text
stringlengths 2
100k
| meta
dict |
---|---|
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
/**
* The "operations" collection of methods.
* Typical usage is:
* <code>
* $spannerService = new Google_Service_Spanner(...);
* $operations = $spannerService->operations;
* </code>
*/
class Google_Service_Spanner_Resource_ProjectsInstancesBackupsOperations extends Google_Service_Resource
{
/**
* Starts asynchronous cancellation on a long-running operation. The server
* makes a best effort to cancel the operation, but success is not guaranteed.
* If the server doesn't support this method, it returns
* `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or
* other methods to check whether the cancellation succeeded or whether the
* operation completed despite cancellation. On successful cancellation, the
* operation is not deleted; instead, it becomes an operation with an
* Operation.error value with a google.rpc.Status.code of 1, corresponding to
* `Code.CANCELLED`. (operations.cancel)
*
* @param string $name The name of the operation resource to be cancelled.
* @param array $optParams Optional parameters.
* @return Google_Service_Spanner_SpannerEmpty
*/
public function cancel($name, $optParams = array())
{
$params = array('name' => $name);
$params = array_merge($params, $optParams);
return $this->call('cancel', array($params), "Google_Service_Spanner_SpannerEmpty");
}
/**
* Deletes a long-running operation. This method indicates that the client is no
* longer interested in the operation result. It does not cancel the operation.
* If the server doesn't support this method, it returns
* `google.rpc.Code.UNIMPLEMENTED`. (operations.delete)
*
* @param string $name The name of the operation resource to be deleted.
* @param array $optParams Optional parameters.
* @return Google_Service_Spanner_SpannerEmpty
*/
public function delete($name, $optParams = array())
{
$params = array('name' => $name);
$params = array_merge($params, $optParams);
return $this->call('delete', array($params), "Google_Service_Spanner_SpannerEmpty");
}
/**
* Gets the latest state of a long-running operation. Clients can use this
* method to poll the operation result at intervals as recommended by the API
* service. (operations.get)
*
* @param string $name The name of the operation resource.
* @param array $optParams Optional parameters.
* @return Google_Service_Spanner_Operation
*/
public function get($name, $optParams = array())
{
$params = array('name' => $name);
$params = array_merge($params, $optParams);
return $this->call('get', array($params), "Google_Service_Spanner_Operation");
}
/**
* Lists operations that match the specified filter in the request. If the
* server doesn't support this method, it returns `UNIMPLEMENTED`.
*
* NOTE: the `name` binding allows API services to override the binding to use
* different resource name schemes, such as `users/operations`. To override the
* binding, API services can add a binding such as
* `"/v1/{name=users}/operations"` to their service configuration. For backwards
* compatibility, the default name includes the operations collection id,
* however overriding users must ensure the name binding is the parent resource,
* without the operations collection id.
* (operations.listProjectsInstancesBackupsOperations)
*
* @param string $name The name of the operation's parent resource.
* @param array $optParams Optional parameters.
*
* @opt_param string filter The standard list filter.
* @opt_param string pageToken The standard list page token.
* @opt_param int pageSize The standard list page size.
* @return Google_Service_Spanner_ListOperationsResponse
*/
public function listProjectsInstancesBackupsOperations($name, $optParams = array())
{
$params = array('name' => $name);
$params = array_merge($params, $optParams);
return $this->call('list', array($params), "Google_Service_Spanner_ListOperationsResponse");
}
}
|
{
"pile_set_name": "Github"
}
|
<?php
class HTMLPurifier_Printer_CSSDefinition extends HTMLPurifier_Printer
{
/**
* @type HTMLPurifier_CSSDefinition
*/
protected $def;
/**
* @param HTMLPurifier_Config $config
* @return string
*/
public function render($config)
{
$this->def = $config->getCSSDefinition();
$ret = '';
$ret .= $this->start('div', array('class' => 'HTMLPurifier_Printer'));
$ret .= $this->start('table');
$ret .= $this->element('caption', 'Properties ($info)');
$ret .= $this->start('thead');
$ret .= $this->start('tr');
$ret .= $this->element('th', 'Property', array('class' => 'heavy'));
$ret .= $this->element('th', 'Definition', array('class' => 'heavy', 'style' => 'width:auto;'));
$ret .= $this->end('tr');
$ret .= $this->end('thead');
ksort($this->def->info);
foreach ($this->def->info as $property => $obj) {
$name = $this->getClass($obj, 'AttrDef_');
$ret .= $this->row($property, $name);
}
$ret .= $this->end('table');
$ret .= $this->end('div');
return $ret;
}
}
// vim: et sw=4 sts=4
|
{
"pile_set_name": "Github"
}
|
1
164
464
764
1064
1144
1387
1527
1664
1757
1971
2090
2101
2124
2128
2129
2187
2372
2556
2667
2756
2932
3099
3206
3506
3512
3599
3772
3919
4017
4082
4123
4125
4126
4127
4136
4157
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright (C) 1999-2011 Insight Software Consortium
* Copyright (C) 2005-2020 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* 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.
*/
#ifndef otbPersistentImageToVectorDataFilter_h
#define otbPersistentImageToVectorDataFilter_h
#include "otbPersistentImageFilter.h"
#include "itkExtractImageFilter.h"
#include "otbConcatenateVectorDataFilter.h"
#include "otbOGRVectorDataIO.h"
#include "itkMacro.h"
#include <string>
namespace otb
{
/** \class PersistentImageToVectorDataFilter
* \brief Perform vectorization in a persistent way.
*
* This filter is a generic PersistentImageFilter, which encapsulate any filter
* which produces VectorData from an input Image.
*
* It provides a default implementation which merge
* the VectorData from the different tiles/strips used during streaming into
* a single VectorData, which can be accessed via GetVectorData()
*
* \sa PersistentImageFilter
*
*
* \ingroup OTBConversion
*/
template <class TImage, class TOutputVectorData>
class ITK_EXPORT PersistentImageToVectorDataFilter : public PersistentImageFilter<TImage, TImage>
{
public:
/** Standard Self typedef */
typedef PersistentImageToVectorDataFilter Self;
typedef PersistentImageFilter<TImage, TImage> Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Runtime information support. */
itkTypeMacro(PersistentImageToVectorDataFilter, PersistentImageFilter);
typedef TImage InputImageType;
typedef typename InputImageType::Pointer InputImagePointer;
typedef typename InputImageType::RegionType RegionType;
typedef typename InputImageType::SizeType SizeType;
typedef typename InputImageType::IndexType IndexType;
typedef typename InputImageType::PixelType PixelType;
typedef typename InputImageType::InternalPixelType InternalPixelType;
typedef TOutputVectorData OutputVectorDataType;
typedef typename TOutputVectorData::Pointer OutputVectorDataPointerType;
typedef itk::ExtractImageFilter<InputImageType, InputImageType> ExtractImageFilterType;
typedef typename ExtractImageFilterType::Pointer ExtractImageFilterPointerType;
typedef otb::ConcatenateVectorDataFilter<OutputVectorDataType> ConcatenateVectorDataFilterType;
typedef typename ConcatenateVectorDataFilterType::Pointer ConcatenateVectorDataFilterPointerType;
typedef otb::OGRVectorDataIO OGRVectorDataIOType;
typedef typename OGRVectorDataIOType::Pointer OGRVectorDataIOPointerType;
/** Smart Pointer type to a DataObject. */
typedef itk::DataObject::Pointer DataObjectPointer;
OutputVectorDataType* GetOutputVectorData() const;
void AllocateOutputs() override;
void Reset(void) override;
void Synthetize(void) override;
/** Specify the name of the output shapefile to write. */
itkSetStringMacro(FileName);
itkGetStringMacro(FileName);
protected:
PersistentImageToVectorDataFilter();
~PersistentImageToVectorDataFilter() override
{
}
void PrintSelf(std::ostream& os, itk::Indent indent) const override;
void GenerateData() override;
ExtractImageFilterPointerType m_ExtractFilter;
OutputVectorDataPointerType m_OutputVectorData;
private:
PersistentImageToVectorDataFilter(const Self&) = delete;
void operator=(const Self&) = delete;
virtual OutputVectorDataPointerType ProcessTile() = 0;
OGRVectorDataIOPointerType m_VectorDataIO;
std::string m_FileName;
}; // end of class
} // end namespace otb
#ifndef OTB_MANUAL_INSTANTIATION
#include "otbPersistentImageToVectorDataFilter.hxx"
#endif
#endif
|
{
"pile_set_name": "Github"
}
|
////////////////////////////////////////////////////////////////////
//
// Copyright Vicente J. Botet Escriba 2010
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
//
////////////////////////////////////////////////////////////////////
#ifndef BOOST_MPL_LCM_HPP_INCLUDED
#define BOOST_MPL_LCM_HPP_INCLUDED
#include <boost/mpl/integral_c.hpp>
#include <boost/ratio/detail/mpl/abs.hpp>
#include <boost/mpl/aux_/largest_int.hpp>
#include <boost/mpl/aux_/na_spec.hpp>
#include <boost/mpl/aux_/lambda_support.hpp>
#include <boost/mpl/aux_/config/integral.hpp>
#include <boost/mpl/aux_/config/static_constant.hpp>
#include <boost/mpl/aux_/config/dependent_nttp.hpp>
#include <boost/cstdint.hpp>
#if !defined(BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2) \
&& !defined(BOOST_MPL_PREPROCESSING_MODE) \
&& !defined(__CUDACC__) \
&& ( defined(BOOST_MSVC) \
|| BOOST_WORKAROUND(__EDG_VERSION__, <= 238) \
)
# define BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2
#endif
namespace boost { namespace mpl {
template< typename Tag1, typename Tag2 > struct lcm_impl;
template< typename T > struct lcm_tag
{
typedef typename T::tag type;
};
template<
typename BOOST_MPL_AUX_NA_PARAM(N1)
, typename BOOST_MPL_AUX_NA_PARAM(N2)
>
struct lcm
: lcm_impl<
typename lcm_tag<N1>::type
, typename lcm_tag<N2>::type
>::template apply<N1, N2>::type
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(2, lcm, (N1, N2))
};
BOOST_MPL_AUX_NA_SPEC(2, lcm)
template<
typename T
, T n1
, T n2
>
struct lcm_c
: lcm<integral_c<T,n1>,integral_c<T,n2> >
{
};
namespace aux {
// Workaround for error: the type of partial specialization template parameter constant "n2"
// depends on another template parameter
// Note: this solution could be wrong for n1 or n2 = [2**63 .. 2**64-1]
#if defined(BOOST_MPL_CFG_NO_DEPENDENT_NONTYPE_PARAMETER_IN_PARTIAL_SPEC)
template< typename T1, boost::intmax_t n1, bool n1_is_0
, typename T2, boost::intmax_t n2, bool n2_is_0 >
struct lcm_aux
: abs<integral_c< typename aux::largest_int<T1, T2>::type,
( n1 / gcd<integral_c<T1,n1>, integral_c<T2,n2> >::value * n2 )
> >
{};
template <typename T1, boost::intmax_t n1, typename T2, boost::intmax_t n2>
struct lcm_aux<T1, n1, false, T2, n2, true> : integral_c<T2, 0>
{};
template <typename T1, boost::intmax_t n1, typename T2, boost::intmax_t n2, bool C>
struct lcm_aux<T1, n1, true, T2, n2, C> : integral_c<T1, 0>
{};
#else // defined(BOOST_MPL_CFG_NO_DEPENDENT_NONTYPE_PARAMETER_IN_PARTIAL_SPEC)
template< typename T1, T1 n1, bool n1_is_0, typename T2, T2 n2, bool n2_is_0 >
struct lcm_aux
: abs<integral_c< typename aux::largest_int<T1, T2>::type,
( n1 / gcd<integral_c<T1,n1>, integral_c<T2,n2> >::value * n2 )
> >
{};
template <typename T1, T1 n1, typename T2, T2 n2>
struct lcm_aux<T1, n1, false, T2, n2, true> : integral_c<T2, 0>
{};
template <typename T1, T1 n1, typename T2, T2 n2, bool C>
struct lcm_aux<T1, n1, true, T2, n2, C> : integral_c<T1, 0>
{};
#endif // defined(BOOST_MPL_CFG_NO_DEPENDENT_NONTYPE_PARAMETER_IN_PARTIAL_SPEC)
}
template<>
struct lcm_impl<integral_c_tag, integral_c_tag>
{
template< typename N1, typename N2 > struct apply
: abs<aux::lcm_aux< typename N1::value_type, N1::value, N1::value==0,
typename N2::value_type, N2::value, N2::value==0 > >
{
};
};
}}
#endif // BOOST_MPL_LCM_HPP_INCLUDED
|
{
"pile_set_name": "Github"
}
|
# H4ckIT CTF 2016 : code-name-10
**Category:** quiz
**Points:** 10
**Solves:**
**Description:**
Columbia
> Code name of CVE-2014-0160? h4ck1t{answer(lowercase)}
## Write-up
Those familiar with common vulnerabilities and CVE identifiers may be able to recognize it on the spot, but Googling "CVE-2015-0160" leads you to the CVE entry, which in the description is labeled as Heartbleed.
## Other write-ups and resources
* none yet
|
{
"pile_set_name": "Github"
}
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Base class for helicopters & helicopter-type vehicles
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "ai_network.h"
#include "ai_default.h"
#include "ai_schedule.h"
#include "ai_hull.h"
#include "ai_node.h"
#include "ai_task.h"
#include "ai_senses.h"
#include "ai_memory.h"
#include "entitylist.h"
#include "soundenvelope.h"
#include "gamerules.h"
#include "grenade_homer.h"
#include "ndebugoverlay.h"
#include "cbasehelicopter.h"
#include "soundflags.h"
#include "rope.h"
#include "saverestore_utlvector.h"
#include "collisionutils.h"
#include "coordsize.h"
#include "effects.h"
#include "rotorwash.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
void ExpandBBox(Vector &vecMins, Vector &vecMaxs);
#if 0
virtual void NullThink( void );
#endif //0
#define HELICOPTER_THINK_INTERVAL 0.1
#define HELICOPTER_ROTORWASH_THINK_INTERVAL 0.01
#define BASECHOPPER_DEBUG_WASH 1
ConVar g_debug_basehelicopter( "g_debug_basehelicopter", "0", FCVAR_CHEAT );
//---------------------------------------------------------
//---------------------------------------------------------
// TODOs
//
// -Member function: CHANGE MOVE GOAL
//
// -Member function: GET GRAVITY (or GetMaxThrust)
//
//---------------------------------------------------------
//---------------------------------------------------------
static const char *s_pRotorWashThinkContext = "RotorWashThink";
static const char *s_pDelayedKillThinkContext = "DelayedKillThink";
//------------------------------------------------------------------------------
// Purpose :
// Input :
// Output :
//------------------------------------------------------------------------------
BEGIN_DATADESC_NO_BASE( washentity_t )
DEFINE_FIELD( hEntity, FIELD_EHANDLE ),
DEFINE_FIELD( flWashStartTime, FIELD_TIME ),
END_DATADESC()
BEGIN_DATADESC( CBaseHelicopter )
DEFINE_THINKFUNC( HelicopterThink ),
DEFINE_THINKFUNC( RotorWashThink ),
DEFINE_THINKFUNC( CallDyingThink ),
DEFINE_THINKFUNC( DelayedKillThink ),
DEFINE_ENTITYFUNC( CrashTouch ),
DEFINE_ENTITYFUNC( FlyTouch ),
DEFINE_SOUNDPATCH( m_pRotorSound ),
DEFINE_SOUNDPATCH( m_pRotorBlast ),
DEFINE_FIELD( m_flForce, FIELD_FLOAT ),
DEFINE_FIELD( m_fHelicopterFlags, FIELD_INTEGER),
DEFINE_FIELD( m_vecDesiredFaceDir, FIELD_VECTOR ),
DEFINE_FIELD( m_flLastSeen, FIELD_TIME ),
DEFINE_FIELD( m_flPrevSeen, FIELD_TIME ),
// DEFINE_FIELD( m_iSoundState, FIELD_INTEGER ), // Don't save, precached
DEFINE_FIELD( m_vecTargetPosition, FIELD_POSITION_VECTOR ),
DEFINE_FIELD( m_hRotorWash, FIELD_EHANDLE ),
DEFINE_FIELD( m_flMaxSpeed, FIELD_FLOAT ),
DEFINE_FIELD( m_flMaxSpeedFiring, FIELD_FLOAT ),
DEFINE_FIELD( m_flGoalSpeed, FIELD_FLOAT ),
DEFINE_KEYFIELD( m_flInitialSpeed, FIELD_FLOAT, "InitialSpeed" ),
DEFINE_FIELD( m_flRandomOffsetTime, FIELD_TIME ),
DEFINE_FIELD( m_vecRandomOffset, FIELD_VECTOR ),
DEFINE_FIELD( m_flRotorWashEntitySearchTime, FIELD_TIME ),
DEFINE_FIELD( m_bSuppressSound, FIELD_BOOLEAN ),
DEFINE_FIELD( m_flStartupTime, FIELD_TIME ),
DEFINE_FIELD( m_cullBoxMins, FIELD_VECTOR ),
DEFINE_FIELD( m_cullBoxMaxs, FIELD_VECTOR ),
DEFINE_UTLVECTOR( m_hEntitiesPushedByWash, FIELD_EMBEDDED ),
// Inputs
DEFINE_INPUTFUNC( FIELD_VOID, "Activate", InputActivate),
DEFINE_INPUTFUNC( FIELD_VOID, "GunOn", InputGunOn ),
DEFINE_INPUTFUNC( FIELD_VOID, "GunOff", InputGunOff ),
DEFINE_INPUTFUNC( FIELD_VOID, "MissileOn", InputMissileOn ),
DEFINE_INPUTFUNC( FIELD_VOID, "MissileOff", InputMissileOff ),
DEFINE_INPUTFUNC( FIELD_VOID, "EnableRotorWash", InputEnableRotorWash ),
DEFINE_INPUTFUNC( FIELD_VOID, "DisableRotorWash", InputDisableRotorWash ),
DEFINE_INPUTFUNC( FIELD_VOID, "MoveTopSpeed", InputMoveTopSpeed ),
DEFINE_INPUTFUNC( FIELD_FLOAT, "MoveSpecifiedSpeed", InputMoveSpecifiedSpeed ),
DEFINE_INPUTFUNC( FIELD_STRING, "SetAngles", InputSetAngles ),
DEFINE_INPUTFUNC( FIELD_VOID, "EnableRotorSound", InputEnableRotorSound ),
DEFINE_INPUTFUNC( FIELD_VOID, "DisableRotorSound", InputDisableRotorSound ),
DEFINE_INPUTFUNC( FIELD_VOID, "Kill", InputKill ),
END_DATADESC()
IMPLEMENT_SERVERCLASS_ST( CBaseHelicopter, DT_BaseHelicopter )
SendPropTime( SENDINFO( m_flStartupTime ) ),
END_SEND_TABLE()
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CBaseHelicopter::CBaseHelicopter( void )
{
m_cullBoxMins = vec3_origin;
m_cullBoxMaxs = vec3_origin;
m_hRotorWash = NULL;
}
//------------------------------------------------------------------------------
// Purpose :
// Input :
// Output :
// Notes : Have your derived Helicopter's Spawn() function call this one FIRST
//------------------------------------------------------------------------------
void CBaseHelicopter::Precache( void )
{
}
//------------------------------------------------------------------------------
// Purpose :
// Input :
// Output :
// Notes : Have your derived Helicopter's Spawn() function call this one FIRST
//------------------------------------------------------------------------------
void CBaseHelicopter::Spawn( void )
{
Precache( );
SetSolid( SOLID_BBOX );
SetMoveType( MOVETYPE_STEP );
AddFlag( FL_FLY );
SetState( NPC_STATE_IDLE );
m_lifeState = LIFE_ALIVE;
// motor
//******
// All of this stuff is specific to the individual type of aircraft. Handle it yourself.
//******
// m_iAmmoType = g_pGameRules->GetAmmoDef()->Index("AR2");
// SetModel( "models/attack_helicopter.mdl" );
// UTIL_SetSize( this, Vector( -32, -32, -64 ), Vector( 32, 32, 0 ) );
// UTIL_SetOrigin( this, GetLocalOrigin() );
// m_iHealth = 100;
// m_flFieldOfView = -0.707; // 270 degrees
// InitBoneControllers();
// m_iRockets = 10;
// Get the rotor sound started up.
// This base class assumes the helicopter has no guns or missiles.
// Set the appropriate flags in your derived class' Spawn() function.
m_fHelicopterFlags &= ~BITS_HELICOPTER_MISSILE_ON;
m_fHelicopterFlags &= ~BITS_HELICOPTER_GUN_ON;
m_pRotorSound = NULL;
m_pRotorBlast = NULL;
SetCycle( 0 );
ResetSequenceInfo();
AddFlag( FL_NPC );
m_flMaxSpeed = BASECHOPPER_MAX_SPEED;
m_flMaxSpeedFiring = BASECHOPPER_MAX_FIRING_SPEED;
m_takedamage = DAMAGE_AIM;
// Don't start up if the level designer has asked the
// helicopter to start disabled.
if ( !(m_spawnflags & SF_AWAITINPUT) )
{
Startup();
SetNextThink( gpGlobals->curtime + 1.0f );
}
else
{
m_flStartupTime = FLT_MAX;
}
InitPathingData( 0, BASECHOPPER_MIN_CHASE_DIST_DIFF, BASECHOPPER_AVOID_DIST );
// Setup collision hull
ExpandBBox( m_cullBoxMins, m_cullBoxMaxs );
CollisionProp()->SetSurroundingBoundsType( USE_SPECIFIED_BOUNDS, &m_cullBoxMins, &m_cullBoxMaxs );
AddSolidFlags( FSOLID_CUSTOMRAYTEST | FSOLID_CUSTOMBOXTEST );
m_flRandomOffsetTime = -1.0f;
m_vecRandomOffset.Init( 0, 0, 0 );
}
//------------------------------------------------------------------------------
// Cleanup
//------------------------------------------------------------------------------
void CBaseHelicopter::UpdateOnRemove()
{
StopRotorWash();
BaseClass::UpdateOnRemove();
}
//------------------------------------------------------------------------------
// Gets the max speed of the helicopter
//------------------------------------------------------------------------------
float CBaseHelicopter::GetMaxSpeed()
{
// If our last path_track has specified a speed, use that instead of ours
if ( GetPathMaxSpeed() )
return GetPathMaxSpeed();
return m_flMaxSpeed;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
float CBaseHelicopter::GetMaxSpeedFiring()
{
// If our last path_track has specified a speed, use that instead of ours
if ( GetPathMaxSpeed() )
return GetPathMaxSpeed();
return m_flMaxSpeedFiring;
}
//------------------------------------------------------------------------------
// Enemy methods
//------------------------------------------------------------------------------
bool CBaseHelicopter::GetTrackPatherTarget( Vector *pPos )
{
if ( GetEnemy() )
{
*pPos = GetEnemy()->BodyTarget( GetAbsOrigin(), false );
return true;
}
return false;
}
CBaseEntity *CBaseHelicopter::GetTrackPatherTargetEnt()
{
return GetEnemy();
}
//------------------------------------------------------------------------------
// Purpose :
// Input :
// Output :
//------------------------------------------------------------------------------
bool CBaseHelicopter::FireGun( void )
{
return true;
}
//------------------------------------------------------------------------------
// Purpose : The main think function for the helicopters
// Input :
// Output :
//------------------------------------------------------------------------------
void CBaseHelicopter::HelicopterThink( void )
{
CheckPVSCondition();
SetNextThink( gpGlobals->curtime + HELICOPTER_THINK_INTERVAL );
// Don't keep this around for more than one frame.
ClearCondition( COND_ENEMY_DEAD );
// Animate and dispatch animation events.
StudioFrameAdvance( );
DispatchAnimEvents( this );
PrescheduleThink();
if ( IsMarkedForDeletion() )
return;
ShowDamage( );
// -----------------------------------------------
// If AI is disabled, kill any motion and return
// -----------------------------------------------
if (CAI_BaseNPC::m_nDebugBits & bits_debugDisableAI)
{
SetAbsVelocity( vec3_origin );
SetLocalAngularVelocity( vec3_angle );
SetNextThink( gpGlobals->curtime + HELICOPTER_THINK_INTERVAL );
return;
}
Hunt();
// Finally, forget dead enemies, or ones we've been told to ignore.
if( GetEnemy() != NULL && (!GetEnemy()->IsAlive() || GetEnemy()->GetFlags() & FL_NOTARGET || IRelationType( GetEnemy() ) == D_NU ) )
{
SetEnemy( NULL );
}
HelicopterPostThink();
}
//-----------------------------------------------------------------------------
// Rotor wash think
//-----------------------------------------------------------------------------
void CBaseHelicopter::RotorWashThink( void )
{
if ( m_lifeState == LIFE_ALIVE || m_lifeState == LIFE_DYING )
{
DrawRotorWash( BASECHOPPER_WASH_ALTITUDE, GetAbsOrigin() );
SetContextThink( &CBaseHelicopter::RotorWashThink, gpGlobals->curtime + HELICOPTER_ROTORWASH_THINK_INTERVAL, s_pRotorWashThinkContext );
}
else
{
SetContextThink( NULL, gpGlobals->curtime, s_pRotorWashThinkContext );
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseHelicopter::DrawRotorWash( float flAltitude, const Vector &vecRotorOrigin )
{
// Shake any ropes nearby
if ( random->RandomInt( 0, 2 ) == 0 )
{
CRopeKeyframe::ShakeRopes( GetAbsOrigin(), flAltitude, 128 );
}
if ( m_spawnflags & SF_NOROTORWASH )
return;
DoRotorPhysicsPush( vecRotorOrigin, flAltitude );
if ( m_flRotorWashEntitySearchTime > gpGlobals->curtime )
return;
// Only push every half second
m_flRotorWashEntitySearchTime = gpGlobals->curtime + 0.5f;
}
//-----------------------------------------------------------------------------
// Purpose: Push an airboat in our wash
//-----------------------------------------------------------------------------
#define MAX_AIRBOAT_ROLL_ANGLE 20.0f
#define MAX_AIRBOAT_ROLL_COSANGLE 0.866f
#define MAX_AIRBOAT_ROLL_COSANGLE_X2 0.5f
void CBaseHelicopter::DoWashPushOnAirboat( CBaseEntity *pAirboat,
const Vector &vecWashToAirboat, float flWashAmount )
{
// For the airboat, simply produce a small roll and a push outwards.
// But don't produce a roll if we're too rolled in that direction already.
// Get the actual up direction vector
Vector vecUp;
pAirboat->GetVectors( NULL, NULL, &vecUp );
if ( vecUp.z < MAX_AIRBOAT_ROLL_COSANGLE )
return;
// Compute roll direction so that we get pushed down on the side where the rotor wash is.
Vector vecRollNormal;
CrossProduct( vecWashToAirboat, Vector( 0, 0, 1 ), vecRollNormal );
// Project it into the plane of the roll normal
VectorMA( vecUp, -DotProduct( vecUp, vecRollNormal ), vecRollNormal, vecUp );
VectorNormalize( vecUp );
// Compute a vector which is the max direction we can roll given the roll constraint
Vector vecExtremeUp;
VMatrix rot;
MatrixBuildRotationAboutAxis( rot, vecRollNormal, MAX_AIRBOAT_ROLL_ANGLE );
MatrixGetColumn( rot, 2, &vecExtremeUp );
// Find the angle between how vertical we are and how vertical we should be
float flCosDelta = DotProduct( vecExtremeUp, vecUp );
float flDelta = acos(flCosDelta) * 180.0f / M_PI;
flDelta = clamp( flDelta, 0.0f, MAX_AIRBOAT_ROLL_ANGLE );
flDelta = SimpleSplineRemapVal( flDelta, 0.0f, MAX_AIRBOAT_ROLL_ANGLE, 0.0f, 1.0f );
float flForce = 12.0f * flWashAmount * flDelta;
Vector vecWashOrigin;
Vector vecForce;
VectorMultiply( Vector( 0, 0, -1 ), flForce, vecForce );
VectorMA( pAirboat->GetAbsOrigin(), -200.0f, vecWashToAirboat, vecWashOrigin );
pAirboat->VPhysicsTakeDamage( CTakeDamageInfo( this, this, vecForce, vecWashOrigin, flWashAmount, DMG_BLAST ) );
}
//-----------------------------------------------------------------------------
// Purpose: Push a physics object in our wash. Return false if it's now out of our wash
//-----------------------------------------------------------------------------
bool CBaseHelicopter::DoWashPush( washentity_t *pWash, const Vector &vecWashOrigin )
{
if ( !pWash || !pWash->hEntity.Get() )
return false;
// Make sure the entity is still within our wash's radius
CBaseEntity *pEntity = pWash->hEntity;
// This can happen because we can dynamically turn this flag on and off
if ( pEntity->IsEFlagSet( EFL_NO_ROTORWASH_PUSH ))
return false;
Vector vecSpot = pEntity->BodyTarget( vecWashOrigin );
Vector vecToSpot = ( vecSpot - vecWashOrigin );
vecToSpot.z = 0;
float flDist = VectorNormalize( vecToSpot );
if ( flDist > BASECHOPPER_WASH_RADIUS )
return false;
IRotorWashShooter *pShooter = GetRotorWashShooter( pEntity );
IPhysicsObject *pPhysObject;
float flPushTime = (gpGlobals->curtime - pWash->flWashStartTime);
flPushTime = clamp( flPushTime, 0, BASECHOPPER_WASH_RAMP_TIME );
float flWashAmount = RemapVal( flPushTime, 0, BASECHOPPER_WASH_RAMP_TIME, BASECHOPPER_WASH_PUSH_MIN, BASECHOPPER_WASH_PUSH_MAX );
if ( pShooter )
{
Vector vecForce = (0.015f / 0.1f) * flWashAmount * vecToSpot * phys_pushscale.GetFloat();
pEntity = pShooter->DoWashPush( pWash->flWashStartTime, vecForce );
if ( !pEntity )
return true;
washentity_t Wash;
Wash.hEntity = pEntity;
Wash.flWashStartTime = pWash->flWashStartTime;
int i = m_hEntitiesPushedByWash.AddToTail( Wash );
pWash = &m_hEntitiesPushedByWash[i];
pPhysObject = pEntity->VPhysicsGetObject();
if ( !pPhysObject )
return true;
}
else
{
// Airboat gets special treatment
if ( FClassnameIs( pEntity, "prop_vehicle_airboat" ) )
{
DoWashPushOnAirboat( pEntity, vecToSpot, flWashAmount );
return true;
}
pPhysObject = pEntity->VPhysicsGetObject();
if ( !pPhysObject )
return false;
}
// Push it away from the center of the wash
float flMass = pPhysObject->GetMass();
// This used to be mass independent, which is a bad idea because it blows 200kg engine blocks
// as much as it blows cardboard and soda cans. Make this force mass-independent, but clamp at
// 30kg.
flMass = MIN( flMass, 30.0f );
Vector vecForce = (0.015f / 0.1f) * flWashAmount * flMass * vecToSpot * phys_pushscale.GetFloat();
pEntity->VPhysicsTakeDamage( CTakeDamageInfo( this, this, vecForce, vecWashOrigin, flWashAmount, DMG_BLAST ) );
// Debug
if ( g_debug_basehelicopter.GetInt() == BASECHOPPER_DEBUG_WASH )
{
NDebugOverlay::Cross3D( pEntity->GetAbsOrigin(), -Vector(4,4,4), Vector(4,4,4), 255, 0, 0, true, 0.1f );
NDebugOverlay::Line( pEntity->GetAbsOrigin(), pEntity->GetAbsOrigin() + vecForce, 255, 255, 0, true, 0.1f );
IPhysicsObject *pPhysObject = pEntity->VPhysicsGetObject();
Msg("Pushed %s (index %d) (mass %f) with force %f (min %.2f max %.2f) at time %.2f\n",
pEntity->GetClassname(), pEntity->entindex(), pPhysObject->GetMass(), flWashAmount,
BASECHOPPER_WASH_PUSH_MIN * flMass, BASECHOPPER_WASH_PUSH_MAX * flMass, gpGlobals->curtime );
}
// If we've pushed this thing for some time, remove it to give us a chance to find lighter things nearby
if ( flPushTime > 2.0 )
return false;
return true;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseHelicopter::DoRotorPhysicsPush( const Vector &vecRotorOrigin, float flAltitude )
{
CBaseEntity *pEntity = NULL;
trace_t tr;
// First, trace down and find out where the was is hitting the ground
UTIL_TraceLine( vecRotorOrigin, vecRotorOrigin+Vector(0,0,-flAltitude), (MASK_SOLID_BRUSHONLY|CONTENTS_WATER), NULL, COLLISION_GROUP_NONE, &tr );
// Always raise the physics origin a bit
Vector vecPhysicsOrigin = tr.endpos + Vector(0,0,64);
// Debug
if ( g_debug_basehelicopter.GetInt() == BASECHOPPER_DEBUG_WASH )
{
NDebugOverlay::Cross3D( vecPhysicsOrigin, -Vector(16,16,16), Vector(16,16,16), 0, 255, 255, true, 0.1f );
}
// Push entities that we've pushed before, and are still within range
// Walk backwards because they may be removed if they're now out of range
int iCount = m_hEntitiesPushedByWash.Count();
bool bWasPushingObjects = (iCount > 0);
for ( int i = (iCount-1); i >= 0; i-- )
{
if ( !DoWashPush( &(m_hEntitiesPushedByWash[i]), vecPhysicsOrigin ) )
{
// Out of range now, so remove
m_hEntitiesPushedByWash.Remove(i);
}
}
if ( m_flRotorWashEntitySearchTime > gpGlobals->curtime )
return;
// Any spare slots?
iCount = m_hEntitiesPushedByWash.Count();
if ( iCount >= BASECHOPPER_WASH_MAX_OBJECTS )
return;
// Find the lightest physics entity below us and add it to our list to push around
CBaseEntity *pLightestEntity = NULL;
float flLightestMass = 9999;
while ((pEntity = gEntList.FindEntityInSphere(pEntity, vecPhysicsOrigin, BASECHOPPER_WASH_RADIUS )) != NULL)
{
IRotorWashShooter *pShooter = GetRotorWashShooter( pEntity );
if ( pEntity->IsEFlagSet( EFL_NO_ROTORWASH_PUSH ))
continue;
if ( pShooter || pEntity->GetMoveType() == MOVETYPE_VPHYSICS || (pEntity->VPhysicsGetObject() && !pEntity->IsPlayer()) )
{
// Make sure it's not already in our wash
bool bAlreadyPushing = false;
for ( int i = 0; i < iCount; i++ )
{
if ( m_hEntitiesPushedByWash[i].hEntity == pEntity )
{
bAlreadyPushing = true;
break;
}
}
if ( bAlreadyPushing )
continue;
float flMass = FLT_MAX;
if ( pShooter )
{
flMass = 1.0f;
}
else
{
// Don't try to push anything too big
IPhysicsObject *pPhysObject = pEntity->VPhysicsGetObject();
if ( pPhysObject )
{
flMass = pPhysObject->GetMass();
if ( flMass > BASECHOPPER_WASH_MAX_MASS )
continue;
}
}
// Ignore anything bigger than the one we've already found
if ( flMass > flLightestMass )
continue;
Vector vecSpot = pEntity->BodyTarget( vecPhysicsOrigin );
// Don't push things too far below our starting point (helps reduce through-roof cases w/o doing a trace)
if ( fabs( vecSpot.z - vecPhysicsOrigin.z ) > 96 )
continue;
Vector vecToSpot = ( vecSpot - vecPhysicsOrigin );
vecToSpot.z = 0;
float flDist = VectorNormalize( vecToSpot );
if ( flDist > BASECHOPPER_WASH_RADIUS )
continue;
// Try to cast to the helicopter; if we can't, then we can't be hit.
if ( pEntity->GetServerVehicle() )
{
UTIL_TraceLine( vecSpot, vecPhysicsOrigin, MASK_SOLID_BRUSHONLY, pEntity, COLLISION_GROUP_NONE, &tr );
if ( tr.fraction != 1.0f )
continue;
}
flLightestMass = flMass;
pLightestEntity = pEntity;
washentity_t Wash;
Wash.hEntity = pLightestEntity;
Wash.flWashStartTime = gpGlobals->curtime;
m_hEntitiesPushedByWash.AddToTail( Wash );
// Can we fit more after adding this one? No? Then we are done.
iCount = m_hEntitiesPushedByWash.Count();
if ( iCount >= BASECHOPPER_WASH_MAX_OBJECTS )
break;
}
}
// Handle sound.
// If we just started pushing objects, ramp the blast sound up.
if ( !bWasPushingObjects && m_hEntitiesPushedByWash.Count() )
{
if ( m_pRotorBlast )
{
CSoundEnvelopeController &controller = CSoundEnvelopeController::GetController();
controller.SoundChangeVolume( m_pRotorBlast, 1.0, 1.0 );
}
}
else if ( bWasPushingObjects && m_hEntitiesPushedByWash.Count() == 0 )
{
if ( m_pRotorBlast )
{
// We just stopped pushing objects, so fade the blast sound out.
CSoundEnvelopeController &controller = CSoundEnvelopeController::GetController();
controller.SoundChangeVolume( m_pRotorBlast, 0, 1.0 );
}
}
}
//------------------------------------------------------------------------------
// Updates the enemy
//------------------------------------------------------------------------------
float CBaseHelicopter::EnemySearchDistance( )
{
return 4092;
}
//------------------------------------------------------------------------------
// Updates the enemy
//------------------------------------------------------------------------------
void CBaseHelicopter::UpdateEnemy()
{
if( HasCondition( COND_ENEMY_DEAD ) )
{
SetEnemy( NULL );
}
// Look for my best enemy. If I change enemies,
// be sure and change my prevseen/lastseen timers.
if( m_lifeState == LIFE_ALIVE )
{
GetSenses()->Look( EnemySearchDistance() );
GetEnemies()->RefreshMemories();
ChooseEnemy();
if( HasEnemy() )
{
CBaseEntity *pEnemy = GetEnemy();
GatherEnemyConditions( pEnemy );
if ( FVisible( pEnemy ) )
{
if (m_flLastSeen < gpGlobals->curtime - 2)
{
m_flPrevSeen = gpGlobals->curtime;
}
m_flLastSeen = gpGlobals->curtime;
m_vecTargetPosition = pEnemy->WorldSpaceCenter();
}
}
else
{
// look at where we're going instead
m_vecTargetPosition = GetDesiredPosition();
}
}
else
{
// If we're dead or dying, forget our enemy and don't look for new ones(sjb)
SetEnemy( NULL );
}
}
//------------------------------------------------------------------------------
// Purpose : Override the desired position if your derived helicopter is doing something special
//------------------------------------------------------------------------------
void CBaseHelicopter::UpdateDesiredPosition( void )
{
}
//------------------------------------------------------------------------------
// Updates the facing direction
//------------------------------------------------------------------------------
void CBaseHelicopter::UpdateFacingDirection()
{
if ( 1 )
{
Vector targetDir = m_vecTargetPosition - GetAbsOrigin();
Vector desiredDir = GetDesiredPosition() - GetAbsOrigin();
VectorNormalize( targetDir );
VectorNormalize( desiredDir );
if ( !IsCrashing() && m_flLastSeen + 5 > gpGlobals->curtime ) //&& DotProduct( targetDir, desiredDir) > 0.25)
{
// If we've seen the target recently, face the target.
//Msg( "Facing Target \n" );
m_vecDesiredFaceDir = targetDir;
}
else
{
// Face our desired position.
// Msg( "Facing Position\n" );
m_vecDesiredFaceDir = desiredDir;
}
}
else
{
// Face the way the path corner tells us to.
//Msg( "Facing my path corner\n" );
m_vecDesiredFaceDir = GetGoalOrientation();
}
}
//------------------------------------------------------------------------------
// Fire weapons
//------------------------------------------------------------------------------
void CBaseHelicopter::FireWeapons()
{
// ALERT( at_console, "%.0f %.0f %.0f\n", gpGlobals->curtime, m_flLastSeen, m_flPrevSeen );
if (m_fHelicopterFlags & BITS_HELICOPTER_GUN_ON)
{
//if ( (m_flLastSeen + 1 > gpGlobals->curtime) && (m_flPrevSeen + 2 < gpGlobals->curtime) )
{
if (FireGun( ))
{
// slow down if we're firing
if (m_flGoalSpeed > GetMaxSpeedFiring() )
{
m_flGoalSpeed = GetMaxSpeedFiring();
}
}
}
}
if (m_fHelicopterFlags & BITS_HELICOPTER_MISSILE_ON)
{
AimRocketGun();
}
}
//------------------------------------------------------------------------------
// Purpose :
// Input :
// Output :
//------------------------------------------------------------------------------
void CBaseHelicopter::Hunt( void )
{
UpdateEnemy();
UpdateTrackNavigation( );
UpdateDesiredPosition();
UpdateFacingDirection();
Flight();
UpdatePlayerDopplerShift( );
FireWeapons();
}
//------------------------------------------------------------------------------
// Purpose :
// Input :
// Output :
//------------------------------------------------------------------------------
void CBaseHelicopter::UpdatePlayerDopplerShift( )
{
// -----------------------------
// make rotor, engine sounds
// -----------------------------
if (m_iSoundState == 0)
{
// Sound startup.
InitializeRotorSound();
}
else
{
CBaseEntity *pPlayer = NULL;
// UNDONE: this needs to send different sounds to every player for multiplayer.
// FIXME: this isn't the correct way to find a player!!!
pPlayer = gEntList.FindEntityByName( NULL, "!player" );
if (pPlayer)
{
Vector dir;
VectorSubtract( pPlayer->GetAbsOrigin(), GetAbsOrigin(), dir );
VectorNormalize(dir);
#if 1
float velReceiver = DotProduct( pPlayer->GetAbsVelocity(), dir );
float velTransmitter = -DotProduct( GetAbsVelocity(), dir );
// speed of sound == 13049in/s
int iPitch = 100 * ((1 - velReceiver / 13049) / (1 + velTransmitter / 13049));
#else
// This is a bogus doppler shift, but I like it better
float relV = DotProduct( GetAbsVelocity() - pPlayer->GetAbsVelocity(), dir );
int iPitch = (int)(100 + relV / 50.0);
#endif
// clamp pitch shifts
if (iPitch > 250)
{
iPitch = 250;
}
if (iPitch < 50)
{
iPitch = 50;
}
UpdateRotorSoundPitch( iPitch );
// Msg( "Pitch:%d\n", iPitch );
}
else
{
Msg( "Chopper didn't find a player!\n" );
}
}
}
//-----------------------------------------------------------------------------
// Computes the actual position to fly to
//-----------------------------------------------------------------------------
void CBaseHelicopter::ComputeActualTargetPosition( float flSpeed, float flTime, float flPerpDist, Vector *pDest, bool bApplyNoise )
{
// This is used to make the helicopter drift around a bit.
if ( bApplyNoise && m_flRandomOffsetTime <= gpGlobals->curtime )
{
m_vecRandomOffset.Random( -25.0f, 25.0f );
m_flRandomOffsetTime = gpGlobals->curtime + 1.0f;
}
if ( IsLeading() && GetEnemy() && IsOnPathTrack() )
{
ComputePointAlongCurrentPath( flSpeed * flTime, flPerpDist, pDest );
*pDest += m_vecRandomOffset;
return;
}
*pDest = GetDesiredPosition() - GetAbsOrigin();
float flDistToDesired = pDest->Length();
if (flDistToDesired > flSpeed * flTime)
{
float scale = flSpeed * flTime / flDistToDesired;
*pDest *= scale;
}
else if ( IsOnPathTrack() )
{
// Blend in a fake destination point based on the dest velocity
Vector vecDestVelocity;
ComputeNormalizedDestVelocity( &vecDestVelocity );
vecDestVelocity *= flSpeed;
float flBlendFactor = 1.0f - flDistToDesired / (flSpeed * flTime);
VectorMA( *pDest, flTime * flBlendFactor, vecDestVelocity, *pDest );
}
*pDest += GetAbsOrigin();
if ( bApplyNoise )
{
// ComputePointAlongCurrentPath( flSpeed * flTime, flPerpDist, pDest );
*pDest += m_vecRandomOffset;
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void CBaseHelicopter::Flight( void )
{
if( GetFlags() & FL_ONGROUND )
{
//This would be really bad.
SetGroundEntity( NULL );
}
// Generic speed up
if (m_flGoalSpeed < GetMaxSpeed())
{
m_flGoalSpeed += GetAcceleration();
}
//NDebugOverlay::Line(GetAbsOrigin(), m_vecDesiredPosition, 0,0,255, true, 0.1);
// tilt model 5 degrees (why?! sjb)
QAngle vecAdj = QAngle( 5.0, 0, 0 );
// estimate where I'll be facing in one seconds
Vector forward, right, up;
AngleVectors( GetLocalAngles() + GetLocalAngularVelocity() * 2 + vecAdj, &forward, &right, &up );
// Vector vecEst1 = GetLocalOrigin() + GetAbsVelocity() + up * m_flForce - Vector( 0, 0, 384 );
// float flSide = DotProduct( m_vecDesiredPosition - vecEst1, right );
QAngle angVel = GetLocalAngularVelocity();
float flSide = DotProduct( m_vecDesiredFaceDir, right );
if (flSide < 0)
{
if (angVel.y < 60)
{
angVel.y += 8;
}
}
else
{
if (angVel.y > -60)
{
angVel.y -= 8;
}
}
angVel.y *= ( 0.98 ); // why?! (sjb)
// estimate where I'll be in two seconds
AngleVectors( GetLocalAngles() + angVel * 1 + vecAdj, NULL, NULL, &up );
Vector vecEst = GetAbsOrigin() + GetAbsVelocity() * 2.0 + up * m_flForce * 20 - Vector( 0, 0, 384 * 2 );
// add immediate force
AngleVectors( GetLocalAngles() + vecAdj, &forward, &right, &up );
Vector vecImpulse( 0, 0, 0 );
vecImpulse.x += up.x * m_flForce;
vecImpulse.y += up.y * m_flForce;
vecImpulse.z += up.z * m_flForce;
// add gravity
vecImpulse.z -= 38.4; // 32ft/sec
ApplyAbsVelocityImpulse( vecImpulse );
float flSpeed = GetAbsVelocity().Length();
float flDir = DotProduct( Vector( forward.x, forward.y, 0 ), Vector( GetAbsVelocity().x, GetAbsVelocity().y, 0 ) );
if (flDir < 0)
{
flSpeed = -flSpeed;
}
float flDist = DotProduct( GetDesiredPosition() - vecEst, forward );
// float flSlip = DotProduct( GetAbsVelocity(), right );
float flSlip = -DotProduct( GetDesiredPosition() - vecEst, right );
// fly sideways
if (flSlip > 0)
{
if (GetLocalAngles().z > -30 && angVel.z > -15)
angVel.z -= 4;
else
angVel.z += 2;
}
else
{
if (GetLocalAngles().z < 30 && angVel.z < 15)
angVel.z += 4;
else
angVel.z -= 2;
}
// These functions contain code Ken wrote that used to be right here as part of the flight model,
// but we want different helicopter vehicles to have different drag characteristics, so I made
// them virtual functions (sjb)
ApplySidewaysDrag( right );
ApplyGeneralDrag();
// apply power to stay correct height
// FIXME: these need to be per class variables
#define MAX_FORCE 80
#define FORCE_POSDELTA 12
#define FORCE_NEGDELTA 8
if (m_flForce < MAX_FORCE && vecEst.z < GetDesiredPosition().z)
{
m_flForce += FORCE_POSDELTA;
}
else if (m_flForce > 30)
{
if (vecEst.z > GetDesiredPosition().z)
m_flForce -= FORCE_NEGDELTA;
}
// pitch forward or back to get to target
//-----------------------------------------
// Pitch is reversed since Half-Life! (sjb)
//-----------------------------------------
if (flDist > 0 && flSpeed < m_flGoalSpeed /* && flSpeed < flDist */ && GetLocalAngles().x + angVel.x < 40)
{
// ALERT( at_console, "F " );
// lean forward
angVel.x += 12.0;
}
else if (flDist < 0 && flSpeed > -50 && GetLocalAngles().x + angVel.x > -20)
{
// ALERT( at_console, "B " );
// lean backward
angVel.x -= 12.0;
}
else if (GetLocalAngles().x + angVel.x < 0)
{
// ALERT( at_console, "f " );
angVel.x += 4.0;
}
else if (GetLocalAngles().x + angVel.x > 0)
{
// ALERT( at_console, "b " );
angVel.x -= 4.0;
}
SetLocalAngularVelocity( angVel );
// ALERT( at_console, "%.0f %.0f : %.0f %.0f : %.0f %.0f : %.0f\n", GetAbsOrigin().x, GetAbsVelocity().x, flDist, flSpeed, GetLocalAngles().x, m_vecAngVelocity.x, m_flForce );
// ALERT( at_console, "%.0f %.0f : %.0f %0.f : %.0f\n", GetAbsOrigin().z, GetAbsVelocity().z, vecEst.z, m_vecDesiredPosition.z, m_flForce );
}
//------------------------------------------------------------------------------
// Updates the rotor wash volume
//------------------------------------------------------------------------------
void CBaseHelicopter::UpdateRotorWashVolume()
{
if ( !m_pRotorSound )
return;
CSoundEnvelopeController &controller = CSoundEnvelopeController::GetController();
float flVolDelta = GetRotorVolume() - controller.SoundGetVolume( m_pRotorSound );
if ( flVolDelta )
{
// We can change from 0 to 1 in 3 seconds.
// Figure out how many seconds flVolDelta will take.
float flRampTime = fabs( flVolDelta ) * 3.0f;
controller.SoundChangeVolume( m_pRotorSound, GetRotorVolume(), flRampTime );
}
}
//------------------------------------------------------------------------------
// For scripted times where it *has* to shoot
//------------------------------------------------------------------------------
float CBaseHelicopter::GetRotorVolume( void )
{
return m_bSuppressSound ? 0.0f : 1.0f;
}
//-----------------------------------------------------------------------------
// Rotor sound
//-----------------------------------------------------------------------------
void CBaseHelicopter::InputEnableRotorSound( inputdata_t &inputdata )
{
m_bSuppressSound = false;
}
void CBaseHelicopter::InputDisableRotorSound( inputdata_t &inputdata )
{
m_bSuppressSound = true;
}
//-----------------------------------------------------------------------------
// Purpose: Marks the entity for deletion
//-----------------------------------------------------------------------------
void CBaseHelicopter::InputKill( inputdata_t &inputdata )
{
StopRotorWash();
m_bSuppressSound = true;
SetContextThink( &CBaseHelicopter::DelayedKillThink, gpGlobals->curtime + 3.0f, s_pDelayedKillThinkContext );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseHelicopter::StopRotorWash( void )
{
if ( m_hRotorWash )
{
UTIL_Remove( m_hRotorWash );
m_hRotorWash = NULL;
}
}
//-----------------------------------------------------------------------------
// Purpose: Marks the entity for deletion
//-----------------------------------------------------------------------------
void CBaseHelicopter::DelayedKillThink( )
{
// tell owner ( if any ) that we're dead.This is mostly for NPCMaker functionality.
CBaseEntity *pOwner = GetOwnerEntity();
if ( pOwner )
{
pOwner->DeathNotice( this );
SetOwnerEntity( NULL );
}
UTIL_Remove( this );
}
//------------------------------------------------------------------------------
// Purpose :
// Input :
// Output :
//------------------------------------------------------------------------------
void CBaseHelicopter::InitializeRotorSound( void )
{
CSoundEnvelopeController &controller = CSoundEnvelopeController::GetController();
if ( m_pRotorSound )
{
// Get the rotor sound started up.
controller.Play( m_pRotorSound, 0.0, 100 );
UpdateRotorWashVolume();
}
if ( m_pRotorBlast )
{
// Start the blast sound and then immediately drop it to 0 (starting it at 0 wouldn't start it)
controller.Play( m_pRotorBlast, 1.0, 100 );
controller.SoundChangeVolume(m_pRotorBlast, 0, 0.0);
}
m_iSoundState = SND_CHANGE_PITCH; // hack for going through level transitions
}
//------------------------------------------------------------------------------
// Purpose :
// Input :
// Output :
//------------------------------------------------------------------------------
void CBaseHelicopter::UpdateRotorSoundPitch( int iPitch )
{
if (m_pRotorSound)
{
CSoundEnvelopeController &controller = CSoundEnvelopeController::GetController();
controller.SoundChangePitch( m_pRotorSound, iPitch, 0.1 );
UpdateRotorWashVolume();
}
}
//------------------------------------------------------------------------------
// Purpose :
// Input :
// Output :
//------------------------------------------------------------------------------
void CBaseHelicopter::FlyTouch( CBaseEntity *pOther )
{
// bounce if we hit something solid
if ( pOther->GetSolid() == SOLID_BSP)
{
// trace_t tr;
// tr = CBaseEntity::GetTouchTrace();
// UNDONE, do a real bounce
// FIXME: This causes bad problems, so we just ignore it right now
//ApplyAbsVelocityImpulse( tr.plane.normal * (GetAbsVelocity().Length() + 200) );
}
}
//------------------------------------------------------------------------------
// Purpose :
// Input :
// Output :
//------------------------------------------------------------------------------
void CBaseHelicopter::CrashTouch( CBaseEntity *pOther )
{
// only crash if we hit something solid
if ( pOther->GetSolid() == SOLID_BSP)
{
SetTouch( NULL );
SetNextThink( gpGlobals->curtime );
}
}
//------------------------------------------------------------------------------
// Purpose :
// Input :
// Output :
//------------------------------------------------------------------------------
void CBaseHelicopter::DyingThink( void )
{
StudioFrameAdvance( );
SetNextThink( gpGlobals->curtime + 0.1f );
SetLocalAngularVelocity( GetLocalAngularVelocity() * 1.02 );
}
//-----------------------------------------------------------------------------
// Purpose: Override base class to add display of fly direction
// Input :
// Output :
//-----------------------------------------------------------------------------
void CBaseHelicopter::DrawDebugGeometryOverlays(void)
{
if (m_pfnThink!= NULL)
{
// ------------------------------
// Draw route if requested
// ------------------------------
if (m_debugOverlays & OVERLAY_NPC_ROUTE_BIT)
{
NDebugOverlay::Line(GetAbsOrigin(), GetDesiredPosition(), 0,0,255, true, 0);
}
}
BaseClass::DrawDebugGeometryOverlays();
}
//-----------------------------------------------------------------------------
// Purpose:
// Input :
// Output :
//-----------------------------------------------------------------------------
void CBaseHelicopter::TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr, CDmgAccumulator *pAccumulator )
{
// Take no damage from trace attacks unless it's blast damage. RadiusDamage() sometimes calls
// TraceAttack() as a means for delivering blast damage. Usually when the explosive penetrates
// the target. (RPG missiles do this sometimes).
if( info.GetDamageType() & (DMG_BLAST|DMG_AIRBOAT) )
{
BaseClass::TraceAttack( info, vecDir, ptr, pAccumulator );
}
}
//------------------------------------------------------------------------------
// Purpose :
// Input :
// Output :
//------------------------------------------------------------------------------
void CBaseHelicopter::NullThink( void )
{
StudioFrameAdvance( );
SetNextThink( gpGlobals->curtime + 0.5f );
}
void CBaseHelicopter::Startup( void )
{
StopRotorWash();
if ( !( m_spawnflags & SF_NOROTORWASH ) )
{
m_hRotorWash = CreateRotorWashEmitter( GetAbsOrigin(), GetAbsAngles(), this, BASECHOPPER_WASH_ALTITUDE );
}
// Fade in the blades
m_flStartupTime = gpGlobals->curtime;
m_flGoalSpeed = m_flInitialSpeed;
SetThink( &CBaseHelicopter::HelicopterThink );
SetTouch( &CBaseHelicopter::FlyTouch );
SetNextThink( gpGlobals->curtime + 0.1f );
m_flRotorWashEntitySearchTime = gpGlobals->curtime;
SetContextThink( &CBaseHelicopter::RotorWashThink, gpGlobals->curtime, s_pRotorWashThinkContext );
}
void CBaseHelicopter::StopLoopingSounds()
{
// Kill the rotor sounds
CSoundEnvelopeController &controller = CSoundEnvelopeController::GetController();
controller.SoundDestroy( m_pRotorSound );
controller.SoundDestroy( m_pRotorBlast );
m_pRotorSound = NULL;
m_pRotorBlast = NULL;
BaseClass::StopLoopingSounds();
}
void CBaseHelicopter::Event_Killed( const CTakeDamageInfo &info )
{
m_lifeState = LIFE_DYING;
SetMoveType( MOVETYPE_FLYGRAVITY );
SetGravity( UTIL_ScaleForGravity( 240 ) ); // use a lower gravity
StopLoopingSounds();
UTIL_SetSize( this, Vector( -32, -32, -64), Vector( 32, 32, 0) );
SetThink( &CBaseHelicopter::CallDyingThink );
SetTouch( &CBaseHelicopter::CrashTouch );
SetNextThink( gpGlobals->curtime + 0.1f );
m_iHealth = 0;
m_takedamage = DAMAGE_NO;
/*
if (m_spawnflags & SF_NOWRECKAGE)
{
m_flNextRocket = gpGlobals->curtime + 4.0;
}
else
{
m_flNextRocket = gpGlobals->curtime + 15.0;
}
*/
StopRotorWash();
m_OnDeath.FireOutput( info.GetAttacker(), this );
}
void CBaseHelicopter::GibMonster( void )
{
}
//-----------------------------------------------------------------------------
// Purpose: Call Startup for a helicopter that's been flagged to start disabled
//-----------------------------------------------------------------------------
void CBaseHelicopter::InputActivate( inputdata_t &inputdata )
{
if( m_spawnflags & SF_AWAITINPUT )
{
Startup();
// Now clear the spawnflag to protect from
// subsequent calls.
m_spawnflags &= ~SF_AWAITINPUT;
}
}
//------------------------------------------------------------------------------
// Purpose : Turn the gun on
//------------------------------------------------------------------------------
void CBaseHelicopter::InputGunOn( inputdata_t &inputdata )
{
m_fHelicopterFlags |= BITS_HELICOPTER_GUN_ON;
}
//-----------------------------------------------------------------------------
// Purpose: Turn the gun off
//-----------------------------------------------------------------------------
void CBaseHelicopter::InputGunOff( inputdata_t &inputdata )
{
m_fHelicopterFlags &= ~BITS_HELICOPTER_GUN_ON;
}
//------------------------------------------------------------------------------
// Purpose : Turn the missile on
//------------------------------------------------------------------------------
void CBaseHelicopter::InputMissileOn( inputdata_t &inputdata )
{
m_fHelicopterFlags |= BITS_HELICOPTER_MISSILE_ON;
}
//-----------------------------------------------------------------------------
// Purpose: Turn the missile off
//-----------------------------------------------------------------------------
void CBaseHelicopter::InputMissileOff( inputdata_t &inputdata )
{
m_fHelicopterFlags &= ~BITS_HELICOPTER_MISSILE_ON;
}
//-----------------------------------------------------------------------------
// Enable, disable rotor wash
//-----------------------------------------------------------------------------
void CBaseHelicopter::InputEnableRotorWash( inputdata_t &inputdata )
{
m_spawnflags &= ~SF_NOROTORWASH;
}
void CBaseHelicopter::InputDisableRotorWash( inputdata_t &inputdata )
{
m_spawnflags |= SF_NOROTORWASH;
}
//-----------------------------------------------------------------------------
// Causes the helicopter to immediately accelerate to its desired velocity
//-----------------------------------------------------------------------------
void CBaseHelicopter::InputMoveTopSpeed( inputdata_t &inputdata )
{
Vector vecVelocity;
ComputeActualTargetPosition( GetMaxSpeed(), 1.0f, 0.0f, &vecVelocity, false );
vecVelocity -= GetAbsOrigin();
float flLength = VectorNormalize( vecVelocity );
if (flLength < 1e-3)
{
GetVectors( &vecVelocity, NULL, NULL );
}
vecVelocity *= GetMaxSpeed();
SetAbsVelocity( vecVelocity );
}
//-----------------------------------------------------------------------------
// Cause helicopter to immediately accelerate to specified velocity
//-----------------------------------------------------------------------------
void CBaseHelicopter::InputMoveSpecifiedSpeed( inputdata_t &inputdata )
{
Vector vecVelocity;
ComputeActualTargetPosition( GetMaxSpeed(), 1.0f, 0.0f, &vecVelocity, false );
vecVelocity -= GetAbsOrigin();
float flLength = VectorNormalize( vecVelocity );
if (flLength < 1e-3)
{
GetVectors( &vecVelocity, NULL, NULL );
}
float flSpeed = inputdata.value.Float();
vecVelocity *= flSpeed;
SetAbsVelocity( vecVelocity );
}
//------------------------------------------------------------------------------
// Input values
//------------------------------------------------------------------------------
void CBaseHelicopter::InputSetAngles( inputdata_t &inputdata )
{
const char *pAngles = inputdata.value.String();
QAngle angles;
UTIL_StringToVector( angles.Base(), pAngles );
SetAbsAngles( angles );
}
//-----------------------------------------------------------------------------
// Purpose:
// Input :
// Output :
//-----------------------------------------------------------------------------
void CBaseHelicopter::ApplySidewaysDrag( const Vector &vecRight )
{
Vector vecNewVelocity = GetAbsVelocity();
vecNewVelocity.x *= 1.0 - fabs( vecRight.x ) * 0.05;
vecNewVelocity.y *= 1.0 - fabs( vecRight.y ) * 0.05;
vecNewVelocity.z *= 1.0 - fabs( vecRight.z ) * 0.05;
SetAbsVelocity( vecNewVelocity );
}
//-----------------------------------------------------------------------------
// Purpose:
// Input :
// Output :
//-----------------------------------------------------------------------------
void CBaseHelicopter::ApplyGeneralDrag( void )
{
Vector vecNewVelocity = GetAbsVelocity();
vecNewVelocity *= 0.995;
SetAbsVelocity( vecNewVelocity );
}
//-----------------------------------------------------------------------------
// Purpose:
// Input :
// Output :
//-----------------------------------------------------------------------------
bool CBaseHelicopter::ChooseEnemy( void )
{
// See if there's a new enemy.
CBaseEntity *pNewEnemy;
pNewEnemy = BestEnemy();
if ( pNewEnemy != GetEnemy() )
{
if ( pNewEnemy != NULL )
{
// New enemy! Clear the timers and set conditions.
SetEnemy( pNewEnemy );
m_flLastSeen = m_flPrevSeen = gpGlobals->curtime;
}
else
{
SetEnemy( NULL );
SetState( NPC_STATE_ALERT );
}
return true;
}
else
{
ClearCondition( COND_NEW_ENEMY );
return false;
}
}
//-----------------------------------------------------------------------------
// Purpose:
// Input :
// Output :
//-----------------------------------------------------------------------------
void CBaseHelicopter::GatherEnemyConditions( CBaseEntity *pEnemy )
{
// -------------------
// If enemy is dead
// -------------------
if ( !pEnemy->IsAlive() )
{
SetCondition( COND_ENEMY_DEAD );
ClearCondition( COND_SEE_ENEMY );
ClearCondition( COND_ENEMY_OCCLUDED );
return;
}
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : *pInfo -
// bAlways -
//-----------------------------------------------------------------------------
void CBaseHelicopter::SetTransmit( CCheckTransmitInfo *pInfo, bool bAlways )
{
// Are we already marked for transmission?
if ( pInfo->m_pTransmitEdict->Get( entindex() ) )
return;
BaseClass::SetTransmit( pInfo, bAlways );
// Make our smoke trail always come with us
if ( m_hRotorWash )
{
m_hRotorWash->SetTransmit( pInfo, bAlways );
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void ExpandBBox(Vector &vecMins, Vector &vecMaxs)
{
// expand for *any* rotation
float maxval = 0;
for (int i = 0; i < 3; i++)
{
float v = fabs( vecMins[i]);
if (v > maxval)
maxval = v;
v = fabs( vecMaxs[i]);
if (v > maxval)
maxval = v;
}
vecMins.Init(-maxval, -maxval, -maxval);
vecMaxs.Init(maxval, maxval, maxval);
}
|
{
"pile_set_name": "Github"
}
|
# module and export all
snippet mod
-module(${1:`Filename('', 'my')`}).
-compile([export_all]).
start() ->
${2}
stop() ->
ok.
# define directive
snippet def
-define(${1:macro}, ${2:body}).${3}
# export directive
snippet exp
-export([${1:function}/${2:arity}]).
# include directive
snippet inc
-include("${1:file}").${2}
# behavior directive
snippet beh
-behaviour(${1:behaviour}).${2}
# if expression
snippet if
if
${1:guard} ->
${2:body}
end
# case expression
snippet case
case ${1:expression} of
${2:pattern} ->
${3:body};
end
# anonymous function
snippet fun
fun (${1:Parameters}) -> ${2:body} end${3}
# try...catch
snippet try
try
${1}
catch
${2:_:_} -> ${3:got_some_exception}
end
# record directive
snippet rec
-record(${1:record}, {
${2:field}=${3:value}}).${4}
# todo comment
snippet todo
%% TODO: ${1}
## Snippets below (starting with '%') are in EDoc format.
## See http://www.erlang.org/doc/apps/edoc/chapter.html#id56887 for more details
# doc comment
snippet %d
%% @doc ${1}
# end of doc comment
snippet %e
%% @end
# specification comment
snippet %s
%% @spec ${1}
# private function marker
snippet %p
%% @private
# OTP application
snippet application
-module(${1:`Filename('', 'my')`}).
-behaviour(application).
-export([start/2, stop/1]).
start(_Type, _StartArgs) ->
case ${2:root_supervisor}:start_link() of
{ok, Pid} ->
{ok, Pid};
Other ->
{error, Other}
end.
stop(_State) ->
ok.
# OTP supervisor
snippet supervisor
-module(${1:`Filename('', 'my')`}).
-behaviour(supervisor).
%% API
-export([start_link/0]).
%% Supervisor callbacks
-export([init/1]).
-define(SERVER, ?MODULE).
start_link() ->
supervisor:start_link({local, ?SERVER}, ?MODULE, []).
init([]) ->
Server = {${2:my_server}, {$2, start_link, []},
permanent, 2000, worker, [$2]},
Children = [Server],
RestartStrategy = {one_for_one, 0, 1},
{ok, {RestartStrategy, Children}}.
# OTP gen_server
snippet gen_server
-module(${1:`Filename('', 'my')`}).
-behaviour(gen_server).
%% API
-export([
start_link/0
]).
%% gen_server callbacks
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
terminate/2, code_change/3]).
-define(SERVER, ?MODULE).
-record(state, {}).
%%%===================================================================
%%% API
%%%===================================================================
start_link() ->
gen_server:start_link({local, ?SERVER}, ?MODULE, [], []).
%%%===================================================================
%%% gen_server callbacks
%%%===================================================================
init([]) ->
{ok, #state{}}.
handle_call(_Request, _From, State) ->
Reply = ok,
{reply, Reply, State}.
handle_cast(_Msg, State) ->
{noreply, State}.
handle_info(_Info, State) ->
{noreply, State}.
terminate(_Reason, _State) ->
ok.
code_change(_OldVsn, State, _Extra) ->
{ok, State}.
%%%===================================================================
%%% Internal functions
%%%===================================================================
|
{
"pile_set_name": "Github"
}
|
apiVersion: enmasse.io/v1beta1
kind: Address
metadata:
name: myspace.myqueue
spec:
address: myqueue
type: queue
plan: standard-small-queue
expiry: myexpiry <1>
messageTtl: <2>
minimim: 30000
maximum: 300000
|
{
"pile_set_name": "Github"
}
|
<zk>
<html><![CDATA[
<ol>
<li>Click the "add listener" button first</li>
<li>Then click "Click Me", and then you shall see a "onClick" dialog shown up</li>
</ol>
]]></html>
<div id="d" style="border:1px solid blue">Click Me</div>
<button label="add listener" onClick='d.setWidgetListener("onClick", "jq.alert(event.name)")'/>
</zk>
|
{
"pile_set_name": "Github"
}
|
package logrus
import "time"
const DefaultTimestampFormat = time.RFC3339
// The Formatter interface is used to implement a custom Formatter. It takes an
// `Entry`. It exposes all the fields, including the default ones:
//
// * `entry.Data["msg"]`. The message passed from Info, Warn, Error ..
// * `entry.Data["time"]`. The timestamp.
// * `entry.Data["level"]. The level the entry was logged at.
//
// Any additional fields added with `WithField` or `WithFields` are also in
// `entry.Data`. Format is expected to return an array of bytes which are then
// logged to `logger.Out`.
type Formatter interface {
Format(*Entry) ([]byte, error)
}
// This is to not silently overwrite `time`, `msg` and `level` fields when
// dumping it. If this code wasn't there doing:
//
// logrus.WithField("level", 1).Info("hello")
//
// Would just silently drop the user provided level. Instead with this code
// it'll logged as:
//
// {"level": "info", "fields.level": 1, "msg": "hello", "time": "..."}
//
// It's not exported because it's still using Data in an opinionated way. It's to
// avoid code duplication between the two default formatters.
func prefixFieldClashes(data Fields) {
if t, ok := data["time"]; ok {
data["fields.time"] = t
}
if m, ok := data["msg"]; ok {
data["fields.msg"] = m
}
if l, ok := data["level"]; ok {
data["fields.level"] = l
}
}
|
{
"pile_set_name": "Github"
}
|
fileFormatVersion: 2
guid: a0aa4a2fe7d2e4376bb226c062b47cab
timeCreated: 1516414656
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
|
{
"pile_set_name": "Github"
}
|
dnl HP-PA 2.0 64-bit mpn_addmul_1 -- Multiply a limb vector with a limb and
dnl add the result to a second limb vector.
dnl Copyright 1998-2000, 2002, 2003 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of either:
dnl
dnl * the GNU Lesser General Public License as published by the Free
dnl Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
dnl or
dnl
dnl * the GNU General Public License as published by the Free Software
dnl Foundation; either version 2 of the License, or (at your option) any
dnl later version.
dnl
dnl or both in parallel, as here.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
dnl for more details.
dnl
dnl You should have received copies of the GNU General Public License and the
dnl GNU Lesser General Public License along with the GNU MP Library. If not,
dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C 8000,8200: 7
C 8500,8600,8700: 6.375
C The feed-in and wind-down code has not yet been scheduled. Many cycles
C could be saved there per call.
C DESCRIPTION:
C The main loop "BIG" is 4-way unrolled, mainly to allow
C effective use of ADD,DC. Delays in moving data via the cache from the FP
C registers to the IU registers, have demanded a deep software pipeline, and
C a lot of stack slots for partial products in flight.
C
C CODE STRUCTURE:
C save-some-registers
C do 0, 1, 2, or 3 limbs
C if done, restore-some-regs and return
C save-many-regs
C do 4, 8, ... limb
C restore-all-regs
C STACK LAYOUT:
C HP-PA stack grows upwards. We could allocate 8 fewer slots by using the
C slots marked FREE, as well as some slots in the caller's "frame marker".
C
C -00 <- r30
C -08 FREE
C -10 tmp
C -18 tmp
C -20 tmp
C -28 tmp
C -30 tmp
C -38 tmp
C -40 tmp
C -48 tmp
C -50 tmp
C -58 tmp
C -60 tmp
C -68 tmp
C -70 tmp
C -78 tmp
C -80 tmp
C -88 tmp
C -90 FREE
C -98 FREE
C -a0 FREE
C -a8 FREE
C -b0 r13
C -b8 r12
C -c0 r11
C -c8 r10
C -d0 r8
C -d8 r8
C -e0 r7
C -e8 r6
C -f0 r5
C -f8 r4
C -100 r3
C Previous frame:
C [unused area]
C -38/-138 vlimb home slot. For 2.0N, the vlimb arg will arrive here.
include(`../config.m4')
C INPUT PARAMETERS:
define(`rp',`%r26') C
define(`up',`%r25') C
define(`n',`%r24') C
define(`vlimb',`%r23') C
define(`climb',`%r23') C
ifdef(`HAVE_ABI_2_0w',
` .level 2.0w
',` .level 2.0
')
PROLOGUE(mpn_addmul_1)
ifdef(`HAVE_ABI_2_0w',
` std vlimb, -0x38(%r30) C store vlimb into "home" slot
')
std,ma %r3, 0x100(%r30)
std %r4, -0xf8(%r30)
std %r5, -0xf0(%r30)
ldo 0(%r0), climb C clear climb
fldd -0x138(%r30), %fr8 C put vlimb in fp register
define(`p032a1',`%r1') C
define(`p032a2',`%r19') C
define(`m032',`%r20') C
define(`m096',`%r21') C
define(`p000a',`%r22') C
define(`p064a',`%r29') C
define(`s000',`%r31') C
define(`ma000',`%r4') C
define(`ma064',`%r20') C
define(`r000',`%r3') C
extrd,u n, 63, 2, %r5
cmpb,= %r5, %r0, L(BIG)
nop
fldd 0(up), %fr4
ldo 8(up), up
xmpyu %fr8R, %fr4L, %fr22
xmpyu %fr8L, %fr4R, %fr23
fstd %fr22, -0x78(%r30) C mid product to -0x78..-0x71
xmpyu %fr8R, %fr4R, %fr24
xmpyu %fr8L, %fr4L, %fr25
fstd %fr23, -0x70(%r30) C mid product to -0x70..-0x69
fstd %fr24, -0x80(%r30) C low product to -0x80..-0x79
addib,<> -1, %r5, L(two_or_more)
fstd %fr25, -0x68(%r30) C high product to -0x68..-0x61
LDEF(one)
ldd -0x78(%r30), p032a1
ldd -0x70(%r30), p032a2
ldd -0x80(%r30), p000a
b L(0_one_out)
ldd -0x68(%r30), p064a
LDEF(two_or_more)
fldd 0(up), %fr4
ldo 8(up), up
xmpyu %fr8R, %fr4L, %fr22
xmpyu %fr8L, %fr4R, %fr23
ldd -0x78(%r30), p032a1
fstd %fr22, -0x78(%r30) C mid product to -0x78..-0x71
xmpyu %fr8R, %fr4R, %fr24
xmpyu %fr8L, %fr4L, %fr25
ldd -0x70(%r30), p032a2
fstd %fr23, -0x70(%r30) C mid product to -0x70..-0x69
ldd -0x80(%r30), p000a
fstd %fr24, -0x80(%r30) C low product to -0x80..-0x79
ldd -0x68(%r30), p064a
addib,<> -1, %r5, L(three_or_more)
fstd %fr25, -0x68(%r30) C high product to -0x68..-0x61
LDEF(two)
add p032a1, p032a2, m032
add,dc %r0, %r0, m096
depd,z m032, 31, 32, ma000
extrd,u m032, 31, 32, ma064
ldd 0(rp), r000
b L(0_two_out)
depd m096, 31, 32, ma064
LDEF(three_or_more)
fldd 0(up), %fr4
add p032a1, p032a2, m032
add,dc %r0, %r0, m096
depd,z m032, 31, 32, ma000
extrd,u m032, 31, 32, ma064
ldd 0(rp), r000
C addib,= -1, %r5, L(0_out)
depd m096, 31, 32, ma064
LDEF(loop0)
C xmpyu %fr8R, %fr4L, %fr22
C xmpyu %fr8L, %fr4R, %fr23
C ldd -0x78(%r30), p032a1
C fstd %fr22, -0x78(%r30) C mid product to -0x78..-0x71
C
C xmpyu %fr8R, %fr4R, %fr24
C xmpyu %fr8L, %fr4L, %fr25
C ldd -0x70(%r30), p032a2
C fstd %fr23, -0x70(%r30) C mid product to -0x70..-0x69
C
C ldo 8(rp), rp
C add climb, p000a, s000
C ldd -0x80(%r30), p000a
C fstd %fr24, -0x80(%r30) C low product to -0x80..-0x79
C
C add,dc p064a, %r0, climb
C ldo 8(up), up
C ldd -0x68(%r30), p064a
C fstd %fr25, -0x68(%r30) C high product to -0x68..-0x61
C
C add ma000, s000, s000
C add,dc ma064, climb, climb
C fldd 0(up), %fr4
C
C add r000, s000, s000
C add,dc %r0, climb, climb
C std s000, -8(rp)
C
C add p032a1, p032a2, m032
C add,dc %r0, %r0, m096
C
C depd,z m032, 31, 32, ma000
C extrd,u m032, 31, 32, ma064
C ldd 0(rp), r000
C addib,<> -1, %r5, L(loop0)
C depd m096, 31, 32, ma064
LDEF(0_out)
ldo 8(up), up
xmpyu %fr8R, %fr4L, %fr22
xmpyu %fr8L, %fr4R, %fr23
ldd -0x78(%r30), p032a1
fstd %fr22, -0x78(%r30) C mid product to -0x78..-0x71
xmpyu %fr8R, %fr4R, %fr24
xmpyu %fr8L, %fr4L, %fr25
ldd -0x70(%r30), p032a2
fstd %fr23, -0x70(%r30) C mid product to -0x70..-0x69
ldo 8(rp), rp
add climb, p000a, s000
ldd -0x80(%r30), p000a
fstd %fr24, -0x80(%r30) C low product to -0x80..-0x79
add,dc p064a, %r0, climb
ldd -0x68(%r30), p064a
fstd %fr25, -0x68(%r30) C high product to -0x68..-0x61
add ma000, s000, s000
add,dc ma064, climb, climb
add r000, s000, s000
add,dc %r0, climb, climb
std s000, -8(rp)
add p032a1, p032a2, m032
add,dc %r0, %r0, m096
depd,z m032, 31, 32, ma000
extrd,u m032, 31, 32, ma064
ldd 0(rp), r000
depd m096, 31, 32, ma064
LDEF(0_two_out)
ldd -0x78(%r30), p032a1
ldd -0x70(%r30), p032a2
ldo 8(rp), rp
add climb, p000a, s000
ldd -0x80(%r30), p000a
add,dc p064a, %r0, climb
ldd -0x68(%r30), p064a
add ma000, s000, s000
add,dc ma064, climb, climb
add r000, s000, s000
add,dc %r0, climb, climb
std s000, -8(rp)
LDEF(0_one_out)
add p032a1, p032a2, m032
add,dc %r0, %r0, m096
depd,z m032, 31, 32, ma000
extrd,u m032, 31, 32, ma064
ldd 0(rp), r000
depd m096, 31, 32, ma064
add climb, p000a, s000
add,dc p064a, %r0, climb
add ma000, s000, s000
add,dc ma064, climb, climb
add r000, s000, s000
add,dc %r0, climb, climb
std s000, 0(rp)
cmpib,>= 4, n, L(done)
ldo 8(rp), rp
C 4-way unrolled code.
LDEF(BIG)
define(`p032a1',`%r1') C
define(`p032a2',`%r19') C
define(`p096b1',`%r20') C
define(`p096b2',`%r21') C
define(`p160c1',`%r22') C
define(`p160c2',`%r29') C
define(`p224d1',`%r31') C
define(`p224d2',`%r3') C
C
define(`m032',`%r4') C
define(`m096',`%r5') C
define(`m160',`%r6') C
define(`m224',`%r7') C
define(`m288',`%r8') C
C
define(`p000a',`%r1') C
define(`p064a',`%r19') C
define(`p064b',`%r20') C
define(`p128b',`%r21') C
define(`p128c',`%r22') C
define(`p192c',`%r29') C
define(`p192d',`%r31') C
define(`p256d',`%r3') C
C
define(`s000',`%r10') C
define(`s064',`%r11') C
define(`s128',`%r12') C
define(`s192',`%r13') C
C
define(`ma000',`%r9') C
define(`ma064',`%r4') C
define(`ma128',`%r5') C
define(`ma192',`%r6') C
define(`ma256',`%r7') C
C
define(`r000',`%r1') C
define(`r064',`%r19') C
define(`r128',`%r20') C
define(`r192',`%r21') C
std %r6, -0xe8(%r30)
std %r7, -0xe0(%r30)
std %r8, -0xd8(%r30)
std %r9, -0xd0(%r30)
std %r10, -0xc8(%r30)
std %r11, -0xc0(%r30)
std %r12, -0xb8(%r30)
std %r13, -0xb0(%r30)
ifdef(`HAVE_ABI_2_0w',
` extrd,u n, 61, 62, n C right shift 2
',` extrd,u n, 61, 30, n C right shift 2, zero extend
')
LDEF(4_or_more)
fldd 0(up), %fr4
fldd 8(up), %fr5
fldd 16(up), %fr6
fldd 24(up), %fr7
xmpyu %fr8R, %fr4L, %fr22
xmpyu %fr8L, %fr4R, %fr23
xmpyu %fr8R, %fr5L, %fr24
xmpyu %fr8L, %fr5R, %fr25
xmpyu %fr8R, %fr6L, %fr26
xmpyu %fr8L, %fr6R, %fr27
fstd %fr22, -0x78(%r30) C mid product to -0x78..-0x71
xmpyu %fr8R, %fr7L, %fr28
xmpyu %fr8L, %fr7R, %fr29
fstd %fr23, -0x70(%r30) C mid product to -0x70..-0x69
xmpyu %fr8R, %fr4R, %fr30
xmpyu %fr8L, %fr4L, %fr31
fstd %fr24, -0x38(%r30) C mid product to -0x38..-0x31
xmpyu %fr8R, %fr5R, %fr22
xmpyu %fr8L, %fr5L, %fr23
fstd %fr25, -0x30(%r30) C mid product to -0x30..-0x29
xmpyu %fr8R, %fr6R, %fr24
xmpyu %fr8L, %fr6L, %fr25
fstd %fr26, -0x58(%r30) C mid product to -0x58..-0x51
xmpyu %fr8R, %fr7R, %fr26
fstd %fr27, -0x50(%r30) C mid product to -0x50..-0x49
addib,<> -1, n, L(8_or_more)
xmpyu %fr8L, %fr7L, %fr27
fstd %fr28, -0x18(%r30) C mid product to -0x18..-0x11
fstd %fr29, -0x10(%r30) C mid product to -0x10..-0x09
fstd %fr30, -0x80(%r30) C low product to -0x80..-0x79
fstd %fr31, -0x68(%r30) C high product to -0x68..-0x61
fstd %fr22, -0x40(%r30) C low product to -0x40..-0x39
fstd %fr23, -0x28(%r30) C high product to -0x28..-0x21
fstd %fr24, -0x60(%r30) C low product to -0x60..-0x59
fstd %fr25, -0x48(%r30) C high product to -0x48..-0x41
fstd %fr26, -0x20(%r30) C low product to -0x20..-0x19
fstd %fr27, -0x88(%r30) C high product to -0x88..-0x81
ldd -0x78(%r30), p032a1
ldd -0x70(%r30), p032a2
ldd -0x38(%r30), p096b1
ldd -0x30(%r30), p096b2
ldd -0x58(%r30), p160c1
ldd -0x50(%r30), p160c2
ldd -0x18(%r30), p224d1
ldd -0x10(%r30), p224d2
b L(end1)
nop
LDEF(8_or_more)
fstd %fr28, -0x18(%r30) C mid product to -0x18..-0x11
fstd %fr29, -0x10(%r30) C mid product to -0x10..-0x09
ldo 32(up), up
fstd %fr30, -0x80(%r30) C low product to -0x80..-0x79
fstd %fr31, -0x68(%r30) C high product to -0x68..-0x61
fstd %fr22, -0x40(%r30) C low product to -0x40..-0x39
fstd %fr23, -0x28(%r30) C high product to -0x28..-0x21
fstd %fr24, -0x60(%r30) C low product to -0x60..-0x59
fstd %fr25, -0x48(%r30) C high product to -0x48..-0x41
fstd %fr26, -0x20(%r30) C low product to -0x20..-0x19
fstd %fr27, -0x88(%r30) C high product to -0x88..-0x81
fldd 0(up), %fr4
fldd 8(up), %fr5
fldd 16(up), %fr6
fldd 24(up), %fr7
xmpyu %fr8R, %fr4L, %fr22
ldd -0x78(%r30), p032a1
xmpyu %fr8L, %fr4R, %fr23
xmpyu %fr8R, %fr5L, %fr24
ldd -0x70(%r30), p032a2
xmpyu %fr8L, %fr5R, %fr25
xmpyu %fr8R, %fr6L, %fr26
ldd -0x38(%r30), p096b1
xmpyu %fr8L, %fr6R, %fr27
fstd %fr22, -0x78(%r30) C mid product to -0x78..-0x71
xmpyu %fr8R, %fr7L, %fr28
ldd -0x30(%r30), p096b2
xmpyu %fr8L, %fr7R, %fr29
fstd %fr23, -0x70(%r30) C mid product to -0x70..-0x69
xmpyu %fr8R, %fr4R, %fr30
ldd -0x58(%r30), p160c1
xmpyu %fr8L, %fr4L, %fr31
fstd %fr24, -0x38(%r30) C mid product to -0x38..-0x31
xmpyu %fr8R, %fr5R, %fr22
ldd -0x50(%r30), p160c2
xmpyu %fr8L, %fr5L, %fr23
fstd %fr25, -0x30(%r30) C mid product to -0x30..-0x29
xmpyu %fr8R, %fr6R, %fr24
ldd -0x18(%r30), p224d1
xmpyu %fr8L, %fr6L, %fr25
fstd %fr26, -0x58(%r30) C mid product to -0x58..-0x51
xmpyu %fr8R, %fr7R, %fr26
ldd -0x10(%r30), p224d2
fstd %fr27, -0x50(%r30) C mid product to -0x50..-0x49
addib,= -1, n, L(end2)
xmpyu %fr8L, %fr7L, %fr27
LDEF(loop)
add p032a1, p032a2, m032
ldd -0x80(%r30), p000a
add,dc p096b1, p096b2, m096
fstd %fr28, -0x18(%r30) C mid product to -0x18..-0x11
add,dc p160c1, p160c2, m160
ldd -0x68(%r30), p064a
add,dc p224d1, p224d2, m224
fstd %fr29, -0x10(%r30) C mid product to -0x10..-0x09
add,dc %r0, %r0, m288
ldd -0x40(%r30), p064b
ldo 32(up), up
fstd %fr30, -0x80(%r30) C low product to -0x80..-0x79
depd,z m032, 31, 32, ma000
ldd -0x28(%r30), p128b
extrd,u m032, 31, 32, ma064
fstd %fr31, -0x68(%r30) C high product to -0x68..-0x61
depd m096, 31, 32, ma064
ldd -0x60(%r30), p128c
extrd,u m096, 31, 32, ma128
fstd %fr22, -0x40(%r30) C low product to -0x40..-0x39
depd m160, 31, 32, ma128
ldd -0x48(%r30), p192c
extrd,u m160, 31, 32, ma192
fstd %fr23, -0x28(%r30) C high product to -0x28..-0x21
depd m224, 31, 32, ma192
ldd -0x20(%r30), p192d
extrd,u m224, 31, 32, ma256
fstd %fr24, -0x60(%r30) C low product to -0x60..-0x59
depd m288, 31, 32, ma256
ldd -0x88(%r30), p256d
add climb, p000a, s000
fstd %fr25, -0x48(%r30) C high product to -0x48..-0x41
add,dc p064a, p064b, s064
ldd 0(rp), r000
add,dc p128b, p128c, s128
fstd %fr26, -0x20(%r30) C low product to -0x20..-0x19
add,dc p192c, p192d, s192
ldd 8(rp), r064
add,dc p256d, %r0, climb
fstd %fr27, -0x88(%r30) C high product to -0x88..-0x81
ldd 16(rp), r128
add ma000, s000, s000 C accum mid 0
ldd 24(rp), r192
add,dc ma064, s064, s064 C accum mid 1
add,dc ma128, s128, s128 C accum mid 2
fldd 0(up), %fr4
add,dc ma192, s192, s192 C accum mid 3
fldd 8(up), %fr5
add,dc ma256, climb, climb
fldd 16(up), %fr6
add r000, s000, s000 C accum rlimb 0
fldd 24(up), %fr7
add,dc r064, s064, s064 C accum rlimb 1
add,dc r128, s128, s128 C accum rlimb 2
std s000, 0(rp)
add,dc r192, s192, s192 C accum rlimb 3
add,dc %r0, climb, climb
std s064, 8(rp)
xmpyu %fr8R, %fr4L, %fr22
ldd -0x78(%r30), p032a1
xmpyu %fr8L, %fr4R, %fr23
std s128, 16(rp)
xmpyu %fr8R, %fr5L, %fr24
ldd -0x70(%r30), p032a2
xmpyu %fr8L, %fr5R, %fr25
std s192, 24(rp)
xmpyu %fr8R, %fr6L, %fr26
ldd -0x38(%r30), p096b1
xmpyu %fr8L, %fr6R, %fr27
fstd %fr22, -0x78(%r30) C mid product to -0x78..-0x71
xmpyu %fr8R, %fr7L, %fr28
ldd -0x30(%r30), p096b2
xmpyu %fr8L, %fr7R, %fr29
fstd %fr23, -0x70(%r30) C mid product to -0x70..-0x69
xmpyu %fr8R, %fr4R, %fr30
ldd -0x58(%r30), p160c1
xmpyu %fr8L, %fr4L, %fr31
fstd %fr24, -0x38(%r30) C mid product to -0x38..-0x31
xmpyu %fr8R, %fr5R, %fr22
ldd -0x50(%r30), p160c2
xmpyu %fr8L, %fr5L, %fr23
fstd %fr25, -0x30(%r30) C mid product to -0x30..-0x29
xmpyu %fr8R, %fr6R, %fr24
ldd -0x18(%r30), p224d1
xmpyu %fr8L, %fr6L, %fr25
fstd %fr26, -0x58(%r30) C mid product to -0x58..-0x51
xmpyu %fr8R, %fr7R, %fr26
ldd -0x10(%r30), p224d2
fstd %fr27, -0x50(%r30) C mid product to -0x50..-0x49
xmpyu %fr8L, %fr7L, %fr27
addib,<> -1, n, L(loop)
ldo 32(rp), rp
LDEF(end2)
add p032a1, p032a2, m032
ldd -0x80(%r30), p000a
add,dc p096b1, p096b2, m096
fstd %fr28, -0x18(%r30) C mid product to -0x18..-0x11
add,dc p160c1, p160c2, m160
ldd -0x68(%r30), p064a
add,dc p224d1, p224d2, m224
fstd %fr29, -0x10(%r30) C mid product to -0x10..-0x09
add,dc %r0, %r0, m288
ldd -0x40(%r30), p064b
fstd %fr30, -0x80(%r30) C low product to -0x80..-0x79
depd,z m032, 31, 32, ma000
ldd -0x28(%r30), p128b
extrd,u m032, 31, 32, ma064
fstd %fr31, -0x68(%r30) C high product to -0x68..-0x61
depd m096, 31, 32, ma064
ldd -0x60(%r30), p128c
extrd,u m096, 31, 32, ma128
fstd %fr22, -0x40(%r30) C low product to -0x40..-0x39
depd m160, 31, 32, ma128
ldd -0x48(%r30), p192c
extrd,u m160, 31, 32, ma192
fstd %fr23, -0x28(%r30) C high product to -0x28..-0x21
depd m224, 31, 32, ma192
ldd -0x20(%r30), p192d
extrd,u m224, 31, 32, ma256
fstd %fr24, -0x60(%r30) C low product to -0x60..-0x59
depd m288, 31, 32, ma256
ldd -0x88(%r30), p256d
add climb, p000a, s000
fstd %fr25, -0x48(%r30) C high product to -0x48..-0x41
add,dc p064a, p064b, s064
ldd 0(rp), r000
add,dc p128b, p128c, s128
fstd %fr26, -0x20(%r30) C low product to -0x20..-0x19
add,dc p192c, p192d, s192
ldd 8(rp), r064
add,dc p256d, %r0, climb
fstd %fr27, -0x88(%r30) C high product to -0x88..-0x81
ldd 16(rp), r128
add ma000, s000, s000 C accum mid 0
ldd 24(rp), r192
add,dc ma064, s064, s064 C accum mid 1
add,dc ma128, s128, s128 C accum mid 2
add,dc ma192, s192, s192 C accum mid 3
add,dc ma256, climb, climb
add r000, s000, s000 C accum rlimb 0
add,dc r064, s064, s064 C accum rlimb 1
add,dc r128, s128, s128 C accum rlimb 2
std s000, 0(rp)
add,dc r192, s192, s192 C accum rlimb 3
add,dc %r0, climb, climb
std s064, 8(rp)
ldd -0x78(%r30), p032a1
std s128, 16(rp)
ldd -0x70(%r30), p032a2
std s192, 24(rp)
ldd -0x38(%r30), p096b1
ldd -0x30(%r30), p096b2
ldd -0x58(%r30), p160c1
ldd -0x50(%r30), p160c2
ldd -0x18(%r30), p224d1
ldd -0x10(%r30), p224d2
ldo 32(rp), rp
LDEF(end1)
add p032a1, p032a2, m032
ldd -0x80(%r30), p000a
add,dc p096b1, p096b2, m096
add,dc p160c1, p160c2, m160
ldd -0x68(%r30), p064a
add,dc p224d1, p224d2, m224
add,dc %r0, %r0, m288
ldd -0x40(%r30), p064b
depd,z m032, 31, 32, ma000
ldd -0x28(%r30), p128b
extrd,u m032, 31, 32, ma064
depd m096, 31, 32, ma064
ldd -0x60(%r30), p128c
extrd,u m096, 31, 32, ma128
depd m160, 31, 32, ma128
ldd -0x48(%r30), p192c
extrd,u m160, 31, 32, ma192
depd m224, 31, 32, ma192
ldd -0x20(%r30), p192d
extrd,u m224, 31, 32, ma256
depd m288, 31, 32, ma256
ldd -0x88(%r30), p256d
add climb, p000a, s000
add,dc p064a, p064b, s064
ldd 0(rp), r000
add,dc p128b, p128c, s128
add,dc p192c, p192d, s192
ldd 8(rp), r064
add,dc p256d, %r0, climb
ldd 16(rp), r128
add ma000, s000, s000 C accum mid 0
ldd 24(rp), r192
add,dc ma064, s064, s064 C accum mid 1
add,dc ma128, s128, s128 C accum mid 2
add,dc ma192, s192, s192 C accum mid 3
add,dc ma256, climb, climb
add r000, s000, s000 C accum rlimb 0
add,dc r064, s064, s064 C accum rlimb 1
add,dc r128, s128, s128 C accum rlimb 2
std s000, 0(rp)
add,dc r192, s192, s192 C accum rlimb 3
add,dc %r0, climb, climb
std s064, 8(rp)
std s128, 16(rp)
std s192, 24(rp)
ldd -0xb0(%r30), %r13
ldd -0xb8(%r30), %r12
ldd -0xc0(%r30), %r11
ldd -0xc8(%r30), %r10
ldd -0xd0(%r30), %r9
ldd -0xd8(%r30), %r8
ldd -0xe0(%r30), %r7
ldd -0xe8(%r30), %r6
LDEF(done)
ifdef(`HAVE_ABI_2_0w',
` copy climb, %r28
',` extrd,u climb, 63, 32, %r29
extrd,u climb, 31, 32, %r28
')
ldd -0xf0(%r30), %r5
ldd -0xf8(%r30), %r4
bve (%r2)
ldd,mb -0x100(%r30), %r3
EPILOGUE(mpn_addmul_1)
|
{
"pile_set_name": "Github"
}
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{f44a99d0-e906-45dd-aa0e-e3529584ff1a}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<DCC_DCCCompiler>DCC32</DCC_DCCCompiler>
<DCC_DependencyCheckOutputName>app_34_TreeScan.exe</DCC_DependencyCheckOutputName>
<MainSource>app_34_TreeScan.dpr</MainSource>
<ProjectVersion>14.6</ProjectVersion>
<Config Condition="'$(Config)'==''">Debug</Config>
<Base>True</Base>
<AppType>Application</AppType>
<FrameworkType>VCL</FrameworkType>
<Platform Condition="'$(Platform)'==''">Win32</Platform>
<TargetedPlatforms>3</TargetedPlatforms>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
<Base_Win32>true</Base_Win32>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
<Base_Win64>true</Base_Win64>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
<Cfg_1>true</Cfg_1>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
<Cfg_2>true</Cfg_2>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<DCC_Namespace>Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;$(DCC_Namespace)</DCC_Namespace>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<VerInfo_Locale>1060</VerInfo_Locale>
<DCC_DependencyCheckOutputName>app_34_TreeScan.exe</DCC_DependencyCheckOutputName>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<DCC_Namespace>System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
<VerInfo_Locale>1033</VerInfo_Locale>
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win64)'!=''">
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<DCC_Namespace>System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)</DCC_Namespace>
<VerInfo_Locale>1033</VerInfo_Locale>
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1)'!=''">
<Version>7.0</Version>
<DCC_DebugInformation>False</DCC_DebugInformation>
<DCC_LocalDebugSymbols>False</DCC_LocalDebugSymbols>
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<Version>7.0</Version>
<DCC_Define>DEBUG;FullDebugMode;$(DCC_Define)</DCC_Define>
<DCC_DcuOutput>..\..\lib\XE3\$(Platform)\$(Config)</DCC_DcuOutput>
<DCC_UnitSearchPath>..\..;..\..\src;..\..\fastmm;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
<DCC_Optimize>False</DCC_Optimize>
<DCC_RangeChecking>True</DCC_RangeChecking>
<DCC_SYMBOL_PLATFORM>False</DCC_SYMBOL_PLATFORM>
</PropertyGroup>
<ProjectExtensions>
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
<Borland.ProjectType/>
<BorlandProject>
<Delphi.Personality>
<Parameters/>
<VersionInfo>
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
<VersionInfo Name="MajorVer">1</VersionInfo>
<VersionInfo Name="MinorVer">0</VersionInfo>
<VersionInfo Name="Release">0</VersionInfo>
<VersionInfo Name="Build">0</VersionInfo>
<VersionInfo Name="Debug">False</VersionInfo>
<VersionInfo Name="PreRelease">False</VersionInfo>
<VersionInfo Name="Special">False</VersionInfo>
<VersionInfo Name="Private">False</VersionInfo>
<VersionInfo Name="DLL">False</VersionInfo>
<VersionInfo Name="Locale">1060</VersionInfo>
<VersionInfo Name="CodePage">1250</VersionInfo>
</VersionInfo>
<VersionInfoKeys>
<VersionInfoKeys Name="CompanyName"/>
<VersionInfoKeys Name="FileDescription"/>
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="InternalName"/>
<VersionInfoKeys Name="LegalCopyright"/>
<VersionInfoKeys Name="LegalTrademarks"/>
<VersionInfoKeys Name="OriginalFilename"/>
<VersionInfoKeys Name="ProductName"/>
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="Comments"/>
</VersionInfoKeys>
<Source>
<Source Name="MainSource">app_34_TreeScan.dpr</Source>
</Source>
</Delphi.Personality>
<Platforms>
<Platform value="Win32">True</Platform>
<Platform value="Win64">True</Platform>
</Platforms>
</BorlandProject>
<ProjectFileVersion>12</ProjectFileVersion>
</ProjectExtensions>
<ItemGroup>
<DelphiCompile Include="$(MainSource)">
<MainSource>MainSource</MainSource>
</DelphiCompile>
<RcCompile Include="..\..\res\MainIcon.rc">
<Form>MainIcon.res</Form>
</RcCompile>
<DCCReference Include="test_34_TreeScan.pas">
<Form>frmTreeScanDemo</Form>
</DCCReference>
<BuildConfiguration Include="Debug">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
<BuildConfiguration Include="Release">
<Key>Cfg_1</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
</ItemGroup>
<Import Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')" Project="$(BDS)\Bin\CodeGear.Delphi.Targets"/>
<Import Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')" Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj"/>
</Project>
|
{
"pile_set_name": "Github"
}
|
<!DOCTYPE html>
<html itemscope lang="en-us">
<head><meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta charset="utf-8">
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><meta name="generator" content="Hugo 0.57.2" />
<meta property="og:title" content="Contact" />
<meta name="twitter:title" content="Contact"/>
<meta itemprop="name" content="Contact"><meta property="og:description" content="Contact information for devopsdays Salt Lake City 2018" />
<meta name="twitter:description" content="Contact information for devopsdays Salt Lake City 2018" />
<meta itemprop="description" content="Contact information for devopsdays Salt Lake City 2018"><meta name="twitter:site" content="@devopsdays">
<meta property="og:type" content="event" />
<meta property="og:url" content="/events/2018-salt-lake-city/contact/" /><meta name="twitter:creator" content="@devopsdaysslc" /><meta name="twitter:label1" value="Event" />
<meta name="twitter:data1" value="devopsdays Salt Lake City 2018" /><meta name="twitter:label2" value="Dates" />
<meta name="twitter:data2" value="May 15 - 16, 2018" /><meta property="og:image" content="https://www.devopsdays.org/img/sharing.jpg" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:image" content="https://www.devopsdays.org/img/sharing.jpg" />
<meta itemprop="image" content="https://www.devopsdays.org/img/sharing.jpg" />
<meta property="fb:app_id" content="1904065206497317" /><meta itemprop="wordCount" content="96">
<title>devopsdays Salt Lake City 2018 - contact information
</title>
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-9713393-1', 'auto');
ga('send', 'pageview');
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>
<link href="/css/site.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto+Condensed:300,400,700" rel="stylesheet"><link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
<link href="/events/index.xml" rel="alternate" type="application/rss+xml" title="DevOpsDays" />
<link href="/events/index.xml" rel="feed" type="application/rss+xml" title="DevOpsDays" />
<script src=/js/devopsdays-min.js></script></head>
<body lang="">
<nav class="navbar navbar-expand-md navbar-light">
<a class="navbar-brand" href="/">
<img src="/img/devopsdays-brain.png" height="30" class="d-inline-block align-top" alt="devopsdays Logo">
DevOpsDays
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto"><li class="nav-item global-navigation"><a class = "nav-link" href="/events">events</a></li><li class="nav-item global-navigation"><a class = "nav-link" href="/blog">blog</a></li><li class="nav-item global-navigation"><a class = "nav-link" href="/sponsor">sponsor</a></li><li class="nav-item global-navigation"><a class = "nav-link" href="/speaking">speaking</a></li><li class="nav-item global-navigation"><a class = "nav-link" href="/organizing">organizing</a></li><li class="nav-item global-navigation"><a class = "nav-link" href="/about">about</a></li></ul>
</div>
</nav>
<nav class="navbar event-navigation navbar-expand-md navbar-light">
<a href="/events/2018-salt-lake-city" class="nav-link">Salt Lake City</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar2">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse" id="navbar2">
<ul class="navbar-nav"><li class="nav-item active">
<a class="nav-link" href="https://www.slcdevopsdays.org">slcdevopsdays.org</a>
</li><li class="nav-item active">
<a class="nav-link" href="/events/2018-salt-lake-city/location">location</a>
</li><li class="nav-item active">
<a class="nav-link" href="https://www.slcdevopsdays.org/purchase-tickets/">registration</a>
</li><li class="nav-item active">
<a class="nav-link" href="https://www.slcdevopsdays.org/sponsorships/">sponsor</a>
</li><li class="nav-item active">
<a class="nav-link" href="/events/2018-salt-lake-city/contact">contact</a>
</li><li class="nav-item active">
<a class="nav-link" href="https://www.slcdevopsdays.org/code-of-conduct/">conduct</a>
</li></ul>
</div>
</nav>
<div class="container-fluid">
<div class="row">
<div class="col-md-12"><div class="row">
<div class="col-md-12 content-text"><h1>devopsdays Salt Lake City - Contact</h1>
<p>If you’d like to contact us by email: <a href='mailto:[email protected]?subject='>[email protected]</a>
</p>
<p><strong>Our local team</strong></p>
<div class="row" style="width:100%"><div class="col-xl-3 col-lg-4 col-md-6 organizer-card">
<div class = "card h-100" style="max-width: 300px;padding-left:0px;padding-right:0px">
<div class = "card-header">
<h3>Jason Vance</h3><h4>Organizer</h4>
</div><div class = "card-block"><h6 class="card-subtitle mb-2 text-muted">Accela, Inc.</h6><p class = "card-text">
</p><a href="https://twitter.com/jasonsvance" class="card-link"><i class="fa fa-twitter fa-2x" aria-hidden="true"></i></a> </div>
</div>
</div><div class="col-xl-3 col-lg-4 col-md-6 organizer-card">
<div class = "card h-100" style="max-width: 300px;padding-left:0px;padding-right:0px">
<div class = "card-header">
<h3>David Snider</h3><h4>Organizer</h4>
</div><img class="card-img-top organizer-image" src="/events/2018-salt-lake-city/organizers/david-snider.jpg" alt="David Snider"><div class = "card-block"><h6 class="card-subtitle mb-2 text-muted">Optum Technology</h6><p class = "card-text">
</p><a href="https://twitter.com/davidasnider" class="card-link"><i class="fa fa-twitter fa-2x" aria-hidden="true"></i></a> <a href = "https://www.facebook.com/david.snider.731"><i class="fa fa-facebook-official fa-2x" aria-hidden="true"></i></a> <a href = "https://www.linkedin.com/in/davidasnider/"><i class="fa fa-linkedin fa-2x" aria-hidden="true"></i></a> <a href = "https://github.com/davidasnider"><i class="fa fa-github fa-2x" aria-hidden="true"></i></a> </div>
</div>
</div><div class="col-xl-3 col-lg-4 col-md-6 organizer-card">
<div class = "card h-100" style="max-width: 300px;padding-left:0px;padding-right:0px">
<div class = "card-header">
<h3>Allia DeAngelis</h3><h4>Organizer</h4>
</div><div class = "card-block"><h6 class="card-subtitle mb-2 text-muted">NCR</h6><p class = "card-text">
</p><a href="https://twitter.com/adeangelis" class="card-link"><i class="fa fa-twitter fa-2x" aria-hidden="true"></i></a> </div>
</div>
</div><div class="col-xl-3 col-lg-4 col-md-6 organizer-card">
<div class = "card h-100" style="max-width: 300px;padding-left:0px;padding-right:0px">
<div class = "card-header">
<h3>Trent Cameron</h3><h4>Organizer</h4>
</div><div class = "card-block"><p class = "card-text">
</p><a href="https://twitter.com/tvc123" class="card-link"><i class="fa fa-twitter fa-2x" aria-hidden="true"></i></a> </div>
</div>
</div><div class="col-xl-3 col-lg-4 col-md-6 organizer-card">
<div class = "card h-100" style="max-width: 300px;padding-left:0px;padding-right:0px">
<div class = "card-header">
<h3>Tim Ward</h3><h4>Organizer</h4>
</div><div class = "card-block"><h6 class="card-subtitle mb-2 text-muted">Dell EMC</h6><p class = "card-text">
</p><a href="https://twitter.com/roboticward" class="card-link"><i class="fa fa-twitter fa-2x" aria-hidden="true"></i></a> <a href = "http://linkedin.com/in/tim-ward-419a2723"><i class="fa fa-linkedin fa-2x" aria-hidden="true"></i></a> </div>
</div>
</div><div class="col-xl-3 col-lg-4 col-md-6 organizer-card">
<div class = "card h-100" style="max-width: 300px;padding-left:0px;padding-right:0px">
<div class = "card-header">
<h3>Randall Mawhinnie</h3><h4>Organizer</h4>
</div><div class = "card-block"><h6 class="card-subtitle mb-2 text-muted">Virtustream, A Dell Technologies Business</h6><p class = "card-text">
</p><a href="https://twitter.com/rmawhinnie" class="card-link"><i class="fa fa-twitter fa-2x" aria-hidden="true"></i></a> </div>
</div>
</div><div class="col-xl-3 col-lg-4 col-md-6 organizer-card">
<div class = "card h-100" style="max-width: 300px;padding-left:0px;padding-right:0px">
<div class = "card-header">
<h3>Lindley White</h3><h4>Organizer</h4>
</div><div class = "card-block"><p class = "card-text">
</p></div>
</div>
</div><div class="col-xl-3 col-lg-4 col-md-6 organizer-card">
<div class = "card h-100" style="max-width: 300px;padding-left:0px;padding-right:0px">
<div class = "card-header">
<h3>Brett Palmer</h3><h4>Organizer</h4>
</div><img class="card-img-top organizer-image" src="/events/2018-salt-lake-city/organizers/brett-palmer.jpg" alt="Brett Palmer"><div class = "card-block"><h6 class="card-subtitle mb-2 text-muted">Department of Workforce Services</h6><p class = "card-text">
</p><a href="https://twitter.com/brettgpalmer" class="card-link"><i class="fa fa-twitter fa-2x" aria-hidden="true"></i></a> <a href = "http://www.linkedin.com/in/brett-palmer-161177"><i class="fa fa-linkedin fa-2x" aria-hidden="true"></i></a> </div>
</div>
</div><div class="col-xl-3 col-lg-4 col-md-6 organizer-card">
<div class = "card h-100" style="max-width: 300px;padding-left:0px;padding-right:0px">
<div class = "card-header">
<h3>Maria Bates</h3><h4>Organizer</h4>
</div><div class = "card-block"><p class = "card-text">
</p></div>
</div>
</div><div class="col-xl-3 col-lg-4 col-md-6 organizer-card">
<div class = "card h-100" style="max-width: 300px;padding-left:0px;padding-right:0px">
<div class = "card-header">
<h3>Barry McCormick</h3><h4>Organizer</h4>
</div><img class="card-img-top organizer-image" src="/events/2018-salt-lake-city/organizers/barry-mccormick.jpg" alt="Barry McCormick"><div class = "card-block"><h6 class="card-subtitle mb-2 text-muted">Digital Harbor</h6><p class = "card-text">
</p></div>
</div>
</div></div>
</ul>
<style>
.organizer-image {
max-width: 100%;
}
</style>
<p><strong>The core devopsdays organizer group</strong></p>
<em>Active</em><br>Bridget Kromhout (lead), Kris Buytaert, Serhat Can, Jennifer Davis, Bernd Erk, Rafael Gomes, Nathen Harvey, Matthew Jones, Dan Maher, Ken Mugrage, Mike Rosado, Andrew Clay Shafer, Matt Stratton (web team lead), John Willis<br>
<br>
<em>Historic</em><br>Patrick Debois (founder), Damon Edwards, Anthony Goddard, Lindsay Holmwood, Gildas Le Nadan, Stephen Nelson-Smith, Julian Simpson, Christian Trabold, John Vincent, James Wickett<br>
<br>
<br /><div class="row cta-row">
<div class="col-md-12"><h4 class="sponsor-cta">Platinum Sponsors</h4><a href = "/events/2018-salt-lake-city/sponsor" class="sponsor-cta"><i>Join as Platinum Sponsor!</i>
</a></div>
</div><div class="row sponsor-row"></div><div class="row cta-row">
<div class="col-md-12"><h4 class="sponsor-cta">Gold Sponsors</h4><a href = "/events/2018-salt-lake-city/sponsor" class="sponsor-cta"><i>Join as Gold Sponsor!</i>
</a></div>
</div><div class="row sponsor-row"><div class = "col-lg-1 col-md-2 col-4">
<a href = "https://www.instana.com"><img src = "/img/sponsors/instana-before-20200127.png" alt = "Instana" title = "Instana" class="img-fluid"></a>
</div><div class = "col-lg-1 col-md-2 col-4">
<a href = "http://www.opsgenie.com"><img src = "/img/sponsors/opsgenie.png" alt = "OpsGenie" title = "OpsGenie" class="img-fluid"></a>
</div><div class = "col-lg-1 col-md-2 col-4">
<a href = "http://www.victorops.com"><img src = "/img/sponsors/victorops-before-20180823.png" alt = "VictorOps" title = "VictorOps" class="img-fluid"></a>
</div><div class = "col-lg-1 col-md-2 col-4">
<a href = "https://www.xmatters.com/"><img src = "/img/sponsors/xmatters.png" alt = "xMatters, Inc" title = "xMatters, Inc" class="img-fluid"></a>
</div><div class = "col-lg-1 col-md-2 col-4">
<a href = "http://www.puppet.com"><img src = "/img/sponsors/puppet.png" alt = "Puppet" title = "Puppet" class="img-fluid"></a>
</div><div class = "col-lg-1 col-md-2 col-4">
<a href = "https://www.scalyr.com"><img src = "/img/sponsors/scalyr.png" alt = "Scalyr" title = "Scalyr" class="img-fluid"></a>
</div><div class = "col-lg-1 col-md-2 col-4">
<a href = "https://www.appdynamics.com/"><img src = "/img/sponsors/appdynamics-before-20190121.png" alt = "AppDynamics" title = "AppDynamics" class="img-fluid"></a>
</div><div class = "col-lg-1 col-md-2 col-4">
<a href = "http://chef.io"><img src = "/img/sponsors/chef.png" alt = "Chef Software, Inc" title = "Chef Software, Inc" class="img-fluid"></a>
</div></div><div class="row cta-row">
<div class="col-md-12"><h4 class="sponsor-cta">Silver Sponsors</h4></div>
</div><div class="row sponsor-row"><div class = "col-lg-1 col-md-2 col-4">
<a href = "https://mesosphere.com/"><img src = "/img/sponsors/mesosphere.png" alt = "Mesosphere" title = "Mesosphere" class="img-fluid"></a>
</div><div class = "col-lg-1 col-md-2 col-4">
<a href = "http://saltstack.com/"><img src = "/img/sponsors/saltstack.png" alt = "SaltStack" title = "SaltStack" class="img-fluid"></a>
</div><div class = "col-lg-1 col-md-2 col-4">
<a href = "https://www.accela.com"><img src = "/img/sponsors/accela.png" alt = "Accela, Inc" title = "Accela, Inc" class="img-fluid"></a>
</div><div class = "col-lg-1 col-md-2 col-4">
<a href = "https://hailstone.io"><img src = "/img/sponsors/hailstone.png" alt = "Hailstone" title = "Hailstone" class="img-fluid"></a>
</div><div class = "col-lg-1 col-md-2 col-4">
<a href = "https://www.elastic.co"><img src = "/img/sponsors/elastic.png" alt = "Elastic" title = "Elastic" class="img-fluid"></a>
</div><div class = "col-lg-1 col-md-2 col-4">
<a href = "https://www.bluematador.com"><img src = "/img/sponsors/bluematador-before-20180705.png" alt = "Blue Matador" title = "Blue Matador" class="img-fluid"></a>
</div></div><div class="row cta-row">
<div class="col-md-12"><h4 class="sponsor-cta">Community Sponsors</h4><a href = "/events/2018-salt-lake-city/sponsor" class="sponsor-cta"><i>Join as Community Sponsor!</i>
</a></div>
</div><div class="row sponsor-row"><div class = "col-lg-1 col-md-2 col-4">
<a href = "https://www.arresteddevops.com"><img src = "/img/sponsors/arresteddevops.png" alt = "Arrested DevOps" title = "Arrested DevOps" class="img-fluid"></a>
</div></div><br />
</div>
</div>
</div></div>
</div>
<nav class="navbar bottom navbar-light footer-nav-row" style="background-color: #bfbfc1;">
<div class = "row">
<div class = "col-md-12 footer-nav-background">
<div class = "row">
<div class = "col-md-6 col-lg-3 footer-nav-col">
<h3 class="footer-nav">@DEVOPSDAYS</h3>
<div>
<a class="twitter-timeline" data-dnt="true" href="https://twitter.com/devopsdays/lists/devopsdays" data-chrome="noheader" height="440"></a>
<script>
! function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0],
p = /^http:/.test(d.location) ? 'http' : 'https';
if (!d.getElementById(id)) {
js = d.createElement(s);
js.id = id;
js.src = p + "://platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js, fjs);
}
}(document, "script", "twitter-wjs");
</script>
</div>
</div>
<div class="col-md-6 col-lg-3 footer-nav-col footer-content">
<h3 class="footer-nav">BLOG</h3><a href = "https://www.devopsdays.org/blog/2019/05/10/10-years-of-devopsdays/"><h1 class = "footer-heading">10 years of devopsdays</h1></a><h2 class="footer-heading">by Kris Buytaert - 10 May, 2019</h2><p class="footer-content">It’s hard to believe but it is almost 10 years ago since #devopsdays happened for the first time in Gent. Back then there were almost 70 of us talking about topics that were of interest to both Operations and Development, we were exchanging our ideas and experiences `on how we were improving the quality of software delivery.
Our ideas got started on the crossroads of Open Source, Agile and early Cloud Adoption.</p><a href = "https://www.devopsdays.org/blog/"><h1 class = "footer-heading">Blogs</h1></a><h2 class="footer-heading">10 May, 2019</h2><p class="footer-content"></p><a href="https://www.devopsdays.org/blog/index.xml">Feed</a>
</div>
<div class="col-md-6 col-lg-3 footer-nav-col">
<h3 class="footer-nav">CFP OPEN</h3><a href = "/events/2019-campinas" class = "footer-content">Campinas</a><br /><a href = "/events/2019-macapa" class = "footer-content">Macapá</a><br /><a href = "/events/2019-shanghai" class = "footer-content">Shanghai</a><br /><a href = "/events/2019-recife" class = "footer-content">Recife</a><br /><a href = "/events/2020-charlotte" class = "footer-content">Charlotte</a><br /><a href = "/events/2020-prague" class = "footer-content">Prague</a><br /><a href = "/events/2020-tokyo" class = "footer-content">Tokyo</a><br /><a href = "/events/2020-salt-lake-city" class = "footer-content">Salt Lake City</a><br />
<br />Propose a talk at an event near you!<br />
</div>
<div class="col-md-6 col-lg-3 footer-nav-col">
<h3 class="footer-nav">About</h3>
devopsdays is a worldwide community conference series for anyone interested in IT improvement.<br /><br />
<a href="/about/" class = "footer-content">About devopsdays</a><br />
<a href="/privacy/" class = "footer-content">Privacy Policy</a><br />
<a href="/conduct/" class = "footer-content">Code of Conduct</a>
<br />
<br />
<a href="https://www.netlify.com">
<img src="/img/netlify-light.png" alt="Deploys by Netlify">
</a>
</div>
</div>
</div>
</div>
</nav>
<script>
$(document).ready(function () {
$("#share").jsSocials({
shares: ["email", {share: "twitter", via: 'devopsdaysslc'}, "facebook", "linkedin"],
text: 'devopsdays Salt Lake City - 2018',
showLabel: false,
showCount: false
});
});
</script>
</body>
</html>
|
{
"pile_set_name": "Github"
}
|
<?php
return array(
'attendize_register' => 'Gracias por registrarte en Attendize',
'invite_user' => ':name te ha añadido a la cuenta :app.',
'message_regarding_event' => 'Mensaje con respecto a: :event',
'organiser_copy' => '[Copia del organizador]',
'refund_from_name' => 'Has recibido un reembolso de :name',
'your_ticket_cancelled' => 'Tu entrada ha sido cancelada',
'your_ticket_for_event' => 'Tu entrada para el evento :event',
'LLH:obsolete' => array(),
);
|
{
"pile_set_name": "Github"
}
|
/*
* util.h
*
* helper function header file
*
* a Net::DNS like library for C
*
* (c) NLnet Labs, 2004
*
* See the file LICENSE for the license
*/
#ifndef _UTIL_H
#define _UTIL_H
#include <inttypes.h>
#include <sys/types.h>
#include <unistd.h>
#include <ldns/common.h>
#include <time.h>
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
#define dprintf(X,Y) fprintf(stderr, (X), (Y))
/* #define dprintf(X, Y) */
#define LDNS_VERSION "1.7.1"
#define LDNS_REVISION ((1<<16)|(7<<8)|(1))
/**
* splint static inline workaround
*/
#ifdef S_SPLINT_S
# define INLINE
#else
# ifdef SWIG
# define INLINE static
# else
# define INLINE static inline
# endif
#endif
/**
* Memory management macros
*/
#define LDNS_MALLOC(type) LDNS_XMALLOC(type, 1)
#define LDNS_XMALLOC(type, count) ((type *) malloc((count) * sizeof(type)))
#define LDNS_CALLOC(type, count) ((type *) calloc((count), sizeof(type)))
#define LDNS_REALLOC(ptr, type) LDNS_XREALLOC((ptr), type, 1)
#define LDNS_XREALLOC(ptr, type, count) \
((type *) realloc((ptr), (count) * sizeof(type)))
#define LDNS_FREE(ptr) \
do { free((ptr)); (ptr) = NULL; } while (0)
#define LDNS_DEP printf("DEPRECATED FUNCTION!\n");
/*
* Copy data allowing for unaligned accesses in network byte order
* (big endian).
*/
INLINE uint16_t
ldns_read_uint16(const void *src)
{
#ifdef ALLOW_UNALIGNED_ACCESSES
return ntohs(*(const uint16_t *) src);
#else
const uint8_t *p = (const uint8_t *) src;
return ((uint16_t) p[0] << 8) | (uint16_t) p[1];
#endif
}
INLINE uint32_t
ldns_read_uint32(const void *src)
{
#ifdef ALLOW_UNALIGNED_ACCESSES
return ntohl(*(const uint32_t *) src);
#else
const uint8_t *p = (const uint8_t *) src;
return ( ((uint32_t) p[0] << 24)
| ((uint32_t) p[1] << 16)
| ((uint32_t) p[2] << 8)
| (uint32_t) p[3]);
#endif
}
/*
* Copy data allowing for unaligned accesses in network byte order
* (big endian).
*/
INLINE void
ldns_write_uint16(void *dst, uint16_t data)
{
#ifdef ALLOW_UNALIGNED_ACCESSES
* (uint16_t *) dst = htons(data);
#else
uint8_t *p = (uint8_t *) dst;
p[0] = (uint8_t) ((data >> 8) & 0xff);
p[1] = (uint8_t) (data & 0xff);
#endif
}
INLINE void
ldns_write_uint32(void *dst, uint32_t data)
{
#ifdef ALLOW_UNALIGNED_ACCESSES
* (uint32_t *) dst = htonl(data);
#else
uint8_t *p = (uint8_t *) dst;
p[0] = (uint8_t) ((data >> 24) & 0xff);
p[1] = (uint8_t) ((data >> 16) & 0xff);
p[2] = (uint8_t) ((data >> 8) & 0xff);
p[3] = (uint8_t) (data & 0xff);
#endif
}
/* warning. */
INLINE void
ldns_write_uint64_as_uint48(void *dst, uint64_t data)
{
uint8_t *p = (uint8_t *) dst;
p[0] = (uint8_t) ((data >> 40) & 0xff);
p[1] = (uint8_t) ((data >> 32) & 0xff);
p[2] = (uint8_t) ((data >> 24) & 0xff);
p[3] = (uint8_t) ((data >> 16) & 0xff);
p[4] = (uint8_t) ((data >> 8) & 0xff);
p[5] = (uint8_t) (data & 0xff);
}
/**
* Structure to do a Schwartzian-like transformation, for instance when
* sorting. If you need a transformation on the objects that are sorted,
* you can sue this to store the transformed values, so you do not
* need to do the transformation again for each comparison
*/
struct ldns_schwartzian_compare_struct {
void *original_object;
void *transformed_object;
};
/** A general purpose lookup table
*
* Lookup tables are arrays of (id, name) pairs,
* So you can for instance lookup the RCODE 3, which is "NXDOMAIN",
* and vice versa. The lookup tables themselves are defined wherever needed,
* for instance in \ref host2str.c
*/
struct ldns_struct_lookup_table {
int id;
const char *name;
};
typedef struct ldns_struct_lookup_table ldns_lookup_table;
/**
* Looks up the table entry by name, returns NULL if not found.
* \param[in] table the lookup table to search in
* \param[in] name what to search for
* \return the item found
*/
ldns_lookup_table *ldns_lookup_by_name(ldns_lookup_table table[],
const char *name);
/**
* Looks up the table entry by id, returns NULL if not found.
* \param[in] table the lookup table to search in
* \param[in] id what to search for
* \return the item found
*/
ldns_lookup_table *ldns_lookup_by_id(ldns_lookup_table table[], int id);
/**
* Returns the value of the specified bit
* The bits are counted from left to right, so bit #0 is the
* left most bit.
* \param[in] bits array holding the bits
* \param[in] index to the wanted bit
* \return
*/
int ldns_get_bit(uint8_t bits[], size_t index);
/**
* Returns the value of the specified bit
* The bits are counted from right to left, so bit #0 is the
* right most bit.
* \param[in] bits array holding the bits
* \param[in] index to the wanted bit
* \return 1 or 0 depending no the bit state
*/
int ldns_get_bit_r(uint8_t bits[], size_t index);
/**
* sets the specified bit in the specified byte to
* 1 if value is true, 0 if false
* The bits are counted from right to left, so bit #0 is the
* right most bit.
* \param[in] byte the bit to set the bit in
* \param[in] bit_nr the bit to set (0 <= n <= 7)
* \param[in] value whether to set the bit to 1 or 0
* \return 1 or 0 depending no the bit state
*/
void ldns_set_bit(uint8_t *byte, int bit_nr, bool value);
/**
* Returns the value of a to the power of b
* (or 1 of b < 1)
*/
/*@unused@*/
INLINE long
ldns_power(long a, long b) {
long result = 1;
while (b > 0) {
if (b & 1) {
result *= a;
if (b == 1) {
return result;
}
}
a *= a;
b /= 2;
}
return result;
}
/**
* Returns the int value of the given (hex) digit
* \param[in] ch the hex char to convert
* \return the converted decimal value
*/
int ldns_hexdigit_to_int(char ch);
/**
* Returns the char (hex) representation of the given int
* \param[in] ch the int to convert
* \return the converted hex char
*/
char ldns_int_to_hexdigit(int ch);
/**
* Converts a hex string to binary data
*
* \param[out] data The binary result is placed here.
* At least strlen(str)/2 bytes should be allocated
* \param[in] str The hex string to convert.
* This string should not contain spaces
* \return The number of bytes of converted data, or -1 if one of the arguments * is NULL, or -2 if the string length is not an even number
*/
int
ldns_hexstring_to_data(uint8_t *data, const char *str);
/**
* Show the internal library version
* \return a string with the version in it
*/
const char * ldns_version(void);
/**
* Convert TM to seconds since epoch (midnight, January 1st, 1970).
* Like timegm(3), which is not always available.
* \param[in] tm a struct tm* with the date
* \return the seconds since epoch
*/
time_t ldns_mktime_from_utc(const struct tm *tm);
time_t mktime_from_utc(const struct tm *tm);
/**
* The function interprets time as the number of seconds since epoch
* with respect to now using serial arithmitics (rfc1982).
* That number of seconds is then converted to broken-out time information.
* This is especially useful when converting the inception and expiration
* fields of RRSIG records.
*
* \param[in] time number of seconds since epoch (midnight, January 1st, 1970)
* to be intepreted as a serial arithmitics number relative to now.
* \param[in] now number of seconds since epoch (midnight, January 1st, 1970)
* to which the time value is compared to determine the final value.
* \param[out] result the struct with the broken-out time information
* \return result on success or NULL on error
*/
struct tm * ldns_serial_arithmitics_gmtime_r(int32_t time, time_t now, struct tm *result);
/**
* Seed the random function.
* If the file descriptor is specified, the random generator is seeded with
* data from that file. If not, /dev/urandom is used.
*
* applications should call this if they need entropy data within ldns
* If openSSL is available, it is automatically seeded from /dev/urandom
* or /dev/random.
*
* If you need more entropy, or have no openssl available, this function
* MUST be called at the start of the program
*
* If openssl *is* available, this function just adds more entropy
*
* \param[in] fd a file providing entropy data for the seed
* \param[in] size the number of bytes to use as entropy data. If this is 0,
* only the minimal amount is taken (usually 4 bytes)
* \return 0 if seeding succeeds, 1 if it fails
*/
int ldns_init_random(FILE *fd, unsigned int size);
/**
* Get random number.
* \return random number.
*
*/
uint16_t ldns_get_random(void);
/**
* Encode data as BubbleBabble
*
* \param[in] data a pointer to data to be encoded
* \param[in] len size the number of bytes of data
* \return a string of BubbleBabble
*/
char *ldns_bubblebabble(uint8_t *data, size_t len);
INLINE time_t ldns_time(time_t *t) { return time(t); }
/**
* calculates the size needed to store the result of b32_ntop
*/
/*@unused@*/
INLINE size_t ldns_b32_ntop_calculate_size(size_t src_data_length)
{
return src_data_length == 0 ? 0 : ((src_data_length - 1) / 5 + 1) * 8;
}
INLINE size_t ldns_b32_ntop_calculate_size_no_padding(size_t src_data_length)
{
return ((src_data_length + 3) * 8 / 5) - 4;
}
int ldns_b32_ntop(const uint8_t* src_data, size_t src_data_length,
char* target_text_buffer, size_t target_text_buffer_size);
int ldns_b32_ntop_extended_hex(const uint8_t* src_data, size_t src_data_length,
char* target_text_buffer, size_t target_text_buffer_size);
#if ! LDNS_BUILD_CONFIG_HAVE_B32_NTOP
int b32_ntop(const uint8_t* src_data, size_t src_data_length,
char* target_text_buffer, size_t target_text_buffer_size);
int b32_ntop_extended_hex(const uint8_t* src_data, size_t src_data_length,
char* target_text_buffer, size_t target_text_buffer_size);
#endif /* ! LDNS_BUILD_CONFIG_HAVE_B32_NTOP */
/**
* calculates the size needed to store the result of b32_pton
*/
/*@unused@*/
INLINE size_t ldns_b32_pton_calculate_size(size_t src_text_length)
{
return src_text_length * 5 / 8;
}
int ldns_b32_pton(const char* src_text, size_t src_text_length,
uint8_t* target_data_buffer, size_t target_data_buffer_size);
int ldns_b32_pton_extended_hex(const char* src_text, size_t src_text_length,
uint8_t* target_data_buffer, size_t target_data_buffer_size);
#if ! LDNS_BUILD_CONFIG_HAVE_B32_PTON
int b32_pton(const char* src_text, size_t src_text_length,
uint8_t* target_data_buffer, size_t target_data_buffer_size);
int b32_pton_extended_hex(const char* src_text, size_t src_text_length,
uint8_t* target_data_buffer, size_t target_data_buffer_size);
#endif /* ! LDNS_BUILD_CONFIG_HAVE_B32_PTON */
#ifdef __cplusplus
}
#endif
#endif /* !_UTIL_H */
|
{
"pile_set_name": "Github"
}
|
julia 0.6
DynamicalSystemsBase 0.2.0 0.2.1
OrdinaryDiffEq 2.17.0
ForwardDiff 0.5
Requires 0.4.3
LsqFit 0.3.0
StaticArrays 0.5.0
StatsBase 0.8.2
NearestNeighbors 0.1.0
IterTools 0.1.0
Distances
Combinatorics
Reexport
|
{
"pile_set_name": "Github"
}
|
{
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "item",
"name": "ancientwarfarenpc:coin",
"weight": 1,
"functions": [
{
"function": "set_count",
"count": {
"min": 1,
"max": 8
}
},
{
"function": "set_nbt",
"tag": "{metal:\"copper\"}"
}
]
}
]
}
]
}
|
{
"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.
package fake
import (
rest "k8s.io/client-go/rest"
testing "k8s.io/client-go/testing"
)
type FakeEvents struct {
*testing.Fake
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeEvents) RESTClient() rest.Interface {
var ret *rest.RESTClient
return ret
}
|
{
"pile_set_name": "Github"
}
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* 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/.
*
* This file incorporates work covered by the following license notice:
*
* 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 .
*/
#include <transliteration_Ignore.hxx>
#include <numeric>
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
namespace i18npool {
const sal_Unicode table_normalwidth[] = {
// 0x0000, // 0x3040
0x3041, // 0x3041 HIRAGANA LETTER SMALL A
0x3042, // 0x3042 HIRAGANA LETTER A
0x3043, // 0x3043 HIRAGANA LETTER SMALL I
0x3044, // 0x3044 HIRAGANA LETTER I
0x3045, // 0x3045 HIRAGANA LETTER SMALL U
0x3046, // 0x3046 HIRAGANA LETTER U
0x3047, // 0x3047 HIRAGANA LETTER SMALL E
0x3048, // 0x3048 HIRAGANA LETTER E
0x3049, // 0x3049 HIRAGANA LETTER SMALL O
0x304a, // 0x304a HIRAGANA LETTER O
0x3042, // 0x304b HIRAGANA LETTER KA
0x3042, // 0x304c HIRAGANA LETTER GA
0x3044, // 0x304d HIRAGANA LETTER KI
0x3044, // 0x304e HIRAGANA LETTER GI
0x3046, // 0x304f HIRAGANA LETTER KU
0x3046, // 0x3050 HIRAGANA LETTER GU
0x3048, // 0x3051 HIRAGANA LETTER KE
0x3048, // 0x3052 HIRAGANA LETTER GE
0x304a, // 0x3053 HIRAGANA LETTER KO
0x304a, // 0x3054 HIRAGANA LETTER GO
0x3042, // 0x3055 HIRAGANA LETTER SA
0x3042, // 0x3056 HIRAGANA LETTER ZA
0x3044, // 0x3057 HIRAGANA LETTER SI
0x3044, // 0x3058 HIRAGANA LETTER ZI
0x3046, // 0x3059 HIRAGANA LETTER SU
0x3046, // 0x305a HIRAGANA LETTER ZU
0x3048, // 0x305b HIRAGANA LETTER SE
0x3048, // 0x305c HIRAGANA LETTER ZE
0x304a, // 0x305d HIRAGANA LETTER SO
0x304a, // 0x305e HIRAGANA LETTER ZO
0x3042, // 0x305f HIRAGANA LETTER TA
0x3042, // 0x3060 HIRAGANA LETTER DA
0x3044, // 0x3061 HIRAGANA LETTER TI
0x3044, // 0x3062 HIRAGANA LETTER DI
0x3045, // 0x3063 HIRAGANA LETTER SMALL TU
0x3046, // 0x3064 HIRAGANA LETTER TU
0x3046, // 0x3065 HIRAGANA LETTER DU
0x3048, // 0x3066 HIRAGANA LETTER TE
0x3048, // 0x3067 HIRAGANA LETTER DE
0x304a, // 0x3068 HIRAGANA LETTER TO
0x304a, // 0x3069 HIRAGANA LETTER DO
0x3042, // 0x306a HIRAGANA LETTER NA
0x3044, // 0x306b HIRAGANA LETTER NI
0x3046, // 0x306c HIRAGANA LETTER NU
0x3048, // 0x306d HIRAGANA LETTER NE
0x304a, // 0x306e HIRAGANA LETTER NO
0x3042, // 0x306f HIRAGANA LETTER HA
0x3042, // 0x3070 HIRAGANA LETTER BA
0x3042, // 0x3071 HIRAGANA LETTER PA
0x3044, // 0x3072 HIRAGANA LETTER HI
0x3044, // 0x3073 HIRAGANA LETTER BI
0x3044, // 0x3074 HIRAGANA LETTER PI
0x3046, // 0x3075 HIRAGANA LETTER HU
0x3046, // 0x3076 HIRAGANA LETTER BU
0x3046, // 0x3077 HIRAGANA LETTER PU
0x3048, // 0x3078 HIRAGANA LETTER HE
0x3048, // 0x3079 HIRAGANA LETTER BE
0x3048, // 0x307a HIRAGANA LETTER PE
0x304a, // 0x307b HIRAGANA LETTER HO
0x304a, // 0x307c HIRAGANA LETTER BO
0x304a, // 0x307d HIRAGANA LETTER PO
0x3042, // 0x307e HIRAGANA LETTER MA
0x3044, // 0x307f HIRAGANA LETTER MI
0x3046, // 0x3080 HIRAGANA LETTER MU
0x3048, // 0x3081 HIRAGANA LETTER ME
0x304a, // 0x3082 HIRAGANA LETTER MO
0x3041, // 0x3083 HIRAGANA LETTER SMALL YA
0x3042, // 0x3084 HIRAGANA LETTER YA
0x3045, // 0x3085 HIRAGANA LETTER SMALL YU
0x3046, // 0x3086 HIRAGANA LETTER YU
0x3049, // 0x3087 HIRAGANA LETTER SMALL YO
0x304a, // 0x3088 HIRAGANA LETTER YO
0x3042, // 0x3089 HIRAGANA LETTER RA
0x3044, // 0x308a HIRAGANA LETTER RI
0x3046, // 0x308b HIRAGANA LETTER RU
0x3048, // 0x308c HIRAGANA LETTER RE
0x304a, // 0x308d HIRAGANA LETTER RO
0x3041, // 0x308e HIRAGANA LETTER SMALL WA
0x3042, // 0x308f HIRAGANA LETTER WA
0x3044, // 0x3090 HIRAGANA LETTER WI
0x3048, // 0x3091 HIRAGANA LETTER WE
0x304a, // 0x3092 HIRAGANA LETTER WO
0x0000, // 0x3093 HIRAGANA LETTER N
0x3046, // 0x3094 HIRAGANA LETTER VU
0x0000, // 0x3095
0x0000, // 0x3096
0x0000, // 0x3097
0x0000, // 0x3098
0x0000, // 0x3099 COMBINING KATAKANA-HIRAGANA VOICED SOUND MARK
0x0000, // 0x309a COMBINING KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK
0x0000, // 0x309b KATAKANA-HIRAGANA VOICED SOUND MARK
0x0000, // 0x309c KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK
0x0000, // 0x309d HIRAGANA ITERATION MARK
0x0000, // 0x309e HIRAGANA VOICED ITERATION MARK
0x0000, // 0x309f
0x0000, // 0x30a0
0x30a1, // 0x30a1 KATAKANA LETTER SMALL A
0x30a2, // 0x30a2 KATAKANA LETTER A
0x30a3, // 0x30a3 KATAKANA LETTER SMALL I
0x30a4, // 0x30a4 KATAKANA LETTER I
0x30a5, // 0x30a5 KATAKANA LETTER SMALL U
0x30a6, // 0x30a6 KATAKANA LETTER U
0x30a7, // 0x30a7 KATAKANA LETTER SMALL E
0x30a8, // 0x30a8 KATAKANA LETTER E
0x30a9, // 0x30a9 KATAKANA LETTER SMALL O
0x30aa, // 0x30aa KATAKANA LETTER O
0x30a2, // 0x30ab KATAKANA LETTER KA
0x30a2, // 0x30ac KATAKANA LETTER GA
0x30a4, // 0x30ad KATAKANA LETTER KI
0x30a4, // 0x30ae KATAKANA LETTER GI
0x30a6, // 0x30af KATAKANA LETTER KU
0x30a6, // 0x30b0 KATAKANA LETTER GU
0x30a8, // 0x30b1 KATAKANA LETTER KE
0x30a8, // 0x30b2 KATAKANA LETTER GE
0x30aa, // 0x30b3 KATAKANA LETTER KO
0x30aa, // 0x30b4 KATAKANA LETTER GO
0x30a2, // 0x30b5 KATAKANA LETTER SA
0x30a2, // 0x30b6 KATAKANA LETTER ZA
0x30a4, // 0x30b7 KATAKANA LETTER SI
0x30a4, // 0x30b8 KATAKANA LETTER ZI
0x30a6, // 0x30b9 KATAKANA LETTER SU
0x30a6, // 0x30ba KATAKANA LETTER ZU
0x30a8, // 0x30bb KATAKANA LETTER SE
0x30a8, // 0x30bc KATAKANA LETTER ZE
0x30aa, // 0x30bd KATAKANA LETTER SO
0x30aa, // 0x30be KATAKANA LETTER ZO
0x30a2, // 0x30bf KATAKANA LETTER TA
0x30a2, // 0x30c0 KATAKANA LETTER DA
0x30a4, // 0x30c1 KATAKANA LETTER TI
0x30a4, // 0x30c2 KATAKANA LETTER DI
0x30a5, // 0x30c3 KATAKANA LETTER SMALL TU
0x30a6, // 0x30c4 KATAKANA LETTER TU
0x30a6, // 0x30c5 KATAKANA LETTER DU
0x30a8, // 0x30c6 KATAKANA LETTER TE
0x30a8, // 0x30c7 KATAKANA LETTER DE
0x30aa, // 0x30c8 KATAKANA LETTER TO
0x30aa, // 0x30c9 KATAKANA LETTER DO
0x30a2, // 0x30ca KATAKANA LETTER NA
0x30a4, // 0x30cb KATAKANA LETTER NI
0x30a6, // 0x30cc KATAKANA LETTER NU
0x30a8, // 0x30cd KATAKANA LETTER NE
0x30aa, // 0x30ce KATAKANA LETTER NO
0x30a2, // 0x30cf KATAKANA LETTER HA
0x30a2, // 0x30d0 KATAKANA LETTER BA
0x30a2, // 0x30d1 KATAKANA LETTER PA
0x30a4, // 0x30d2 KATAKANA LETTER HI
0x30a4, // 0x30d3 KATAKANA LETTER BI
0x30a4, // 0x30d4 KATAKANA LETTER PI
0x30a6, // 0x30d5 KATAKANA LETTER HU
0x30a6, // 0x30d6 KATAKANA LETTER BU
0x30a6, // 0x30d7 KATAKANA LETTER PU
0x30a8, // 0x30d8 KATAKANA LETTER HE
0x30a8, // 0x30d9 KATAKANA LETTER BE
0x30a8, // 0x30da KATAKANA LETTER PE
0x30aa, // 0x30db KATAKANA LETTER HO
0x30aa, // 0x30dc KATAKANA LETTER BO
0x30aa, // 0x30dd KATAKANA LETTER PO
0x30a2, // 0x30de KATAKANA LETTER MA
0x30a4, // 0x30df KATAKANA LETTER MI
0x30a6, // 0x30e0 KATAKANA LETTER MU
0x30a8, // 0x30e1 KATAKANA LETTER ME
0x30aa, // 0x30e2 KATAKANA LETTER MO
0x30a1, // 0x30e3 KATAKANA LETTER SMALL YA
0x30a2, // 0x30e4 KATAKANA LETTER YA
0x30a5, // 0x30e5 KATAKANA LETTER SMALL YU
0x30a6, // 0x30e6 KATAKANA LETTER YU
0x30a9, // 0x30e7 KATAKANA LETTER SMALL YO
0x30aa, // 0x30e8 KATAKANA LETTER YO
0x30a2, // 0x30e9 KATAKANA LETTER RA
0x30a4, // 0x30ea KATAKANA LETTER RI
0x30a6, // 0x30eb KATAKANA LETTER RU
0x30a8, // 0x30ec KATAKANA LETTER RE
0x30aa, // 0x30ed KATAKANA LETTER RO
0x30a1, // 0x30ee KATAKANA LETTER SMALL WA
0x30a2, // 0x30ef KATAKANA LETTER WA
0x30a4, // 0x30f0 KATAKANA LETTER WI
0x30a8, // 0x30f1 KATAKANA LETTER WE
0x30aa, // 0x30f2 KATAKANA LETTER WO
0x0000, // 0x30f3 KATAKANA LETTER N
0x30a6, // 0x30f4 KATAKANA LETTER VU
0x30a1, // 0x30f5 KATAKANA LETTER SMALL KA
0x30a7, // 0x30f6 KATAKANA LETTER SMALL KE
0x30a2, // 0x30f7 KATAKANA LETTER VA
0x30a4, // 0x30f8 KATAKANA LETTER VI
0x30a8, // 0x30f9 KATAKANA LETTER VE
0x30aa // 0x30fa KATAKANA LETTER VO
// 0x0000, // 0x30fb KATAKANA MIDDLE DOT
// 0x0000, // 0x30fc KATAKANA-HIRAGANA PROLONGED SOUND MARK
// 0x0000, // 0x30fd KATAKANA ITERATION MARK
// 0x0000, // 0x30fe KATAKANA VOICED ITERATION MARK
// 0x0000 // 0x30ff
};
const sal_Unicode table_halfwidth[] = {
// 0x0000, // 0xff61 HALFWIDTH IDEOGRAPHIC FULL STOP
// 0x0000, // 0xff62 HALFWIDTH LEFT CORNER BRACKET
// 0x0000, // 0xff63 HALFWIDTH RIGHT CORNER BRACKET
// 0x0000, // 0xff64 HALFWIDTH IDEOGRAPHIC COMMA
// 0x0000, // 0xff65 HALFWIDTH KATAKANA MIDDLE DOT
0xff75, // 0xff66 HALFWIDTH KATAKANA LETTER WO
0xff67, // 0xff67 HALFWIDTH KATAKANA LETTER SMALL A
0xff68, // 0xff68 HALFWIDTH KATAKANA LETTER SMALL I
0xff69, // 0xff69 HALFWIDTH KATAKANA LETTER SMALL U
0xff6a, // 0xff6a HALFWIDTH KATAKANA LETTER SMALL E
0xff6b, // 0xff6b HALFWIDTH KATAKANA LETTER SMALL O
0xff67, // 0xff6c HALFWIDTH KATAKANA LETTER SMALL YA
0xff69, // 0xff6d HALFWIDTH KATAKANA LETTER SMALL YU
0xff6b, // 0xff6e HALFWIDTH KATAKANA LETTER SMALL YO
0xff69, // 0xff6f HALFWIDTH KATAKANA LETTER SMALL TU
0x0000, // 0xff70 HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK
0xff71, // 0xff71 HALFWIDTH KATAKANA LETTER A
0xff72, // 0xff72 HALFWIDTH KATAKANA LETTER I
0xff73, // 0xff73 HALFWIDTH KATAKANA LETTER U
0xff74, // 0xff74 HALFWIDTH KATAKANA LETTER E
0xff75, // 0xff75 HALFWIDTH KATAKANA LETTER O
0xff71, // 0xff76 HALFWIDTH KATAKANA LETTER KA
0xff72, // 0xff77 HALFWIDTH KATAKANA LETTER KI
0xff73, // 0xff78 HALFWIDTH KATAKANA LETTER KU
0xff74, // 0xff79 HALFWIDTH KATAKANA LETTER KE
0xff75, // 0xff7a HALFWIDTH KATAKANA LETTER KO
0xff71, // 0xff7b HALFWIDTH KATAKANA LETTER SA
0xff72, // 0xff7c HALFWIDTH KATAKANA LETTER SI
0xff73, // 0xff7d HALFWIDTH KATAKANA LETTER SU
0xff74, // 0xff7e HALFWIDTH KATAKANA LETTER SE
0xff75, // 0xff7f HALFWIDTH KATAKANA LETTER SO
0xff71, // 0xff80 HALFWIDTH KATAKANA LETTER TA
0xff72, // 0xff81 HALFWIDTH KATAKANA LETTER TI
0xff73, // 0xff82 HALFWIDTH KATAKANA LETTER TU
0xff74, // 0xff83 HALFWIDTH KATAKANA LETTER TE
0xff75, // 0xff84 HALFWIDTH KATAKANA LETTER TO
0xff71, // 0xff85 HALFWIDTH KATAKANA LETTER NA
0xff72, // 0xff86 HALFWIDTH KATAKANA LETTER NI
0xff73, // 0xff87 HALFWIDTH KATAKANA LETTER NU
0xff74, // 0xff88 HALFWIDTH KATAKANA LETTER NE
0xff75, // 0xff89 HALFWIDTH KATAKANA LETTER NO
0xff71, // 0xff8a HALFWIDTH KATAKANA LETTER HA
0xff72, // 0xff8b HALFWIDTH KATAKANA LETTER HI
0xff73, // 0xff8c HALFWIDTH KATAKANA LETTER HU
0xff74, // 0xff8d HALFWIDTH KATAKANA LETTER HE
0xff75, // 0xff8e HALFWIDTH KATAKANA LETTER HO
0xff71, // 0xff8f HALFWIDTH KATAKANA LETTER MA
0xff72, // 0xff90 HALFWIDTH KATAKANA LETTER MI
0xff73, // 0xff91 HALFWIDTH KATAKANA LETTER MU
0xff74, // 0xff92 HALFWIDTH KATAKANA LETTER ME
0xff75, // 0xff93 HALFWIDTH KATAKANA LETTER MO
0xff71, // 0xff94 HALFWIDTH KATAKANA LETTER YA
0xff73, // 0xff95 HALFWIDTH KATAKANA LETTER YU
0xff75, // 0xff96 HALFWIDTH KATAKANA LETTER YO
0xff71, // 0xff97 HALFWIDTH KATAKANA LETTER RA
0xff72, // 0xff98 HALFWIDTH KATAKANA LETTER RI
0xff73, // 0xff99 HALFWIDTH KATAKANA LETTER RU
0xff74, // 0xff9a HALFWIDTH KATAKANA LETTER RE
0xff75, // 0xff9b HALFWIDTH KATAKANA LETTER RO
0xff71 // 0xff9c HALFWIDTH KATAKANA LETTER WA
// 0x0000, // 0xff9d HALFWIDTH KATAKANA LETTER N
// 0x0000, // 0xff9e HALFWIDTH KATAKANA VOICED SOUND MARK
// 0x0000 // 0xff9f HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK
};
OUString
ignoreProlongedSoundMark_ja_JP::foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset, bool useOffset )
{
// Create a string buffer which can hold nCount + 1 characters.
// The reference count is 1 now.
rtl_uString * newStr = rtl_uString_alloc(nCount);
sal_Unicode * dst = newStr->buffer;
const sal_Unicode * src = inStr.getStr() + startPos;
if (useOffset) {
// Allocate nCount length to offset argument.
offset.realloc( nCount );
std::iota(offset.begin(), offset.end(), startPos);
}
sal_Unicode previousChar = *src ++;
sal_Unicode currentChar;
// Conversion
while (-- nCount > 0) {
currentChar = *src ++;
if (currentChar == 0x30fc || // KATAKANA-HIRAGANA PROLONGED SOUND MARK
currentChar == 0xff70) { // HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK
if (0x3041 <= previousChar && previousChar <= 0x30fa) {
currentChar = table_normalwidth[ previousChar - 0x3041 ];
}
else if (0xff66 <= previousChar && previousChar <= 0xff9c) {
currentChar = table_halfwidth[ previousChar - 0xff66 ];
}
}
*dst ++ = previousChar;
previousChar = currentChar;
}
if (nCount == 0) {
*dst ++ = previousChar;
}
*dst = u'\0';
newStr->length = sal_Int32(dst - newStr->buffer);
if (useOffset)
offset.realloc(newStr->length);
return OUString(newStr, SAL_NO_ACQUIRE); // take ownership
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
{
"pile_set_name": "Github"
}
|
{r = (s = )}
{r = (s = hi)}
|
{
"pile_set_name": "Github"
}
|
// RUN: clang-import-test -x objective-c++ -import %S/Inputs/S.m -expression %s
@class D;
@interface B {
int x;
int y;
}
@end
@interface D : B {
int z;
}
-(int)n;
@end
void expr() {
C *c;
int i = [c m];
D *d;
int j = [d n] + d->x;
}
|
{
"pile_set_name": "Github"
}
|
// -------------------------------------------------------------------------
// Copyright (C) 2019 BMW AG
// -------------------------------------------------------------------------
// 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 https://mozilla.org/MPL/2.0/.
// -------------------------------------------------------------------------
#include "SharedSceneState.h"
namespace ramses
{
void SharedSceneState::setActualState(RendererSceneState state)
{
m_actualState = state;
updateLastHighestStateAndOwner();
}
RendererSceneState SharedSceneState::getActualState() const
{
return m_actualState;
}
void SharedSceneState::setDesiredState(ContentID contentID, RendererSceneState state)
{
m_desiredStates[contentID] = state;
updateLastHighestStateAndOwner();
}
RendererSceneState SharedSceneState::getConsolidatedDesiredState() const
{
RendererSceneState state = RendererSceneState::Unavailable;
for (const auto& desiredStateIt : m_desiredStates)
state = std::max(state, desiredStateIt.second);
return state;
}
RendererSceneState SharedSceneState::getCurrentStateForContent(ContentID contentID) const
{
const auto desiredStateIt = m_desiredStates.find(contentID);
if (desiredStateIt == m_desiredStates.cend())
return RendererSceneState::Unavailable;
// content is owner of last highest state, report actual scene state
if (contentID == m_lastHighestStateOwner)
return m_actualState;
// content is not owner of last highest state
// report actual state or desired state, whichever is lower
return std::min(m_actualState, desiredStateIt->second);
}
void SharedSceneState::updateLastHighestStateAndOwner()
{
// Desired behavior is that the last state owner is defined as the one who triggered the actual state to be pushed highest.
// The last state owner keeps being owner until someone else desires at least the level of actual state
// (or the actual state drops to a desired state of another content).
// find last highest state and its owner
RendererSceneState maxCurrentlyDesiredState = RendererSceneState::Unavailable;
ContentID maxCurrentlyDesiredStateOwner = ContentID::Invalid();
for (const auto& it : m_desiredStates)
{
if (it.second >= maxCurrentlyDesiredState)
{
maxCurrentlyDesiredStateOwner = it.first;
maxCurrentlyDesiredState = it.second;
}
}
// update last highest state and owner only if desiring equal or higher than actual state
if (maxCurrentlyDesiredState >= m_actualState)
{
m_lastHighestStateOwner = maxCurrentlyDesiredStateOwner;
m_lastHighestDesiredState = maxCurrentlyDesiredState;
}
}
}
|
{
"pile_set_name": "Github"
}
|
{
"_from": "fast-deep-equal@^1.0.0",
"_id": "[email protected]",
"_inBundle": false,
"_integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=",
"_location": "/fast-deep-equal",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "fast-deep-equal@^1.0.0",
"name": "fast-deep-equal",
"escapedName": "fast-deep-equal",
"rawSpec": "^1.0.0",
"saveSpec": null,
"fetchSpec": "^1.0.0"
},
"_requiredBy": [
"/ajv"
],
"_resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz",
"_shasum": "c053477817c86b51daa853c81e059b733d023614",
"_spec": "fast-deep-equal@^1.0.0",
"_where": "/Users/sunxin/DOClever/node_modules/ajv",
"author": {
"name": "Evgeny Poberezkin"
},
"bugs": {
"url": "https://github.com/epoberezkin/fast-deep-equal/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Fast deep equal",
"devDependencies": {
"benchmark": "^2.1.4",
"coveralls": "^2.13.1",
"deep-eql": "^2.0.2",
"deep-equal": "^1.0.1",
"eslint": "^4.0.0",
"lodash": "^4.17.4",
"mocha": "^3.4.2",
"nano-equal": "^1.0.1",
"nyc": "^11.0.2",
"pre-commit": "^1.2.2",
"shallow-equal-fuzzy": "0.0.2",
"typescript": "^2.6.1",
"underscore": "^1.8.3"
},
"files": [
"index.js",
"index.d.ts"
],
"homepage": "https://github.com/epoberezkin/fast-deep-equal#readme",
"keywords": [
"fast",
"equal",
"deep-equal"
],
"license": "MIT",
"main": "index.js",
"name": "fast-deep-equal",
"nyc": {
"exclude": [
"**/spec/**",
"node_modules"
],
"reporter": [
"lcov",
"text-summary"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/epoberezkin/fast-deep-equal.git"
},
"scripts": {
"eslint": "eslint *.js benchmark spec",
"test": "npm run eslint && npm run test-ts && npm run test-cov",
"test-cov": "nyc npm run test-spec",
"test-spec": "mocha spec/*.spec.js -R spec",
"test-ts": "tsc --target ES5 --noImplicitAny index.d.ts"
},
"types": "index.d.ts",
"version": "1.1.0"
}
|
{
"pile_set_name": "Github"
}
|
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -Wsystem-headers %s
// libstdc++4.6 in debug mode has explicit default constructors.
// stlport has this for all containers.
#ifdef BE_THE_HEADER
#pragma clang system_header
namespace std {
namespace __debug {
template <class T>
class vector {
public:
explicit vector() {} // expected-warning 2 {{should not be explicit}}
};
}
}
#else
#define BE_THE_HEADER
#include __FILE__
struct { int a, b; std::__debug::vector<int> c; } e[] = { {1, 1} }; // expected-note{{used in initialization here}}
// expected-warning@+1 {{expression with side effects has no effect in an unevaluated context}}
decltype(new std::__debug::vector<int>[1]{}) x; // expected-note{{used in initialization here}}
#endif
|
{
"pile_set_name": "Github"
}
|
class {{Namespace}}_{{Module}}_Block_Adminhtml_{{Entity}}_Edit_Form extends {{Namespace}}_{{Module}}_Block_Adminhtml_{{Entity}}_Abstract
{
/**
* Additional buttons on {{entityLabel}} page
* @var array
*/
protected $_additionalButtons = array();
/**
* constructor
*
* set template
* @access public
* {{qwertyuiop}}
*/
public function __construct()
{
parent::__construct();
$this->setTemplate('{{namespace}}_{{module}}/{{entity}}/edit/form.phtml');
}
/**
* prepare the layout
*
* @access protected
* @return {{Namespace}}_{{Module}}_Block_Adminhtml_{{Entity}}_Edit_Form
* {{qwertyuiop}}
*/
protected function _prepareLayout()
{
${{entity}} = $this->get{{Entity}}();
${{entity}}Id = (int)${{entity}}->getId();
$this->setChild(
'tabs',
$this->getLayout()->createBlock('{{namespace}}_{{module}}/adminhtml_{{entity}}_edit_tabs', 'tabs')
);
$this->setChild(
'save_button',
$this->getLayout()->createBlock('adminhtml/widget_button')
->setData(
array(
'label' => Mage::helper('{{namespace}}_{{module}}')->__('Save {{EntityLabel}}'),
'onclick' => "{{entity}}Submit('" . $this->getSaveUrl() . "', true)",
'class' => 'save'
)
)
);
// Delete button
if (!in_array(${{entity}}Id, $this->getRootIds())) {
$this->setChild(
'delete_button',
$this->getLayout()->createBlock('adminhtml/widget_button')
->setData(
array(
'label' => Mage::helper('{{namespace}}_{{module}}')->__('Delete {{EntityLabel}}'),
'onclick' => "{{entity}}Delete('" . $this->getUrl(
'*/*/delete',
array('_current' => true)
)
. "', true, {${{entity}}Id})",
'class' => 'delete'
)
)
);
}
// Reset button
$resetPath = ${{entity}} ? '*/*/edit' : '*/*/add';
$this->setChild(
'reset_button',
$this->getLayout()->createBlock('adminhtml/widget_button')
->setData(
array(
'label' => Mage::helper('{{namespace}}_{{module}}')->__('Reset'),
'onclick' => "{{entity}}Reset('".$this->getUrl(
$resetPath,
array('_current'=>true)
)
."',true)"
)
)
);
return parent::_prepareLayout();
}
/**
* get html for delete button
*
* @access public
* @return string
* {{qwertyuiop}}
*/
public function getDeleteButtonHtml()
{
return $this->getChildHtml('delete_button');
}
/**
* get html for save button
*
* @access public
* @return string
* {{qwertyuiop}}
*/
public function getSaveButtonHtml()
{
return $this->getChildHtml('save_button');
}
/**
* get html for reset button
*
* @access public
* @return string
* {{qwertyuiop}}
*/
public function getResetButtonHtml()
{
return $this->getChildHtml('reset_button');
}
/**
* Retrieve additional buttons html
*
* @access public
* @return string
* {{qwertyuiop}}
*/
public function getAdditionalButtonsHtml()
{
$html = '';
foreach ($this->_additionalButtons as $childName) {
$html .= $this->getChildHtml($childName);
}
return $html;
}
/**
* Add additional button
*
* @param string $alias
* @param array $config
* @return {{Namespace}}_{{Module}}_Block_Adminhtml_{{Entity}}_Edit_Form
* {{qwertyuiop}}
*/
public function addAdditionalButton($alias, $config)
{
if (isset($config['name'])) {
$config['element_name'] = $config['name'];
}
$this->setChild(
$alias . '_button',
$this->getLayout()->createBlock('adminhtml/widget_button')->addData($config)
);
$this->_additionalButtons[$alias] = $alias . '_button';
return $this;
}
/**
* Remove additional button
*
* @access public
* @param string $alias
* @return {{Namespace}}_{{Module}}_Block_Adminhtml_{{Entity}}_Edit_Form
* {{qwertyuiop}}
*/
public function removeAdditionalButton($alias)
{
if (isset($this->_additionalButtons[$alias])) {
$this->unsetChild($this->_additionalButtons[$alias]);
unset($this->_additionalButtons[$alias]);
}
return $this;
}
/**
* get html for tabs
*
* @access public
* @return string
* {{qwertyuiop}}
*/
public function getTabsHtml()
{
return $this->getChildHtml('tabs');
}
/**
* get the form header
*
* @access public
* @return string
* {{qwertyuiop}}
*/
public function getHeader()
{
if ($this->get{{Entity}}Id()) {
return $this->get{{Entity}}{{EntityNameMagicCode}}();
} else {
return Mage::helper('{{namespace}}_{{module}}')->__('New Root {{EntityLabel}}');
}
}
/**
* get the delete url
*
* @access public
* @param array $args
* @return string
* {{qwertyuiop}}
*/
public function getDeleteUrl(array $args = array())
{
$params = array('_current'=>true);
$params = array_merge($params, $args);
return $this->getUrl('*/*/delete', $params);
}
/**
* Return URL for refresh input element 'path' in form
*
* @access public
* @param array $args
* @return string
* {{qwertyuiop}}
*/
public function getRefreshPathUrl(array $args = array())
{
$params = array('_current'=>true);
$params = array_merge($params, $args);
return $this->getUrl('*/*/refreshPath', $params);
}
/**
* check if request is ajax
*
* @access public
* @return bool
* {{qwertyuiop}}
*/
public function isAjax()
{
return Mage::app()->getRequest()->isXmlHttpRequest() || Mage::app()->getRequest()->getParam('isAjax');
}
|
{
"pile_set_name": "Github"
}
|
require('./angular-locale_de-it');
module.exports = 'ngLocale';
|
{
"pile_set_name": "Github"
}
|
/** @file
OcXmlLib
Copyright (c) 2018, vit9696
All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
//
// Copyright (c) 2012 ooxi/xml.c
// https://github.com/ooxi/xml.c
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the
// use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software in a
// product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
//
#include <Library/OcXmlLib.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/OcMiscLib.h>
#include <Library/OcStringLib.h>
//
// Minimal extra allocation size during export.
//
#define XML_EXPORT_MIN_ALLOCATION_SIZE 4096
#define XML_PLIST_HEADER "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">"
struct XML_NODE_LIST_;
struct XML_PARSER_;
typedef struct XML_NODE_LIST_ XML_NODE_LIST;
typedef struct XML_PARSER_ XML_PARSER;
//
// An XML_NODE will always contain a tag name and possibly a list of
// children or text content.
//
struct XML_NODE_ {
CONST CHAR8 *Name;
CONST CHAR8 *Attributes;
CONST CHAR8 *Content;
XML_NODE *Real;
XML_NODE_LIST *Children;
};
struct XML_NODE_LIST_ {
UINT32 NodeCount;
UINT32 AllocCount;
XML_NODE *NodeList[];
};
typedef struct {
UINT32 RefCount;
UINT32 RefAllocCount;
XML_NODE **RefList;
} XML_REFLIST;
//
// An XML_DOCUMENT simply contains the root node and the underlying buffer.
//
struct XML_DOCUMENT_ {
struct {
CHAR8 *Buffer;
UINT32 Length;
} Buffer;
XML_NODE *Root;
XML_REFLIST References;
};
//
// Parser context.
//
struct XML_PARSER_ {
CHAR8 *Buffer;
UINT32 Position;
UINT32 Length;
UINT32 Level;
};
//
// Character offsets.
//
typedef enum XML_PARSER_OFFSET_ {
NO_CHARACTER = -1,
CURRENT_CHARACTER = 0,
NEXT_CHARACTER = 1,
} XML_PARSER_OFFSET;
//
// Plist node types.
//
CONST CHAR8 *
PlistNodeTypes[PLIST_NODE_TYPE_MAX] = {
NULL,
"array",
"dict",
"key",
"string",
"data",
"date",
"true",
"false",
"real",
"integer"
};
STATIC
BOOLEAN
XmlParseAttributeNumber (
CONST CHAR8 *Attributes,
CONST CHAR8 *Argument,
UINT32 ArgumentLength,
UINT32 *ArgumentValue
)
{
CONST CHAR8 *ArgumentStart;
CONST CHAR8 *ArgumentEnd;
UINTN Number;
CHAR8 NumberStr[16];
//
// FIXME: This may give false positives.
//
ArgumentStart = AsciiStrStr (Attributes, Argument);
if (ArgumentStart == NULL) {
return FALSE;
}
ArgumentStart += ArgumentLength;
ArgumentEnd = AsciiStrStr (ArgumentStart, "\"");
Number = ArgumentEnd - ArgumentStart;
if (ArgumentEnd == NULL || Number > sizeof (NumberStr) - 1) {
return FALSE;
}
CopyMem (&NumberStr, ArgumentStart, Number);
NumberStr[Number] = '\0';
*ArgumentValue = (UINT32) AsciiStrDecimalToUint64 (NumberStr);
return TRUE;
}
//
// Allocates the node with contents.
//
STATIC
XML_NODE *
XmlNodeCreate (
CONST CHAR8 *Name,
CONST CHAR8 *Attributes,
CONST CHAR8 *Content,
XML_NODE *Real,
XML_NODE_LIST *Children
)
{
XML_NODE *Node;
Node = AllocatePool (sizeof (XML_NODE));
if (Node != NULL) {
Node->Name = Name;
Node->Attributes = Attributes;
Node->Content = Content;
Node->Real = Real;
Node->Children = Children;
}
return Node;
}
//
// Adds child nodes to node.
//
STATIC
BOOLEAN
XmlNodeChildPush (
XML_NODE *Node,
XML_NODE *Child
)
{
UINT32 NodeCount;
UINT32 AllocCount;
XML_NODE_LIST *NewList;
NodeCount = 0;
AllocCount = 1;
//
// Push new node if there is enough room.
//
if (Node->Children != NULL) {
NodeCount = Node->Children->NodeCount;
AllocCount = Node->Children->AllocCount;
if (NodeCount < XML_PARSER_NODE_COUNT && AllocCount > NodeCount) {
Node->Children->NodeList[NodeCount] = Child;
Node->Children->NodeCount++;
return TRUE;
}
}
//
// Insertion will exceed the limit.
//
if (NodeCount >= XML_PARSER_NODE_COUNT - 1) {
return FALSE;
}
//
// Allocate three times more room.
// This balances performance and memory usage on large files like prelinked plist.
//
AllocCount *= 3;
NewList = (XML_NODE_LIST *) AllocatePool (
sizeof (XML_NODE_LIST) + sizeof (NewList->NodeList[0]) * AllocCount
);
if (NewList == NULL) {
return FALSE;
}
NewList->NodeCount = NodeCount + 1;
NewList->AllocCount = AllocCount;
if (Node->Children != NULL) {
CopyMem (
&NewList->NodeList[0],
&Node->Children->NodeList[0],
sizeof (NewList->NodeList[0]) * NodeCount
);
FreePool (Node->Children);
}
NewList->NodeList[NodeCount] = Child;
Node->Children = NewList;
return TRUE;
}
STATIC
BOOLEAN
XmlPushReference (
XML_REFLIST *References,
XML_NODE *Node,
UINT32 ReferenceNumber
)
{
XML_NODE **NewReferences;
UINT32 NewRefAllocCount;
if (ReferenceNumber >= XML_PARSER_MAX_REFERENCE_COUNT) {
return FALSE;
}
if (ReferenceNumber >= References->RefAllocCount) {
if (OcOverflowAddMulU32 (ReferenceNumber, 1, 2, &NewRefAllocCount)) {
return FALSE;
}
NewReferences = AllocateZeroPool (NewRefAllocCount * sizeof (References->RefList[0]));
if (NewReferences == NULL) {
return FALSE;
}
if (References->RefList != NULL) {
CopyMem (
&NewReferences[0],
&References->RefList[0],
References->RefCount * sizeof (References->RefList[0])
);
FreePool (References->RefList);
}
References->RefList = NewReferences;
References->RefAllocCount = NewRefAllocCount;
}
References->RefList[ReferenceNumber] = Node;
if (ReferenceNumber >= References->RefCount) {
References->RefCount = ReferenceNumber + 1;
}
return TRUE;
}
STATIC
XML_NODE *
XmlNodeReal (
XML_REFLIST *References,
CONST CHAR8 *Attributes
)
{
BOOLEAN HasArgument;
UINT32 Number;
if (References == NULL || Attributes == NULL) {
return NULL;
}
HasArgument = XmlParseAttributeNumber (
Attributes,
"IDREF=\"",
L_STR_LEN ("IDREF=\""),
&Number
);
if (!HasArgument || Number >= References->RefCount) {
return NULL;
}
return References->RefList[Number];
}
//
// Frees the resources allocated by the node.
//
STATIC
VOID
XmlNodeFree (
XML_NODE *Node
)
{
UINT32 Index;
if (Node->Children != NULL) {
for (Index = 0; Index < Node->Children->NodeCount; ++Index) {
XmlNodeFree (Node->Children->NodeList[Index]);
}
FreePool (Node->Children);
}
FreePool (Node);
}
STATIC
VOID
XmlFreeRefs (
XML_REFLIST *References
)
{
if (References->RefList != NULL) {
FreePool (References->RefList);
References->RefList = NULL;
}
}
//
// Echos the parsers call stack for debugging purposes.
//
#ifdef XML_PARSER_VERBOSE
#define XML_PARSER_INFO(Parser, Message) \
DEBUG ((DEBUG_VERBOSE, "OCXML: XML_PARSER_INFO %a\n", Message));
#define XML_PARSER_TAG(Parser, Tag) \
DEBUG ((DEBUG_VERBOSE, "OCXML: XML_PARSER_TAG %a\n", Tag));
#else
#define XML_PARSER_INFO(Parser, Message) do {} while (0)
#define XML_PARSER_TAG(Parser, Tag) do {} while (0)
#endif
//
// Echos an error regarding the parser's source to the console.
//
VOID
XmlParserError (
XML_PARSER *Parser,
XML_PARSER_OFFSET Offset,
CONST CHAR8 *Message
)
{
UINT32 Character = 0;
UINT32 Position;
UINT32 Row = 0;
UINT32 Column = 0;
if (Parser->Length > 0 && (Parser->Position > 0 || NO_CHARACTER != Offset)) {
Character = Parser->Position + Offset;
if (Character > Parser->Length-1) {
Character = Parser->Length-1;
}
for (Position = 0; Position <= Character; ++Position) {
Column++;
if ('\n' == Parser->Buffer[Position]) {
Row++;
Column = 0;
}
}
}
if (NO_CHARACTER != Offset) {
DEBUG ((DEBUG_INFO, "OCXML: XmlParserError at %u:%u (is %c): %a\n",
Row + 1, Column, Parser->Buffer[Character], Message
));
} else {
DEBUG ((DEBUG_INFO, "OCXML: XmlParserError at %u:%u: %a\n",
Row + 1, Column, Message
));
}
}
//
// Conditionally enable error printing.
//
#ifdef XML_PRINT_ERRORS
#define XML_PARSER_ERROR(Parser, Offset, Message) \
XmlParserError (Parser, Offset, Message)
#define XML_USAGE_ERROR(Message) \
DEBUG ((DEBUG_VERBOSE, "OCXML: %a\n", Message));
#else
#define XML_PARSER_ERROR(Parser, Offset, Message) do {} while (0)
#define XML_USAGE_ERROR(X) do {} while (0)
#endif
//
// Returns the n-th not-whitespace byte in parser and 0 if such a byte does not
// exist.
//
STATIC
CHAR8
XmlParserPeek (
XML_PARSER *Parser,
UINT32 N
)
{
UINT32 Position;
if (!OcOverflowAddU32 (Parser->Position, N, &Position)
&& Position < Parser->Length) {
return Parser->Buffer[Position];
}
return 0;
}
//
// Moves the parser's position n bytes. If the new position would be out of
// bounds, it will be converted to the bounds itself.
//
STATIC
VOID
XmlParserConsume (
XML_PARSER *Parser,
UINT32 N
)
{
#ifdef XML_PARSER_VERBOSE
CHAR8 *Consumed;
CHAR8 *MessageBuffer;
UINT32 Left;
//
// Debug information.
//
Consumed = AllocatePool ((N + 1) * sizeof (CHAR8));
MessageBuffer = AllocatePool (512 * sizeof (CHAR8));
if (Consumed != NULL && MessageBuffer != NULL) {
Left = N;
if (Left > Parser->Length - Parser->Position) {
Left = Parser->Length - Parser->Position;
}
CopyMem (Consumed, &Parser->Buffer[Parser->Position], Left);
Consumed[Left] = 0;
AsciiSPrint (MessageBuffer, 512, "Consuming %u bytes \"%a\"", N, Consumed);
XML_PARSER_INFO (Parser, MessageBuffer);
}
if (Consumed != NULL) {
FreePool (Consumed);
}
if (MessageBuffer != NULL) {
FreePool (MessageBuffer);
}
#endif
//
// Move the position forward.
//
if (OcOverflowAddU32 (Parser->Position, N, &Parser->Position)
|| Parser->Position > Parser->Length) {
Parser->Position = Parser->Length;
}
}
//
// Skips to the next non-whitespace character.
//
STATIC
VOID
XmlSkipWhitespace (
XML_PARSER *Parser
)
{
XML_PARSER_INFO (Parser, "whitespace");
while (Parser->Position < Parser->Length
&& IsAsciiSpace (Parser->Buffer[Parser->Position])) {
Parser->Position++;
}
}
//
// Parses the name out of the an XML tag's ending.
//
// ---( Example )---
// tag_name>
// ---
//
STATIC
CONST CHAR8 *
XmlParseTagEnd (
XML_PARSER *Parser,
BOOLEAN *SelfClosing,
CONST CHAR8 **Attributes
)
{
CHAR8 Current;
UINT32 Start;
UINT32 AttributeStart;
UINT32 Length = 0;
UINT32 NameLength = 0;
XML_PARSER_INFO (Parser, "tag_end");
Current = XmlParserPeek (Parser, CURRENT_CHARACTER);
Start = Parser->Position;
//
// Parse until `>' or a whitespace is reached.
//
while (Start + Length < Parser->Length) {
if (('/' == Current) || ('>' == Current)) {
break;
}
if (NameLength == 0 && IsAsciiSpace (Current)) {
NameLength = Length;
if (NameLength == 0) {
XML_PARSER_ERROR (Parser, CURRENT_CHARACTER, "XmlParseTagEnd::expected tag name");
return NULL;
}
}
XmlParserConsume (Parser, 1);
Length++;
Current = XmlParserPeek (Parser, CURRENT_CHARACTER);
}
//
// Handle attributes.
//
if (NameLength != 0) {
if (Attributes != NULL && (Current == '/' || Current == '>')) {
*Attributes = &Parser->Buffer[Start + NameLength];
AttributeStart = NameLength;
while (AttributeStart < Length && IsAsciiSpace (**Attributes)) {
(*Attributes)++;
AttributeStart++;
}
Parser->Buffer[Start + Length] = '\0';
}
} else {
//
// No attributes besides name.
//
NameLength = Length;
}
if ('/' == Current) {
if (SelfClosing == NULL) {
XML_PARSER_ERROR (Parser, CURRENT_CHARACTER, "XmlParseTagEnd::unexpected self closing tag");
return NULL;
}
*SelfClosing = TRUE;
XmlParserConsume (Parser, 1);
Current = XmlParserPeek (Parser, CURRENT_CHARACTER);
}
//
// Consume `>'.
//
if ('>' != Current) {
XML_PARSER_ERROR (Parser, CURRENT_CHARACTER, "XmlParseTagEnd::expected tag end");
return NULL;
}
XmlParserConsume (Parser, 1);
//
// Return parsed tag name.
//
Parser->Buffer[Start + NameLength] = 0;
XML_PARSER_TAG (Parser, &Parser->Buffer[Start]);
return &Parser->Buffer[Start];
}
//
// Parses an opening XML tag without attributes.
//
// ---( Example )---
// <tag_name>
// ---
//
STATIC
CONST CHAR8 *
XmlParseTagOpen (
XML_PARSER *Parser,
BOOLEAN *SelfClosing,
CONST CHAR8 **Attributes
)
{
CHAR8 Current;
XML_PARSER_INFO (Parser, "tag_open");
do {
XmlSkipWhitespace (Parser);
//
// Consume `<'.
//
if ('<' != XmlParserPeek (Parser, CURRENT_CHARACTER)) {
XML_PARSER_ERROR (Parser, CURRENT_CHARACTER, "XmlParseTagOpen::expected opening tag");
return NULL;
}
XmlParserConsume (Parser, 1);
Current = XmlParserPeek (Parser, CURRENT_CHARACTER);
//
// This is closing tag, e.g. `</tag>', return.
//
if (Current == '/') {
return NULL;
}
//
// This is not a control sequence, e.g. `<!DOCTYPE...>', continue parsing tag.
//
if (Current != '?' && Current != '!') {
break;
}
//
// Skip the control sequence.
//
do {
XmlParserConsume (Parser, 1);
} while (XmlParserPeek (Parser, CURRENT_CHARACTER) != '>' && Parser->Position < Parser->Length);
XmlParserConsume (Parser, 1);
} while (Parser->Position < Parser->Length);
//
// Consume tag name.
//
return XmlParseTagEnd (Parser, SelfClosing, Attributes);
}
//
// Parses an closing XML tag without attributes.
//
// ---( Example )---
// </tag_name>
// ---
//
STATIC
CONST CHAR8 *
XmlParseTagClose (
XML_PARSER *Parser,
BOOLEAN Unprefixed
)
{
XML_PARSER_INFO (Parser, "tag_close");
XmlSkipWhitespace (Parser);
if (Unprefixed) {
//
// Consume `/'.
//
if ('/' != XmlParserPeek (Parser, CURRENT_CHARACTER)) {
XML_PARSER_ERROR (Parser, CURRENT_CHARACTER, "XmlParseTagClose::expected closing tag `/'");
return NULL;
}
XmlParserConsume (Parser, 1);
} else {
//
// Consume `</'.
//
if ('<' != XmlParserPeek (Parser, CURRENT_CHARACTER)) {
XML_PARSER_ERROR (Parser, CURRENT_CHARACTER, "XmlParseTagClose::expected closing tag `<'");
return NULL;
}
if ('/' != XmlParserPeek (Parser, NEXT_CHARACTER)) {
XML_PARSER_ERROR (Parser, NEXT_CHARACTER, "XmlParseTagClose::expected closing tag `/'");
return NULL;
}
XmlParserConsume (Parser, 2);
}
//
// Consume tag name.
//
return XmlParseTagEnd(Parser, NULL, NULL);
}
//
// Parses a tag's content.
//
// ---( Example )---
// this is
// a
// tag {} content
// ---
//
// @warning CDATA etc. is _not_ and will never be supported
//
STATIC
CONST CHAR8 *
XmlParseContent (
XML_PARSER *Parser
)
{
UINTN Start;
UINTN Length;
CHAR8 Current;
XML_PARSER_INFO(Parser, "content");
//
// Whitespace will be ignored.
//
XmlSkipWhitespace (Parser);
Start = Parser->Position;
Length = 0;
//
// Consume until `<' is reached.
//
while (Start + Length < Parser->Length) {
Current = XmlParserPeek (Parser, CURRENT_CHARACTER);
if ('<' == Current) {
break;
} else {
XmlParserConsume (Parser, 1);
Length++;
}
}
//
// Next character must be an `<' or we have reached end of file.
//
if ('<' != XmlParserPeek (Parser, CURRENT_CHARACTER)) {
XML_PARSER_ERROR (Parser, CURRENT_CHARACTER, "XmlParseContent::expected <");
return NULL;
}
//
// Ignore tailing whitespace.
//
while ((Length > 0) && IsAsciiSpace (Parser->Buffer[Start + Length - 1])) {
Length--;
}
//
// Return text.
//
Parser->Buffer[Start + Length] = 0;
XmlParserConsume (Parser, 1);
return &Parser->Buffer[Start];
}
//
// Prints to growing buffer always preserving one byte extra.
//
STATIC
VOID
XmlBufferAppend (
CHAR8 **Buffer,
UINT32 *AllocSize,
UINT32 *CurrentSize,
CONST CHAR8 *Data,
UINT32 DataLength
)
{
CHAR8 *NewBuffer;
UINT32 NewSize;
NewSize = *AllocSize;
if (NewSize - *CurrentSize <= DataLength) {
if (DataLength + 1 <= XML_EXPORT_MIN_ALLOCATION_SIZE) {
NewSize += XML_EXPORT_MIN_ALLOCATION_SIZE;
} else {
NewSize += DataLength + 1;
}
NewBuffer = AllocatePool (NewSize);
if (NewBuffer == NULL) {
XML_USAGE_ERROR("XmlBufferAppend::failed to allocate");
return;
}
CopyMem (NewBuffer, *Buffer, *CurrentSize);
FreePool (*Buffer);
*Buffer = NewBuffer;
*AllocSize = NewSize;
}
CopyMem (&(*Buffer)[*CurrentSize], Data, DataLength);
*CurrentSize += DataLength;
}
//
// Prints node to growing buffer always preserving one byte extra.
//
STATIC
VOID
XmlNodeExportRecursive (
XML_NODE *Node,
CHAR8 **Buffer,
UINT32 *AllocSize,
UINT32 *CurrentSize,
UINT32 Skip
)
{
UINT32 Index;
UINT32 NameLength;
if (Skip != 0) {
if (Node->Children != NULL) {
for (Index = 0; Index < Node->Children->NodeCount; ++Index) {
XmlNodeExportRecursive (Node->Children->NodeList[Index], Buffer, AllocSize, CurrentSize, Skip - 1);
}
}
return;
}
NameLength = (UINT32)AsciiStrLen (Node->Name);
XmlBufferAppend (Buffer, AllocSize, CurrentSize, "<", L_STR_LEN ("<"));
XmlBufferAppend (Buffer, AllocSize, CurrentSize, Node->Name, NameLength);
if (Node->Attributes != NULL) {
XmlBufferAppend (Buffer, AllocSize, CurrentSize, " ", L_STR_LEN (" "));
XmlBufferAppend (Buffer, AllocSize, CurrentSize, Node->Attributes, (UINT32)AsciiStrLen (Node->Attributes));
}
if (Node->Children != NULL || Node->Content != NULL) {
XmlBufferAppend (Buffer, AllocSize, CurrentSize, ">", L_STR_LEN (">"));
if (Node->Children != NULL) {
for (Index = 0; Index < Node->Children->NodeCount; ++Index) {
XmlNodeExportRecursive (Node->Children->NodeList[Index], Buffer, AllocSize, CurrentSize, 0);
}
} else {
XmlBufferAppend (Buffer, AllocSize, CurrentSize, Node->Content, (UINT32)AsciiStrLen (Node->Content));
}
XmlBufferAppend (Buffer, AllocSize, CurrentSize, "</", L_STR_LEN ("</"));
XmlBufferAppend (Buffer, AllocSize, CurrentSize, Node->Name, NameLength);
XmlBufferAppend (Buffer, AllocSize, CurrentSize, ">", L_STR_LEN (">"));
} else {
XmlBufferAppend (Buffer, AllocSize, CurrentSize, "/>", L_STR_LEN ("/>"));
}
}
//
// Parses an XML fragment node.
//
// ---( Example without children )---
// <Node>Text</Node>
// ---
//
// ---( Example with children )---
// <Parent>
// <Child>Text</Child>
// <Child>Text</Child>
// <Test>Content</Test>
// </Parent>
// ---
//
STATIC
XML_NODE *
XmlParseNode (
XML_PARSER *Parser,
XML_REFLIST *References
)
{
CONST CHAR8 *TagOpen;
CONST CHAR8 *TagClose;
CONST CHAR8 *Attributes;
XML_NODE *Node;
XML_NODE *Child;
UINT32 ReferenceNumber;
BOOLEAN IsReference;
BOOLEAN SelfClosing;
BOOLEAN Unprefixed;
BOOLEAN HasChildren;
XML_PARSER_INFO (Parser, "node");
Attributes = NULL;
SelfClosing = FALSE;
Unprefixed = FALSE;
IsReference = FALSE;
//
// Parse open tag.
//
TagOpen = XmlParseTagOpen (Parser, &SelfClosing, &Attributes);
if (TagOpen == NULL) {
if ('/' != XmlParserPeek (Parser, CURRENT_CHARACTER)) {
XML_PARSER_ERROR (Parser, NO_CHARACTER, "XmlParseNode::tag_open");
}
return NULL;
}
XmlSkipWhitespace (Parser);
Node = XmlNodeCreate (TagOpen, Attributes, NULL, XmlNodeReal (References, Attributes), NULL);
if (Node == NULL) {
XML_PARSER_ERROR (Parser, NO_CHARACTER, "XmlParseNode::node alloc fail");
return NULL;
}
//
// If tag ends with `/' it's self closing, skip content lookup.
//
if (SelfClosing) {
return Node;
}
//
// If the content does not start with '<', a text content is assumed.
//
if ('<' != XmlParserPeek (Parser, CURRENT_CHARACTER)) {
Node->Content = XmlParseContent (Parser);
if (Node->Content == NULL) {
XML_PARSER_ERROR (Parser, 0, "XmlParseNode::content");
XmlNodeFree (Node);
return NULL;
}
//
// All references must be defined sequentially.
//
if (References != NULL && Node->Attributes != NULL) {
IsReference = XmlParseAttributeNumber (
Node->Attributes,
"ID=\"",
L_STR_LEN ("ID=\""),
&ReferenceNumber
);
}
Unprefixed = TRUE;
//
// Otherwise children are to be expected.
//
} else {
Parser->Level++;
if (Parser->Level > XML_PARSER_NEST_LEVEL) {
XML_PARSER_ERROR (Parser, NO_CHARACTER, "XmlParseNode::level overflow");
XmlNodeFree (Node);
return NULL;
}
HasChildren = FALSE;
while ('/' != XmlParserPeek (Parser, NEXT_CHARACTER)) {
//
// Parse child node.
//
Child = XmlParseNode (Parser, References);
if (Child == NULL) {
if ('/' == XmlParserPeek (Parser, CURRENT_CHARACTER)) {
XML_PARSER_INFO (Parser, "child_end");
Unprefixed = TRUE;
break;
}
XML_PARSER_ERROR (Parser, NEXT_CHARACTER, "XmlParseNode::child");
XmlNodeFree (Node);
return NULL;
}
if (!XmlNodeChildPush (Node, Child)) {
XML_PARSER_ERROR (Parser, NO_CHARACTER, "XmlParseNode::node push fail");
XmlNodeFree (Node);
XmlNodeFree (Child);
return NULL;
}
HasChildren = TRUE;
}
Parser->Level--;
if (!HasChildren && References != NULL && Attributes != NULL) {
IsReference = XmlParseAttributeNumber (
Node->Attributes,
"ID=\"",
L_STR_LEN ("ID=\""),
&ReferenceNumber
);
}
}
//
// Parse close tag.
//
TagClose = XmlParseTagClose (Parser, Unprefixed);
if (TagClose == NULL) {
XML_PARSER_ERROR (Parser, NO_CHARACTER, "XmlParseNode::tag close");
XmlNodeFree (Node);
return NULL;
}
//
// Close tag has to match open tag.
//
if (AsciiStrCmp (TagOpen, TagClose) != 0) {
XML_PARSER_ERROR (Parser, NO_CHARACTER, "XmlParseNode::tag missmatch");
XmlNodeFree (Node);
return NULL;
}
if (IsReference && !XmlPushReference (References, Node, ReferenceNumber)) {
XML_PARSER_ERROR (Parser, 0, "XmlParseNode::reference");
XmlNodeFree (Node);
return NULL;
}
return Node;
}
XML_DOCUMENT *
XmlDocumentParse (
CHAR8 *Buffer,
UINT32 Length,
BOOLEAN WithRefs
)
{
XML_NODE *Root;
XML_DOCUMENT *Document;
XML_REFLIST References;
//
// Initialize parser.
//
XML_PARSER Parser;
ZeroMem (&Parser, sizeof (Parser));
Parser.Buffer = Buffer;
Parser.Length = Length;
ZeroMem (&References, sizeof (References));
//
// An empty buffer can never contain a valid document.
//
if (Length == 0 || Length > XML_PARSER_MAX_SIZE) {
XML_PARSER_ERROR (&Parser, NO_CHARACTER, "XmlDocumentParse::length is too small or too large");
return NULL;
}
//
// Parse the root node.
//
Root = XmlParseNode (&Parser, WithRefs ? &References : NULL);
if (Root == NULL) {
XML_PARSER_ERROR (&Parser, NO_CHARACTER, "XmlDocumentParse::parsing document failed");
return NULL;
}
//
// Return parsed document.
//
Document = AllocatePool (sizeof(XML_DOCUMENT));
if (Document == NULL) {
XML_PARSER_ERROR (&Parser, NO_CHARACTER, "XmlDocumentParse::document allocation failed");
XmlNodeFree (Root);
XmlFreeRefs (&References);
return NULL;
}
Document->Buffer.Buffer = Buffer;
Document->Buffer.Length = Length;
Document->Root = Root;
CopyMem (&Document->References, &References, sizeof (References));
return Document;
}
CHAR8 *
XmlDocumentExport (
XML_DOCUMENT *Document,
UINT32 *Length,
UINT32 Skip,
BOOLEAN PrependPlistInfo
)
{
CHAR8 *Buffer;
CHAR8 *NewBuffer;
UINT32 AllocSize;
UINT32 CurrentSize;
UINT32 NewSize;
AllocSize = Document->Buffer.Length + 1;
Buffer = AllocatePool (AllocSize);
if (Buffer == NULL) {
XML_USAGE_ERROR ("XmlDocumentExport::failed to allocate");
return NULL;
}
CurrentSize = 0;
XmlNodeExportRecursive (Document->Root, &Buffer, &AllocSize, &CurrentSize, Skip);
if (PrependPlistInfo) {
//
// XmlNodeExportRecursive returns a size that does not include the null terminator,
// but the allocated buffer does. During this reallocation, we count the null terminator
// of the plist header instead to ensure allocated buffer is the proper size.
//
if (OcOverflowAddU32 (CurrentSize, L_STR_SIZE (XML_PLIST_HEADER), &NewSize)) {
FreePool (Buffer);
return NULL;
}
NewBuffer = AllocatePool (NewSize);
if (NewBuffer == NULL) {
FreePool (Buffer);
XML_USAGE_ERROR ("XmlDocumentExport::failed to allocate");
return NULL;
}
CopyMem (NewBuffer, XML_PLIST_HEADER, L_STR_SIZE_NT (XML_PLIST_HEADER));
CopyMem (&NewBuffer[L_STR_LEN (XML_PLIST_HEADER)], Buffer, CurrentSize);
FreePool (Buffer);
//
// Null terminator is not included in size returned by XmlBufferAppend.
//
CurrentSize = NewSize - 1;
Buffer = NewBuffer;
}
if (Length != NULL) {
*Length = CurrentSize;
}
//
// Null terminator is not included in size returned by XmlBufferAppend,
// but the buffer is allocated to include it.
//
Buffer[CurrentSize] = '\0';
return Buffer;
}
VOID
XmlDocumentFree (
XML_DOCUMENT *Document
)
{
XmlNodeFree (Document->Root);
XmlFreeRefs (&Document->References);
FreePool (Document);
}
XML_NODE *
XmlDocumentRoot (
XML_DOCUMENT *Document
)
{
return Document->Root;
}
CONST CHAR8 *
XmlNodeName (
XML_NODE *Node
)
{
return Node->Name;
}
CONST CHAR8 *
XmlNodeContent (
XML_NODE *Node
)
{
return Node->Real != NULL ? Node->Real->Content : Node->Content;
}
VOID
XmlNodeChangeContent (
XML_NODE *Node,
CONST CHAR8 *Content
)
{
if (Node->Real != NULL) {
Node->Real->Content = Content;
}
Node->Content = Content;
}
UINT32
XmlNodeChildren (
XML_NODE *Node
)
{
return Node->Children ? Node->Children->NodeCount : 0;
}
XML_NODE *
XmlNodeChild (
XML_NODE *Node,
UINT32 Child
)
{
return Node->Children->NodeList[Child];
}
XML_NODE *
EFIAPI
XmlEasyChild (
XML_NODE *Node,
CONST CHAR8 *ChildName,
...)
{
VA_LIST Arguments;
XML_NODE *Next;
XML_NODE *Child;
UINT32 Index;
VA_START (Arguments, ChildName);
//
// Descent to current child.
//
while (ChildName != NULL) {
//
// Interate through all children.
//
Next = NULL;
for (Index = 0; Index < XmlNodeChildren (Node); ++Index) {
Child = XmlNodeChild (Node, Index);
if (AsciiStrCmp (XmlNodeName (Child), ChildName) != 0) {
if (Next == NULL) {
Next = Child;
} else {
//
// Two children with the same name.
//
VA_END (Arguments);
return NULL;
}
}
}
//
// No child with that name found.
//
if (Next == NULL) {
VA_END (Arguments);
return NULL;
}
Node = Next;
//
// Find name of next child.
//
ChildName = VA_ARG (Arguments, CONST CHAR8*);
}
VA_END (Arguments);
//
// Return current element.
//
return Node;
}
XML_NODE *
XmlNodeAppend (
XML_NODE *Node,
CONST CHAR8 *Name,
CONST CHAR8 *Attributes,
CONST CHAR8 *Content
)
{
XML_NODE *NewNode;
NewNode = XmlNodeCreate (Name, Attributes, Content, NULL, NULL);
if (NewNode == NULL) {
return NULL;
}
if (!XmlNodeChildPush (Node, NewNode)) {
XmlNodeFree (NewNode);
return NULL;
}
return NewNode;
}
XML_NODE *
XmlNodePrepend (
XML_NODE *Node,
CONST CHAR8 *Name,
CONST CHAR8 *Attributes,
CONST CHAR8 *Content
)
{
XML_NODE *NewNode;
NewNode = XmlNodeAppend (Node, Name, Attributes, Content);
if (NewNode == NULL) {
return NULL;
}
CopyMem (&Node->Children->NodeList[1], &Node->Children->NodeList[0], (Node->Children->NodeCount - 1) * sizeof (Node->Children->NodeList[0]));
Node->Children->NodeList[0] = NewNode;
return NewNode;
}
XML_NODE *
PlistDocumentRoot (
XML_DOCUMENT *Document
)
{
XML_NODE *Node;
Node = Document->Root;
if (AsciiStrCmp (XmlNodeName (Node), "plist") != 0) {
XML_USAGE_ERROR ("PlistDocumentRoot::not plist root");
return NULL;
}
if (XmlNodeChildren (Node) != 1) {
XML_USAGE_ERROR ("PlistDocumentRoot::no single first node");
return NULL;
}
return XmlNodeChild(Node, 0);
}
XML_NODE *
PlistNodeCast (
XML_NODE *Node,
PLIST_NODE_TYPE Type
)
{
UINT32 ChildrenNum;
if (Node == NULL || Type == PLIST_NODE_TYPE_ANY) {
return Node;
}
if (AsciiStrCmp (XmlNodeName (Node), PlistNodeTypes[Type]) != 0) {
// XML_USAGE_ERROR ("PlistNodeType::wrong type");
return NULL;
}
ChildrenNum = XmlNodeChildren (Node);
switch (Type) {
case PLIST_NODE_TYPE_DICT:
if (ChildrenNum % 2 != 0) {
XML_USAGE_ERROR ("PlistNodeType::dict has odd children");
return NULL;
}
break;
case PLIST_NODE_TYPE_ARRAY:
break;
case PLIST_NODE_TYPE_KEY:
case PLIST_NODE_TYPE_INTEGER:
case PLIST_NODE_TYPE_REAL:
if (XmlNodeContent (Node) == NULL) {
XML_USAGE_ERROR ("PlistNodeType::key or int have no content");
return NULL;
}
// Fallthrough
default:
//
// Only dictionaries and arrays are allowed to have child nodes.
//
if (ChildrenNum > 0) {
XML_USAGE_ERROR ("PlistNodeType::non dict array has children");
return NULL;
}
break;
}
return Node;
}
UINT32
PlistDictChildren (
XML_NODE *Node
)
{
return XmlNodeChildren (Node) / 2;
}
XML_NODE *
PlistDictChild (
XML_NODE *Node,
UINT32 Child,
XML_NODE **Value OPTIONAL
)
{
Child *= 2;
if (Value != NULL) {
*Value = XmlNodeChild (Node, Child + 1);
}
return XmlNodeChild (Node, Child);
}
CONST CHAR8 *
PlistKeyValue (
XML_NODE *Node
)
{
if (PlistNodeCast (Node, PLIST_NODE_TYPE_KEY) == NULL) {
return NULL;
}
return XmlNodeContent (Node);
}
BOOLEAN
PlistStringValue (
XML_NODE *Node,
CHAR8 *Value,
UINT32 *Size
)
{
CONST CHAR8 *Content;
UINTN Length;
if (PlistNodeCast (Node, PLIST_NODE_TYPE_STRING) == NULL) {
return FALSE;
}
Content = XmlNodeContent (Node);
if (Content == NULL) {
Value[0] = '\0';
*Size = 1;
return TRUE;
}
Length = AsciiStrLen (Content);
if (Length < *Size) {
*Size = (UINT32) (Length + 1);
}
AsciiStrnCpyS (Value, *Size, Content, Length);
return TRUE;
}
BOOLEAN
PlistDataValue (
XML_NODE *Node,
UINT8 *Buffer,
UINT32 *Size
)
{
CONST CHAR8 *Content;
UINTN Length;
EFI_STATUS Result;
if (PlistNodeCast (Node, PLIST_NODE_TYPE_DATA) == NULL) {
return FALSE;
}
Content = XmlNodeContent (Node);
if (Content == NULL) {
*Size = 0;
return TRUE;
}
Length = *Size;
Result = Base64Decode (Content, AsciiStrLen (Content), Buffer, &Length);
if (!EFI_ERROR (Result) && (UINT32) Length == Length) {
*Size = (UINT32) Length;
return TRUE;
}
*Size = 0;
return FALSE;
}
BOOLEAN
PlistBooleanValue (
XML_NODE *Node,
BOOLEAN *Value
)
{
if (PlistNodeCast (Node, PLIST_NODE_TYPE_TRUE) != NULL) {
*Value = TRUE;
return TRUE;
}
if (PlistNodeCast (Node, PLIST_NODE_TYPE_FALSE) != NULL) {
*Value = FALSE;
return TRUE;
}
return FALSE;
}
BOOLEAN
PlistIntegerValue (
XML_NODE *Node,
VOID *Value,
UINT32 Size,
BOOLEAN Hex
)
{
UINT64 Temp;
CONST CHAR8 *TempStr;
BOOLEAN Negate;
if (PlistNodeCast (Node, PLIST_NODE_TYPE_INTEGER) == NULL) {
return FALSE;
}
TempStr = XmlNodeContent (Node);
while (*TempStr == ' ' || *TempStr == '\t') {
++TempStr;
}
Negate = *TempStr == '-';
if (Negate) {
++TempStr;
}
if (Hex && TempStr[0] != '0' && TempStr[1] != 'x') {
Hex = FALSE;
}
if (Hex) {
Temp = AsciiStrHexToUint64 (TempStr);
} else {
Temp = AsciiStrDecimalToUint64 (TempStr);
}
//
// May produce unexpected results when the value is too large, but just do not care.
//
if (Negate) {
Temp = 0ULL - Temp;
}
switch (Size) {
case sizeof (UINT64):
*(UINT64 *) Value = Temp;
return TRUE;
case sizeof (UINT32):
*(UINT32 *) Value = (UINT32) Temp;
return TRUE;
case sizeof (UINT16):
*(UINT16 *) Value = (UINT16) Temp;
return TRUE;
case sizeof (UINT8):
*(UINT8 *) Value = (UINT8) Temp;
return TRUE;
default:
return FALSE;
}
}
BOOLEAN
PlistMetaDataValue (
XML_NODE *Node,
VOID *Buffer,
UINT32 *Size
)
{
CONST CHAR8 *Content;
UINTN Length;
EFI_STATUS Result;
if (PlistNodeCast (Node, PLIST_NODE_TYPE_DATA) != NULL) {
Content = XmlNodeContent (Node);
if (Content != NULL) {
Length = *Size;
Result = Base64Decode (Content, AsciiStrLen (Content), Buffer, &Length);
if (!EFI_ERROR (Result) && (UINT32) Length == Length) {
*Size = (UINT32) Length;
} else {
return FALSE;
}
} else {
*Size = 0;
}
return TRUE;
}
if (PlistNodeCast (Node, PLIST_NODE_TYPE_STRING) != NULL) {
Content = XmlNodeContent (Node);
if (Content != NULL) {
Length = AsciiStrLen (Content);
if (Length < *Size) {
*Size = (UINT32) (Length + 1);
}
AsciiStrnCpyS (Buffer, *Size, Content, Length);
} else {
*(CHAR8 *) Buffer = '\0';
*Size = 1;
}
return TRUE;
}
if (PlistNodeCast (Node, PLIST_NODE_TYPE_INTEGER) != NULL) {
*(UINT32 *) Buffer = (UINT32) AsciiStrDecimalToUint64 (XmlNodeContent (Node));
*Size = sizeof (UINT32);
return TRUE;
}
if (PlistNodeCast (Node, PLIST_NODE_TYPE_TRUE) != NULL) {
*(UINT8 *) Buffer = 1;
*Size = sizeof (UINT8);
return TRUE;
}
if (PlistNodeCast (Node, PLIST_NODE_TYPE_FALSE) != NULL) {
*(UINT8 *) Buffer = 0;
*Size = sizeof (UINT8);
return TRUE;
}
return FALSE;
}
BOOLEAN
PlistStringSize (
XML_NODE *Node,
UINT32 *Size
)
{
CONST CHAR8 *Content;
if (PlistNodeCast (Node, PLIST_NODE_TYPE_STRING) == NULL) {
return FALSE;
}
Content = XmlNodeContent (Node);
if (Content != NULL) {
*Size = (UINT32) AsciiStrLen (Content) + 1;
return TRUE;
}
*Size = 0;
return TRUE;
}
BOOLEAN
PlistDataSize (
XML_NODE *Node,
UINT32 *Size
)
{
CONST CHAR8 *Content;
if (PlistNodeCast (Node, PLIST_NODE_TYPE_DATA) == NULL) {
return FALSE;
}
Content = XmlNodeContent (Node);
if (Content != NULL) {
*Size = (UINT32) AsciiStrLen (Content);
} else {
*Size = 0;
}
return TRUE;
}
BOOLEAN
PlistMetaDataSize (
XML_NODE *Node,
UINT32 *Size
)
{
CONST CHAR8 *Content;
if (PlistNodeCast (Node, PLIST_NODE_TYPE_DATA) != NULL) {
Content = XmlNodeContent (Node);
if (Content != NULL) {
*Size = (UINT32) AsciiStrLen (Content);
} else {
*Size = 0;
}
return TRUE;
}
if (PlistNodeCast (Node, PLIST_NODE_TYPE_STRING) != NULL) {
Content = XmlNodeContent (Node);
if (Content != NULL) {
*Size = (UINT32) (AsciiStrLen (Content) + 1);
} else {
*Size = 0;
}
return TRUE;
}
if (PlistNodeCast (Node, PLIST_NODE_TYPE_INTEGER) != NULL) {
*Size = sizeof (UINT32);
return TRUE;
}
if (PlistNodeCast (Node, PLIST_NODE_TYPE_TRUE) != NULL
|| PlistNodeCast (Node, PLIST_NODE_TYPE_FALSE) != NULL) {
*Size = sizeof (UINT8);
return TRUE;
}
return FALSE;
}
|
{
"pile_set_name": "Github"
}
|
#ifndef __GLOBALS_H_
#define __GLOBALS_H_
extern int overwrite_flag;
extern long seed_value;
extern long seeded;
extern int region_approach;
extern int current_depth, current_row;
extern int depths, rows, columns;
#endif /* __GLOBALS_H_ */
|
{
"pile_set_name": "Github"
}
|
{%- for signatureComponent in signature -%}
{%- if signatureComponent.kind == 'type' %}{{ anchor(signatureComponent.name, signatureComponent.qualifiedName) -}}
{%- else %}{{ signatureComponent.name }}{% endif -%}
{%- endfor -%}
|
{
"pile_set_name": "Github"
}
|
//
// Generated by class-dump 3.5 (64 bit) (Debug version compiled Oct 15 2018 10:31:50).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard.
//
#import <AddressBookCore/ABCNContact.h>
@class NSArray, NSDate, NSDateComponents, NSDictionary, NSString;
@interface ABCNMutableContact : ABCNContact
{
}
@property(copy, nonatomic) NSArray *linkedContacts; // @dynamic linkedContacts;
@property(copy, nonatomic) ABCNContact *snapshot; // @dynamic snapshot;
- (void)setNilValueForKey:(id)arg1;
@property(copy, nonatomic) NSArray *calendarURIs; // @dynamic calendarURIs;
- (void)setTone:(id)arg1 forAlert:(id)arg2;
@property(copy, nonatomic) NSDictionary *alertTones; // @dynamic alertTones;
- (void)setTexttone:(id)arg1;
- (void)setRingtone:(id)arg1;
@property(copy, nonatomic) NSArray *postalAddresses; // @dynamic postalAddresses;
@property(copy, nonatomic) NSArray *socialProfiles; // @dynamic socialProfiles;
@property(copy, nonatomic) NSArray *relatedNames; // @dynamic relatedNames;
@property(copy, nonatomic) NSArray *instantMessageAddresses; // @dynamic instantMessageAddresses;
@property(copy, nonatomic) NSArray *otherDateComponents; // @dynamic otherDateComponents;
@property(copy, nonatomic) NSArray *urlAddresses; // @dynamic urlAddresses;
@property(copy, nonatomic) NSArray *emailAddresses; // @dynamic emailAddresses;
@property(copy, nonatomic) NSArray *phoneNumbers; // @dynamic phoneNumbers;
@property(copy, nonatomic) NSString *phonemeData; // @dynamic phonemeData;
@property(copy, nonatomic) NSString *accountIdentifier; // @dynamic accountIdentifier;
@property(copy, nonatomic) NSString *cardDAVUID; // @dynamic cardDAVUID;
@property(nonatomic) long long nameOrder; // @dynamic nameOrder;
@property(nonatomic) long long displayStyle; // @dynamic displayStyle;
@property(copy, nonatomic) NSString *preferredLikenessSource; // @dynamic preferredLikenessSource;
@property(copy, nonatomic) NSString *preferredApplePersonaIdentifier; // @dynamic preferredApplePersonaIdentifier;
@property(nonatomic, getter=isPreferredForPhoto) BOOL preferredForPhoto; // @dynamic preferredForPhoto;
@property(nonatomic, getter=isPreferredForName) BOOL preferredForName; // @dynamic preferredForName;
@property(copy, nonatomic) NSString *linkIdentifier; // @dynamic linkIdentifier;
@property(copy, nonatomic) NSString *note; // @dynamic note;
@property(copy, nonatomic) NSDate *creationDate; // @dynamic creationDate;
@property(copy, nonatomic) NSDateComponents *alternateBirthdayComponents; // @dynamic alternateBirthdayComponents;
@property(copy, nonatomic) NSDateComponents *birthdayComponents; // @dynamic birthdayComponents;
@property(copy, nonatomic) NSString *jobTitle; // @dynamic jobTitle;
@property(copy, nonatomic) NSString *departmentName; // @dynamic departmentName;
@property(copy, nonatomic) NSString *phoneticCompanyName; // @dynamic phoneticCompanyName;
@property(copy, nonatomic) NSString *companyName; // @dynamic companyName;
@property(copy, nonatomic) NSString *sortingLastName; // @dynamic sortingLastName;
@property(copy, nonatomic) NSString *sortingFirstName; // @dynamic sortingFirstName;
@property(copy, nonatomic) NSString *phoneticLastName; // @dynamic phoneticLastName;
@property(copy, nonatomic) NSString *phoneticMiddleName; // @dynamic phoneticMiddleName;
@property(copy, nonatomic) NSString *phoneticFirstName; // @dynamic phoneticFirstName;
@property(copy, nonatomic) NSString *nickname; // @dynamic nickname;
@property(copy, nonatomic) NSString *maidenName; // @dynamic maidenName;
@property(copy, nonatomic) NSString *nameSuffix; // @dynamic nameSuffix;
@property(copy, nonatomic) NSString *lastName; // @dynamic lastName;
@property(copy, nonatomic) NSString *middleName; // @dynamic middleName;
@property(copy, nonatomic) NSString *firstName; // @dynamic firstName;
@property(copy, nonatomic) NSString *nameTitle; // @dynamic nameTitle;
- (id)freezeWithSelfAsSnapshot;
- (id)freeze;
- (id)copyWithSelfAsSnapshot;
- (id)copyWithZone:(struct _NSZone *)arg1;
@end
|
{
"pile_set_name": "Github"
}
|
import _curry2 from './internal/_curry2.js';
/**
* Calls an input function `n` times, returning an array containing the results
* of those function calls.
*
* `fn` is passed one argument: The current value of `n`, which begins at `0`
* and is gradually incremented to `n - 1`.
*
* @func
* @memberOf R
* @since v0.2.3
* @category List
* @sig (Number -> a) -> Number -> [a]
* @param {Function} fn The function to invoke. Passed one argument, the current value of `n`.
* @param {Number} n A value between `0` and `n - 1`. Increments after each function call.
* @return {Array} An array containing the return values of all calls to `fn`.
* @see R.repeat
* @example
*
* R.times(R.identity, 5); //=> [0, 1, 2, 3, 4]
* @symb R.times(f, 0) = []
* @symb R.times(f, 1) = [f(0)]
* @symb R.times(f, 2) = [f(0), f(1)]
*/
var times = _curry2(function times(fn, n) {
var len = Number(n);
var idx = 0;
var list;
if (len < 0 || isNaN(len)) {
throw new RangeError('n must be a non-negative number');
}
list = new Array(len);
while (idx < len) {
list[idx] = fn(idx);
idx += 1;
}
return list;
});
export default times;
|
{
"pile_set_name": "Github"
}
|
import React from 'react';
import PropTypes from 'prop-types';
import Dialog from '@material-ui/core/Dialog';
import DialogActions from '@material-ui/core/DialogActions';
import DialogContent from '@material-ui/core/DialogContent';
import DialogTitle from '@material-ui/core/DialogTitle';
//import withMobileDialog from '@material-ui/core/withMobileDialog';
import Toolbar from '@material-ui/core/Toolbar';
import Typography from '@material-ui/core/Typography';
import CloseIcon from '@material-ui/icons/Close';
import FullscreenIcon from '@material-ui/icons/Fullscreen';
import FullscreenExitIcon from '@material-ui/icons/FullscreenExit';
import IconButton from '@material-ui/core/IconButton';
import colors from '@material-ui/core/colors/common';
import withStyles from '@material-ui/core/styles/withStyles';
import compose from 'recompose/compose';
import cn from 'classnames';
const style = theme => ({
flex: {
flex: 1,
whiteSpace: 'nowrap',
},
toolbar: {
backgroundColor: theme.palette.primary[50],
borderBottom: '1px solid',
borderBottomColor: theme.palette.primary[100],
},
title: {
flex: '1 1 auto',
marginLeft: theme.spacing.unit * 2,
},
content: {
padding: theme.spacing.unit * 2,
},
contentNoSpace: {
padding: 0,
},
paper: {
[theme.breakpoints.up('sm')]: {
minWidth: 480,
}
},
minheight: {
minHeight: 320,
},
large: {
[theme.breakpoints.up('md')]: {
minWidth: 960,
},
maxHeight: 'calc(100vh - 80px)',
}
});
class SimpleDialog extends React.Component {
constructor(props, context) {
super(props, context);
this.state = {fullScreen: props.initFullScreen || false};
}
getChildContext() {
return {dnr: this};
}
get frameRect() {
return {};
}
toggleFullScreen = () => {
this.setState({fullScreen: !this.state.fullScreen})
}
render() {
const {open, fullScreen, disablePortal, noSpace, title, actions, children, classes, onClose, minheight, large} = this.props;
const stateFullScreen = fullScreen || this.state.fullScreen;
return <Dialog
disablePortal={disablePortal}
open={open}
fullScreen={stateFullScreen}
onClose={onClose}
classes={{paper: cn(large ? classes.large : classes.paper, minheight && classes.minheight)}}
>
<Toolbar disableGutters className={classes.toolbar}>
<Typography className={classes.title} variant="h6" color="inherit" noWrap>{title}</Typography>
{
!fullScreen && <IconButton
title={stateFullScreen ? 'Свернуть' : 'Развернуть'}
onClick={this.toggleFullScreen}>
{stateFullScreen ? <FullscreenExitIcon/> : <FullscreenIcon/>}
</IconButton>
}
<IconButton title="Закрыть диалог" onClick={onClose}><CloseIcon/></IconButton>
</Toolbar>
<DialogContent className={noSpace ? classes.contentNoSpace : classes.content}>{children}</DialogContent>
{actions && <DialogActions>{actions}</DialogActions>}
</Dialog>;
}
}
SimpleDialog.propTypes = {
open: PropTypes.bool,
fullScreen: PropTypes.bool,
disablePortal: PropTypes.bool,
initFullScreen: PropTypes.bool,
title: PropTypes.string.isRequired,
actions: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
children: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
classes: PropTypes.object.isRequired,
onClose: PropTypes.func.isRequired,
};
SimpleDialog.defaultProps = {
disablePortal: true,
};
SimpleDialog.childContextTypes = {
dnr: PropTypes.object
};
//export default compose(withStyles(style), withMobileDialog({ breakpoint: 'md' }))(SimpleDialog);
export default withStyles(style)(SimpleDialog);
|
{
"pile_set_name": "Github"
}
|
package dbus
import (
"bufio"
"bytes"
"errors"
"io"
"os"
"strconv"
)
// AuthStatus represents the Status of an authentication mechanism.
type AuthStatus byte
const (
// AuthOk signals that authentication is finished; the next command
// from the server should be an OK.
AuthOk AuthStatus = iota
// AuthContinue signals that additional data is needed; the next command
// from the server should be a DATA.
AuthContinue
// AuthError signals an error; the server sent invalid data or some
// other unexpected thing happened and the current authentication
// process should be aborted.
AuthError
)
type authState byte
const (
waitingForData authState = iota
waitingForOk
waitingForReject
)
// Auth defines the behaviour of an authentication mechanism.
type Auth interface {
// Return the name of the mechnism, the argument to the first AUTH command
// and the next status.
FirstData() (name, resp []byte, status AuthStatus)
// Process the given DATA command, and return the argument to the DATA
// command and the next status. If len(resp) == 0, no DATA command is sent.
HandleData(data []byte) (resp []byte, status AuthStatus)
}
// Auth authenticates the connection, trying the given list of authentication
// mechanisms (in that order). If nil is passed, the EXTERNAL and
// DBUS_COOKIE_SHA1 mechanisms are tried for the current user. For private
// connections, this method must be called before sending any messages to the
// bus. Auth must not be called on shared connections.
func (conn *Conn) Auth(methods []Auth) error {
if methods == nil {
uid := strconv.Itoa(os.Getuid())
methods = []Auth{AuthExternal(uid), AuthCookieSha1(uid, getHomeDir())}
}
in := bufio.NewReader(conn.transport)
err := conn.transport.SendNullByte()
if err != nil {
return err
}
err = authWriteLine(conn.transport, []byte("AUTH"))
if err != nil {
return err
}
s, err := authReadLine(in)
if err != nil {
return err
}
if len(s) < 2 || !bytes.Equal(s[0], []byte("REJECTED")) {
return errors.New("dbus: authentication protocol error")
}
s = s[1:]
for _, v := range s {
for _, m := range methods {
if name, data, status := m.FirstData(); bytes.Equal(v, name) {
var ok bool
err = authWriteLine(conn.transport, []byte("AUTH"), []byte(v), data)
if err != nil {
return err
}
switch status {
case AuthOk:
err, ok = conn.tryAuth(m, waitingForOk, in)
case AuthContinue:
err, ok = conn.tryAuth(m, waitingForData, in)
default:
panic("dbus: invalid authentication status")
}
if err != nil {
return err
}
if ok {
if conn.transport.SupportsUnixFDs() {
err = authWriteLine(conn, []byte("NEGOTIATE_UNIX_FD"))
if err != nil {
return err
}
line, err := authReadLine(in)
if err != nil {
return err
}
switch {
case bytes.Equal(line[0], []byte("AGREE_UNIX_FD")):
conn.EnableUnixFDs()
conn.unixFD = true
case bytes.Equal(line[0], []byte("ERROR")):
default:
return errors.New("dbus: authentication protocol error")
}
}
err = authWriteLine(conn.transport, []byte("BEGIN"))
if err != nil {
return err
}
go conn.inWorker()
go conn.outWorker()
return nil
}
}
}
}
return errors.New("dbus: authentication failed")
}
// tryAuth tries to authenticate with m as the mechanism, using state as the
// initial authState and in for reading input. It returns (nil, true) on
// success, (nil, false) on a REJECTED and (someErr, false) if some other
// error occured.
func (conn *Conn) tryAuth(m Auth, state authState, in *bufio.Reader) (error, bool) {
for {
s, err := authReadLine(in)
if err != nil {
return err, false
}
switch {
case state == waitingForData && string(s[0]) == "DATA":
if len(s) != 2 {
err = authWriteLine(conn.transport, []byte("ERROR"))
if err != nil {
return err, false
}
continue
}
data, status := m.HandleData(s[1])
switch status {
case AuthOk, AuthContinue:
if len(data) != 0 {
err = authWriteLine(conn.transport, []byte("DATA"), data)
if err != nil {
return err, false
}
}
if status == AuthOk {
state = waitingForOk
}
case AuthError:
err = authWriteLine(conn.transport, []byte("ERROR"))
if err != nil {
return err, false
}
}
case state == waitingForData && string(s[0]) == "REJECTED":
return nil, false
case state == waitingForData && string(s[0]) == "ERROR":
err = authWriteLine(conn.transport, []byte("CANCEL"))
if err != nil {
return err, false
}
state = waitingForReject
case state == waitingForData && string(s[0]) == "OK":
if len(s) != 2 {
err = authWriteLine(conn.transport, []byte("CANCEL"))
if err != nil {
return err, false
}
state = waitingForReject
}
conn.uuid = string(s[1])
return nil, true
case state == waitingForData:
err = authWriteLine(conn.transport, []byte("ERROR"))
if err != nil {
return err, false
}
case state == waitingForOk && string(s[0]) == "OK":
if len(s) != 2 {
err = authWriteLine(conn.transport, []byte("CANCEL"))
if err != nil {
return err, false
}
state = waitingForReject
}
conn.uuid = string(s[1])
return nil, true
case state == waitingForOk && string(s[0]) == "REJECTED":
return nil, false
case state == waitingForOk && (string(s[0]) == "DATA" ||
string(s[0]) == "ERROR"):
err = authWriteLine(conn.transport, []byte("CANCEL"))
if err != nil {
return err, false
}
state = waitingForReject
case state == waitingForOk:
err = authWriteLine(conn.transport, []byte("ERROR"))
if err != nil {
return err, false
}
case state == waitingForReject && string(s[0]) == "REJECTED":
return nil, false
case state == waitingForReject:
return errors.New("dbus: authentication protocol error"), false
default:
panic("dbus: invalid auth state")
}
}
}
// authReadLine reads a line and separates it into its fields.
func authReadLine(in *bufio.Reader) ([][]byte, error) {
data, err := in.ReadBytes('\n')
if err != nil {
return nil, err
}
data = bytes.TrimSuffix(data, []byte("\r\n"))
return bytes.Split(data, []byte{' '}), nil
}
// authWriteLine writes the given line in the authentication protocol format
// (elements of data separated by a " " and terminated by "\r\n").
func authWriteLine(out io.Writer, data ...[]byte) error {
buf := make([]byte, 0)
for i, v := range data {
buf = append(buf, v...)
if i != len(data)-1 {
buf = append(buf, ' ')
}
}
buf = append(buf, '\r')
buf = append(buf, '\n')
n, err := out.Write(buf)
if err != nil {
return err
}
if n != len(buf) {
return io.ErrUnexpectedEOF
}
return nil
}
|
{
"pile_set_name": "Github"
}
|
{
"@context": {
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type": {"@id": "@type", "@type": "@id"}
},
"@graph": [
{
"@id": "http://example.com/a",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type": "http://example.com/b"
}, {
"@id": "http://example.com/c",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type": [
"http://example.com/d",
"http://example.com/e"
]
}, {
"@id": "http://example.com/f",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type": "http://example.com/g"
}
]
}
|
{
"pile_set_name": "Github"
}
|
Há muito tempo, antes dos tróis
habitarem cavernas e das górgonas
entrarem em seus templos, houve
uma mulher que roubou dos deuses
um arado, e o reivindicou como uma
invenção própia. Devido este crime,
ela foi metamorfoseada num terrível
inseto: a primeira rainha Myrmex.
Embora ela fosse a primeira de sua
espécie, ela não ficou sozinha por
muito tempo, sua fecundidade
insectoide gerou enormes colônias
de Myrmex em selvas e desertos.
O rosto do myrmex é horrendo,
um grande inseto com ferrão e
mandíbulosas poderosas. Sua
sociedade é separada em castas
semelhantes à de insetos Eusociais.
§nOperárias
As operárias são os menores
membros da casta. Elas são as
trabalhadoras da colônia e à deixam
frequentemente para coletar alimentos
e outros recursos. Os itens são
depositados nas salas de alimentos
da colônia. As operárias também
são responsáveis por mover ovos
de myrmex jovem, larvas e pupas
para as Salas de Enfermagem. Elas
são a casta de myrmex mais
frequentemente encontradas fora
das colônias e, com isso, são
constantementes predados por
Minhocas Mortíferas. Elas são
geralmente escoltadas por soldados.
|
{
"pile_set_name": "Github"
}
|
/*--------------------------------------------------------*\
| |
| hprose |
| |
| Official WebSite: https://hprose.com |
| |
| BytesSerializer.cs |
| |
| BytesSerializer class for C#. |
| |
| LastModified: Jan 11, 2019 |
| Author: Ma Bingyao <[email protected]> |
| |
\*________________________________________________________*/
namespace Hprose.IO.Serializers {
using static Tags;
internal class BytesSerializer : ReferenceSerializer<byte[]> {
public override void Write(Writer writer, byte[] obj) {
base.Write(writer, obj);
var stream = writer.Stream;
stream.WriteByte(TagBytes);
int length = obj.Length;
if (length > 0) {
ValueWriter.WriteInt(stream, length);
}
stream.WriteByte(TagQuote);
stream.Write(obj, 0, length);
stream.WriteByte(TagQuote);
}
}
}
|
{
"pile_set_name": "Github"
}
|
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc -->
<title>Uses of Class squidpony.FakeLanguageGen.Alteration (squidlib-util 3.0.1)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="description" content="use: package: squidpony, class: FakeLanguageGen, class: Alteration">
<meta name="generator" content="javadoc/ClassUseWriter">
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../script-dir/jquery-ui.css" title="Style">
<script type="text/javascript" src="../../script.js"></script>
<script type="text/javascript" src="../../script-dir/jszip/dist/jszip.min.js"></script>
<script type="text/javascript" src="../../script-dir/jszip-utils/dist/jszip-utils.min.js"></script>
<!--[if IE]>
<script type="text/javascript" src="../../script-dir/jszip-utils/dist/jszip-utils-ie.min.js"></script>
<![endif]-->
<script type="text/javascript" src="../../script-dir/jquery-3.4.1.js"></script>
<script type="text/javascript" src="../../script-dir/jquery-ui.js"></script>
</head>
<body class="class-use">
<script type="text/javascript">var pathtoroot = "../../";
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="flexBox">
<header role="banner" class="flexHeader">
<nav role="navigation">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a id="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../index.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../FakeLanguageGen.Alteration.html" title="class in squidpony">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../index-files/index-1.html">Index</a></li>
<li><a href="../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<div class="navListSearch"><label for="search">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">
</div>
</div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="skipNav"><a id="skip.navbar.top">
<!-- -->
</a></div>
</nav>
</header>
<div class="flexContent">
<main role="main">
<div class="header">
<h1 title="Uses of Class squidpony.FakeLanguageGen.Alteration" class="title">Uses of Class<br>squidpony.FakeLanguageGen.Alteration</h1>
</div>
<div class="classUseContainer">
<div class="useSummary">
<table>
<caption><span>Packages that use <a href="../FakeLanguageGen.Alteration.html" title="class in squidpony">FakeLanguageGen.Alteration</a></span><span class="tabEnd"> </span></caption>
<thead>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr class="altColor">
<th class="colFirst" scope="row"><a href="#squidpony">squidpony</a></th>
<td class="colLast">
<div class="block">Utilities that don't fit elsewhere in SquidLib; mostly text manipulation, compression, and helper code.</div>
</td>
</tr>
</tbody>
</table>
</div>
<section class="classUses">
<ul class="blockList">
<li class="blockList">
<section class="detail"><a id="squidpony">
<!-- -->
</a>
<h2>Uses of <a href="../FakeLanguageGen.Alteration.html" title="class in squidpony">FakeLanguageGen.Alteration</a> in <a href="../package-summary.html">squidpony</a></h2>
<div class="useSummary">
<table>
<caption><span>Fields in <a href="../package-summary.html">squidpony</a> declared as <a href="../FakeLanguageGen.Alteration.html" title="class in squidpony">FakeLanguageGen.Alteration</a></span><span class="tabEnd"> </span></caption>
<thead>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Field</th>
<th class="colLast" scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr class="altColor">
<td class="colFirst"><code><a href="../FakeLanguageGen.Alteration.html" title="class in squidpony">FakeLanguageGen.Alteration</a>[]</code></td>
<th class="colSecond" scope="row"><span class="typeNameLabel">FakeLanguageGen.Modifier.</span><code><span class="memberNameLink"><a href="../FakeLanguageGen.Modifier.html#alterations">alterations</a></span></code></th>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</div>
<div class="useSummary">
<table>
<caption><span>Fields in <a href="../package-summary.html">squidpony</a> with type parameters of type <a href="../FakeLanguageGen.Alteration.html" title="class in squidpony">FakeLanguageGen.Alteration</a></span><span class="tabEnd"> </span></caption>
<thead>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Field</th>
<th class="colLast" scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr class="altColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/en/java/javase/14/docs/api/java.base/java/util/ArrayList.html?is-external=true" title="class or interface in java.util" class="externalLink">ArrayList</a><<a href="../FakeLanguageGen.Alteration.html" title="class in squidpony">FakeLanguageGen.Alteration</a>></code></td>
<th class="colSecond" scope="row"><span class="typeNameLabel">Thesaurus.</span><code><span class="memberNameLink"><a href="../Thesaurus.html#alterations">alterations</a></span></code></th>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</div>
<div class="useSummary">
<table>
<caption><span>Methods in <a href="../package-summary.html">squidpony</a> that return <a href="../FakeLanguageGen.Alteration.html" title="class in squidpony">FakeLanguageGen.Alteration</a></span><span class="tabEnd"> </span></caption>
<thead>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Method</th>
<th class="colLast" scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../FakeLanguageGen.Alteration.html" title="class in squidpony">FakeLanguageGen.Alteration</a></code></td>
<th class="colSecond" scope="row"><span class="typeNameLabel">FakeLanguageGen.Alteration.</span><code><span class="memberNameLink"><a href="../FakeLanguageGen.Alteration.html#deserializeFromString(java.lang.String)">deserializeFromString</a></span>​(<a href="https://docs.oracle.com/en/java/javase/14/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> data)</code></th>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</div>
<div class="useSummary">
<table>
<caption><span>Constructors in <a href="../package-summary.html">squidpony</a> with parameters of type <a href="../FakeLanguageGen.Alteration.html" title="class in squidpony">FakeLanguageGen.Alteration</a></span><span class="tabEnd"> </span></caption>
<thead>
<tr>
<th class="colFirst" scope="col">Constructor</th>
<th class="colLast" scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr class="altColor">
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../FakeLanguageGen.Modifier.html#%3Cinit%3E(squidpony.FakeLanguageGen.Alteration...)">Modifier</a></span>​(<a href="../FakeLanguageGen.Alteration.html" title="class in squidpony">FakeLanguageGen.Alteration</a>... alts)</code></th>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</div>
</section>
</li>
</ul>
</section>
</div>
</main>
<footer role="contentinfo">
<nav role="navigation">
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a id="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../index.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../FakeLanguageGen.Alteration.html" title="class in squidpony">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../index-files/index-1.html">Index</a></li>
<li><a href="../../help-doc.html">Help</a></li>
</ul>
</div>
<a id="skip.navbar.bottom">
<!-- -->
</a>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</nav>
<p class="legalCopy"><small>Copyright © 2012–2020. All rights reserved.</small></p>
</footer>
</div>
</div>
</body>
</html>
|
{
"pile_set_name": "Github"
}
|
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2015 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: yunwuxin <[email protected]>
// +----------------------------------------------------------------------
namespace think\captcha;
use think\facade\Session;
class Captcha
{
protected $config = [
'seKey' => 'ThinkPHP.CN',
// 验证码加密密钥
'codeSet' => '2345678abcdefhijkmnpqrstuvwxyzABCDEFGHJKLMNPQRTUVWXY',
// 验证码字符集合
'expire' => 1800,
// 验证码过期时间(s)
'useZh' => false,
// 使用中文验证码
'zhSet' => '们以我到他会作时要动国产的一是工就年阶义发成部民可出能方进在了不和有大这主中人上为来分生对于学下级地个用同行面说种过命度革而多子后自社加小机也经力线本电高量长党得实家定深法表着水理化争现所二起政三好十战无农使性前等反体合斗路图把结第里正新开论之物从当两些还天资事队批点育重其思与间内去因件日利相由压员气业代全组数果期导平各基或月毛然如应形想制心样干都向变关问比展那它最及外没看治提五解系林者米群头意只明四道马认次文通但条较克又公孔领军流入接席位情运器并飞原油放立题质指建区验活众很教决特此常石强极土少已根共直团统式转别造切九你取西持总料连任志观调七么山程百报更见必真保热委手改管处己将修支识病象几先老光专什六型具示复安带每东增则完风回南广劳轮科北打积车计给节做务被整联步类集号列温装即毫知轴研单色坚据速防史拉世设达尔场织历花受求传口断况采精金界品判参层止边清至万确究书术状厂须离再目海交权且儿青才证低越际八试规斯近注办布门铁需走议县兵固除般引齿千胜细影济白格效置推空配刀叶率述今选养德话查差半敌始片施响收华觉备名红续均药标记难存测士身紧液派准斤角降维板许破述技消底床田势端感往神便贺村构照容非搞亚磨族火段算适讲按值美态黄易彪服早班麦削信排台声该击素张密害侯草何树肥继右属市严径螺检左页抗苏显苦英快称坏移约巴材省黑武培著河帝仅针怎植京助升王眼她抓含苗副杂普谈围食射源例致酸旧却充足短划剂宣环落首尺波承粉践府鱼随考刻靠够满夫失包住促枝局菌杆周护岩师举曲春元超负砂封换太模贫减阳扬江析亩木言球朝医校古呢稻宋听唯输滑站另卫字鼓刚写刘微略范供阿块某功套友限项余倒卷创律雨让骨远帮初皮播优占死毒圈伟季训控激找叫云互跟裂粮粒母练塞钢顶策双留误础吸阻故寸盾晚丝女散焊功株亲院冷彻弹错散商视艺灭版烈零室轻血倍缺厘泵察绝富城冲喷壤简否柱李望盘磁雄似困巩益洲脱投送奴侧润盖挥距触星松送获兴独官混纪依未突架宽冬章湿偏纹吃执阀矿寨责熟稳夺硬价努翻奇甲预职评读背协损棉侵灰虽矛厚罗泥辟告卵箱掌氧恩爱停曾溶营终纲孟钱待尽俄缩沙退陈讨奋械载胞幼哪剥迫旋征槽倒握担仍呀鲜吧卡粗介钻逐弱脚怕盐末阴丰雾冠丙街莱贝辐肠付吉渗瑞惊顿挤秒悬姆烂森糖圣凹陶词迟蚕亿矩康遵牧遭幅园腔订香肉弟屋敏恢忘编印蜂急拿扩伤飞露核缘游振操央伍域甚迅辉异序免纸夜乡久隶缸夹念兰映沟乙吗儒杀汽磷艰晶插埃燃欢铁补咱芽永瓦倾阵碳演威附牙芽永瓦斜灌欧献顺猪洋腐请透司危括脉宜笑若尾束壮暴企菜穗楚汉愈绿拖牛份染既秋遍锻玉夏疗尖殖井费州访吹荣铜沿替滚客召旱悟刺脑措贯藏敢令隙炉壳硫煤迎铸粘探临薄旬善福纵择礼愿伏残雷延烟句纯渐耕跑泽慢栽鲁赤繁境潮横掉锥希池败船假亮谓托伙哲怀割摆贡呈劲财仪沉炼麻罪祖息车穿货销齐鼠抽画饲龙库守筑房歌寒喜哥洗蚀废纳腹乎录镜妇恶脂庄擦险赞钟摇典柄辩竹谷卖乱虚桥奥伯赶垂途额壁网截野遗静谋弄挂课镇妄盛耐援扎虑键归符庆聚绕摩忙舞遇索顾胶羊湖钉仁音迹碎伸灯避泛亡答勇频皇柳哈揭甘诺概宪浓岛袭谁洪谢炮浇斑讯懂灵蛋闭孩释乳巨徒私银伊景坦累匀霉杜乐勒隔弯绩招绍胡呼痛峰零柴簧午跳居尚丁秦稍追梁折耗碱殊岗挖氏刃剧堆赫荷胸衡勤膜篇登驻案刊秧缓凸役剪川雪链渔啦脸户洛孢勃盟买杨宗焦赛旗滤硅炭股坐蒸凝竟陷枪黎救冒暗洞犯筒您宋弧爆谬涂味津臂障褐陆啊健尊豆拔莫抵桑坡缝警挑污冰柬嘴啥饭塑寄赵喊垫丹渡耳刨虎笔稀昆浪萨茶滴浅拥穴覆伦娘吨浸袖珠雌妈紫戏塔锤震岁貌洁剖牢锋疑霸闪埔猛诉刷狠忽灾闹乔唐漏闻沈熔氯荒茎男凡抢像浆旁玻亦忠唱蒙予纷捕锁尤乘乌智淡允叛畜俘摸锈扫毕璃宝芯爷鉴秘净蒋钙肩腾枯抛轨堂拌爸循诱祝励肯酒绳穷塘燥泡袋朗喂铝软渠颗惯贸粪综墙趋彼届墨碍启逆卸航衣孙龄岭骗休借',
// 中文验证码字符串
'useImgBg' => false,
// 使用背景图片
'fontSize' => 25,
// 验证码字体大小(px)
'useCurve' => true,
// 是否画混淆曲线
'useNoise' => true,
// 是否添加杂点
'imageH' => 0,
// 验证码图片高度
'imageW' => 0,
// 验证码图片宽度
'length' => 5,
// 验证码位数
'fontttf' => '',
// 验证码字体,不设置随机获取
'bg' => [243, 251, 254],
// 背景颜色
'reset' => true,
// 验证成功后是否重置
];
private $im = null; // 验证码图片实例
private $color = null; // 验证码字体颜色
/**
* 架构方法 设置参数
* @access public
* @param array $config 配置参数
*/
public function __construct($config = [])
{
$this->config = array_merge($this->config, $config);
}
/**
* 使用 $this->name 获取配置
* @access public
* @param string $name 配置名称
* @return mixed 配置值
*/
public function __get($name)
{
return $this->config[$name];
}
/**
* 设置验证码配置
* @access public
* @param string $name 配置名称
* @param string $value 配置值
* @return void
*/
public function __set($name, $value)
{
if (isset($this->config[$name])) {
$this->config[$name] = $value;
}
}
/**
* 检查配置
* @access public
* @param string $name 配置名称
* @return bool
*/
public function __isset($name)
{
return isset($this->config[$name]);
}
/**
* 验证验证码是否正确
* @access public
* @param string $code 用户验证码
* @param string $id 验证码标识
* @return bool 用户验证码是否正确
*/
public function check($code, $id = '')
{
$key = $this->authcode($this->seKey) . $id;
// 验证码不能为空
$secode = Session::get($key, '');
if (empty($code) || empty($secode)) {
return false;
}
// session 过期
if (time() - $secode['verify_time'] > $this->expire) {
Session::delete($key, '');
return false;
}
if ($this->authcode(strtoupper($code)) == $secode['verify_code']) {
$this->reset && Session::delete($key, '');
return true;
}
return false;
}
/**
* 输出验证码并把验证码的值保存的session中
* 验证码保存到session的格式为: array('verify_code' => '验证码值', 'verify_time' => '验证码创建时间');
* @access public
* @param string $id 要生成验证码的标识
* @return \think\Response
*/
public function entry($id = '')
{
// 图片宽(px)
$this->imageW || $this->imageW = $this->length * $this->fontSize * 1.5 + $this->length * $this->fontSize / 2;
// 图片高(px)
$this->imageH || $this->imageH = $this->fontSize * 2.5;
// 建立一幅 $this->imageW x $this->imageH 的图像
$this->im = imagecreate($this->imageW, $this->imageH);
// 设置背景
imagecolorallocate($this->im, $this->bg[0], $this->bg[1], $this->bg[2]);
// 验证码字体随机颜色
$this->color = imagecolorallocate($this->im, mt_rand(1, 150), mt_rand(1, 150), mt_rand(1, 150));
// 验证码使用随机字体
$ttfPath = __DIR__ . '/../assets/' . ($this->useZh ? 'zhttfs' : 'ttfs') . '/';
if (empty($this->fontttf)) {
$dir = dir($ttfPath);
$ttfs = [];
while (false !== ($file = $dir->read())) {
if ('.' != $file[0] && substr($file, -4) == '.ttf') {
$ttfs[] = $file;
}
}
$dir->close();
$this->fontttf = $ttfs[array_rand($ttfs)];
}
$this->fontttf = $ttfPath . $this->fontttf;
if ($this->useImgBg) {
$this->background();
}
if ($this->useNoise) {
// 绘杂点
$this->writeNoise();
}
if ($this->useCurve) {
// 绘干扰线
$this->writeCurve();
}
// 绘验证码
$code = []; // 验证码
$codeNX = 0; // 验证码第N个字符的左边距
if ($this->useZh) {
// 中文验证码
for ($i = 0; $i < $this->length; $i++) {
$code[$i] = iconv_substr($this->zhSet, floor(mt_rand(0, mb_strlen($this->zhSet, 'utf-8') - 1)), 1, 'utf-8');
imagettftext($this->im, $this->fontSize, mt_rand(-40, 40), $this->fontSize * ($i + 1) * 1.5, $this->fontSize + mt_rand(10, 20), $this->color, $this->fontttf, $code[$i]);
}
} else {
for ($i = 0; $i < $this->length; $i++) {
$code[$i] = $this->codeSet[mt_rand(0, strlen($this->codeSet) - 1)];
$codeNX += mt_rand($this->fontSize * 1.2, $this->fontSize * 1.6);
imagettftext($this->im, $this->fontSize, mt_rand(-40, 40), $codeNX, $this->fontSize * 1.6, $this->color, $this->fontttf, $code[$i]);
}
}
// 保存验证码
$key = $this->authcode($this->seKey);
$code = $this->authcode(strtoupper(implode('', $code)));
$secode = [];
$secode['verify_code'] = $code; // 把校验码保存到session
$secode['verify_time'] = time(); // 验证码创建时间
Session::set($key . $id, $secode, '');
ob_start();
// 输出图像
imagepng($this->im);
$content = ob_get_clean();
imagedestroy($this->im);
return response($content, 200, ['Content-Length' => strlen($content)])->contentType('image/png');
}
/**
* 画一条由两条连在一起构成的随机正弦函数曲线作干扰线(你可以改成更帅的曲线函数)
*
* 高中的数学公式咋都忘了涅,写出来
* 正弦型函数解析式:y=Asin(ωx+φ)+b
* 各常数值对函数图像的影响:
* A:决定峰值(即纵向拉伸压缩的倍数)
* b:表示波形在Y轴的位置关系或纵向移动距离(上加下减)
* φ:决定波形与X轴位置关系或横向移动距离(左加右减)
* ω:决定周期(最小正周期T=2π/∣ω∣)
*
*/
private function writeCurve()
{
$px = $py = 0;
// 曲线前部分
$A = mt_rand(1, $this->imageH / 2); // 振幅
$b = mt_rand(-$this->imageH / 4, $this->imageH / 4); // Y轴方向偏移量
$f = mt_rand(-$this->imageH / 4, $this->imageH / 4); // X轴方向偏移量
$T = mt_rand($this->imageH, $this->imageW * 2); // 周期
$w = (2 * M_PI) / $T;
$px1 = 0; // 曲线横坐标起始位置
$px2 = mt_rand($this->imageW / 2, $this->imageW * 0.8); // 曲线横坐标结束位置
for ($px = $px1; $px <= $px2; $px = $px + 1) {
if (0 != $w) {
$py = $A * sin($w * $px + $f) + $b + $this->imageH / 2; // y = Asin(ωx+φ) + b
$i = (int) ($this->fontSize / 5);
while ($i > 0) {
imagesetpixel($this->im, $px + $i, $py + $i, $this->color); // 这里(while)循环画像素点比imagettftext和imagestring用字体大小一次画出(不用这while循环)性能要好很多
$i--;
}
}
}
// 曲线后部分
$A = mt_rand(1, $this->imageH / 2); // 振幅
$f = mt_rand(-$this->imageH / 4, $this->imageH / 4); // X轴方向偏移量
$T = mt_rand($this->imageH, $this->imageW * 2); // 周期
$w = (2 * M_PI) / $T;
$b = $py - $A * sin($w * $px + $f) - $this->imageH / 2;
$px1 = $px2;
$px2 = $this->imageW;
for ($px = $px1; $px <= $px2; $px = $px + 1) {
if (0 != $w) {
$py = $A * sin($w * $px + $f) + $b + $this->imageH / 2; // y = Asin(ωx+φ) + b
$i = (int) ($this->fontSize / 5);
while ($i > 0) {
imagesetpixel($this->im, $px + $i, $py + $i, $this->color);
$i--;
}
}
}
}
/**
* 画杂点
* 往图片上写不同颜色的字母或数字
*/
private function writeNoise()
{
$codeSet = '2345678abcdefhijkmnpqrstuvwxyz';
for ($i = 0; $i < 10; $i++) {
//杂点颜色
$noiseColor = imagecolorallocate($this->im, mt_rand(150, 225), mt_rand(150, 225), mt_rand(150, 225));
for ($j = 0; $j < 5; $j++) {
// 绘杂点
imagestring($this->im, 5, mt_rand(-10, $this->imageW), mt_rand(-10, $this->imageH), $codeSet[mt_rand(0, 29)], $noiseColor);
}
}
}
/**
* 绘制背景图片
* 注:如果验证码输出图片比较大,将占用比较多的系统资源
*/
private function background()
{
$path = __DIR__ . '/../assets/bgs/';
$dir = dir($path);
$bgs = [];
while (false !== ($file = $dir->read())) {
if ('.' != $file[0] && substr($file, -4) == '.jpg') {
$bgs[] = $path . $file;
}
}
$dir->close();
$gb = $bgs[array_rand($bgs)];
list($width, $height) = @getimagesize($gb);
// Resample
$bgImage = @imagecreatefromjpeg($gb);
@imagecopyresampled($this->im, $bgImage, 0, 0, 0, 0, $this->imageW, $this->imageH, $width, $height);
@imagedestroy($bgImage);
}
/* 加密验证码 */
private function authcode($str)
{
$key = substr(md5($this->seKey), 5, 8);
$str = substr(md5($str), 8, 10);
return md5($key . $str);
}
}
|
{
"pile_set_name": "Github"
}
|
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.png">
<!--
Notice the use of %PUBLIC_URL% in the tag above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>RAP接口管理平台</title>
</head>
<body>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start`.
To create a production bundle, use `npm run build`.
-->
</body>
</html>
|
{
"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.
-->
<dataset>
<metadata>
<column name="item_id" />
</metadata>
<row values="100001" />
<row values="100002" />
<row values="100101" />
<row values="100102" />
<row values="110001" />
<row values="110002" />
<row values="110101" />
<row values="110102" />
<row values="120001" />
<row values="120002" />
<row values="120101" />
<row values="120102" />
<row values="130001" />
<row values="130002" />
<row values="130101" />
<row values="130102" />
<row values="140001" />
<row values="140002" />
<row values="140101" />
<row values="140102" />
<row values="150001" />
<row values="150002" />
<row values="150101" />
<row values="150102" />
<row values="160001" />
<row values="160002" />
<row values="160101" />
<row values="160102" />
<row values="170001" />
<row values="170002" />
<row values="170101" />
<row values="170102" />
<row values="180001" />
<row values="180002" />
<row values="180101" />
<row values="180102" />
<row values="190001" />
<row values="190002" />
<row values="190101" />
<row values="190102" />
<row values="200001" />
<row values="200002" />
<row values="200101" />
<row values="200102" />
<row values="210001" />
<row values="210002" />
<row values="210101" />
<row values="210102" />
<row values="220001" />
<row values="220002" />
<row values="220101" />
<row values="220102" />
<row values="230001" />
<row values="230002" />
<row values="230101" />
<row values="230102" />
<row values="240001" />
<row values="240002" />
<row values="240101" />
<row values="240102" />
<row values="250001" />
<row values="250002" />
<row values="250101" />
<row values="250102" />
<row values="260001" />
<row values="260002" />
<row values="260101" />
<row values="260102" />
<row values="270001" />
<row values="270002" />
<row values="270101" />
<row values="270102" />
<row values="280001" />
<row values="280002" />
<row values="280101" />
<row values="280102" />
<row values="290001" />
<row values="290002" />
<row values="290101" />
<row values="290102" />
</dataset>
|
{
"pile_set_name": "Github"
}
|
#version 450
layout( location = 0 ) in vec4 app_position;
layout( set = 0, binding = 0 ) uniform UniformBuffer {
mat4 ModelViewMatrix;
mat4 ProjectionMatrix;
};
void main() {
gl_Position = ModelViewMatrix * app_position;
}
|
{
"pile_set_name": "Github"
}
|
function varargout = slic(varargin)
% VL_SLIC SLIC superpixels
% SEGMENTS = VL_SLIC(IM, REGIONSIZE, REGULARIZER) extracts the SLIC
% superpixes [1] from image IM. REGIONSIZE is the starting size of
% the superpixels and REGULARIZER is the trades-off appearance for
% spatial regularity when clustering (a larger value results in more
% spatial regularization). SEGMENTS is a UINT32 array containing the
% superpixel identifier for each image pixel.
%
% The image IM is a SINGLE array with two or three dimensions. The
% third dimension is arbitrary, but it is usually three for RGB or
% LAB images.
%
% VL_SLIC() accepts the following options:
%
% Verbose::
% Be verbose.
%
% MinRegionSize:: (1/6 of REGIONSIZE)^2
% The minimum size (in pixel area) of the extracted
% superpixels.
%
% Example::
% If IM contains an RGB images, the SLIC superpixels can be
% extracted as:
%
% REFERENCES::
% [1] R. Achanta, A. Shaji, K. Smith, A. Lucchi, P. Fua, and
% S. Susstrunk. SLIC superpixels. Technical report, EPFL, 2010.
%
% See also:: http://www.vlfeat.org/doc/api/slic.html, VL_HELP().
[varargout{1:nargout}] = vl_slic(varargin{:});
|
{
"pile_set_name": "Github"
}
|
# WARNING: Never edit this file.
# It will be overwritten when translations are pulled from Crowdin.
#
# To work with us on translations, join this project:
# https://translate.discourse.org/
da:
js:
notifications:
alt:
solved:
accepted_notification: "accepteret"
solved:
allow_accepted_answers: "Tillad ejer af emne og stab at markere svar som en løsning"
accepted_answer: "Løsning"
solution: "Løsning"
topic_status_filter:
all: "alle"
topic_statuses:
solved:
help: "Dette svar har en løsning"
|
{
"pile_set_name": "Github"
}
|
/*
Copyright 2014 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.
*/
package filters
import (
"errors"
"net/http"
"strings"
"github.com/golang/glog"
"github.com/prometheus/client_golang/prometheus"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apiserver/pkg/authentication/authenticator"
"k8s.io/apiserver/pkg/endpoints/handlers/responsewriters"
genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
)
var (
authenticatedUserCounter = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "authenticated_user_requests",
Help: "Counter of authenticated requests broken out by username.",
},
[]string{"username"},
)
)
func init() {
prometheus.MustRegister(authenticatedUserCounter)
}
// WithAuthentication creates an http handler that tries to authenticate the given request as a user, and then
// stores any such user found onto the provided context for the request. If authentication fails or returns an error
// the failed handler is used. On success, "Authorization" header is removed from the request and handler
// is invoked to serve the request.
func WithAuthentication(handler http.Handler, mapper genericapirequest.RequestContextMapper, auth authenticator.Request, failed http.Handler) http.Handler {
if auth == nil {
glog.Warningf("Authentication is disabled")
return handler
}
return genericapirequest.WithRequestContext(
http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
user, ok, err := auth.AuthenticateRequest(req)
if err != nil || !ok {
if err != nil {
glog.Errorf("Unable to authenticate the request due to an error: %v", err)
}
failed.ServeHTTP(w, req)
return
}
// authorization header is not required anymore in case of a successful authentication.
req.Header.Del("Authorization")
if ctx, ok := mapper.Get(req); ok {
mapper.Update(req, genericapirequest.WithUser(ctx, user))
}
authenticatedUserCounter.WithLabelValues(compressUsername(user.GetName())).Inc()
handler.ServeHTTP(w, req)
}),
mapper,
)
}
func Unauthorized(requestContextMapper genericapirequest.RequestContextMapper, s runtime.NegotiatedSerializer, supportsBasicAuth bool) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
if supportsBasicAuth {
w.Header().Set("WWW-Authenticate", `Basic realm="kubernetes-master"`)
}
ctx, ok := requestContextMapper.Get(req)
if !ok {
responsewriters.InternalError(w, req, errors.New("no context found for request"))
return
}
requestInfo, found := genericapirequest.RequestInfoFrom(ctx)
if !found {
responsewriters.InternalError(w, req, errors.New("no RequestInfo found in the context"))
return
}
gv := schema.GroupVersion{Group: requestInfo.APIGroup, Version: requestInfo.APIVersion}
responsewriters.ErrorNegotiated(ctx, apierrors.NewUnauthorized("Unauthorized"), s, gv, w, req)
})
}
// compressUsername maps all possible usernames onto a small set of categories
// of usernames. This is done both to limit the cardinality of the
// authorized_user_requests metric, and to avoid pushing actual usernames in the
// metric.
func compressUsername(username string) string {
switch {
// Known internal identities.
case username == "admin" ||
username == "client" ||
username == "kube_proxy" ||
username == "kubelet" ||
username == "system:serviceaccount:kube-system:default":
return username
// Probably an email address.
case strings.Contains(username, "@"):
return "email_id"
// Anything else (custom service accounts, custom external identities, etc.)
default:
return "other"
}
}
|
{
"pile_set_name": "Github"
}
|
<doc>
<div id="lookup"/>
<div id="unwanted"/>
</doc>
|
{
"pile_set_name": "Github"
}
|
# 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/.
toolkit.jar:
content/global/aboutCache.js (content/aboutCache.js)
|
{
"pile_set_name": "Github"
}
|
export function classExtender<TFunction>(superClass: TFunction, _instanceModifier: (instance: any, args: any[]) => void): TFunction {
return class decoratorFunc extends superClass {
constructor(...args: any[]) {
super(...args);
_instanceModifier(this, args);
}
};
}
class MyClass { private x; }
export function classExtender2<TFunction extends new (...args: string[]) => MyClass>(superClass: TFunction, _instanceModifier: (instance: any, args: any[]) => void): TFunction {
return class decoratorFunc extends superClass {
constructor(...args: any[]) {
super(...args);
_instanceModifier(this, args);
}
};
}
|
{
"pile_set_name": "Github"
}
|
using System.Collections.Generic;
using Alipay.AopSdk.Core.Response;
namespace Alipay.AopSdk.Core.Request
{
/// <summary>
/// AOP API: alipay.trade.cancel
/// </summary>
public class AlipayTradeCancelRequest : IAopRequest<AlipayTradeCancelResponse>
{
/// <summary>
/// 统一收单交易撤销接口
/// </summary>
public string BizContent { get; set; }
#region IAopRequest Members
private bool needEncrypt;
private string apiVersion = "1.0";
private string terminalType;
private string terminalInfo;
private string prodCode;
private string notifyUrl;
private string returnUrl;
private AopObject bizModel;
public void SetNeedEncrypt(bool needEncrypt)
{
this.needEncrypt = needEncrypt;
}
public bool GetNeedEncrypt()
{
return needEncrypt;
}
public void SetNotifyUrl(string notifyUrl)
{
this.notifyUrl = notifyUrl;
}
public string GetNotifyUrl()
{
return notifyUrl;
}
public void SetReturnUrl(string returnUrl)
{
this.returnUrl = returnUrl;
}
public string GetReturnUrl()
{
return returnUrl;
}
public void SetTerminalType(string terminalType)
{
this.terminalType = terminalType;
}
public string GetTerminalType()
{
return terminalType;
}
public void SetTerminalInfo(string terminalInfo)
{
this.terminalInfo = terminalInfo;
}
public string GetTerminalInfo()
{
return terminalInfo;
}
public void SetProdCode(string prodCode)
{
this.prodCode = prodCode;
}
public string GetProdCode()
{
return prodCode;
}
public string GetApiName()
{
return "alipay.trade.cancel";
}
public void SetApiVersion(string apiVersion)
{
this.apiVersion = apiVersion;
}
public string GetApiVersion()
{
return apiVersion;
}
public IDictionary<string, string> GetParameters()
{
var parameters = new AopDictionary();
parameters.Add("biz_content", BizContent);
return parameters;
}
public AopObject GetBizModel()
{
return bizModel;
}
public void SetBizModel(AopObject bizModel)
{
this.bizModel = bizModel;
}
#endregion
}
}
|
{
"pile_set_name": "Github"
}
|
package com.github.agourlay.cornichon.http
import cats.Show
import cats.syntax.show._
import com.github.agourlay.cornichon.json.CornichonJson.parseDslJsonUnsafe
import io.circe.{ Encoder, Json }
import sangria.ast.Document
import sangria.renderer.QueryRenderer
case class QueryGQL(
url: String,
query: Document,
operationName: Option[String],
variables: Option[Map[String, Json]],
params: Seq[(String, String)],
headers: Seq[(String, String)]) {
def withParams(params: (String, String)*) = copy(params = params)
def addParams(params: (String, String)*) = copy(params = this.params ++ params)
def withHeaders(headers: (String, String)*) = copy(headers = headers)
def addHeaders(headers: (String, String)*) = copy(headers = this.headers ++ headers)
def withQuery(query: Document) = copy(query = query)
def withOperationName(operationName: String) = copy(operationName = Some(operationName))
def withVariables(newVariables: (String, VarValue)*) = {
val vars: Map[String, Json] = newVariables.map { case (k, v) => k -> parseDslJsonUnsafe(v.value)(v.encoder, v.show) }.toMap
copy(variables = variables.fold(Some(vars))(v => Some(v ++ vars)))
}
lazy val querySource = query.source.getOrElse(QueryRenderer.render(query, QueryRenderer.Pretty))
lazy val payload: String = {
import io.circe.generic.auto._
import io.circe.syntax._
GqlPayload(querySource, operationName, variables).asJson.show
}
private case class GqlPayload(query: String, operationName: Option[String], variables: Option[Map[String, Json]])
}
trait VarValue {
type Value
def value: Value
def encoder: Encoder[Value]
def show: Show[Value]
}
object VarValue {
implicit def fromEncoderShow[A: Encoder: Show](a: A): VarValue = new VarValue {
type Value = A
def value = a
def encoder = Encoder[A]
def show = Show[A]
}
}
object QueryGQL {
val emptyDocument = Document(Vector.empty)
}
|
{
"pile_set_name": "Github"
}
|
import json
import time
import MySQLdb
from tweepy import OAuthHandler
from tweepy import Stream
from tweepy.streaming import StreamListener
# replace mysql.server with "localhost" if you are running via your own server!
# server MySQL username MySQL pass Database name.
conn = MySQLdb.connect("mysql.server", "beginneraccount", "cookies", "beginneraccount$tutorial")
c = conn.cursor()
# consumer key, consumer secret, access token, access secret.
ckey = "asdfsafsafsaf"
csecret = "asdfasdfsadfsa"
atoken = "asdfsadfsafsaf-asdfsaf"
asecret = "asdfsadfsadfsadfsadfsad"
class listener(StreamListener):
def on_data(self, data):
all_data = json.loads(data)
tweet = all_data["text"]
username = all_data["user"]["screen_name"]
c.execute("INSERT INTO taula (time, username, tweet) VALUES (%s,%s,%s)",
(time.time(), username, tweet))
conn.commit()
print((username, tweet))
return True
def on_error(self, status):
print(status)
auth = OAuthHandler(ckey, csecret)
auth.set_access_token(atoken, asecret)
twitterStream = Stream(auth, listener())
twitterStream.filter(track=["car"])
|
{
"pile_set_name": "Github"
}
|
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that: (1) source code
* distributions retain the above copyright notice and this paragraph
* in its entirety, and (2) distributions including binary code include
* the above copyright notice and this paragraph in its entirety in
* the documentation or other materials provided with the distribution.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND
* WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
* LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE.
*
* Original code by Hannes Gredler ([email protected])
*/
extern const struct tok oui_values[];
extern const struct tok smi_values[];
#define OUI_ENCAP_ETHER 0x000000 /* encapsulated Ethernet */
#define OUI_CISCO 0x00000c /* Cisco protocols */
#define OUI_IANA 0x00005E /* IANA */
#define OUI_NORTEL 0x000081 /* Nortel SONMP */
#define OUI_CISCO_90 0x0000f8 /* Cisco bridging */
#define OUI_RFC2684 0x0080c2 /* RFC 2427/2684 bridged Ethernet */
#define OUI_ATM_FORUM 0x00A03E /* ATM Forum */
#define OUI_CABLE_BPDU 0x00E02F /* DOCSIS spanning tree BPDU */
#define OUI_APPLETALK 0x080007 /* Appletalk */
#define OUI_JUNIPER 0x009069 /* Juniper */
#define OUI_HP 0x080009 /* Hewlett-Packard */
#define OUI_IEEE_8021_PRIVATE 0x0080c2 /* IEEE 802.1 Organisation Specific - Annex F */
#define OUI_IEEE_8023_PRIVATE 0x00120f /* IEEE 802.3 Organisation Specific - Annex G */
#define OUI_TIA 0x0012bb /* TIA - Telecommunications Industry Association - ANSI/TIA-1057- 2006 */
#define OUI_DCBX 0x001B21 /* DCBX */
#define OUI_NICIRA 0x002320 /* Nicira Networks */
#define OUI_BSN 0x5c16c7 /* Big Switch Networks */
#define OUI_VELLO 0xb0d2f5 /* Vello Systems */
#define OUI_HP2 0x002481 /* HP too */
#define OUI_HPLABS 0x0004ea /* HP-Labs */
#define OUI_INFOBLOX 0x748771 /* Infoblox Inc */
#define OUI_ONLAB 0xa42305 /* Open Networking Lab */
#define OUI_FREESCALE 0x00049f /* Freescale */
#define OUI_NETRONOME 0x0015ad /* Netronome */
/*
* These are SMI Network Management Private Enterprise Codes for
* organizations; see
*
* https://www.iana.org/assignments/enterprise-numbers
*
* for a list.
*
* List taken from Ethereal's epan/sminmpec.h.
*/
#define SMI_IETF 0 /* reserved - used by the IETF in L2TP? */
#define SMI_ACC 5
#define SMI_CISCO 9
#define SMI_HEWLETT_PACKARD 11
#define SMI_SUN_MICROSYSTEMS 42
#define SMI_MERIT 61
#define SMI_AT_AND_T 74
#define SMI_MOTOROLA 161
#define SMI_SHIVA 166
#define SMI_ERICSSON 193
#define SMI_CISCO_VPN5000 255
#define SMI_LIVINGSTON 307
#define SMI_MICROSOFT 311
#define SMI_3COM 429
#define SMI_ASCEND 529
#define SMI_BAY 1584
#define SMI_FOUNDRY 1991
#define SMI_VERSANET 2180
#define SMI_REDBACK 2352
#define SMI_JUNIPER 2636
#define SMI_APTIS 2637
#define SMI_DT_AG 2937
#define SMI_IXIA 3054
#define SMI_CISCO_VPN3000 3076
#define SMI_COSINE 3085
#define SMI_SHASTA 3199
#define SMI_NETSCREEN 3224
#define SMI_NOMADIX 3309
#define SMI_T_MOBILE 3414
#define SMI_BROADBAND_FORUM 3561
#define SMI_ZTE 3902
#define SMI_SIEMENS 4329
#define SMI_CABLELABS 4491
#define SMI_UNISPHERE 4874
#define SMI_CISCO_BBSM 5263
#define SMI_THE3GPP2 5535
#define SMI_SKT_TELECOM 5806
#define SMI_IP_UNPLUGGED 5925
#define SMI_ISSANNI 5948
#define SMI_NETSCALER 5951
#define SMI_DE_TE_MOBIL 6490
#define SMI_QUINTUM 6618
#define SMI_INTERLINK 6728
#define SMI_CNCTC 7951
#define SMI_STARENT_NETWORKS 8164
#define SMI_COLUBRIS 8744
#define SMI_THE3GPP 10415
#define SMI_GEMTEK_SYSTEMS 10529
#define SMI_BARRACUDA 10704
#define SMI_ERICSSON_PKT_CORE 10923
#define SMI_DACOM 11665
#define SMI_COLUMBIA_UNIVERSITY 11862
#define SMI_FORTINET 12356
#define SMI_VERIZON 12951
#define SMI_PLIXER 13745
#define SMI_WIFI_ALLIANCE 14122
#define SMI_T_SYSTEMS_NOVA 16787
#define SMI_CHINATELECOM_GUANZHOU 20942
#define SMI_GIGAMON 26866
#define SMI_CACE 32622
/* Greater than 32,767 need to be tagged unsigned. */
#define SMI_NTOP 35632u
#define SMI_ERICSSON_CANADA_INC 46098u
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright (c) 2002-2008 LWJGL Project
* 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 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.lwjgl.opengles;
public interface EXT_texture_rg {
/**
* Accepted by the <internalformat> parameter of TexImage2D and CopyTexImage2D,
* and the <format> parameter of TexImage2D, TexSubImage2D, and ReadPixels:
*/
int GL_RED_EXT = 0x1903,
GL_RG_EXT = 0x8227;
/**
* Accepted by the <internalformat> parameter of RenderbufferStorage and
* RenderbufferStorageMultisampleAPPLE:
*/
int GL_R8_EXT = 0x8229,
GL_RG8_EXT = 0x822B;
}
|
{
"pile_set_name": "Github"
}
|
<?xml version='1.0' encoding='UTF-8'?>
<resources>
<string name="widgetLoadingText">Caricamento…</string>
<string name="widgetConfigureDoneText">Fine</string>
</resources>
|
{
"pile_set_name": "Github"
}
|
"""
path.py
"""
__author__ = "[email protected]"
import numpy as np
from itertools import product
import sys
import networkx as nx
G = nx.Graph(np.loadtxt(sys.argv[1], dtype=int))
n_edges = len(G.edges())
num = 1e5
good = set()
i = 0
while len(good) < num:
i += 1
matrix = np.full([len(G.nodes())]*2, -1, dtype=int)
for u, v, d in G.edges(data=True):
d['weight'] = np.random.random()
all_shortest = nx.all_pairs_dijkstra_path(G)
for s, d in product(G.nodes(), G.nodes()):
if s != d:
matrix[s][d] = all_shortest[s][d][1]
candidate = ','.join(map(str, matrix.ravel()))
l = len(good)
good.add(candidate)
if len(good) == l:
print('dup!')
continue
print(len(good), i)
with open('path_'+ str(sys.argv[1]) +'.csv', 'a') as file:
file.write(candidate + '\n')
|
{
"pile_set_name": "Github"
}
|
package yaml
const (
// The size of the input raw buffer.
input_raw_buffer_size = 512
// The size of the input buffer.
// It should be possible to decode the whole raw buffer.
input_buffer_size = input_raw_buffer_size * 3
// The size of the output buffer.
output_buffer_size = 128
// The size of the output raw buffer.
// It should be possible to encode the whole output buffer.
output_raw_buffer_size = (output_buffer_size*2 + 2)
// The size of other stacks and queues.
initial_stack_size = 16
initial_queue_size = 16
initial_string_size = 16
)
// Check if the character at the specified position is an alphabetical
// character, a digit, '_', or '-'.
func is_alpha(b []byte, i int) bool {
return b[i] >= '0' && b[i] <= '9' || b[i] >= 'A' && b[i] <= 'Z' || b[i] >= 'a' && b[i] <= 'z' || b[i] == '_' || b[i] == '-'
}
// Check if the character at the specified position is a digit.
func is_digit(b []byte, i int) bool {
return b[i] >= '0' && b[i] <= '9'
}
// Get the value of a digit.
func as_digit(b []byte, i int) int {
return int(b[i]) - '0'
}
// Check if the character at the specified position is a hex-digit.
func is_hex(b []byte, i int) bool {
return b[i] >= '0' && b[i] <= '9' || b[i] >= 'A' && b[i] <= 'F' || b[i] >= 'a' && b[i] <= 'f'
}
// Get the value of a hex-digit.
func as_hex(b []byte, i int) int {
bi := b[i]
if bi >= 'A' && bi <= 'F' {
return int(bi) - 'A' + 10
}
if bi >= 'a' && bi <= 'f' {
return int(bi) - 'a' + 10
}
return int(bi) - '0'
}
// Check if the character is ASCII.
func is_ascii(b []byte, i int) bool {
return b[i] <= 0x7F
}
// Check if the character at the start of the buffer can be printed unescaped.
func is_printable(b []byte, i int) bool {
return ((b[i] == 0x0A) || // . == #x0A
(b[i] >= 0x20 && b[i] <= 0x7E) || // #x20 <= . <= #x7E
(b[i] == 0xC2 && b[i+1] >= 0xA0) || // #0xA0 <= . <= #xD7FF
(b[i] > 0xC2 && b[i] < 0xED) ||
(b[i] == 0xED && b[i+1] < 0xA0) ||
(b[i] == 0xEE) ||
(b[i] == 0xEF && // #xE000 <= . <= #xFFFD
!(b[i+1] == 0xBB && b[i+2] == 0xBF) && // && . != #xFEFF
!(b[i+1] == 0xBF && (b[i+2] == 0xBE || b[i+2] == 0xBF))))
}
// Check if the character at the specified position is NUL.
func is_z(b []byte, i int) bool {
return b[i] == 0x00
}
// Check if the beginning of the buffer is a BOM.
func is_bom(b []byte, i int) bool {
return b[0] == 0xEF && b[1] == 0xBB && b[2] == 0xBF
}
// Check if the character at the specified position is space.
func is_space(b []byte, i int) bool {
return b[i] == ' '
}
// Check if the character at the specified position is tab.
func is_tab(b []byte, i int) bool {
return b[i] == '\t'
}
// Check if the character at the specified position is blank (space or tab).
func is_blank(b []byte, i int) bool {
//return is_space(b, i) || is_tab(b, i)
return b[i] == ' ' || b[i] == '\t'
}
// Check if the character at the specified position is a line break.
func is_break(b []byte, i int) bool {
return (b[i] == '\r' || // CR (#xD)
b[i] == '\n' || // LF (#xA)
b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85)
b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028)
b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9) // PS (#x2029)
}
func is_crlf(b []byte, i int) bool {
return b[i] == '\r' && b[i+1] == '\n'
}
// Check if the character is a line break or NUL.
func is_breakz(b []byte, i int) bool {
//return is_break(b, i) || is_z(b, i)
return ( // is_break:
b[i] == '\r' || // CR (#xD)
b[i] == '\n' || // LF (#xA)
b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85)
b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028)
b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029)
// is_z:
b[i] == 0)
}
// Check if the character is a line break, space, or NUL.
func is_spacez(b []byte, i int) bool {
//return is_space(b, i) || is_breakz(b, i)
return ( // is_space:
b[i] == ' ' ||
// is_breakz:
b[i] == '\r' || // CR (#xD)
b[i] == '\n' || // LF (#xA)
b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85)
b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028)
b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029)
b[i] == 0)
}
// Check if the character is a line break, space, tab, or NUL.
func is_blankz(b []byte, i int) bool {
//return is_blank(b, i) || is_breakz(b, i)
return ( // is_blank:
b[i] == ' ' || b[i] == '\t' ||
// is_breakz:
b[i] == '\r' || // CR (#xD)
b[i] == '\n' || // LF (#xA)
b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85)
b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028)
b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029)
b[i] == 0)
}
// Determine the width of the character.
func width(b byte) int {
// Don't replace these by a switch without first
// confirming that it is being inlined.
if b&0x80 == 0x00 {
return 1
}
if b&0xE0 == 0xC0 {
return 2
}
if b&0xF0 == 0xE0 {
return 3
}
if b&0xF8 == 0xF0 {
return 4
}
return 0
}
|
{
"pile_set_name": "Github"
}
|
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"undertaker-tests.ts"
]
}
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright (C) 2011-2019 Project SkyFire <http://www.projectskyfire.org/>
* Copyright (C) 2008-2019 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2019 MaNGOS <https://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _SPELLSCALING_H
#define _SPELLSCALING_H
#include "SharedDefines.h"
#include "DBCStores.h"
class SpellInfo;
class SpellScaling
{
bool _canScale;
int32 _castTime;
public:
float avg[3];
float min[3];
float max[3];
float pts[3];
bool CanUseScale() { return _canScale; }
int32 GetCastTime() { return _castTime; }
float GetGtSpellScalingValue(int8 classId, uint8 level)
{
classId = classId < 0 ? MAX_CLASSES : classId;
float _coef = -1.0f;
if (classId)
{
GtSpellScalingEntry const* spellscaling = sGtSpellScalingStore.LookupEntry(((classId - 1) * 100) + (level - 1));
_coef = spellscaling ? spellscaling->coef : _coef;
}
return _coef;
}
SpellScaling(SpellInfo const* spellInfo, uint8 level)
{
_canScale = false;
_castTime = 0;
for (uint8 i = 0; i < 3; i++)
{
avg[i] = 0.0f;
min[i] = 0.0f;
max[i] = 0.0f;
pts[i] = 0.0f;
}
if (!spellInfo || !spellInfo->SpellScalingId)
return;
if (!spellInfo->playerClass)
return;
float CoefBase = spellInfo->CoefBase;
uint8 CoefBaseLevel = spellInfo->CoefLevelBase;
int32 castTimeMin = spellInfo->castTimeMin;
int32 castTimeMax = spellInfo->castTimeMax;
uint8 castScalingMaxLevel = spellInfo->castScalingMaxLevel;
float gtCoef = GetGtSpellScalingValue(spellInfo->playerClass, level);
if (gtCoef == -1.0f)
return;
gtCoef *= (std::min(level, CoefBaseLevel) + (CoefBase * std::max(0, level - CoefBaseLevel))) / level;
// Cast time
if (castTimeMax > 0 && level > 1)
_castTime = castTimeMin + (((level - 1) * (castTimeMax - castTimeMin)) / (castScalingMaxLevel - 1));
else
_castTime = castTimeMin;
_castTime = _castTime > castTimeMax ? castTimeMax : _castTime;
// Effects
for (uint8 effIndex = 0; effIndex < 3; effIndex++)
{
float mult = spellInfo->Multiplier[effIndex];
float randommult = spellInfo->RandomMultiplier[effIndex];
float othermult = spellInfo->OtherMultiplier[effIndex];
avg[effIndex] = mult * gtCoef;
if (castTimeMax > 0)
avg[effIndex] *= float(_castTime)/float(castTimeMax);
min[effIndex] = roundf(avg[effIndex]) - std::floor(avg[effIndex] * randommult / 2);
max[effIndex] = roundf(avg[effIndex]) + std::floor(avg[effIndex] * randommult / 2);
pts[effIndex] = roundf(othermult * gtCoef);
avg[effIndex] = std::max((float)ceil(mult), roundf(avg[effIndex]));
}
_canScale = true;
}
};
#endif // _SPELLSCALING_H
|
{
"pile_set_name": "Github"
}
|
// named.rfc1912.zones:
//
// Provided by Red Hat caching-nameserver package
//
// ISC BIND named zone configuration for zones recommended by
// RFC 1912 section 4.1 : localhost TLDs and address zones
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
zone "localdomain" IN {
type master;
file "localdomain.zone";
allow-update { none; };
};
zone "localhost" IN {
type master;
file "localhost.zone";
allow-update { none; };
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
allow-update { none; };
};
zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
type master;
file "named.ip6.local";
allow-update { none; };
};
zone "255.in-addr.arpa" IN {
type master;
file "named.broadcast";
allow-update { none; };
};
zone "0.in-addr.arpa" IN {
type master;
file "named.zero";
allow-update { none; };
};
|
{
"pile_set_name": "Github"
}
|
{
"name": "bacon",
"version": "3.0.15",
"main": "dist/Bacon.js",
"ignore": [
".*",
"*.md",
"*.coffee",
"*.png",
"browsertest/",
"examples/",
"lib/",
"nuspec/",
"performance/",
"readme/",
"spec/",
"src/",
"build",
"component.json",
"package.json",
"release",
"test",
"runtests",
"testem.json",
"update-cdnjs",
"version",
"assemble*.js",
"test-individually.js"
]
}
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright 2015, Michael Neuling, IBM Corp.
* Licensed under GPLv2.
*
* Edited: Rashmica Gupta, Nov 2015
*
* This test does a fork syscall inside a transaction. Basic sniff test
* to see if we can enter the kernel during a transaction.
*/
#include <errno.h>
#include <inttypes.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "utils.h"
#include "tm.h"
int test_fork(void)
{
SKIP_IF(!have_htm());
asm __volatile__(
"tbegin.;"
"blt 1f; "
"li 0, 2;" /* fork syscall */
"sc ;"
"tend.;"
"1: ;"
: : : "memory", "r0");
/* If we reach here, we've passed. Otherwise we've probably crashed
* the kernel */
return 0;
}
int main(int argc, char *argv[])
{
return test_harness(test_fork, "tm_fork");
}
|
{
"pile_set_name": "Github"
}
|
common:
sources:
macros:
- SOFT_RESET=VECTRESET
board:
- source/board/dipdap_cc3220sf.c
target:
- source/target/ti/cc3220sf/target.c
- source/target/ti/target_reset.c
- source/target/ti/cc3220sf/validation_cc3220sf.c
|
{
"pile_set_name": "Github"
}
|
# translation of de.po to Deutsch
# german translation of steghide 0.5.1 messages
# Copyright (C) 2002,2003 Stefan Hetzl
# Stefan Hetzl <[email protected]>, 2002,2003.
#
msgid ""
msgstr ""
"Project-Id-Version: de\n"
"POT-Creation-Date: 2003-10-15 10:02+0200\n"
"PO-Revision-Date: 2003-09-29 14:09+0200\n"
"Last-Translator: Stefan Hetzl <[email protected]>\n"
"Language-Team: Deutsch\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: KBabel 1.0.1\n"
#: src/Arguments.cc:84
#, c-format
msgid "unknown argument \"%s\"."
msgstr "unbekanntes Argument \"%s\"."
#: src/Arguments.cc:90
msgid "standard input cannot be used for cover data AND data to be embedded."
msgstr ""
"Die Standardeingabe kann nicht für Trägerdaten UND Klartextdaten verwendet "
"werden."
#: src/Arguments.cc:103 src/Arguments.cc:109
msgid ""
"if standard input is used, the passphrase must be specified on the command "
"line."
msgstr ""
"Wenn die Standardeingabe verwendet wird, muss das Passwort in der "
"Kommandozeile angegeben werden."
#: src/Arguments.cc:138
#, c-format
msgid "you have to suppy a filename to the \"%s\" command."
msgstr "Das Kommando \"%s\" benötigt einen Dateinamen."
#: src/Arguments.cc:159 src/Arguments.cc:166 src/Arguments.cc:173
#: src/Arguments.cc:180
#, c-format
msgid "you cannot use arguments with the \"%s\" command."
msgstr "Mit dem Kommando \"%s\" können keine Argumente verwendet werden."
#: src/Arguments.cc:195
#, c-format
msgid "unknown command \"%s\"."
msgstr "unbekanntes Kommando \"%s\"."
#: src/Arguments.cc:205 src/Arguments.cc:236 src/Arguments.cc:267
#: src/Arguments.cc:351 src/Arguments.cc:396 src/Arguments.cc:440
#: src/Arguments.cc:542 src/Arguments.cc:570
#, c-format
msgid "the argument \"%s\" can only be used with the \"%s\" command."
msgstr "Das Argument \"%s\" kann nur mit dem Kommando \"%s\" verwendet werden."
#: src/Arguments.cc:209 src/Arguments.cc:240 src/Arguments.cc:302
#, c-format
msgid "the \"%s\" argument can be used only once."
msgstr "Das Argument \"%s\" kann nur einmal verwendet werden."
#: src/Arguments.cc:213
#, c-format
msgid "the \"%s\" argument must be followed by the embed file name."
msgstr ""
"Nach dem Argument \"%s\" muss sich der Name der einzubettenden Datei "
"befinden."
#: src/Arguments.cc:244
#, c-format
msgid "the \"%s\" argument must be followed by the extract file name."
msgstr ""
"Nach dem Argument \"%s\" muss sich ein Dateiname für die extrahierten Daten "
"befinden."
#: src/Arguments.cc:271
msgid "the cover file name argument can be used only once."
msgstr "Das Trägerdatei-Argument kann nur einmal verwendet werden."
#: src/Arguments.cc:275
#, c-format
msgid "the \"%s\" argument must be followed by the cover file name."
msgstr "Nach dem Argument \"%s\" muss sich der Name der Trägerdatei befinden."
#: src/Arguments.cc:298 src/Arguments.cc:601 src/Arguments.cc:625
#: src/Arguments.cc:639
#, c-format
msgid ""
"the argument \"%s\" can only be used with the \"%s\" and \"%s\" commands."
msgstr ""
"Das Argument \"%s\" kann nur mit den Kommandos \"%s\" und \"%s\" verwendet "
"werden."
#: src/Arguments.cc:306
#, c-format
msgid "the \"%s\" argument must be followed by the stego file name."
msgstr "Nach dem Argument \"%s\" muss sich der Name der Stegodatei befinden."
#: src/Arguments.cc:329
msgid "the passphrase argument can be used only once."
msgstr "Das Argument \"Passwort\" kann nur einmal verwendet werden."
#: src/Arguments.cc:333
#, c-format
msgid "the \"%s\" argument must be followed by the passphrase."
msgstr "Nach dem Argument \"%s\" muss sich ein Passwort befinden."
#: src/Arguments.cc:355
msgid "the checksum argument can be used only once."
msgstr "Das Prüfsumme-Argument kann nur einmal verwendet werden."
#: src/Arguments.cc:373 src/Arguments.cc:418
#, c-format
msgid "the argument \"%s\" can only be used with the \"embed\" command."
msgstr ""
"Das Argument \"%s\" kann nur mit dem \"embed\"-Kommando verwendet werden."
#: src/Arguments.cc:377 src/Arguments.cc:400
msgid "the compression argument can be used only once."
msgstr "Das Kompression-Argument kann nur einmal verwendet werden."
#: src/Arguments.cc:381
#, c-format
msgid "the \"%s\" argument must be followed by the compression level."
msgstr "Nach dem Argument \"%s\" muss sich eine Kompressionsstufe befinden."
#: src/Arguments.cc:387
#, c-format
msgid "\"%s\" is not a valid compression level."
msgstr "\"%s\" is keine gültige Kompressionsstufe."
#: src/Arguments.cc:422
msgid "the file name embedding argument can be used only once."
msgstr ""
"Das Argument zur Einbettung des Dateinamens kann nur einmal verwendet werden."
#: src/Arguments.cc:444
msgid "the encryption argument can be used only once."
msgstr "Das Verschlüsselung-Argument kann nur einmal verwendet werden."
#: src/Arguments.cc:448 src/Arguments.cc:453
#, c-format
msgid "the \"%s\" argument must be followed by encryption parameters."
msgstr ""
"Nach dem Argument \"%s\" müssen sich Verschlüsselungsparameter befinden."
#: src/Arguments.cc:485 src/Arguments.cc:494
#, c-format
msgid "\"%s\" is neither an algorithm nor a mode supported by libmcrypt."
msgstr ""
"\"%s\" ist weder ein Algorithmus noch ein Modus der von libmcrypt "
"unterstützt wird."
#: src/Arguments.cc:499
#, c-format
msgid ""
"\"%s\" and \"%s\" are both libmcrypt algorithms. please specify only one."
msgstr ""
"Sowohl \"%s\" als auch \"%s\" sind libmcrypt-Algorithmen. Bitte nur einen "
"angeben."
#: src/Arguments.cc:502
#, c-format
msgid "\"%s\" and \"%s\" are both libmcrypt modes. please specify only one."
msgstr ""
"Sowohl \"%s\" als auch \"%s\" sind libmcrypt-Modi. Bitte nur einen angeben."
#: src/Arguments.cc:519
#, c-format
msgid "the encryption algorithm \"%s\" can not be used with the mode \"%s\"."
msgstr ""
"Der Verschlüsselungsalgorithmus \"%s\" kann nicht mit dem Modus \"%s\" "
"verwendet werden."
#: src/Arguments.cc:525
msgid "steghide has been compiled without support for encryption."
msgstr "Steghide wurde ohne Unterstützung für Verschlüsselung kompiliert."
#: src/Arguments.cc:546
msgid "the radius argument can be used only once."
msgstr "Das Argument \"Radius\" kann nur einmal verwendet werden."
#: src/Arguments.cc:550
#, c-format
msgid "the \"%s\" argument must be followed by the neighbourhood radius."
msgstr "Nach dem Argument \"%s\" muss sich der Nachbarschaftsradius befinden."
#: src/Arguments.cc:574
msgid "the goal argument can be used only once."
msgstr "Das Ziel-Argument kann nur einmal verwendet werden."
#: src/Arguments.cc:578 src/Arguments.cc:584
#, c-format
msgid "the \"%s\" argument must be followed by a number between 0 and 100."
msgstr "Nach dem Argument \"%s\" muss sich eine Zahl von 0 bis 100 befinden."
#: src/Arguments.cc:605
msgid "the force argument can be used only once."
msgstr "Das Überschreiben-Argument kann nur einmal verwendet werden."
#: src/Arguments.cc:629 src/Arguments.cc:643 src/Arguments.cc:701
#, c-format
msgid ""
"the \"%s\" argument cannot be used here because the verbosity has already "
"been set."
msgstr ""
"Das Argument \"%s\" kann hier nicht verwendet werden, da die Genauigkeit der "
"Ausgabe bereits festgelegt wurde."
#: src/Arguments.cc:659 src/Arguments.cc:669 src/Arguments.cc:679
#: src/Arguments.cc:697
msgid "you cannot use more than one debug command at a time."
msgstr "Sie können nicht mehr als ein debug-Kommando auf einmal verwenden."
#: src/Arguments.cc:711
msgid "the debug level argument can be used only once."
msgstr "Das debug level-Argument kann nur einmal verwendet werden."
#: src/Arguments.cc:715
#, c-format
msgid "the \"%s\" argument must be followed by the debug level."
msgstr "Nach dem Argument \"%s\" muss sich der debug level befinden."
#: src/Arguments.cc:741
msgid "unknown terminal. the passphrase you type now will be visible."
msgstr ""
"Unbekanntes Terminal. Das Passwort das Sie jetzt eingeben wird sichtbar sein."
#: src/Arguments.cc:745
msgid "Enter passphrase: "
msgstr "Passwort eingeben: "
#: src/Arguments.cc:758
msgid "Re-Enter passphrase: "
msgstr "Passwort wiederholen: "
#: src/Arguments.cc:770
msgid "the passphrases do not match."
msgstr "Die Passworte stimmen nicht überein."
#: src/AssertionFailed.cc:28
msgid ""
"This means that you have found a bug. Please let me ([email protected])\n"
"know this if you have a way to reproduce the error.\n"
"Steghide has to exit now. Sorry.\n"
msgstr ""
"Das bedeutet dass Sie einen Fehler gefunden haben. Wenn Sie diesen Fehler\n"
"reproduzieren können, lassen Sie es mich ([email protected]) bitte wissen.\n"
"Steghide wird jetzt beendet.\n"
#: src/AssertionFailed.h:30
#, c-format
msgid "assertion failed in %s at line number %d."
msgstr "Zusicherung fehlgeschlagen in %s in Zeile %d."
#: src/AuFile.cc:94
#, c-format
msgid "the au file on standard input uses the unkown encoding %d."
msgstr ""
"Die au-Datei von der Standardeingabe verwendet die unbekannte Kodierung %d."
#: src/AuFile.cc:97
#, c-format
msgid "the au file \"%s\" uses the unknown encoding %d."
msgstr "Die au-Datei \"%s\" verwendet die unbekannte Kodierung %d."
#: src/AuFile.cc:107
#, c-format
msgid "an error occured while reading the au headers from the file \"%s\"."
msgstr ""
"Beim Lesen der au-Header aus der Datei \"%s\" ist ein Fehler aufgetreten."
#: src/AuFile.cc:113
#, c-format
msgid "premature end of file \"%s\" while reading au headers."
msgstr "Die au-Header aus der Datei \"%s\" sind unvollständig."
#: src/AuFile.cc:119
msgid "an error occured while reading the au headers from standard input."
msgstr ""
"Beim Lesen der au-Header von der Standardeingabe ist ein Fehler aufgetreten."
#: src/AuFile.cc:125
msgid "premature end of data from standard input while reading au headers."
msgstr "Die au-Header von der Standardeingabe sind unvollständig."
#: src/AuFile.cc:165
#, c-format
msgid "an error occured while writing the au headers to the file \"%s\"."
msgstr ""
"Beim Schreiben der au-Header in die Datei \"%s\" ist ein Fehler aufgetreten."
#: src/AuFile.cc:171
msgid "an error occured while writing the au headers to standard output."
msgstr ""
"Beim Schreiben der au-Header auf die Standardausgabe ist ein Fehler "
"aufgetreten."
#: src/AuFile.cc:188
msgid ", mu-law encoding"
msgstr ", mu-law-Kodierung"
#: src/AuFile.cc:193
msgid ", PCM encoding"
msgstr ", PCM-Kodierung"
#: src/AuFile.cc:196 src/BmpFile.cc:87 src/JpegFile.cc:61 src/WavFile.cc:81
msgid "format"
msgstr "Format"
#: src/AudioData.h:94 src/WavFile.cc:249
#, c-format
msgid "an error occured while reading the audio data from the file \"%s\"."
msgstr ""
"Beim Lesen der Audiodaten aus der Datei \"%s\" ist ein Fehler aufgetreten."
#: src/AudioData.h:100 src/WavFile.cc:253
#, c-format
msgid "premature end of file \"%s\" while reading audio data."
msgstr "Die Audiodaten aus der Datei \"%s\" sind unvollständig."
#: src/AudioData.h:106 src/WavFile.cc:257
msgid "an error occured while reading the audio data from standard input."
msgstr ""
"Beim Lesen der Audiodaten von der Standardeingabe ist ein Fehler aufgetreten."
#: src/AudioData.h:112 src/WavFile.cc:261
msgid "premature end of data from standard input while reading audio data."
msgstr "Die Audiodaten von der Standardeingabe sind unvollständig."
#: src/AudioData.h:134 src/WavFile.cc:302
#, c-format
msgid "an error occured while writing the audio data to the file \"%s\"."
msgstr ""
"Beim Schreiben der Audiodaten in die Datei \"%s\" ist ein Fehler aufgetreten."
#: src/AudioData.h:140 src/WavFile.cc:306
msgid "an error occured while writing the audio data to standard output."
msgstr ""
"Beim Schreiben der Audiodaten auf die Standardausgabe ist ein Fehler "
"aufgetreten."
#: src/BinaryIO.cc:67
#, c-format
msgid "the file \"%s\" does already exist. overwrite ?"
msgstr "Die Datei \"%s\" existiert bereits. Überschreiben ?"
#: src/BinaryIO.cc:70
#, c-format
msgid "did not write to file \"%s\"."
msgstr "Datei \"%s\" wurde nicht geschrieben."
#: src/BinaryIO.cc:113
#, c-format
msgid "could not open the file \"%s\"."
msgstr "Die Datei \"%s\" konnte nicht geöffnet werden."
#: src/BinaryIO.cc:137
#, c-format
msgid "could not close the file \"%s\"."
msgstr "Die Datei \"%s\" konnte nicht geschlossen werden."
#: src/BitString.cc:299 src/BitString.cc:347 src/MCryptPP.cc:322
#: src/MHashKeyGen.cc:115
msgid "could not allocate memory."
msgstr "Es konnte nicht genügend Speicher alloziiert werden."
#: src/BitString.cc:303
#, c-format
msgid "error %d while calling zlib's compress2."
msgstr ""
"Während dem Aufruf von compress2 aus zlib ist der Fehler %d aufgetreten."
#: src/BitString.cc:351
msgid "can not uncompress data. compressed data is corrupted."
msgstr ""
"Die Daten können nicht dekomprimiert werden, da die komprimierten Daten "
"fehlerhaft sind."
#: src/BitString.cc:355
#, c-format
msgid "error %d while calling zlib's uncompress."
msgstr ""
"Während dem Aufruf von uncompress aus zlib ist der Fehler %d aufgetreten."
#: src/BmpFile.cc:80
msgid "Windows 3.x bitmap"
msgstr "Windows 3.x bitmap"
#: src/BmpFile.cc:84
msgid "OS/2 1.x bitmap"
msgstr "OS/2 1.x bitmap"
#: src/BmpFile.cc:428
#, c-format
msgid ""
"the bmp data from standard input has a format that is not supported (biSize: "
"%lu)."
msgstr ""
"Die bmp-Daten von der Standardeingabe haben ein Format das nicht unterstützt "
"wird (biSize: %lu)."
#: src/BmpFile.cc:431
#, c-format
msgid "the bmp file \"%s\" has a format that is not supported (biSize: %lu)."
msgstr ""
"Die bmp-Datei \"%s\" hat ein Format das nicht unterstützt wird (biSize: %lu)."
#: src/BmpFile.cc:439
#, c-format
msgid "an error occured while reading the bmp headers from the file \"%s\"."
msgstr ""
"Beim Lesen der bmp-Header aus der Datei \"%s\" ist ein Fehler aufgetreten."
#: src/BmpFile.cc:443
#, c-format
msgid "premature end of file \"%s\" while reading bmp headers."
msgstr "Die bmp-Header aus der Datei \"%s\" sind unvollständig."
#: src/BmpFile.cc:447
msgid "an error occured while reading the bmp headers from standard input."
msgstr ""
"Beim Lesen der bmp-Header von der Standardeingabe ist ein Fehler aufgetreten."
#: src/BmpFile.cc:451
msgid "premature end of data from standard input while reading bmp headers."
msgstr "Die bmp-Header von der Standardeingabe sind unvollständig."
#: src/BmpFile.cc:492
#, c-format
msgid ""
"the bmp data from standard input has a format that is not supported "
"(biBitCount: %d)."
msgstr ""
"Die bmp-Daten von der Standardeingabe haben ein Format das nicht unterstützt "
"wird (biBitCount: %d)."
#: src/BmpFile.cc:495
#, c-format
msgid ""
"the bmp file \"%s\" has a format that is not supported (biBitCount: %d)."
msgstr ""
"Die bmp-Datei \"%s\" hat ein Format, das nicht unterstützt wird (biBitCount: "
"%d)."
#: src/BmpFile.cc:502
msgid ""
"the bitmap data from standard input is compressed which is not supported."
msgstr ""
"Die Bilddaten von der Standardeingabe sind komprimiert, was nicht "
"unterstützt wird."
#: src/BmpFile.cc:505
#, c-format
msgid "the bitmap data in \"%s\" is compressed which is not supported."
msgstr "Die Bilddaten in \"%s\" sind komprimiert, was nicht unterstützt wird."
#: src/BmpFile.cc:521 src/BmpFile.cc:610
msgid "using a black/white bitmap as cover is very insecure!"
msgstr ""
"eine schwarz/weiß bmp-Datei als Trägerdatei zu verwenden ist sehr unsicher!"
#: src/BmpFile.cc:529 src/BmpFile.cc:618
msgid "using a 16-color bitmap as cover is very insecure!"
msgstr ""
"eine bmp-Datei mit 16 Farben als Trägerdatei zu verwenden ist sehr unsicher!"
#: src/BmpFile.cc:552
msgid "maybe corrupted windows bmp data (Reserved in RGBQUAD is non-zero)."
msgstr ""
"möglicherweise beschädigte Windows-bmp Daten (Reserved in RGBQUAD ist nicht "
"null)."
#: src/BmpFile.cc:595
#, c-format
msgid ""
"the bmp data from standard input has a format that is not supported "
"(bcBitCount: %d)."
msgstr ""
"Die bmp-Daten von der Standardeingabe haben ein Format das nicht unterstützt "
"wird (bcBitCount: %d)."
#: src/BmpFile.cc:598
#, c-format
msgid ""
"the bmp file \"%s\" has a format that is not supported (bcBitCount: %d)."
msgstr ""
"Die bmp-Datei \"%s\" hat ein Format das nicht unterstützt wird (bcBitCount: %"
"d)."
#: src/BmpFile.cc:669
#, c-format
msgid "an error occured while writing the bmp headers to the file \"%s\"."
msgstr ""
"Beim Schreiben der bmp-Header in die Datei \"%s\" ist ein Fehler aufgetreten."
#: src/BmpFile.cc:673
msgid "an error occured while writing the bmp headers to standard output."
msgstr ""
"Beim Schreiben der bmp-Header auf die Standardausgabe ist ein Fehler "
"aufgetreten."
#: src/BmpFile.cc:776
#, c-format
msgid "maybe corrupted bmp data (padding byte at 0x%lx set to non-zero)."
msgstr ""
"möglicherweise beschädigte bmp Daten (Paddingbyte an Position 0x%lx ist "
"nicht Null)."
#: src/BmpFile.cc:790
#, c-format
msgid "an error occured while reading the bmp data from the file \"%s\"."
msgstr ""
"Beim Lesen der Bilddaten aus der Datei \"%s\" ist ein Fehler aufgetreten."
#: src/BmpFile.cc:794
#, c-format
msgid "premature end of file \"%s\" while reading bmp data."
msgstr "Die Bilddaten aus der Datei \"%s\" sind unvollständig."
#: src/BmpFile.cc:798
msgid "an error occured while reading the bmp data from standard input."
msgstr ""
"Beim Lesen der Bilddaten von der Standardeingabe ist ein Fehler aufgetreten."
#: src/BmpFile.cc:802
msgid "premature end of bmp data from standard input."
msgstr "Die bmp-Daten von der Standardeingabe sind unvollständig."
#: src/BmpFile.cc:840
#, c-format
msgid "an error occured while writing the bitmap data to the file \"%s\"."
msgstr ""
"Beim Schreiben der Bilddaten in die Datei \"%s\" ist ein Fehler aufgetreten."
#: src/BmpFile.cc:844
msgid "an error occured while writing the bitmap data to standard output."
msgstr ""
"Beim Schreiben der Bilddaten auf die Standardausgabe ist ein Fehler "
"aufgetreten."
#: src/CvrStgFile.cc:212
msgid ""
"can not read input file. steghide has been compiled without support for jpeg "
"files."
msgstr ""
"Eingabedatei konnte nicht gelesen werden. Steghide wurd ohne Unterstützung "
"für jpeg-Dateien kompiliert."
#: src/EmbData.cc:91
msgid "could not extract any data with that passphrase!"
msgstr "Mit diesem Passwort konnten keine Daten extrahiert werden!"
#: src/EmbData.cc:107
#, c-format
msgid ""
"attempting to read an embedding of version %d but steghide %s only supports "
"embeddings of version %d."
msgstr ""
"versuche Einbettung der version %d zu lesen, aber steghide %s unterstützt "
"nur Einbettungen der version %d."
#: src/EmbData.cc:137
msgid ""
"The embedded data is encrypted but steghide has been compiled without "
"encryption\n"
"support. To be able to read the embedded data, you have to install "
"libmcrypt\n"
"(http://mcrypt.sourceforge.net/) and recompile steghide."
msgstr ""
"Die eingebetteten Daten sind verschlüsselt aber steghide wurde ohne\n"
"Unterstützung für Verschlüsselung kompiliert. Um die eingebetteten Daten zu\n"
"lesen müssen Sie libmcrypt (http://mcrypt.sourceforge.net/) installieren "
"und\n"
"steghide erneut kompilieren."
#: src/EmbData.cc:226
msgid "the embedded data has an invalid length."
msgstr "Die eingebetteten Daten haben eine ungültige Länge."
#: src/Embedder.cc:48
msgid "reading secret data from standard input..."
msgstr "Lese geheime Daten von der Standardeingabe..."
#: src/Embedder.cc:51
#, c-format
msgid "reading secret file \"%s\"..."
msgstr "Lese geheime Datei \"%s\"..."
#: src/Embedder.cc:63 src/Extractor.cc:46 src/ProgressOutput.cc:71
#: src/Session.cc:88
msgid " done"
msgstr " fertig"
#: src/Embedder.cc:84
msgid "reading cover file from standard input..."
msgstr "Lese Trägerdatei von der Standardeingabe..."
#: src/Embedder.cc:87
#, c-format
msgid "reading cover file \"%s\"..."
msgstr "Lese Trägerdatei \"%s\"..."
#: src/Embedder.cc:98
msgid "the cover file is too short to embed the data."
msgstr "Die Trägerdatei ist zu kurz, um die Daten einzubetten."
#: src/Embedder.cc:104
msgid "creating the graph..."
msgstr "Erzeuge den Graphen..."
#: src/Embedder.cc:148 src/Embedder.cc:154
msgid "standard input"
msgstr "Standardeingabe"
#: src/Embedder.cc:160
#, c-format
msgid "embedding %s in %s..."
msgstr "Bette %s in %s ein..."
#: src/Embedder.cc:189
msgid "writing stego file to standard output... "
msgstr "Schreibe Stegodatei auf die Standardausgabe... "
#: src/Embedder.cc:194
#, c-format
msgid "writing stego file \"%s\"... "
msgstr "Schreibe Stegodatei \"%s\"... "
#: src/Embedder.cc:204
msgid "done"
msgstr "fertig"
#: src/Embedder.cc:217
#, c-format
msgid "executing %s..."
msgstr "Führe %s aus..."
#: src/Extractor.cc:36
msgid "reading stego file from standard input..."
msgstr "Lese Stegodatei von der Standardeingabe..."
#: src/Extractor.cc:39
#, c-format
msgid "reading stego file \"%s\"..."
msgstr "Lese Stegodatei \"%s\"..."
#: src/Extractor.cc:52
msgid "extracting data..."
msgstr "Extrahiere Daten..."
#: src/Extractor.cc:62
msgid ""
"the stego data from standard input is too short to contain the embedded data."
msgstr ""
"Die Stegodaten von der Standardeingabe sind zu kurz, um die Klartextdaten zu "
"enthalten."
#: src/Extractor.cc:65
#, c-format
msgid "the stego file \"%s\" is too short to contain the embedded data."
msgstr "Die Stegodatei \"%s\" ist zu kurz, um die Klartextdaten zu enthalten."
#: src/Extractor.cc:82
msgid "checking crc32 checksum..."
msgstr "CRC32 Prüfsummentest..."
#: src/Extractor.cc:86
msgid " ok"
msgstr " ok"
#: src/Extractor.cc:90
msgid " FAILED!"
msgstr " FEHLGESCHLAGEN!"
#: src/Extractor.cc:93
msgid "crc32 checksum failed! extracted data is probably corrupted."
msgstr ""
"CRC32 Prüfsummentest fehlgeschlagen! Die extrahierten Daten sind "
"wahrscheinlich fehlerhaft."
#: src/Graph.cc:253
#, c-format
msgid " %lu sample values, %lu vertices, %lu edges"
msgstr " %lu Samplewerte, %lu Knoten, %lu Kanten"
#: src/JpegFile.cc:73
msgid "can not use standard input as source for jpeg files with libjpeg."
msgstr ""
"Die Standardeingabe kann nicht zum Lesen von jpeg-Dateien mit libjpeg "
"verwendet werden."
#: src/MCryptPP.cc:64 src/MCryptPP.cc:249
#, c-format
msgid "could not open libmcrypt module \"%s\",\"%s\"."
msgstr "Das libmcrypt Modul \"%s\",\"%s\" konnte nicht geöffnet werden."
#: src/MCryptPP.cc:119
msgid ""
"could not initialize libmcrypt encryption. see above error messages if any."
msgstr ""
"Die Verschlüsselung aus libmcrypt konnte nicht initialisiert werden. Siehe "
"obige Meldungen (falls vorhanden)."
#: src/MCryptPP.cc:132
msgid "could not encrypt data."
msgstr "Die Daten konnten nicht verschlüsselt werden."
#: src/MCryptPP.cc:154
msgid "could not finish libmcrypt encryption."
msgstr "Die libmcrypt-Verschlüsselung konnte nicht beendet werden."
#: src/MCryptPP.cc:185
msgid ""
"could not initialize libmcrypt decryption. see above error messages if any."
msgstr ""
"Die Entschlüsselung aus libmcrypt konnte nicht initialisiert werden. Siehe "
"obige Meldungen (falls vorhanden)."
#: src/MCryptPP.cc:198
msgid "could not decrypt data."
msgstr "Die Daten konnten nicht entschlüsselt werden."
#: src/MCryptPP.cc:209
msgid "could not finish libmcrypt decryption."
msgstr "Die libmcrypt-Entschlüsselung konnte nicht beendet werden."
#: src/MHashKeyGen.cc:61
msgid "could not generate key using libmhash."
msgstr "Schlüssel konnte unter Verwendung von libmhash nicht erzeugt werden."
#: src/MHashPP.cc:45
#, c-format
msgid "could not initialize libmhash %s algorithm."
msgstr "Der Algorithmus %s aus libmhash konnte nicht initialisiert werden."
#: src/ProgressOutput.cc:79
msgid " done\n"
msgstr " fertig\n"
#: src/RandomSource.cc:38
msgid ""
"could not open /dev/urandom, using standard library random numbers instead."
msgstr ""
"/dev/urandom konnte nicht geöffnet werden, stattdessen werden die "
"Zufallszahlen der Standardbibliothek verwendet."
#: src/RandomSource.cc:53
msgid "could not close random input file."
msgstr "Die Datei zum Lesen von Zufallsdaten konnte nicht geschlossen werden."
#: src/Session.cc:64
msgid ""
"please specify a file name for the extracted data (there is no name embedded "
"in the stego file)."
msgstr ""
"Bitte geben Sie einen Dateinamen für die extrahierten Daten an (es ist "
"keiner in der Stegodatei eingebettet)."
#: src/Session.cc:71
msgid "writing extracted data to standard output..."
msgstr "Schreibe extrahierte Daten auf die Standardausgabe..."
#: src/Session.cc:75
#, c-format
msgid "writing extracted data to \"%s\"..."
msgstr "Schreibe extrahierte Daten nach \"%s\"..."
#: src/Session.cc:94
#, c-format
msgid "wrote extracted data to \"%s\"."
msgstr "Extrahierte Daten wurden nach \"%s\" geschrieben."
#: src/Session.cc:138
msgid "data from standard input:\n"
msgstr "Daten von der Standardeingabe:\n"
#: src/Session.cc:145
msgid "capacity"
msgstr "Kapazität"
#: src/Session.cc:152
msgid "Try to get information about embedded data ?"
msgstr "Soll versucht werden, Information über eingebettete Daten anzuzeigen ?"
#: src/Session.cc:171
msgid " embedded data:\n"
msgstr " eingebettete Daten:\n"
#: src/Session.cc:174
#, c-format
msgid " embedded file \"%s\":\n"
msgstr " Eingebettete Datei \"%s\":\n"
#: src/Session.cc:177
#, c-format
msgid " size: %s\n"
msgstr " Größe: %s\n"
#: src/Session.cc:180 src/Session.cc:186
msgid "no"
msgstr "nein"
#: src/Session.cc:185
#, c-format
msgid " encrypted: %s\n"
msgstr " verschlüsselt: %s\n"
#: src/Session.cc:186
#, c-format
msgid " compressed: %s\n"
msgstr " komprimiert: %s\n"
#: src/Session.cc:186
msgid "yes"
msgstr "ja"
#: src/Session.cc:191
msgid "could not extract any data with that passphrase!\n"
msgstr "Mit diesem Passwort konnten keine Daten extrahiert werden!\n"
#: src/Session.cc:214
msgid ""
"encryption algorithms:\n"
"<algorithm>: <supported modes>...\n"
msgstr ""
"Verschlüsselungsalgorithmen:\n"
"<Algorithmus>: <unterstützte Modi>...\n"
#: src/Session.cc:231
msgid ""
"steghide has been compiled without support for encryption.\n"
"If you want to encrypt your data before embedding it, use an external "
"encryption\n"
"program or install libmcrypt (http://mcrypt.sourceforge.net/) and recompile "
"steghide.\n"
msgstr ""
"Steghide wurde ohne Unterstützung für Verschlüsselung kompiliert.\n"
"Wenn Sie die Daten vor dem Einbetten verschlüsseln wollen, verwenden Sie "
"ein\n"
"externes Verschlüsselungsprogramm oder installieren Sie libmcrypt\n"
"(http://mcrypt.sourceforge.net/) und kompilieren Sie steghide erneut.\n"
#: src/Session.cc:245
msgid ""
"\n"
"the first argument must be one of the following:\n"
" embed, --embed embed data\n"
" extract, --extract extract data\n"
" info, --info display information about a cover- or stego-file\n"
" info <filename> display information about <filename>\n"
" encinfo, --encinfo display a list of supported encryption algorithms\n"
" version, --version display version information\n"
" license, --license display steghide's license\n"
" help, --help display this usage information\n"
"\n"
"embedding options:\n"
" -ef, --embedfile select file to be embedded\n"
" -ef <filename> embed the file <filename>\n"
" -cf, --coverfile select cover-file\n"
" -cf <filename> embed into the file <filename>\n"
" -p, --passphrase specify passphrase\n"
" -p <passphrase> use <passphrase> to embed data\n"
" -sf, --stegofile select stego file\n"
" -sf <filename> write result to <filename> instead of cover-file\n"
" -e, --encryption select encryption parameters\n"
" -e <a>[<m>]|<m>[<a>] specify an encryption algorithm and/or mode\n"
" -e none do not encrypt data before embedding\n"
" -z, --compress compress data before embedding (default)\n"
" -z <l> using level <l> (1 best speed...9 best "
"compression)\n"
" -Z, --dontcompress do not compress data before embedding\n"
" -K, --nochecksum do not embed crc32 checksum of embedded data\n"
" -N, --dontembedname do not embed the name of the original file\n"
" -f, --force overwrite existing files\n"
" -q, --quiet suppress information messages\n"
" -v, --verbose display detailed information\n"
"\n"
"extracting options:\n"
" -sf, --stegofile select stego file\n"
" -sf <filename> extract data from <filename>\n"
" -p, --passphrase specify passphrase\n"
" -p <passphrase> use <passphrase> to extract data\n"
" -xf, --extractfile select file name for extracted data\n"
" -xf <filename> write the extracted data to <filename>\n"
" -f, --force overwrite existing files\n"
" -q, --quiet suppress information messages\n"
" -v, --verbose display detailed information\n"
"\n"
"options for the info command:\n"
" -p, --passphrase specify passphrase\n"
" -p <passphrase> use <passphrase> to get info about embedded data\n"
"\n"
"To embed emb.txt in cvr.jpg: steghide embed -cf cvr.jpg -ef emb.txt\n"
"To extract embedded data from stg.jpg: steghide extract -sf stg.jpg\n"
msgstr ""
"\n"
"Das erste Argument muss eines der folgenden sein:\n"
" embed, --embed Daten einbetten\n"
" extract, --extract Daten extrahieren\n"
" info, --info Information über Cover- oder Stegodatei anzeigen\n"
" info <dateiname> Information über <dateiname> anzeigen\n"
" encinfo, --encinfo Liste verfügbarer Verschlüsselungsalgorithmen "
"anzeigen\n"
" version, --version Versionsnummer anzeigen\n"
" license, --license Lizenz von steghide anzeigen\n"
" help, --help diese Gebrauchsanweisung anzeigen\n"
"\n"
"Optionen zur Einbettung:\n"
" -ef, --embedfile Datei die eingebettet werden soll auswählen\n"
" -ef <dateiname> die Datei <dateiname> einbetten\n"
" -cf, -coverfile Trägerdatei auswählen\n"
" -cf <dateiname> in die Datei <dateiname> einbetten\n"
" -p, --passphrase Passwort angeben\n"
" -p <zeichenfolge> <zeichenfolge> als Passwort verwenden\n"
" -sf, --stegofile Stegodatei auswählen\n"
" -sf <dateiname> Ergebnis in <dateiname> statt in Trägerdatei "
"schreiben\n"
" -e, --encryption Verschlüsselungsparamter auswählen\n"
" -e <a>[<m>]|<m>[<a>] Verschlüsselungsalgorithmus und/oder -modus "
"auswählen\n"
" -e none Daten vor Einbettung nicht verschlüsseln\n"
" -z, --compress Daten vor Einbettung komprimieren (Standard)\n"
" -z <l> verwende Stufe <l> (1 schnell...9 gute "
"Kompression)\n"
" -Z, --dontcompress Daten vor Einbettung nicht komprimieren\n"
" -K, --nochecksum Keine CRC32 Prüfsumme der eingebetteten Daten "
"einbetten\n"
" -N, --dontembedname den Namen der eingebetten Datei nicht einbetten\n"
" -f, --force Existierende Dateien überschreiben\n"
" -q, --quiet Unkritische Nachrichten nicht anzeigen\n"
" -v, --verbose Detaillierte Informationen anzeigen\n"
"\n"
"Optionen zur Extraktion:\n"
"-sf, --stegofile Stegodatei auswählen\n"
" -sf <name> <name> als Stegodatei verwenden\n"
" -p, --passphrase Passwort angeben\n"
" -p <zeichenfolge> <zeichenfolge> als Passwort verwenden\n"
" -xf, --extractfile Dateinamen für extrahierte Daten auswählen\n"
" -xf <dateiname> extrahierte Daten nach <dateiname> schreiben\n"
" -f, --force Existierende Dateien überschreiben\n"
" -q, --quiet Unkritische Nachrichten nicht anzeigen\n"
" -v, --verbose Detaillierte Informationen anzeigen\n"
"\n"
"Optionen für das info-Kommando:\n"
"-p, --passphrase Passwort angeben\n"
" -p <zeichenfolge> <zeichenfolge> als Passwort verwenden\n"
"\n"
"Um emb.txt in cvr.jpg einzubetten: steghide embed -cf cvr.jpg -ef emb.txt\n"
"Um eingebettete Daten aus stg.jpg zu extrahieren: steghide extract -sf stg."
"jpg\n"
#: src/SteghideError.cc:27
msgid "error, exiting. (no error message defined)."
msgstr "Fehler, Programmende. (keine Fehlermeldung definiert)."
#: src/Terminal.cc:31 src/Terminal.cc:39 src/Terminal.cc:53
msgid "could not get terminal attributes."
msgstr "Die Attribute des Terminals konnten nicht gelesen werden."
#: src/Terminal.cc:45 src/Terminal.cc:61 src/Terminal.cc:68
msgid "could not set terminal attributes."
msgstr "Die Attribute des Terminals konnten nicht gesetzt werden."
#: src/WavFile.cc:346
#, c-format
msgid "an error occured while reading the wav headers from the file \"%s\"."
msgstr ""
"Beim Lesen der wav-Header aus der Datei \"%s\" ist ein Fehler aufgetreten."
#: src/WavFile.cc:352
#, c-format
msgid "premature end of file \"%s\" while reading wav headers."
msgstr "Die wav-Header aus der Datei \"%s\" sind unvollständig."
#: src/WavFile.cc:358
msgid "an error occured while reading the wav headers from standard input."
msgstr ""
"Beim Lesen der wav-Header von der Standardeingabe ist ein Fehler aufgetreten."
#: src/WavFile.cc:364
msgid "premature end of data from standard input while reading wav headers."
msgstr "Die wav-Header von der Standardeingabe sind unvollständig."
#: src/WavFile.cc:394
#, c-format
msgid "an error occured while writing the wav headers to the file \"%s\"."
msgstr ""
"Beim Schreiben der wav-Header in die Datei \"%s\" ist ein Fehler aufgetreten."
#: src/WavFile.cc:400
msgid "an error occured while writing the wav headers to standard output."
msgstr ""
"Beim Schreiben der wav-Header auf die Standardausgabe ist ein Fehler "
"aufgetreten."
#: src/WavFormatChunk.cc:31
#, c-format
msgid ""
"the wav file from standard input has a format that is not supported "
"(FormatTag: 0x%X)."
msgstr ""
"Die wav-Datei von der Standardeingabe hat ein Format, das nicht unterstützt "
"wird (FormatTag: 0x%X)."
#: src/WavFormatChunk.cc:34
#, c-format
msgid ""
"the wav file \"%s\" has a format that is not supported (FormatTag: 0x%X)."
msgstr ""
"Die wav-Datei \"%s\" hat ein Format, das nicht unterstützt wird (FormatTag: "
"0x%X)."
#: src/WavFormatChunk.cc:49
msgid ""
"the wav file from standard input does not have pcm format (header too long)."
msgstr ""
"Die wav-Datei von der Standardeingabe hat nicht das PCM-Format (header ist "
"zu lang)."
#: src/WavFormatChunk.cc:52
#, c-format
msgid "the wav file \"%s\" does not have pcm format (header too long)."
msgstr "Die wav-Datei \"%s\" hat nicht das PCM-Format (header ist zu lang)."
#: src/WavFormatChunk.cc:57
msgid "the wav file from standard input is corrupted."
msgstr "Die wav-Datei von der Standardeingabe ist ungültig."
#: src/WavFormatChunk.cc:60
#, c-format
msgid "the wav file \"%s\" is corrupted."
msgstr "Die wav-Datei \"%s\" ist ungültig."
#: src/error.cc:45
msgid "type \"steghide --help\" for help."
msgstr "Geben Sie \"steghide --help\" ein, um Hilfe zu erhalten."
#: src/error.cc:56
msgid "premature end of data from standard input."
msgstr "Die Daten von der Standardeingabe sind unvollständig."
#: src/error.cc:60
#, c-format
msgid "premature end of file \"%s\"."
msgstr "Die Datei \"%s\" ist unvollständig."
#: src/error.cc:66
msgid "an error occured while reading data from standard input."
msgstr "Beim Lesen von der Standardeingabe ist ein Fehler aufgetreten."
#: src/error.cc:70
#, c-format
msgid "an error occured while reading data from the file \"%s\"."
msgstr "Beim Lesen aus der Datei \"%s\" ist ein Fehler aufgetreten."
#: src/error.cc:93
msgid "an error occured while writing data to standard output."
msgstr "Beim Schreiben auf die Standardausgabe ist ein Fehler aufgetreten."
#: src/error.cc:97
#, c-format
msgid "an error occured while writing data to the file \"%s\"."
msgstr "Beim Schreiben in die Datei \"%s\" ist ein Fehler aufgetreten."
#: src/error.cc:119
msgid "the file format of the data from standard input is not supported."
msgstr ""
"Das Dateiformat der Daten von der Standardeingabe wird nicht unterstützt."
#: src/error.cc:122
#, c-format
msgid "the file format of the file \"%s\" is not supported."
msgstr "Das Dateiformat der Datei \"%s\" wird nicht unterstützt."
#: src/error.cc:141
msgid ""
"This feature is not (yet) available. Please let me ([email protected]) know\n"
"that you want to use this functionality to increase the chance that this "
"will\n"
"be implemented in the near future. Steghide has to exit now. Sorry.\n"
msgstr ""
"Diese Funktion ist (noch) nicht vorhanden. Bitte lassen Sie es mich "
"([email protected])\n"
"wissen, dass sie diese Funktion verwenden wollten, um die Chancen zu "
"erhöhen, dass sie\n"
"bald programmiert wird. Steghide wird jetzt beendet\n"
#: src/error.cc:161
msgid ""
"Other possible reasons for this error are that the passphrase is wrong\n"
"or that there is no embedded data.\n"
msgstr ""
"Andere mögliche Gründe für diesen Fehler sind dass das Passwort falsch ist\n"
"oder dass keine Daten eingebettet sind.\n"
#: src/msg.cc:35
msgid "__no_message_defined__"
msgstr "__keine_Meldung_definiert__"
#: src/msg.cc:135 src/msg.cc:153
msgid "warning:"
msgstr "Warnung:"
# the [y]es character (see also the [n]o character)
#: src/msg.cc:162 src/msg.cc:169 src/msg.cc:176
msgid "y"
msgstr "j"
# the [n]o character (see also the [y]es character)
#: src/msg.cc:163 src/msg.cc:170 src/msg.cc:177
msgid "n"
msgstr "n"
#: src/msg.cc:188
msgid "unknown terminal. you might need to press <Enter> after answering."
msgstr ""
"Unbekanntes Terminal. Vielleicht müssen Sie zur Bestätigung der Antwort auf "
"<Enter> drücken."
#~ msgid "the file \"%s\" does already exist."
#~ msgstr "Die Datei \"%s\" existiert bereits."
|
{
"pile_set_name": "Github"
}
|
// Import bootstrap variables including default color palette and fonts
@import "bootstrap/less/variables.less";
// Import datepicker component
@import "_bootstrap-datetimepicker.less";
//this is here so the compiler doesn't complain about a missing bootstrap mixin
.sr-only {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0,0,0,0);
border: 0;
}
|
{
"pile_set_name": "Github"
}
|
config.unsupported = not config.have_dia_sdk
|
{
"pile_set_name": "Github"
}
|
#region LICENSE
// The contents of this file are subject to the Common Public Attribution
// License Version 1.0. (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// https://github.com/NiclasOlofsson/MiNET/blob/master/LICENSE.
// The License is based on the Mozilla Public License Version 1.1, but Sections 14
// and 15 have been added to cover use of software over a computer network and
// provide for limited attribution for the Original Developer. In addition, Exhibit A has
// been modified to be consistent with Exhibit B.
//
// Software distributed under the License is distributed on an "AS IS" basis,
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
// the specific language governing rights and limitations under the License.
//
// The Original Code is MiNET.
//
// The Original Developer is the Initial Developer. The Initial Developer of
// the Original Code is Niclas Olofsson.
//
// All portions of the code written by Niclas Olofsson are Copyright (c) 2014-2020 Niclas Olofsson.
// All Rights Reserved.
#endregion
using System;
using log4net;
namespace MiNET.Net.RakNet
{
public class MessagePart : Packet<MessagePart> // Replace this with stream
{
private static readonly ILog Log = LogManager.GetLogger(typeof(MessagePart));
public Memory<byte> Buffer { get; set; }
public byte ContainedMessageId { get; set; }
public MessagePart()
{
}
public override void Reset()
{
base.Reset();
ReliabilityHeader.Reset();
ContainedMessageId = 0;
Buffer = null;
}
protected override void EncodePacket()
{
// DO NOT CALL base.EncodePackage();
Memory<byte> encodedMessage = Buffer;
if(encodedMessage.Length == 0) Log.Error("Bad size 0 in message part");
//if(ReliabilityHeader.Reliability != Reliability.ReliableOrdered) Log.Warn($"Sending message with reliability={ReliabilityHeader.Reliability}");
byte flags = (byte) (((byte) ReliabilityHeader.Reliability) << 5);
Write((byte) (flags | (ReliabilityHeader.HasSplit ? 0b00010000 : 0x00)));
Write((short) (encodedMessage.Length * 8), true); // bit length
switch (ReliabilityHeader.Reliability)
{
case Reliability.Reliable:
case Reliability.ReliableOrdered:
case Reliability.ReliableSequenced:
case Reliability.ReliableWithAckReceipt:
case Reliability.ReliableOrderedWithAckReceipt:
Write(ReliabilityHeader.ReliableMessageNumber);
break;
}
//switch (ReliabilityHeader.Reliability)
//{
// case Reliability.UnreliableSequenced:
// case Reliability.ReliableSequenced:
// ReliabilityHeader.SequencingIndex = WriteLittle();
// break;
//}
switch (ReliabilityHeader.Reliability)
{
case Reliability.UnreliableSequenced:
case Reliability.ReliableOrdered:
case Reliability.ReliableSequenced:
case Reliability.ReliableOrderedWithAckReceipt:
Write(ReliabilityHeader.OrderingIndex);
Write(ReliabilityHeader.OrderingChannel);
break;
}
if (ReliabilityHeader.HasSplit)
{
Write(ReliabilityHeader.PartCount, true);
Write(ReliabilityHeader.PartId, true);
Write(ReliabilityHeader.PartIndex, true);
}
// Message body
Write(encodedMessage);
}
}
}
|
{
"pile_set_name": "Github"
}
|
#ifndef _UAPI_ASM_TERMIOS_H
#define _UAPI_ASM_TERMIOS_H
#include <asm/termbits.h>
#include <asm/ioctls.h>
struct winsize {
unsigned short ws_row;
unsigned short ws_col;
unsigned short ws_xpixel;
unsigned short ws_ypixel;
};
#define NCC 8
struct termio {
unsigned short c_iflag; /* input mode flags */
unsigned short c_oflag; /* output mode flags */
unsigned short c_cflag; /* control mode flags */
unsigned short c_lflag; /* local mode flags */
unsigned char c_line; /* line discipline */
unsigned char c_cc[NCC]; /* control characters */
};
/* modem lines */
#define TIOCM_LE 0x001
#define TIOCM_DTR 0x002
#define TIOCM_RTS 0x004
#define TIOCM_ST 0x008
#define TIOCM_SR 0x010
#define TIOCM_CTS 0x020
#define TIOCM_CAR 0x040
#define TIOCM_RNG 0x080
#define TIOCM_DSR 0x100
#define TIOCM_CD TIOCM_CAR
#define TIOCM_RI TIOCM_RNG
#define TIOCM_OUT1 0x2000
#define TIOCM_OUT2 0x4000
#define TIOCM_LOOP 0x8000
#define TIOCM_MODEM_BITS TIOCM_OUT2 /* IRDA support */
/*
* Translate a "termio" structure into a "termios". Ugh.
*/
#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
unsigned short __tmp; \
get_user(__tmp, &(termio)->x); \
*(unsigned short *) &(termios)->x = __tmp; \
}
#define user_termio_to_kernel_termios(termios, termio) \
({ \
SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
})
/*
* Translate a "termios" structure into a "termio". Ugh.
*/
#define kernel_termios_to_user_termio(termio, termios) \
({ \
put_user((termios)->c_iflag, &(termio)->c_iflag); \
put_user((termios)->c_oflag, &(termio)->c_oflag); \
put_user((termios)->c_cflag, &(termio)->c_cflag); \
put_user((termios)->c_lflag, &(termio)->c_lflag); \
put_user((termios)->c_line, &(termio)->c_line); \
copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
})
#define user_termios_to_kernel_termios(k, u) \
copy_from_user(k, u, sizeof(struct termios2))
#define kernel_termios_to_user_termios(u, k) \
copy_to_user(u, k, sizeof(struct termios2))
#define user_termios_to_kernel_termios_1(k, u) \
copy_from_user(k, u, sizeof(struct termios))
#define kernel_termios_to_user_termios_1(u, k) \
copy_to_user(u, k, sizeof(struct termios))
#endif /* _UAPI_ASM_TERMIOS_H */
|
{
"pile_set_name": "Github"
}
|
//
// test-UriParser.c
// snowcrash
//
// Created by Carl Griffiths on 24/02/14.
// Copyright (c) 2014 Apiary Inc. All rights reserved.
//
#include "catch.hpp"
#include "UriTemplateParser.h"
using namespace snowcrash;
TEST_CASE("Parse a valid uri into separate parts", "[validuriparser][issue][79]")
{
const snowcrash::URI uri = "http://www.test.com/other/{id}";
URITemplateParser parser;
ParsedURITemplate result;
mdp::CharactersRangeSet sourceBlock;
parser.parse(uri, sourceBlock, result);
REQUIRE(result.scheme == "http");
REQUIRE(result.host == "www.test.com");
REQUIRE(result.path == "/other/{id}");
REQUIRE(result.report.warnings.size() == 0);
}
TEST_CASE("Parse an invalid uri into separate parts", "[invaliduriparser][issue][79]")
{
const snowcrash::URI uri = "http://www.test.com/other/{id}[2]";
URITemplateParser parser;
ParsedURITemplate result;
mdp::CharactersRangeSet sourceBlock;
parser.parse(uri, sourceBlock, result);
REQUIRE(result.scheme == "http");
REQUIRE(result.host == "www.test.com");
REQUIRE(result.path == "/other/{id}[2]");
REQUIRE(result.report.warnings.size() == 1);
}
TEST_CASE("Parse uri template for invalid format curly brackets (nested brackets)",
"[invalidcurlybracketparsingnested][issue][78]")
{
const snowcrash::URI uri = "http://www.test.com/{id{}}";
URITemplateParser parser;
ParsedURITemplate result;
mdp::CharactersRangeSet sourceBlock;
parser.parse(uri, sourceBlock, result);
REQUIRE(result.report.warnings.size() == 1);
}
TEST_CASE("Parse uri template for invalid format curly brackets (missing end bracket)",
"[invalidcurlybracketparsingmissingendbracket][issue][78]")
{
const snowcrash::URI uri = "http://www.test.com/{id";
URITemplateParser parser;
ParsedURITemplate result;
mdp::CharactersRangeSet sourceBlock;
parser.parse(uri, sourceBlock, result);
REQUIRE(result.report.warnings.size() == 1);
}
TEST_CASE("Parse uri template for supported level one variable expansion",
"[supportedlevelonevariableexpansionexpression][issue][78]")
{
const snowcrash::URI uri = "http://www.test.com/{id}/{test}";
URITemplateParser parser;
ParsedURITemplate result;
mdp::CharactersRangeSet sourceBlock;
parser.parse(uri, sourceBlock, result);
REQUIRE(result.report.warnings.size() == 0);
}
TEST_CASE("Parse uri template for supported variables with % encoding and explode modifier",
"[supportedpercentencodedvariablesandexplodemodifier][issue][78]")
{
const snowcrash::URI uri = "http://www.test.com/{id}/{?test%20one,test%20two*}";
URITemplateParser parser;
ParsedURITemplate result;
mdp::CharactersRangeSet sourceBlock;
parser.parse(uri, sourceBlock, result);
REQUIRE(result.report.warnings.size() == 0);
}
TEST_CASE("Parse uri template for invalid % encoding", "[invalidpercentencoding][issue][78]")
{
const snowcrash::URI uri = "http://www.test.com/{id}/{?test%20one,test%2Ztwo}";
URITemplateParser parser;
ParsedURITemplate result;
mdp::CharactersRangeSet sourceBlock;
parser.parse(uri, sourceBlock, result);
REQUIRE(result.report.warnings.size() == 1);
}
TEST_CASE("Parse uri template for invalid expansion", "[invalidexpression][issue][78]")
{
const snowcrash::URI uri = "http://www.test.com/{@id}/{|test}";
URITemplateParser parser;
ParsedURITemplate result;
mdp::CharactersRangeSet sourceBlock;
parser.parse(uri, sourceBlock, result);
REQUIRE(result.report.warnings.size() == 2);
}
TEST_CASE("Parse uri template for supported level two fragment expansion",
"[supportedleveltwofragmentexpansionexpression][issue][78]")
{
const snowcrash::URI uri = "http://www.test.com/path{id}{#var}";
URITemplateParser parser;
ParsedURITemplate result;
mdp::CharactersRangeSet sourceBlock;
parser.parse(uri, sourceBlock, result);
REQUIRE(result.report.warnings.size() == 0);
}
TEST_CASE("Parse uri template for supported level three form style query string expansion",
"[supportedlevelthreeformstylequeryexpansionexpression][issue][78]")
{
const snowcrash::URI uri = "http://www.test.com/path{?varone,vartwo}";
URITemplateParser parser;
ParsedURITemplate result;
mdp::CharactersRangeSet sourceBlock;
parser.parse(uri, sourceBlock, result);
REQUIRE(result.report.warnings.size() == 0);
}
TEST_CASE("Parse uri template for supported level three reserved expansion",
"[supportedlevelthreeformstylequeryexpansionexpression][issue][78]")
{
const snowcrash::URI uri = "http://www.test.com/path{+varone}";
URITemplateParser parser;
ParsedURITemplate result;
mdp::CharactersRangeSet sourceBlock;
parser.parse(uri, sourceBlock, result);
REQUIRE(result.report.warnings.size() == 0);
}
TEST_CASE("Parse uri template for unsupported level three label expansion",
"[unsupportedlevelthreelabelexpansionexpression][issue][78]")
{
const snowcrash::URI uri = "http://www.test.com/path{.varone}";
URITemplateParser parser;
ParsedURITemplate result;
mdp::CharactersRangeSet sourceBlock;
parser.parse(uri, sourceBlock, result);
REQUIRE(result.report.warnings.size() == 1);
}
TEST_CASE("Parse uri template for unsupported level three path segment expansion",
"[unsupportedlevelthreepathsegmentexpansionexpression][issue][78]")
{
const snowcrash::URI uri = "http://www.test.com/path{/varone}";
URITemplateParser parser;
ParsedURITemplate result;
mdp::CharactersRangeSet sourceBlock;
parser.parse(uri, sourceBlock, result);
REQUIRE(result.report.warnings.size() == 1);
}
TEST_CASE("Parse uri template for unsupported level three path style parameter expansion",
"[unsupportedlevelthreepathstyleparameterexpression][issue][78]")
{
const snowcrash::URI uri = "http://www.test.com/path{;varone,vartwo}";
URITemplateParser parser;
ParsedURITemplate result;
mdp::CharactersRangeSet sourceBlock;
parser.parse(uri, sourceBlock, result);
REQUIRE(result.report.warnings.size() == 1);
}
TEST_CASE("Parse uri template for supported level three form style query continuation expansion",
"[supportedlevelthreeformstylequerycontinuationexpression][issue][78]")
{
const snowcrash::URI uri = "http://www.test.com/{id}?path=test{&varone,vartwo}";
URITemplateParser parser;
ParsedURITemplate result;
mdp::CharactersRangeSet sourceBlock;
parser.parse(uri, sourceBlock, result);
REQUIRE(result.report.warnings.size() == 0);
}
TEST_CASE(
"Parse uri template for invalid variable name, contains spaces", "[invalidvariablenamecontainingspaces][issue][78]")
{
const snowcrash::URI uri = "http://www.test.com/path{?varone, vartwo}";
URITemplateParser parser;
ParsedURITemplate result;
mdp::CharactersRangeSet sourceBlock;
parser.parse(uri, sourceBlock, result);
REQUIRE(result.report.warnings.size() == 1);
REQUIRE(result.report.warnings[0].message == "URI template expression \"?varone, vartwo\" contains spaces. Allowed characters for expressions are A-Z a-z 0-9 _ and percent encoded characters");
}
TEST_CASE("Parse uri template for invalid variable name, contains hyphens",
"[invalidvariablenamecontainingshyphens][issue][78]")
{
const snowcrash::URI uri = "http://www.test.com/{id}{?var-one,var-two}";
URITemplateParser parser;
ParsedURITemplate result;
mdp::CharactersRangeSet sourceBlock;
parser.parse(uri, sourceBlock, result);
REQUIRE(result.report.warnings.size() == 1);
REQUIRE(result.report.warnings[0].message == "URI template expression \"?var-one,var-two\" contains hyphens. Allowed characters for expressions are A-Z a-z 0-9 _ and percent encoded characters");
}
TEST_CASE("Parse uri template for invalid variable name, contains assignment",
"[invalidvariablenamecontainingsassignment][issue][78]")
{
const snowcrash::URITemplate uri = "http://www.test.com/{id}{?varone=vartwo}";
URITemplateParser parser;
ParsedURITemplate result;
mdp::CharactersRangeSet sourceBlock;
parser.parse(uri, sourceBlock, result);
REQUIRE(result.report.warnings.size() == 1);
REQUIRE(result.report.warnings[0].message == "URI template expression \"?varone=vartwo\" contains assignment. Allowed characters for expressions are A-Z a-z 0-9 _ and percent encoded characters");
}
TEST_CASE("Parse uri template for invalid variable name, invalid % encoded",
"[invalidvariablenamecontainingsbadpctencoding][issue][78]")
{
const snowcrash::URITemplate uri = "http://www.test.com/{id}{?varone%2z}";
URITemplateParser parser;
ParsedURITemplate result;
mdp::CharactersRangeSet sourceBlock;
parser.parse(uri, sourceBlock, result);
REQUIRE(result.report.warnings.size() == 1);
REQUIRE(result.report.warnings[0].message == "URI template expression \"?varone%2z\" contains invalid characters. Allowed characters for expressions are A-Z a-z 0-9 _ and percent encoded characters");
}
TEST_CASE("Parse uri template for variable name containing dot", "[validvariablenamecontainingdot][issue][78]")
{
const snowcrash::URITemplate uri = "http://www.test.com/{id}{?varone.data}";
URITemplateParser parser;
ParsedURITemplate result;
mdp::CharactersRangeSet sourceBlock;
parser.parse(uri, sourceBlock, result);
REQUIRE(result.report.warnings.size() == 0);
}
TEST_CASE("Parse uri template for invalid variable name containing multiple contiguous dots",
"[invalidvariablenamecontiguousdots][issue][78]")
{
const snowcrash::URITemplate uri = "http://www.test.com/{id}{?varone..data}";
URITemplateParser parser;
ParsedURITemplate result;
mdp::CharactersRangeSet sourceBlock;
parser.parse(uri, sourceBlock, result);
REQUIRE(result.report.warnings.size() == 1);
}
TEST_CASE("Parse uri template for consistent invalid character warning",
"[invalidexpressionconsistentinvalidcharacterwarning][issue][78]")
{
const snowcrash::URITemplate urione = "http://www.test.com/{$a,b,c}";
const snowcrash::URITemplate uritwo = "http://www.test.com/{@a,b,c}";
URITemplateParser parser;
ParsedURITemplate result;
ParsedURITemplate result2;
mdp::CharactersRangeSet sourceBlock;
parser.parse(urione, sourceBlock, result);
REQUIRE(result.report.warnings.size() == 1);
REQUIRE(result.report.warnings[0].message == "URI template expression \"$a,b,c\" contains invalid characters. Allowed characters for expressions are A-Z a-z 0-9 _ and percent encoded characters");
parser.parse(urione, sourceBlock, result2);
REQUIRE(result2.report.warnings.size() == 1);
REQUIRE(result2.report.warnings[0].message == "URI template expression \"$a,b,c\" contains invalid characters. Allowed characters for expressions are A-Z a-z 0-9 _ and percent encoded characters");
}
|
{
"pile_set_name": "Github"
}
|
###############################################################################
#
# Copyright 2006 - 2019, Paul Beckingham, Federico Hernandez.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# https://www.opensource.org/licenses/mit-license.php
#
###############################################################################
rule.precedence.color=deleted,completed,active,keyword.,tag.,project.,overdue,scheduled,due.today,due,blocked,blocking,recurring,tagged,uda.
# General decoration
color.label=
color.label.sort=
color.alternate=on gray2
color.header=rgb031
color.footnote=rgb031
color.warning=rgb020
color.error=white on red
color.debug=blue
# Task state
color.completed=
color.deleted=
color.active=rgb050 on rgb010
color.recurring=rgb151
color.scheduled=black on rgb031
color.until=
color.blocked=white on rgb010
color.blocking=white on rgb020
# Project
color.project.none=
# Priority
color.uda.priority.H=rgb050
color.uda.priority.L=rgb010
color.uda.priority.M=rgb030
# Tags
color.tag.next=rgb440
color.tag.none=
color.tagged=color246
# Due
color.due.today=color252
color.due=color249
color.overdue=color255
# Report: burndown
color.burndown.done=on gray4
color.burndown.pending=on rgb010
color.burndown.started=on rgb030
# Report: history
color.history.add=color0 on rgb010
color.history.delete=color0 on rgb050
color.history.done=color0 on rgb030
# Report: summary
color.summary.background=white on gray3
color.summary.bar=white on rgb030
# Command: calendar
color.calendar.due.today=color0 on color225
color.calendar.due=color0 on color249
color.calendar.holiday=rgb151 on rgb020
color.calendar.overdue=color0 on color255
color.calendar.today=color0 on rgb151
color.calendar.weekend=on color235
color.calendar.weeknumber=rgb010
# Command: sync
color.sync.added=gray4
color.sync.changed=rgb030
color.sync.rejected=rgb010
# Command: undo
color.undo.after=rgb053
color.undo.before=rgb021
|
{
"pile_set_name": "Github"
}
|
package session
import (
"fmt"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/endpoints"
"github.com/aws/aws-sdk-go/internal/ini"
)
const (
// Static Credentials group
accessKeyIDKey = `aws_access_key_id` // group required
secretAccessKey = `aws_secret_access_key` // group required
sessionTokenKey = `aws_session_token` // optional
// Assume Role Credentials group
roleArnKey = `role_arn` // group required
sourceProfileKey = `source_profile` // group required (or credential_source)
credentialSourceKey = `credential_source` // group required (or source_profile)
externalIDKey = `external_id` // optional
mfaSerialKey = `mfa_serial` // optional
roleSessionNameKey = `role_session_name` // optional
// CSM options
csmEnabledKey = `csm_enabled`
csmHostKey = `csm_host`
csmPortKey = `csm_port`
csmClientIDKey = `csm_client_id`
// Additional Config fields
regionKey = `region`
// endpoint discovery group
enableEndpointDiscoveryKey = `endpoint_discovery_enabled` // optional
// External Credential Process
credentialProcessKey = `credential_process` // optional
// Web Identity Token File
webIdentityTokenFileKey = `web_identity_token_file` // optional
// Additional config fields for regional or legacy endpoints
stsRegionalEndpointSharedKey = `sts_regional_endpoints`
// Additional config fields for regional or legacy endpoints
s3UsEast1RegionalSharedKey = `s3_us_east_1_regional_endpoint`
// DefaultSharedConfigProfile is the default profile to be used when
// loading configuration from the config files if another profile name
// is not provided.
DefaultSharedConfigProfile = `default`
// S3 ARN Region Usage
s3UseARNRegionKey = "s3_use_arn_region"
)
// sharedConfig represents the configuration fields of the SDK config files.
type sharedConfig struct {
// Credentials values from the config file. Both aws_access_key_id and
// aws_secret_access_key must be provided together in the same file to be
// considered valid. The values will be ignored if not a complete group.
// aws_session_token is an optional field that can be provided if both of
// the other two fields are also provided.
//
// aws_access_key_id
// aws_secret_access_key
// aws_session_token
Creds credentials.Value
CredentialSource string
CredentialProcess string
WebIdentityTokenFile string
RoleARN string
RoleSessionName string
ExternalID string
MFASerial string
SourceProfileName string
SourceProfile *sharedConfig
// Region is the region the SDK should use for looking up AWS service
// endpoints and signing requests.
//
// region
Region string
// EnableEndpointDiscovery can be enabled in the shared config by setting
// endpoint_discovery_enabled to true
//
// endpoint_discovery_enabled = true
EnableEndpointDiscovery *bool
// CSM Options
CSMEnabled *bool
CSMHost string
CSMPort string
CSMClientID string
// Specifies the Regional Endpoint flag for the SDK to resolve the endpoint for a service
//
// sts_regional_endpoints = regional
// This can take value as `LegacySTSEndpoint` or `RegionalSTSEndpoint`
STSRegionalEndpoint endpoints.STSRegionalEndpoint
// Specifies the Regional Endpoint flag for the SDK to resolve the endpoint for a service
//
// s3_us_east_1_regional_endpoint = regional
// This can take value as `LegacyS3UsEast1Endpoint` or `RegionalS3UsEast1Endpoint`
S3UsEast1RegionalEndpoint endpoints.S3UsEast1RegionalEndpoint
// Specifies if the S3 service should allow ARNs to direct the region
// the client's requests are sent to.
//
// s3_use_arn_region=true
S3UseARNRegion bool
}
type sharedConfigFile struct {
Filename string
IniData ini.Sections
}
// loadSharedConfig retrieves the configuration from the list of files using
// the profile provided. The order the files are listed will determine
// precedence. Values in subsequent files will overwrite values defined in
// earlier files.
//
// For example, given two files A and B. Both define credentials. If the order
// of the files are A then B, B's credential values will be used instead of
// A's.
//
// See sharedConfig.setFromFile for information how the config files
// will be loaded.
func loadSharedConfig(profile string, filenames []string, exOpts bool) (sharedConfig, error) {
if len(profile) == 0 {
profile = DefaultSharedConfigProfile
}
files, err := loadSharedConfigIniFiles(filenames)
if err != nil {
return sharedConfig{}, err
}
cfg := sharedConfig{}
profiles := map[string]struct{}{}
if err = cfg.setFromIniFiles(profiles, profile, files, exOpts); err != nil {
return sharedConfig{}, err
}
return cfg, nil
}
func loadSharedConfigIniFiles(filenames []string) ([]sharedConfigFile, error) {
files := make([]sharedConfigFile, 0, len(filenames))
for _, filename := range filenames {
sections, err := ini.OpenFile(filename)
if aerr, ok := err.(awserr.Error); ok && aerr.Code() == ini.ErrCodeUnableToReadFile {
// Skip files which can't be opened and read for whatever reason
continue
} else if err != nil {
return nil, SharedConfigLoadError{Filename: filename, Err: err}
}
files = append(files, sharedConfigFile{
Filename: filename, IniData: sections,
})
}
return files, nil
}
func (cfg *sharedConfig) setFromIniFiles(profiles map[string]struct{}, profile string, files []sharedConfigFile, exOpts bool) error {
// Trim files from the list that don't exist.
var skippedFiles int
var profileNotFoundErr error
for _, f := range files {
if err := cfg.setFromIniFile(profile, f, exOpts); err != nil {
if _, ok := err.(SharedConfigProfileNotExistsError); ok {
// Ignore profiles not defined in individual files.
profileNotFoundErr = err
skippedFiles++
continue
}
return err
}
}
if skippedFiles == len(files) {
// If all files were skipped because the profile is not found, return
// the original profile not found error.
return profileNotFoundErr
}
if _, ok := profiles[profile]; ok {
// if this is the second instance of the profile the Assume Role
// options must be cleared because they are only valid for the
// first reference of a profile. The self linked instance of the
// profile only have credential provider options.
cfg.clearAssumeRoleOptions()
} else {
// First time a profile has been seen, It must either be a assume role
// or credentials. Assert if the credential type requires a role ARN,
// the ARN is also set.
if err := cfg.validateCredentialsRequireARN(profile); err != nil {
return err
}
}
profiles[profile] = struct{}{}
if err := cfg.validateCredentialType(); err != nil {
return err
}
// Link source profiles for assume roles
if len(cfg.SourceProfileName) != 0 {
// Linked profile via source_profile ignore credential provider
// options, the source profile must provide the credentials.
cfg.clearCredentialOptions()
srcCfg := &sharedConfig{}
err := srcCfg.setFromIniFiles(profiles, cfg.SourceProfileName, files, exOpts)
if err != nil {
// SourceProfile that doesn't exist is an error in configuration.
if _, ok := err.(SharedConfigProfileNotExistsError); ok {
err = SharedConfigAssumeRoleError{
RoleARN: cfg.RoleARN,
SourceProfile: cfg.SourceProfileName,
}
}
return err
}
if !srcCfg.hasCredentials() {
return SharedConfigAssumeRoleError{
RoleARN: cfg.RoleARN,
SourceProfile: cfg.SourceProfileName,
}
}
cfg.SourceProfile = srcCfg
}
return nil
}
// setFromFile loads the configuration from the file using the profile
// provided. A sharedConfig pointer type value is used so that multiple config
// file loadings can be chained.
//
// Only loads complete logically grouped values, and will not set fields in cfg
// for incomplete grouped values in the config. Such as credentials. For
// example if a config file only includes aws_access_key_id but no
// aws_secret_access_key the aws_access_key_id will be ignored.
func (cfg *sharedConfig) setFromIniFile(profile string, file sharedConfigFile, exOpts bool) error {
section, ok := file.IniData.GetSection(profile)
if !ok {
// Fallback to to alternate profile name: profile <name>
section, ok = file.IniData.GetSection(fmt.Sprintf("profile %s", profile))
if !ok {
return SharedConfigProfileNotExistsError{Profile: profile, Err: nil}
}
}
if exOpts {
// Assume Role Parameters
updateString(&cfg.RoleARN, section, roleArnKey)
updateString(&cfg.ExternalID, section, externalIDKey)
updateString(&cfg.MFASerial, section, mfaSerialKey)
updateString(&cfg.RoleSessionName, section, roleSessionNameKey)
updateString(&cfg.SourceProfileName, section, sourceProfileKey)
updateString(&cfg.CredentialSource, section, credentialSourceKey)
updateString(&cfg.Region, section, regionKey)
if v := section.String(stsRegionalEndpointSharedKey); len(v) != 0 {
sre, err := endpoints.GetSTSRegionalEndpoint(v)
if err != nil {
return fmt.Errorf("failed to load %s from shared config, %s, %v",
stsRegionalEndpointSharedKey, file.Filename, err)
}
cfg.STSRegionalEndpoint = sre
}
if v := section.String(s3UsEast1RegionalSharedKey); len(v) != 0 {
sre, err := endpoints.GetS3UsEast1RegionalEndpoint(v)
if err != nil {
return fmt.Errorf("failed to load %s from shared config, %s, %v",
s3UsEast1RegionalSharedKey, file.Filename, err)
}
cfg.S3UsEast1RegionalEndpoint = sre
}
}
updateString(&cfg.CredentialProcess, section, credentialProcessKey)
updateString(&cfg.WebIdentityTokenFile, section, webIdentityTokenFileKey)
// Shared Credentials
creds := credentials.Value{
AccessKeyID: section.String(accessKeyIDKey),
SecretAccessKey: section.String(secretAccessKey),
SessionToken: section.String(sessionTokenKey),
ProviderName: fmt.Sprintf("SharedConfigCredentials: %s", file.Filename),
}
if creds.HasKeys() {
cfg.Creds = creds
}
// Endpoint discovery
updateBoolPtr(&cfg.EnableEndpointDiscovery, section, enableEndpointDiscoveryKey)
// CSM options
updateBoolPtr(&cfg.CSMEnabled, section, csmEnabledKey)
updateString(&cfg.CSMHost, section, csmHostKey)
updateString(&cfg.CSMPort, section, csmPortKey)
updateString(&cfg.CSMClientID, section, csmClientIDKey)
updateBool(&cfg.S3UseARNRegion, section, s3UseARNRegionKey)
return nil
}
func (cfg *sharedConfig) validateCredentialsRequireARN(profile string) error {
var credSource string
switch {
case len(cfg.SourceProfileName) != 0:
credSource = sourceProfileKey
case len(cfg.CredentialSource) != 0:
credSource = credentialSourceKey
case len(cfg.WebIdentityTokenFile) != 0:
credSource = webIdentityTokenFileKey
}
if len(credSource) != 0 && len(cfg.RoleARN) == 0 {
return CredentialRequiresARNError{
Type: credSource,
Profile: profile,
}
}
return nil
}
func (cfg *sharedConfig) validateCredentialType() error {
// Only one or no credential type can be defined.
if !oneOrNone(
len(cfg.SourceProfileName) != 0,
len(cfg.CredentialSource) != 0,
len(cfg.CredentialProcess) != 0,
len(cfg.WebIdentityTokenFile) != 0,
) {
return ErrSharedConfigSourceCollision
}
return nil
}
func (cfg *sharedConfig) hasCredentials() bool {
switch {
case len(cfg.SourceProfileName) != 0:
case len(cfg.CredentialSource) != 0:
case len(cfg.CredentialProcess) != 0:
case len(cfg.WebIdentityTokenFile) != 0:
case cfg.Creds.HasKeys():
default:
return false
}
return true
}
func (cfg *sharedConfig) clearCredentialOptions() {
cfg.CredentialSource = ""
cfg.CredentialProcess = ""
cfg.WebIdentityTokenFile = ""
cfg.Creds = credentials.Value{}
}
func (cfg *sharedConfig) clearAssumeRoleOptions() {
cfg.RoleARN = ""
cfg.ExternalID = ""
cfg.MFASerial = ""
cfg.RoleSessionName = ""
cfg.SourceProfileName = ""
}
func oneOrNone(bs ...bool) bool {
var count int
for _, b := range bs {
if b {
count++
if count > 1 {
return false
}
}
}
return true
}
// updateString will only update the dst with the value in the section key, key
// is present in the section.
func updateString(dst *string, section ini.Section, key string) {
if !section.Has(key) {
return
}
*dst = section.String(key)
}
// updateBool will only update the dst with the value in the section key, key
// is present in the section.
func updateBool(dst *bool, section ini.Section, key string) {
if !section.Has(key) {
return
}
*dst = section.Bool(key)
}
// updateBoolPtr will only update the dst with the value in the section key,
// key is present in the section.
func updateBoolPtr(dst **bool, section ini.Section, key string) {
if !section.Has(key) {
return
}
*dst = new(bool)
**dst = section.Bool(key)
}
// SharedConfigLoadError is an error for the shared config file failed to load.
type SharedConfigLoadError struct {
Filename string
Err error
}
// Code is the short id of the error.
func (e SharedConfigLoadError) Code() string {
return "SharedConfigLoadError"
}
// Message is the description of the error
func (e SharedConfigLoadError) Message() string {
return fmt.Sprintf("failed to load config file, %s", e.Filename)
}
// OrigErr is the underlying error that caused the failure.
func (e SharedConfigLoadError) OrigErr() error {
return e.Err
}
// Error satisfies the error interface.
func (e SharedConfigLoadError) Error() string {
return awserr.SprintError(e.Code(), e.Message(), "", e.Err)
}
// SharedConfigProfileNotExistsError is an error for the shared config when
// the profile was not find in the config file.
type SharedConfigProfileNotExistsError struct {
Profile string
Err error
}
// Code is the short id of the error.
func (e SharedConfigProfileNotExistsError) Code() string {
return "SharedConfigProfileNotExistsError"
}
// Message is the description of the error
func (e SharedConfigProfileNotExistsError) Message() string {
return fmt.Sprintf("failed to get profile, %s", e.Profile)
}
// OrigErr is the underlying error that caused the failure.
func (e SharedConfigProfileNotExistsError) OrigErr() error {
return e.Err
}
// Error satisfies the error interface.
func (e SharedConfigProfileNotExistsError) Error() string {
return awserr.SprintError(e.Code(), e.Message(), "", e.Err)
}
// SharedConfigAssumeRoleError is an error for the shared config when the
// profile contains assume role information, but that information is invalid
// or not complete.
type SharedConfigAssumeRoleError struct {
RoleARN string
SourceProfile string
}
// Code is the short id of the error.
func (e SharedConfigAssumeRoleError) Code() string {
return "SharedConfigAssumeRoleError"
}
// Message is the description of the error
func (e SharedConfigAssumeRoleError) Message() string {
return fmt.Sprintf(
"failed to load assume role for %s, source profile %s has no shared credentials",
e.RoleARN, e.SourceProfile,
)
}
// OrigErr is the underlying error that caused the failure.
func (e SharedConfigAssumeRoleError) OrigErr() error {
return nil
}
// Error satisfies the error interface.
func (e SharedConfigAssumeRoleError) Error() string {
return awserr.SprintError(e.Code(), e.Message(), "", nil)
}
// CredentialRequiresARNError provides the error for shared config credentials
// that are incorrectly configured in the shared config or credentials file.
type CredentialRequiresARNError struct {
// type of credentials that were configured.
Type string
// Profile name the credentials were in.
Profile string
}
// Code is the short id of the error.
func (e CredentialRequiresARNError) Code() string {
return "CredentialRequiresARNError"
}
// Message is the description of the error
func (e CredentialRequiresARNError) Message() string {
return fmt.Sprintf(
"credential type %s requires role_arn, profile %s",
e.Type, e.Profile,
)
}
// OrigErr is the underlying error that caused the failure.
func (e CredentialRequiresARNError) OrigErr() error {
return nil
}
// Error satisfies the error interface.
func (e CredentialRequiresARNError) Error() string {
return awserr.SprintError(e.Code(), e.Message(), "", nil)
}
|
{
"pile_set_name": "Github"
}
|
/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#ifndef UV_DARWIN_H
#define UV_DARWIN_H
#if defined(__APPLE__) && defined(__MACH__)
# include <mach/mach.h>
# include <mach/task.h>
# include <mach/semaphore.h>
# include <TargetConditionals.h>
# define UV_PLATFORM_SEM_T semaphore_t
#endif
#define UV_IO_PRIVATE_PLATFORM_FIELDS \
int rcount; \
int wcount; \
#define UV_PLATFORM_LOOP_FIELDS \
uv_thread_t cf_thread; \
void* _cf_reserved; \
void* cf_state; \
uv_mutex_t cf_mutex; \
uv_sem_t cf_sem; \
void* cf_signals[2]; \
#define UV_PLATFORM_FS_EVENT_FIELDS \
uv__io_t event_watcher; \
char* realpath; \
int realpath_len; \
int cf_flags; \
uv_async_t* cf_cb; \
void* cf_events[2]; \
void* cf_member[2]; \
int cf_error; \
uv_mutex_t cf_mutex; \
#define UV_STREAM_PRIVATE_PLATFORM_FIELDS \
void* select; \
#define UV_HAVE_KQUEUE 1
#endif /* UV_DARWIN_H */
|
{
"pile_set_name": "Github"
}
|
#include "pairwise_hist.cuh"
#include "split_properties_helpers.cuh"
#include "compute_pair_hist_loop.cuh"
#include <cooperative_groups.h>
#include <library/cpp/cuda/wrappers/arch.cuh>
#include <catboost/cuda/cuda_util/kernel/instructions.cuh>
#include <catboost/cuda/cuda_util/kernel/kernel_helpers.cuh>
#include <cstdio>
using namespace cooperative_groups;
namespace NKernel {
template <bool IsFullPass>
struct TFiveBitPairwiseHistUnrollTrait {
static constexpr int InnerUnroll() {
#if __CUDA_ARCH__ <= 350
return 4;
#elif __CUDA_ARCH__ < 700
return 2;
#else
return IsFullPass ? 4 : 8;
#endif
}
static constexpr int OuterUnroll() {
#if __CUDA_ARCH__ <= 350
return 2;
#elif __CUDA_ARCH__ < 700
return 2;
#else
return 1;
#endif
}
};
template <int BlockSize, bool NeedLastBinMask /*is 32 histogram */, class TCmpBins = TCmpBinsWithoutOneHot>
struct TFiveBitHistogram {
TCmpBins CmpBinsFunc;
float* Histogram;
__forceinline__ __device__ int SliceOffset() {
const int warpOffset = 1024 * (threadIdx.x / 32);
//2 blocks if INNER_HIST_BITS_COUNT = 0, else 1
// x4 feature and x4 histograms, though histStart = blockIdx * 16
return warpOffset + (threadIdx.x & 16);
}
__forceinline__ __device__ TFiveBitHistogram(float* buff, TCmpBins cmpBins)
: CmpBinsFunc(cmpBins) {
Histogram = buff;
CmpBinsFunc = cmpBins;
for (int i = threadIdx.x; i < BlockSize * 32; i += BlockSize) {
Histogram[i] = 0;
}
Histogram += SliceOffset();
__syncthreads();
}
__forceinline__ __device__ void AddPair(const ui32 ci1,
const ui32 ci2,
const float w) {
thread_block_tile<16> groupTile = tiled_partition<16>(this_thread_block());
const bool flag = threadIdx.x & 1;
const int shift = 4 * (threadIdx.x & 6);
const ui32 bins1 = RotateRight(flag ? ci2 : ci1, shift);
const ui32 bins2 = RotateRight(flag ? ci1 : ci2, shift);
#pragma unroll
for (int i = 0; i < 4; i++) {
const int f = (threadIdx.x + 2 * i) & 6;
int bin1 = (bins1 >> (24 - 8 * i)) & 255;
int bin2 = (bins2 >> (24 - 8 * i)) & 255;
const float w1 = (!NeedLastBinMask || bin1 < 32) ? w : 0;
const float w2 = (!NeedLastBinMask || bin2 < 32) ? w : 0;
const int tmp = (CmpBinsFunc.Compare(i, bin1, bin2, flag) ? 0 : 8) + f;
int offset1 = tmp + ((bin1 & 31) << 5) + flag;
int offset2 = tmp + ((bin2 & 31) << 5) + !flag;
groupTile.sync();
if (groupTile.thread_rank() < 8) {
Histogram[offset1] += w1;
}
groupTile.sync();
if (groupTile.thread_rank() >= 8) {
Histogram[offset1] += w1;
}
groupTile.sync();
if (groupTile.thread_rank() < 8) {
Histogram[offset2] += w2;
}
groupTile.sync();
if (groupTile.thread_rank() >= 8) {
Histogram[offset2] += w2;
}
}
}
#if __CUDA_ARCH__ < 700
template <int N>
__forceinline__ __device__ void AddPairs(const ui32* ci1,
const ui32* ci2,
const float* w) {
#pragma unroll
for (int k = 0; k < N; ++k) {
AddPair(ci1[k], ci2[k], w[k]);
}
}
#else
template <int N>
__forceinline__ __device__ void AddPairs(const ui32* ci1,
const ui32* ci2,
const float* w) {
thread_block_tile<16> groupTile = tiled_partition<16>(this_thread_block());
const bool flag = threadIdx.x & 1;
const int shift = 4 * (threadIdx.x & 6);
ui32 bins1[N];
ui32 bins2[N];
#pragma unroll
for (int i = 0; i < 4; i++) {
const int f = (threadIdx.x + 2 * i) & 6;
int bin1[N];
int bin2[N];
float w1[N];
float w2[N];
int offset1[N];
int offset2[N];
#pragma unroll
for (int k = 0; k < N;++k) {
if (i == 0) {
bins1[k] = RotateRight(flag ? ci2[k] : ci1[k], shift);
bins2[k] = RotateRight(flag ? ci1[k] : ci2[k], shift);
}
bin1[k] = (bins1[k] >> (24 - 8 * i)) & 255;
bin2[k] = (bins2[k] >> (24 - 8 * i)) & 255;
w1[k] = (!NeedLastBinMask || bin1[k] < 32) ? w[k] : 0;
w2[k] = (!NeedLastBinMask || bin2[k] < 32) ? w[k] : 0;
const int tmp = (CmpBinsFunc.Compare(i, bin1[k], bin2[k], flag) ? 0 : 8) + f;
offset1[k] = tmp + ((bin1[k] & 31) * 32) + flag;
offset2[k] = tmp + ((bin2[k] & 31) * 32) + !flag;
}
groupTile.sync();
if (groupTile.thread_rank() < 8) {
#pragma unroll
for (int k = 0; k < N; ++k) {
Histogram[offset1[k]] += w1[k];
}
}
groupTile.sync();
if (groupTile.thread_rank() >= 8) {
#pragma unroll
for (int k = 0; k < N; ++k) {
Histogram[offset1[k]] += w1[k];
}
}
groupTile.sync();
if (groupTile.thread_rank() < 8) {
#pragma unroll
for (int k = 0; k < N; ++k) {
Histogram[offset2[k]] += w2[k];
}
}
groupTile.sync();
if (groupTile.thread_rank() >= 8) {
#pragma unroll
for (int k = 0; k < N; ++k) {
Histogram[offset2[k]] += w2[k];
}
}
}
}
#endif
__forceinline__ __device__ void Reduce() {
Histogram -= SliceOffset();
__syncthreads();
{
const int warpHistSize = 1024;
for (int start = threadIdx.x; start < warpHistSize; start += BlockSize) {
float sum = 0;
#pragma unroll 12
for (int i = start; i < 32 * BlockSize; i += warpHistSize) {
sum += Histogram[i];
}
Histogram[warpHistSize + start] = sum;
}
}
__syncthreads();
const int maxFoldCount = 32;
const int fold = (threadIdx.x >> 1) & 31;
const int f = threadIdx.x / 64;
if (threadIdx.x < 256) {
float weightLeq = 0;
float weightGe = 0;
const bool isSecondBin = (threadIdx.x & 1);
if (fold < maxFoldCount) {
const volatile float* __restrict__ src = Histogram
+ 1024 //warpHistSize
+ 32 * fold
+ 2 * f
+ isSecondBin;
weightLeq = src[0] + src[16];
weightGe = src[8] + src[24];
Histogram[4 * (maxFoldCount * f + fold) + isSecondBin] = weightLeq;
Histogram[4 * (maxFoldCount * f + fold) + 2 + isSecondBin] = weightGe;
}
}
__syncthreads();
}
};
template <int BlockSize, bool IsFullPass, bool OneHotPass>
#if __CUDA_ARCH__ <= 350
__launch_bounds__(BlockSize, 1)
#elif __CUDA_ARCH__ < 700
__launch_bounds__(BlockSize, 2)
#endif
__global__ void ComputeSplitPropertiesNonBinaryPairs(const TCFeature* feature, int fCount, const ui32* cindex,
const uint2* pairs, const float* weight,
const TDataPartition* partition,
int histLineSize,
float* histogram) {
const int maxBlocksPerPart = gridDim.x / ((fCount + 3) / 4);
const int featureOffset = (blockIdx.x / maxBlocksPerPart) * 4;
feature += featureOffset;
cindex += feature->Offset;
fCount = min(fCount - featureOffset, 4);
__shared__ float localHist[32 * BlockSize];
const int maxBinCount = GetMaxBinCount(feature, fCount, (int*) &localHist[0]);
if (maxBinCount > 32) {
return;
}
const bool needOneHot = HasOneHotFeatures(feature, fCount, (int*)&localHist[0]);
if (needOneHot != OneHotPass) {
return;
}
__syncthreads();
if (IsFullPass) {
partition += blockIdx.y;
histogram += blockIdx.y * histLineSize * 4ULL;
} else {
const int depth = (int)log2((float)gridDim.y);
int partId = GetPairwisePartIdToCalculate(partition);
partition += partId;
histogram += (((blockIdx.z + 1) << depth) | blockIdx.y) * histLineSize * 4ULL;
}
if (partition->Size == 0) {
return;
}
constexpr int innerUnroll = TFiveBitPairwiseHistUnrollTrait<IsFullPass>::InnerUnroll();
constexpr int outerUnroll = TFiveBitPairwiseHistUnrollTrait<IsFullPass>::OuterUnroll();
const int localBlockIdx = blockIdx.x % maxBlocksPerPart;
const int minDocsPerBlock = BlockSize * innerUnroll * 4;
const int activeBlockCount = min((partition->Size + minDocsPerBlock - 1) / minDocsPerBlock, maxBlocksPerPart);
if (localBlockIdx >= activeBlockCount) {
return;
}
#define DECLARE_PASS(NEED_MASK) \
{ \
using TBinCmp = typename TCmpBinsOneByteTrait<OneHotPass>::TCmpBins;\
using THist = TFiveBitHistogram<BlockSize, NEED_MASK, TBinCmp>;\
TBinCmp cmp(feature, fCount);\
THist hist(&localHist[0], cmp);\
ComputePairHistogram< BlockSize, innerUnroll, outerUnroll, THist>(partition->Offset, partition->Size, cindex, pairs, weight, localBlockIdx, activeBlockCount, hist);\
}
if (maxBinCount < 32) {
DECLARE_PASS(false);
} else {
DECLARE_PASS(true);
}
#undef DECLARE_PASS
if (threadIdx.x < 256) {
const int histId = threadIdx.x & 3;
const int fold = (threadIdx.x >> 2) & 31;
const int firstFid = (threadIdx.x >> 7) & 1;
const int maxFoldCount = 1 << 5;
for (int fid = firstFid; fid < fCount; fid += 2) {
const ui32 bfStart = feature[fid].FirstFoldIndex;
if (fold < feature[fid].Folds) {
const int readOffset = 4 * (maxFoldCount * fid + fold) + histId;
const float val = localHist[readOffset];
if (abs(val) > 1e-20f) {
if (activeBlockCount > 1) {
atomicAdd(histogram + 4 * bfStart + 4 * fold + histId, val);
} else {
histogram[4 * bfStart + 4 * fold + histId] = val;
}
}
}
}
}
}
template <bool OneHotPass>
void ComputePairwiseHistogramOneByte5BitsImpl(const TCFeature* features,
const TCFeature* featuresCpu,
const ui32 featureCount,
const ui32 fiveBitsFeatureCount,
const ui32* compressedIndex,
const uint2* pairs,
ui32 /*pairCount*/,
const float* weight,
const TDataPartition* partition,
ui32 partCount,
ui32 histLineSize,
bool fullPass,
float* histogram,
int parallelStreams,
TCudaStream stream) {
const bool hasOneHot = HasOneHotFeatures(featuresCpu, featureCount);
if (!hasOneHot && OneHotPass) {
return;
}
if (fiveBitsFeatureCount > 0) {
const int blockSize = 384;
dim3 numBlocks;
numBlocks.x = (fiveBitsFeatureCount + 3) / 4;
numBlocks.y = fullPass ? partCount : partCount / 4;
numBlocks.z = fullPass ? 1 : 3;
const int blocksPerSm = TArchProps::GetMajorVersion() > 3 ? 2 : 1;
const int blockPerFeatureMultiplier = CeilDivide<int>(TArchProps::SMCount() * blocksPerSm * 4, (parallelStreams * numBlocks.x * numBlocks.y * numBlocks.z));
numBlocks.x = (featureCount + 3) / 4;
numBlocks.x *= blockPerFeatureMultiplier;
#define NB_HIST(IS_FULL) \
ComputeSplitPropertiesNonBinaryPairs < blockSize, IS_FULL, OneHotPass > << <numBlocks, blockSize, 0, stream>>>(\
features, featureCount, compressedIndex, pairs,\
weight, partition, histLineSize, histogram);
if (fullPass) {
NB_HIST(true)
} else {
NB_HIST(false)
}
#undef NB_HIST
}
}
#define DEFINE_EXTERN(flag) \
extern template \
void ComputePairwiseHistogramOneByte5BitsImpl<flag>(const TCFeature* features, const TCFeature* featuresCpu,\
const ui32 featureCount,\
const ui32 fiveBitsFeatureCount,\
const ui32* compressedIndex,\
const uint2* pairs, ui32 pairCount,\
const float* weight,\
const TDataPartition* partition,\
ui32 partCount,\
ui32 histLineSize,\
bool fullPass,\
float* histogram, int parallelStreams,\
TCudaStream stream);
DEFINE_EXTERN(false)
DEFINE_EXTERN(true)
#undef DEFINE_EXTERN
}
|
{
"pile_set_name": "Github"
}
|
<?php
/**
* Locale data for 'ur'.
*
* This file is automatically generated by yiic cldr command.
*
* Copyright © 1991-2007 Unicode, Inc. All rights reserved.
* Distributed under the Terms of Use in http://www.unicode.org/copyright.html.
*
* Copyright © 2008-2011 Yii Software LLC (http://www.yiiframework.com/license/)
*/
return array (
'version' => '4765',
'numberSymbols' =>
array (
'decimal' => '.',
'group' => ',',
'list' => ';',
'percentSign' => '%',
'nativeZeroDigit' => '0',
'patternDigit' => '#',
'plusSign' => '+',
'minusSign' => '-',
'exponential' => 'E',
'perMille' => '‰',
'infinity' => '∞',
'nan' => 'NaN',
),
'decimalFormat' => '#,##0.###',
'scientificFormat' => '#E0',
'percentFormat' => '#,##0%',
'currencyFormat' => '¤#,##0.00',
'currencySymbols' =>
array (
'AFN' => 'Af',
'ANG' => 'NAf.',
'AOA' => 'Kz',
'ARA' => '₳',
'ARL' => '$L',
'ARM' => 'm$n',
'ARS' => 'AR$',
'AUD' => 'AU$',
'AWG' => 'Afl.',
'AZN' => 'man.',
'BAM' => 'KM',
'BBD' => 'Bds$',
'BDT' => 'Tk',
'BEF' => 'BF',
'BHD' => 'BD',
'BIF' => 'FBu',
'BMD' => 'BD$',
'BND' => 'BN$',
'BOB' => 'Bs',
'BOP' => '$b.',
'BRL' => 'R$',
'BSD' => 'BS$',
'BTN' => 'Nu.',
'BWP' => 'BWP',
'BZD' => 'BZ$',
'CAD' => 'CA$',
'CDF' => 'CDF',
'CLE' => 'Eº',
'CLP' => 'CL$',
'CNY' => 'CN¥',
'COP' => 'CO$',
'CRC' => '₡',
'CUC' => 'CUC$',
'CUP' => 'CU$',
'CVE' => 'CV$',
'CYP' => 'CY£',
'CZK' => 'Kč',
'DEM' => 'DM',
'DJF' => 'Fdj',
'DKK' => 'Dkr',
'DOP' => 'RD$',
'DZD' => 'DA',
'EEK' => 'Ekr',
'ERN' => 'Nfk',
'ESP' => 'Pts',
'ETB' => 'Br',
'EUR' => '€',
'FIM' => 'mk',
'FJD' => 'FJ$',
'FKP' => 'FK£',
'FRF' => '₣',
'GBP' => '£',
'GHC' => '₵',
'GHS' => 'GH₵',
'GIP' => 'GI£',
'GMD' => 'GMD',
'GNF' => 'FG',
'GRD' => '₯',
'GTQ' => 'GTQ',
'GYD' => 'GY$',
'HKD' => 'HK$',
'HNL' => 'HNL',
'HRK' => 'kn',
'HTG' => 'HTG',
'HUF' => 'Ft',
'IDR' => 'Rp',
'IEP' => 'IR£',
'ILP' => 'I£',
'ILS' => '₪',
'INR' => 'Rs',
'ISK' => 'Ikr',
'ITL' => 'IT₤',
'JMD' => 'J$',
'JOD' => 'JD',
'JPY' => 'JP¥',
'KES' => 'Ksh',
'KMF' => 'CF',
'KRW' => '₩',
'KWD' => 'KD',
'KYD' => 'KY$',
'LAK' => '₭',
'LBP' => 'LB£',
'LKR' => 'SLRs',
'LRD' => 'L$',
'LSL' => 'LSL',
'LTL' => 'Lt',
'LVL' => 'Ls',
'LYD' => 'LD',
'MMK' => 'MMK',
'MNT' => '₮',
'MOP' => 'MOP$',
'MRO' => 'UM',
'MTL' => 'Lm',
'MTP' => 'MT£',
'MUR' => 'MURs',
'MXN' => 'MX$',
'MYR' => 'RM',
'MZM' => 'Mt',
'MZN' => 'MTn',
'NAD' => 'N$',
'NGN' => '₦',
'NIO' => 'C$',
'NLG' => 'fl',
'NOK' => 'Nkr',
'NPR' => 'NPRs',
'NZD' => 'NZ$',
'PAB' => 'B/.',
'PEI' => 'I/.',
'PEN' => 'S/.',
'PGK' => 'PGK',
'PHP' => '₱',
'PKR' => 'روپے',
'PLN' => 'zł',
'PTE' => 'Esc',
'PYG' => '₲',
'QAR' => 'QR',
'RHD' => 'RH$',
'RON' => 'RON',
'RSD' => 'din.',
'SAR' => 'SR',
'SBD' => 'SI$',
'SCR' => 'SRe',
'SDD' => 'LSd',
'SEK' => 'Skr',
'SGD' => 'S$',
'SHP' => 'SH£',
'SKK' => 'Sk',
'SLL' => 'Le',
'SOS' => 'Ssh',
'SRD' => 'SR$',
'SRG' => 'Sf',
'STD' => 'Db',
'SVC' => 'SV₡',
'SYP' => 'SY£',
'SZL' => 'SZL',
'THB' => '฿',
'TMM' => 'TMM',
'TND' => 'DT',
'TOP' => 'T$',
'TRL' => 'TRL',
'TRY' => 'TL',
'TTD' => 'TT$',
'TWD' => 'NT$',
'TZS' => 'TSh',
'UAH' => '₴',
'UGX' => 'USh',
'USD' => 'ڈالر',
'UYU' => '$U',
'VEF' => 'Bs.F.',
'VND' => '₫',
'VUV' => 'VT',
'WST' => 'WS$',
'XAF' => 'FCFA',
'XCD' => 'EC$',
'XOF' => 'CFA',
'XPF' => 'CFPF',
'YER' => 'YR',
'ZAR' => 'R',
'ZMK' => 'ZK',
'ZRN' => 'NZ',
'ZRZ' => 'ZRZ',
'ZWD' => 'Z$',
),
'monthNames' =>
array (
'wide' =>
array (
1 => 'جنوری',
2 => 'فروری',
3 => 'مار چ',
4 => 'اپريل',
5 => 'مئ',
6 => 'جون',
7 => 'جولائ',
8 => 'اگست',
9 => 'ستمبر',
10 => 'اکتوبر',
11 => 'نومبر',
12 => 'دسمبر',
),
'abbreviated' =>
array (
1 => '1',
2 => '2',
3 => '3',
4 => '4',
5 => '5',
6 => '6',
7 => '7',
8 => '8',
9 => '9',
10 => '10',
11 => '11',
12 => '12',
),
),
'monthNamesSA' =>
array (
'narrow' =>
array (
1 => 'ج',
2 => 'ف',
3 => 'م',
4 => 'ا',
5 => 'م',
6 => 'ج',
7 => 'ج',
8 => 'ا',
9 => 'س',
10 => 'ا',
11 => 'ن',
12 => 'د',
),
),
'weekDayNames' =>
array (
'wide' =>
array (
0 => 'اتوار',
1 => 'پير',
2 => 'منگل',
3 => 'بده',
4 => 'جمعرات',
5 => 'جمعہ',
6 => 'ہفتہ',
),
'abbreviated' =>
array (
0 => '1',
1 => '2',
2 => '3',
3 => '4',
4 => '5',
5 => '6',
6 => '7',
),
),
'weekDayNamesSA' =>
array (
'narrow' =>
array (
0 => 'ا',
1 => 'پ',
2 => 'م',
3 => 'ب',
4 => 'ج',
5 => 'ج',
6 => 'ہ',
),
),
'eraNames' =>
array (
'abbreviated' =>
array (
0 => 'ق م',
1 => 'عيسوی سن',
),
'wide' =>
array (
0 => 'قبل مسيح',
1 => 'عيسوی سن',
),
'narrow' =>
array (
0 => 'ق م',
1 => 'عيسوی سن',
),
),
'dateFormats' =>
array (
'full' => 'EEEE, d, MMMM y',
'long' => 'd, MMMM y',
'medium' => 'd, MMM y',
'short' => 'd/M/yy',
),
'timeFormats' =>
array (
'full' => 'h:mm:ss a zzzz',
'long' => 'h:mm:ss a z',
'medium' => 'h:mm:ss a',
'short' => 'h:mm a',
),
'dateTimeFormat' => '{1} {0}',
'amName' => 'قبل دوپہر',
'pmName' => 'بعد دوپہر',
'orientation' => 'rtl',
'pluralRules' =>
array (
0 => 'n==1',
1 => 'true',
),
);
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright (c) 2008, 2009, 2010 Denis Tulskiy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
*/
package com.tulskiy.musique.gui.dialogs;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import org.jaudiotagger.tag.FieldKey;
import com.tulskiy.musique.gui.components.GroupTable;
import com.tulskiy.musique.gui.model.MultiTagFieldModel;
import com.tulskiy.musique.gui.model.TrackInfoItem;
import com.tulskiy.musique.gui.playlist.PlaylistTable;
import com.tulskiy.musique.util.FieldKeyMetaHelper;
import com.tulskiy.musique.util.FieldKeyMetaHelper.FieldKeyMeta;
/**
* Author: Maksim Liauchuk
* Date: 08.05.2011
*/
public class TracksInfoAddFieldDialog extends JDialog {
private JButton cancel;
public TracksInfoAddFieldDialog(final GroupTable properties, final MultiTagFieldModel tagFieldsModel) {
setTitle("Add field");
setModal(false);
final JComboBox key = new JComboBox(new FieldKeyModel(getAvailableFieldKeys(tagFieldsModel)));
add(key, BorderLayout.NORTH);
final JTextField value = new JTextField();
add(value, BorderLayout.CENTER);
Box b1 = new Box(BoxLayout.X_AXIS);
b1.add(Box.createHorizontalGlue());
JButton add = new JButton("Add");
b1.add(add);
add.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
FieldKeyMeta keyMeta = (FieldKeyMeta) key.getSelectedItem();
TrackInfoItem trackInfoItem = new TrackInfoItem(keyMeta.getKey(),
tagFieldsModel.getTrackInfoItems().get(0).getTracks());
trackInfoItem.getState().setValue(value.getText());
trackInfoItem.approveState(false);
tagFieldsModel.addTrackInfoItem(trackInfoItem);
tagFieldsModel.sort();
properties.revalidate();
properties.repaint();
setVisible(false);
dispose();
properties.requestFocus();
}
});
cancel = new JButton("Cancel");
cancel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
setVisible(false);
dispose();
properties.requestFocus();
}
});
b1.add(Box.createHorizontalStrut(5));
b1.add(cancel);
b1.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 10));
add(b1, BorderLayout.SOUTH);
setSize(300, 115);
setLocationRelativeTo(SwingUtilities.windowForComponent(properties));
}
private List<FieldKey> getAvailableFieldKeys(final MultiTagFieldModel tagFieldsModel) {
List<FieldKey> result = new ArrayList<FieldKey>(Arrays.asList(FieldKey.values()));
// remove already used fields
result.removeAll(tagFieldsModel.getAllUsedFieldKeys());
// remove technical fields
result.remove(FieldKey.ENCODER);
result.remove(FieldKey.CUESHEET);
return result;
}
private class FieldKeyModel extends DefaultComboBoxModel {
private List<FieldKey> keys;
public FieldKeyModel(List<FieldKey> keys) {
this.keys = keys;
}
@Override
public Object getElementAt(int arg0) {
return FieldKeyMetaHelper.getFieldKeyMeta(keys.get(arg0));
}
@Override
public int getSize() {
return keys.size();
}
}
}
|
{
"pile_set_name": "Github"
}
|
'use strict';
exports.__esModule = true;
var _color = require('color');
var _color2 = _interopRequireDefault(_color);
var _colourNames = require('./lib/colourNames');
var _colourNames2 = _interopRequireDefault(_colourNames);
var _toShorthand = require('./lib/toShorthand');
var _toShorthand2 = _interopRequireDefault(_toShorthand);
var _colourType = require('./lib/colourType');
var ctype = _interopRequireWildcard(_colourType);
var _stripWhitespace = require('./lib/stripWhitespace');
var _stripWhitespace2 = _interopRequireDefault(_stripWhitespace);
var _trimLeadingZero = require('./lib/trimLeadingZero');
var _trimLeadingZero2 = _interopRequireDefault(_trimLeadingZero);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var filterColor = function filterColor(callback) {
return Object.keys(_colourNames2.default).filter(callback);
};
var shorter = function shorter(a, b) {
return (a && a.length < b.length ? a : b).toLowerCase();
};
exports.default = function (colour) {
var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
if (ctype.isRGBorHSL(colour)) {
var c = void 0;
// Pass through invalid rgb/hsl functions
try {
c = (0, _color2.default)(colour);
} catch (err) {
return colour;
}
if (c.alpha() === 1) {
// At full alpha, just use hex
colour = c.hexString();
} else {
var rgb = c.rgb();
if (!opts.legacy && !rgb.r && !rgb.g && !rgb.b && !rgb.a) {
return 'transparent';
}
var hsla = c.hslaString();
var rgba = c.rgbString();
return (0, _trimLeadingZero2.default)((0, _stripWhitespace2.default)(hsla.length < rgba.length ? hsla : rgba));
}
}
if (ctype.isHex(colour)) {
colour = (0, _toShorthand2.default)(colour.toLowerCase());
var keyword = filterColor(function (key) {
return _colourNames2.default[key] === colour;
})[0];
return shorter(keyword, colour);
} else if (ctype.isKeyword(colour)) {
var hex = _colourNames2.default[filterColor(function (k) {
return k === colour.toLowerCase();
})[0]];
return shorter(hex, colour);
}
// Possibly malformed, just pass through
return colour;
};
module.exports = exports['default'];
|
{
"pile_set_name": "Github"
}
|
// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.api.ads.admanager.jaxws.v201911;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for getContentBundlesByStatementResponse element declaration.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <element name="getContentBundlesByStatementResponse">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="rval" type="{https://www.google.com/apis/ads/publisher/v201911}ContentBundlePage" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"rval"
})
@XmlRootElement(name = "getContentBundlesByStatementResponse")
public class ContentBundleServiceInterfacegetContentBundlesByStatementResponse {
protected ContentBundlePage rval;
/**
* Gets the value of the rval property.
*
* @return
* possible object is
* {@link ContentBundlePage }
*
*/
public ContentBundlePage getRval() {
return rval;
}
/**
* Sets the value of the rval property.
*
* @param value
* allowed object is
* {@link ContentBundlePage }
*
*/
public void setRval(ContentBundlePage value) {
this.rval = value;
}
}
|
{
"pile_set_name": "Github"
}
|
#!/usr/bin/env perl
# ====================================================================
# Written by Andy Polyakov <[email protected]> for the OpenSSL
# project. The module is, however, dual licensed under OpenSSL and
# CRYPTOGAMS licenses depending on where you obtain it. For further
# details see http://www.openssl.org/~appro/cryptogams/.
# ====================================================================
# SHA512 block procedure for ARMv4. September 2007.
# This code is ~4.5 (four and a half) times faster than code generated
# by gcc 3.4 and it spends ~72 clock cycles per byte [on single-issue
# Xscale PXA250 core].
#
# July 2010.
#
# Rescheduling for dual-issue pipeline resulted in 6% improvement on
# Cortex A8 core and ~40 cycles per processed byte.
# February 2011.
#
# Profiler-assisted and platform-specific optimization resulted in 7%
# improvement on Coxtex A8 core and ~38 cycles per byte.
# March 2011.
#
# Add NEON implementation. On Cortex A8 it was measured to process
# one byte in 25.5 cycles or 47% faster than integer-only code.
# Byte order [in]dependence. =========================================
#
# Originally caller was expected to maintain specific *dword* order in
# h[0-7], namely with most significant dword at *lower* address, which
# was reflected in below two parameters as 0 and 4. Now caller is
# expected to maintain native byte order for whole 64-bit values.
$hi="HI";
$lo="LO";
# ====================================================================
while (($output=shift) && ($output!~/^\w[\w\-]*\.\w+$/)) {}
open STDOUT,">$output";
$ctx="r0"; # parameter block
$inp="r1";
$len="r2";
$Tlo="r3";
$Thi="r4";
$Alo="r5";
$Ahi="r6";
$Elo="r7";
$Ehi="r8";
$t0="r9";
$t1="r10";
$t2="r11";
$t3="r12";
############ r13 is stack pointer
$Ktbl="r14";
############ r15 is program counter
$Aoff=8*0;
$Boff=8*1;
$Coff=8*2;
$Doff=8*3;
$Eoff=8*4;
$Foff=8*5;
$Goff=8*6;
$Hoff=8*7;
$Xoff=8*8;
sub BODY_00_15() {
my $magic = shift;
$code.=<<___;
@ Sigma1(x) (ROTR((x),14) ^ ROTR((x),18) ^ ROTR((x),41))
@ LO lo>>14^hi<<18 ^ lo>>18^hi<<14 ^ hi>>9^lo<<23
@ HI hi>>14^lo<<18 ^ hi>>18^lo<<14 ^ lo>>9^hi<<23
mov $t0,$Elo,lsr#14
str $Tlo,[sp,#$Xoff+0]
mov $t1,$Ehi,lsr#14
str $Thi,[sp,#$Xoff+4]
eor $t0,$t0,$Ehi,lsl#18
ldr $t2,[sp,#$Hoff+0] @ h.lo
eor $t1,$t1,$Elo,lsl#18
ldr $t3,[sp,#$Hoff+4] @ h.hi
eor $t0,$t0,$Elo,lsr#18
eor $t1,$t1,$Ehi,lsr#18
eor $t0,$t0,$Ehi,lsl#14
eor $t1,$t1,$Elo,lsl#14
eor $t0,$t0,$Ehi,lsr#9
eor $t1,$t1,$Elo,lsr#9
eor $t0,$t0,$Elo,lsl#23
eor $t1,$t1,$Ehi,lsl#23 @ Sigma1(e)
adds $Tlo,$Tlo,$t0
ldr $t0,[sp,#$Foff+0] @ f.lo
adc $Thi,$Thi,$t1 @ T += Sigma1(e)
ldr $t1,[sp,#$Foff+4] @ f.hi
adds $Tlo,$Tlo,$t2
ldr $t2,[sp,#$Goff+0] @ g.lo
adc $Thi,$Thi,$t3 @ T += h
ldr $t3,[sp,#$Goff+4] @ g.hi
eor $t0,$t0,$t2
str $Elo,[sp,#$Eoff+0]
eor $t1,$t1,$t3
str $Ehi,[sp,#$Eoff+4]
and $t0,$t0,$Elo
str $Alo,[sp,#$Aoff+0]
and $t1,$t1,$Ehi
str $Ahi,[sp,#$Aoff+4]
eor $t0,$t0,$t2
ldr $t2,[$Ktbl,#$lo] @ K[i].lo
eor $t1,$t1,$t3 @ Ch(e,f,g)
ldr $t3,[$Ktbl,#$hi] @ K[i].hi
adds $Tlo,$Tlo,$t0
ldr $Elo,[sp,#$Doff+0] @ d.lo
adc $Thi,$Thi,$t1 @ T += Ch(e,f,g)
ldr $Ehi,[sp,#$Doff+4] @ d.hi
adds $Tlo,$Tlo,$t2
and $t0,$t2,#0xff
adc $Thi,$Thi,$t3 @ T += K[i]
adds $Elo,$Elo,$Tlo
ldr $t2,[sp,#$Boff+0] @ b.lo
adc $Ehi,$Ehi,$Thi @ d += T
teq $t0,#$magic
ldr $t3,[sp,#$Coff+0] @ c.lo
orreq $Ktbl,$Ktbl,#1
@ Sigma0(x) (ROTR((x),28) ^ ROTR((x),34) ^ ROTR((x),39))
@ LO lo>>28^hi<<4 ^ hi>>2^lo<<30 ^ hi>>7^lo<<25
@ HI hi>>28^lo<<4 ^ lo>>2^hi<<30 ^ lo>>7^hi<<25
mov $t0,$Alo,lsr#28
mov $t1,$Ahi,lsr#28
eor $t0,$t0,$Ahi,lsl#4
eor $t1,$t1,$Alo,lsl#4
eor $t0,$t0,$Ahi,lsr#2
eor $t1,$t1,$Alo,lsr#2
eor $t0,$t0,$Alo,lsl#30
eor $t1,$t1,$Ahi,lsl#30
eor $t0,$t0,$Ahi,lsr#7
eor $t1,$t1,$Alo,lsr#7
eor $t0,$t0,$Alo,lsl#25
eor $t1,$t1,$Ahi,lsl#25 @ Sigma0(a)
adds $Tlo,$Tlo,$t0
and $t0,$Alo,$t2
adc $Thi,$Thi,$t1 @ T += Sigma0(a)
ldr $t1,[sp,#$Boff+4] @ b.hi
orr $Alo,$Alo,$t2
ldr $t2,[sp,#$Coff+4] @ c.hi
and $Alo,$Alo,$t3
and $t3,$Ahi,$t1
orr $Ahi,$Ahi,$t1
orr $Alo,$Alo,$t0 @ Maj(a,b,c).lo
and $Ahi,$Ahi,$t2
adds $Alo,$Alo,$Tlo
orr $Ahi,$Ahi,$t3 @ Maj(a,b,c).hi
sub sp,sp,#8
adc $Ahi,$Ahi,$Thi @ h += T
tst $Ktbl,#1
add $Ktbl,$Ktbl,#8
___
}
$code=<<___;
#include "arm_arch.h"
#ifdef __ARMEL__
# define LO 0
# define HI 4
# define WORD64(hi0,lo0,hi1,lo1) .word lo0,hi0, lo1,hi1
#else
# define HI 0
# define LO 4
# define WORD64(hi0,lo0,hi1,lo1) .word hi0,lo0, hi1,lo1
#endif
.text
.code 32
.type K512,%object
.align 5
K512:
WORD64(0x428a2f98,0xd728ae22, 0x71374491,0x23ef65cd)
WORD64(0xb5c0fbcf,0xec4d3b2f, 0xe9b5dba5,0x8189dbbc)
WORD64(0x3956c25b,0xf348b538, 0x59f111f1,0xb605d019)
WORD64(0x923f82a4,0xaf194f9b, 0xab1c5ed5,0xda6d8118)
WORD64(0xd807aa98,0xa3030242, 0x12835b01,0x45706fbe)
WORD64(0x243185be,0x4ee4b28c, 0x550c7dc3,0xd5ffb4e2)
WORD64(0x72be5d74,0xf27b896f, 0x80deb1fe,0x3b1696b1)
WORD64(0x9bdc06a7,0x25c71235, 0xc19bf174,0xcf692694)
WORD64(0xe49b69c1,0x9ef14ad2, 0xefbe4786,0x384f25e3)
WORD64(0x0fc19dc6,0x8b8cd5b5, 0x240ca1cc,0x77ac9c65)
WORD64(0x2de92c6f,0x592b0275, 0x4a7484aa,0x6ea6e483)
WORD64(0x5cb0a9dc,0xbd41fbd4, 0x76f988da,0x831153b5)
WORD64(0x983e5152,0xee66dfab, 0xa831c66d,0x2db43210)
WORD64(0xb00327c8,0x98fb213f, 0xbf597fc7,0xbeef0ee4)
WORD64(0xc6e00bf3,0x3da88fc2, 0xd5a79147,0x930aa725)
WORD64(0x06ca6351,0xe003826f, 0x14292967,0x0a0e6e70)
WORD64(0x27b70a85,0x46d22ffc, 0x2e1b2138,0x5c26c926)
WORD64(0x4d2c6dfc,0x5ac42aed, 0x53380d13,0x9d95b3df)
WORD64(0x650a7354,0x8baf63de, 0x766a0abb,0x3c77b2a8)
WORD64(0x81c2c92e,0x47edaee6, 0x92722c85,0x1482353b)
WORD64(0xa2bfe8a1,0x4cf10364, 0xa81a664b,0xbc423001)
WORD64(0xc24b8b70,0xd0f89791, 0xc76c51a3,0x0654be30)
WORD64(0xd192e819,0xd6ef5218, 0xd6990624,0x5565a910)
WORD64(0xf40e3585,0x5771202a, 0x106aa070,0x32bbd1b8)
WORD64(0x19a4c116,0xb8d2d0c8, 0x1e376c08,0x5141ab53)
WORD64(0x2748774c,0xdf8eeb99, 0x34b0bcb5,0xe19b48a8)
WORD64(0x391c0cb3,0xc5c95a63, 0x4ed8aa4a,0xe3418acb)
WORD64(0x5b9cca4f,0x7763e373, 0x682e6ff3,0xd6b2b8a3)
WORD64(0x748f82ee,0x5defb2fc, 0x78a5636f,0x43172f60)
WORD64(0x84c87814,0xa1f0ab72, 0x8cc70208,0x1a6439ec)
WORD64(0x90befffa,0x23631e28, 0xa4506ceb,0xde82bde9)
WORD64(0xbef9a3f7,0xb2c67915, 0xc67178f2,0xe372532b)
WORD64(0xca273ece,0xea26619c, 0xd186b8c7,0x21c0c207)
WORD64(0xeada7dd6,0xcde0eb1e, 0xf57d4f7f,0xee6ed178)
WORD64(0x06f067aa,0x72176fba, 0x0a637dc5,0xa2c898a6)
WORD64(0x113f9804,0xbef90dae, 0x1b710b35,0x131c471b)
WORD64(0x28db77f5,0x23047d84, 0x32caab7b,0x40c72493)
WORD64(0x3c9ebe0a,0x15c9bebc, 0x431d67c4,0x9c100d4c)
WORD64(0x4cc5d4be,0xcb3e42b6, 0x597f299c,0xfc657e2a)
WORD64(0x5fcb6fab,0x3ad6faec, 0x6c44198c,0x4a475817)
.size K512,.-K512
.LOPENSSL_armcap:
.word OPENSSL_armcap_P-sha512_block_data_order
.skip 32-4
.global sha512_block_data_order
.type sha512_block_data_order,%function
sha512_block_data_order:
sub r3,pc,#8 @ sha512_block_data_order
add $len,$inp,$len,lsl#7 @ len to point at the end of inp
#if __ARM_ARCH__>=7
ldr r12,.LOPENSSL_armcap
ldr r12,[r3,r12] @ OPENSSL_armcap_P
tst r12,#1
bne .LNEON
#endif
stmdb sp!,{r4-r12,lr}
sub $Ktbl,r3,#672 @ K512
sub sp,sp,#9*8
ldr $Elo,[$ctx,#$Eoff+$lo]
ldr $Ehi,[$ctx,#$Eoff+$hi]
ldr $t0, [$ctx,#$Goff+$lo]
ldr $t1, [$ctx,#$Goff+$hi]
ldr $t2, [$ctx,#$Hoff+$lo]
ldr $t3, [$ctx,#$Hoff+$hi]
.Loop:
str $t0, [sp,#$Goff+0]
str $t1, [sp,#$Goff+4]
str $t2, [sp,#$Hoff+0]
str $t3, [sp,#$Hoff+4]
ldr $Alo,[$ctx,#$Aoff+$lo]
ldr $Ahi,[$ctx,#$Aoff+$hi]
ldr $Tlo,[$ctx,#$Boff+$lo]
ldr $Thi,[$ctx,#$Boff+$hi]
ldr $t0, [$ctx,#$Coff+$lo]
ldr $t1, [$ctx,#$Coff+$hi]
ldr $t2, [$ctx,#$Doff+$lo]
ldr $t3, [$ctx,#$Doff+$hi]
str $Tlo,[sp,#$Boff+0]
str $Thi,[sp,#$Boff+4]
str $t0, [sp,#$Coff+0]
str $t1, [sp,#$Coff+4]
str $t2, [sp,#$Doff+0]
str $t3, [sp,#$Doff+4]
ldr $Tlo,[$ctx,#$Foff+$lo]
ldr $Thi,[$ctx,#$Foff+$hi]
str $Tlo,[sp,#$Foff+0]
str $Thi,[sp,#$Foff+4]
.L00_15:
#if __ARM_ARCH__<7
ldrb $Tlo,[$inp,#7]
ldrb $t0, [$inp,#6]
ldrb $t1, [$inp,#5]
ldrb $t2, [$inp,#4]
ldrb $Thi,[$inp,#3]
ldrb $t3, [$inp,#2]
orr $Tlo,$Tlo,$t0,lsl#8
ldrb $t0, [$inp,#1]
orr $Tlo,$Tlo,$t1,lsl#16
ldrb $t1, [$inp],#8
orr $Tlo,$Tlo,$t2,lsl#24
orr $Thi,$Thi,$t3,lsl#8
orr $Thi,$Thi,$t0,lsl#16
orr $Thi,$Thi,$t1,lsl#24
#else
ldr $Tlo,[$inp,#4]
ldr $Thi,[$inp],#8
#ifdef __ARMEL__
rev $Tlo,$Tlo
rev $Thi,$Thi
#endif
#endif
___
&BODY_00_15(0x94);
$code.=<<___;
tst $Ktbl,#1
beq .L00_15
ldr $t0,[sp,#`$Xoff+8*(16-1)`+0]
ldr $t1,[sp,#`$Xoff+8*(16-1)`+4]
bic $Ktbl,$Ktbl,#1
.L16_79:
@ sigma0(x) (ROTR((x),1) ^ ROTR((x),8) ^ ((x)>>7))
@ LO lo>>1^hi<<31 ^ lo>>8^hi<<24 ^ lo>>7^hi<<25
@ HI hi>>1^lo<<31 ^ hi>>8^lo<<24 ^ hi>>7
mov $Tlo,$t0,lsr#1
ldr $t2,[sp,#`$Xoff+8*(16-14)`+0]
mov $Thi,$t1,lsr#1
ldr $t3,[sp,#`$Xoff+8*(16-14)`+4]
eor $Tlo,$Tlo,$t1,lsl#31
eor $Thi,$Thi,$t0,lsl#31
eor $Tlo,$Tlo,$t0,lsr#8
eor $Thi,$Thi,$t1,lsr#8
eor $Tlo,$Tlo,$t1,lsl#24
eor $Thi,$Thi,$t0,lsl#24
eor $Tlo,$Tlo,$t0,lsr#7
eor $Thi,$Thi,$t1,lsr#7
eor $Tlo,$Tlo,$t1,lsl#25
@ sigma1(x) (ROTR((x),19) ^ ROTR((x),61) ^ ((x)>>6))
@ LO lo>>19^hi<<13 ^ hi>>29^lo<<3 ^ lo>>6^hi<<26
@ HI hi>>19^lo<<13 ^ lo>>29^hi<<3 ^ hi>>6
mov $t0,$t2,lsr#19
mov $t1,$t3,lsr#19
eor $t0,$t0,$t3,lsl#13
eor $t1,$t1,$t2,lsl#13
eor $t0,$t0,$t3,lsr#29
eor $t1,$t1,$t2,lsr#29
eor $t0,$t0,$t2,lsl#3
eor $t1,$t1,$t3,lsl#3
eor $t0,$t0,$t2,lsr#6
eor $t1,$t1,$t3,lsr#6
ldr $t2,[sp,#`$Xoff+8*(16-9)`+0]
eor $t0,$t0,$t3,lsl#26
ldr $t3,[sp,#`$Xoff+8*(16-9)`+4]
adds $Tlo,$Tlo,$t0
ldr $t0,[sp,#`$Xoff+8*16`+0]
adc $Thi,$Thi,$t1
ldr $t1,[sp,#`$Xoff+8*16`+4]
adds $Tlo,$Tlo,$t2
adc $Thi,$Thi,$t3
adds $Tlo,$Tlo,$t0
adc $Thi,$Thi,$t1
___
&BODY_00_15(0x17);
$code.=<<___;
ldreq $t0,[sp,#`$Xoff+8*(16-1)`+0]
ldreq $t1,[sp,#`$Xoff+8*(16-1)`+4]
beq .L16_79
bic $Ktbl,$Ktbl,#1
ldr $Tlo,[sp,#$Boff+0]
ldr $Thi,[sp,#$Boff+4]
ldr $t0, [$ctx,#$Aoff+$lo]
ldr $t1, [$ctx,#$Aoff+$hi]
ldr $t2, [$ctx,#$Boff+$lo]
ldr $t3, [$ctx,#$Boff+$hi]
adds $t0,$Alo,$t0
str $t0, [$ctx,#$Aoff+$lo]
adc $t1,$Ahi,$t1
str $t1, [$ctx,#$Aoff+$hi]
adds $t2,$Tlo,$t2
str $t2, [$ctx,#$Boff+$lo]
adc $t3,$Thi,$t3
str $t3, [$ctx,#$Boff+$hi]
ldr $Alo,[sp,#$Coff+0]
ldr $Ahi,[sp,#$Coff+4]
ldr $Tlo,[sp,#$Doff+0]
ldr $Thi,[sp,#$Doff+4]
ldr $t0, [$ctx,#$Coff+$lo]
ldr $t1, [$ctx,#$Coff+$hi]
ldr $t2, [$ctx,#$Doff+$lo]
ldr $t3, [$ctx,#$Doff+$hi]
adds $t0,$Alo,$t0
str $t0, [$ctx,#$Coff+$lo]
adc $t1,$Ahi,$t1
str $t1, [$ctx,#$Coff+$hi]
adds $t2,$Tlo,$t2
str $t2, [$ctx,#$Doff+$lo]
adc $t3,$Thi,$t3
str $t3, [$ctx,#$Doff+$hi]
ldr $Tlo,[sp,#$Foff+0]
ldr $Thi,[sp,#$Foff+4]
ldr $t0, [$ctx,#$Eoff+$lo]
ldr $t1, [$ctx,#$Eoff+$hi]
ldr $t2, [$ctx,#$Foff+$lo]
ldr $t3, [$ctx,#$Foff+$hi]
adds $Elo,$Elo,$t0
str $Elo,[$ctx,#$Eoff+$lo]
adc $Ehi,$Ehi,$t1
str $Ehi,[$ctx,#$Eoff+$hi]
adds $t2,$Tlo,$t2
str $t2, [$ctx,#$Foff+$lo]
adc $t3,$Thi,$t3
str $t3, [$ctx,#$Foff+$hi]
ldr $Alo,[sp,#$Goff+0]
ldr $Ahi,[sp,#$Goff+4]
ldr $Tlo,[sp,#$Hoff+0]
ldr $Thi,[sp,#$Hoff+4]
ldr $t0, [$ctx,#$Goff+$lo]
ldr $t1, [$ctx,#$Goff+$hi]
ldr $t2, [$ctx,#$Hoff+$lo]
ldr $t3, [$ctx,#$Hoff+$hi]
adds $t0,$Alo,$t0
str $t0, [$ctx,#$Goff+$lo]
adc $t1,$Ahi,$t1
str $t1, [$ctx,#$Goff+$hi]
adds $t2,$Tlo,$t2
str $t2, [$ctx,#$Hoff+$lo]
adc $t3,$Thi,$t3
str $t3, [$ctx,#$Hoff+$hi]
add sp,sp,#640
sub $Ktbl,$Ktbl,#640
teq $inp,$len
bne .Loop
add sp,sp,#8*9 @ destroy frame
#if __ARM_ARCH__>=5
ldmia sp!,{r4-r12,pc}
#else
ldmia sp!,{r4-r12,lr}
tst lr,#1
moveq pc,lr @ be binary compatible with V4, yet
bx lr @ interoperable with Thumb ISA:-)
#endif
___
{
my @Sigma0=(28,34,39);
my @Sigma1=(14,18,41);
my @sigma0=(1, 8, 7);
my @sigma1=(19,61,6);
my $Ktbl="r3";
my $cnt="r12"; # volatile register known as ip, intra-procedure-call scratch
my @X=map("d$_",(0..15));
my @V=($A,$B,$C,$D,$E,$F,$G,$H)=map("d$_",(16..23));
sub NEON_00_15() {
my $i=shift;
my ($a,$b,$c,$d,$e,$f,$g,$h)=@_;
my ($t0,$t1,$t2,$T1,$K,$Ch,$Maj)=map("d$_",(24..31)); # temps
$code.=<<___ if ($i<16 || $i&1);
vshr.u64 $t0,$e,#@Sigma1[0] @ $i
#if $i<16
vld1.64 {@X[$i%16]},[$inp]! @ handles unaligned
#endif
vshr.u64 $t1,$e,#@Sigma1[1]
vshr.u64 $t2,$e,#@Sigma1[2]
___
$code.=<<___;
vld1.64 {$K},[$Ktbl,:64]! @ K[i++]
vsli.64 $t0,$e,#`64-@Sigma1[0]`
vsli.64 $t1,$e,#`64-@Sigma1[1]`
vsli.64 $t2,$e,#`64-@Sigma1[2]`
#if $i<16 && defined(__ARMEL__)
vrev64.8 @X[$i],@X[$i]
#endif
vadd.i64 $T1,$K,$h
veor $Ch,$f,$g
veor $t0,$t1
vand $Ch,$e
veor $t0,$t2 @ Sigma1(e)
veor $Ch,$g @ Ch(e,f,g)
vadd.i64 $T1,$t0
vshr.u64 $t0,$a,#@Sigma0[0]
vadd.i64 $T1,$Ch
vshr.u64 $t1,$a,#@Sigma0[1]
vshr.u64 $t2,$a,#@Sigma0[2]
vsli.64 $t0,$a,#`64-@Sigma0[0]`
vsli.64 $t1,$a,#`64-@Sigma0[1]`
vsli.64 $t2,$a,#`64-@Sigma0[2]`
vadd.i64 $T1,@X[$i%16]
vorr $Maj,$a,$c
vand $Ch,$a,$c
veor $h,$t0,$t1
vand $Maj,$b
veor $h,$t2 @ Sigma0(a)
vorr $Maj,$Ch @ Maj(a,b,c)
vadd.i64 $h,$T1
vadd.i64 $d,$T1
vadd.i64 $h,$Maj
___
}
sub NEON_16_79() {
my $i=shift;
if ($i&1) { &NEON_00_15($i,@_); return; }
# 2x-vectorized, therefore runs every 2nd round
my @X=map("q$_",(0..7)); # view @X as 128-bit vector
my ($t0,$t1,$s0,$s1) = map("q$_",(12..15)); # temps
my ($d0,$d1,$d2) = map("d$_",(24..26)); # temps from NEON_00_15
my $e=@_[4]; # $e from NEON_00_15
$i /= 2;
$code.=<<___;
vshr.u64 $t0,@X[($i+7)%8],#@sigma1[0]
vshr.u64 $t1,@X[($i+7)%8],#@sigma1[1]
vshr.u64 $s1,@X[($i+7)%8],#@sigma1[2]
vsli.64 $t0,@X[($i+7)%8],#`64-@sigma1[0]`
vext.8 $s0,@X[$i%8],@X[($i+1)%8],#8 @ X[i+1]
vsli.64 $t1,@X[($i+7)%8],#`64-@sigma1[1]`
veor $s1,$t0
vshr.u64 $t0,$s0,#@sigma0[0]
veor $s1,$t1 @ sigma1(X[i+14])
vshr.u64 $t1,$s0,#@sigma0[1]
vadd.i64 @X[$i%8],$s1
vshr.u64 $s1,$s0,#@sigma0[2]
vsli.64 $t0,$s0,#`64-@sigma0[0]`
vsli.64 $t1,$s0,#`64-@sigma0[1]`
vext.8 $s0,@X[($i+4)%8],@X[($i+5)%8],#8 @ X[i+9]
veor $s1,$t0
vshr.u64 $d0,$e,#@Sigma1[0] @ from NEON_00_15
vadd.i64 @X[$i%8],$s0
vshr.u64 $d1,$e,#@Sigma1[1] @ from NEON_00_15
veor $s1,$t1 @ sigma0(X[i+1])
vshr.u64 $d2,$e,#@Sigma1[2] @ from NEON_00_15
vadd.i64 @X[$i%8],$s1
___
&NEON_00_15(2*$i,@_);
}
$code.=<<___;
#if __ARM_ARCH__>=7
.fpu neon
.align 4
.LNEON:
dmb @ errata #451034 on early Cortex A8
vstmdb sp!,{d8-d15} @ ABI specification says so
sub $Ktbl,r3,#672 @ K512
vldmia $ctx,{$A-$H} @ load context
.Loop_neon:
___
for($i=0;$i<16;$i++) { &NEON_00_15($i,@V); unshift(@V,pop(@V)); }
$code.=<<___;
mov $cnt,#4
.L16_79_neon:
subs $cnt,#1
___
for(;$i<32;$i++) { &NEON_16_79($i,@V); unshift(@V,pop(@V)); }
$code.=<<___;
bne .L16_79_neon
vldmia $ctx,{d24-d31} @ load context to temp
vadd.i64 q8,q12 @ vectorized accumulate
vadd.i64 q9,q13
vadd.i64 q10,q14
vadd.i64 q11,q15
vstmia $ctx,{$A-$H} @ save context
teq $inp,$len
sub $Ktbl,#640 @ rewind K512
bne .Loop_neon
vldmia sp!,{d8-d15} @ epilogue
bx lr
#endif
___
}
$code.=<<___;
.size sha512_block_data_order,.-sha512_block_data_order
.asciz "SHA512 block transform for ARMv4/NEON, CRYPTOGAMS by <appro\@openssl.org>"
.align 2
.comm OPENSSL_armcap_P,4,4
___
$code =~ s/\`([^\`]*)\`/eval $1/gem;
$code =~ s/\bbx\s+lr\b/.word\t0xe12fff1e/gm; # make it possible to compile with -march=armv4
print $code;
close STDOUT; # enforce flush
|
{
"pile_set_name": "Github"
}
|
# jmxmon 简介
jmxmon是一个基于open-falcon的jmx监控插件,通过这个插件,结合open-falcon agent,可以采集任何开启了JMX服务端口的java进程的服务状态,并将采集信息自动上报给open-falcon服务端
## 主要功能
通过jmx采集java进程的jvm信息,包括gc耗时、gc次数、gc吞吐、老年代使用率、新生代晋升大小、活跃线程数等信息。
对应用程序代码无侵入,几乎不占用系统资源。
## 采集指标
| Counters | Type | Notes|
|-----|------|------|
| parnew.gc.avg.time | GAUGE | 一分钟内,每次YoungGC(parnew)的平均耗时 |
| concurrentmarksweep.gc.avg.time | GAUGE | 一分钟内,每次CMSGC的平均耗时 |
| parnew.gc.count | GAUGE | 一分钟内,YoungGC(parnew)的总次数 |
| concurrentmarksweep.gc.count | GAUGE | 一分钟内,CMSGC的总次数 |
| gc.throughput | GAUGE | GC的总吞吐率(应用运行时间/进程总运行时间) |
| new.gen.promotion | GAUGE | 一分钟内,新生代的内存晋升总大小 |
| new.gen.avg.promotion | GAUGE | 一分钟内,平均每次YoungGC的新生代内存晋升大小 |
| old.gen.mem.used | GAUGE | 老年代的内存使用量 |
| old.gen.mem.ratio | GAUGE | 老年代的内存使用率 |
| thread.active.count | GAUGE | 当前活跃线程数 |
| thread.peak.count | GAUGE | 峰值线程数 |
## 建议设置监控告警项
不同应用根据其特点,可以灵活调整触发条件及触发阈值
| 告警项 | 触发条件 | 备注|
|-----|------|------|
| gc.throughput | all(#3)<98 | gc吞吐率低于98%,影响性能 |
| old.gen.mem.ratio | all(#3)>90 | 老年代内存使用率高于90%,需要调优 |
| thread.active.count | all(#3)>500 | 线程数过多,影响性能 |
# 使用帮助
详细的使用方法常见:[jmxmon](https://github.com/toomanyopenfiles/jmxmon)
|
{
"pile_set_name": "Github"
}
|
{
"bbox": [
-180.3460693359375,
-17.16703442146408,
-179.5770263671875,
-16.48349760264812
],
"cellSide": 10,
"units": "miles"
}
|
{
"pile_set_name": "Github"
}
|
import { module, test } from '../qunit';
import moment from '../../moment';
module('add and subtract');
test('add short reverse args', function (assert) {
var a = moment(), b, c, d;
a.year(2011);
a.month(9);
a.date(12);
a.hours(6);
a.minutes(7);
a.seconds(8);
a.milliseconds(500);
assert.equal(a.add({ms: 50}).milliseconds(), 550, 'Add milliseconds');
assert.equal(a.add({s: 1}).seconds(), 9, 'Add seconds');
assert.equal(a.add({m: 1}).minutes(), 8, 'Add minutes');
assert.equal(a.add({h: 1}).hours(), 7, 'Add hours');
assert.equal(a.add({d: 1}).date(), 13, 'Add date');
assert.equal(a.add({w: 1}).date(), 20, 'Add week');
assert.equal(a.add({M: 1}).month(), 10, 'Add month');
assert.equal(a.add({y: 1}).year(), 2012, 'Add year');
assert.equal(a.add({Q: 1}).month(), 1, 'Add quarter');
b = moment([2010, 0, 31]).add({M: 1});
c = moment([2010, 1, 28]).subtract({M: 1});
d = moment([2010, 1, 28]).subtract({Q: 1});
assert.equal(b.month(), 1, 'add month, jan 31st to feb 28th');
assert.equal(b.date(), 28, 'add month, jan 31st to feb 28th');
assert.equal(c.month(), 0, 'subtract month, feb 28th to jan 28th');
assert.equal(c.date(), 28, 'subtract month, feb 28th to jan 28th');
assert.equal(d.month(), 10, 'subtract quarter, feb 28th 2010 to nov 28th 2009');
assert.equal(d.date(), 28, 'subtract quarter, feb 28th 2010 to nov 28th 2009');
assert.equal(d.year(), 2009, 'subtract quarter, feb 28th 2010 to nov 28th 2009');
});
test('add long reverse args', function (assert) {
var a = moment();
a.year(2011);
a.month(9);
a.date(12);
a.hours(6);
a.minutes(7);
a.seconds(8);
a.milliseconds(500);
assert.equal(a.add({milliseconds: 50}).milliseconds(), 550, 'Add milliseconds');
assert.equal(a.add({seconds: 1}).seconds(), 9, 'Add seconds');
assert.equal(a.add({minutes: 1}).minutes(), 8, 'Add minutes');
assert.equal(a.add({hours: 1}).hours(), 7, 'Add hours');
assert.equal(a.add({days: 1}).date(), 13, 'Add date');
assert.equal(a.add({weeks: 1}).date(), 20, 'Add week');
assert.equal(a.add({months: 1}).month(), 10, 'Add month');
assert.equal(a.add({years: 1}).year(), 2012, 'Add year');
assert.equal(a.add({quarters: 1}).month(), 1, 'Add quarter');
});
test('add long singular reverse args', function (assert) {
var a = moment();
a.year(2011);
a.month(9);
a.date(12);
a.hours(6);
a.minutes(7);
a.seconds(8);
a.milliseconds(500);
assert.equal(a.add({millisecond: 50}).milliseconds(), 550, 'Add milliseconds');
assert.equal(a.add({second: 1}).seconds(), 9, 'Add seconds');
assert.equal(a.add({minute: 1}).minutes(), 8, 'Add minutes');
assert.equal(a.add({hour: 1}).hours(), 7, 'Add hours');
assert.equal(a.add({day: 1}).date(), 13, 'Add date');
assert.equal(a.add({week: 1}).date(), 20, 'Add week');
assert.equal(a.add({month: 1}).month(), 10, 'Add month');
assert.equal(a.add({year: 1}).year(), 2012, 'Add year');
assert.equal(a.add({quarter: 1}).month(), 1, 'Add quarter');
});
test('add string long reverse args', function (assert) {
var a = moment(), b;
a.year(2011);
a.month(9);
a.date(12);
a.hours(6);
a.minutes(7);
a.seconds(8);
a.milliseconds(500);
b = a.clone();
assert.equal(a.add('millisecond', 50).milliseconds(), 550, 'Add milliseconds');
assert.equal(a.add('second', 1).seconds(), 9, 'Add seconds');
assert.equal(a.add('minute', 1).minutes(), 8, 'Add minutes');
assert.equal(a.add('hour', 1).hours(), 7, 'Add hours');
assert.equal(a.add('day', 1).date(), 13, 'Add date');
assert.equal(a.add('week', 1).date(), 20, 'Add week');
assert.equal(a.add('month', 1).month(), 10, 'Add month');
assert.equal(a.add('year', 1).year(), 2012, 'Add year');
assert.equal(b.add('day', '01').date(), 13, 'Add date');
assert.equal(a.add('quarter', 1).month(), 1, 'Add quarter');
});
test('add string long singular reverse args', function (assert) {
var a = moment(), b;
a.year(2011);
a.month(9);
a.date(12);
a.hours(6);
a.minutes(7);
a.seconds(8);
a.milliseconds(500);
b = a.clone();
assert.equal(a.add('milliseconds', 50).milliseconds(), 550, 'Add milliseconds');
assert.equal(a.add('seconds', 1).seconds(), 9, 'Add seconds');
assert.equal(a.add('minutes', 1).minutes(), 8, 'Add minutes');
assert.equal(a.add('hours', 1).hours(), 7, 'Add hours');
assert.equal(a.add('days', 1).date(), 13, 'Add date');
assert.equal(a.add('weeks', 1).date(), 20, 'Add week');
assert.equal(a.add('months', 1).month(), 10, 'Add month');
assert.equal(a.add('years', 1).year(), 2012, 'Add year');
assert.equal(b.add('days', '01').date(), 13, 'Add date');
assert.equal(a.add('quarters', 1).month(), 1, 'Add quarter');
});
test('add string short reverse args', function (assert) {
var a = moment();
a.year(2011);
a.month(9);
a.date(12);
a.hours(6);
a.minutes(7);
a.seconds(8);
a.milliseconds(500);
assert.equal(a.add('ms', 50).milliseconds(), 550, 'Add milliseconds');
assert.equal(a.add('s', 1).seconds(), 9, 'Add seconds');
assert.equal(a.add('m', 1).minutes(), 8, 'Add minutes');
assert.equal(a.add('h', 1).hours(), 7, 'Add hours');
assert.equal(a.add('d', 1).date(), 13, 'Add date');
assert.equal(a.add('w', 1).date(), 20, 'Add week');
assert.equal(a.add('M', 1).month(), 10, 'Add month');
assert.equal(a.add('y', 1).year(), 2012, 'Add year');
assert.equal(a.add('Q', 1).month(), 1, 'Add quarter');
});
test('add string long', function (assert) {
var a = moment();
a.year(2011);
a.month(9);
a.date(12);
a.hours(6);
a.minutes(7);
a.seconds(8);
a.milliseconds(500);
assert.equal(a.add(50, 'millisecond').milliseconds(), 550, 'Add milliseconds');
assert.equal(a.add(1, 'second').seconds(), 9, 'Add seconds');
assert.equal(a.add(1, 'minute').minutes(), 8, 'Add minutes');
assert.equal(a.add(1, 'hour').hours(), 7, 'Add hours');
assert.equal(a.add(1, 'day').date(), 13, 'Add date');
assert.equal(a.add(1, 'week').date(), 20, 'Add week');
assert.equal(a.add(1, 'month').month(), 10, 'Add month');
assert.equal(a.add(1, 'year').year(), 2012, 'Add year');
assert.equal(a.add(1, 'quarter').month(), 1, 'Add quarter');
});
test('add string long singular', function (assert) {
var a = moment();
a.year(2011);
a.month(9);
a.date(12);
a.hours(6);
a.minutes(7);
a.seconds(8);
a.milliseconds(500);
assert.equal(a.add(50, 'milliseconds').milliseconds(), 550, 'Add milliseconds');
assert.equal(a.add(1, 'seconds').seconds(), 9, 'Add seconds');
assert.equal(a.add(1, 'minutes').minutes(), 8, 'Add minutes');
assert.equal(a.add(1, 'hours').hours(), 7, 'Add hours');
assert.equal(a.add(1, 'days').date(), 13, 'Add date');
assert.equal(a.add(1, 'weeks').date(), 20, 'Add week');
assert.equal(a.add(1, 'months').month(), 10, 'Add month');
assert.equal(a.add(1, 'years').year(), 2012, 'Add year');
assert.equal(a.add(1, 'quarters').month(), 1, 'Add quarter');
});
test('add string short', function (assert) {
var a = moment();
a.year(2011);
a.month(9);
a.date(12);
a.hours(6);
a.minutes(7);
a.seconds(8);
a.milliseconds(500);
assert.equal(a.add(50, 'ms').milliseconds(), 550, 'Add milliseconds');
assert.equal(a.add(1, 's').seconds(), 9, 'Add seconds');
assert.equal(a.add(1, 'm').minutes(), 8, 'Add minutes');
assert.equal(a.add(1, 'h').hours(), 7, 'Add hours');
assert.equal(a.add(1, 'd').date(), 13, 'Add date');
assert.equal(a.add(1, 'w').date(), 20, 'Add week');
assert.equal(a.add(1, 'M').month(), 10, 'Add month');
assert.equal(a.add(1, 'y').year(), 2012, 'Add year');
assert.equal(a.add(1, 'Q').month(), 1, 'Add quarter');
});
test('add strings string short args', function (assert) {
var a = moment();
a.year(2011);
a.month(9);
a.date(12);
a.hours(6);
a.minutes(7);
a.seconds(8);
a.milliseconds(500);
assert.equal(a.add('ms', '50').milliseconds(), 550, 'Add milliseconds');
assert.equal(a.add('s', '1').seconds(), 9, 'Add seconds');
assert.equal(a.add('m', '1').minutes(), 8, 'Add minutes');
assert.equal(a.add('h', '1').hours(), 7, 'Add hours');
assert.equal(a.add('d', '1').date(), 13, 'Add date');
assert.equal(a.add('w', '1').date(), 20, 'Add week');
assert.equal(a.add('M', '1').month(), 10, 'Add month');
assert.equal(a.add('y', '1').year(), 2012, 'Add year');
assert.equal(a.add('Q', '1').month(), 1, 'Add quarter');
});
test('subtract strings string short args', function (assert) {
var a = moment();
a.year(2011);
a.month(9);
a.date(12);
a.hours(6);
a.minutes(7);
a.seconds(8);
a.milliseconds(500);
assert.equal(a.subtract('ms', '50').milliseconds(), 450, 'Subtract milliseconds');
assert.equal(a.subtract('s', '1').seconds(), 7, 'Subtract seconds');
assert.equal(a.subtract('m', '1').minutes(), 6, 'Subtract minutes');
assert.equal(a.subtract('h', '1').hours(), 5, 'Subtract hours');
assert.equal(a.subtract('d', '1').date(), 11, 'Subtract date');
assert.equal(a.subtract('w', '1').date(), 4, 'Subtract week');
assert.equal(a.subtract('M', '1').month(), 8, 'Subtract month');
assert.equal(a.subtract('y', '1').year(), 2010, 'Subtract year');
assert.equal(a.subtract('Q', '1').month(), 5, 'Subtract quarter');
});
test('add strings string short', function (assert) {
var a = moment();
a.year(2011);
a.month(9);
a.date(12);
a.hours(6);
a.minutes(7);
a.seconds(8);
a.milliseconds(500);
assert.equal(a.add('50', 'ms').milliseconds(), 550, 'Add milliseconds');
assert.equal(a.add('1', 's').seconds(), 9, 'Add seconds');
assert.equal(a.add('1', 'm').minutes(), 8, 'Add minutes');
assert.equal(a.add('1', 'h').hours(), 7, 'Add hours');
assert.equal(a.add('1', 'd').date(), 13, 'Add date');
assert.equal(a.add('1', 'w').date(), 20, 'Add week');
assert.equal(a.add('1', 'M').month(), 10, 'Add month');
assert.equal(a.add('1', 'y').year(), 2012, 'Add year');
assert.equal(a.add('1', 'Q').month(), 1, 'Add quarter');
});
test('subtract strings string short', function (assert) {
var a = moment();
a.year(2011);
a.month(9);
a.date(12);
a.hours(6);
a.minutes(7);
a.seconds(8);
a.milliseconds(500);
assert.equal(a.subtract('50', 'ms').milliseconds(), 450, 'Subtract milliseconds');
assert.equal(a.subtract('1', 's').seconds(), 7, 'Subtract seconds');
assert.equal(a.subtract('1', 'm').minutes(), 6, 'Subtract minutes');
assert.equal(a.subtract('1', 'h').hours(), 5, 'Subtract hours');
assert.equal(a.subtract('1', 'd').date(), 11, 'Subtract date');
assert.equal(a.subtract('1', 'w').date(), 4, 'Subtract week');
assert.equal(a.subtract('1', 'M').month(), 8, 'Subtract month');
assert.equal(a.subtract('1', 'y').year(), 2010, 'Subtract year');
assert.equal(a.subtract('1', 'Q').month(), 5, 'Subtract quarter');
});
test('add across DST', function (assert) {
// Detect Safari bug and bail. Hours on 13th March 2011 are shifted
// with 1 ahead.
if (new Date(2011, 2, 13, 5, 0, 0).getHours() !== 5) {
return;
}
var a = moment(new Date(2011, 2, 12, 5, 0, 0)),
b = moment(new Date(2011, 2, 12, 5, 0, 0)),
c = moment(new Date(2011, 2, 12, 5, 0, 0)),
d = moment(new Date(2011, 2, 12, 5, 0, 0)),
e = moment(new Date(2011, 2, 12, 5, 0, 0));
a.add(1, 'days');
b.add(24, 'hours');
c.add(1, 'months');
e.add(1, 'quarter');
assert.equal(a.hours(), 5, 'adding days over DST difference should result in the same hour');
if (b.isDST() && !d.isDST()) {
assert.equal(b.hours(), 6, 'adding hours over DST difference should result in a different hour');
} else if (!b.isDST() && d.isDST()) {
assert.equal(b.hours(), 4, 'adding hours over DST difference should result in a different hour');
} else {
assert.equal(b.hours(), 5, 'adding hours over DST difference should result in a same hour if the timezone does not have daylight savings time');
}
assert.equal(c.hours(), 5, 'adding months over DST difference should result in the same hour');
assert.equal(e.hours(), 5, 'adding quarters over DST difference should result in the same hour');
});
|
{
"pile_set_name": "Github"
}
|
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objects = {
/* Begin PBXBuildFile section */
922A1768228C152D008D0B38 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 922A1767228C152D008D0B38 /* AppDelegate.m */; };
922A176B228C152D008D0B38 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 922A176A228C152D008D0B38 /* ViewController.m */; };
922A176E228C152D008D0B38 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 922A176C228C152D008D0B38 /* Main.storyboard */; };
922A1770228C152F008D0B38 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 922A176F228C152F008D0B38 /* Assets.xcassets */; };
922A1773228C152F008D0B38 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 922A1771228C152F008D0B38 /* LaunchScreen.storyboard */; };
922A1776228C152F008D0B38 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 922A1775228C152F008D0B38 /* main.m */; };
922A177D228C19AD008D0B38 /* poc.m in Sources */ = {isa = PBXBuildFile; fileRef = 922A177C228C19AD008D0B38 /* poc.m */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
922A1763228C152D008D0B38 /* MediaLibraryPoc.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MediaLibraryPoc.app; sourceTree = BUILT_PRODUCTS_DIR; };
922A1766228C152D008D0B38 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
922A1767228C152D008D0B38 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
922A1769228C152D008D0B38 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
922A176A228C152D008D0B38 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
922A176D228C152D008D0B38 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
922A176F228C152F008D0B38 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
922A1772228C152F008D0B38 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
922A1774228C152F008D0B38 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
922A1775228C152F008D0B38 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
922A177C228C19AD008D0B38 /* poc.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = poc.m; sourceTree = "<group>"; };
922A177E228C2290008D0B38 /* poc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = poc.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
922A1760228C152D008D0B38 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
922A175A228C152D008D0B38 = {
isa = PBXGroup;
children = (
922A1765228C152D008D0B38 /* Poc */,
922A1764228C152D008D0B38 /* Products */,
);
sourceTree = "<group>";
};
922A1764228C152D008D0B38 /* Products */ = {
isa = PBXGroup;
children = (
922A1763228C152D008D0B38 /* MediaLibraryPoc.app */,
);
name = Products;
sourceTree = "<group>";
};
922A1765228C152D008D0B38 /* Poc */ = {
isa = PBXGroup;
children = (
922A1766228C152D008D0B38 /* AppDelegate.h */,
922A1767228C152D008D0B38 /* AppDelegate.m */,
922A1769228C152D008D0B38 /* ViewController.h */,
922A176A228C152D008D0B38 /* ViewController.m */,
922A176C228C152D008D0B38 /* Main.storyboard */,
922A177C228C19AD008D0B38 /* poc.m */,
922A177E228C2290008D0B38 /* poc.h */,
922A176F228C152F008D0B38 /* Assets.xcassets */,
922A1771228C152F008D0B38 /* LaunchScreen.storyboard */,
922A1774228C152F008D0B38 /* Info.plist */,
922A1775228C152F008D0B38 /* main.m */,
);
path = Poc;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
922A1762228C152D008D0B38 /* MediaLibraryPoc */ = {
isa = PBXNativeTarget;
buildConfigurationList = 922A1779228C152F008D0B38 /* Build configuration list for PBXNativeTarget "MediaLibraryPoc" */;
buildPhases = (
922A175F228C152D008D0B38 /* Sources */,
922A1760228C152D008D0B38 /* Frameworks */,
922A1761228C152D008D0B38 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = MediaLibraryPoc;
productName = "CVE-2019-8577";
productReference = 922A1763228C152D008D0B38 /* MediaLibraryPoc.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
922A175B228C152D008D0B38 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1010;
ORGANIZATIONNAME = CodeColorist;
TargetAttributes = {
922A1762228C152D008D0B38 = {
CreatedOnToolsVersion = 10.1;
};
};
};
buildConfigurationList = 922A175E228C152D008D0B38 /* Build configuration list for PBXProject "MediaLibraryPoc" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 922A175A228C152D008D0B38;
productRefGroup = 922A1764228C152D008D0B38 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
922A1762228C152D008D0B38 /* MediaLibraryPoc */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
922A1761228C152D008D0B38 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
922A1773228C152F008D0B38 /* LaunchScreen.storyboard in Resources */,
922A1770228C152F008D0B38 /* Assets.xcassets in Resources */,
922A176E228C152D008D0B38 /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
922A175F228C152D008D0B38 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
922A176B228C152D008D0B38 /* ViewController.m in Sources */,
922A1776228C152F008D0B38 /* main.m in Sources */,
922A177D228C19AD008D0B38 /* poc.m in Sources */,
922A1768228C152D008D0B38 /* AppDelegate.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
922A176C228C152D008D0B38 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
922A176D228C152D008D0B38 /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
922A1771228C152F008D0B38 /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
922A1772228C152F008D0B38 /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
922A1777228C152F008D0B38 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.1;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
};
name = Debug;
};
922A1778228C152F008D0B38 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.1;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
922A177A228C152F008D0B38 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = JX8L3VHP22;
INFOPLIST_FILE = "$(SRCROOT)/Poc/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "me.chichou.medialibraryd-bug";
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
922A177B228C152F008D0B38 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = JX8L3VHP22;
INFOPLIST_FILE = "$(SRCROOT)/Poc/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "me.chichou.medialibraryd-bug";
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
922A175E228C152D008D0B38 /* Build configuration list for PBXProject "MediaLibraryPoc" */ = {
isa = XCConfigurationList;
buildConfigurations = (
922A1777228C152F008D0B38 /* Debug */,
922A1778228C152F008D0B38 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
922A1779228C152F008D0B38 /* Build configuration list for PBXNativeTarget "MediaLibraryPoc" */ = {
isa = XCConfigurationList;
buildConfigurations = (
922A177A228C152F008D0B38 /* Debug */,
922A177B228C152F008D0B38 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 922A175B228C152D008D0B38 /* Project object */;
}
|
{
"pile_set_name": "Github"
}
|
/*
+----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| [email protected] so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Michele Locati <[email protected]> |
+----------------------------------------------------------------------+
*/
#include "php.h"
#include "SAPI.h"
#include "win32/console.h"
PHP_WINUTIL_API BOOL php_win32_console_fileno_is_console(zend_long fileno)
{/*{{{*/
BOOL result = FALSE;
HANDLE handle = (HANDLE) _get_osfhandle(fileno);
if (handle != INVALID_HANDLE_VALUE) {
DWORD mode;
if (GetConsoleMode(handle, &mode)) {
result = TRUE;
}
}
return result;
}/*}}}*/
PHP_WINUTIL_API BOOL php_win32_console_fileno_has_vt100(zend_long fileno)
{/*{{{*/
BOOL result = FALSE;
HANDLE handle = (HANDLE) _get_osfhandle(fileno);
if (handle != INVALID_HANDLE_VALUE) {
DWORD events;
if (fileno != 0 && !GetNumberOfConsoleInputEvents(handle, &events)) {
// Not STDIN
DWORD mode;
if (GetConsoleMode(handle, &mode)) {
if (mode & ENABLE_VIRTUAL_TERMINAL_PROCESSING) {
result = TRUE;
}
}
}
}
return result;
}/*}}}*/
PHP_WINUTIL_API BOOL php_win32_console_fileno_set_vt100(zend_long fileno, BOOL enable)
{/*{{{*/
BOOL result = FALSE;
HANDLE handle = (HANDLE) _get_osfhandle(fileno);
if (handle != INVALID_HANDLE_VALUE) {
DWORD events;
if (fileno != 0 && !GetNumberOfConsoleInputEvents(handle, &events)) {
// Not STDIN
DWORD mode;
if (GetConsoleMode(handle, &mode)) {
DWORD newMode;
if (enable) {
newMode = mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING;
}
else {
newMode = mode & ~ENABLE_VIRTUAL_TERMINAL_PROCESSING;
}
if (newMode == mode) {
result = TRUE;
}
else {
if (SetConsoleMode(handle, newMode)) {
result = TRUE;
}
}
}
}
}
return result;
}/*}}}*/
PHP_WINUTIL_API BOOL php_win32_console_is_own(void)
{/*{{{*/
if (!IsDebuggerPresent()) {
CONSOLE_SCREEN_BUFFER_INFO csbi;
DWORD pl[1];
BOOL ret0 = FALSE, ret1 = FALSE;
if (GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi)) {
ret0 = !csbi.dwCursorPosition.X && !csbi.dwCursorPosition.Y;
}
ret1 = GetConsoleProcessList(pl, 1) == 1;
return ret0 && ret1;
}
return FALSE;
}/*}}}*/
PHP_WINUTIL_API BOOL php_win32_console_is_cli_sapi(void)
{/*{{{*/
return strlen(sapi_module.name) >= sizeof("cli") - 1 && !strncmp(sapi_module.name, "cli", sizeof("cli") - 1);
}/*}}}*/
|
{
"pile_set_name": "Github"
}
|
package revision
// token represents a entity extracted from string parsing
type token int
const (
eof token = iota
aslash
asterisk
at
caret
cbrace
colon
control
dot
emark
minus
number
obrace
obracket
qmark
slash
space
tilde
tokenError
word
)
|
{
"pile_set_name": "Github"
}
|
//=====================================================
// File : x86_perf_analyzer.hh
// Author : L. Plagne <[email protected])>
// Copyright (C) EDF R&D, mar d�c 3 18:59:35 CET 2002
//=====================================================
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
#ifndef _X86_PERF_ANALYSER_HH
#define _X86_PERF_ANALYSER_HH
#include "x86_timer.hh"
#include "bench_parameter.hh"
template<class ACTION>
class X86_Perf_Analyzer{
public:
X86_Perf_Analyzer( unsigned long long nb_sample=DEFAULT_NB_SAMPLE):_nb_sample(nb_sample),_chronos()
{
MESSAGE("X86_Perf_Analyzer Ctor");
_chronos.find_frequency();
};
X86_Perf_Analyzer( const X86_Perf_Analyzer & ){
INFOS("Copy Ctor not implemented");
exit(0);
};
~X86_Perf_Analyzer( void ){
MESSAGE("X86_Perf_Analyzer Dtor");
};
inline double eval_mflops(int size)
{
ACTION action(size);
int nb_loop=5;
double calculate_time=0.0;
double baseline_time=0.0;
for (int j=0 ; j < nb_loop ; j++){
_chronos.clear();
for(int i=0 ; i < _nb_sample ; i++)
{
_chronos.start();
action.initialize();
action.calculate();
_chronos.stop();
_chronos.add_get_click();
}
calculate_time += double(_chronos.get_shortest_clicks())/_chronos.frequency();
if (j==0) action.check_result();
_chronos.clear();
for(int i=0 ; i < _nb_sample ; i++)
{
_chronos.start();
action.initialize();
_chronos.stop();
_chronos.add_get_click();
}
baseline_time+=double(_chronos.get_shortest_clicks())/_chronos.frequency();
}
double corrected_time = (calculate_time-baseline_time)/double(nb_loop);
// INFOS("_nb_sample="<<_nb_sample);
// INFOS("baseline_time="<<baseline_time);
// INFOS("calculate_time="<<calculate_time);
// INFOS("corrected_time="<<corrected_time);
// cout << size <<" "<<baseline_time<<" "<<calculate_time<<" "<<corrected_time<<" "<<action.nb_op_base() << endl;
return action.nb_op_base()/(corrected_time*1000000.0);
//return action.nb_op_base()/(calculate_time*1000000.0);
}
private:
X86_Timer _chronos;
unsigned long long _nb_sample;
};
#endif
|
{
"pile_set_name": "Github"
}
|
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:RSTransitionEffectSample.xcodeproj">
</FileRef>
</Workspace>
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright ConsenSys AG.
*
* 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.
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods;
import org.hyperledger.besu.ethereum.api.jsonrpc.RpcMethod;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse;
import org.hyperledger.besu.ethereum.p2p.network.P2PNetwork;
import org.hyperledger.besu.ethereum.p2p.peers.DefaultPeer;
import org.hyperledger.besu.ethereum.p2p.peers.EnodeURL;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class AdminRemovePeer extends AdminModifyPeer {
private static final Logger LOG = LogManager.getLogger();
public AdminRemovePeer(final P2PNetwork peerNetwork) {
super(peerNetwork);
}
@Override
public String getName() {
return RpcMethod.ADMIN_REMOVE_PEER.getMethodName();
}
@Override
protected JsonRpcResponse performOperation(final Object id, final String enode) {
LOG.debug("Remove ({}) from peer cache", enode);
final EnodeURL enodeURL = EnodeURL.fromString(enode);
final boolean result =
peerNetwork.removeMaintainedConnectionPeer(DefaultPeer.fromEnodeURL(enodeURL));
return new JsonRpcSuccessResponse(id, result);
}
}
|
{
"pile_set_name": "Github"
}
|
// Copyright (c) Stride contributors (https://stride3d.net) and Sean Boettger <[email protected]>
// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Text;
using Stride.Core;
using Stride.Shaders;
using Stride.Rendering.Materials;
namespace Stride.Rendering.Voxels
{
[DataContract(DefaultMemberMode = DataMemberMode.Default)]
[Display("R11G11B10F")]
public class VoxelFragmentPackFloatR11G11B10 : IVoxelFragmentPacker
{
ShaderSource source = new ShaderClassSource("VoxelFragmentPackFloatR11G11B10");
public ShaderSource GetShader()
{
return source;
}
public int GetBits(int channels)
{
return ((channels+2) / 3)*32;//(channels)/3 * 32 + (channels % 3) * 11;
}
}
}
|
{
"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.
//! In-memory table scan operator to represent data that has already been loaded into memory. This
//! can be useful for testing and also for caching intermediate results in query plans.
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
use crate::arrow::datatypes::Schema;
use crate::error::Result;
use crate::execution::physical_plan::{
ColumnarBatch, ColumnarBatchIter, ColumnarBatchStream, ExecutionContext, ExecutionPlan,
};
use async_trait::async_trait;
/// In-memory table scan operator to represent data that has already been loaded into memory. This
/// can be useful for testing and also for caching intermediate results in query plans.
pub struct InMemoryTableScanExec {
data: Vec<ColumnarBatch>,
}
impl InMemoryTableScanExec {
pub fn new(data: Vec<ColumnarBatch>) -> Self {
Self { data }
}
}
#[async_trait]
impl ExecutionPlan for InMemoryTableScanExec {
fn schema(&self) -> Arc<Schema> {
self.data[0].schema()
}
async fn execute(
&self,
_ctx: Arc<dyn ExecutionContext>,
_partition_index: usize,
) -> Result<ColumnarBatchStream> {
Ok(Arc::new(InMemoryTableScanIter::new(self.data.clone())))
}
}
pub struct InMemoryTableScanIter {
index: Arc<AtomicUsize>,
data: Vec<ColumnarBatch>,
}
impl InMemoryTableScanIter {
fn new(data: Vec<ColumnarBatch>) -> Self {
Self {
index: Arc::new(AtomicUsize::new(0)),
data,
}
}
}
impl ColumnarBatchIter for InMemoryTableScanIter {
fn schema(&self) -> Arc<Schema> {
self.data[0].schema()
}
fn next(&self) -> Result<Option<ColumnarBatch>> {
let index = self.index.load(Ordering::SeqCst);
if index < self.data.len() {
self.index.store(index + 1, Ordering::SeqCst);
Ok(Some(self.data[index].clone()))
} else {
Ok(None)
}
}
}
|
{
"pile_set_name": "Github"
}
|
package typings.dojo.dojox.gfx3d.base
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._
/**
* Permalink: http://dojotoolkit.org/api/1.9/dojox/gfx3d/_base.defaultQuads.html
*
*
*/
trait defaultQuads extends js.Object {
/**
*
*/
var points: js.Array[_]
/**
*
*/
var style: Object
/**
*
*/
var `type`: String
}
object defaultQuads {
@scala.inline
def apply(points: js.Array[_], style: Object, `type`: String): defaultQuads = {
val __obj = js.Dynamic.literal(points = points.asInstanceOf[js.Any], style = style.asInstanceOf[js.Any])
__obj.updateDynamic("type")(`type`.asInstanceOf[js.Any])
__obj.asInstanceOf[defaultQuads]
}
}
|
{
"pile_set_name": "Github"
}
|
#ifndef L_INPUT_STREAM
#define L_INPUT_STREAM
extern "C"
{
#include "lua.h"
}
class LInputStream
{
public:
/*double getTotalLength();
bool isExhausted();
double getPosition();
bool setPosition (double newPosition);
void skipNextBytes (double numBytesToSkip);
int readIntoMemoryBlock (LMemoryBlock &destBlock, double maxNumBytesToRead);
*/
static void wrapForLua (lua_State *L);
};
#endif
|
{
"pile_set_name": "Github"
}
|
import { injectable } from 'inversify';
import axios from 'axios';
@injectable()
export class GitHubUtil {
private static readonly GITHUB_API_ENTRIPOINT_URL = 'https://api.github.com/';
/**
* add public part of ssh key to the defied github account
* @param authToken
* @param title
* @param key
*/
async addPublicSshKeyToUserAccount(authToken: string, title: string, key: string) {
const gitHubApiSshURL: string = GitHubUtil.GITHUB_API_ENTRIPOINT_URL + 'user/keys';
const authHeader = { headers: { 'Authorization': 'token ' + authToken, 'Content-Type': 'application/json' } };
const data = {
title: `${title}`,
key: `${key}`
};
try { await axios.post(gitHubApiSshURL, JSON.stringify(data), authHeader); } catch (error) {
console.error('Cannot add the public key to the GitHub account: ');
console.error(error);
throw error;
}
}
async getRawContentFromFile(pathToFile: string): Promise<string> {
const gitHubContentEntryPointUrl: string = 'https://raw.githubusercontent.com/';
const pathToRawContent: string = `${gitHubContentEntryPointUrl}${pathToFile}`;
const authorization: string = 'Authorization';
const contentType: string = 'Content-Type';
try {
delete axios.defaults.headers.common[authorization];
delete axios.defaults.headers.common[contentType];
const response = await axios.get(`${gitHubContentEntryPointUrl}${pathToFile}`);
return response.data;
} catch (error) {
console.error('Cannot get content form the raw github content: ' + pathToRawContent);
console.error(error);
throw error;
}
}
}
|
{
"pile_set_name": "Github"
}
|
/**
* Copyright 2018-present MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Codec, Stream } from "mongodb-stitch-core-sdk";
import {
ChangeEvent,
CompactChangeEvent,
RemoteCountOptions,
RemoteDeleteResult,
RemoteFindOneAndModifyOptions,
RemoteFindOptions,
RemoteInsertManyResult,
RemoteInsertOneResult,
RemoteUpdateOptions,
RemoteUpdateResult
} from "mongodb-stitch-core-services-mongodb-remote";
import RemoteMongoReadOperation from "./RemoteMongoReadOperation";
/**
* The RemoteMongoCollection is the interface to a MongoDB database's
* collection via Stitch, allowing read and write.
*
* It is retrieved from a [[RemoteMongoDatabase]].
*
* The read operations are [[find]], [[count]] and [[aggregate]].
*
* The write operations are [[insertOne]], [[insertMany]],
* [[updateOne]], [[updateMany]], [[deleteOne]], and [[deleteMany]].
*
* It is also possible to [[watch]] documents in the collection for
* changes.
*
* If you are already familiar with MongoDB drivers, it is important
* to understand that the RemoteMongoCollection only provides access
* to the operations available in Stitch. For a list of unsupported
* aggregation stages, see
* [Unsupported Aggregation Stages](https://docs.mongodb.com/stitch/mongodb/actions/collection.aggregate/#unsupported-aggregation-stages).
*
* @note Log in first
*
* A user will need to be logged in (at least anonymously) before you can read from
* or write to the collection. See [[StitchAuth]].
*
* @see
* - [[RemoteMongoClient]]
* - [[RemoteMongoDatabase]]
* - [CRUD Snippets](https://docs.mongodb.com/stitch/mongodb/crud-snippets/)
*/
export default interface RemoteMongoCollection<DocumentT> {
/**
* Gets the namespace of this collection.
*
* @return the namespace
*/
readonly namespace: string;
/**
* Create a new RemoteMongoCollection instance with a different default class to cast any
* documents returned from the database into.
*
* @param codec the default class to cast any documents returned from the database into.
* @param <NewDocumentT> the type that the new collection will encode documents from and decode
* documents to.
* @return a new CoreRemoteMongoCollection instance with the different default class
*/
withCollectionType<U>(codec: Codec<U>): RemoteMongoCollection<U>;
/**
* Counts the number of documents in the collection.
* @param query the query filter
* @param options the options describing the count
*
* @return a Promise containing the number of documents in the collection
*/
count(query?: object, options?: RemoteCountOptions): Promise<number>;
/**
* Finds all documents in the collection that match the given query.
*
* An empty query (`{}`) will match all documents.
*
* @param query the query filter
* @return a read operation which can be used to execute the query
*/
find(
query?: object,
options?: RemoteFindOptions
): RemoteMongoReadOperation<DocumentT>;
/**
* Finds one document in the collection that matches the given query.
*
* An empty query (`{}`) will match all documents.
*
* @param query the query filter
* @return the resulting document or null if the query resulted in zero matches
*/
findOne(
query?: object,
options?: RemoteFindOptions
): Promise<DocumentT | null>;
/**
* Finds one document in the collection that matches the given query and performs the
* given update on that document. (An empty query {} will match all documents)
*
* @param query A `Document` that should match the query.
* @param update A `Document` describing the update.
* @param options Optional: `RemoteFindOneAndModifyOptions` to use when executing the command.
* @return A resulting `DocumentT` or null if the query returned zero matches.
*/
findOneAndUpdate(
query: object,
update: object,
options?: RemoteFindOneAndModifyOptions
): Promise<DocumentT | null>;
/**
* Finds one document in the collection that matches the given query and replaces that document
* with the given replacement. (An empty query {} will match all documents)
*
* @param query A `Document` that should match the query.
* @param replacement A `Document` that will replace the matched document
* @param options Optional: `RemoteFindOneAndModifyOptions` to use when executing the command.
* @return A resulting `DocumentT` or null if the query returned zero matches.
*/
findOneAndReplace(
query: object,
replacement: object,
options?: RemoteFindOneAndModifyOptions
): Promise<DocumentT | null>;
/**
* Finds one document in the collection that matches the given query and
* deletes that document. (An empty query {} will match all documents)
*
* @param query A `Document` that should match the query.
* @param options Optional: `RemoteFindOneAndModifyOptions` to use when executing the command.
* @return The `DocumentT` being deleted or null if the query returned zero matches.
*/
findOneAndDelete(
query: object,
options?: RemoteFindOneAndModifyOptions
): Promise<DocumentT | null>;
/**
* Aggregates documents according to the specified aggregation pipeline.
*
* Stitch supports a subset of the available aggregation stages in MongoDB.
* See
* [Unsupported Aggregation Stages](https://docs.mongodb.com/stitch/mongodb/actions/collection.aggregate/#unsupported-aggregation-stages).
*
* @param pipeline the aggregation pipeline
* @return a read operation which can be used to execute the aggregation
*/
aggregate(pipeline: object[]): RemoteMongoReadOperation<DocumentT>;
/**
* Inserts the provided document. If the document is missing an identifier, the client should
* generate one.
*
* @param document the document to insert
* @return a Promise containing the result of the insert one operation
*/
insertOne(document: DocumentT): Promise<RemoteInsertOneResult>;
/**
* Inserts one or more documents.
*
* @param documents the documents to insert
* @return a Promise containing the result of the insert many operation
*/
insertMany(documents: DocumentT[]): Promise<RemoteInsertManyResult>;
/**
* Removes at most one document from the collection that matches the given filter.
* If no documents match, the collection is not modified.
*
* @param query the query filter to apply the the delete operation
* @return a Promise containing the result of the remove one operation
*/
deleteOne(query: object): Promise<RemoteDeleteResult>;
/**
* Removes all documents from the collection that match the given query filter. If no documents
* match, the collection is not modified.
*
* @param query the query filter to apply the the delete operation
* @return a Promise containing the result of the remove many operation
*/
deleteMany(query: object): Promise<RemoteDeleteResult>;
/**
* Update a single document in the collection according to the specified arguments.
*
* @param query a document describing the query filter, which may not be null.
* @param update a document describing the update, which may not be null. The update to
* apply must include only update operators.
* @param updateOptions the options to apply to the update operation
* @return a Promise containing the result of the update one operation
*/
updateOne(
query: object,
update: object,
updateOptions?: RemoteUpdateOptions
): Promise<RemoteUpdateResult>;
/**
* Update all documents in the collection according to the specified arguments.
*
* @param query a document describing the query filter, which may not be null.
* @param update a document describing the update, which may not be null. The update to
* apply must include only update operators.
* @param updateOptions the options to apply to the update operation
* @return a Promise containing the result of the update many operation
*/
updateMany(
query: object,
update: object,
updateOptions?: RemoteUpdateOptions
): Promise<RemoteUpdateResult>;
/**
* Opens a MongoDB change stream against the collection to watch for changes.
* You can watch a subset of the documents in the collection by passing
* an array of specific document ids or a
* [match expression](https://docs.mongodb.com/manual/reference/operator/aggregation/match/)
* that filters the [[ChangeEvent]]s from the change stream.
*
* Defining the match expression to filter ChangeEvents is similar to
* defining the match expression for [triggers](https://docs.mongodb.com/stitch/triggers/database-triggers/).
*
* @note
* This method requires a browser that supports EventSource (server-sent
* events). If you'd like this method to work in a browser that does not
* support EventSource, you must provide a polyfill that makes
* window.EventSource available. See
* [EventSource Browser Compatibility on MDN](https://developer.mozilla.org/en-US/docs/Web/API/EventSource#Browser_compatibility)
* for information on which browsers support EventSource.
*
* @param arg Optional. An array of ids to watch or a $match expression.
* Omit to watch the entire collection.
* @return a Promise containing a stream of change events representing the
* changes to the watched documents.
*/
watch(arg?: any[] | object | undefined): Promise<Stream<ChangeEvent<DocumentT>>>;
/**
* Opens a MongoDB change stream against the collection to watch for changes
* made to specific documents. The documents to watch must be explicitly
* specified by their _id.
*
* Requests a stream where the full document of update events, and several
* other unnecessary fields are omitted from the change event objects
* returned by the server. This can save on network usage when watching
* large documents.
*
* @note
* This method requires a browser that supports EventSource (server-sent
* events). If you'd like this method to work in a browser that does not
* support EventSource, you must provide a polyfill that makes
* window.EventSource available. See
* [EventSource Browser Compatibility on MDN](https://developer.mozilla.org/en-US/docs/Web/API/EventSource#Browser_compatibility)
* for information on which browsers support EventSource.
*
* @note
* This method does not support opening change streams on an entire collection
* or a specific query.
*
* @param ids the _ids of the documents to watch in this change stream
* @return a Promise containing a stream of compact change events
* representing the changes to the watched documents.
*/
watchCompact(ids: any[]): Promise<Stream<CompactChangeEvent<DocumentT>>>;
}
|
{
"pile_set_name": "Github"
}
|
DESCRIBE FUNCTION when;
DESCRIBE FUNCTION EXTENDED when;
EXPLAIN
SELECT CASE
WHEN 1=1 THEN 2
WHEN 1=3 THEN 4
ELSE 5
END,
CASE
WHEN 6=7 THEN 8
ELSE 9
END,
CASE
WHEN 10=11 THEN 12
WHEN 13=13 THEN 14
END,
CASE
WHEN 15=16 THEN 17
WHEN 18=19 THEN 20
END,
CASE
WHEN 21=22 THEN NULL
WHEN 23=23 THEN 24
END,
CASE
WHEN 25=26 THEN 27
WHEN 28=28 THEN NULL
END
FROM src LIMIT 1;
SELECT CASE
WHEN 1=1 THEN 2
WHEN 1=3 THEN 4
ELSE 5
END,
CASE
WHEN 6=7 THEN 8
ELSE 9
END,
CASE
WHEN 10=11 THEN 12
WHEN 13=13 THEN 14
END,
CASE
WHEN 15=16 THEN 17
WHEN 18=19 THEN 20
END,
CASE
WHEN 21=22 THEN NULL
WHEN 23=23 THEN 24
END,
CASE
WHEN 25=26 THEN 27
WHEN 28=28 THEN NULL
END
FROM src LIMIT 1;
|
{
"pile_set_name": "Github"
}
|
package info.nightscout.androidaps.setupwizard;
public interface SWTextValidator {
boolean isValid(String text);
}
|
{
"pile_set_name": "Github"
}
|
#region File Description
//-----------------------------------------------------------------------------
// Player.cs
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#endregion
#region Using Statements
using System;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
#endregion
namespace RolePlayingGameData
{
/// <summary>
/// A member of the player's party, also represented in the world before joining.
/// </summary>
/// <remarks>
/// There is only one of a given Player in the game world at a time, and their
/// current statistics persist after combat. Thererefore, current statistics
/// are tracked here.
/// </remarks>
public class Player : FightingCharacter
#if WINDOWS
, ICloneable
#endif
{
#region Current Statistics
/// <summary>
/// The current set of persistent statistics modifiers - damage, etc.
/// </summary>
[ContentSerializerIgnore]
public StatisticsValue StatisticsModifiers = new StatisticsValue();
/// <summary>
/// The current set of statistics, including damage, etc.
/// </summary>
[ContentSerializerIgnore]
public StatisticsValue CurrentStatistics
{
get { return CharacterStatistics + StatisticsModifiers; }
}
#endregion
#region Initial Data
/// <summary>
/// The amount of gold that the player has when it joins the party.
/// </summary>
private int gold;
/// <summary>
/// The amount of gold that the player has when it joins the party.
/// </summary>
public int Gold
{
get { return gold; }
set { gold = value; }
}
#endregion
#region Dialogue Data
/// <summary>
/// The dialogue that the player says when it is greeted as an Npc in the world.
/// </summary>
private string introductionDialogue;
/// <summary>
/// The dialogue that the player says when it is greeted as an Npc in the world.
/// </summary>
public string IntroductionDialogue
{
get { return introductionDialogue; }
set { introductionDialogue = value; }
}
/// <summary>
/// The dialogue that the player says when its offer to join is accepted.
/// </summary>
private string joinAcceptedDialogue;
/// <summary>
/// The dialogue that the player says when its offer to join is accepted.
/// </summary>
public string JoinAcceptedDialogue
{
get { return joinAcceptedDialogue; }
set { joinAcceptedDialogue = value; }
}
/// <summary>
/// The dialogue that the player says when its offer to join is rejected.
/// </summary>
private string joinRejectedDialogue;
/// <summary>
/// The dialogue that the player says when its offer to join is rejected.
/// </summary>
public string JoinRejectedDialogue
{
get { return joinRejectedDialogue; }
set { joinRejectedDialogue = value; }
}
#endregion
#region Portrait Data
/// <summary>
/// The name of the active portrait texture.
/// </summary>
private string activePortraitTextureName;
/// <summary>
/// The name of the active portrait texture.
/// </summary>
public string ActivePortraitTextureName
{
get { return activePortraitTextureName; }
set { activePortraitTextureName = value; }
}
/// <summary>
/// The active portrait texture.
/// </summary>
private Texture2D activePortraitTexture;
/// <summary>
/// The active portrait texture.
/// </summary>
[ContentSerializerIgnore]
public Texture2D ActivePortraitTexture
{
get { return activePortraitTexture; }
}
/// <summary>
/// The name of the inactive portrait texture.
/// </summary>
private string inactivePortraitTextureName;
/// <summary>
/// The name of the inactive portrait texture.
/// </summary>
public string InactivePortraitTextureName
{
get { return inactivePortraitTextureName; }
set { inactivePortraitTextureName = value; }
}
/// <summary>
/// The inactive portrait texture.
/// </summary>
private Texture2D inactivePortraitTexture;
/// <summary>
/// The inactive portrait texture.
/// </summary>
[ContentSerializerIgnore]
public Texture2D InactivePortraitTexture
{
get { return inactivePortraitTexture; }
}
/// <summary>
/// The name of the unselectable portrait texture.
/// </summary>
private string unselectablePortraitTextureName;
/// <summary>
/// The name of the unselectable portrait texture.
/// </summary>
public string UnselectablePortraitTextureName
{
get { return unselectablePortraitTextureName; }
set { unselectablePortraitTextureName = value; }
}
/// <summary>
/// The unselectable portrait texture.
/// </summary>
private Texture2D unselectablePortraitTexture;
/// <summary>
/// The unselectable portrait texture.
/// </summary>
[ContentSerializerIgnore]
public Texture2D UnselectablePortraitTexture
{
get { return unselectablePortraitTexture; }
}
#endregion
#region Content Type Reader
/// <summary>
/// Read a Player object from the content pipeline.
/// </summary>
public class PlayerReader : ContentTypeReader<Player>
{
protected override Player Read(ContentReader input, Player existingInstance)
{
Player player = existingInstance;
if (player == null)
{
player = new Player();
}
input.ReadRawObject<FightingCharacter>(player as FightingCharacter);
player.Gold = input.ReadInt32();
player.IntroductionDialogue = input.ReadString();
player.JoinAcceptedDialogue = input.ReadString();
player.JoinRejectedDialogue = input.ReadString();
player.ActivePortraitTextureName = input.ReadString();
player.activePortraitTexture =
input.ContentManager.Load<Texture2D>(
System.IO.Path.Combine(@"Textures\Characters\Portraits",
player.ActivePortraitTextureName));
player.InactivePortraitTextureName = input.ReadString();
player.inactivePortraitTexture =
input.ContentManager.Load<Texture2D>(
System.IO.Path.Combine(@"Textures\Characters\Portraits",
player.InactivePortraitTextureName));
player.UnselectablePortraitTextureName = input.ReadString();
player.unselectablePortraitTexture =
input.ContentManager.Load<Texture2D>(
System.IO.Path.Combine(@"Textures\Characters\Portraits",
player.UnselectablePortraitTextureName));
return player;
}
}
#endregion
#region ICloneable Members
public object Clone()
{
Player player = new Player();
player.activePortraitTexture = activePortraitTexture;
player.activePortraitTextureName = activePortraitTextureName;
player.AssetName = AssetName;
player.CharacterClass = CharacterClass;
player.CharacterClassContentName = CharacterClassContentName;
player.CharacterLevel = CharacterLevel;
player.CombatAnimationInterval = CombatAnimationInterval;
player.CombatSprite = CombatSprite.Clone() as AnimatingSprite;
player.Direction = Direction;
player.EquippedEquipment.AddRange(EquippedEquipment);
player.Experience = Experience;
player.gold = gold;
player.inactivePortraitTexture = inactivePortraitTexture;
player.inactivePortraitTextureName = inactivePortraitTextureName;
player.InitialEquipmentContentNames.AddRange(InitialEquipmentContentNames);
player.introductionDialogue = introductionDialogue;
player.Inventory.AddRange(Inventory);
player.joinAcceptedDialogue = joinAcceptedDialogue;
player.joinRejectedDialogue = joinRejectedDialogue;
player.MapIdleAnimationInterval = MapIdleAnimationInterval;
player.MapPosition = MapPosition;
player.MapSprite = MapSprite.Clone() as AnimatingSprite;
player.MapWalkingAnimationInterval = MapWalkingAnimationInterval;
player.Name = Name;
player.ShadowTexture = ShadowTexture;
player.State = State;
player.unselectablePortraitTexture = unselectablePortraitTexture;
player.unselectablePortraitTextureName = unselectablePortraitTextureName;
player.WalkingSprite = WalkingSprite.Clone() as AnimatingSprite;
player.RecalculateEquipmentStatistics();
player.RecalculateTotalDefenseRanges();
player.RecalculateTotalTargetDamageRange();
player.ResetAnimation(false);
player.ResetBaseStatistics();
return player;
}
#endregion
}
}
|
{
"pile_set_name": "Github"
}
|
/*
* Licensed to ObjectStyle LLC under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ObjectStyle LLC 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 io.bootique.junit5;
import io.bootique.junit5.scope.BQAfterMethodCallback;
import io.bootique.junit5.scope.BQAfterScopeCallback;
import io.bootique.junit5.scope.BQBeforeMethodCallback;
import io.bootique.junit5.scope.BQBeforeScopeCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
import java.util.ArrayList;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
class BQTestToolCallbackRecorder implements BQBeforeScopeCallback, BQAfterScopeCallback, BQBeforeMethodCallback, BQAfterMethodCallback {
private List<BQTestToolCallback> callbacks = new ArrayList<>();
public void assertCallbacksSize(String label, int expectedSize) {
int actual = 0;
for (BQTestToolCallback c : callbacks) {
if (label.equals(c.label)) {
actual++;
}
}
assertEquals(expectedSize, actual, "Unexpected number of callbacks for: " + label);
}
public void assertCallbacksScope(BQTestScope expectedScope) {
for (BQTestToolCallback c : callbacks) {
assertEquals(expectedScope, c.scope, "Unexpected scope for " + c);
}
}
public void assertCallback(int pos, String label, BQTestScope scope) {
assertTrue(pos < callbacks.size(), "No callback at index " + pos +
". " + callbacks.size() + " callbacks were registered");
assertCallback(pos, label, null, scope);
}
public void assertCallback(int order, String label, String methodName, BQTestScope scope) {
callbacks.get(order).assertCallback(label, methodName, scope);
}
@Override
public void beforeScope(BQTestScope scope, ExtensionContext context) {
callbacks.add(new BQTestToolCallback("beforeScope", null, scope));
}
@Override
public void beforeMethod(BQTestScope scope, ExtensionContext context) {
String method = context.getRequiredTestMethod().getName();
callbacks.add(new BQTestToolCallback("beforeMethod", method, scope));
}
@Override
public void afterMethod(BQTestScope scope, ExtensionContext context) {
String method = context.getRequiredTestMethod().getName();
callbacks.add(new BQTestToolCallback("afterMethod", method, scope));
}
@Override
public void afterScope(BQTestScope scope, ExtensionContext context) {
callbacks.add(new BQTestToolCallback("afterScope", null, scope));
}
}
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright 2003-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.nodeEditor.assist;
import jetbrains.mps.lang.editor.menus.transformation.MenuLocations;
import jetbrains.mps.nodeEditor.EditorSettings;
import jetbrains.mps.openapi.editor.EditorComponent;
import jetbrains.mps.openapi.editor.assist.ContextAssistant;
import jetbrains.mps.openapi.editor.assist.ContextAssistantManager;
import jetbrains.mps.openapi.editor.menus.transformation.TransformationMenuItem;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.mps.openapi.module.SRepository;
import java.util.List;
/**
* Serves as a facade for context assistant-related tasks. Internally delegates to {@link EditorContextAssistantsController} and
* {@link EditorContextAssistants}.
*/
public class DefaultContextAssistantManager implements ContextAssistantManager {
private final EditorComponent myEditorComponent;
private final EditorContextAssistants myAssistants;
private final EditorContextAssistantsController myController;
private final EditorSettings myEditorSettings;
public static DefaultContextAssistantManager newInstance(EditorComponent component, SRepository repository) {
SelectionMenuProvider executableContextAssistantItemsMenuProvider =
new FilteringSelectionMenuProvider(new SelectionMenuProviderByCellAndConcept(MenuLocations.CONTEXT_ASSISTANT),
new CanExecuteFilter());
EditorContextAssistants assistants = new EditorContextAssistants(executableContextAssistantItemsMenuProvider, component.getSelectionManager(),
repository.getModelAccess());
EditorContextAssistantsController controller = new EditorContextAssistantsController(assistants, component.getSelectionManager(), component.getUpdater());
return new DefaultContextAssistantManager(component, assistants, controller, EditorSettings.getInstance());
}
private DefaultContextAssistantManager(EditorComponent editorComponent, EditorContextAssistants assistants, EditorContextAssistantsController controller,
EditorSettings editorSettings) {
myEditorComponent = editorComponent;
myAssistants = assistants;
myController = controller;
myEditorSettings = editorSettings;
}
private boolean shouldBeUpdating() {
return myAssistants.hasRegisteredAssistants() && myEditorSettings.isShowContextAssistant() && !myEditorComponent.isReadOnly();
}
@Override
public void register(ContextAssistant assistant) {
myAssistants.register(assistant);
if (shouldBeUpdating() && !myController.isUpdating()) {
myController.startUpdating();
}
if (myController.isUpdating()) {
myController.scheduleUpdate();
}
}
@Override
public void unregister(ContextAssistant assistant) {
myAssistants.unregister(assistant);
if (!myAssistants.hasRegisteredAssistants() && myController.isUpdating()) {
myController.stopUpdating();
}
}
@Override
public void updateImmediately() {
myAssistants.update();
}
@Nullable
@Override
public ContextAssistant getActiveAssistant() {
return myAssistants.getActiveAssistant();
}
@Override
public List<TransformationMenuItem> getActiveMenuItems() {
return myAssistants.getActiveMenuItems();
}
@Override
public void scheduleUpdate() {
myController.scheduleUpdate();
}
}
|
{
"pile_set_name": "Github"
}
|
#tb 0: 1/25
0, 0, 0, 1, 8294400, 0xa061c78c
0, 1, 1, 1, 8294400, 0x60250c76
0, 2, 2, 1, 8294400, 0x48e3fbdb
|
{
"pile_set_name": "Github"
}
|
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package openpgp implements high level operations on OpenPGP messages.
package openpgp // import "golang.org/x/crypto/openpgp"
import (
"crypto"
_ "crypto/sha256"
"hash"
"io"
"strconv"
"golang.org/x/crypto/openpgp/armor"
"golang.org/x/crypto/openpgp/errors"
"golang.org/x/crypto/openpgp/packet"
)
// SignatureType is the armor type for a PGP signature.
var SignatureType = "PGP SIGNATURE"
// readArmored reads an armored block with the given type.
func readArmored(r io.Reader, expectedType string) (body io.Reader, err error) {
block, err := armor.Decode(r)
if err != nil {
return
}
if block.Type != expectedType {
return nil, errors.InvalidArgumentError("expected '" + expectedType + "', got: " + block.Type)
}
return block.Body, nil
}
// MessageDetails contains the result of parsing an OpenPGP encrypted and/or
// signed message.
type MessageDetails struct {
IsEncrypted bool // true if the message was encrypted.
EncryptedToKeyIds []uint64 // the list of recipient key ids.
IsSymmetricallyEncrypted bool // true if a passphrase could have decrypted the message.
DecryptedWith Key // the private key used to decrypt the message, if any.
IsSigned bool // true if the message is signed.
SignedByKeyId uint64 // the key id of the signer, if any.
SignedBy *Key // the key of the signer, if available.
LiteralData *packet.LiteralData // the metadata of the contents
UnverifiedBody io.Reader // the contents of the message.
// If IsSigned is true and SignedBy is non-zero then the signature will
// be verified as UnverifiedBody is read. The signature cannot be
// checked until the whole of UnverifiedBody is read so UnverifiedBody
// must be consumed until EOF before the data can be trusted. Even if a
// message isn't signed (or the signer is unknown) the data may contain
// an authentication code that is only checked once UnverifiedBody has
// been consumed. Once EOF has been seen, the following fields are
// valid. (An authentication code failure is reported as a
// SignatureError error when reading from UnverifiedBody.)
SignatureError error // nil if the signature is good.
Signature *packet.Signature // the signature packet itself, if v4 (default)
SignatureV3 *packet.SignatureV3 // the signature packet if it is a v2 or v3 signature
decrypted io.ReadCloser
}
// A PromptFunction is used as a callback by functions that may need to decrypt
// a private key, or prompt for a passphrase. It is called with a list of
// acceptable, encrypted private keys and a boolean that indicates whether a
// passphrase is usable. It should either decrypt a private key or return a
// passphrase to try. If the decrypted private key or given passphrase isn't
// correct, the function will be called again, forever. Any error returned will
// be passed up.
type PromptFunction func(keys []Key, symmetric bool) ([]byte, error)
// A keyEnvelopePair is used to store a private key with the envelope that
// contains a symmetric key, encrypted with that key.
type keyEnvelopePair struct {
key Key
encryptedKey *packet.EncryptedKey
}
// ReadMessage parses an OpenPGP message that may be signed and/or encrypted.
// The given KeyRing should contain both public keys (for signature
// verification) and, possibly encrypted, private keys for decrypting.
// If config is nil, sensible defaults will be used.
func ReadMessage(r io.Reader, keyring KeyRing, prompt PromptFunction, config *packet.Config) (md *MessageDetails, err error) {
var p packet.Packet
var symKeys []*packet.SymmetricKeyEncrypted
var pubKeys []keyEnvelopePair
var se *packet.SymmetricallyEncrypted
packets := packet.NewReader(r)
md = new(MessageDetails)
md.IsEncrypted = true
// The message, if encrypted, starts with a number of packets
// containing an encrypted decryption key. The decryption key is either
// encrypted to a public key, or with a passphrase. This loop
// collects these packets.
ParsePackets:
for {
p, err = packets.Next()
if err != nil {
return nil, err
}
switch p := p.(type) {
case *packet.SymmetricKeyEncrypted:
// This packet contains the decryption key encrypted with a passphrase.
md.IsSymmetricallyEncrypted = true
symKeys = append(symKeys, p)
case *packet.EncryptedKey:
// This packet contains the decryption key encrypted to a public key.
md.EncryptedToKeyIds = append(md.EncryptedToKeyIds, p.KeyId)
switch p.Algo {
case packet.PubKeyAlgoRSA, packet.PubKeyAlgoRSAEncryptOnly, packet.PubKeyAlgoElGamal:
break
default:
continue
}
var keys []Key
if p.KeyId == 0 {
keys = keyring.DecryptionKeys()
} else {
keys = keyring.KeysById(p.KeyId)
}
for _, k := range keys {
pubKeys = append(pubKeys, keyEnvelopePair{k, p})
}
case *packet.SymmetricallyEncrypted:
se = p
break ParsePackets
case *packet.Compressed, *packet.LiteralData, *packet.OnePassSignature:
// This message isn't encrypted.
if len(symKeys) != 0 || len(pubKeys) != 0 {
return nil, errors.StructuralError("key material not followed by encrypted message")
}
packets.Unread(p)
return readSignedMessage(packets, nil, keyring)
}
}
var candidates []Key
var decrypted io.ReadCloser
// Now that we have the list of encrypted keys we need to decrypt at
// least one of them or, if we cannot, we need to call the prompt
// function so that it can decrypt a key or give us a passphrase.
FindKey:
for {
// See if any of the keys already have a private key available
candidates = candidates[:0]
candidateFingerprints := make(map[string]bool)
for _, pk := range pubKeys {
if pk.key.PrivateKey == nil {
continue
}
if !pk.key.PrivateKey.Encrypted {
if len(pk.encryptedKey.Key) == 0 {
pk.encryptedKey.Decrypt(pk.key.PrivateKey, config)
}
if len(pk.encryptedKey.Key) == 0 {
continue
}
decrypted, err = se.Decrypt(pk.encryptedKey.CipherFunc, pk.encryptedKey.Key)
if err != nil && err != errors.ErrKeyIncorrect {
return nil, err
}
if decrypted != nil {
md.DecryptedWith = pk.key
break FindKey
}
} else {
fpr := string(pk.key.PublicKey.Fingerprint[:])
if v := candidateFingerprints[fpr]; v {
continue
}
candidates = append(candidates, pk.key)
candidateFingerprints[fpr] = true
}
}
if len(candidates) == 0 && len(symKeys) == 0 {
return nil, errors.ErrKeyIncorrect
}
if prompt == nil {
return nil, errors.ErrKeyIncorrect
}
passphrase, err := prompt(candidates, len(symKeys) != 0)
if err != nil {
return nil, err
}
// Try the symmetric passphrase first
if len(symKeys) != 0 && passphrase != nil {
for _, s := range symKeys {
key, cipherFunc, err := s.Decrypt(passphrase)
if err == nil {
decrypted, err = se.Decrypt(cipherFunc, key)
if err != nil && err != errors.ErrKeyIncorrect {
return nil, err
}
if decrypted != nil {
break FindKey
}
}
}
}
}
md.decrypted = decrypted
if err := packets.Push(decrypted); err != nil {
return nil, err
}
return readSignedMessage(packets, md, keyring)
}
// readSignedMessage reads a possibly signed message if mdin is non-zero then
// that structure is updated and returned. Otherwise a fresh MessageDetails is
// used.
func readSignedMessage(packets *packet.Reader, mdin *MessageDetails, keyring KeyRing) (md *MessageDetails, err error) {
if mdin == nil {
mdin = new(MessageDetails)
}
md = mdin
var p packet.Packet
var h hash.Hash
var wrappedHash hash.Hash
FindLiteralData:
for {
p, err = packets.Next()
if err != nil {
return nil, err
}
switch p := p.(type) {
case *packet.Compressed:
if err := packets.Push(p.Body); err != nil {
return nil, err
}
case *packet.OnePassSignature:
if !p.IsLast {
return nil, errors.UnsupportedError("nested signatures")
}
h, wrappedHash, err = hashForSignature(p.Hash, p.SigType)
if err != nil {
md = nil
return
}
md.IsSigned = true
md.SignedByKeyId = p.KeyId
keys := keyring.KeysByIdUsage(p.KeyId, packet.KeyFlagSign)
if len(keys) > 0 {
md.SignedBy = &keys[0]
}
case *packet.LiteralData:
md.LiteralData = p
break FindLiteralData
}
}
if md.SignedBy != nil {
md.UnverifiedBody = &signatureCheckReader{packets, h, wrappedHash, md}
} else if md.decrypted != nil {
md.UnverifiedBody = checkReader{md}
} else {
md.UnverifiedBody = md.LiteralData.Body
}
return md, nil
}
// hashForSignature returns a pair of hashes that can be used to verify a
// signature. The signature may specify that the contents of the signed message
// should be preprocessed (i.e. to normalize line endings). Thus this function
// returns two hashes. The second should be used to hash the message itself and
// performs any needed preprocessing.
func hashForSignature(hashId crypto.Hash, sigType packet.SignatureType) (hash.Hash, hash.Hash, error) {
if !hashId.Available() {
return nil, nil, errors.UnsupportedError("hash not available: " + strconv.Itoa(int(hashId)))
}
h := hashId.New()
switch sigType {
case packet.SigTypeBinary:
return h, h, nil
case packet.SigTypeText:
return h, NewCanonicalTextHash(h), nil
}
return nil, nil, errors.UnsupportedError("unsupported signature type: " + strconv.Itoa(int(sigType)))
}
// checkReader wraps an io.Reader from a LiteralData packet. When it sees EOF
// it closes the ReadCloser from any SymmetricallyEncrypted packet to trigger
// MDC checks.
type checkReader struct {
md *MessageDetails
}
func (cr checkReader) Read(buf []byte) (n int, err error) {
n, err = cr.md.LiteralData.Body.Read(buf)
if err == io.EOF {
mdcErr := cr.md.decrypted.Close()
if mdcErr != nil {
err = mdcErr
}
}
return
}
// signatureCheckReader wraps an io.Reader from a LiteralData packet and hashes
// the data as it is read. When it sees an EOF from the underlying io.Reader
// it parses and checks a trailing Signature packet and triggers any MDC checks.
type signatureCheckReader struct {
packets *packet.Reader
h, wrappedHash hash.Hash
md *MessageDetails
}
func (scr *signatureCheckReader) Read(buf []byte) (n int, err error) {
n, err = scr.md.LiteralData.Body.Read(buf)
scr.wrappedHash.Write(buf[:n])
if err == io.EOF {
var p packet.Packet
p, scr.md.SignatureError = scr.packets.Next()
if scr.md.SignatureError != nil {
return
}
var ok bool
if scr.md.Signature, ok = p.(*packet.Signature); ok {
scr.md.SignatureError = scr.md.SignedBy.PublicKey.VerifySignature(scr.h, scr.md.Signature)
} else if scr.md.SignatureV3, ok = p.(*packet.SignatureV3); ok {
scr.md.SignatureError = scr.md.SignedBy.PublicKey.VerifySignatureV3(scr.h, scr.md.SignatureV3)
} else {
scr.md.SignatureError = errors.StructuralError("LiteralData not followed by Signature")
return
}
// The SymmetricallyEncrypted packet, if any, might have an
// unsigned hash of its own. In order to check this we need to
// close that Reader.
if scr.md.decrypted != nil {
mdcErr := scr.md.decrypted.Close()
if mdcErr != nil {
err = mdcErr
}
}
}
return
}
// CheckDetachedSignature takes a signed file and a detached signature and
// returns the signer if the signature is valid. If the signer isn't known,
// ErrUnknownIssuer is returned.
func CheckDetachedSignature(keyring KeyRing, signed, signature io.Reader) (signer *Entity, err error) {
var issuerKeyId uint64
var hashFunc crypto.Hash
var sigType packet.SignatureType
var keys []Key
var p packet.Packet
packets := packet.NewReader(signature)
for {
p, err = packets.Next()
if err == io.EOF {
return nil, errors.ErrUnknownIssuer
}
if err != nil {
return nil, err
}
switch sig := p.(type) {
case *packet.Signature:
if sig.IssuerKeyId == nil {
return nil, errors.StructuralError("signature doesn't have an issuer")
}
issuerKeyId = *sig.IssuerKeyId
hashFunc = sig.Hash
sigType = sig.SigType
case *packet.SignatureV3:
issuerKeyId = sig.IssuerKeyId
hashFunc = sig.Hash
sigType = sig.SigType
default:
return nil, errors.StructuralError("non signature packet found")
}
keys = keyring.KeysByIdUsage(issuerKeyId, packet.KeyFlagSign)
if len(keys) > 0 {
break
}
}
if len(keys) == 0 {
panic("unreachable")
}
h, wrappedHash, err := hashForSignature(hashFunc, sigType)
if err != nil {
return nil, err
}
if _, err := io.Copy(wrappedHash, signed); err != nil && err != io.EOF {
return nil, err
}
for _, key := range keys {
switch sig := p.(type) {
case *packet.Signature:
err = key.PublicKey.VerifySignature(h, sig)
case *packet.SignatureV3:
err = key.PublicKey.VerifySignatureV3(h, sig)
default:
panic("unreachable")
}
if err == nil {
return key.Entity, nil
}
}
return nil, err
}
// CheckArmoredDetachedSignature performs the same actions as
// CheckDetachedSignature but expects the signature to be armored.
func CheckArmoredDetachedSignature(keyring KeyRing, signed, signature io.Reader) (signer *Entity, err error) {
body, err := readArmored(signature, SignatureType)
if err != nil {
return
}
return CheckDetachedSignature(keyring, signed, body)
}
|
{
"pile_set_name": "Github"
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.