hexsha stringlengths 40 40 | size int64 7 1.05M | ext stringclasses 13
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 269 | max_stars_repo_name stringlengths 5 108 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 9 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 269 | max_issues_repo_name stringlengths 5 116 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 9 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 269 | max_forks_repo_name stringlengths 5 116 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 9 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 7 1.05M | avg_line_length float64 1.21 330k | max_line_length int64 6 990k | alphanum_fraction float64 0.01 0.99 | author_id stringlengths 2 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4ce63cde6592cfc58aee4772fc5e52f4f52659df | 229 | cpp | C++ | point.cpp | Unicorn3D/Analyst | 25261a601c97a64bffd3926c125dc441ffdbb661 | [
"MIT"
] | 1 | 2016-06-16T07:08:54.000Z | 2016-06-16T07:08:54.000Z | point.cpp | Unicorn3D/Analyst | 25261a601c97a64bffd3926c125dc441ffdbb661 | [
"MIT"
] | null | null | null | point.cpp | Unicorn3D/Analyst | 25261a601c97a64bffd3926c125dc441ffdbb661 | [
"MIT"
] | null | null | null | #include "point.h"
point::point()
{
}
point::point(float lat, float lng)
{
this->lat = lat;
this->lng = lng;
}
void point::write(QJsonObject &json) const
{
json["lat"] = this->lat;
json["lng"] = this->lng;
}
| 11.45 | 42 | 0.572052 | Unicorn3D |
4ce778d1f6a68cc2e4507edb1153366b4c8b65d9 | 10,249 | cpp | C++ | thirdparty/physx/PhysXSDK/Source/PhysXMetaData/core/src/PxMetaDataObjects.cpp | johndpope/echo | e9ce2f4037e8a5d49b74cc7a9d9ee09f296e7fa7 | [
"MIT"
] | null | null | null | thirdparty/physx/PhysXSDK/Source/PhysXMetaData/core/src/PxMetaDataObjects.cpp | johndpope/echo | e9ce2f4037e8a5d49b74cc7a9d9ee09f296e7fa7 | [
"MIT"
] | 2 | 2015-06-21T17:38:11.000Z | 2015-06-22T20:54:42.000Z | thirdparty/physx/PhysXSDK/Source/PhysXMetaData/core/src/PxMetaDataObjects.cpp | johndpope/echo | e9ce2f4037e8a5d49b74cc7a9d9ee09f296e7fa7 | [
"MIT"
] | null | null | null | /*
* Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#include "PsFoundation.h"
#include "PsUtilities.h"
#include "CmPhysXCommon.h"
#include "PxMetaDataObjects.h"
#include "PxPhysicsAPI.h"
using namespace physx;
PX_PHYSX_CORE_API PxGeometryType::Enum PxShapeGeometryPropertyHelper::getGeometryType(const PxShape* inShape) const { return inShape->getGeometryType(); }
PX_PHYSX_CORE_API bool PxShapeGeometryPropertyHelper::getGeometry(const PxShape* inShape, PxBoxGeometry& geometry) const { return inShape->getBoxGeometry( geometry ); }
PX_PHYSX_CORE_API bool PxShapeGeometryPropertyHelper::getGeometry(const PxShape* inShape, PxSphereGeometry& geometry) const { return inShape->getSphereGeometry( geometry ); }
PX_PHYSX_CORE_API bool PxShapeGeometryPropertyHelper::getGeometry(const PxShape* inShape, PxCapsuleGeometry& geometry) const { return inShape->getCapsuleGeometry( geometry ); }
PX_PHYSX_CORE_API bool PxShapeGeometryPropertyHelper::getGeometry(const PxShape* inShape, PxPlaneGeometry& geometry) const { return inShape->getPlaneGeometry( geometry ); }
PX_PHYSX_CORE_API bool PxShapeGeometryPropertyHelper::getGeometry(const PxShape* inShape, PxConvexMeshGeometry& geometry) const { return inShape->getConvexMeshGeometry( geometry ); }
PX_PHYSX_CORE_API bool PxShapeGeometryPropertyHelper::getGeometry(const PxShape* inShape, PxTriangleMeshGeometry& geometry) const { return inShape->getTriangleMeshGeometry( geometry ); }
PX_PHYSX_CORE_API bool PxShapeGeometryPropertyHelper::getGeometry(const PxShape* inShape, PxHeightFieldGeometry& geometry) const { return inShape->getHeightFieldGeometry( geometry ); }
PX_PHYSX_CORE_API void PxShapeMaterialsPropertyHelper::setMaterials(PxShape* inShape, PxMaterial*const* materials, PxU16 materialCount) const
{
inShape->setMaterials( materials, materialCount );
}
PX_PHYSX_CORE_API PxShape* PxRigidActorShapeCollectionHelper::createShape(PxRigidActor* inActor, const PxGeometry& geometry, PxMaterial& material,
PxShapeFlags shapeFlags ) const
{
return inActor->createShape( geometry, material, shapeFlags );
}
PX_PHYSX_CORE_API PxShape* PxRigidActorShapeCollectionHelper::createShape(PxRigidActor* inActor, const PxGeometry& geometry, PxMaterial *const* materials,
PxU16 materialCount, PxShapeFlags shapeFlags ) const
{
return inActor->createShape( geometry, materials, materialCount, shapeFlags );
}
PX_PHYSX_CORE_API PxArticulationLink* PxArticulationLinkCollectionPropHelper::createLink(PxArticulation* inArticulation, PxArticulationLink* parent,
const PxTransform& pose) const
{
PX_CHECK_AND_RETURN_NULL(pose.isValid(), "PxArticulationLinkCollectionPropHelper::createLink pose is not valid.");
return inArticulation->createLink( parent, pose );
}
/*
typedef void (*TSetterType)( TObjType*, TIndexType, TPropertyType );
typedef TPropertyType (*TGetterType)( const TObjType* inObj, TIndexType );
*/
inline void SetNbBroadPhaseAdd( PxSimulationStatistics* inStats, PxSimulationStatistics::VolumeType data, PxU32 val ) { inStats->nbBroadPhaseAdds[data] = val; }
inline PxU32 GetNbBroadPhaseAdd( const PxSimulationStatistics* inStats, PxSimulationStatistics::VolumeType data) { return inStats->nbBroadPhaseAdds[data]; }
PX_PHYSX_CORE_API NbBroadPhaseAddsProperty::NbBroadPhaseAddsProperty()
: PxIndexedPropertyInfo<PxPropertyInfoName::PxSimulationStatistics_NbBroadPhaseAdds
, PxSimulationStatistics
, PxSimulationStatistics::VolumeType
, PxU32> ( "NbBroadPhaseAdds", SetNbBroadPhaseAdd, GetNbBroadPhaseAdd )
{
}
inline void SetNbBroadPhaseRemove( PxSimulationStatistics* inStats, PxSimulationStatistics::VolumeType data, PxU32 val ) { inStats->nbBroadPhaseRemoves[data] = val; }
inline PxU32 GetNbBroadPhaseRemove( const PxSimulationStatistics* inStats, PxSimulationStatistics::VolumeType data) { return inStats->nbBroadPhaseRemoves[data]; }
PX_PHYSX_CORE_API NbBroadPhaseRemovesProperty::NbBroadPhaseRemovesProperty()
: PxIndexedPropertyInfo<PxPropertyInfoName::PxSimulationStatistics_NbBroadPhaseRemoves
, PxSimulationStatistics
, PxSimulationStatistics::VolumeType
, PxU32> ( "NbBroadPhaseRemoves", SetNbBroadPhaseRemove, GetNbBroadPhaseRemove )
{
}
inline void SetNbShape( PxSimulationStatistics* inStats, PxGeometryType::Enum data, PxU32 val ) { inStats->nbShapes[data] = val; }
inline PxU32 GetNbShape( const PxSimulationStatistics* inStats, PxGeometryType::Enum data) { return inStats->nbShapes[data]; }
PX_PHYSX_CORE_API NbShapesProperty::NbShapesProperty()
: PxIndexedPropertyInfo<PxPropertyInfoName::PxSimulationStatistics_NbShapes
, PxSimulationStatistics
, PxGeometryType::Enum
, PxU32> ( "NbShapes", SetNbShape, GetNbShape )
{
}
inline void SetNbDiscreteContactPairs( PxSimulationStatistics* inStats, PxGeometryType::Enum idx1, PxGeometryType::Enum idx2, PxU32 val ) { inStats->nbDiscreteContactPairs[idx1][idx2] = val; }
inline PxU32 GetNbDiscreteContactPairs( const PxSimulationStatistics* inStats, PxGeometryType::Enum idx1, PxGeometryType::Enum idx2 ) { return inStats->nbDiscreteContactPairs[idx1][idx2]; }
PX_PHYSX_CORE_API NbDiscreteContactPairsProperty::NbDiscreteContactPairsProperty()
: PxDualIndexedPropertyInfo<PxPropertyInfoName::PxSimulationStatistics_NbDiscreteContactPairs
, PxSimulationStatistics
, PxGeometryType::Enum
, PxGeometryType::Enum
, PxU32> ( "NbDiscreteContactPairs", SetNbDiscreteContactPairs, GetNbDiscreteContactPairs )
{
}
inline void SetNbModifiedContactPairs( PxSimulationStatistics* inStats, PxGeometryType::Enum idx1, PxGeometryType::Enum idx2, PxU32 val ) { inStats->nbModifiedContactPairs[idx1][idx2] = val; }
inline PxU32 GetNbModifiedContactPairs( const PxSimulationStatistics* inStats, PxGeometryType::Enum idx1, PxGeometryType::Enum idx2 ) { return inStats->nbModifiedContactPairs[idx1][idx2]; }
PX_PHYSX_CORE_API NbModifiedContactPairsProperty::NbModifiedContactPairsProperty()
: PxDualIndexedPropertyInfo<PxPropertyInfoName::PxSimulationStatistics_NbModifiedContactPairs
, PxSimulationStatistics
, PxGeometryType::Enum
, PxGeometryType::Enum
, PxU32> ( "NbModifiedContactPairs", SetNbModifiedContactPairs, GetNbModifiedContactPairs )
{
}
inline void SetNbCCDPairs( PxSimulationStatistics* inStats, PxGeometryType::Enum idx1, PxGeometryType::Enum idx2, PxU32 val ) { inStats->nbCCDPairs[idx1][idx2] = val; }
inline PxU32 GetNbCCDPairs( const PxSimulationStatistics* inStats, PxGeometryType::Enum idx1, PxGeometryType::Enum idx2 ) { return inStats->nbCCDPairs[idx1][idx2]; }
PX_PHYSX_CORE_API NbCCDPairsProperty::NbCCDPairsProperty()
: PxDualIndexedPropertyInfo<PxPropertyInfoName::PxSimulationStatistics_NbCCDPairs
, PxSimulationStatistics
, PxGeometryType::Enum
, PxGeometryType::Enum
, PxU32> ( "NbCCDPairs", SetNbCCDPairs, GetNbCCDPairs )
{
}
inline void SetNbTriggerPairs( PxSimulationStatistics* inStats, PxGeometryType::Enum idx1, PxGeometryType::Enum idx2, PxU32 val ) { inStats->nbTriggerPairs[idx1][idx2] = val; }
inline PxU32 GetNbTriggerPairs( const PxSimulationStatistics* inStats, PxGeometryType::Enum idx1, PxGeometryType::Enum idx2 ) { return inStats->nbTriggerPairs[idx1][idx2]; }
PX_PHYSX_CORE_API NbTriggerPairsProperty::NbTriggerPairsProperty()
: PxDualIndexedPropertyInfo<PxPropertyInfoName::PxSimulationStatistics_NbTriggerPairs
, PxSimulationStatistics
, PxGeometryType::Enum
, PxGeometryType::Enum
, PxU32> ( "NbTriggerPairs", SetNbTriggerPairs, GetNbTriggerPairs )
{
}
inline PxSimulationStatistics GetStats( const PxScene* inScene ) { PxSimulationStatistics stats; inScene->getSimulationStatistics( stats ); return stats; }
PX_PHYSX_CORE_API SimulationStatisticsProperty::SimulationStatisticsProperty()
: PxReadOnlyPropertyInfo<PxPropertyInfoName::PxScene_SimulationStatistics, PxScene, PxSimulationStatistics >( "SimulationStatistics", GetStats )
{
}
#if PX_USE_PARTICLE_SYSTEM_API
inline void SetProjectionPlane( PxParticleBase* inBase, PxMetaDataPlane inPlane ) { inBase->setProjectionPlane( inPlane.normal, inPlane.distance ); }
inline PxMetaDataPlane GetProjectionPlane( const PxParticleBase* inBase )
{
PxMetaDataPlane retval;
inBase->getProjectionPlane( retval.normal, retval.distance );
return retval;
}
PX_PHYSX_CORE_API ProjectionPlaneProperty::ProjectionPlaneProperty()
: PxPropertyInfo< PxPropertyInfoName::PxParticleBase_ProjectionPlane, PxParticleBase, PxMetaDataPlane, PxMetaDataPlane >( "ProjectionPlane", SetProjectionPlane, GetProjectionPlane )
{
}
#endif // PX_USE_PARTICLE_SYSTEM_API
#if PX_USE_CLOTH_API
inline PxU32 GetNbPxClothFabric_Restvalues( const PxClothFabric* fabric ) { return fabric->getNbParticleIndices()/2; }
inline PxU32 GetPxClothFabric_Restvalues( const PxClothFabric* fabric, PxReal* outBuffer, PxU32 outBufLen ){ return fabric->getRestvalues( outBuffer, outBufLen ); }
PX_PHYSX_CORE_API RestvaluesProperty::RestvaluesProperty()
: PxReadOnlyCollectionPropertyInfo<PxPropertyInfoName::PxClothFabric_Restvalues, PxClothFabric, PxReal>( "Restvalues", GetPxClothFabric_Restvalues, GetNbPxClothFabric_Restvalues )
{
}
inline PxU32 GetNbPxClothFabric_PhaseTypes( const PxClothFabric* fabric ) { return fabric->getNbPhases(); }
inline PxU32 GetPxClothFabric_PhaseTypes( const PxClothFabric* fabric, PxClothFabricPhaseType::Enum* outBuffer, PxU32 outBufLen )
{
PxU32 numItems = PxMin( outBufLen, fabric->getNbPhases() );
for ( PxU32 idx = 0; idx < numItems; ++idx )
outBuffer[idx] = fabric->getPhaseType( idx );
return numItems;
}
#endif // PX_USE_CLOTH_API
| 56.624309 | 192 | 0.796273 | johndpope |
4ce77d76d10cffdd619c575b32bf8f1bbca39b7b | 6,571 | cpp | C++ | src/CellCam.cpp | odinsbane/toy-model-cell-gl | a1e976d51e9673a364f130cf5685d86ed0d50ea4 | [
"MIT"
] | null | null | null | src/CellCam.cpp | odinsbane/toy-model-cell-gl | a1e976d51e9673a364f130cf5685d86ed0d50ea4 | [
"MIT"
] | null | null | null | src/CellCam.cpp | odinsbane/toy-model-cell-gl | a1e976d51e9673a364f130cf5685d86ed0d50ea4 | [
"MIT"
] | null | null | null | #include "CellCam.h"
#include "error.h"
#include "stdio.h"
CellCam::CellCam(GLuint &program){
theProgram = program;
aspect = 1.0f;
setPerspectiveMatrix();
xx = new float[4];
yy = new float[4];
zz = new float[4];
r = 1;
for(int i = 0; i<4; i++){
quarternion[i] = 0.0;
xx[i] = 0;
yy[i] = 0;
zz[i] = 0;
}
quarternion[3] = 1.0;
updatePosition();
printf("initializing lights\n");
light_position = new float[3]{-0.5,-0.5,1.0};
light_intensity = new float[4]{0.9,0.9,0.9,1};
ambient_light = new float[4]{0.1, 0.1, 0.1, 1.0};
GetError();
updateLights();
}
void CellCam::setPosition(){
xx[0] = r;
yy[1] = r;
zz[2] = r;
x = -Framework::multiplyMatrixVector4(orientationMatrix,xx)[2];
y = -Framework::multiplyMatrixVector4(orientationMatrix,yy)[2];
z = -Framework::multiplyMatrixVector4(orientationMatrix,zz)[2];
GLuint cam_offset = glGetUniformLocation(theProgram, "cam_offset");
glUseProgram(theProgram);
glUniform3f(cam_offset, x, y, z);
glUseProgram(0);
}
void CellCam::zoom(double dr){
r += dr;
updatePosition();
}
void CellCam::updatePosition(){
setRotation();
setPosition();
}
void CellCam::setPerspectiveMatrix(){
float fFrustumScale = 1.0f;
float fzNear = 0.5f;
float fzFar = 10.0f;
//column
perspectiveMatrix[0] = fFrustumScale/aspect;
perspectiveMatrix[1] = 0;
perspectiveMatrix[2] = 0;
perspectiveMatrix[3] = 0;
//column
perspectiveMatrix[4] = 0;
perspectiveMatrix[5] = fFrustumScale;
perspectiveMatrix[6] = 0;
perspectiveMatrix[7] = 0;
//column
perspectiveMatrix[8] = 0;
perspectiveMatrix[9] = 0;
perspectiveMatrix[10] = (fzFar + fzNear) / (fzNear - fzFar);
perspectiveMatrix[11] = -1.0f;
//column
perspectiveMatrix[12] = 0;
perspectiveMatrix[13] = 0;
perspectiveMatrix[14] = 2.f*fzFar*fzNear / (fzNear - fzFar);
perspectiveMatrix[15] = 0;
GLuint perspectiveMatrixUnif = glGetUniformLocation(theProgram, "perspectiveMatrix");
glUseProgram(theProgram);
glUniformMatrix4fv(perspectiveMatrixUnif, 1, GL_FALSE, perspectiveMatrix);
glUseProgram(0);
}
void CellCam::rotate(float dtheta, float dphi){
if(dtheta==0){
float axis[4];
float sdp = sin(dphi/2.0);
axis[0] = sdp*xx[0];
axis[1] = sdp*xx[1];
axis[2] = sdp*xx[2];
axis[3] = cos(dphi/2.0);
rotate(axis);
} else{
float axis[4];
float sdp = sin(dtheta/2.0);
axis[0] = sdp*yy[0];
axis[1] = sdp*yy[1];
axis[2] = sdp*yy[2];
axis[3] = cos(dtheta/2.0);
rotate(axis);
}
updatePosition();
}
void CellCam::rotate(float* quat){
float next[4];
float sum = 0;
next[0] = quarternion[3]*quat[0] + quarternion[0]*quat[3] + quarternion[1]*quat[2] - quarternion[2]*quat[1];
sum += next[0]*next[0];
next[1] = quarternion[3]*quat[1] + quarternion[1]*quat[3] + quarternion[2]*quat[0] - quarternion[0]*quat[2];
sum += next[1]*next[1];
next[2] = quarternion[3]*quat[2] + quarternion[2]*quat[3] + quarternion[0]*quat[1] - quarternion[1]*quat[0];
sum += next[2]*next[2];
next[3] = quarternion[3]*quat[3] - quarternion[0]*quat[0] - quarternion[1]*quat[1] - quarternion[2]*quat[2];
sum += next[3]*next[3];
sum = sqrt(sum);
for(int i = 0; i<4; i++){
quarternion[i] = next[i]/sum;
}
}
void CellCam::setRotation(){
orientationMatrix[0] = 1 - 2*quarternion[1]*quarternion[1]-2*quarternion[2]*quarternion[2];
orientationMatrix[1] = 2*quarternion[0]*quarternion[1] + 2*quarternion[3]*quarternion[2];
orientationMatrix[2] = 2*quarternion[0]*quarternion[2] - 2*quarternion[3]*quarternion[1];
orientationMatrix[3] = 0;
orientationMatrix[4] = 2*quarternion[0]*quarternion[1] - 2*quarternion[3]*quarternion[2];
orientationMatrix[5] = 1 - 2*quarternion[0]*quarternion[0]-2*quarternion[2]*quarternion[2];
orientationMatrix[6] = 2*quarternion[1]*quarternion[2] + 2*quarternion[3]*quarternion[0];
orientationMatrix[7] = 0;
orientationMatrix[8] = 2*quarternion[0]*quarternion[2] + 2*quarternion[3]*quarternion[1];
orientationMatrix[9] = 2*quarternion[1]*quarternion[2] - 2*quarternion[3]*quarternion[0];
orientationMatrix[10] = 1 - 2*quarternion[0]*quarternion[0]-2*quarternion[1]*quarternion[1];
orientationMatrix[11] = 0;
orientationMatrix[12] = 0;
orientationMatrix[13] = 0;
orientationMatrix[14] = 0;
orientationMatrix[15] = 1;
for(int i = 0; i<3; i++){
for(int j = 0; j<3; j++){
normalMatrix[i + 3*j] = orientationMatrix[i + 4*j];
}
}
GLuint orientationMatrixUnif = glGetUniformLocation(theProgram, "orientationMatrix");
GLuint normalMatrixUniform = glGetUniformLocation(theProgram, "normalModelToCameraMatrix");
glUseProgram(theProgram);
glUniformMatrix4fv(orientationMatrixUnif, 1, GL_FALSE, orientationMatrix);
glUniformMatrix3fv(normalMatrixUniform, 1, GL_FALSE, normalMatrix);
glUseProgram(0);
}
/*
* Changes the display aspect ratio, such that more of the image is shown in a
* particular direction.
*
*/
void CellCam::resizeWindow(float w, float h){
aspect = w/h;
}
void CellCam::updateLights(){
float cast[2]{0,0};
cast[0] = -light_position[0]*0.5/light_position[2];
cast[1] = -light_position[1]*0.5/light_position[2];
GLuint lightPositionUniform = glGetUniformLocation(theProgram, "lightPos");
GLuint lightIntensityUniform = glGetUniformLocation(theProgram, "lightIntensity");
GLuint ambientIntensityUniform = glGetUniformLocation(theProgram, "ambientIntensity");
GLuint radiusUniform = glGetUniformLocation(theProgram, "RADIUS");
GLuint castUniform = glGetUniformLocation(theProgram, "CAST_LOCATION");
glUseProgram(theProgram);
printf("ru: %d; cl: %d\n", radiusUniform, castUniform);
glUniform1f(radiusUniform, 0.5);
glUniform2fv(castUniform, 1, cast);
glUniform3fv(lightPositionUniform, 1, light_position);
GetError();
glUniform4fv(lightIntensityUniform, 1, light_intensity);
glUniform4fv(ambientIntensityUniform, 1, ambient_light);
printf("pos: %d int: %d amb: %d\n", lightPositionUniform, lightIntensityUniform, ambientIntensityUniform);
glUseProgram(0);
}
| 29.599099 | 112 | 0.628671 | odinsbane |
4ceb3c3726b0bcc22f9208e1cc63b0c9b09a20d0 | 3,009 | cpp | C++ | GraphManager/shared/DrRef.cpp | TheWhiteEagle/Dryad | ad28579dd8303925befc6502633949850b7ca550 | [
"Apache-2.0"
] | 242 | 2015-01-04T08:08:04.000Z | 2022-03-31T02:00:14.000Z | GraphManager/shared/DrRef.cpp | TheWhiteEagle/Dryad | ad28579dd8303925befc6502633949850b7ca550 | [
"Apache-2.0"
] | 2 | 2015-04-30T07:44:42.000Z | 2015-05-19T06:24:31.000Z | GraphManager/shared/DrRef.cpp | TheWhiteEagle/Dryad | ad28579dd8303925befc6502633949850b7ca550 | [
"Apache-2.0"
] | 50 | 2015-01-13T20:39:53.000Z | 2022-01-09T20:42:34.000Z | /*
Copyright (c) Microsoft Corporation
All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License
at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER
EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF
TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions and
limitations under the License.
*/
#include "DrShared.h"
#ifdef _MANAGED
#else
#define DRREF_MAGIC_CONSTRUCTOR_VALUE (-666)
#ifdef _DEBUG_DRREF
std::set<DrRefCounter*> DrRefCounter::s_refsAllocated;
std::map<void*,DrRefCounter*> DrRefCounter::s_arrayStorage;
CRITICAL_SECTION DrRefCounter::s_debugCS;
#endif
DrRefCounter::DrRefCounter() : m_iRefCount( DRREF_MAGIC_CONSTRUCTOR_VALUE )
{
#ifdef _DEBUG_DRREF
EnterCriticalSection(&s_debugCS);
bool inserted = s_refsAllocated.insert(this).second;
DrAssert(inserted);
LeaveCriticalSection(&s_debugCS);
#endif
}
DrRefCounter::~DrRefCounter()
{
DrAssert(m_iRefCount == 0);
#ifdef _DEBUG_DRREF
DrAssert(m_holders.empty());
EnterCriticalSection(&s_debugCS);
size_t nRemoved = s_refsAllocated.erase(this);
DrAssert(nRemoved == 1);
LeaveCriticalSection(&s_debugCS);
#endif
}
void DrRefCounter::FreeMemory() // Called when the refcount becomes zero.
{
delete this;
}
#ifdef _DEBUG_DRREF
void DrRefCounter::IncRef(void* h)
{
EnterCriticalSection(&s_debugCS);
++m_iRefCount;
if (m_iRefCount <= 1)
{
// this is the first assignment of a newly constructed object */
DrAssert(m_iRefCount == (DRREF_MAGIC_CONSTRUCTOR_VALUE + 1));
m_iRefCount = 1;
}
bool inserted = m_holders.insert(h).second;
DrAssert(inserted);
DrAssert(m_holders.size() == (size_t) m_iRefCount);
LeaveCriticalSection(&s_debugCS);
}
#else
void DrRefCounter::IncRef()
{
LONG i;
i = InterlockedIncrement(&m_iRefCount);
if (i <= 1)
{
// this is the first assignment of a newly constructed object */
DrAssert(i == (DRREF_MAGIC_CONSTRUCTOR_VALUE + 1));
m_iRefCount = 1;
}
}
#endif
#ifdef _DEBUG_DRREF
void DrRefCounter::DecRef(void* h)
{
EnterCriticalSection(&s_debugCS);
DrAssert(m_holders.size() == (size_t) m_iRefCount);
size_t nRemoved = m_holders.erase(h);
DrAssert(nRemoved == 1);
--m_iRefCount;
if (m_iRefCount <= 0)
{
DrAssert(m_iRefCount == 0);
FreeMemory();
}
LeaveCriticalSection(&s_debugCS);
}
#else
void DrRefCounter::DecRef()
{
LONG i;
i = InterlockedDecrement(&m_iRefCount);
if (i <= 0)
{
DrAssert(i == 0);
FreeMemory();
}
}
#endif
void DrInterfaceRefBase::AssertTypeCast()
{
DrLogA("Type cast failed");
}
#endif | 23.880952 | 100 | 0.699236 | TheWhiteEagle |
4cec70398d1c3c0086f32b0ada552e06029c28fc | 782 | cpp | C++ | wumpus_simulator/src/model/Agent.cpp | dasys-lab/cnc-turtlebots | c3749d3905f85c7955a8da8cb3194f7fbe0ba64b | [
"MIT"
] | null | null | null | wumpus_simulator/src/model/Agent.cpp | dasys-lab/cnc-turtlebots | c3749d3905f85c7955a8da8cb3194f7fbe0ba64b | [
"MIT"
] | null | null | null | wumpus_simulator/src/model/Agent.cpp | dasys-lab/cnc-turtlebots | c3749d3905f85c7955a8da8cb3194f7fbe0ba64b | [
"MIT"
] | null | null | null | /*
* Agent.cpp
*
* Created on: Dec 1, 2016
* Author: stefan
*/
#include <model/Agent.h>
namespace wumpus_simulator
{
Agent::Agent(shared_ptr<GroundTile> tile)
{
this->tile = tile;
type = "agent";
arrow = false;
hasGold = false;
this->heading = WumpusEnums::heading::up;
}
Agent::~Agent()
{
}
bool Agent::hasArrow()
{
return arrow;
}
void Agent::setArrow(bool value)
{
this->arrow = value;
}
WumpusEnums::heading Agent::getHeading()
{
return heading;
}
void Agent::setHeading(WumpusEnums::heading heading)
{
this->heading = heading;
}
void wumpus_simulator::Agent::setHasGold(bool value)
{
this->hasGold = value;
}
bool wumpus_simulator::Agent::getHasGold()
{
return hasGold;
}
} /* namespace wumpus_simulator */
| 13.254237 | 53 | 0.648338 | dasys-lab |
4cf026b586614503a05d7e51c2ecb3e9b6737920 | 2,843 | hpp | C++ | src/Evolution/Systems/NewtonianEuler/PrimitiveFromConservative.hpp | GAcuna001/spectre | 645a7f203b2ced1b1205e346d3abaf2adaf0e6ba | [
"MIT"
] | null | null | null | src/Evolution/Systems/NewtonianEuler/PrimitiveFromConservative.hpp | GAcuna001/spectre | 645a7f203b2ced1b1205e346d3abaf2adaf0e6ba | [
"MIT"
] | null | null | null | src/Evolution/Systems/NewtonianEuler/PrimitiveFromConservative.hpp | GAcuna001/spectre | 645a7f203b2ced1b1205e346d3abaf2adaf0e6ba | [
"MIT"
] | null | null | null | // Distributed under the MIT License.
// See LICENSE.txt for details.
#pragma once
#include <cstddef>
#include "DataStructures/Tensor/TypeAliases.hpp"
#include "Evolution/Systems/NewtonianEuler/TagsDeclarations.hpp" // IWYU pragma: keep
#include "PointwiseFunctions/Hydro/EquationsOfState/EquationOfState.hpp" // IWYU pragma: keep
#include "PointwiseFunctions/Hydro/Tags.hpp"
#include "Utilities/TMPL.hpp"
// IWYU pragma: no_forward_declare EquationsOfState::EquationOfState
// IWYU pragma: no_forward_declare NewtonianEuler::Tags::EnergyDensity
// IWYU pragma: no_forward_declare NewtonianEuler::Tags::MassDensity
// IWYU pragma: no_forward_declare NewtonianEuler::Tags::MassDensityCons
// IWYU pragma: no_forward_declare NewtonianEuler::Tags::MomentumDensity
// IWYU pragma: no_forward_declare NewtonianEuler::Tags::Pressure
// IWYU pragma: no_forward_declare NewtonianEuler::Tags::SpecificInternalEnergy
// IWYU pragma: no_forward_declare NewtonianEuler::Tags::Velocity
// IWYU pragma: no_forward_declare hydro::Tags::EquationOfStateBase
/// \cond
namespace gsl {
template <typename T>
class not_null;
} // namespace gsl
class DataVector;
/// \endcond
// IWYU pragma: no_forward_declare Tensor
namespace NewtonianEuler {
/*!
* \brief Compute the primitive variables from the conservative variables.
*
* \f{align*}
* v^i &= \frac{S^i}{\rho} \\
* \epsilon &= \frac{e}{\rho} - \frac{1}{2}\frac{S^2}{\rho^2}
* \f}
*
* where \f$v^i\f$ is the velocity, \f$\epsilon\f$ is the specific
* internal energy, \f$e\f$ is the energy density, \f$\rho\f$
* is the mass density, \f$S^i\f$ is the momentum density, and
* \f$S^2\f$ is the momentum density squared.
*
* This routine also returns the mass density as a primitive, and the pressure
* from a generic equation of state \f$p = p(\rho, \epsilon)\f$.
*/
template <size_t Dim>
struct PrimitiveFromConservative {
using return_tags =
tmpl::list<Tags::MassDensity<DataVector>, Tags::Velocity<DataVector, Dim>,
Tags::SpecificInternalEnergy<DataVector>,
Tags::Pressure<DataVector>>;
using argument_tags =
tmpl::list<Tags::MassDensityCons, Tags::MomentumDensity<Dim>,
Tags::EnergyDensity, hydro::Tags::EquationOfStateBase>;
template <size_t ThermodynamicDim>
static void apply(
gsl::not_null<Scalar<DataVector>*> mass_density,
gsl::not_null<tnsr::I<DataVector, Dim>*> velocity,
gsl::not_null<Scalar<DataVector>*> specific_internal_energy,
gsl::not_null<Scalar<DataVector>*> pressure,
const Scalar<DataVector>& mass_density_cons,
const tnsr::I<DataVector, Dim>& momentum_density,
const Scalar<DataVector>& energy_density,
const EquationsOfState::EquationOfState<false, ThermodynamicDim>&
equation_of_state) noexcept;
};
} // namespace NewtonianEuler
| 36.922078 | 94 | 0.730918 | GAcuna001 |
4cf4105a46744bc1e966fc799296dfbba60826df | 3,997 | cpp | C++ | src/SignalOperation/KeySampler.cpp | Lut1n/QuasarBell | c5b5052ac1db94d0a97fd07e512883a9fd244fd5 | [
"MIT"
] | 2 | 2021-01-31T10:06:33.000Z | 2021-03-10T13:20:15.000Z | src/SignalOperation/KeySampler.cpp | Lut1n/QuasarBell | c5b5052ac1db94d0a97fd07e512883a9fd244fd5 | [
"MIT"
] | null | null | null | src/SignalOperation/KeySampler.cpp | Lut1n/QuasarBell | c5b5052ac1db94d0a97fd07e512883a9fd244fd5 | [
"MIT"
] | null | null | null | #include "SignalOperation/KeySampler.hpp"
#include <iostream>
#include <string>
#include "imgui.h"
#include "Json/Json.hpp"
//--------------------------------------------------------------
KeySampler::KeySampler()
{
_hasCustomData = true;
makeOutput("value", BaseOperationDataType::Float);
makeProperty("count", BaseOperationDataType::Int, &count);
makeProperty("interpo", BaseOperationDataType::Int, &interpo);
keys.resize(1,{0.f,1.f});
}
//--------------------------------------------------------------
bool KeySampler::sample(size_t index, qb::PcmBuilderVisitor& visitor)
{
// t.dstOp = this;
qb::OperationData& data = visitor.data;
auto output = getOutput(0);
data.type = output->type;
float& t = visitor.time.t;
int index1 = -1;
int index2 = -1;
for(size_t i=0; i<keys.size(); ++i)
{
int j = (int)(keys.size()-1-i);
if(keys[i].first <= t) index1 = (int)i;
if(keys[j].first >= t) index2 = (int)j;
}
if(index1 == -1 && index2 == -1)
data.fvec[0] = 0.0;
else if(index1 == -1)
data.fvec[0] = keys[index2].second;
else if(index2 == -1)
data.fvec[0] = keys[index1].second;
else if(index1 == index2)
data.fvec[0] = keys[index1].second;
else
{
float x = (t-keys[index1].first) / (keys[index2].first-keys[index1].first);
data.fvec[0] = keys[index1].second + interpolate(x) * (keys[index2].second-keys[index1].second);
}
return true;
}
//--------------------------------------------------------------
float KeySampler::interpolate(float x)
{
if (interpo == Interpo::Flat)
return 0;
else if (interpo == Interpo::Linear)
return x;
else if (interpo == Interpo::Cubic)
return x * x * (3.f - 2.f * x);
return x;
}
//--------------------------------------------------------------
void KeySampler::saveCustomData(JsonValue& json)
{
auto& jArray = json.setPath("key-values");
int index = 0;
for (auto kv : keys)
{
jArray.setPath(index, 0).set(kv.first);
jArray.setPath(index, 1).set(kv.second);
index++;
}
}
//--------------------------------------------------------------
void KeySampler::loadCustomData(JsonValue& json)
{
auto& jArray = json.setPath("key-values");
count = (int)jArray.count();
keys.resize(jArray.count());
int index = 0;
for(auto& jkv : jArray.array.values)
{
keys[index] = {(float)jkv.setPath(0).getNumeric(),(float) jkv.setPath(1).getNumeric()};
index++;
}
}
//--------------------------------------------------------------
void KeySampler::uiProperties()
{
constexpr size_t typeCount = 3;
constexpr std::array<const char*, typeCount> typeNames = {"flat", "linear", "cubic"};
if (ImGui::Button(typeNames[interpo]))
{
interpo = (interpo+1) % typeCount;
dirty();
}
if (ImGui::InputInt("count", &count))
{
if (count < 1) count = 1;
if (count > 10) count = 10;
keys.resize(count);
dirty();
}
ImGui::Columns(2);
ImGui::Text("Time");
ImGui::NextColumn();
ImGui::Text("Value");
ImGui::NextColumn();
ImGui::Separator();
int index = 0;
for(auto& kv : keys)
{
std::string keytext = std::string("##key") + std::to_string(index);
std::string valtext = std::string("##val") + std::to_string(index);
if (ImGui::InputFloat(keytext.c_str(), &kv.first)) dirty();
ImGui::NextColumn();
if (ImGui::InputFloat(valtext.c_str(), &kv.second)) dirty();
ImGui::NextColumn();
index++;
}
ImGui::Columns(1);
ImGui::Separator();
ImGui::Text("Preview");
preview.compute(this);
ImGui::PlotLines("##preview", preview.data.data(), 32, 0, NULL, FLT_MAX, FLT_MAX, ImVec2(0, 60.0f));
} | 30.052632 | 105 | 0.504128 | Lut1n |
4cf47eebe814d6cd8b406fc93172bcbfcf6d1d08 | 6,073 | cpp | C++ | src/ML/Graphics/Image.cpp | Gurman8r/ML | 171e7865291f3fd9ea748d59f9d4bdb4e2a6eed1 | [
"MIT"
] | 3 | 2019-10-09T19:03:05.000Z | 2019-12-15T14:22:38.000Z | src/ML/Graphics/Image.cpp | Gurman8r/ML | 171e7865291f3fd9ea748d59f9d4bdb4e2a6eed1 | [
"MIT"
] | null | null | null | src/ML/Graphics/Image.cpp | Gurman8r/ML | 171e7865291f3fd9ea748d59f9d4bdb4e2a6eed1 | [
"MIT"
] | null | null | null | #include <ML/Graphics/Image.hpp>
#include <ML/Core/Debug.hpp>
#define STB_IMAGE_IMPLEMENTATION
#include <stb/stb_image.h>
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
namespace ml
{
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static inline Image generate_default_image()
{
Image img { vec2u{ 512, 512 }, 4 };
for (uint32_t y = 0; y < img.height(); y++)
{
for (uint32_t x = 0; x < img.width(); x++)
{
img.setPixel(x, y,
(((y < img.height() / 2) && (x < img.width() / 2)) ||
((y >= img.height() / 2) && (x >= img.width() / 2))
? Color(Color(0.1f).rgb(), 1.0)
: (((y >= img.height() / 2) || (x >= img.width() / 2))
? Colors::magenta
: Colors::green
)));
}
}
return img;
}
const Image Image::Default { generate_default_image() };
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Image::Image()
: Image { vec2u { NULL } }
{
}
Image::Image(vec2u const & size)
: Image { size, 4 }
{
}
Image::Image(vec2u const & size, uint32_t channels)
: Image { size, Pixels(), channels }
{
}
Image::Image(vec2u const & size, Pixels const & pixels)
: Image { size, pixels, 4 }
{
}
Image::Image(vec2u const & size, Pixels const & pixels, uint32_t channels)
: m_size { size }
, m_pixels { pixels }
, m_channels { channels }
{
if (const uint32_t c { this->capacity() })
{
if (m_pixels.empty() || (m_pixels.size() != c))
{
m_pixels.resize(c);
}
}
}
Image::Image(String const & filename)
: Image { filename, false }
{
}
Image::Image(String const & filename, bool flip_v)
: Image { filename, flip_v, 0 }
{
}
Image::Image(String const & filename, bool flip_v, uint32_t req_comp)
: Image {}
{
this->loadFromFile(filename, flip_v, req_comp);
}
Image::Image(Image const & copy)
: Image {}
{
this->update(copy.m_size, copy.m_channels, copy.m_pixels);
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
bool Image::dispose()
{
if (!m_pixels.empty())
{
Pixels().swap(m_pixels);
}
m_size = { 0, 0 };
m_channels = 0;
return !(*this);
}
bool Image::loadFromFile(String const & filename)
{
return loadFromFile(filename, true);
}
bool Image::loadFromFile(String const & filename, bool flip_v)
{
return loadFromFile(filename, flip_v, 0);
}
bool Image::loadFromFile(String const & filename, bool flip_v, uint32_t req_comp)
{
stbi_set_flip_vertically_on_load(flip_v);
if (byte_t * data = stbi_load(
filename.c_str(),
(int32_t *)(&m_size[0]),
(int32_t *)(&m_size[1]),
(int32_t *)(&m_channels),
req_comp
))
{
update({ data, data + capacity() });
stbi_image_free(data);
return (*this);
}
return dispose();
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Image & Image::update(vec2u const & size, Color32 const & color)
{
return update(size, channels(), color);
}
Image & Image::update(Color32 const & color)
{
return update(size(), channels(), color);
}
Image & Image::update(vec2u const & size, uint32_t channels, Color32 const & color)
{
if (size[0] && size[1] && channels)
{
m_size = size;
m_channels = channels;
m_pixels.resize(capacity());
iterator it { begin() };
while (it != end())
{
if (m_channels >= 1) *it++ = color[0];
if (m_channels >= 2) *it++ = color[1];
if (m_channels >= 3) *it++ = color[2];
if (m_channels >= 4) *it++ = color[3];
}
return (*this);
}
dispose();
return (*this);
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Image & Image::update(vec2u const & size, Pixels const & pixels)
{
return update(size, m_channels, pixels);
}
Image & Image::update(Pixels const & pixels)
{
return update(m_size, m_channels, pixels);
}
Image & Image::update(vec2u const & size, uint32_t channels, Pixels const & pixels)
{
if (!pixels.empty() && (pixels.size() == (size[0] * size[1] * channels)))
{
m_size = size;
m_channels = channels;
m_pixels.assign(pixels.begin(), pixels.end());
return (*this);
}
dispose();
return (*this);
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Image & Image::flipHorizontally()
{
if (*this)
{
const uint32_t cols { width() * channels() };
for (uint32_t y = 0; y < height(); ++y)
{
iterator lhs { begin() + y * cols };
iterator rhs { begin() + (y + 1) * cols - channels() };
for (uint32_t x = 0; x < width() / 2; ++x)
{
std::swap_ranges(lhs, lhs + channels(), rhs);
lhs += channels();
rhs -= channels();
}
}
}
return (*this);
}
Image & Image::flipVertically()
{
if (*this)
{
const uint32_t cols { width() * channels() };
iterator top { begin() };
iterator bot { end() - cols };
for (uint32_t y = 0; y < height() / 2; ++y)
{
std::swap_ranges(top, top + cols, bot);
top += cols;
bot -= cols;
}
}
return (*this);
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Color32 Image::getPixel(uint32_t x, uint32_t y) const
{
Color32 temp { Colors::clear };
const size_t i { (x + y * m_size[0]) * m_channels };
if (i < capacity())
{
const_iterator it { cbegin() + i };
if (m_channels >= 1) temp[0] = *(it + 0);
if (m_channels >= 2) temp[1] = *(it + 1);
if (m_channels >= 3) temp[2] = *(it + 2);
if (m_channels >= 4) temp[3] = *(it + 3);
}
return temp;
}
Image & Image::setPixel(uint32_t x, uint32_t y, Color32 const & color)
{
const size_t i { (x + y * m_size[0]) * m_channels };
if (i < capacity())
{
iterator it { begin() + i };
if (m_channels >= 1) *it++ = color[0];
if (m_channels >= 2) *it++ = color[1];
if (m_channels >= 3) *it++ = color[2];
if (m_channels >= 4) *it++ = color[3];
}
return (*this);
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
} | 22.916981 | 84 | 0.503376 | Gurman8r |
e07cfb66e6048da2a26e32e0aa88f53c6b7541cb | 5,683 | cpp | C++ | DemoApps/Shared/VulkanWillemsMeshDemoAppExperimental/source/Shared/VulkanWillemsMeshDemoAppExperimental/VulkanMeshLoaderAssimp.cpp | alejandrolozano2/OpenGL_DemoFramework | 5fd85f05c98cc3d0c0a68bac438035df8cabaee7 | [
"MIT",
"BSD-3-Clause"
] | 3 | 2019-01-19T20:21:24.000Z | 2021-08-10T02:11:32.000Z | DemoApps/Shared/VulkanWillemsMeshDemoAppExperimental/source/Shared/VulkanWillemsMeshDemoAppExperimental/VulkanMeshLoaderAssimp.cpp | alejandrolozano2/OpenGL_DemoFramework | 5fd85f05c98cc3d0c0a68bac438035df8cabaee7 | [
"MIT",
"BSD-3-Clause"
] | null | null | null | DemoApps/Shared/VulkanWillemsMeshDemoAppExperimental/source/Shared/VulkanWillemsMeshDemoAppExperimental/VulkanMeshLoaderAssimp.cpp | alejandrolozano2/OpenGL_DemoFramework | 5fd85f05c98cc3d0c0a68bac438035df8cabaee7 | [
"MIT",
"BSD-3-Clause"
] | 1 | 2021-08-10T02:11:33.000Z | 2021-08-10T02:11:33.000Z | /*
* Mesh loader for creating Vulkan resources from models loaded with ASSIMP
*
* Copyright (C) 2016 by Sascha Willems - www.saschawillems.de
*
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
*/
// Based on a code by Sascha Willems from https://github.com/SaschaWillems/Vulkan
// Recreated as a DemoFramework freestyle window sample by Freescale (2016)
// This class simulates the functionality found in VulkanMeshLoader to make it easier
// to port samples. It is not a straight port, but it has instead been converted to
// follow the RAII principle used in this framework
#include <Shared/VulkanWillemsMeshDemoAppExperimental/VulkanMeshLoaderAssimp.hpp>
#include <Shared/VulkanWillemsDemoAppExperimental/Config.hpp>
#include <FslBase/Exceptions.hpp>
#include <FslBase/IO/File.hpp>
#include <FslDemoApp/Base/Service/Content/IContentManager.hpp>
#include <FslGraphics/Texture/Texture.hpp>
#include <RapidVulkan/Buffer.hpp>
#include <RapidVulkan/Check.hpp>
#include <RapidVulkan/Fence.hpp>
#include <algorithm>
#include <cstring>
#include <utility>
namespace Fsl
{
//using namespace Vulkan;
namespace Willems
{
namespace
{
const IO::Path ToAbsolutePath(const IO::Path& trustedAbsPath, const IO::Path& notTrustedRelativePath)
{
assert(!trustedAbsPath.IsEmpty());
// Do a lot of extra validation
if (notTrustedRelativePath.IsEmpty())
throw std::invalid_argument(std::string("path is invalid: ") + notTrustedRelativePath.ToAsciiString());
if (IO::Path::IsPathRooted(notTrustedRelativePath))
throw std::invalid_argument(std::string("not a relative path: ") + notTrustedRelativePath.ToAsciiString());
if (notTrustedRelativePath.Contains(".."))
throw std::invalid_argument(std::string("\"..\" not allowed in the relative path: ") + notTrustedRelativePath.ToAsciiString());
return IO::Path::Combine(trustedAbsPath, notTrustedRelativePath);
}
}
VulkanMeshLoaderAssimp::VulkanMeshLoaderAssimp(const std::shared_ptr<IContentManager>& contentManager)
: VulkanMeshLoader(contentManager)
{
if (!contentManager)
throw std::invalid_argument("contentManager can not be null");
}
VulkanMeshLoaderAssimp::~VulkanMeshLoaderAssimp()
{
}
void VulkanMeshLoaderAssimp::LoadMeshNow(const std::string& relativePath, std::vector<MeshEntry>& rEntries, Dimension& rDim)
{
LoadMeshNow(relativePath, DefaultFlags, rEntries, rDim);
}
void VulkanMeshLoaderAssimp::LoadMeshNow(const std::string& relativePath, const int flags, std::vector<MeshEntry>& rEntries, Dimension& rDim)
{
const IO::Path absPath(ToAbsolutePath(GetContentPath(), relativePath));
auto pScene = Importer.ReadFile(absPath.ToAsciiString().c_str(), flags);
if (! pScene)
throw NotSupportedException(std::string("Could not read file: ") + absPath.ToAsciiString());
rEntries.clear();
rEntries.resize(pScene->mNumMeshes);
// Read in all meshes in the scene
uint32_t numVertices = 0;
for (std::size_t i = 0; i < rEntries.size(); ++i)
{
rEntries[i].VertexBase = numVertices;
numVertices += pScene->mMeshes[i]->mNumVertices;
const aiMesh* paiMesh = pScene->mMeshes[i];
InitMesh(rEntries[i], paiMesh, pScene, rDim);
}
}
void VulkanMeshLoaderAssimp::InitMesh(MeshEntry& rMeshEntry, const aiMesh*const pAiMesh, const aiScene*const pScene, Dimension& rDim)
{
assert(pAiMesh != nullptr);
assert(pScene != nullptr);
rMeshEntry.MaterialIndex = pAiMesh->mMaterialIndex;
aiColor3D pColor(0.f, 0.f, 0.f);
pScene->mMaterials[pAiMesh->mMaterialIndex]->Get(AI_MATKEY_COLOR_DIFFUSE, pColor);
aiVector3D Zero3D(0.0f, 0.0f, 0.0f);
rMeshEntry.Vertices.clear();
rMeshEntry.Vertices.resize(pAiMesh->mNumVertices);
for (unsigned int i = 0; i < pAiMesh->mNumVertices; i++)
{
aiVector3D* pPos = &(pAiMesh->mVertices[i]);
aiVector3D* pNormal = &(pAiMesh->mNormals[i]);
aiVector3D* pTexCoord = (pAiMesh->HasTextureCoords(0)) ? &(pAiMesh->mTextureCoords[0][i]) : &Zero3D;
aiVector3D* pTangent = (pAiMesh->HasTangentsAndBitangents()) ? &(pAiMesh->mTangents[i]) : &Zero3D;
aiVector3D* pBiTangent = (pAiMesh->HasTangentsAndBitangents()) ? &(pAiMesh->mBitangents[i]) : &Zero3D;
Vertex v(
glm::vec3(pPos->x, -pPos->y, pPos->z),
glm::vec2(pTexCoord->x, pTexCoord->y),
glm::vec3(pNormal->x, pNormal->y, pNormal->z),
glm::vec3(pTangent->x, pTangent->y, pTangent->z),
glm::vec3(pBiTangent->x, pBiTangent->y, pBiTangent->z),
glm::vec3(pColor.r, pColor.g, pColor.b)
);
rDim.max.x = std::max(pPos->x, rDim.max.x);
rDim.max.y = std::max(pPos->y, rDim.max.y);
rDim.max.z = std::max(pPos->z, rDim.max.z);
rDim.min.x = std::min(pPos->x, rDim.min.x);
rDim.min.y = std::min(pPos->y, rDim.min.y);
rDim.min.z = std::min(pPos->z, rDim.min.z);
rMeshEntry.Vertices[i] = v;
}
rDim.size = rDim.max - rDim.min;
uint32_t indexBase = static_cast<uint32_t>(rMeshEntry.Indices.size());
for (unsigned int i = 0; i < pAiMesh->mNumFaces; i++)
{
const aiFace& Face = pAiMesh->mFaces[i];
if (Face.mNumIndices == 3)
{
rMeshEntry.Indices.push_back(indexBase + Face.mIndices[0]);
rMeshEntry.Indices.push_back(indexBase + Face.mIndices[1]);
rMeshEntry.Indices.push_back(indexBase + Face.mIndices[2]);
}
}
}
}
}
| 36.429487 | 145 | 0.665846 | alejandrolozano2 |
e07ee8ca0eebbbfd6367120f3f5d286321f641ff | 465 | cpp | C++ | src/loggers/messenger_logger.cpp | pmenon/noisepage | 73d50cdfa2e15b5d45e61b51e34672d10a851e14 | [
"MIT"
] | 971 | 2020-09-13T10:24:02.000Z | 2022-03-31T07:02:51.000Z | src/loggers/messenger_logger.cpp | pmenon/noisepage | 73d50cdfa2e15b5d45e61b51e34672d10a851e14 | [
"MIT"
] | 1,019 | 2018-07-20T23:11:10.000Z | 2020-09-10T06:41:42.000Z | src/loggers/messenger_logger.cpp | pmenon/noisepage | 73d50cdfa2e15b5d45e61b51e34672d10a851e14 | [
"MIT"
] | 318 | 2018-07-23T16:48:16.000Z | 2020-09-07T09:46:31.000Z | #include "loggers/messenger_logger.h"
#include <memory>
namespace noisepage::messenger {
#ifdef NOISEPAGE_USE_LOGGING
common::SanctionedSharedPtr<spdlog::logger>::Ptr messenger_logger = nullptr;
void InitMessengerLogger() {
if (messenger_logger == nullptr) {
messenger_logger = std::make_shared<spdlog::logger>("messenger_logger", ::default_sink); // NOLINT
spdlog::register_logger(messenger_logger);
}
}
#endif
} // namespace noisepage::messenger
| 27.352941 | 103 | 0.75914 | pmenon |
e084a7e9ed1121316e77fba00ea902f104838b11 | 8,844 | inl | C++ | include/tpf/geometry/tpf_cuboid.inl | UniStuttgart-VISUS/tpf | cf9327363242daff9644bc0d0e40577cdaaf97aa | [
"MIT"
] | null | null | null | include/tpf/geometry/tpf_cuboid.inl | UniStuttgart-VISUS/tpf | cf9327363242daff9644bc0d0e40577cdaaf97aa | [
"MIT"
] | 1 | 2021-06-10T15:24:28.000Z | 2021-06-10T15:24:28.000Z | include/tpf/geometry/tpf_cuboid.inl | UniStuttgart-VISUS/tpf | cf9327363242daff9644bc0d0e40577cdaaf97aa | [
"MIT"
] | 1 | 2021-03-19T16:08:34.000Z | 2021-03-19T16:08:34.000Z | #include "tpf_cuboid.h"
#include "tpf_geometric_object.h"
#include "tpf_point.h"
#include "../exception/tpf_not_implemented_exception.h"
#include <CGAL/Iso_cuboid_3.h>
#include <memory>
#include <vector>
namespace tpf
{
namespace geometry
{
template <typename floatp_t, typename kernel_t>
inline cuboid<floatp_t, kernel_t>::cuboid(const point<floatp_t, kernel_t>& point_min, const point<floatp_t, kernel_t>& point_max) noexcept
{
this->_cuboid = typename kernel_t::Iso_cuboid_3(point_min.get_internal(), point_max.get_internal());
}
template <typename floatp_t, typename kernel_t>
inline cuboid<floatp_t, kernel_t>::cuboid(const typename kernel_t::Iso_cuboid_3& cuboid) noexcept
{
this->_cuboid = cuboid;
}
template <typename floatp_t, typename kernel_t>
inline cuboid<floatp_t, kernel_t>::cuboid(const cuboid<floatp_t, kernel_t>& copy) noexcept
{
this->_cuboid = copy._cuboid;
}
template <typename floatp_t, typename kernel_t>
inline cuboid<floatp_t, kernel_t>& cuboid<floatp_t, kernel_t>::operator=(const typename kernel_t::Iso_cuboid_3& cuboid) noexcept
{
geometric_object<floatp_t>::operator=(cuboid);
this->_cuboid = cuboid;
return *this;
}
template <typename floatp_t, typename kernel_t>
inline cuboid<floatp_t, kernel_t>& cuboid<floatp_t, kernel_t>::operator=(const cuboid<floatp_t, kernel_t>& copy) noexcept
{
geometric_object<floatp_t>::operator=(copy);
this->_cuboid = copy._cuboid;
return *this;
}
template <typename floatp_t, typename kernel_t>
inline bool cuboid<floatp_t, kernel_t>::operator==(const cuboid<floatp_t, kernel_t>& other) const noexcept
{
return this->_cuboid == other._cuboid;
}
template <typename floatp_t, typename kernel_t>
inline bool cuboid<floatp_t, kernel_t>::operator==(const typename kernel_t::Iso_cuboid_3& other) const noexcept
{
return this->_cuboid == other;
}
template <typename floatp_t, typename kernel_t>
inline std::shared_ptr<geometric_object<floatp_t>> cuboid<floatp_t, kernel_t>::clone(const math::transformer<floatp_t, 3>& trafo) const
{
auto copy = std::make_shared<cuboid<floatp_t, kernel_t>>(*this);
copy->transform(trafo);
return copy;
}
template <typename floatp_t, typename kernel_t>
inline geometric_object<floatp_t>& cuboid<floatp_t, kernel_t>::transform(const math::transformer<floatp_t, 3>& trafo)
{
if (!trafo.is_unit())
{
this->_cuboid = typename kernel_t::Iso_cuboid_3(
static_cast<point<floatp_t, kernel_t>&>(point<floatp_t, kernel_t>(this->_cuboid.min()).transform(trafo)).get_internal(),
static_cast<point<floatp_t, kernel_t>&>(point<floatp_t, kernel_t>(this->_cuboid.max()).transform(trafo)).get_internal());
}
return *this;
}
template <typename floatp_t, typename kernel_t>
inline geometric_float<floatp_t, typename kernel_t::FT> cuboid<floatp_t, kernel_t>::calculate_volume() const
{
return this->_cuboid.volume();
}
template <typename floatp_t, typename kernel_t>
inline point<floatp_t, kernel_t> cuboid<floatp_t, kernel_t>::get_min_point() const
{
return static_cast<point<floatp_t, kernel_t>>(this->_cuboid.min());
}
template <typename floatp_t, typename kernel_t>
inline point<floatp_t, kernel_t> cuboid<floatp_t, kernel_t>::get_max_point() const
{
return static_cast<point<floatp_t, kernel_t>>(this->_cuboid.max());
}
template <typename floatp_t, typename kernel_t>
inline point<floatp_t, kernel_t> cuboid<floatp_t, kernel_t>::get_center_point() const
{
return this->_cuboid.min() + 0.5 * (this->_cuboid.max() - this->_cuboid.min());
}
template <typename floatp_t, typename kernel_t>
inline std::size_t cuboid<floatp_t, kernel_t>::get_num_points() const
{
return 8;
}
template <typename floatp_t, typename kernel_t>
inline std::vector<Eigen::Matrix<floatp_t, 3, 1>> cuboid<floatp_t, kernel_t>::get_points() const
{
std::vector<Eigen::Matrix<floatp_t, 3, 1>> points;
points.push_back(point<floatp_t, kernel_t>(this->_cuboid.vertex(0)).get_vertex());
points.push_back(point<floatp_t, kernel_t>(this->_cuboid.vertex(1)).get_vertex());
points.push_back(point<floatp_t, kernel_t>(this->_cuboid.vertex(2)).get_vertex());
points.push_back(point<floatp_t, kernel_t>(this->_cuboid.vertex(3)).get_vertex());
points.push_back(point<floatp_t, kernel_t>(this->_cuboid.vertex(4)).get_vertex());
points.push_back(point<floatp_t, kernel_t>(this->_cuboid.vertex(5)).get_vertex());
points.push_back(point<floatp_t, kernel_t>(this->_cuboid.vertex(6)).get_vertex());
points.push_back(point<floatp_t, kernel_t>(this->_cuboid.vertex(7)).get_vertex());
return points;
}
template <typename floatp_t, typename kernel_t>
inline std::size_t cuboid<floatp_t, kernel_t>::get_num_cells() const
{
return 6;
}
template <typename floatp_t, typename kernel_t>
inline std::vector<std::vector<std::size_t>> cuboid<floatp_t, kernel_t>::get_cells() const
{
std::vector<std::vector<std::size_t>> cells(static_cast<std::size_t>(6));
// vertex id to coords mapping:
// vert. | x | y | z
// ------+---+---+---
// 0 | 0 | 0 | 0
// 1 | 1 | 0 | 0
// 2 | 1 | 1 | 0
// 3 | 0 | 1 | 0
// 4 | 0 | 1 | 1
// 5 | 0 | 0 | 1
// 6 | 1 | 0 | 1
// 7 | 1 | 1 | 1
// draw all quads counter-clockwise when viewed from outside
// z = 0 plane
cells[0].push_back(static_cast<std::size_t>(0));
cells[0].push_back(static_cast<std::size_t>(3));
cells[0].push_back(static_cast<std::size_t>(2));
cells[0].push_back(static_cast<std::size_t>(1));
// z = 1 plane
cells[1].push_back(static_cast<std::size_t>(5));
cells[1].push_back(static_cast<std::size_t>(6));
cells[1].push_back(static_cast<std::size_t>(7));
cells[1].push_back(static_cast<std::size_t>(4));
// y = 0 plane
cells[2].push_back(static_cast<std::size_t>(0));
cells[2].push_back(static_cast<std::size_t>(1));
cells[2].push_back(static_cast<std::size_t>(6));
cells[2].push_back(static_cast<std::size_t>(5));
// y = 1 plane
cells[3].push_back(static_cast<std::size_t>(3));
cells[3].push_back(static_cast<std::size_t>(4));
cells[3].push_back(static_cast<std::size_t>(7));
cells[3].push_back(static_cast<std::size_t>(2));
// x = 0 plane
cells[4].push_back(static_cast<std::size_t>(0));
cells[4].push_back(static_cast<std::size_t>(5));
cells[4].push_back(static_cast<std::size_t>(4));
cells[4].push_back(static_cast<std::size_t>(3));
// x = 1 plane
cells[5].push_back(static_cast<std::size_t>(1));
cells[5].push_back(static_cast<std::size_t>(2));
cells[5].push_back(static_cast<std::size_t>(7));
cells[5].push_back(static_cast<std::size_t>(6));
return cells;
}
template <typename floatp_t, typename kernel_t>
inline std::vector<char> cuboid<floatp_t, kernel_t>::serialize() const
{
throw exception::not_implemented_exception();
}
template <typename floatp_t, typename kernel_t>
std::shared_ptr<geometric_object<floatp_t>> cuboid<floatp_t, kernel_t>::deserialize(const std::vector<char>& serialized)
{
throw exception::not_implemented_exception();
}
template <typename floatp_t, typename kernel_t>
inline const typename kernel_t::Iso_cuboid_3& cuboid<floatp_t, kernel_t>::get_internal() const
{
return this->_cuboid;
}
template <typename floatp_t, typename kernel_t>
inline cuboid<floatp_t, kernel_t>::operator const typename kernel_t::Iso_cuboid_3&() const
{
return this->_cuboid;
}
}
}
| 39.482143 | 146 | 0.599389 | UniStuttgart-VISUS |
e086d715be6ca76019b03df22548778482286e4f | 1,428 | cpp | C++ | Inheritance/main.cpp | clemaitre58/LessonsCpp | a385b30c9ca970f0be68a781a55cfe409058aa05 | [
"MIT"
] | null | null | null | Inheritance/main.cpp | clemaitre58/LessonsCpp | a385b30c9ca970f0be68a781a55cfe409058aa05 | [
"MIT"
] | null | null | null | Inheritance/main.cpp | clemaitre58/LessonsCpp | a385b30c9ca970f0be68a781a55cfe409058aa05 | [
"MIT"
] | 5 | 2020-04-11T20:19:27.000Z | 2020-04-14T04:20:19.000Z | #include <iostream>
#include "inheritance.hpp"
int main()
{
inheritance::Parent my_parent;
my_parent.set_a(1);
my_parent.set_b(2);
my_parent.set_c(3);
std::cout << "My parent a attribute value : " << my_parent.get_a() << std::endl;
std::cout << "My parent b attribute value : " << my_parent.get_b() << std::endl;
std::cout << "My parent c attribute value : " << my_parent.get_c() << std::endl;
inheritance::Child1 my_child1;
my_child1.set_a(4);
my_child1.set_b(5);
my_child1.set_c(6);
my_child1.set_d(7);
std::cout << "My child1 a attribute value : " << my_child1.get_a() << std::endl;
std::cout << "My child1 b attribute value : " << my_child1.get_b() << std::endl;
std::cout << "My child1 c attribute value : " << my_child1.get_c() << std::endl;
std::cout << "My child1 d attribute value : " << my_child1.get_d() << std::endl;
//my_child1.b = 12;
inheritance::Child2 my_child2;
my_child2.set_d(8);
// my_child2.set_a(5);
// my_child2.set_b(6);
// my_child2.set_b(7);
// std::cout << "My child1 a attribute value : " << my_child2.get_a() << std::endl;
// std::cout << "My child1 b attribute value : " << my_child2.get_b() << std::endl;
// std::cout << "My child1 c attribute value : " << my_child2.get_c() << std::endl;
std::cout << "My child1 d attribute value : " << my_child2.get_d() << std::endl;
return 0;
}
| 31.733333 | 86 | 0.606443 | clemaitre58 |
e087cd03a4bb1630131fb1b690a616af6b3df221 | 938 | cpp | C++ | src/apply_gate.cpp | Milos9304/FastVQA | a48f535212c5d081009f32a707cb79e92f5273d2 | [
"MIT"
] | null | null | null | src/apply_gate.cpp | Milos9304/FastVQA | a48f535212c5d081009f32a707cb79e92f5273d2 | [
"MIT"
] | null | null | null | src/apply_gate.cpp | Milos9304/FastVQA | a48f535212c5d081009f32a707cb79e92f5273d2 | [
"MIT"
] | null | null | null | #include "accelerator.h"
#include "logger.h"
namespace fastVQA{
void Accelerator::apply_gate(Gate gate, double param){
std::string message;
switch(gate.code){
case Gate::g_H:
logd("H " + std::to_string(gate.qubit1));
hadamard(qureg, gate.qubit1);
break;
case Gate::g_Ry:
logd("Ry " + std::to_string(gate.qubit1) + " @ " + std::to_string(param));
rotateY(qureg, gate.qubit1, param);
break;
case Gate::g_Rz:
logd("Rz " + std::to_string(gate.qubit1) + " @ " + std::to_string(param));
rotateZ(qureg, gate.qubit1, param);
break;
case Gate::g_CNOT:
logd("CNOT " + std::to_string(gate.qubit1) + " " + std::to_string(gate.qubit2));
controlledNot(qureg, gate.qubit1, gate.qubit2);
break;
case Gate::g_CZ:
logd("CZ " + std::to_string(gate.qubit1) + " " + std::to_string(gate.qubit2));
controlledPhaseFlip(qureg, gate.qubit1, gate.qubit2);
break;
default:
loge("Unknown gate");
throw;
break;
}
}
}
| 23.45 | 82 | 0.659915 | Milos9304 |
e08d53775ab8572776061e0a0100004193ca1993 | 279 | hpp | C++ | ext-falcon-bms-linear-acc/falcon-bms-ext.hpp | dendisuhubdy/opentrack | 0f13f02f2fdce44934476665a9e3bc97c1fccb82 | [
"ISC"
] | 2,134 | 2015-01-02T04:47:23.000Z | 2022-03-29T14:04:54.000Z | ext-falcon-bms-linear-acc/falcon-bms-ext.hpp | dendisuhubdy/opentrack | 0f13f02f2fdce44934476665a9e3bc97c1fccb82 | [
"ISC"
] | 1,284 | 2015-01-02T20:02:47.000Z | 2022-03-29T16:55:55.000Z | ext-falcon-bms-linear-acc/falcon-bms-ext.hpp | dendisuhubdy/opentrack | 0f13f02f2fdce44934476665a9e3bc97c1fccb82 | [
"ISC"
] | 373 | 2015-01-02T04:50:30.000Z | 2022-03-28T13:39:34.000Z | #pragma once
#include "api/plugin-api.hpp"
struct falcon_bms_acceleration_ext : IExtension
{
event_mask hook_types() override;
falcon_bms_acceleration_ext();
void process_finished(Pose&p) override;
module_status initialize() override { return status_ok(); }
};
| 23.25 | 63 | 0.749104 | dendisuhubdy |
e09358aeb14a393f891f30a12c0d4ddf0fd82621 | 1,403 | cpp | C++ | poj 1947 Rebuilding Roads/2016.12.6.1.cpp | 1980744819/ACM-code | a697242bc963e682e552e655e3d78527e044e854 | [
"Apache-2.0"
] | null | null | null | poj 1947 Rebuilding Roads/2016.12.6.1.cpp | 1980744819/ACM-code | a697242bc963e682e552e655e3d78527e044e854 | [
"Apache-2.0"
] | null | null | null | poj 1947 Rebuilding Roads/2016.12.6.1.cpp | 1980744819/ACM-code | a697242bc963e682e552e655e3d78527e044e854 | [
"Apache-2.0"
] | null | null | null | #include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<stack>
#include<set>
#include<map>
#include<queue>
#include<algorithm>
using namespace std;
vector<int>sons[155];
int dp[155][155];
int father[155];
int n,p;
int dfs(int root){
int i,j,k;
for(i=0;i<sons[root].size();i++)
dfs(sons[root][i]);
dp[root][1]=sons[root].size();
for(i=0;i<sons[root].size();i++){
for(j=p-1;j>0;j--){
if(dp[root][j]!=999999){
for(k=1;k<=p-j;k++){
if(dp[sons[root][i]][k]!=999999)
dp[root][j+k]=min(dp[root][j]+dp[sons[root][i]][k]-1,dp[root][j+k]);
}
}
}
}
return dp[root][p];
}
int main(){
int i,j,k;
int a,b;
int Min;
int root;
while(~scanf("%d %d",&n,&p)){
memset(father,0,sizeof(father));
for(i=1;i<=n;i++){
for(j=1;j<=p;j++){
dp[i][j]=999999;
}
}
for(i=0;i<n-1;i++){
scanf("%d %d",&a,&b);
sons[a].push_back(b);
father[b]=a;
}
root=1;
while(father[root]!=0)
root=father[root];
Min=dfs(root);
for(i=1;i<=n;i++)
if(Min>dp[i][p]+1)
Min=dp[i][p]+1;
printf("%d\n",Min);
}
return 0;
}
| 22.269841 | 96 | 0.442623 | 1980744819 |
e0946149d7244e942d8fd49021dd340ed44627f7 | 845 | cpp | C++ | acmicpc.net/source/2740.cpp | tdm1223/Algorithm | 994149afffa21a81e38b822afcfc01f677d9e430 | [
"MIT"
] | 7 | 2019-06-26T07:03:32.000Z | 2020-11-21T16:12:51.000Z | acmicpc.net/source/2740.cpp | tdm1223/Algorithm | 994149afffa21a81e38b822afcfc01f677d9e430 | [
"MIT"
] | null | null | null | acmicpc.net/source/2740.cpp | tdm1223/Algorithm | 994149afffa21a81e38b822afcfc01f677d9e430 | [
"MIT"
] | 9 | 2019-02-28T03:34:54.000Z | 2020-12-18T03:02:40.000Z | // 2740. 행렬 곱셈
// 2020.05.09
// 구현, 수학
#include<iostream>
using namespace std;
int a[101][101];
int b[101][101];
int c[101][101];
int main()
{
int n, m, n2, m2;
cin >> n >> m;
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++)
{
cin >> a[i][j];
}
}
cin >> n2 >> m2;
for (int i = 0; i < n2; i++)
{
for (int j = 0; j < m2; j++)
{
cin >> b[i][j];
}
}
for (int x = 0; x < n; x++)
{
for (int y = 0; y < m2; y++)
{
for (int i = 0; i < m; i++)
{
c[x][y] += a[x][i] * b[i][y];
}
}
}
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m2; j++)
{
cout << c[i][j] << " ";
}
cout << endl;
}
}
| 15.943396 | 45 | 0.294675 | tdm1223 |
e095c0362c30f50b3a670b8c390383232eefd4ed | 37,013 | cpp | C++ | source_code/system_fpl/source_code/calculation/section_fpl/mechanisms/dike/Fpl_Seepage_Calculator_Dike.cpp | dabachma/ProMaIDes_src | 3fa6263c46f89abbdb407f2e1643843d54eb6ccc | [
"BSD-3-Clause"
] | null | null | null | source_code/system_fpl/source_code/calculation/section_fpl/mechanisms/dike/Fpl_Seepage_Calculator_Dike.cpp | dabachma/ProMaIDes_src | 3fa6263c46f89abbdb407f2e1643843d54eb6ccc | [
"BSD-3-Clause"
] | null | null | null | source_code/system_fpl/source_code/calculation/section_fpl/mechanisms/dike/Fpl_Seepage_Calculator_Dike.cpp | dabachma/ProMaIDes_src | 3fa6263c46f89abbdb407f2e1643843d54eb6ccc | [
"BSD-3-Clause"
] | null | null | null | #include "source_code\Fpl_Headers_Precompiled.h"
//#include "Fpl_Seepage_Calculator_Dike.h"
//Default constructor
Fpl_Seepage_Calculator_Dike::Fpl_Seepage_Calculator_Dike(void){
this->ptr_waterside_cub=NULL;
this->ptr_landside_cub=NULL;
this->ptr_cubature=NULL;
this->seepage_calc_max=_fpl_max_waterlevel_seepage::kozeny;
this->seepage_calc_min=_fpl_min_waterlevel_seepage::water_base;
Sys_Memory_Count::self()->add_mem(sizeof(Fpl_Seepage_Calculator_Dike),_sys_system_modules::FPL_SYS);//count the memory
}
//Default destructor
Fpl_Seepage_Calculator_Dike::~Fpl_Seepage_Calculator_Dike(void){
Sys_Memory_Count::self()->minus_mem(sizeof(Fpl_Seepage_Calculator_Dike),_sys_system_modules::FPL_SYS);//count the memory
}
//___________
//public
//Set the pointer to waterside cubature;
void Fpl_Seepage_Calculator_Dike::set_ptr_waterside_cub(Fpl_Cub_Dike_Waterside *cub){
this->ptr_waterside_cub=cub;
}
//Set the pointer to landside cubature;
void Fpl_Seepage_Calculator_Dike::set_ptr_landside_cub(Fpl_Cub_Dike_Landside *cub){
this->ptr_landside_cub=cub;
}
//Set the pointer to the cubature
void Fpl_Seepage_Calculator_Dike::set_ptr_cubature(Geo_Polysegment *cubature){
this->ptr_cubature=cubature;
}
//Calculate new waterlevels of the seepage line
void Fpl_Seepage_Calculator_Dike::calculate_waterlevel_seepage_line(const double water_level, Fpl_Seepage_Line_Point_List *ascending, Fpl_Seepage_Line_Point_List *descending, const bool for_output){
if(this->seepage_calc_max==_fpl_max_waterlevel_seepage::one_third_waterlevel){
this->calculate_seepage_line_land_one_third(water_level, ascending, for_output);
this->calculate_seepage_line_land_one_third(water_level, descending, for_output);
if(this->seepage_calc_min==_fpl_min_waterlevel_seepage::one_third_mid_waterlevel){
this->calculate_seepage_line_mid_water_one_third(water_level, descending, for_output);
}
else{
this->calculate_seepage_line_mid_water_base(water_level, descending, for_output);
}
}
else if(this->seepage_calc_max==_fpl_max_waterlevel_seepage::kozeny){
try{
this->calculate_seepage_line_land_kozeny(water_level, ascending, for_output);
this->calculate_seepage_line_land_kozeny(water_level, descending, for_output);
}
catch(Error msg){
throw msg;
}
if(this->seepage_calc_min==_fpl_min_waterlevel_seepage::one_third_mid_waterlevel){
this->calculate_seepage_line_mid_water_one_third(water_level, descending, for_output);
}
else{
this->calculate_seepage_line_mid_water_base(water_level, descending, for_output);
}
}
else {
this->calculate_seepage_line_land_base(water_level, ascending, for_output);
this->calculate_seepage_line_land_base(water_level, descending, for_output);
if(this->seepage_calc_min==_fpl_min_waterlevel_seepage::one_third_mid_waterlevel){
this->calculate_seepage_line_mid_water_one_third(water_level, descending, for_output);
}
else{
this->calculate_seepage_line_mid_water_base(water_level, descending, for_output);
}
}
}
//Input the control parameters per database table
void Fpl_Seepage_Calculator_Dike::set_input(QSqlDatabase *ptr_database, const bool frc_sim, const bool output){
if(output==true){
ostringstream cout;
cout <<"Set the control parameters of the seepage calculation... " << endl ;
Sys_Common_Output::output_fpl->output_txt(&cout,false);
}
//mysql query with the table_model
QSqlTableModel model(0,*ptr_database);
int number_result=0;
//the table is set the name and the column names
try{
Fpl_Mc_Sim::set_table(ptr_database);
}
catch(Error msg){
throw msg;
}
//give the complet table of control parameters FPL
model.setTable(Fpl_Mc_Sim::table->get_table_name().c_str());
//set the query
Data_Base::database_request(&model);
number_result=model.rowCount();
//read out the results
//the set of the name-column has to match to this parameter
//output
if(number_result>0){
//read out from the search result
string buffer;
for(int i=0; i< number_result; i++){
buffer=model.record(i).value((Fpl_Mc_Sim::table->get_column_name(fpl_label::control_name)).c_str()).toString().toStdString();
if(buffer==fpl_seepage_method::seepage_maximum){
this->seepage_calc_max=Fpl_Seepage_Calculator_Dike::convert_txt2seepagetype_max_waterlevel(
model.record(i).value((Fpl_Mc_Sim::table->get_column_name(fpl_label::control_value)).c_str()).toString().toStdString());
}
else if(buffer==fpl_seepage_method::seepage_minimum){
this->seepage_calc_min=Fpl_Seepage_Calculator_Dike::convert_txt2seepagetype_min_waterlevel(
model.record(i).value((Fpl_Mc_Sim::table->get_column_name(fpl_label::control_value)).c_str()).toString().toStdString());
}
}
}
if(frc_sim==true && this->seepage_calc_min==_fpl_min_waterlevel_seepage::one_third_mid_waterlevel){
Warning msg=this->set_warning(0);
msg.output_msg(1);
this->seepage_calc_min=_fpl_min_waterlevel_seepage::water_base;
}
}
//Output the control parameters of the seepage calculation to display/console
void Fpl_Seepage_Calculator_Dike::output_members(void){
Sys_Common_Output::output_fpl->reset_prefix_was_outputed();
ostringstream cout;
cout << "SEEPAGE-CALCULATION " << endl;
cout << " Method for the maximum waterlevel : " << Fpl_Seepage_Calculator_Dike::convert_seepagetype_max_waterlevel2txt(this->seepage_calc_max) << endl;
cout << " Method for the minimum waterlevel : " << Fpl_Seepage_Calculator_Dike::convert_seepagetype_min_waterlevel2txt(this->seepage_calc_min) << endl;
Sys_Common_Output::output_fpl->output_txt(cout.str(),false);
}
//Convert a string into seepage type at maximum waterlevel (_fpl_max_waterlevel_seepage) (static)
_fpl_max_waterlevel_seepage Fpl_Seepage_Calculator_Dike::convert_txt2seepagetype_max_waterlevel(const string txt){
_fpl_max_waterlevel_seepage type;
string buffer=txt;
functions::clean_string(&buffer);
functions::convert_string2lower_case(&buffer);
if(buffer==fpl_label::seepage_max_base_land){
type=_fpl_max_waterlevel_seepage::land_base;
}
else if(buffer==fpl_label::seepage_max_one_third){
type=_fpl_max_waterlevel_seepage::one_third_waterlevel;
}
else if(buffer==fpl_label::seepage_max_kozeny){
type=_fpl_max_waterlevel_seepage::kozeny;
}
else{
Error msg;
msg.set_msg("Fpl_Seepage_Calculator_Dike::convert_txt2seepagetype_max_waterlevel(const string txt)", "Can not convert this seepage maximum waterlevel type", "Check the given type", 1, false);
ostringstream info;
info << "seepage maximum waterlevel type: " << txt << endl;
info << "Possible types: "<< endl;
info << " "<<fpl_label::seepage_max_base_land << endl;
info << " "<<fpl_label::seepage_max_one_third << endl;
info << " "<<fpl_label::seepage_max_kozeny << endl;
msg.make_second_info(info.str());
throw msg;
}
return type;
}
//Convert a seepage type at maximum waterlevel (_fpl_max_waterlevel_seepage) into a string (static)
string Fpl_Seepage_Calculator_Dike::convert_seepagetype_max_waterlevel2txt(const _fpl_max_waterlevel_seepage type){
string buffer;
switch(type){
case _fpl_max_waterlevel_seepage::land_base:
buffer=fpl_label::seepage_max_base_land;
break;
case _fpl_max_waterlevel_seepage::one_third_waterlevel:
buffer=fpl_label::seepage_max_one_third;
break;
case _fpl_max_waterlevel_seepage::kozeny:
buffer=fpl_label::seepage_max_kozeny;
break;
default:
buffer=label::unknown_type;
}
return buffer;
}
//Convert a string into seepage type at minimum waterlevel (_fpl_min_waterlevel_seepage) (static)
_fpl_min_waterlevel_seepage Fpl_Seepage_Calculator_Dike::convert_txt2seepagetype_min_waterlevel(const string txt){
_fpl_min_waterlevel_seepage type;
string buffer=txt;
functions::clean_string(&buffer);
functions::convert_string2lower_case(&buffer);
if(buffer==fpl_label::seepage_min_base_land){
type=_fpl_min_waterlevel_seepage::water_base;
}
else if(buffer==fpl_label::seepage_min_one_third){
type=_fpl_min_waterlevel_seepage::one_third_mid_waterlevel;
}
else{
Error msg;
msg.set_msg("Fpl_Seepage_Calculator_Dike::convert_txt2seepagetype_min_waterlevel(const string txt)", "Can not convert this seepage minimum waterlevel type", "Check the given type", 1, false);
ostringstream info;
info << "Seepage minimum waterlevel type: " << txt << endl;
info << "Possible types: "<< endl;
info << " "<<fpl_label::seepage_min_base_land << endl;
info << " "<<fpl_label::seepage_min_one_third << endl;
msg.make_second_info(info.str());
throw msg;
}
return type;
}
//Convert a seepage type at minimum waterlevel (_fpl_min_waterlevel_seepage) into a string (static)
string Fpl_Seepage_Calculator_Dike::convert_seepagetype_min_waterlevel2txt(const _fpl_min_waterlevel_seepage type){
string buffer;
switch(type){
case _fpl_min_waterlevel_seepage::water_base:
buffer=fpl_label::seepage_min_base_land;
break;
case _fpl_min_waterlevel_seepage::one_third_mid_waterlevel:
buffer=fpl_label::seepage_min_one_third;
break;
default:
buffer=label::unknown_type;
}
return buffer;
}
//Write the default value of the control parameters into the database table (static)
void Fpl_Seepage_Calculator_Dike::set_predefined_data2control_table(QSqlDatabase *ptr_database, QSqlQuery *model, int *id_glob, ostringstream *fix_string){
try{
Fpl_Mc_Sim::set_table(ptr_database);
}
catch(Error msg){
throw msg;
}
ostringstream total;
//Keystring for calculation method for maximum waterlevel
ostringstream query_string;
query_string << " VALUES ( ";
query_string << *id_glob << " , " ;
query_string <<"'"<< fpl_seepage_method::seepage_maximum <<"'"<< " , " ;
query_string <<"'"<< fpl_label::seepage_max_one_third << "' , " ;
query_string << "'Calculation method for the maximum waterlevel: "<< fpl_label::seepage_max_base_land <<", "<<fpl_label::seepage_max_kozeny<<", "<<fpl_label::seepage_max_kozeny <<"' ) ";
total <<fix_string->str() << query_string.str();
Data_Base::database_request(model, total.str(), ptr_database);
total.str("");
query_string.str("");
(*id_glob)++;
//Keystring for calculation method for minimum waterlevel
query_string << " VALUES ( ";
query_string << *id_glob << " , " ;
query_string <<"'"<< fpl_seepage_method::seepage_minimum <<"'"<< " , " ;
query_string <<"'"<< fpl_label::seepage_min_base_land << "' , " ;
query_string << "'Calculation method for the minimum waterlevel: "<< fpl_label::seepage_min_base_land <<", "<<fpl_label::seepage_min_one_third <<"(just for deterministic calculation)' ) ";
total <<fix_string->str() << query_string.str();
Data_Base::database_request(model, total.str(), ptr_database);
total.str("");
query_string.str("");
(*id_glob)++;
}
//_________
//private
//Calculate the seepage line: horizontal
void Fpl_Seepage_Calculator_Dike::calculate_seepage_line_horizontal(double h_rel, Fpl_Seepage_Line_Point_List *point_list, const bool for_output){
if(h_rel>this->ptr_waterside_cub->get_ptr_last_point()->get_ycoordinate()){
h_rel=this->ptr_waterside_cub->get_ptr_last_point()->get_ycoordinate();
}
if(h_rel<0.0){
h_rel=0.0;
}
//waterlevel is below landside dike base=> horizontal line
if(h_rel<this->ptr_landside_cub->get_ptr_last_point()->get_ycoordinate()){
//find the interception point with waterside
Geo_Segment buffer;
buffer.set_coordinates(0.0,h_rel,this->ptr_landside_cub->get_ptr_last_point()->get_xcoordinate(),h_rel);
_geo_interception_point buff_point_water;
buff_point_water.interception_point.set_point_name(label::interception_point);
for(int i=this->ptr_waterside_cub->get_number_segments()-1; i>=0; i--){
buffer.calc_interception(this->ptr_waterside_cub->get_segment(i),&buff_point_water);
if(buff_point_water.interception_flag==true){
break;
}
}
if(for_output==true){
point_list->add_new_point(buff_point_water.interception_point.get_xcoordinate(),buff_point_water.interception_point.get_ycoordinate(),true, this->ptr_cubature);
}
//descending waterlevel =>take a horizontal line
for(int i=0; i< point_list->get_number_points(); i++){
//left or right of the dike body
if(point_list->get_list_point(i)->get_x_coordinate()<buff_point_water.interception_point.get_xcoordinate()){
point_list->get_list_point(i)->set_waterlevel(h_rel);
point_list->get_list_point(i)->set_inside_dike_body_flag(false);
}
//inbetween (dike body)
else{
point_list->get_list_point(i)->set_waterlevel(h_rel);
point_list->get_list_point(i)->set_inside_dike_body_flag(true);
}
}
}
//waterlevel horizontal
else{
//find the interception point with waterside
Geo_Segment buffer;
buffer.set_coordinates(0.0,h_rel,this->ptr_landside_cub->get_ptr_last_point()->get_xcoordinate(),h_rel);
_geo_interception_point buff_point_water;
buff_point_water.interception_point.set_point_name(label::interception_point);
for(int i=this->ptr_waterside_cub->get_number_segments()-1; i>=0; i--){
buffer.calc_interception(this->ptr_waterside_cub->get_segment(i),&buff_point_water);
if(buff_point_water.interception_flag==true){
break;
}
}
_geo_interception_point buff_point_land;
buff_point_land.interception_point.set_point_name(label::interception_point);
for(int i=0; i< this->ptr_landside_cub->get_number_segments(); i++){
buffer.calc_interception(this->ptr_landside_cub->get_segment(i),&buff_point_land);
if(buff_point_land.interception_flag==true){
break;
}
}
for(int i=0; i< point_list->get_number_points(); i++){
//left or right of the dike body
if(point_list->get_list_point(i)->get_x_coordinate()<buff_point_water.interception_point.get_xcoordinate() ||
point_list->get_list_point(i)->get_x_coordinate()>buff_point_land.interception_point.get_xcoordinate()){
point_list->get_list_point(i)->set_waterlevel(h_rel);
point_list->get_list_point(i)->set_inside_dike_body_flag(false);
}
//inbetween (dike body)
else{
point_list->get_list_point(i)->set_waterlevel(h_rel);
point_list->get_list_point(i)->set_inside_dike_body_flag(true);
}
}
}
}
//Calculate the seepage line to the mid: one third of the waterlevel at the crest mid at the waterside to waterlevel at crest mid; the rest have to be calculated before
void Fpl_Seepage_Calculator_Dike::calculate_seepage_line_mid_water_one_third(double h_rel, Fpl_Seepage_Line_Point_List *point_list, const bool for_output){
if(h_rel>this->ptr_waterside_cub->get_ptr_last_point()->get_ycoordinate()){
h_rel=this->ptr_waterside_cub->get_ptr_last_point()->get_ycoordinate();
}
if(h_rel<0.0){
h_rel=0.0;
}
Fpl_Seepage_Line_Point *mid_point;
mid_point=point_list->get_list_point(0);
//find the interception point with waterside
Geo_Segment buffer;
buffer.set_coordinates(0.0,mid_point->get_waterlevel()*1.0/3.0,mid_point->get_x_coordinate(),mid_point->get_waterlevel()*1.0/3.0);
_geo_interception_point buff_point_real_water;
buff_point_real_water.interception_point.set_point_name(label::interception_point);
for(int i=0; i<this->ptr_waterside_cub->get_number_segments(); i++){
buffer.calc_interception(this->ptr_waterside_cub->get_segment(i),&buff_point_real_water);
if(buff_point_real_water.interception_flag==true){
break;
}
}
buffer.set_coordinates(buff_point_real_water.interception_point.get_xcoordinate(),buff_point_real_water.interception_point.get_ycoordinate(),
mid_point->get_x_coordinate(),mid_point->get_waterlevel());
if(for_output==true){
point_list->add_new_point(buff_point_real_water.interception_point.get_xcoordinate(),buff_point_real_water.interception_point.get_ycoordinate(),true, this->ptr_cubature);
mid_point=point_list->get_list_point(0);
}
double deltay=mid_point->get_waterlevel()-buff_point_real_water.interception_point.get_ycoordinate();
double deltax=mid_point->get_x_coordinate()-buff_point_real_water.interception_point.get_xcoordinate();
for(int i=0; i< point_list->get_number_points(); i++){
//left of the waterside interception
if(point_list->get_list_point(i)->get_x_coordinate()<buff_point_real_water.interception_point.get_xcoordinate()){
point_list->get_list_point(i)->set_waterlevel(buff_point_real_water.interception_point.get_ycoordinate());
point_list->get_list_point(i)->set_inside_dike_body_flag(true);
}
//right of the mid point
else if(point_list->get_list_point(i)->get_x_coordinate()> mid_point->get_x_coordinate()){
//do nothing it has to be set before
}
//inbetween
else{
double y=buff_point_real_water.interception_point.get_ycoordinate()+(point_list->get_list_point(i)->get_x_coordinate()-buff_point_real_water.interception_point.get_xcoordinate())*
deltay/deltax;
if(y<=point_list->get_list_point(i)->get_y_coordinate_cubature()){
point_list->get_list_point(i)->set_waterlevel(y);
}
else{
point_list->get_list_point(i)->set_waterlevel(point_list->get_list_point(i)->get_y_coordinate_cubature());
}
point_list->get_list_point(i)->set_inside_dike_body_flag(true);
}
}
}
//Calculate the seepage line to the mid: base point at the waterside to the waterlevel at the crest mid; the rest have to be calculated before
void Fpl_Seepage_Calculator_Dike::calculate_seepage_line_mid_water_base(double h_rel, Fpl_Seepage_Line_Point_List *point_list, const bool ){
if(h_rel>this->ptr_waterside_cub->get_ptr_last_point()->get_ycoordinate()){
h_rel=this->ptr_waterside_cub->get_ptr_last_point()->get_ycoordinate();
}
if(h_rel<0.0){
h_rel=0.0;
}
Fpl_Seepage_Line_Point *mid_point;
mid_point=point_list->get_list_point(0);
//find the interception point with waterside
Geo_Segment buffer;
buffer.set_coordinates(0.0,0.0,mid_point->get_x_coordinate(),mid_point->get_waterlevel());
_geo_interception_point buff_point_water;
buff_point_water.interception_point.set_point_name(label::interception_point);
for(int i=this->ptr_waterside_cub->get_number_segments()-1; i>=0; i--){
buffer.calc_interception(this->ptr_waterside_cub->get_segment(i),&buff_point_water);
if(buff_point_water.interception_flag==true){
break;
}
}
double deltay=mid_point->get_waterlevel()-buff_point_water.interception_point.get_ycoordinate();
double deltax=mid_point->get_x_coordinate()-buff_point_water.interception_point.get_xcoordinate();
for(int i=0; i< point_list->get_number_points(); i++){
//left of the waterside
if(point_list->get_list_point(i)->get_x_coordinate()<0.0){
point_list->get_list_point(i)->set_waterlevel(0.0);
point_list->get_list_point(i)->set_inside_dike_body_flag(true);
}
//right of the mid point
else if(point_list->get_list_point(i)->get_x_coordinate()> mid_point->get_x_coordinate()){
//do nothing it has to be set before
}
//inbetween
else{
double y=buff_point_water.interception_point.get_ycoordinate()+(point_list->get_list_point(i)->get_x_coordinate()-buff_point_water.interception_point.get_xcoordinate())*
deltay/deltax;
if(y<=point_list->get_list_point(i)->get_y_coordinate_cubature()){
point_list->get_list_point(i)->set_waterlevel(y);
}
else{
point_list->get_list_point(i)->set_waterlevel(point_list->get_list_point(i)->get_y_coordinate_cubature());
}
point_list->get_list_point(i)->set_inside_dike_body_flag(true);
}
}
}
//Output the seepage line: to the landside base point
void Fpl_Seepage_Calculator_Dike::calculate_seepage_line_land_base(double h_rel, Fpl_Seepage_Line_Point_List *point_list, const bool for_output){
if(h_rel>this->ptr_waterside_cub->get_ptr_last_point()->get_ycoordinate()){
h_rel=this->ptr_waterside_cub->get_ptr_last_point()->get_ycoordinate();
}
if(h_rel<0.0){
h_rel=0.0;
}
//waterlevel is below landside dike base=> horizontal line
if(h_rel<this->ptr_landside_cub->get_ptr_last_point()->get_ycoordinate()){
this->calculate_seepage_line_horizontal(h_rel, point_list,for_output);
}
//waterlevel is above landside dike base
else{
//find the interception point with waterside
Geo_Segment buffer;
buffer.set_coordinates(0.0,h_rel,this->ptr_landside_cub->get_ptr_last_point()->get_xcoordinate(),h_rel);
_geo_interception_point buff_point_water;
buff_point_water.interception_point.set_point_name(label::interception_point);
for(int i=0; i<this->ptr_waterside_cub->get_number_segments(); i++){
buffer.calc_interception(this->ptr_waterside_cub->get_segment(i),&buff_point_water);
if(buff_point_water.interception_flag==true){
break;
}
}
if(for_output==true){
point_list->add_new_point(buff_point_water.interception_point.get_xcoordinate(),buff_point_water.interception_point.get_ycoordinate(),true, this->ptr_cubature);
}
//find the interception point with landside
buffer.set_coordinates(buff_point_water.interception_point.get_xcoordinate(),buff_point_water.interception_point.get_ycoordinate(),this->ptr_landside_cub->get_ptr_last_point()->get_xcoordinate(),this->ptr_landside_cub->get_ptr_last_point()->get_ycoordinate());
_geo_interception_point buff_point_land;
buff_point_land.interception_point.set_point_name(label::interception_point);
for(int i=0; i<this->ptr_landside_cub->get_number_segments(); i++){
buffer.calc_interception(this->ptr_landside_cub->get_segment(i),&buff_point_land);
if(buff_point_land.interception_flag==true){
break;
}
}
if(for_output==true){
point_list->add_new_point(buff_point_land.interception_point.get_xcoordinate(),buff_point_land.interception_point.get_ycoordinate(),true, this->ptr_cubature);
}
double deltay=buff_point_water.interception_point.get_ycoordinate()-buff_point_land.interception_point.get_ycoordinate();
double deltax=buff_point_land.interception_point.get_xcoordinate()-buff_point_water.interception_point.get_xcoordinate();
double h_buff=0.0;
for(int i=0; i< point_list->get_number_points(); i++){
//left of the waterside base
if(point_list->get_list_point(i)->get_x_coordinate()<buff_point_water.interception_point.get_xcoordinate()){
h_buff=h_rel;
point_list->get_list_point(i)->set_waterlevel(h_buff);
}
//right of the landside base
else if(point_list->get_list_point(i)->get_x_coordinate()> buff_point_land.interception_point.get_xcoordinate()){
h_buff=buff_point_land.interception_point.get_ycoordinate();
point_list->get_list_point(i)->set_waterlevel(h_buff);
if(h_buff<=point_list->get_list_point(i)->get_y_coordinate_cubature()){
point_list->get_list_point(i)->set_waterlevel(h_buff);
}
else{
point_list->get_list_point(i)->set_waterlevel(point_list->get_list_point(i)->get_y_coordinate_cubature());
}
}
//inbetween
else{
h_buff=h_rel-(point_list->get_list_point(i)->get_x_coordinate()-buff_point_water.interception_point.get_xcoordinate())*
deltay/deltax;
if(h_buff<=point_list->get_list_point(i)->get_y_coordinate_cubature()){
point_list->get_list_point(i)->set_waterlevel(h_buff);
}
else{
point_list->get_list_point(i)->set_waterlevel(point_list->get_list_point(i)->get_y_coordinate_cubature());
}
}
point_list->get_list_point(i)->set_inside_dike_body_flag(true);
}
}
}
//Output the seepage line: to the landside one third of the waterlevel
void Fpl_Seepage_Calculator_Dike::calculate_seepage_line_land_one_third(double h_rel, Fpl_Seepage_Line_Point_List *point_list, const bool for_output){
if(h_rel>this->ptr_waterside_cub->get_ptr_last_point()->get_ycoordinate()){
h_rel=this->ptr_waterside_cub->get_ptr_last_point()->get_ycoordinate();
}
if(h_rel<0.0){
h_rel=0.0;
}
//waterlevel is below landside dike base=> horizontal line
if(h_rel<this->ptr_landside_cub->get_ptr_last_point()->get_ycoordinate()){
this->calculate_seepage_line_horizontal(h_rel, point_list,for_output);
}
//waterlevel is above landside dike base
else{
//find the interception point with waterside
Geo_Segment buffer;
buffer.set_coordinates(0.0,h_rel,this->ptr_landside_cub->get_ptr_last_point()->get_xcoordinate(),h_rel);
_geo_interception_point buff_point_water;
buff_point_water.interception_point.set_point_name(label::interception_point);
for(int i=0; i<this->ptr_waterside_cub->get_number_segments(); i++){
buffer.calc_interception(this->ptr_waterside_cub->get_segment(i),&buff_point_water);
if(buff_point_water.interception_flag==true){
break;
}
}
if(for_output==true){
point_list->add_new_point(buff_point_water.interception_point.get_xcoordinate(),buff_point_water.interception_point.get_ycoordinate(),true, this->ptr_cubature);
}
//find the interception point with landside: first horizontal line at 1/3 of the waterlevel
buffer.set_coordinates(buff_point_water.interception_point.get_xcoordinate(),buff_point_water.interception_point.get_ycoordinate()*1.0/3.0+this->ptr_landside_cub->get_ptr_last_point()->get_ycoordinate()*2.0/3.0,
this->ptr_landside_cub->get_ptr_last_point()->get_xcoordinate(),buff_point_water.interception_point.get_ycoordinate()*1.0/3.0+this->ptr_landside_cub->get_ptr_last_point()->get_ycoordinate()*2.0/3.0);
_geo_interception_point buff_point_land;
buff_point_land.interception_point.set_point_name(label::interception_point);
for(int i=0; i<this->ptr_landside_cub->get_number_segments(); i++){
buffer.calc_interception(this->ptr_landside_cub->get_segment(i),&buff_point_land);
if(buff_point_land.interception_flag==true){
break;
}
}
//find the interception point with landside: second line waterlevel to 1/3 of the waterlevel
buffer.set_coordinates(buff_point_water.interception_point.get_xcoordinate(),buff_point_water.interception_point.get_ycoordinate(),buff_point_land.interception_point.get_xcoordinate(),buff_point_land.interception_point.get_ycoordinate());
for(int i=0; i<this->ptr_landside_cub->get_number_segments(); i++){
buffer.calc_interception(this->ptr_landside_cub->get_segment(i),&buff_point_land);
if(buff_point_land.interception_flag==true){
break;
}
}
if(for_output==true){
point_list->add_new_point(buff_point_land.interception_point.get_xcoordinate(),buff_point_land.interception_point.get_ycoordinate(),true, this->ptr_cubature);
}
double deltay=buff_point_water.interception_point.get_ycoordinate()-buff_point_land.interception_point.get_ycoordinate();
double deltax=buff_point_land.interception_point.get_xcoordinate()-buff_point_water.interception_point.get_xcoordinate();
double h_buff=0.0;
for(int i=0; i< point_list->get_number_points(); i++){
//left of the waterside base
if(point_list->get_list_point(i)->get_x_coordinate()<buff_point_water.interception_point.get_xcoordinate()){
h_buff=h_rel;
point_list->get_list_point(i)->set_waterlevel(h_buff);
}
//right of the landside base
else if(point_list->get_list_point(i)->get_x_coordinate()>buff_point_land.interception_point.get_xcoordinate()){
h_buff=buff_point_land.interception_point.get_ycoordinate();
point_list->get_list_point(i)->set_waterlevel(h_buff);
if(h_buff<=point_list->get_list_point(i)->get_y_coordinate_cubature()){
point_list->get_list_point(i)->set_waterlevel(h_buff);
}
else{
point_list->get_list_point(i)->set_waterlevel(point_list->get_list_point(i)->get_y_coordinate_cubature());
}
}
//inbetween
else{
h_buff=h_rel-(point_list->get_list_point(i)->get_x_coordinate()-buff_point_water.interception_point.get_xcoordinate())*
deltay/deltax;
if(h_buff<=point_list->get_list_point(i)->get_y_coordinate_cubature()){
point_list->get_list_point(i)->set_waterlevel(h_buff);
}
else{
point_list->get_list_point(i)->set_waterlevel(point_list->get_list_point(i)->get_y_coordinate_cubature());
}
}
point_list->get_list_point(i)->set_inside_dike_body_flag(true);
}
}
}
//Calculate the seepage line: to the landside after the Kozeny
void Fpl_Seepage_Calculator_Dike::calculate_seepage_line_land_kozeny(double h_rel, Fpl_Seepage_Line_Point_List *point_list, const bool for_output){
if(h_rel>this->ptr_waterside_cub->get_ptr_last_point()->get_ycoordinate()){
h_rel=this->ptr_waterside_cub->get_ptr_last_point()->get_ycoordinate();
}
if(h_rel<0.0){
h_rel=0.0;
}
//waterlevel is below landside dike base=> horizontal line
if(h_rel<this->ptr_landside_cub->get_ptr_last_point()->get_ycoordinate()){
this->calculate_seepage_line_horizontal(h_rel, point_list, for_output);
}
//waterlevel is above landside dike base
else{
//find the interception point with waterside
Geo_Segment buffer;
Geo_Point *land_point;
land_point=this->ptr_landside_cub->get_ptr_last_point();
buffer.set_coordinates(0.0,h_rel,this->ptr_landside_cub->get_ptr_last_point()->get_xcoordinate(),h_rel);
_geo_interception_point buff_point_water;
buff_point_water.interception_point.set_point_name(label::interception_point);
int index_segment_water=0;
for(int i=0; i<this->ptr_waterside_cub->get_number_segments(); i++){
buffer.calc_interception(this->ptr_waterside_cub->get_segment(i),&buff_point_water);
if(buff_point_water.interception_flag==true){
index_segment_water=i;
break;
}
}
if(for_output==true){
point_list->add_new_point(buff_point_water.interception_point.get_xcoordinate(),buff_point_water.interception_point.get_ycoordinate(),true, this->ptr_cubature);
}
double s=0.0;
bool interception=false;
double h_drei=0.0;
double l_strich=0.0;
int index_segment_land=0;
double c1=0.0;
double c2=0.0;
double c3=0.0;
int counter=this->ptr_landside_cub->get_number_segments()-1;
index_segment_land=counter;
Geo_Point_List sq_interception;
do{
interception=false;
//coordinate of the water base point is (0/0)
s=buff_point_water.interception_point.get_xcoordinate();
c1=pow((h_rel-land_point->get_ycoordinate()),2.0);
c3=(buff_point_water.interception_point.get_xcoordinate()-0.3*s);
double l=this->ptr_landside_cub->get_segment(counter)->point2.get_xcoordinate()-buff_point_water.interception_point.get_xcoordinate();
double d=l+0.3*s;
double y_null=pow((c1+pow(d,2.0)),0.5)-d;
double beta_land=_Geo_Geometrie::rad_to_grad(atan(abs(this->ptr_landside_cub->get_segment(counter)->get_gradient())));
double a=0.0;
h_drei=0.0;
if(beta_land<30.0){
a=pow(d,2.0)-pow((h_rel-land_point->get_ycoordinate()),2.0)*pow(1.0/tan(_Geo_Geometrie::grad_to_rad(beta_land)),2.0);
if(a<0.0){
interception=true;
counter--;
if(counter<0){
Error msg=this->set_error(1);
throw msg;
}
land_point=&(this->ptr_landside_cub->get_segment(counter)->point2);
continue;
}
a=pow((pow((h_rel-land_point->get_ycoordinate()),2.0)+pow(d,2.0)),0.5)-(pow(a,0.5));
if(a>this->ptr_landside_cub->get_segment(counter)->get_distance()){
interception=true;
counter--;
if(counter<0){
Error msg=this->set_error(1);
throw msg;
}
land_point=&(this->ptr_landside_cub->get_segment(counter)->point2);
continue;
}
}
else{
//approximated with a line
a=y_null/(1.0-cos(_Geo_Geometrie::grad_to_rad(beta_land)))*(0.00256*beta_land+0.53);
}
h_drei=a*sin(_Geo_Geometrie::grad_to_rad(beta_land));
l_strich=d-h_drei*1.0/abs(this->ptr_landside_cub->get_segment(counter)->get_gradient());
c2=(c1-pow(h_drei,2.0))/l_strich;
//check interception with landside; if there is one, change the relevant segment
/*for(int i=0; i< counter ;i++){
this->ptr_landside_cub->get_segment(i)->calc_interception_square_root(&sq_interception,c1,c2,c3, land_point->get_ycoordinate());
if(sq_interception.get_number_points()>0){
interception=true;
counter=i;
land_point=&this->ptr_landside_cub->get_segment(counter)->point2;
break;
}
}*/
}
while(interception==true);
if(for_output==true){
point_list->add_new_point(this->ptr_landside_cub->get_segment(counter)->point2.get_xcoordinate()-h_drei/abs(this->ptr_landside_cub->get_segment(counter)->get_gradient()),0.0,true, this->ptr_cubature);
}
double x_buff=0.0;
double y_buff=0.0;
Geo_Point buffer_point;
buffer_point.set_point_coordinate(buff_point_water.interception_point.get_xcoordinate()+h_rel*this->ptr_waterside_cub->get_segment(index_segment_water)->get_gradient(),0.0);
buffer.set_points(&buff_point_water.interception_point, &buffer_point);
buffer.calc_interception_square_root(&sq_interception,c1,c2,c3, land_point->get_ycoordinate());
if(sq_interception.get_number_points()==0){
Error msg=this->set_error(0);
throw msg;
}
else{
buffer.set_points(&buff_point_water.interception_point, sq_interception.get_ptr_point_max_y());
if(for_output==true){
point_list->add_new_point(sq_interception.get_ptr_point_max_y()->get_xcoordinate(),sq_interception.get_ptr_point_max_y()->get_ycoordinate(),true, this->ptr_cubature);
}
}
/*for(int i=0; i< point_list->get_number_points(); i++){
cout << point_list->get_list_point(i)->get_x_coordinate() << " "<<endl;
}*/
for(int i=0; i< point_list->get_number_points(); i++){
x_buff=point_list->get_list_point(i)->get_x_coordinate();
//left of the waterside base
if(x_buff<buff_point_water.interception_point.get_xcoordinate()){
point_list->get_list_point(i)->set_waterlevel(h_rel);
point_list->get_list_point(i)->set_inside_dike_body_flag(true);
}
//right of the landside base
else if(x_buff>this->ptr_landside_cub->get_segment(index_segment_land)->point2.get_xcoordinate()){
point_list->get_list_point(i)->set_waterlevel(this->ptr_landside_cub->get_segment(index_segment_land)->point2.get_ycoordinate());
point_list->get_list_point(i)->set_inside_dike_body_flag(true);
}
//use a straight line
else if(x_buff<=buffer.point2.get_xcoordinate()){
y_buff=buffer.get_gradient()*x_buff+buffer.get_y_interception();
point_list->get_list_point(i)->set_waterlevel(y_buff);
point_list->get_list_point(i)->set_inside_dike_body_flag(true);
}
//inbetween
else{
double h_buff=0.0;
y_buff=c2;
x_buff=x_buff-c3;
y_buff=y_buff*(x_buff);
if(c1>=y_buff){
y_buff=pow(c1-y_buff,0.5);
if(y_buff>=h_drei-constant::meter_epsilon){
h_buff=y_buff+land_point->get_ycoordinate();
}
else{
if(i==0){
Error msg=this->set_error(2);
throw msg;
}
h_buff=point_list->get_list_point(i-1)->get_waterlevel();
}
}
else{
if(i==0){
Error msg=this->set_error(2);
throw msg;
}
h_buff=point_list->get_list_point(i-1)->get_waterlevel();
}
if(h_buff<=point_list->get_list_point(i)->get_y_coordinate_cubature()){
point_list->get_list_point(i)->set_waterlevel(h_buff);
}
else{
point_list->get_list_point(i)->set_waterlevel(point_list->get_list_point(i)->get_y_coordinate_cubature());
}
point_list->get_list_point(i)->set_inside_dike_body_flag(true);
}
}
}
}
//Set warning(s)
Warning Fpl_Seepage_Calculator_Dike::set_warning(const int warn_type){
string place="Fpl_Seepage_Calculator_Dike::";
string help;
string reason;
string reaction;
int type=0;
Warning msg;
stringstream info;
switch (warn_type){
case 0://method is not applicable
place.append("set_input(QSqlDatabase *ptr_database, const bool frc_sim, const bool output)") ;
reason="The method of 1/3 for the waterside seepage line calculation is not applicable in a frc-calculation";
reaction="Method is changed to the base point method";
help= "Seepage calculation method (waterside)";
type=7;
break;
default:
place.append("set_warning(const int warn_type)");
reason ="Unknown flag!";
help="Check the flags";
type=5;
}
msg.set_msg(place,reason,help,reaction,type);
msg.make_second_info(info.str());
return msg;
};
//set the error
Error Fpl_Seepage_Calculator_Dike::set_error(const int err_type){
string place="Fpl_Seepage_Calculator_Dike::";
string help;
string reason;
int type=0;
bool fatal=false;
stringstream info;
Error msg;
switch (err_type){
case 0://no interception found
place.append("calculate_seepage_line_land_kozeny(double h_rel, Fpl_Seepage_Line_Point_List *point_list)");
reason="Can not find any interception between the starting line and the Kozeny parabola";
help="Check the code";
type=6;
break;
case 1://land side to flat
place.append("calculate_seepage_line_land_kozeny(double h_rel, Fpl_Seepage_Line_Point_List *point_list)");
reason="Can not find any interception between the Kozeny parabola and the land side cubatur; it is to flat";
help="Check the land side cubature";
type=11;
break;
case 2://land side to flat
place.append("calculate_seepage_line_land_kozeny(double h_rel, Fpl_Seepage_Line_Point_List *point_list)");
reason="There is no point in list before i=0";
help="Check the code";
type=11;
break;
default:
place.append("set_error(const int err_type)");
reason ="Unknown flag!";
help="Check the flags";
type=6;
}
msg.set_msg(place, reason, help, type, fatal);
msg.make_second_info(info.str());
return msg;
}
| 39.884698 | 262 | 0.764947 | dabachma |
e0a00fc1c7dc3aa77dd5dd692eb750da571331c4 | 2,136 | cc | C++ | source/src/Analysis/OverlayEstimator/TreeProcessor.cc | rete/Baboon | e5b2cfe6b9e5b5a41c2c68feda84b8df109eb086 | [
"FSFAP"
] | null | null | null | source/src/Analysis/OverlayEstimator/TreeProcessor.cc | rete/Baboon | e5b2cfe6b9e5b5a41c2c68feda84b8df109eb086 | [
"FSFAP"
] | null | null | null | source/src/Analysis/OverlayEstimator/TreeProcessor.cc | rete/Baboon | e5b2cfe6b9e5b5a41c2c68feda84b8df109eb086 | [
"FSFAP"
] | null | null | null | /// \file TreeProcessor.cc
/*
*
* TreeProcessor.cc source template generated by fclass
* Creation date : ven. mai 3 2013
* Copyright (c) CNRS , IPNL
*
* All Right Reserved.
* Use and copying of these libraries and preparation of derivative works
* based upon these libraries are permitted. Any copy of these libraries
* must include this copyright notice.
*
* @author : rete
*/
#include "Analysis/OverlayEstimator/TreeProcessor.hh"
namespace baboon {
TreeProcessor::TreeProcessor( TTree *t ) {
treeWrapper = new InputTTreeWrapper(t);
}
TreeProcessor::~TreeProcessor() {
delete treeWrapper;
}
void TreeProcessor::Loop() {
TH1 *purity1Histo = new TH1D("purity1Histo","",100,0,100);
TH1 *purity2Histo = new TH1D("purity2Histo","",100,0,100);
TH1 *contamination1Histo = new TH1D("contamination1Histo","",100,0,100);
TH1 *contamination2Histo = new TH1D("contamination2Histo","",100,0,100);
int nbOfEntries = treeWrapper->GetNbOfEntries();
for ( int jentry=0 ; jentry<nbOfEntries; jentry++ ) {
EstimatorVars tempVars;
treeWrapper->LoadEntry(jentry);
bool showersFound;
treeWrapper->GetValue("showersFound",showersFound);
if( !showersFound ) continue;
treeWrapper->GetValue("contamination1",tempVars.contamination1);
treeWrapper->GetValue("contamination2",tempVars.contamination2);
treeWrapper->GetValue("purity1",tempVars.purity1);
treeWrapper->GetValue("purity2",tempVars.purity2);
estimatorMeans.algorithmEfficiency++;
purity1Histo->Fill(tempVars.purity1*100);
purity2Histo->Fill(tempVars.purity2*100);
contamination1Histo->Fill(tempVars.contamination1*100);
contamination2Histo->Fill(tempVars.contamination2*100);
}
estimatorMeans.algorithmEfficiency /= double(nbOfEntries);
estimatorMeans.contamination1 = contamination1Histo->GetMean();
estimatorMeans.contamination2 = contamination2Histo->GetMean();
estimatorMeans.purity1 = purity1Histo->GetMean();
estimatorMeans.purity2 = purity2Histo->GetMean();
delete purity1Histo;
delete purity2Histo;
delete contamination1Histo;
delete contamination2Histo;
}
} // namespace
| 28.105263 | 74 | 0.742509 | rete |
e0a0463fb6b548ea1917d880d9df81d6be1553d2 | 673 | cpp | C++ | cpp/july/day_19_Add Binary.cpp | kashyapvinay/leetcode-challenge | 750b0056cb547dc5266d142a9a5048ebd50d8ae3 | [
"MIT"
] | 1 | 2020-06-01T11:35:46.000Z | 2020-06-01T11:35:46.000Z | cpp/july/day_19_Add Binary.cpp | kashyapvinay/leetcode-challenge | 750b0056cb547dc5266d142a9a5048ebd50d8ae3 | [
"MIT"
] | null | null | null | cpp/july/day_19_Add Binary.cpp | kashyapvinay/leetcode-challenge | 750b0056cb547dc5266d142a9a5048ebd50d8ae3 | [
"MIT"
] | null | null | null | class Solution {
public:
string addBinary(string a, string b) {
string res = "";
int i = 0, j, c, s;
reverse(a.begin(), a.end());
reverse(b.begin(), b.end());
c = 0;
while(i < a.size() || i < b.size()){
s = c;
if(i < a.size()){
s += a[i] == '1' ? 1 : 0;
}
if(i < b.size()){
s += b[i] == '1' ? 1 : 0;
}
c = s / 2;
s = s % 2;
res += s ? '1' : '0';
i++;
}
if(c){
res += '1';
}
reverse(res.begin(), res.end());
return res;
}
};
| 23.206897 | 44 | 0.294205 | kashyapvinay |
e0a06b63d3b458bbbfe2303704913d618734eae6 | 2,558 | cpp | C++ | PID_Autotune/lib/QuadEnc/QuadEnc.cpp | PassionForRobotics/DeadReconQuadratureEncoder | d112ea1eb3cd3014347cb88ee593babddd72b353 | [
"MIT"
] | null | null | null | PID_Autotune/lib/QuadEnc/QuadEnc.cpp | PassionForRobotics/DeadReconQuadratureEncoder | d112ea1eb3cd3014347cb88ee593babddd72b353 | [
"MIT"
] | null | null | null | PID_Autotune/lib/QuadEnc/QuadEnc.cpp | PassionForRobotics/DeadReconQuadratureEncoder | d112ea1eb3cd3014347cb88ee593babddd72b353 | [
"MIT"
] | null | null | null |
#include <Arduino.h>
#include "QuadEnc.h"
#include <DeadReckoner.h>
#define SPEED_COMPUTE_INTERVAL (10.0)
#define ENCODER_PULSES_PER_REV (334)
#define SPEED_MUTIPLIER (9000.0) // To match output
QuadEncoder::QuadEncoder(int _pin_1, int _pin_2)//, float _radius, float _separation, int _ticks_per_rev, int _compute_interval)
{
this->pin_1_ = _pin_1;
this->pin_2_ = _pin_2;
//this->radius_ = _radius;
//this->separation_ = _separation;
//this->ticks_per_rev_ = _ticks_per_rev;
//this->compute_interval_ = _compute_interval;
}
volatile void QuadEncoder::pulseA(void)
{
// Test transition
this->pastA_ = digitalRead(this->pin_1_) == HIGH;
// and adjust counter + if A leads B
position_ += (this->pastA_ == this->pastB_) ? +1 : -1;
}
volatile void QuadEncoder::pulseB(void)
{
// Test transition
this->pastB_ = digitalRead(this->pin_2_) == HIGH;
// and adjust counter + if A leads B
position_ += (this->pastA_ == this->pastB_) ? +1 : -1;
}
volatile void QuadEncoder::updateRPM(void)
{
if (millis() - this->prev_speed_compute_time_ > SPEED_COMPUTE_INTERVAL)
{
this->prev_speed_compute_time_ = millis();
long long int ticks = (double) this->position_;
double delta_pos = ((double)ticks - (double)this->last_position_)/((double)ENCODER_PULSES_PER_REV);
this->last_position_ = ticks;
this->meas_rps_ = ticks%ENCODER_PULSES_PER_REV;
this->rp10millis_ = (double)delta_pos/(double)SPEED_COMPUTE_INTERVAL;
this->rps_ = this->rp10millis_*100.0;
this->rpm_ = this->rps_*60.0;
}
}
void QuadEncoder::begin( void (*isr_cb_A)(void), void (*isr_cb_B)(void) )
{
pinMode(this->pin_1_, INPUT);
//turn on pullup resistor
//digitalWrite(encoder0PinA, HIGH); //ONLY FOR SOME ENCODER(MAGNETIC)!!!!
pinMode(this->pin_2_, INPUT);
//turn on pullup resistor
//digitalWrite(encoder0PinB, HIGH); //ONLY FOR SOME ENCODER(MAGNETIC)!!!!
//pastA_ = (bool)digitalRead(this->pin_1_); //initial value of channel A;
//pastB_ = (bool)digitalRead(this->pin_2_); //and channel B
//To speed up even more, you may define manually the ISRs
// encoder A channel on interrupt 0 (Arduino's pin 2)
attachInterrupt(digitalPinToInterrupt(this->pin_1_), isr_cb_A, RISING);
// encoder B channel pin on interrupt 1 (Arduino's pin 3)
attachInterrupt(digitalPinToInterrupt(this->pin_2_), isr_cb_B, CHANGE);
}
void QuadEncoder::reset(int _v)
{
position_ = _v;
}
| 27.804348 | 130 | 0.666927 | PassionForRobotics |
e0a15e7e55f505dd57d84fd8639e330a8a3e04af | 334 | cpp | C++ | leetcode/126. Word Ladder II/main.cpp | joycse06/LeetCode-1 | ad105bd8c5de4a659c2bbe6b19f400b926c82d93 | [
"Fair"
] | 1 | 2021-02-11T01:23:10.000Z | 2021-02-11T01:23:10.000Z | leetcode/126. Word Ladder II/main.cpp | aerlokesh494/LeetCode | 0f2cbb28d5a9825b51a8d3b3a0ae0c30d7ff155f | [
"Fair"
] | null | null | null | leetcode/126. Word Ladder II/main.cpp | aerlokesh494/LeetCode | 0f2cbb28d5a9825b51a8d3b3a0ae0c30d7ff155f | [
"Fair"
] | 1 | 2021-03-25T17:11:14.000Z | 2021-03-25T17:11:14.000Z | #include "../+Helper/Helper.h"
#include "s2.cpp"
#include <cstdio>
int main() {
Solution s;
unordered_set<string> d{"hot","cog","dot","dog","hit","lot","log"};
string a = "hit";
string b = "cog";
auto v = s.findLadders(a, b, d);
for (auto vv : v) {
for (auto s : vv) {
cout << s << ",";
}
cout << endl;
}
return 0;
} | 18.555556 | 68 | 0.54491 | joycse06 |
e0a49d9b9c25435467fcdba032d33856a947ad6d | 24,822 | cpp | C++ | src/CSeahaven.cpp | colinw7/CQSeahaven | fc32309db202637e3330dd011fe32b21edbc125c | [
"MIT"
] | null | null | null | src/CSeahaven.cpp | colinw7/CQSeahaven | fc32309db202637e3330dd011fe32b21edbc125c | [
"MIT"
] | null | null | null | src/CSeahaven.cpp | colinw7/CQSeahaven | fc32309db202637e3330dd011fe32b21edbc125c | [
"MIT"
] | null | null | null | #include <CSeahaven.h>
#include <CSeahavenStack.h>
#include <CSeahavenPile.h>
#include <CSeahavenWorkArea.h>
#include <CSeahavenMove.h>
#include <CInstCount.h>
#include <CCardDeck.h>
#include <CStrUtil.h>
#include <cstring>
enum { MAX_ITERATIONS = 100000, DIE_ITERATIONS = 101000 };
bool CSeahaven::debug_ = false;
CSeahaven::
CSeahaven()
{
deck_ = new CCardDeck();
stack_mgr_ = new CSeahavenStackMgr();
num_stacks_ = stack_mgr_->getNumStacks();
pile_mgr_ = new CSeahavenPileMgr();
num_piles_ = pile_mgr_->getNumPiles();
work_area_mgr_ = new CSeahavenWorkAreaMgr();
num_work_areas_ = work_area_mgr_->getNumWorkAreas();
states_ .resize(NUM_STATE_LISTS);
num_states_.resize(NUM_STATE_LISTS);
for (int i = 0; i < NUM_STATE_LISTS; ++i)
num_states_[i] = 0;
deal();
}
CSeahaven::
~CSeahaven()
{
delete deck_;
delete stack_mgr_;
delete pile_mgr_;
delete work_area_mgr_;
deleteStates();
}
void
CSeahaven::
deleteStates()
{
for (int i = 0; i < NUM_STATE_LISTS; ++i) {
for (int j = 0; j < num_states_[i]; ++j)
delete states_[i][j];
states_[i].clear();
num_states_[i] = 0;
}
}
void
CSeahaven::
shuffle()
{
deck_->shuffle();
}
void
CSeahaven::
deal()
{
deck_->shuffle();
stack_mgr_ ->clearStacks ();
pile_mgr_ ->clearPiles ();
work_area_mgr_->clearWorkAreas();
int num_cards = deck_->getNumCards();
int num_stack_cards = num_cards/num_stacks_;
for (int i = 0; i < num_stacks_; ++i) {
CSeahavenStack *stack = stack_mgr_->getStack(i);
for (int j = 0; j < num_stack_cards; ++j) {
CCard *card = deck_->popCard();
card->setSide(CCard::Side::FaceUp);
stack->push(card);
}
}
int num_extra_cards = num_cards - num_stack_cards*num_stacks_;
for (int i = 0; i < num_extra_cards; ++i) {
CSeahavenWorkArea *work_area = work_area_mgr_->getFreeWorkArea();
CCard *card = deck_->popCard();
card->setSide(CCard::Side::FaceUp);
work_area->push(card);
}
if (getDebug())
std::cout << *this << std::endl;
}
bool
CSeahaven::
readDeck(const std::string &filename)
{
CFile file(filename);
deck_->restore(file);
deal();
return true;
}
bool
CSeahaven::
solve(CSeahavenMoveSetSet &move_set_set)
{
if (getDebug()) {
std::cout << "Solve" << std::endl;
std::cout << *this << std::endl;
}
deleteStates();
iterations_ = 0;
int depth = 0;
if (solve1(move_set_set, depth + 1)) {
move_set_set.reverse();
if (getDebug()) {
std::cout << "Solved in " << iterations_ << " Iterations" << std::endl;
std::cout << move_set_set << std::endl;
}
return true;
}
return false;
}
bool
CSeahaven::
solve1(CSeahavenMoveSetSet &move_set_set, int depth)
{
if (iterations_ > 0 && (iterations_ % 1000) == 0)
std::cerr << iterations_ << " Iterations " << std::endl;
/*
if (iterations_ > MAX_ITERATIONS)
setDebug(true);
if (iterations_ > DIE_ITERATIONS) {
return false;
*/
//-----
CSeahavenMoveSet move_set;
bool unsolvable;
CSeahavenMoveSet undo_move_set;
while (getForcedStackMoveSet(move_set, unsolvable)) {
if (getDebug())
std::cout << "Do Forced Move: " << move_set << std::endl;
move_set.execute();
if (getDebug())
std::cout << *this << std::endl;
undo_move_set.addMoveSet(move_set);
while (getForcedPileMoveSet(move_set)) {
if (getDebug())
std::cout << "Do Forced Move: " << move_set << std::endl;
move_set.execute();
if (getDebug())
std::cout << *this << std::endl;
undo_move_set.addMoveSet(move_set);
}
}
if (unsolvable) {
if (! undo_move_set.isEmpty()) {
if (getDebug())
std::cout << "Undo Forced Moves: " << undo_move_set << std::endl;
undo_move_set.undo();
if (getDebug())
std::cout << *this << std::endl;
}
return false;
}
while (getForcedPileMoveSet(move_set)) {
if (getDebug())
std::cout << "Do Forced Move: " << move_set << std::endl;
move_set.execute();
if (getDebug())
std::cout << *this << std::endl;
undo_move_set.addMoveSet(move_set);
while (getForcedStackMoveSet(move_set, unsolvable)) {
if (getDebug())
std::cout << "Do Forced Move: " << move_set << std::endl;
move_set.execute();
if (getDebug())
std::cout << *this << std::endl;
undo_move_set.addMoveSet(move_set);
}
if (unsolvable) {
if (! undo_move_set.isEmpty()) {
if (getDebug())
std::cout << "Undo Forced Moves: " << undo_move_set << std::endl;
undo_move_set.undo();
if (getDebug())
std::cout << *this << std::endl;
}
return false;
}
}
//-----
bool solved = isSolved();
if (solved) {
if (getDebug()) {
std::cout << "Solved" << std::endl;
std::cout << *this << std::endl;
}
move_set_set.addMoveSet(undo_move_set);
if (! undo_move_set.isEmpty()) {
if (getDebug())
std::cout << "Undo Forced Moves: " << undo_move_set << std::endl;
undo_move_set.undo();
if (getDebug())
std::cout << *this << std::endl;
}
return true;
}
//-----
solved = processMoves(move_set_set, depth);
if (solved)
move_set_set.addMoveSet(undo_move_set);
//-----
if (! undo_move_set.isEmpty()) {
if (getDebug())
std::cout << "Undo Forced Moves: " << undo_move_set << std::endl;
undo_move_set.undo();
if (getDebug())
std::cout << *this << std::endl;
}
//-----
return solved;
}
bool
CSeahaven::
processMoves(CSeahavenMoveSetSet &move_set_set, int depth)
{
CSeahavenMoveSetSet move_set_set1;
getMoves(move_set_set1);
if (getDebug()) {
if (! move_set_set1.isEmpty()) {
std::cout << "Moves" << std::endl;
std::cout << move_set_set1 << std::endl;
}
else
std::cout << "No Moves" << std::endl;
}
int move_set_set1_size = move_set_set1.size();
for (int i = 0; i < move_set_set1_size; ++i) {
CSeahavenMoveSet *move_set1 = move_set_set1.getMoveSet(i);
if (getDebug())
std::cout << "Do Move: " << *move_set1 << std::endl;
move_set1->execute();
if (getDebug())
std::cout << *this << std::endl;
++iterations_;
if (! checkState()) {
bool solved = solve1(move_set_set, depth + 1);
if (solved) {
move_set_set.addMoveSet(*move_set1);
if (getDebug())
std::cout << "Undo Move: " << *move_set1 << std::endl;
move_set1->undo();
if (getDebug())
std::cout << *this << std::endl;
return true;
}
}
if (getDebug())
std::cout << "Undo Move: " << *move_set1 << std::endl;
move_set1->undo();
if (getDebug())
std::cout << *this << std::endl;
}
return false;
}
bool
CSeahaven::
isSolved() const
{
return pile_mgr_->isSolved();
}
bool
CSeahaven::
getForcedStackMoveSet(CSeahavenMoveSet &move_set, bool &unsolvable)
{
unsolvable = false;
int num_empty_work_areas = work_area_mgr_->getNumEmpty();
for (int i = 0; i < num_stacks_; ++i) {
CSeahavenStack *stack1 = stack_mgr_->getStack(i);
if (! stack1->isForceMoveStack())
continue;
for (int j = i + 1; j < num_stacks_; ++j) {
CSeahavenStack *stack2 = stack_mgr_->getStack(j);
if (! stack2->isForceMoveStack())
continue;
if (stacksLockEachOther(stack1, stack2)) {
if (getDebug()) {
std::cout << "Stack Lock" << std::endl;
std::cout << *this << std::endl;
}
unsolvable = true;
return false;
}
}
}
for (int i = 0; i < num_stacks_; ++i) {
CSeahavenStack *stack1 = stack_mgr_->getStack(i);
if (stack1->isEmpty())
continue;
CCard *stack_card1 = stack1->peek(-1);
if (stack1->isForceMoveStack()) {
for (int j = 0; j < num_stacks_; ++j) {
if (i == j)
continue;
CSeahavenStack *stack2 = stack_mgr_->getStack(j);
if (stack2->isEmpty())
continue;
int num_consecutive2 = stack2->getNumConsecutive();
CCard *stack2_top_card = stack2->peek(-num_consecutive2);
if (stack2_top_card->isNextCard(stack_card1)) {
if (num_consecutive2 - 1 > num_empty_work_areas) {
unsolvable = true;
return false;
}
addStackToStack(&move_set, stack2, stack1, num_consecutive2);
return true;
}
}
}
for (int j = 0; j < num_work_areas_; ++j) {
std::vector<CSeahavenWorkArea *> work_areas;
work_area_mgr_->getTopCards(j, work_areas);
int num_cards = work_areas.size();
if (num_cards == 0)
continue;
CCard *work_area_card = work_areas[0]->peek();
if (work_area_card->isNextCard(stack_card1)) {
addWorkToStack(&move_set, work_areas, stack1, num_cards);
return true;
}
}
}
return false;
}
bool
CSeahaven::
getForcedPileMoveSet(CSeahavenMoveSet &move_set)
{
for (int i = 0; i < num_stacks_; ++i) {
CSeahavenStack *stack1 = stack_mgr_->getStack(i);
if (stack1->isEmpty())
continue;
int num_consecutive1 = stack1->getNumConsecutive();
//------
CCard *stack_card1 = stack1->peek(-1);
CSeahavenPile *pile = pile_mgr_->getPile(stack_card1->getSuit());
if (pile->isEmpty()) {
if (stack_card1->isAce()) {
addStackToPile(&move_set, stack1, pile, num_consecutive1);
return true;
}
}
else {
CCard *pile_card = pile->peek();
if (pile_card->isNextCard(stack_card1)) {
addStackToPile(&move_set, stack1, pile, num_consecutive1);
return true;
}
}
}
//------
for (int i = 0; i < num_work_areas_; ++i) {
CCard *work_area_card = work_area_mgr_->getCard(i);
if (! work_area_card)
continue;
CSeahavenWorkArea *work_area = work_area_mgr_->getWorkArea(i);
CSeahavenPile *pile = pile_mgr_->getPile(work_area_card->getSuit());
if (pile->isEmpty()) {
if (work_area_card->isAce()) {
addWorkToPile(&move_set, work_area, pile);
return true;
}
}
else {
CCard *pile_card = pile->peek();
if (pile_card->isNextCard(work_area_card)) {
addWorkToPile(&move_set, work_area, pile);
return true;
}
}
}
return false;
}
bool
CSeahaven::
stacksLockEachOther(CSeahavenStack *stack1, CSeahavenStack *stack2)
{
int num_consecutive1 = stack1->getNumConsecutive();
int num_consecutive2 = stack2->getNumConsecutive();
int num_non_consecutive1 = stack1->getNumCards() - num_consecutive1;
int num_non_consecutive2 = stack2->getNumCards() - num_consecutive2;
CCard *card2 = stack2->peek(-1);
for (int i = 0; i < num_non_consecutive1; ++i) {
CCard *card1 = stack1->peek(i);
if (! card1->isSameSuit(card2))
continue;
if (card1->isLowerValue(card2))
return true;
}
CCard *card1 = stack1->peek(-1);
for (int i = 0; i < num_non_consecutive2; ++i) {
CCard *card3 = stack2->peek(i);
if (! card3->isSameSuit(card1))
continue;
if (card3->isLowerValue(card1))
return true;
}
return false;
}
void
CSeahaven::
getMoves(CSeahavenMoveSetSet &move_set_set)
{
getWorkToStackMoves (move_set_set);
getStackToStackMoves(move_set_set);
getStackToWorkMoves (move_set_set);
}
void
CSeahaven::
getStackToStackMoves(CSeahavenMoveSetSet &move_set_set)
{
int num_empty_work_areas = work_area_mgr_->getNumEmpty();
for (int i = 0; i < num_stacks_; ++i) {
CSeahavenStack *stack1 = stack_mgr_->getStack(i);
if (stack1->isEmpty())
continue;
int num_consecutive = stack1->getNumConsecutive();
CCard *stack1_top_card = stack1->peek(-num_consecutive);
if (num_consecutive - 1 <= num_empty_work_areas) {
int j = 0;
for ( ; j < num_stacks_; ++j) {
if (i == j)
continue;
CSeahavenStack *stack2 = stack_mgr_->getStack(j);
if (stack2->isEmpty()) {
if (stack1_top_card->isKing()) {
if (! stack1->isKingStack()) {
moveStackToStack(move_set_set, stack1, stack2, num_consecutive);
break; // No need to look any further
}
}
}
else {
CCard *stack2_card = stack2->peek();
if (stack1_top_card->isNextCard(stack2_card)) {
moveStackToStack(move_set_set, stack1, stack2, num_consecutive);
break; // No need to look any further
}
}
}
// If stack to stack move then we don't need the stack to work
if (j < num_stacks_)
continue;
}
}
}
void
CSeahaven::
getStackToWorkMoves(CSeahavenMoveSetSet &move_set_set)
{
int num_empty_work_areas = work_area_mgr_->getNumEmpty();
for (int i = 0; i < num_stacks_; ++i) {
CSeahavenStack *stack1 = stack_mgr_->getStack(i);
if (stack1->isEmpty())
continue;
int num_consecutive = stack1->getNumConsecutive();
/*
CCard *stack1_top_card = stack1->peek(-num_consecutive);
*/
//------
if (num_consecutive <= num_empty_work_areas) {
CSeahavenMoveSet move_set;
addStackToWork(&move_set, stack1, num_consecutive);
/*
if (stack1_top_card->isKing()) {
if (getDebug())
std::cout << "Do Temp Move: " << move_set << std::endl;
move_set.execute();
if (getDebug())
std::cout << *this << std::endl;
if (isKingMoveStackToStack(stack1) ||
isKingMoveWorkToStack(stack1))
move_set_set.addMoveSet(move_set);
if (getDebug())
std::cout << "Undo Temp Move: " << move_set << std::endl;
move_set.undo();
if (getDebug())
std::cout << *this << std::endl;
}
else
*/
move_set_set.addMoveSet(move_set);
}
}
}
void
CSeahaven::
getWorkToStackMoves(CSeahavenMoveSetSet &move_set_set)
{
for (int i = 0; i < num_work_areas_; ++i) {
std::vector<CSeahavenWorkArea *> work_areas;
work_area_mgr_->getTopCards(i, work_areas);
int num_cards = work_areas.size();
if (num_cards == 0)
continue;
CCard *work_area_card = work_areas[0]->peek();
for (int ii = 0; ii < num_stacks_; ++ii) {
CSeahavenStack *stack = stack_mgr_->getStack(ii);
if (stack->isEmpty()) {
if (work_area_card->isKing()) {
moveWorkToStack(move_set_set, work_areas, stack, num_cards);
break; // No need to look any further
}
}
else {
CCard *stack_card = stack->peek();
if (work_area_card->isNextCard(stack_card)) {
moveWorkToStack(move_set_set, work_areas, stack, num_cards);
break; // No need to look any further
}
}
}
}
}
/*
bool
CSeahaven::
isKingMoveStackToStack(CSeahavenStack *stack)
{
return false;
}
bool
CSeahaven::
isKingMoveWorkToStack(CSeahavenStack *stack)
{
return false;
}
*/
bool
CSeahaven::
moveStackToStackValid(CSeahavenStack *stack1, CSeahavenStack *stack2) const
{
if (stack1 == stack2)
return false;
if (stack1->isEmpty())
return false;
int num_top_cards = stack1->getNumTopCards();
if (work_area_mgr_->getNumEmpty() < num_top_cards - 1)
return false;
CCard *top_card = stack1->getTopCard();
if (stack2->isEmpty()) {
if (top_card->isKing())
return true;
}
else {
CCard *card = stack2->peek();
if (top_card->isNextCard(card))
return true;
}
return false;
}
bool
CSeahaven::
moveStackToWorkAreaValid(CSeahavenStack *stack) const
{
if (stack->isEmpty())
return false;
int num_top_cards = stack->getNumTopCards();
if (work_area_mgr_->getNumEmpty() >= num_top_cards)
return true;
return false;
}
bool
CSeahaven::
moveStackToPileValid(CSeahavenStack *stack) const
{
if (stack->isEmpty())
return false;
CCard *stack_card = stack->peek();
CSeahavenPile *pile = pile_mgr_->getPile(stack_card->getSuit());
if (pile->isEmpty()) {
if (stack_card->isAce())
return true;
}
else {
CCard *pile_card = pile->peek();
if (pile_card->isNextCard(stack_card))
return true;
}
return false;
}
bool
CSeahaven::
moveWorkAreaToStackValid(CSeahavenWorkArea *work_area, CSeahavenStack *stack) const
{
if (work_area->isEmpty())
return false;
CCard *work_area_card = work_area->peek();
if (stack->isEmpty()) {
if (work_area_card->isKing())
return true;
}
else {
CCard *stack_card = stack->peek();
if (work_area_card->isNextCard(stack_card))
return true;
}
return false;
}
bool
CSeahaven::
moveWorkAreaToPileValid(CSeahavenWorkArea *work_area) const
{
if (work_area->isEmpty())
return false;
CCard *work_area_card = work_area->peek();
CSeahavenPile *pile = pile_mgr_->getPile(work_area_card->getSuit());
if (pile->isEmpty()) {
if (work_area_card->isAce())
return true;
}
else {
CCard *pile_card = pile->peek();
if (pile_card->isNextCard(work_area_card))
return true;
}
return false;
}
void
CSeahaven::
moveStackToStack(CSeahavenMoveSetSet &move_set_set, CSeahavenStack *stack1,
CSeahavenStack *stack2, int num)
{
CSeahavenMoveSet *move_set = move_set_set.addMoveSet();
addStackToStack(move_set, stack1, stack2, num);
}
void
CSeahaven::
moveStackToPile(CSeahavenMoveSetSet &move_set_set, CSeahavenStack *stack,
CSeahavenPile *pile, int num)
{
CSeahavenMoveSet *move_set = move_set_set.addMoveSet();
addStackToPile(move_set, stack, pile, num);
}
void
CSeahaven::
moveStackToWork(CSeahavenMoveSetSet &move_set_set, CSeahavenStack *stack, int num)
{
CSeahavenMoveSet *move_set = move_set_set.addMoveSet();
addStackToWork(move_set, stack, num);
}
void
CSeahaven::
moveWorkToStack(CSeahavenMoveSetSet &move_set_set, std::vector<CSeahavenWorkArea *> work_areas,
CSeahavenStack *stack, int num)
{
CSeahavenMoveSet *move_set = move_set_set.addMoveSet();
addWorkToStack(move_set, work_areas, stack, num);
}
void
CSeahaven::
moveWorkToPile(CSeahavenMoveSetSet &move_set_set, std::vector<CSeahavenWorkArea *> work_areas,
CSeahavenPile *pile, int num)
{
CSeahavenMoveSet *move_set = move_set_set.addMoveSet();
for (int i = 0; i < num; ++i)
addWorkToPile(move_set, work_areas[i], pile);
}
void
CSeahaven::
moveWorkToPile(CSeahavenMoveSetSet &move_set_set, CSeahavenWorkArea *work_area,
CSeahavenPile *pile)
{
CSeahavenMoveSet *move_set = move_set_set.addMoveSet();
addWorkToPile(move_set, work_area, pile);
}
void
CSeahaven::
addStackToStack(CSeahavenMoveSet *move_set, CSeahavenStack *stack1,
CSeahavenStack *stack2, int num)
{
std::vector<CSeahavenWorkArea *> work_areas;
work_area_mgr_->getEmptyWorkAreas(work_areas);
for (int i = 0; i < num - 1; ++i)
move_set->addMove(stack1, work_areas[i]);
move_set->addMove(stack1, stack2);
for (int i = num - 2; i >= 0; --i)
move_set->addMove(work_areas[i], stack2);
}
void
CSeahaven::
addStackToPile(CSeahavenMoveSet *move_set, CSeahavenStack *stack,
CSeahavenPile *pile, int num)
{
for (int i = 0; i < num; ++i)
move_set->addMove(stack, pile);
}
void
CSeahaven::
addStackToWork(CSeahavenMoveSet *move_set, CSeahavenStack *stack, int num)
{
std::vector<CSeahavenWorkArea *> work_areas;
work_area_mgr_->getEmptyWorkAreas(work_areas);
for (int i = 0; i < num; ++i)
move_set->addMove(stack, work_areas[i]);
}
void
CSeahaven::
addWorkToStack(CSeahavenMoveSet *move_set, CSeahavenWorkArea *work_area, CSeahavenStack *stack)
{
move_set->addMove(work_area, stack);
}
void
CSeahaven::
addWorkToStack(CSeahavenMoveSet *move_set, std::vector<CSeahavenWorkArea *> work_areas,
CSeahavenStack *stack, int num)
{
for (int i = 0; i < num; ++i)
move_set->addMove(work_areas[i], stack);
}
void
CSeahaven::
addWorkToPile(CSeahavenMoveSet *move_set, CSeahavenWorkArea *work_area, CSeahavenPile *pile)
{
move_set->addMove(work_area, pile);
}
void
CSeahaven::
save(CFile &file)
{
for (int i = 0; i < num_stacks_; ++i) {
CSeahavenStack *stack = stack_mgr_->getStack(i);
int num_cards = stack->getNumCards();
for (int j = 0; j < num_cards; ++j) {
CCard *card = stack->peek(j);
if (j > 0)
file.printf(" ");
file.printf("%s", card->getName().c_str());
}
file.printf("\n");
}
for (int i = 0; i < num_piles_; ++i) {
CSeahavenPile *pile = pile_mgr_->getPile(i);
int num_cards = pile->getNumCards();
for (int j = 0; j < num_cards; ++j) {
CCard *card = pile->peek(j);
if (j > 0)
file.printf(" ");
file.printf("%s", card->getName().c_str());
}
file.printf("\n");
}
for (int i = 0; i < num_work_areas_; ++i) {
CCard *card = work_area_mgr_->getCard(i);
if (i > 0)
file.printf(" ");
if (card)
file.printf("%s", card->getName().c_str());
else
file.printf("---");
}
file.printf("\n");
}
void
CSeahaven::
restore(CFile &file)
{
stack_mgr_ ->clearStacks ();
pile_mgr_ ->clearPiles ();
work_area_mgr_->clearWorkAreas();
deck_->dealAll();
std::string line;
for (int i = 0; i < num_stacks_; ++i) {
if (! file.readLine(line))
throw "Bad File";
CSeahavenStack *stack = stack_mgr_->getStack(i);
std::vector<std::string> words;
CStrUtil::addWords(line, words);
int num_words = words.size();
for (int j = 0; j < num_words; ++j) {
if (words[j].size() < 1)
throw "Bad File";
char suit_char = words[j][0];
std::string value_str = words[j].substr(1);
CCard::Suit suit = CCard::charToSuit(suit_char);
if (! CStrUtil::isInteger(value_str))
throw "Bad File";
int value = CStrUtil::toInteger(value_str);
CCard *card = deck_->undealCard(suit, (CCard::Value) (value - 1));
stack->push(card);
}
}
for (int i = 0; i < num_piles_; ++i) {
if (! file.readLine(line))
throw "Bad File";
CSeahavenPile *pile = pile_mgr_->getPile(i);
std::vector<std::string> words;
CStrUtil::addWords(line, words);
int num_words = words.size();
for (int j = 0; j < num_words; ++j) {
if (words[j].size() < 1)
throw "Bad File";
char suit_char = words[j][0];
std::string value_str = words[j].substr(1);
CCard::Suit suit = CCard::charToSuit(suit_char);
if (! CStrUtil::isInteger(value_str))
throw "Bad File";
int value = CStrUtil::toInteger(value_str);
CCard *card = deck_->undealCard(suit, (CCard::Value) (value - 1));
pile->push(card);
}
}
if (! file.readLine(line))
throw "Bad File";
std::vector<std::string> words;
CStrUtil::addWords(line, words);
int num_words = words.size();
if (num_words != num_work_areas_)
throw "Bad File";
for (int i = 0; i < num_work_areas_; ++i) {
if (words[i].size() < 1)
throw "Bad File";
if (words[i] != "---") {
CSeahavenWorkArea *work_area = work_area_mgr_->getWorkArea(i);
char suit_char = words[i][0];
std::string value_str = words[i].substr(1);
CCard::Suit suit = CCard::charToSuit(suit_char);
if (! CStrUtil::isInteger(value_str))
throw "Bad File";
int value = CStrUtil::toInteger(value_str);
CCard *card = deck_->undealCard(suit, (CCard::Value) (value - 1));
work_area->push(card);
}
}
deck_->dealAll();
}
bool
CSeahaven::
checkState()
{
CSeahavenState *state = new CSeahavenState(stack_mgr_, num_stacks_);
int key = state->getKey() % NUM_STATE_LISTS;
for (int i = 0; i < num_states_[key]; ++i) {
if (*states_[key][i] == *state) {
delete state;
return true;
}
}
states_[key].push_back(state);
++num_states_[key];
return false;
}
void
CSeahaven::
print(std::ostream &os) const
{
os << *stack_mgr_ << std::endl;
os << *pile_mgr_ << std::endl;
os << *work_area_mgr_;
}
std::ostream &
operator<<(std::ostream &os, const CSeahaven &seahaven)
{
seahaven.print(os);
return os;
}
CSeahavenState::
CSeahavenState(CSeahavenStackMgr *stack_mgr, int num_stacks)
{
int k = 0;
memset(c_, 0, sizeof(c_));
for (int i = 0; i < num_stacks; ++i) {
CSeahavenStack *stack = stack_mgr->getStack(i);
int num_cards = stack->getNumCards();
int k1 = k;
for (int j = 0; j < num_cards; ++j) {
CCard *card = stack->peek(j);
int ind = card->getIndex();
c_[k1++] = ind;
key_ ^= ind;
}
k += 22;
}
}
int
operator==(const CSeahavenState &lhs, const CSeahavenState &rhs)
{
return (memcmp(lhs.c_, rhs.c_, sizeof(lhs.c_)) == 0);
}
| 20.295993 | 95 | 0.611595 | colinw7 |
e0a7cf516ede79dbbb32b6c1554e2c30e6d74738 | 75,193 | cpp | C++ | tests/PathOpsOpTest.cpp | omapzoom/platform-external-skia | 50bf382c46a9d2348701cb3ce822a306bd9f3812 | [
"BSD-3-Clause"
] | null | null | null | tests/PathOpsOpTest.cpp | omapzoom/platform-external-skia | 50bf382c46a9d2348701cb3ce822a306bd9f3812 | [
"BSD-3-Clause"
] | null | null | null | tests/PathOpsOpTest.cpp | omapzoom/platform-external-skia | 50bf382c46a9d2348701cb3ce822a306bd9f3812 | [
"BSD-3-Clause"
] | 2 | 2019-02-04T02:15:39.000Z | 2021-03-04T00:45:13.000Z | /*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "PathOpsExtendedTest.h"
#define TEST(name) { name, #name }
static void cubicOp1d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(0,2, 1,0, 1,0);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,1);
pathB.cubicTo(0,1, 1,0, 2,0);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp2d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,2);
path.cubicTo(0,1, 1,0, 1,0);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,1);
pathB.cubicTo(0,1, 2,0, 1,0);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp3d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(2,3, 1,0, 1,0);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,1);
pathB.cubicTo(0,1, 1,0, 3,2);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp5d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(0,2, 1,0, 2,0);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,1);
pathB.cubicTo(0,2, 1,0, 2,0);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp6d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(0,6, 1,0, 3,0);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,1);
pathB.cubicTo(0,3, 1,0, 6,0);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp7d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(3,4, 1,0, 3,0);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,1);
pathB.cubicTo(0,3, 1,0, 4,3);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp8d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(0,5, 1,0, 4,0);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,1);
pathB.cubicTo(0,4, 1,0, 5,0);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp9d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(1,6, 1,0, 2,1);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,1);
pathB.cubicTo(1,2, 1,0, 6,1);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void quadOp9d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.quadTo(1,6, 1.5f,1);
path.quadTo(1.5f,0.5f, 2,1);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,1);
pathB.quadTo(1,2, 1.4f,1);
pathB.quadTo(3,0.4f, 6,1);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void lineOp9d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.lineTo(1,6);
path.lineTo(1.5f,1);
path.lineTo(1.8f,0.8f);
path.lineTo(2,1);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,1);
pathB.lineTo(1,2);
pathB.lineTo(1.4f,1);
pathB.lineTo(3,0.4f);
pathB.lineTo(6,1);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp1i(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(1,2, 1,0, 2,1);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,1);
pathB.cubicTo(1,2, 1,0, 2,1);
pathB.close();
testPathOp(reporter, path, pathB, kIntersect_PathOp);
}
static void cubicOp10d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(1,3, 1,0, 4,1);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,1);
pathB.cubicTo(1,4, 1,0, 3,1);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp11d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(3,4, 1,0, 5,1);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,1);
pathB.cubicTo(1,5, 1,0, 4,3);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp12d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(1,6, 1,0, 1,0);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,1);
pathB.cubicTo(0,1, 1,0, 6,1);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp13d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(4,5, 1,0, 5,3);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,1);
pathB.cubicTo(3,5, 1,0, 5,4);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp14d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(0,2, 2,0, 2,1);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,2);
pathB.cubicTo(1,2, 1,0, 2,0);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp15d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(3,6, 2,0, 2,1);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,2);
pathB.cubicTo(1,2, 1,0, 6,3);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp16d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,2);
path.cubicTo(0,1, 3,0, 1,0);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,3);
pathB.cubicTo(0,1, 2,0, 1,0);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp17d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,2);
path.cubicTo(0,2, 4,0, 2,1);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,4);
pathB.cubicTo(1,2, 2,0, 2,0);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp18d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(3,5, 2,0, 2,1);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,2);
pathB.cubicTo(1,2, 1,0, 5,3);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp19i(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,2);
path.cubicTo(0,1, 2,1, 6,2);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(1,2);
pathB.cubicTo(2,6, 2,0, 1,0);
pathB.close();
testPathOp(reporter, path, pathB, kIntersect_PathOp);
}
static void cubicOp20d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(0,1, 6,0, 2,1);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,6);
pathB.cubicTo(1,2, 1,0, 1,0);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp21d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(0,1, 2,1, 6,5);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(1,2);
pathB.cubicTo(5,6, 1,0, 1,0);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp22d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(2,3, 3,0, 2,1);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,3);
pathB.cubicTo(1,2, 1,0, 3,2);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp23d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(1,2, 4,0, 2,1);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,4);
pathB.cubicTo(1,2, 1,0, 2,1);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp24d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(1,2, 2,0, 3,2);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,2);
pathB.cubicTo(2,3, 1,0, 2,1);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void testIntersect1(skiatest::Reporter* reporter) {
SkPath one, two;
one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
two.addRect(3, 3, 9, 9, SkPath::kCW_Direction);
testPathOp(reporter, one, two, kIntersect_PathOp);
}
static void testUnion1(skiatest::Reporter* reporter) {
SkPath one, two;
one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
two.addRect(3, 3, 9, 9, SkPath::kCW_Direction);
testPathOp(reporter, one, two, kUnion_PathOp);
}
static void testDiff1(skiatest::Reporter* reporter) {
SkPath one, two;
one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
two.addRect(3, 3, 9, 9, SkPath::kCW_Direction);
testPathOp(reporter, one, two, kDifference_PathOp);
}
static void testXor1(skiatest::Reporter* reporter) {
SkPath one, two;
one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
two.addRect(3, 3, 9, 9, SkPath::kCW_Direction);
testPathOp(reporter, one, two, kXOR_PathOp);
}
static void testIntersect2(skiatest::Reporter* reporter) {
SkPath one, two;
one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
two.addRect(0, 3, 9, 9, SkPath::kCW_Direction);
testPathOp(reporter, one, two, kIntersect_PathOp);
}
static void testUnion2(skiatest::Reporter* reporter) {
SkPath one, two;
one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
two.addRect(0, 3, 9, 9, SkPath::kCW_Direction);
testPathOp(reporter, one, two, kUnion_PathOp);
}
static void testDiff2(skiatest::Reporter* reporter) {
SkPath one, two;
one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
two.addRect(0, 3, 9, 9, SkPath::kCW_Direction);
testPathOp(reporter, one, two, kDifference_PathOp);
}
static void testXor2(skiatest::Reporter* reporter) {
SkPath one, two;
one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
two.addRect(0, 3, 9, 9, SkPath::kCW_Direction);
testPathOp(reporter, one, two, kXOR_PathOp);
}
static void testOp1d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
pathB.setFillType(SkPath::kWinding_FillType);
pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void testOp2d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
pathB.setFillType(SkPath::kEvenOdd_FillType);
pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void testOp3d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
path.addRect(1, 1, 2, 2, SkPath::kCW_Direction);
pathB.setFillType(SkPath::kWinding_FillType);
pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void testOp1u(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
path.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
pathB.setFillType(SkPath::kWinding_FillType);
pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
testPathOp(reporter, path, pathB, kUnion_PathOp);
}
static void testOp4d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
path.addRect(2, 2, 4, 4, SkPath::kCW_Direction);
pathB.setFillType(SkPath::kWinding_FillType);
pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void testOp5d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kEvenOdd_FillType);
path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
path.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
pathB.setFillType(SkPath::kEvenOdd_FillType);
pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void testOp6d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kEvenOdd_FillType);
path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
path.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
pathB.setFillType(SkPath::kWinding_FillType);
pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void testOp7d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kEvenOdd_FillType);
path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
pathB.setFillType(SkPath::kEvenOdd_FillType);
pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void testOp2u(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kEvenOdd_FillType);
path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
pathB.setFillType(SkPath::kWinding_FillType);
pathB.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
pathB.addRect(1, 1, 2, 2, SkPath::kCW_Direction);
testPathOp(reporter, path, pathB, kUnion_PathOp);
}
static void testOp8d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.addRect(0, 0, 640, 480);
pathB.moveTo(577330, 1971.72f);
pathB.cubicTo(10.7082f, -116.596f, 262.057f, 45.6468f, 294.694f, 1.96237f);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp25i(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(2,4, 5,0, 3,2);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,5);
pathB.cubicTo(2,3, 1,0, 4,2);
pathB.close();
testPathOp(reporter, path, pathB, kIntersect_PathOp);
}
static void cubicOp26d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(3,4, 4,0, 3,2);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,4);
pathB.cubicTo(2,3, 1,0, 4,3);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp27d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(3,6, 1,0, 5,2);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,1);
pathB.cubicTo(2,5, 1,0, 6,3);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp28u(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(1,4, 6,0, 3,2);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,6);
pathB.cubicTo(2,3, 1,0, 4,1);
pathB.close();
testPathOp(reporter, path, pathB, kUnion_PathOp);
}
static void cubicOp29d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(2,5, 6,0, 4,2);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,6);
pathB.cubicTo(2,4, 1,0, 5,2);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp30d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(2,5, 6,0, 5,3);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,6);
pathB.cubicTo(3,5, 1,0, 5,2);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp31d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,2);
path.cubicTo(0,3, 2,1, 4,0);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(1,2);
pathB.cubicTo(0,4, 2,0, 3,0);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp31u(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,2);
path.cubicTo(0,3, 2,1, 4,0);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(1,2);
pathB.cubicTo(0,4, 2,0, 3,0);
pathB.close();
testPathOp(reporter, path, pathB, kUnion_PathOp);
}
static void cubicOp31x(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,2);
path.cubicTo(0,3, 2,1, 4,0);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(1,2);
pathB.cubicTo(0,4, 2,0, 3,0);
pathB.close();
testPathOp(reporter, path, pathB, kXOR_PathOp);
}
static void cubicOp32d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(1,2, 6,0, 3,1);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,6);
pathB.cubicTo(1,3, 1,0, 2,1);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp33i(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(1,2, 6,0, 3,1);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,6);
pathB.cubicTo(1,3, 1,0, 2,1);
pathB.close();
testPathOp(reporter, path, pathB, kIntersect_PathOp);
}
static void cubicOp34d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(3,5, 2,1, 3,1);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(1,2);
pathB.cubicTo(1,3, 1,0, 5,3);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp35d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(1,5, 2,1, 4,0);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(1,2);
pathB.cubicTo(0,4, 1,0, 5,1);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp36u(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(1,6, 2,0, 5,1);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,2);
pathB.cubicTo(1,5, 1,0, 6,1);
pathB.close();
testPathOp(reporter, path, pathB, kUnion_PathOp);
}
static void cubicOp37d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(2,6, 6,1, 4,3);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(1,6);
pathB.cubicTo(3,4, 1,0, 6,2);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
#if 1
// this fails to detect a cubic/cubic intersection
// the slight overlap is missed when the cubics are approximated by quadratics
// and the subsequent line/cubic intersection also (correctly) misses the intersection
// if the line/cubic was a matching line/approx.quadratic then the missing intersection
// could have been detected
static void cubicOp38d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(0,6, 3,2, 4,1);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(2,3);
pathB.cubicTo(1,4, 1,0, 6,0);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
#endif
static void cubicOp39d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(2,3, 5,1, 4,3);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(1,5);
pathB.cubicTo(3,4, 1,0, 3,2);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp40d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(1,5, 3,2, 4,2);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(2,3);
pathB.cubicTo(2,4, 1,0, 5,1);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp41i(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(2,6, 4,3, 6,4);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(3,4);
pathB.cubicTo(4,6, 1,0, 6,2);
pathB.close();
testPathOp(reporter, path, pathB, kIntersect_PathOp);
}
static void cubicOp42d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(1,2, 6,5, 5,4);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(5,6);
pathB.cubicTo(4,5, 1,0, 2,1);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp43d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,2);
path.cubicTo(1,2, 4,0, 3,1);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,4);
pathB.cubicTo(1,3, 2,0, 2,1);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp44d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,2);
path.cubicTo(3,6, 4,0, 3,2);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,4);
pathB.cubicTo(2,3, 2,0, 6,3);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp45d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,2);
path.cubicTo(2,4, 4,0, 3,2);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,4);
pathB.cubicTo(2,3, 2,0, 4,2);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp46d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,2);
path.cubicTo(3,5, 5,0, 4,2);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,5);
pathB.cubicTo(2,4, 2,0, 5,3);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp47d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(1,6, 6,2, 5,4);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(2,6);
pathB.cubicTo(4,5, 1,0, 6,1);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp48d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,2);
path.cubicTo(2,3, 5,1, 3,2);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(1,5);
pathB.cubicTo(2,3, 2,0, 3,2);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp49d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,2);
path.cubicTo(1,5, 3,2, 4,1);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(2,3);
pathB.cubicTo(1,4, 2,0, 5,1);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp50d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,3);
path.cubicTo(1,6, 5,0, 5,1);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,5);
pathB.cubicTo(1,5, 3,0, 6,1);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp51d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,3);
path.cubicTo(1,2, 4,1, 6,0);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(1,4);
pathB.cubicTo(0,6, 3,0, 2,1);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp52d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,2);
path.cubicTo(1,2, 5,4, 4,3);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(4,5);
pathB.cubicTo(3,4, 2,0, 2,1);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp53d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,3);
path.cubicTo(1,2, 5,3, 2,1);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(3,5);
pathB.cubicTo(1,2, 3,0, 2,1);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp54d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,4);
path.cubicTo(1,3, 5,4, 4,2);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(4,5);
pathB.cubicTo(2,4, 4,0, 3,1);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp55d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,5);
path.cubicTo(1,3, 3,2, 5,0);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(2,3);
pathB.cubicTo(0,5, 5,0, 3,1);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp56d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(2,6, 5,0, 2,1);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,5);
pathB.cubicTo(1,2, 1,0, 6,2);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp57d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,5);
path.cubicTo(0,5, 5,4, 6,4);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(4,5);
pathB.cubicTo(4,6, 5,0, 5,0);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp58d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,5);
path.cubicTo(3,4, 6,5, 5,3);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(5,6);
pathB.cubicTo(3,5, 5,0, 4,3);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp59d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(5,6, 4,0, 4,1);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,4);
pathB.cubicTo(1,4, 1,0, 6,5);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp60d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,2);
path.cubicTo(4,6, 6,0, 5,2);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,6);
pathB.cubicTo(2,5, 2,0, 6,4);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp61d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(1,2);
path.cubicTo(0,5, 3,2, 6,1);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(2,3);
pathB.cubicTo(1,6, 2,1, 5,0);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp62d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(1,3);
path.cubicTo(5,6, 5,3, 5,4);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(3,5);
pathB.cubicTo(4,5, 3,1, 6,5);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp63d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(2,3);
path.cubicTo(0,4, 3,2, 5,3);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(2,3);
pathB.cubicTo(3,5, 3,2, 4,0);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp64d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.moveTo(0,1);
path.cubicTo(0,1, 1,0, 3,0);
path.lineTo(0,1);
path.close();
pathB.moveTo(0,1);
pathB.cubicTo(0,3, 1,0, 1,0);
pathB.lineTo(0,1);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp65d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.moveTo(0,1);
path.cubicTo(1,5, 1,0, 1,0);
path.lineTo(0,1);
path.close();
pathB.moveTo(0,1);
pathB.cubicTo(0,1, 1,0, 5,1);
pathB.lineTo(0,1);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void rectOp1d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.moveTo(0,1);
path.cubicTo(0,1, 1,0, 3,0);
path.lineTo(0,1);
path.close();
pathB.moveTo(0,1);
pathB.cubicTo(0,3, 1,0, 1,0);
pathB.lineTo(0,1);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp66u(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(2,6, 4,2, 5,3);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(2,4);
pathB.cubicTo(3,5, 1,0, 6,2);
pathB.close();
testPathOp(reporter, path, pathB, kUnion_PathOp);
}
static void cubicOp67u(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.moveTo(3,5);
path.cubicTo(1,6, 5,0, 3,1);
path.lineTo(3,5);
path.close();
pathB.moveTo(0,5);
pathB.cubicTo(1,3, 5,3, 6,1);
pathB.lineTo(0,5);
pathB.close();
testPathOp(reporter, path, pathB, kUnion_PathOp);
}
static void cubicOp68u(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.moveTo(0,5);
path.cubicTo(4,5, 4,1, 5,0);
path.close();
pathB.moveTo(1,4);
pathB.cubicTo(0,5, 5,0, 5,4);
pathB.close();
testPathOp(reporter, path, pathB, kUnion_PathOp);
}
static void cubicOp69d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.moveTo(1,3);
path.cubicTo(0,1, 3,1, 2,0);
path.close();
pathB.moveTo(1,3);
pathB.cubicTo(0,2, 3,1, 1,0);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
SkPathOp ops[] = {
kUnion_PathOp,
kXOR_PathOp,
kReverseDifference_PathOp,
kXOR_PathOp,
kReverseDifference_PathOp,
};
static void rRect1(skiatest::Reporter* reporter) {
SkScalar xA = SkFloatToScalar(0.65f);
SkScalar xB = SkFloatToScalar(10.65f);
SkScalar xC = SkFloatToScalar(20.65f);
SkScalar xD = SkFloatToScalar(30.65f);
SkScalar xE = SkFloatToScalar(40.65f);
SkScalar xF = SkFloatToScalar(50.65f);
SkScalar yA = SkFloatToScalar(0.65f);
SkScalar yB = SkFloatToScalar(10.65f);
SkScalar yC = SkFloatToScalar(20.65f);
SkScalar yD = SkFloatToScalar(30.65f);
SkScalar yE = SkFloatToScalar(40.65f);
SkScalar yF = SkFloatToScalar(50.65f);
SkPath paths[5];
SkRect rects[5];
rects[0].set(xB, yB, xE, yE);
paths[0].addRoundRect(rects[0], SkIntToScalar(5), SkIntToScalar(5)); // red
rects[1].set(xA, yA, xD, yD);
paths[1].addRoundRect(rects[1], SkIntToScalar(5), SkIntToScalar(5)); // green
rects[2].set(xC, yA, xF, yD);
paths[2].addRoundRect(rects[2], SkIntToScalar(5), SkIntToScalar(5)); // blue
rects[3].set(xA, yC, xD, yF);
paths[3].addRoundRect(rects[3], SkIntToScalar(5), SkIntToScalar(5)); // yellow
rects[4].set(xC, yC, xF, yF);
paths[4].addRoundRect(rects[4], SkIntToScalar(5), SkIntToScalar(5)); // cyan
SkPath path;
path.setFillType(SkPath::kInverseEvenOdd_FillType);
for (int index = 0; index < 5; ++index) {
testPathOp(reporter, path, paths[index], ops[index]);
Op(path, paths[index], ops[index], &path);
}
}
static void skp1(skiatest::Reporter* reporter) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
path.moveTo(189,7);
path.cubicTo(189,5.34314585f, 190.34314f,4, 192,4);
path.lineTo(243,4);
path.cubicTo(244.65686f,4, 246,5.34314585f, 246,7);
path.lineTo(246,21);
path.cubicTo(246,22.6568546f, 244.65686f,24, 243,24);
path.lineTo(192,24);
path.cubicTo(190.34314f,24, 189,22.6568546f, 189,21);
path.lineTo(189,7);
path.close();
path.moveTo(191,8);
path.cubicTo(191,6.89543009f, 191.895432f,6, 193,6);
path.lineTo(242,6);
path.cubicTo(243.104568f,6, 244,6.89543009f, 244,8);
path.lineTo(244,20);
path.cubicTo(244,21.1045704f, 243.104568f,22, 242,22);
path.lineTo(193,22);
path.cubicTo(191.895432f,22, 191,21.1045704f, 191,20);
path.lineTo(191,8);
path.close();
SkPath pathB;
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(189,4);
pathB.lineTo(199,14);
pathB.lineTo(236,14);
pathB.lineTo(246,4);
pathB.lineTo(189,4);
pathB.close();
testPathOp(reporter, path, pathB, kIntersect_PathOp);
}
static void skp2(skiatest::Reporter* reporter) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
path.moveTo(253.000000f, 11757.0000f);
path.lineTo(253.000000f, 222.000000f);
path.lineTo(823.000000f, 222.000000f);
path.lineTo(823.000000f, 11757.0000f);
path.lineTo(253.000000f, 11757.0000f);
path.close();
SkPath pathB;
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(258.000000f, 1028.00000f);
pathB.lineTo(258.000000f, 1027.00000f);
pathB.lineTo(823.000000f, 1027.00000f);
pathB.lineTo(823.000000f, 1028.00000f);
pathB.lineTo(258.000000f, 1028.00000f);
pathB.close();
testPathOp(reporter, path, pathB, kIntersect_PathOp);
}
static void skp3(skiatest::Reporter* reporter) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
path.moveTo(717.000000f, 507.000000f);
path.lineTo(717.000000f, 425.000000f);
path.lineTo(973.000000f, 425.000000f);
path.lineTo(973.000000f, 507.000000f);
path.quadTo(973.000000f, 508.242645f, 972.121582f, 509.121613f);
path.quadTo(971.242615f, 510.000000f, 970.000000f, 510.000000f);
path.lineTo(720.000000f, 510.000000f);
path.quadTo(718.757385f, 510.000000f, 717.878418f, 509.121613f);
path.quadTo(717.000000f, 508.242645f, 717.000000f, 507.000000f);
path.close();
path.moveTo(719.000000f, 426.000000f);
path.lineTo(971.000000f, 426.000000f);
path.lineTo(971.000000f, 506.000000f);
path.cubicTo(971.000000f, 507.104584f, 970.104553f, 508.000000f, 969.000000f, 508.000000f);
path.lineTo(721.000000f, 508.000000f);
path.cubicTo(719.895447f, 508.000000f, 719.000000f, 507.104584f, 719.000000f, 506.000000f);
path.lineTo(719.000000f, 426.000000f);
path.close();
SkPath pathB;
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(717.000000f, 510.000000f);
pathB.lineTo(760.000000f, 467.000000f);
pathB.lineTo(930.000000f, 467.000000f);
pathB.lineTo(973.000000f, 510.000000f);
pathB.lineTo(717.000000f, 510.000000f);
pathB.close();
testPathOp(reporter, path, pathB, kIntersect_PathOp);
}
static void skp4(skiatest::Reporter* reporter) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
path.moveTo(230.756805f, 591.756775f);
path.quadTo(232.514725f, 590.000000f, 235.000000f, 590.000000f);
path.lineTo(300.000000f, 590.000000f);
path.quadTo(302.485291f, 590.000000f, 304.243195f, 591.756775f);
path.quadTo(306.000000f, 593.514709f, 306.000000f, 596.000000f);
path.lineTo(306.000000f, 617.000000f);
path.lineTo(229.000000f, 617.000000f);
path.lineTo(229.000000f, 596.000000f);
path.quadTo(229.000000f, 593.514709f, 230.756805f, 591.756775f);
path.close();
path.moveTo(231.000000f, 597.000000f);
path.cubicTo(231.000000f, 594.238586f, 233.238571f, 592.000000f, 236.000000f, 592.000000f);
path.lineTo(299.000000f, 592.000000f);
path.cubicTo(301.761414f, 592.000000f, 304.000000f, 594.238586f, 304.000000f, 597.000000f);
path.lineTo(304.000000f, 616.000000f);
path.lineTo(231.000000f, 616.000000f);
path.lineTo(231.000000f, 597.000000f);
path.close();
SkPath pathB;
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(306.000000f, 590.000000f);
pathB.lineTo(292.000000f, 604.000000f);
pathB.lineTo(305.000000f, 617.000000f);
pathB.lineTo(306.000000f, 617.000000f);
pathB.lineTo(306.000000f, 590.000000f);
pathB.close();
testPathOp(reporter, path, pathB, kIntersect_PathOp);
}
static void skp5(skiatest::Reporter* reporter) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
path.moveTo(18.0000000f, 226.000000f);
path.quadTo(14.6862917f, 226.000000f, 12.3423996f, 228.342407f);
path.quadTo(10.0000000f, 230.686295f, 10.0000000f, 234.000000f);
path.lineTo(10.0000000f, 253.000000f);
path.lineTo(1247.00000f, 253.000000f);
path.lineTo(1247.00000f, 234.000000f);
path.quadTo(1247.00000f, 230.686295f, 1244.65759f, 228.342407f);
path.quadTo(1242.31372f, 226.000000f, 1239.00000f, 226.000000f);
path.lineTo(18.0000000f, 226.000000f);
path.close();
SkPath pathB;
pathB.setFillType(SkPath::kInverseWinding_FillType);
pathB.moveTo(18.0000000f, 226.000000f);
pathB.lineTo(1239.00000f, 226.000000f);
pathB.cubicTo(1243.41833f, 226.000000f, 1247.00000f, 229.581726f, 1247.00000f, 234.000000f);
pathB.lineTo(1247.00000f, 252.000000f);
pathB.lineTo(10.0000000f, 252.000000f);
pathB.lineTo(10.0000000f, 234.000000f);
pathB.cubicTo(10.0000000f, 229.581726f, 13.5817204f, 226.000000f, 18.0000000f, 226.000000f);
pathB.close();
testPathOp(reporter, path, pathB, kIntersect_PathOp);
}
static void cubicOp70d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(0,5, 4,0, 5,0);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,4);
pathB.cubicTo(0,5, 1,0, 5,0);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp71d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(0,5, 4,1, 6,4);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(1,4);
pathB.cubicTo(4,6, 1,0, 5,0);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp72i(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(0,5, 5,2, 5,4);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(2,5);
pathB.cubicTo(4,5, 1,0, 5,0);
pathB.close();
testPathOp(reporter, path, pathB, kIntersect_PathOp);
}
static void cubicOp73d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(3,4, 4,0, 6,4);
path.lineTo(0,1);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,4);
pathB.cubicTo(4,6, 1,0, 4,3);
pathB.lineTo(0,4);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp74d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(1,5, 5,1, 5,1);
path.lineTo(0,1);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(1,5);
pathB.cubicTo(1,5, 1,0, 5,1);
pathB.lineTo(1,5);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp75d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(0,4, 5,1, 6,4);
path.lineTo(0,1);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(1,5);
pathB.cubicTo(4,6, 1,0, 4,0);
pathB.lineTo(1,5);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp76u(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(0,2, 2,0, 5,3);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,2);
pathB.cubicTo(3,5, 1,0, 2,0);
pathB.close();
testPathOp(reporter, path, pathB, kUnion_PathOp);
}
static void cubicOp77i(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kEvenOdd_FillType);
path.moveTo(0,1);
path.cubicTo(1,3, 2,0, 3,2);
path.lineTo(0,1);
path.close();
pathB.setFillType(SkPath::kEvenOdd_FillType);
pathB.moveTo(0,2);
pathB.cubicTo(2,3, 1,0, 3,1);
pathB.lineTo(0,2);
pathB.close();
testPathOp(reporter, path, pathB, kIntersect_PathOp);
}
static void cubicOp78u(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kEvenOdd_FillType);
path.moveTo(1,6);
path.cubicTo(1,6, 5,0, 6,1);
path.lineTo(1,6);
path.close();
pathB.setFillType(SkPath::kEvenOdd_FillType);
pathB.moveTo(0,5);
pathB.cubicTo(1,6, 6,1, 6,1);
pathB.lineTo(0,5);
pathB.close();
testPathOp(reporter, path, pathB, kUnion_PathOp);
}
static void cubicOp79u(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(1,3, 1,0, 6,4);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,1);
pathB.cubicTo(4,6, 1,0, 3,1);
pathB.close();
testPathOp(reporter, path, pathB, kIntersect_PathOp);
}
static void cubicOp80i(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(2,3, 2,1, 4,3);
path.lineTo(0,1);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(1,2);
pathB.cubicTo(3,4, 1,0, 3,2);
pathB.lineTo(1,2);
pathB.close();
testPathOp(reporter, path, pathB, kIntersect_PathOp);
}
static void cubicOp81d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(4,6, 4,3, 5,4);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(3,4);
pathB.cubicTo(4,5, 1,0, 6,4);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void cubicOp82i(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kEvenOdd_FillType);
path.moveTo(0,1);
path.cubicTo(2,3, 5,2, 3,0);
path.lineTo(0,1);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(2,5);
pathB.cubicTo(0,3, 1,0, 3,2);
pathB.lineTo(2,5);
pathB.close();
testPathOp(reporter, path, pathB, kIntersect_PathOp);
}
static void cubicOp83i(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(0,3, 2,1, 4,1);
path.lineTo(0,1);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(1,2);
pathB.cubicTo(1,4, 1,0, 3,0);
pathB.lineTo(1,2);
pathB.close();
testPathOp(reporter, path, pathB, kIntersect_PathOp);
}
static void cubicOp84d(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,4);
path.cubicTo(2,3, 6,3, 3,2);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(3,6);
pathB.cubicTo(2,3, 4,0, 3,2);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
static void skpClip1(skiatest::Reporter* reporter) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
path.moveTo(1126.17114f, 877.171204f);
path.quadTo(1127.34314f, 876.000000f, 1129.00000f, 876.000000f);
path.lineTo(1243.00000f, 876.000000f);
path.quadTo(1244.65686f, 876.000000f, 1245.82886f, 877.171204f);
path.quadTo(1247.00000f, 878.343140f, 1247.00000f, 880.000000f);
path.lineTo(1247.00000f, 907.000000f);
path.lineTo(1246.00000f, 907.000000f);
path.lineTo(1246.00000f, 880.000000f);
path.cubicTo(1246.00000f, 878.343140f, 1244.65686f, 877.000000f, 1243.00000f, 877.000000f);
path.lineTo(1129.00000f, 877.000000f);
path.cubicTo(1127.34314f, 877.000000f, 1126.00000f, 878.343140f, 1126.00000f, 880.000000f);
path.lineTo(1126.00000f, 907.000000f);
path.lineTo(1125.00000f, 907.000000f);
path.lineTo(1125.00000f, 880.000000f);
path.quadTo(1125.00000f, 878.343140f, 1126.17114f, 877.171204f);
path.close();
SkPath pathB;
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(1247.00000f, 876.000000f);
pathB.lineTo(1231.00000f, 892.000000f);
pathB.lineTo(1246.00000f, 907.000000f);
pathB.lineTo(1247.00000f, 907.000000f);
pathB.lineTo(1247.00000f, 876.000000f);
pathB.close();
testPathOp(reporter, path, pathB, kIntersect_PathOp);
}
static void skpClip2(skiatest::Reporter* reporter) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
path.moveTo(134.000000f, 11414.0000f);
path.cubicTo(131.990234f, 11414.0000f, 130.326660f, 11415.4824f, 130.042755f, 11417.4131f);
path.cubicTo(130.233124f, 11418.3193f, 131.037079f, 11419.0000f, 132.000000f, 11419.0000f);
path.lineTo(806.000000f, 11419.0000f);
path.cubicTo(806.962891f, 11419.0000f, 807.766907f, 11418.3193f, 807.957275f, 11417.4131f);
path.cubicTo(807.673401f, 11415.4824f, 806.009766f, 11414.0000f, 804.000000f, 11414.0000f);
path.lineTo(134.000000f, 11414.0000f);
path.close();
SkPath pathB;
pathB.setFillType(SkPath::kInverseWinding_FillType);
pathB.moveTo(132.000000f, 11415.0000f);
pathB.lineTo(806.000000f, 11415.0000f);
pathB.cubicTo(807.104553f, 11415.0000f, 808.000000f, 11415.4473f, 808.000000f, 11416.0000f);
pathB.lineTo(808.000000f, 11417.0000f);
pathB.cubicTo(808.000000f, 11418.1045f, 807.104553f, 11419.0000f, 806.000000f, 11419.0000f);
pathB.lineTo(132.000000f, 11419.0000f);
pathB.cubicTo(130.895432f, 11419.0000f, 130.000000f, 11418.1045f, 130.000000f, 11417.0000f);
pathB.lineTo(130.000000f, 11416.0000f);
pathB.cubicTo(130.000000f, 11415.4473f, 130.895432f, 11415.0000f, 132.000000f, 11415.0000f);
pathB.close();
testPathOp(reporter, path, pathB, kIntersect_PathOp);
}
static void skp96prezzi1(skiatest::Reporter* reporter) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
path.moveTo(157.464005f, 670.463989f);
path.quadTo(158.928925f, 669.000000f, 161.000000f, 669.000000f);
path.lineTo(248.000000f, 669.000000f);
path.quadTo(250.071075f, 669.000000f, 251.535995f, 670.463989f);
path.quadTo(253.000000f, 671.928955f, 253.000000f, 674.000000f);
path.lineTo(253.000000f, 706.000000f);
path.lineTo(251.000000f, 706.000000f);
path.lineTo(251.000000f, 675.000000f);
path.cubicTo(251.000000f, 672.790833f, 249.209137f, 671.000000f, 247.000000f, 671.000000f);
path.lineTo(162.000000f, 671.000000f);
path.cubicTo(159.790863f, 671.000000f, 158.000000f, 672.790833f, 158.000000f, 675.000000f);
path.lineTo(158.000000f, 706.000000f);
path.lineTo(156.000000f, 706.000000f);
path.lineTo(156.000000f, 674.000000f);
path.quadTo(156.000000f, 671.928955f, 157.464005f, 670.463989f);
path.close();
SkPath pathB;
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(156.000000f, 669.000000f);
pathB.lineTo(178.500000f, 691.500000f);
pathB.lineTo(230.500000f, 691.500000f);
pathB.lineTo(253.000000f, 669.000000f);
pathB.lineTo(156.000000f, 669.000000f);
pathB.close();
testPathOp(reporter, path, pathB, kIntersect_PathOp);
}
static void skpancestry_com1(skiatest::Reporter* reporter) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
path.moveTo(161.000000f, 925.000000f);
path.cubicTo(159.874390f, 925.000000f, 158.835663f, 925.371948f, 158.000000f, 925.999634f);
path.lineTo(158.000000f, 926.000000f);
path.lineTo(1108.00000f, 926.000000f);
path.lineTo(1108.00000f, 925.999634f);
path.cubicTo(1107.16443f, 925.371948f, 1106.12561f, 925.000000f, 1105.00000f, 925.000000f);
path.lineTo(161.000000f, 925.000000f);
path.close();
SkPath pathB;
pathB.setFillType(SkPath::kEvenOdd_FillType);
pathB.moveTo(161.000000f, 926.000000f);
pathB.lineTo(1105.00000f, 926.000000f);
pathB.cubicTo(1107.20911f, 926.000000f, 1109.00000f, 927.790833f, 1109.00000f, 930.000000f);
pathB.lineTo(1109.00000f, 956.000000f);
pathB.cubicTo(1109.00000f, 958.209167f, 1107.20911f, 960.000000f, 1105.00000f, 960.000000f);
pathB.lineTo(161.000000f, 960.000000f);
pathB.cubicTo(158.790863f, 960.000000f, 157.000000f, 958.209167f, 157.000000f, 956.000000f);
pathB.lineTo(157.000000f, 930.000000f);
pathB.cubicTo(157.000000f, 927.790833f, 158.790863f, 926.000000f, 161.000000f, 926.000000f);
pathB.close();
testPathOp(reporter, path, pathB, kIntersect_PathOp);
}
static void skpeldorado_com_ua1(skiatest::Reporter* reporter) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
path.moveTo(286.695129f, 291.000000f);
path.lineTo(229.304855f, 561.000000f);
path.lineTo(979.304871f, 561.000000f);
path.lineTo(1036.69507f, 291.000000f);
path.lineTo(286.695129f, 291.000000f);
path.close();
SkPath pathB;
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(1006.69513f, 291.000000f);
pathB.cubicTo(1023.26367f, 291.000000f, 1033.84021f, 304.431458f, 1030.31836f, 321.000000f);
pathB.lineTo(985.681519f, 531.000000f);
pathB.cubicTo(982.159790f, 547.568542f, 965.873413f, 561.000000f, 949.304871f, 561.000000f);
pathB.lineTo(259.304871f, 561.000000f);
pathB.cubicTo(242.736313f, 561.000000f, 232.159805f, 547.568542f, 235.681549f, 531.000000f);
pathB.lineTo(280.318420f, 321.000000f);
pathB.cubicTo(283.840179f, 304.431458f, 300.126587f, 291.000000f, 316.695129f, 291.000000f);
pathB.lineTo(1006.69513f, 291.000000f);
pathB.close();
testPathOp(reporter, path, pathB, kIntersect_PathOp);
}
static void skpbyte_com1(skiatest::Reporter* reporter) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
path.moveTo(968.000000f, 14.0000000f);
path.cubicTo(965.238586f, 14.0000000f, 963.000000f, 16.2385769f, 963.000000f, 19.0000000f);
path.lineTo(963.000000f, 32.0000000f);
path.cubicTo(963.000000f, 34.7614250f, 965.238586f, 37.0000000f, 968.000000f, 37.0000000f);
path.lineTo(1034.00000f, 37.0000000f);
path.cubicTo(1036.76147f, 37.0000000f, 1039.00000f, 34.7614250f, 1039.00000f, 32.0000000f);
path.lineTo(1039.00000f, 19.0000000f);
path.cubicTo(1039.00000f, 16.2385769f, 1036.76147f, 14.0000000f, 1034.00000f, 14.0000000f);
path.lineTo(968.000000f, 14.0000000f);
path.close();
SkPath pathB;
pathB.setFillType(SkPath::kInverseWinding_FillType);
pathB.moveTo(968.000000f, 14.0000000f);
pathB.lineTo(1034.00000f, 14.0000000f);
pathB.cubicTo(1036.76147f, 14.0000000f, 1039.00000f, 16.2385750f, 1039.00000f, 19.0000000f);
pathB.lineTo(1039.00000f, 32.0000000f);
pathB.cubicTo(1039.00000f, 34.2091408f, 1036.76147f, 36.0000000f, 1034.00000f, 36.0000000f);
pathB.lineTo(968.000000f, 36.0000000f);
pathB.cubicTo(965.238586f, 36.0000000f, 963.000000f, 34.2091408f, 963.000000f, 32.0000000f);
pathB.lineTo(963.000000f, 19.0000000f);
pathB.cubicTo(963.000000f, 16.2385750f, 965.238586f, 14.0000000f, 968.000000f, 14.0000000f);
pathB.close();
testPathOp(reporter, path, pathB, kIntersect_PathOp);
}
static void skphealth_com76(skiatest::Reporter* reporter) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
path.moveTo(708.099182f, 7.09919119f);
path.lineTo(708.099182f, 7.09920025f);
path.quadTo(704.000000f, 11.2010098f, 704.000000f, 17.0000000f);
path.lineTo(704.000000f, 33.0000000f);
path.lineTo(705.000000f, 33.0000000f);
path.lineTo(705.000000f, 17.0000000f);
path.cubicTo(705.000000f, 13.4101496f, 706.455078f, 10.1601505f, 708.807617f, 7.80761385f);
path.lineTo(708.099182f, 7.09919119f);
path.close();
SkPath pathB;
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(704.000000f, 3.00000000f);
#if 0
pathB.lineTo(719.500000f, 3.00000000f);
pathB.lineTo(705.000000f, 33.0000000f);
pathB.lineTo(704.000000f, 33.0000000f);
testPathOp(reporter, path, pathB, kIntersect_PathOp);
#else
pathB.lineTo(704.000000f, 33.0000000f);
pathB.lineTo(705.000000f, 33.0000000f);
pathB.lineTo(719.500000f, 3.00000000f);
testPathOp(reporter, path, pathB, kIntersect_PathOp);
#endif
}
static void skpahrefs_com88(skiatest::Reporter* reporter) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
path.moveTo(1099.82886f, 7.17117119f);
path.lineTo(1099.12134f, 7.87867832f);
path.cubicTo(1099.66418f, 8.42157173f, 1100.00000f, 9.17157173f, 1100.00000f, 10.0000000f);
path.lineTo(1100.00000f, 28.0000000f);
path.cubicTo(1100.00000f, 29.6568546f, 1098.65686f, 31.0000000f, 1097.00000f, 31.0000000f);
path.lineTo(1088.00000f, 31.0000000f);
path.lineTo(1088.00000f, 32.0000000f);
path.lineTo(1097.00000f, 32.0000000f);
path.quadTo(1098.65686f, 32.0000000f, 1099.82886f, 30.8288002f);
path.quadTo(1101.00000f, 29.6568546f, 1101.00000f, 28.0000000f);
path.lineTo(1101.00000f, 10.0000000f);
path.quadTo(1101.00000f, 8.34314537f, 1099.82886f, 7.17119980f);
path.lineTo(1099.82886f, 7.17117119f);
path.close();
SkPath pathB;
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(1101.00000f, 6.00000000f);
pathB.lineTo(1088.00000f, 6.00000000f);
pathB.lineTo(1088.00000f, 19.0000000f);
pathB.lineTo(1101.00000f, 32.0000000f);
testPathOp(reporter, path, pathB, kIntersect_PathOp);
}
static void skpahrefs_com29(skiatest::Reporter* reporter) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
path.moveTo(1037.17114f, 7.17119980f);
path.quadTo(1038.34314f, 6.00000000f, 1040.00000f, 6.00000000f);
path.lineTo(1074.00000f, 6.00000000f);
path.lineTo(1074.00000f, 32.0000000f);
path.lineTo(1040.00000f, 32.0000000f);
path.quadTo(1038.34314f, 32.0000000f, 1037.17114f, 30.8288002f);
path.quadTo(1036.00000f, 29.6568546f, 1036.00000f, 28.0000000f);
path.lineTo(1036.00000f, 10.0000000f);
path.quadTo(1036.00000f, 8.34314537f, 1037.17114f, 7.17119980f);
path.close();
path.moveTo(1037.00000f, 10.0000000f);
path.cubicTo(1037.00000f, 8.34314537f, 1038.34314f, 7.00000000f, 1040.00000f, 7.00000000f);
path.lineTo(1073.00000f, 7.00000000f);
path.lineTo(1073.00000f, 31.0000000f);
path.lineTo(1040.00000f, 31.0000000f);
path.cubicTo(1038.34314f, 31.0000000f, 1037.00000f, 29.6568546f, 1037.00000f, 28.0000000f);
path.lineTo(1037.00000f, 10.0000000f);
path.close();
SkPath pathB;
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(1036.00000f, 32.0000000f);
pathB.lineTo(1049.00000f, 19.0000000f);
pathB.lineTo(1073.00000f, 31.0000000f);
pathB.lineTo(1074.00000f, 32.0000000f);
testPathOp(reporter, path, pathB, kIntersect_PathOp);
}
static void cubicOp85d(skiatest::Reporter* reporter) {
SkPath path;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(0,1);
path.cubicTo(1,6, 1,0, 6,2);
path.close();
SkPath pathB;
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(0,1);
pathB.cubicTo(2,6, 1,0, 6,1);
pathB.close();
testPathOp(reporter, path, pathB, kDifference_PathOp);
}
// this fails because the pair of nearly coincident cubics intersect at the ends
// but the line connected to one of the cubics at the same point does not intersect
// the other
static void skpkkiste_to98(skiatest::Reporter* reporter) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
path.moveTo(96, 122);
path.cubicTo(94.6192932f, 122, 93.3692932f, 122.559647f, 92.4644699f, 123.46447f);
path.lineTo(94.1715698f, 125.17157f);
path.cubicTo(94.8954315f, 124.447708f, 95.8954315f, 124, 97, 124);
path.lineTo(257, 124);
path.cubicTo(258.104553f, 124, 259.104584f, 124.447708f, 259.82843f, 125.17157f);
path.lineTo(261.535522f, 123.46447f);
path.cubicTo(260.630707f, 122.559647f, 259.380707f, 122, 258, 122);
path.lineTo(96, 122);
path.close();
SkPath pathB;
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(258, 122);
pathB.cubicTo(260.761414f, 122, 263, 124.238579f, 263, 127);
pathB.lineTo(263, 284);
pathB.cubicTo(263, 286.761414f, 260.761414f, 289, 258, 289);
pathB.lineTo(96, 289);
pathB.cubicTo(93.2385788f, 289, 91, 286.761414f, 91, 284);
pathB.lineTo(91, 127);
pathB.cubicTo(91, 124.238579f, 93.2385788f, 122, 96, 122);
pathB.lineTo(258, 122);
pathB.close();
testPathOp(reporter, path, pathB, kIntersect_PathOp);
}
#if 01
static void issue1417(skiatest::Reporter* reporter) {
SkPath path1;
path1.moveTo(122.58908843994140625f, 82.2836456298828125f);
path1.quadTo(129.8215789794921875f, 80, 138, 80);
path1.quadTo(147.15692138671875f, 80, 155.1280364990234375f, 82.86279296875f);
path1.lineTo(161.1764678955078125f, 100);
path1.lineTo(161.1764678955078125f, 100);
path1.lineTo(115.29412078857421875f, 100);
path1.lineTo(115.29412078857421875f, 100);
path1.lineTo(122.58908843994140625f, 82.2836456298828125f);
path1.lineTo(122.58908843994140625f, 82.2836456298828125f);
path1.close();
path1.moveTo(98.68194580078125f, 140.343841552734375f);
path1.lineTo(115.29412078857421875f, 100);
path1.lineTo(115.29412078857421875f, 100);
path1.lineTo(97.9337615966796875f, 100);
path1.lineTo(97.9337615966796875f, 100);
path1.quadTo(88, 112.94264984130859375f, 88, 130);
path1.quadTo(88, 131.544830322265625f, 88.08148956298828125f, 133.0560302734375f);
path1.lineTo(98.68194580078125f, 140.343841552734375f);
path1.lineTo(98.68194580078125f, 140.343841552734375f);
path1.close();
path1.moveTo(136.969696044921875f, 166.6666717529296875f);
path1.lineTo(98.68194580078125f, 140.343841552734375f);
path1.lineTo(98.68194580078125f, 140.343841552734375f);
path1.lineTo(93.45894622802734375f, 153.02825927734375f);
path1.lineTo(93.45894622802734375f, 153.02825927734375f);
path1.quadTo(96.94116973876953125f, 159.65185546875f, 102.64466094970703125f, 165.3553466796875f);
path1.quadTo(110.7924652099609375f, 173.503143310546875f, 120.8179779052734375f, 177.1177825927734375f);
path1.lineTo(136.969696044921875f, 166.6666717529296875f);
path1.lineTo(136.969696044921875f, 166.6666717529296875f);
path1.close();
path1.moveTo(175.8309783935546875f, 141.5211334228515625f);
path1.lineTo(136.969696044921875f, 166.6666717529296875f);
path1.lineTo(136.969696044921875f, 166.6666717529296875f);
path1.lineTo(153.15728759765625f, 177.7956390380859375f);
path1.lineTo(153.15728759765625f, 177.7956390380859375f);
path1.quadTo(164.392425537109375f, 174.318267822265625f, 173.3553466796875f, 165.3553466796875f);
path1.quadTo(177.805816650390625f, 160.9048614501953125f, 180.90380859375f, 155.8941650390625f);
path1.lineTo(175.8309783935546875f, 141.5211334228515625f);
path1.lineTo(175.8309783935546875f, 141.5211334228515625f);
path1.close();
path1.moveTo(175.8309783935546875f, 141.5211334228515625f);
path1.lineTo(187.8782806396484375f, 133.7258148193359375f);
path1.lineTo(187.8782806396484375f, 133.7258148193359375f);
path1.quadTo(188, 131.8880615234375f, 188, 130);
path1.quadTo(188, 112.942657470703125f, 178.0662384033203125f, 100);
path1.lineTo(161.1764678955078125f, 100);
path1.lineTo(161.1764678955078125f, 100);
path1.lineTo(175.8309783935546875f, 141.5211334228515625f);
path1.lineTo(175.8309783935546875f, 141.5211334228515625f);
path1.close();
SkPath path2;
path2.moveTo(174.117645263671875f, 100);
path2.lineTo(161.1764678955078125f, 100);
path2.lineTo(161.1764678955078125f, 100);
path2.lineTo(155.1280364990234375f, 82.86279296875f);
path2.lineTo(155.1280364990234375f, 82.86279296875f);
path2.quadTo(153.14971923828125f, 82.15229034423828125f, 151.098419189453125f, 81.618133544921875f);
path2.lineTo(143.5294189453125f, 100);
path2.lineTo(143.5294189453125f, 100);
path2.lineTo(161.1764678955078125f, 100);
path2.lineTo(161.1764678955078125f, 100);
path2.lineTo(168.23529052734375f, 120);
path2.lineTo(168.23529052734375f, 120);
path2.lineTo(181.1764678955078125f, 120);
path2.lineTo(181.1764678955078125f, 120);
path2.lineTo(186.3661956787109375f, 134.7042236328125f);
path2.lineTo(186.3661956787109375f, 134.7042236328125f);
path2.lineTo(187.8782806396484375f, 133.7258148193359375f);
path2.lineTo(187.8782806396484375f, 133.7258148193359375f);
path2.quadTo(188, 131.8880615234375f, 188, 130);
path2.quadTo(188, 124.80947113037109375f, 187.080169677734375f, 120);
path2.lineTo(181.1764678955078125f, 120);
path2.lineTo(181.1764678955078125f, 120);
path2.lineTo(174.117645263671875f, 100);
path2.lineTo(174.117645263671875f, 100);
path2.close();
path2.moveTo(88.91983795166015625f, 120);
path2.lineTo(107.0588226318359375f, 120);
path2.lineTo(107.0588226318359375f, 120);
path2.lineTo(98.68194580078125f, 140.343841552734375f);
path2.lineTo(98.68194580078125f, 140.343841552734375f);
path2.lineTo(88.08148956298828125f, 133.0560302734375f);
path2.lineTo(88.08148956298828125f, 133.0560302734375f);
path2.quadTo(88, 131.544830322265625f, 88, 130);
path2.quadTo(88, 124.80951690673828125f, 88.91983795166015625f, 120);
path2.close();
path2.moveTo(96.67621612548828125f, 145.21490478515625f);
path2.lineTo(98.68194580078125f, 140.343841552734375f);
path2.lineTo(98.68194580078125f, 140.343841552734375f);
path2.lineTo(120.68767547607421875f, 155.4727783203125f);
path2.lineTo(120.68767547607421875f, 155.4727783203125f);
path2.lineTo(118.68194580078125f, 160.343841552734375f);
path2.lineTo(118.68194580078125f, 160.343841552734375f);
path2.lineTo(96.67621612548828125f, 145.21490478515625f);
path2.lineTo(96.67621612548828125f, 145.21490478515625f);
path2.close();
path2.moveTo(113.232177734375f, 173.5789947509765625f);
path2.quadTo(116.8802642822265625f, 175.69805908203125f, 120.8179779052734375f, 177.1177825927734375f);
path2.lineTo(132.2864990234375f, 169.6969757080078125f);
path2.lineTo(132.2864990234375f, 169.6969757080078125f);
path2.lineTo(118.68194580078125f, 160.343841552734375f);
path2.lineTo(118.68194580078125f, 160.343841552734375f);
path2.lineTo(113.232177734375f, 173.5789947509765625f);
path2.lineTo(113.232177734375f, 173.5789947509765625f);
path2.close();
testPathOp(reporter, path1, path2, kUnion_PathOp);
}
#endif
static void issue1418(skiatest::Reporter* reporter) {
SkPath path1;
path1.moveTo(0, 0);
path1.lineTo(1, 0);
path1.lineTo(1, 0);
path1.lineTo(1, 1);
path1.lineTo(1, 1);
path1.lineTo(0, 1);
path1.lineTo(0, 1);
path1.lineTo(0, 0);
path1.lineTo(0, 0);
path1.close();
SkPath path2;
path2.moveTo(0.64644664525985717773f, -0.35355341434478759766f);
path2.quadTo(0.79289329051971435547f, -0.50000005960464477539f, 1.0000001192092895508f, -0.50000005960464477539f);
path2.quadTo(1.2071068286895751953f, -0.50000005960464477539f, 1.3535535335540771484f, -0.35355341434478759766f);
path2.quadTo(1.5000001192092895508f, -0.20710679888725280762f, 1.5000001192092895508f, 0);
path2.quadTo(1.5000001192092895508f, 0.20710679888725280762f, 1.3535535335540771484f, 0.35355341434478759766f);
path2.quadTo(1.2071068286895751953f, 0.50000005960464477539f, 1.0000001192092895508f, 0.50000005960464477539f);
path2.quadTo(0.79289329051971435547f, 0.50000005960464477539f, 0.64644664525985717773f, 0.35355341434478759766f);
path2.quadTo(0.50000005960464477539f, 0.20710679888725280762f, 0.50000005960464477539f, 0);
path2.quadTo(0.50000005960464477539f, -0.20710679888725280762f, 0.64644664525985717773f, -0.35355341434478759766f);
testPathOp(reporter, path1, path2, kIntersect_PathOp);
}
static void cubicOp85i(skiatest::Reporter* reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
path.moveTo(3, 4);
path.cubicTo(1, 5, 4, 3, 6, 4);
path.close();
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(3, 4);
pathB.cubicTo(4, 6, 4, 3, 5, 1);
pathB.close();
testPathOp(reporter, path, pathB, kIntersect_PathOp);
}
#if 0
static void skpkkiste_to716(skiatest::Reporter* reporter) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
path.moveTo(1173, 284);
path.cubicTo(1173, 285.125824f, 1173.37207f, 286.164734f, 1174, 287.000488f);
path.lineTo(1174, 123.999496f);
path.cubicTo(1173.37207f, 124.835243f, 1173, 125.874168f, 1173, 127);
path.lineTo(1173, 284);
path.close();
SkPath pathB;
pathB.setFillType(SkPath::kWinding_FillType);
pathB.moveTo(1340, 122);
pathB.cubicTo(1342.76147f, 122, 1345, 124.238579f, 1345, 127);
pathB.lineTo(1345, 284);
pathB.cubicTo(1345, 286.761414f, 1342.76147f, 289, 1340, 289);
pathB.lineTo(1178, 289);
pathB.cubicTo(1175.23853f, 289, 1173, 286.761414f, 1173, 284);
pathB.lineTo(1173, 127);
pathB.cubicTo(1173, 124.238579f, 1175.23853f, 122, 1178, 122);
pathB.lineTo(1340, 122);
pathB.close();
testPathOp(reporter, path, pathB, kIntersect_PathOp);
}
#endif
static void (*firstTest)(skiatest::Reporter* ) = 0;
static struct TestDesc tests[] = {
// TEST(skpkkiste_to716),
TEST(cubicOp85i),
TEST(issue1417),
TEST(issue1418),
TEST(skpkkiste_to98),
TEST(skpahrefs_com29),
TEST(cubicOp85d),
TEST(skpahrefs_com88),
TEST(skphealth_com76),
TEST(skpancestry_com1),
TEST(skpbyte_com1),
TEST(skpeldorado_com_ua1),
TEST(skp96prezzi1),
TEST(skpClip2),
TEST(skpClip1),
TEST(cubicOp84d),
TEST(cubicOp83i),
TEST(cubicOp82i),
TEST(cubicOp81d),
TEST(cubicOp80i),
TEST(cubicOp79u),
TEST(cubicOp78u),
TEST(cubicOp77i),
TEST(cubicOp76u),
TEST(cubicOp75d),
TEST(cubicOp74d),
TEST(cubicOp73d),
TEST(cubicOp72i),
TEST(cubicOp71d),
TEST(skp5),
TEST(skp4),
TEST(skp3),
TEST(skp2),
TEST(skp1),
TEST(rRect1),
TEST(cubicOp70d),
TEST(cubicOp69d),
TEST(cubicOp68u),
TEST(cubicOp67u),
TEST(cubicOp66u),
TEST(rectOp1d),
TEST(cubicOp65d),
TEST(cubicOp64d),
TEST(cubicOp63d),
TEST(cubicOp62d),
TEST(cubicOp61d),
TEST(cubicOp60d),
TEST(cubicOp59d),
TEST(cubicOp58d),
TEST(cubicOp57d),
TEST(cubicOp56d),
TEST(cubicOp55d),
TEST(cubicOp54d),
TEST(cubicOp53d),
TEST(cubicOp52d),
TEST(cubicOp51d),
TEST(cubicOp50d),
TEST(cubicOp49d),
TEST(cubicOp48d),
TEST(cubicOp47d),
TEST(cubicOp46d),
TEST(cubicOp45d),
TEST(cubicOp44d),
TEST(cubicOp43d),
TEST(cubicOp42d),
TEST(cubicOp41i),
TEST(cubicOp40d),
TEST(cubicOp39d),
TEST(cubicOp38d),
TEST(cubicOp37d),
TEST(cubicOp36u),
TEST(cubicOp35d),
TEST(cubicOp34d),
TEST(cubicOp33i),
TEST(cubicOp32d),
TEST(cubicOp31d),
TEST(cubicOp31x),
TEST(cubicOp31u),
TEST(cubicOp30d),
TEST(cubicOp29d),
TEST(cubicOp28u),
TEST(cubicOp27d),
TEST(cubicOp26d),
TEST(cubicOp25i),
TEST(testOp8d),
TEST(testDiff1),
TEST(testIntersect1),
TEST(testUnion1),
TEST(testXor1),
TEST(testDiff2),
TEST(testIntersect2),
TEST(testUnion2),
TEST(testXor2),
TEST(testOp1d),
TEST(testOp2d),
TEST(testOp3d),
TEST(testOp1u),
TEST(testOp4d),
TEST(testOp5d),
TEST(testOp6d),
TEST(testOp7d),
TEST(testOp2u),
TEST(cubicOp24d),
TEST(cubicOp23d),
TEST(cubicOp22d),
TEST(cubicOp21d),
TEST(cubicOp20d),
TEST(cubicOp19i),
TEST(cubicOp18d),
TEST(cubicOp17d),
TEST(cubicOp16d),
TEST(cubicOp15d),
TEST(cubicOp14d),
TEST(cubicOp13d),
TEST(cubicOp12d),
TEST(cubicOp11d),
TEST(cubicOp10d),
TEST(cubicOp1i),
TEST(cubicOp9d),
TEST(quadOp9d),
TEST(lineOp9d),
TEST(cubicOp8d),
TEST(cubicOp7d),
TEST(cubicOp6d),
TEST(cubicOp5d),
TEST(cubicOp3d),
TEST(cubicOp2d),
TEST(cubicOp1d),
};
static const size_t testCount = SK_ARRAY_COUNT(tests);
static struct TestDesc subTests[] = {
TEST(cubicOp6d),
TEST(cubicOp8d),
TEST(cubicOp70d),
TEST(cubicOp16d),
TEST(skp5),
};
static const size_t subTestCount = SK_ARRAY_COUNT(subTests);
static void (*firstSubTest)(skiatest::Reporter* ) = 0;
static bool runSubTestsFirst = false;
static bool runReverse = false;
static void (*stopTest)(skiatest::Reporter* ) = 0;
static void PathOpsOpTest(skiatest::Reporter* reporter) {
#ifdef SK_DEBUG
gDebugMaxWindSum = 4;
gDebugMaxWindValue = 4;
#endif
#if DEBUG_SHOW_TEST_NAME
strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
#endif
if (runSubTestsFirst) {
RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, runReverse);
}
RunTestSet(reporter, tests, testCount, firstTest, stopTest, runReverse);
if (!runSubTestsFirst) {
RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, runReverse);
}
#ifdef SK_DEBUG
gDebugMaxWindSum = SK_MaxS32;
gDebugMaxWindValue = SK_MaxS32;
#endif
}
#include "TestClassDef.h"
DEFINE_TESTCLASS_SHORT(PathOpsOpTest)
| 34.319032 | 119 | 0.689014 | omapzoom |
e0a9be48a2c317e296d85914fe77faa0f2a48d69 | 7,639 | cpp | C++ | cdl/InputLogger.cpp | RetroReversing/libRetroReversing | b0a029b76c92e38340550a5a21e2a0d2f6cb10db | [
"MIT"
] | 8 | 2020-01-20T18:56:14.000Z | 2022-01-16T02:00:49.000Z | cdl/InputLogger.cpp | RetroReversing/libRetroReversing | b0a029b76c92e38340550a5a21e2a0d2f6cb10db | [
"MIT"
] | 9 | 2020-05-18T12:02:20.000Z | 2022-02-13T05:41:37.000Z | cdl/InputLogger.cpp | RetroReversing/libRetroReversing | b0a029b76c92e38340550a5a21e2a0d2f6cb10db | [
"MIT"
] | 4 | 2020-03-19T22:36:40.000Z | 2021-07-05T02:53:09.000Z | #include "CDL.hpp"
#include <queue>
#include "../include/libRR.h"
struct retro_input_descriptor desc[64];
int total_input_buttons=0;
std::queue<unsigned long long> button_history;
std::queue<unsigned long long> playback_button_history;
// Should append is for when you were playing back a history and it reached the end and then you added more input
bool libRR_should_append_history = false;
void libRR_setInputDescriptor(struct retro_input_descriptor* descriptor, int total) {
// printf("libRR_setInputDescriptor \n");
total_input_buttons = total;
for (int i=0; i<total_input_buttons; i++) {
// Copy libretro input descriptors to our own state
desc[i] = { descriptor[i].port, descriptor[i].device, descriptor[i].index, descriptor[i].id, descriptor[i].description };
}
}
bool libRR_alreadyWarnedAboutEndOfLog = false;
//
// playback_fake_input_state_cb - plays back input
//
int lastPlayedBackFrame = 0;
bool savePowerMode = true;
int16_t playback_fake_input_state_cb(unsigned port, unsigned device,
unsigned index, unsigned id) {
// printf("playback_fake_input_state_cb\n");
if(port > 0) {
// printf("We only support Port 0 (player 1)\n");
return 0;
}
if (playback_button_history.empty()) {
if (!libRR_alreadyWarnedAboutEndOfLog) {
printf("WARNING: button history was empty: probably at the end\n");
libRR_alreadyWarnedAboutEndOfLog = true;
libRR_display_message("Ready to take new button input");
}
libRR_should_append_history = true;
libRR_should_playback_input = false;
return 0;
}
// This can be called multiple times per frame, so we need to only pop it when the frame has changed
int16_t button_state = playback_button_history.front();
if (RRCurrentFrame > lastPlayedBackFrame) {
playback_button_history.pop();
if (button_state>0) {
if (!savePowerMode) {
libRR_display_message("Playback Pressed: %d",button_state);
}
}
lastPlayedBackFrame = RRCurrentFrame;
}
if (id == RETRO_DEVICE_ID_JOYPAD_MASK) {
return button_state;
}
return button_state & 1 << id;
}
retro_input_state_t libRR_playback() {
return playback_fake_input_state_cb;
}
//
// libRR_playback_next_input_state - only use when you can't use playback_fake_input_state_cb due to no bitmask support
//
unsigned long long libRR_playback_next_input_state() {
if (playback_button_history.empty()) {
printf("WARNING: button history was empty: probably at the end\n");
libRR_should_append_history = true;
return 0;
}
unsigned long long button_state = playback_button_history.front();
playback_button_history.pop();
std::cout << "\nPlayed back:" << button_state;
return button_state;
}
//
// # libRR_log_input_state_bitmask - this is the prefered solution to use in a core if possible
//
void libRR_log_input_state_bitmask(retro_input_state_t input_cb) {
int16_t ret = input_cb( 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_MASK );
button_history.push(ret);
// printf("Logging input state frame:%d result:%d \n", RRCurrentFrame, ret);
}
retro_input_state_t libRR_handle_input(retro_input_state_t input_cb) {
if (libRR_should_playback_input) {
return libRR_playback();
}
libRR_log_input_state_bitmask(input_cb);
return input_cb;
}
//
// # log_input_state - only use this if you can't use libRR_log_input_state_bitmask
//
void log_input_state(retro_input_state_t input_cb) {
unsigned long long frameInputBitField = 0;
for (int i=0; i<total_input_buttons; i++) {
// printf("Logging button number: %d %d \n", i, desc[i].id);
if (input_cb(desc[i].port, desc[i].device, desc[i].index, desc[i].id) != 0) {
frameInputBitField |= 1ULL << desc[i].id;
}
}
button_history.push(frameInputBitField);
// printf("Logging input state frame:%d result:%d \n", RRCurrentFrame, frameInputBitField);
}
// max_number is used if you want to only save up to a particular frame number
void libRR_resave_button_state_to_file(string filename, int max_number, json changes) {
std::fstream output_file;
// read the state before we open it as an output file
printf("libRR_resave_button_state_to_file max_number: %d\n", max_number);
libRR_read_button_state_from_file(filename, 0);
output_file = std::fstream(filename, std::ios::out | std::ios::binary);
int frame_number = 0;
while (!playback_button_history.empty()) {
unsigned long long button_state = playback_button_history.front();
// check for changes via the UI
if (changes.contains(to_string(frame_number))) {
unsigned long long newValue = changes[to_string(frame_number)];
printf("We have a change for frame number: %d value: %d \n", frame_number, newValue);
output_file.write(reinterpret_cast<char*>(&newValue),sizeof(unsigned long long));
}
else {
output_file.write(reinterpret_cast<char*>(&button_state),sizeof(unsigned long long));
}
playback_button_history.pop();
if (frame_number == max_number) {
printf("Resaving button log, found Max value %d \n", frame_number);
break;
}
frame_number++;
}
output_file.close();
libRR_read_button_state_from_file(filename, RRCurrentFrame);
printf("End of libRR_resave_button_state_to_file\n");
}
extern string current_playthrough_directory;
string libRR_change_input_buttons(json changes) {
libRR_resave_button_state_to_file(current_playthrough_directory+"button_log.bin", -1, changes);
return "Success";
}
//
// # libRR_save_button_state_to_file - save all the keys pressed to a file
//
void libRR_save_button_state_to_file(string filename) {
std::fstream output_file;
// read the state before we open it as an output file
printf("libRR_save_button_state_to_file\n");
// first read the whole file right from the start (frame 0)
libRR_read_button_state_from_file(filename, 0);
output_file = std::fstream(filename, std::ios::out | std::ios::binary);
if (libRR_should_append_history) {
// Use was playing back a history and now added additional logging
printf("\n\n\nAppending history to previous\n\n\n");
while (!playback_button_history.empty()) {
unsigned long long button_state = playback_button_history.front();
output_file.write(reinterpret_cast<char*>(&button_state),sizeof(unsigned long long));
playback_button_history.pop();
}
}
while (!button_history.empty()) {
// std::cout << ' ' << button_history.front();
unsigned long long button_state = button_history.front();
output_file.write(reinterpret_cast<char*>(&button_state),sizeof(unsigned long long));
button_history.pop();
}
output_file.close();
}
//
// # libRR_read_button_state_from_file - loads the buffer of input key presses to be run each frame
//
void libRR_read_button_state_from_file(string filename, int start_frame) {
printf("libRR_read_button_state_from_file start frame: %d\n", start_frame);
std::ifstream myfile(filename, std::ios_base::in | std::ios::binary);
unsigned long long frameInputBitField = 255;
lastPlayedBackFrame = 0;
int loading_frame = 0;
playback_button_history = {};
while (myfile.read(reinterpret_cast<char*>(&frameInputBitField), sizeof(unsigned long long)))
{
if (loading_frame >= start_frame) {
// std::cout << ' ' << frameInputBitField;
playback_button_history.push(frameInputBitField);
}
loading_frame++;
}
printf("Finished Reading input state frame:%d size:%d \n", start_frame, playback_button_history.size());
} | 36.550239 | 127 | 0.716586 | RetroReversing |
e0a9d2102a913327888cdfaa8be0df079a3fedd5 | 2,886 | cpp | C++ | src/business/plate_recognition_worker.cpp | lvnux/midden | 261e2661690e9212ccb90dc64a02fde40f6ce1a7 | [
"MIT"
] | 1 | 2021-06-13T14:13:31.000Z | 2021-06-13T14:13:31.000Z | src/business/plate_recognition_worker.cpp | lvnux/midden | 261e2661690e9212ccb90dc64a02fde40f6ce1a7 | [
"MIT"
] | null | null | null | src/business/plate_recognition_worker.cpp | lvnux/midden | 261e2661690e9212ccb90dc64a02fde40f6ce1a7 | [
"MIT"
] | null | null | null | #include "plate_recognition_worker.h"
#include "thread_macro.h"
#include "user_thread_macro.h"
#include "log.h"
#include "car_http_thread.h"
#include "general.h"
#include "car_algo/pd_api.h"
PlateRecognitionWorker* PlateRecognitionWorker::inst_ = new PlateRecognitionWorker();
PlateRecognitionWorker::PlateRecognitionWorker()
{
}
PlateRecognitionWorker::~PlateRecognitionWorker()
{
}
PlateRecognitionWorker* PlateRecognitionWorker::get_instance()
{
return inst_;
}
bool PlateRecognitionWorker::init(int gpu_index)
{
log_info("PD_Init on gpu [%d]", gpu_index);
int ret = PD_Init(gpu_index);
if (0 != ret)
{
log_error("PD_Init failed, ret [%d]", ret);
return false;
}
return true;
}
void PlateRecognitionWorker::put_data(BaseMsg* msg)
{
que_.put_data(msg);
}
void PlateRecognitionWorker::run()
{
BaseMsg* msg = NULL;
while (true)
{
msg = que_.get_data();
if (NULL == msg)
{
usleep(1000 * 10);
}
else
{
dispose(msg);
delete msg;
}
}
}
void PlateRecognitionWorker::dispose(BaseMsg* msg)
{
if (NULL == msg)
{
return;
}
switch (msg->msg_type)
{
case MSG_TYPE_PLATE_RECOGNITION_REQUEST:
{
recognize_plate(msg);
break;
}
case MSG_TYPE_HTTP_RESPONSE:
{
break;
}
case MSG_TYPE_TIMEOUT:
{
break;
}
default:
{
log_error("msg_type[%d] is invalied.", msg->msg_type);
break;
}
}
return;
}
void PlateRecognitionWorker::recognize_plate(BaseMsg* msg)
{
PlateRecognitionRequestMsg* request_msg = (PlateRecognitionRequestMsg*)msg;
log_debug("get pic heigth: [%d], width: [%d], name: [%s]",
request_msg->height, request_msg->width, request_msg->name.c_str());
std::string desc = "SUCCESS";
std::string plate_num;
int64 start_detect_time = get_cur_microsecond();
int ret = -1;
try
{
ret = PD_Detect(request_msg->height, request_msg->width, request_msg->img_data, plate_num, request_msg->name);
if (0 != ret)
{
log_error("PD_Detect failed, ret [%d]", ret);
plate_num = "";
desc = "PD_Detect failed";
}
}
catch(...)
{
log_error("PD_Detect cause exception");
plate_num = "";
desc = "PD_Detect failed";
}
log_info("PD_Detect cost [%d]ms, ret [%d], plate_num [%s]",
get_cur_microsecond() - start_detect_time, ret, plate_num.c_str());
PlateRecognitionResponseMsg* response_msg = new PlateRecognitionResponseMsg();
response_msg->msg_type = MSG_TYPE_PLATE_RECOGNITION_RESPONSE;
response_msg->msg_sn = request_msg->msg_sn;
response_msg->receive_time = request_msg->receive_time;
response_msg->code = ret;
response_msg->desc = desc;
response_msg->plate_num = plate_num;
CarHttpThread::get_instance()->put_data(response_msg);
}
| 20.614286 | 112 | 0.646916 | lvnux |
e0aaac1f8352e2bc5057754bb2354cf49b9d6651 | 2,964 | cpp | C++ | docs/rgba_example.cpp | Clemapfel/jluna | 5768f4b8520f28e219788d28c8e84418257c5994 | [
"MIT"
] | 102 | 2022-02-06T02:54:32.000Z | 2022-03-30T12:56:07.000Z | docs/rgba_example.cpp | Clemapfel/jluna | 5768f4b8520f28e219788d28c8e84418257c5994 | [
"MIT"
] | 9 | 2022-02-04T21:21:39.000Z | 2022-03-18T20:44:08.000Z | docs/rgba_example.cpp | Clemapfel/jluna | 5768f4b8520f28e219788d28c8e84418257c5994 | [
"MIT"
] | 6 | 2022-03-07T07:15:36.000Z | 2022-03-14T14:56:29.000Z | //
// Copyright 2022 Clemens Cords
// Created on 19.04.22 by clem (mail@clemens-cords.com)
//
// this file summarizes all code from the usertype section of the manual
// see: https://github.com/Clemapfel/jluna/blob/master/docs/manual.md#usertypes
//
#include <jluna.hpp>
using namespace jluna;
// define RGBA
struct RGBA
{
float _red; // field _red
float _green; // field _green
float _blue; // field _blue
float _alpha; // field _alpha
// ctor
RGBA(float r, float g, float b)
: _red(r), _green(g), _blue(b), _alpha(1)
{}
// default ctor (required by jluna::Usertype)
RGBA()
: _red(0), _green(0), _blue(0), _alpha(1)
{}
};
// enable as usertype at compile time
set_usertype_enabled(RGBA);
int main()
{
jluna::initialize();
// add fields
// field _red
Usertype<RGBA>::add_property<float>(
"_red", // name
[](RGBA& in) -> float {return in._red;}, // boxing behavior
[](RGBA& out, float in) -> void {out._red = in;} // unboxing behvaior
);
// field _green
Usertype<RGBA>::add_property<float>(
"_green",
[](RGBA& in) -> float {return in._green;},
[](RGBA& out, float in) -> void {out._green = in;}
);
// field _blue
Usertype<RGBA>::add_property<float>(
"_blue",
[](RGBA& in) -> float {return in._blue;},
[](RGBA& out, float in) -> void {out._blue = in;}
);
// field _alpha
Usertype<RGBA>::add_property<float>(
"_alpha",
[](RGBA& in) -> float {return in._alpha;},
[](RGBA& out, float in) -> void {out._alpha = in;}
);
// julia-only field _value
Usertype<RGBA>::add_property<float>(
"_value", // name
// boxing routine: compute value from red, green and blue
[](RGBA& in) -> float {
float max = 0;
for (auto v : {in._red, in._green, in._blue})
max = std::max(v, max);
return max;
}
);
// implement
Usertype<RGBA>::implement();
// add additional ctor
Main.safe_eval(R"(
function RGBA(r, g, b, a) ::RGBA
out = RGBA()
out._red = r
out._green = g
out._blue = b
out._alpha = a
out._value = max(r, g, b, a)
return out
end
)");
// usage
Main.create_or_assign("jl_rgba", RGBA(0.75, 0.5, 0.1));
Main.safe_eval("println(jl_rgba)");
RGBA cpp_rgba = Main.safe_eval("return RGBA(0.5, 0.5, 0.3, 1.0)");
std::cout << "unboxed: "
std::cout << cpp_rgba._red << " ";
std::cout << cpp_rgba._green << " ";
std::cout << cpp_rgba._blue << " ";
// output:
//
// [JULIA][LOG] initialization successful.
// RGBA(0.75f0, 0.5f0, 0.1f0, 1.0f0, 0.75f0)
// unboxed: 0.5 0.5 0.3
// Process finished with exit code 0
//
return 0;
}
| 24.907563 | 79 | 0.528677 | Clemapfel |
e0af86690b6ecc008c5a3c6612a44acb0e8b6d35 | 1,428 | hpp | C++ | include/ancient/src/IMPDecompressor.hpp | ford442/openmpt | 614c44fe665b0e1cce15092ecf0d069cbb3e1fe7 | [
"BSD-3-Clause"
] | 335 | 2017-02-25T16:39:27.000Z | 2022-03-29T17:45:42.000Z | include/ancient/src/IMPDecompressor.hpp | ford442/openmpt | 614c44fe665b0e1cce15092ecf0d069cbb3e1fe7 | [
"BSD-3-Clause"
] | 19 | 2020-06-20T17:20:11.000Z | 2022-02-07T17:40:18.000Z | include/ancient/src/IMPDecompressor.hpp | ford442/openmpt | 614c44fe665b0e1cce15092ecf0d069cbb3e1fe7 | [
"BSD-3-Clause"
] | 69 | 2017-04-10T00:48:09.000Z | 2022-03-20T10:24:45.000Z | /* Copyright (C) Teemu Suutari */
#ifndef IMPDECOMPRESSOR_HPP
#define IMPDECOMPRESSOR_HPP
#include "Decompressor.hpp"
#include "XPKDecompressor.hpp"
namespace ancient::internal
{
class IMPDecompressor : public Decompressor, public XPKDecompressor
{
public:
IMPDecompressor(const Buffer &packedData,bool verify);
IMPDecompressor(uint32_t hdr,uint32_t recursionLevel,const Buffer &packedData,std::shared_ptr<XPKDecompressor::State> &state,bool verify);
virtual ~IMPDecompressor();
virtual const std::string &getName() const noexcept override final;
virtual const std::string &getSubName() const noexcept override final;
virtual size_t getPackedSize() const noexcept override final;
virtual size_t getRawSize() const noexcept override final;
virtual void decompressImpl(Buffer &rawData,bool verify) override final;
virtual void decompressImpl(Buffer &rawData,const Buffer &previousData,bool verify) override final;
static bool detectHeader(uint32_t hdr) noexcept;
static bool detectHeaderXPK(uint32_t hdr) noexcept;
static std::shared_ptr<Decompressor> create(const Buffer &packedData,bool exactSizeKnown,bool verify);
static std::shared_ptr<XPKDecompressor> create(uint32_t hdr,uint32_t recursionLevel,const Buffer &packedData,std::shared_ptr<XPKDecompressor::State> &state,bool verify);
private:
const Buffer &_packedData;
uint32_t _rawSize=0;
uint32_t _endOffset=0;
bool _isXPK=false;
};
}
#endif
| 31.733333 | 170 | 0.803922 | ford442 |
e0b1b92ea8cff348c184bfbe43f1f860b58a6a59 | 1,459 | cpp | C++ | src/widgets/progressbar.cpp | BusyStudent/Btk | 27b23aa77e4fbcc48bdfe566ce7cae46183c289c | [
"MIT"
] | 2 | 2021-06-19T08:21:38.000Z | 2021-08-15T21:37:30.000Z | src/widgets/progressbar.cpp | BusyStudent/Btk | 27b23aa77e4fbcc48bdfe566ce7cae46183c289c | [
"MIT"
] | null | null | null | src/widgets/progressbar.cpp | BusyStudent/Btk | 27b23aa77e4fbcc48bdfe566ce7cae46183c289c | [
"MIT"
] | 1 | 2021-04-03T14:27:39.000Z | 2021-04-03T14:27:39.000Z | #include "../build.hpp"
#include <Btk/progressbar.hpp>
#include <Btk/render.hpp>
#include <Btk/themes.hpp>
#include <algorithm>
namespace Btk{
ProgressBar::ProgressBar(){
set_value(0);
}
ProgressBar::~ProgressBar() = default;
void ProgressBar::draw(Renderer &render){
FRect fixed_rect = rect;
fixed_rect.y += 1;
fixed_rect.w -= 1;
fixed_rect.h -= 1;
render.begin_path();
render.rect(rect);
render.fill_color(theme()[Theme::Button]);
render.fill();
render.begin_path();
render.rect(rect);
render.stroke_color(theme()[Theme::Border]);
render.stroke();
//Draw the next boarder
render.begin_path();
FRect r = rect;
r.w = r.w / 100.0f * value;
render.rect(r);
render.fill_color(theme()[Theme::Highlight]);
render.fill();
//Draw text
if(display_value){
render.begin_path();
render.text_align(TextAlign::Middle | TextAlign::Center);
render.text_size(theme().font_size());
render.fill_color(theme()[Theme::Text]);
}
render.text(rect.center(),value_text);
render.fill();
}
void ProgressBar::set_value(float v){
v = std::clamp(v,0.0f,100.0f);
value_text = u8format("%.2f%%",v);
value = v;
_signal_value_changed(v);
redraw();
}
} | 24.316667 | 69 | 0.550377 | BusyStudent |
e0b2695c521f452d7765e9e462c59f5f2253abaf | 1,173 | cpp | C++ | GDPARCM_HO2/AGameObject.cpp | NeilDG/GDADPRG-GDPARCM_Courseware | 771509ec7b3eb6d6375807819ca9da957dd22641 | [
"MIT"
] | null | null | null | GDPARCM_HO2/AGameObject.cpp | NeilDG/GDADPRG-GDPARCM_Courseware | 771509ec7b3eb6d6375807819ca9da957dd22641 | [
"MIT"
] | null | null | null | GDPARCM_HO2/AGameObject.cpp | NeilDG/GDADPRG-GDPARCM_Courseware | 771509ec7b3eb6d6375807819ca9da957dd22641 | [
"MIT"
] | null | null | null | #include "AGameObject.h"
AGameObject::AGameObject(String name)
{
this->name = name;
}
AGameObject::~AGameObject() {
delete this->sprite;
delete this->texture;
}
AGameObject::String AGameObject::getName() {
return this->name;
}
void AGameObject::draw(sf::RenderWindow* targetWindow) {
if (this->sprite != NULL) {
this->sprite->setPosition(this->posX, this->posY);
this->sprite->setScale(this->scaleX, this->scaleY);
targetWindow->draw(*this->sprite);
}
}
//must be called after being registered to the game object manager or one of the parent game objects
void AGameObject::setPosition(float x, float y)
{
this->posX = x;
this->posY = y;
if(this->sprite != nullptr)
{
this->sprite->setPosition(this->posX, this->posY);
}
}
void AGameObject::setScale(float x, float y)
{
this->scaleX = x;
this->scaleY = y;
if (this->sprite != nullptr)
{
this->sprite->setScale(this->scaleX, this->scaleY);
}
}
sf::Vector2f AGameObject::getPosition()
{
return this->sprite->getPosition();
}
sf::Vector2f AGameObject::getScale()
{
return this->sprite->getScale();
}
sf::FloatRect AGameObject::getLocalBounds()
{
return this->sprite->getLocalBounds();
}
| 18.919355 | 100 | 0.693947 | NeilDG |
e0b27fd1e5011210eaf28d67dce3884375d433b2 | 5,884 | cpp | C++ | external_libs/gemalto/common/src/Applet.cpp | twilio/wireless-trust-onboard | 1267c5c2a736c0edd79882039b129e3a613be96b | [
"Apache-2.0"
] | null | null | null | external_libs/gemalto/common/src/Applet.cpp | twilio/wireless-trust-onboard | 1267c5c2a736c0edd79882039b129e3a613be96b | [
"Apache-2.0"
] | null | null | null | external_libs/gemalto/common/src/Applet.cpp | twilio/wireless-trust-onboard | 1267c5c2a736c0edd79882039b129e3a613be96b | [
"Apache-2.0"
] | 2 | 2019-04-27T01:43:09.000Z | 2019-10-14T04:47:52.000Z | /*
* Copyright (c) 2017 Gemalto Limited. All Rights Reserved
* This software is the confidential and proprietary information of GEMALTO.
*
* GEMALTO MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
* THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
* TO THE IMPLIED WARRANTIES OR MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE, OR NON-INFRINGEMENT. GEMALTO SHALL NOT BE
* LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS RESULT OF USING,
* MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
* THIS SOFTWARE IS NOT DESIGNED OR INTENDED FOR USE OR RESALE AS ON-LINE
* CONTROL EQUIPMENT IN HAZARDOUS ENVIRONMENTS REQUIRING FAIL-SAFE
* PERFORMANCE, SUCH AS IN THE OPERATION OF NUCLEAR FACILITIES, AIRCRAFT
* NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL, DIRECT LIFE
* SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH THE FAILURE OF THE
* SOFTWARE COULD LEAD DIRECTLY TO DEATH, PERSONAL INJURY, OR SEVERE
* PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH RISK ACTIVITIES"). GEMALTO
* SPECIFICALLY DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY OF FTNESS FOR
* HIGH RISK ACTIVITIES;
*
*/
#include "Applet.h"
Applet::Applet(uint8_t* aid, uint16_t aidLen) {
_seiface = NULL;
_aid = aid;
_aidLen = aidLen;
_seiface = NULL;
_isBasic = false;
_isSelected = false;
_channel = 0;
}
Applet::~Applet(void) {
if(isSelected()) {
deselect();
}
}
void Applet::init(SEInterface* seiface) {
_seiface = seiface;
}
bool Applet::isSelected(void) {
return _isSelected;
}
bool Applet::select(bool isBasic) {
if(_seiface != NULL) {
deselect();
if(isBasic) {
_channel = 0;
if(_seiface->transmit(0x00, 0xA4, 0x04, 0x00, _aid, _aidLen)) {
if((_seiface->getStatusWord() == 0x9000) || ((_seiface->getStatusWord() & 0xFF00) == 0x6100)) {
_isSelected = true;
_isBasic = true;
return true;
}
}
}
else {
if(_seiface->transmit(0x00, 0x70, 0x00, 0x00, 0x01)) {
if(_seiface->getStatusWord() == 0x9000) {
_seiface->getResponse(&_channel);
if(_seiface->transmit(0x00 | _channel, 0xA4, 0x04, 0x00, _aid, _aidLen)) {
if((_seiface->getStatusWord() == 0x9000) || ((_seiface->getStatusWord() & 0xFF00) == 0x6100)) {
_isSelected = true;
_isBasic = false;
return true;
}
}
_seiface->transmit(0x00, 0x70, 0x80, _channel);
}
}
}
}
return false;
}
bool Applet::deselect(void) {
if(_seiface != NULL) {
if(_isSelected && !_isBasic) {
if(_seiface->transmit(0x00, 0x70, 0x80, _channel)) {
if(_seiface->getStatusWord() == 0x9000) {
_isSelected = false;
}
}
}
else if(_isSelected && _isBasic) {
_isSelected = false;
}
}
return _isSelected;
}
bool Applet::transmit(uint8_t cla, uint8_t ins, uint8_t p1, uint8_t p2) {
if(_isSelected) {
return _seiface->transmit(cla | _channel, ins, p1, p2);
}
return false;
}
bool Applet::transmit(uint8_t cla, uint8_t ins, uint8_t p1, uint8_t p2, uint8_t le) {
if(_isSelected) {
return _seiface->transmit(cla | _channel, ins, p1, p2, le);
}
return false;
}
bool Applet::transmit(uint8_t cla, uint8_t ins, uint8_t p1, uint8_t p2, uint8_t* data, uint16_t dataLen) {
if(_isSelected) {
return _seiface->transmit(cla | _channel, ins, p1, p2, data, dataLen);
}
return false;
}
bool Applet::transmit(uint8_t cla, uint8_t ins, uint8_t p1, uint8_t p2, uint8_t* data, uint16_t dataLen, uint8_t le) {
if(_isSelected) {
return _seiface->transmit(cla | _channel, ins, p1, p2, data, dataLen, le);
}
return false;
}
uint16_t Applet::getStatusWord(void) {
uint16_t sw = 0;
if(_isSelected) {
sw = _seiface->getStatusWord();
}
return sw;
}
uint16_t Applet::getResponse(uint8_t* data) {
uint16_t len = 0;
if(_isSelected) {
len = _seiface->getResponse(data);
}
return len;
}
uint16_t Applet::getResponseLength(void) {
uint16_t len = 0;
if(_isSelected) {
len = _seiface->getResponseLength();
}
return len;
}
/** C Accessors ***************************************************************/
extern "C" Applet* Applet_create(uint8_t* aid, uint16_t aid_len) {
return new Applet(aid, aid_len);
}
extern "C" void Applet_destroy(Applet* applet) {
delete applet;
}
extern "C" void Applet_init(Applet* applet, SEInterface* seiface) {
applet->init(seiface);
}
extern "C" bool Applet_is_selected(Applet* applet) {
return applet->isSelected();
}
extern "C" bool Applet_select(Applet* applet, bool is_basic) {
return applet->select(is_basic);
}
extern "C" bool Applet_deselect(Applet* applet) {
return applet->deselect();
}
extern "C" bool Applet_transmit_case1(Applet* applet, uint8_t cla, uint8_t ins, uint8_t p1, uint8_t p2) {
return applet->transmit(cla, ins, p1, p2);
}
extern "C" bool Applet_transmit_case2(Applet* applet, uint8_t cla, uint8_t ins, uint8_t p1, uint8_t p2, uint8_t le) {
return applet->transmit(cla, ins, p1, p2, le);
}
extern "C" bool Applet_transmit_case3(Applet* applet, uint8_t cla, uint8_t ins, uint8_t p1, uint8_t p2, uint8_t* data, uint16_t data_len) {
return applet->transmit(cla, ins, p1, p2, data, data_len);
}
extern "C" bool Applet_transmit_case4(Applet* applet, uint8_t cla, uint8_t ins, uint8_t p1, uint8_t p2, uint8_t* data, uint16_t data_len, uint8_t le) {
return applet->transmit(cla, ins, p1, p2, data, data_len, le);
}
extern "C" uint16_t Applet_get_status_word(Applet* applet) {
return applet->getStatusWord();
}
extern "C" uint16_t Applet_get_response(Applet* applet, uint8_t* data) {
return applet->getResponse(data);
}
extern "C" uint16_t Applet_get_response_length(Applet* applet) {
return applet->getResponseLength();
}
| 27.495327 | 152 | 0.663154 | twilio |
e0b9f5412cfcc4c300d968a882d069a31d20fd5e | 2,155 | cpp | C++ | apps/image_recs.cpp | cdriehuys/comp475 | efcd1d5a3055f0a6676a8771397bd826ee1d7b50 | [
"MIT"
] | 1 | 2018-07-26T05:02:28.000Z | 2018-07-26T05:02:28.000Z | apps/image_recs.cpp | cdriehuys/comp475 | efcd1d5a3055f0a6676a8771397bd826ee1d7b50 | [
"MIT"
] | null | null | null | apps/image_recs.cpp | cdriehuys/comp475 | efcd1d5a3055f0a6676a8771397bd826ee1d7b50 | [
"MIT"
] | 4 | 2018-04-25T05:39:47.000Z | 2022-02-24T04:21:56.000Z | /**
* Copyright 2015 Mike Reed
*/
#include "image.h"
#include "image_pa1.cpp"
#include "image_pa2.cpp"
#include "image_pa3.cpp"
#include "image_pa4.cpp"
#include "image_pa5.cpp"
#include "image_pa6.cpp"
#include "image_final.cpp"
const GDrawRec gDrawRecs[] = {
{ draw_solid_ramp, 256, 7*28, "solid_ramp", 1 },
{ draw_graphs, 256, 256, "rect_graphs", 1 },
{ draw_blend_black, 200, 200, "blend_black", 1 },
{ draw_poly, 512, 512, "poly", 2 },
{ draw_poly_center, 256, 256, "poly_center", 2 },
{ draw_blendmodes, 450, 340, "blendmodes", 2 },
{ draw_checker, 300, 300, "checkers", 3 },
{ draw_poly_rotate, 300, 300, "color_clock", 3 },
{ draw_bitmaps_hole,300, 300, "bitmap_hole", 3 },
{ draw_clock_bm, 480, 480, "spock_clock", 3 },
{ draw_clock_bm, 480, 480, "spock_clock", 3 },
{ draw_bm_blendmodes, 450, 340, "blendmodes2", 3 },
{ draw_rb_switch, 300, 300, "red_blue", 4 },
{ draw_hole, 300, 300, "hole", 4 },
{ draw_pluses, 260, 260, "plus", 4 },
{ draw_filter_blendmodes, 450, 340, "filter_blendmodes", 4 },
{ draw_paint_blendmodes, 450, 340, "filter_paint", 4 },
{ stars, 512, 512, "stars", 5 },
{ draw_lion, 512, 512, "lion", 5 },
{ draw_lion_head, 512, 512, "lion_head", 5 },
{ draw_grad, 250, 200, "grad", 5 },
{ draw_gradient_blendmodes, 450, 340, "gradient_blendmodes", 5 },
{ draw_graphs2, 256, 256, "path_graphs", 5 },
{ draw_quad_rotate, 300, 300, "quad_clock", 6 },
{ draw_cubics, 512, 512, "cubic_fan", 6 },
{ draw_rings, 512, 512, "rings", 6 },
{ draw_bm_tiling, 512, 512, "bitmap_tiling", 6 },
{ draw_cartman, 512, 512, "cartman", 6 },
{ draw_divided, 512, 512, "divided", 6 },
{ final_radial, 512, 512, "final_radial", 7 },
{ final_stroke, 512, 512, "final_stroke", 7 },
{ final_triangle, 512, 512, "final_triangle", 7 },
{ nullptr, 0, 0, nullptr },
};
| 37.807018 | 69 | 0.543387 | cdriehuys |
e0be66b22e477c83ea8920fe5f97a10bb5098d84 | 2,406 | cpp | C++ | src/state/city.cpp | sstanfield/hexGame | 99edad55703846992d3f64ad4cf9d146d57ca625 | [
"Zlib"
] | null | null | null | src/state/city.cpp | sstanfield/hexGame | 99edad55703846992d3f64ad4cf9d146d57ca625 | [
"Zlib"
] | null | null | null | src/state/city.cpp | sstanfield/hexGame | 99edad55703846992d3f64ad4cf9d146d57ca625 | [
"Zlib"
] | null | null | null | /*
Copyright (c) 2015-2016 Steven Stanfield
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 "city.h"
#include <cstdlib>
namespace hexgame {
namespace state {
struct CityManager::CityContext {
std::vector<City::u_ptr> cities;
uint cityPos;
};
CityManager::CityManager() : _ctx(std::make_unique<CityContext>())
{
}
CityManager::~CityManager() = default;
const City& CityManager::newCity(std::string name, uint row, uint col, uint walls)
{
City::u_ptr c = std::make_unique<City>();
c->name = name;
c->row = row;
c->col = col;
c->walls = walls;
c->side = Side::Side_Grey;
c->id = _ctx->cities.size();
_ctx->cities.push_back(std::move(c));
return *_ctx->cities[c->id];
}
void CityManager::addCityProd(uint id, std::string basename, uint time, uint cost,
uint upkeep, uint strength, uint movement)
{
UnitProd::u_ptr up = std::make_unique<UnitProd>();
up->basename = basename;
up->time = time;
up->cost = cost;
up->upkeep = upkeep;
up->strength = strength;
up->movement = movement;
_ctx->cities.at(id)->units.push_back(std::move(up));
}
uint CityManager::numCities() const
{
return _ctx->cities.size();
}
const City* CityManager::getCity(uint id) const
{
return _ctx->cities.at(id).get();
}
const City* CityManager::firstCity()
{
City *c = nullptr;
_ctx->cityPos = 0;
if (_ctx->cityPos < _ctx->cities.size())
c = _ctx->cities[_ctx->cityPos].get();
return c;
}
const City* CityManager::nextCity()
{
City *c = nullptr;
_ctx->cityPos++;
if (_ctx->cityPos < _ctx->cities.size())
c = _ctx->cities[_ctx->cityPos].get();
return c;
}
} //state
} // hexgame
| 24.55102 | 82 | 0.704489 | sstanfield |
e0c012f7953c67129226a27d685eb3cee3f6ebd5 | 5,552 | cpp | C++ | src/py/wrapper/wrapper_3d6a15edb2225daba874c2b80defe6b4.cpp | StatisKit/Core | 79d8ec07c203eb7973a6cf482852ddb2e8e1e93e | [
"Apache-2.0"
] | null | null | null | src/py/wrapper/wrapper_3d6a15edb2225daba874c2b80defe6b4.cpp | StatisKit/Core | 79d8ec07c203eb7973a6cf482852ddb2e8e1e93e | [
"Apache-2.0"
] | 7 | 2018-03-20T14:23:16.000Z | 2019-04-09T11:57:57.000Z | src/py/wrapper/wrapper_3d6a15edb2225daba874c2b80defe6b4.cpp | StatisKit/Core | 79d8ec07c203eb7973a6cf482852ddb2e8e1e93e | [
"Apache-2.0"
] | 7 | 2017-04-28T07:41:01.000Z | 2021-03-15T18:17:20.000Z | #include "_core.h"
namespace autowig
{
typedef ::statiskit::Optimization< ::statiskit::DiscreteMultivariateDistributionEstimation::Estimator > class_type;
class Trampoline : public class_type
{
public:
using ::statiskit::Optimization< ::statiskit::DiscreteMultivariateDistributionEstimation::Estimator >::Optimization;
typedef class ::std::unique_ptr< struct ::statiskit::MultivariateDistributionEstimation::Estimator, struct ::std::default_delete< struct ::statiskit::MultivariateDistributionEstimation::Estimator > > return_type_20397b66478a59f481c4e33cec98b652;
virtual return_type_20397b66478a59f481c4e33cec98b652 copy() const override { PYBIND11_OVERLOAD_PURE_UNIQUE_PTR(return_type_20397b66478a59f481c4e33cec98b652, class_type, copy, ); };
typedef class ::std::unique_ptr< struct ::statiskit::MultivariateDistributionEstimation, struct ::std::default_delete< struct ::statiskit::MultivariateDistributionEstimation > > return_type_0cfbeb46728f5e3393b2f59c4a91a99d;
typedef ::statiskit::MultivariateDistributionEstimation::data_type const & param_0cfbeb46728f5e3393b2f59c4a91a99d_0_type;
typedef bool const & param_0cfbeb46728f5e3393b2f59c4a91a99d_1_type;
virtual return_type_0cfbeb46728f5e3393b2f59c4a91a99d operator()(param_0cfbeb46728f5e3393b2f59c4a91a99d_0_type param_0, param_0cfbeb46728f5e3393b2f59c4a91a99d_1_type param_1) const override { PYBIND11_OVERLOAD_PURE_UNIQUE_PTR(return_type_0cfbeb46728f5e3393b2f59c4a91a99d, class_type, operator(), param_0, param_1); };
typedef ::uintptr_t return_type_ed723b56ee6d50838db979e102419f39;
virtual return_type_ed723b56ee6d50838db979e102419f39 identifier() const override { PYBIND11_OVERLOAD(return_type_ed723b56ee6d50838db979e102419f39, class_type, identifier, ); };
typedef class ::std::unordered_set< statiskit::Index, struct ::std::hash< statiskit::Index >, struct ::std::equal_to< statiskit::Index >, class ::std::allocator< statiskit::Index > > return_type_7ba100805cd95f1cba468c9ce84eb72c;
virtual return_type_7ba100805cd95f1cba468c9ce84eb72c children() const override { PYBIND11_OVERLOAD(return_type_7ba100805cd95f1cba468c9ce84eb72c, class_type, children, ); };
};
class Publicist : public class_type
{
public:
using class_type::identifier;
using class_type::children;
};
}
double const & (::statiskit::Optimization< ::statiskit::DiscreteMultivariateDistributionEstimation::Estimator >::*method_pointer_35a1d72c2afe50abae544c7b85e81bf1)()const= &::statiskit::Optimization< struct ::statiskit::DiscreteMultivariateDistributionEstimation::Estimator >::get_mindiff;
void (::statiskit::Optimization< ::statiskit::DiscreteMultivariateDistributionEstimation::Estimator >::*method_pointer_99ae7dd9f31d5974bde957949a5035c4)(double const &)= &::statiskit::Optimization< struct ::statiskit::DiscreteMultivariateDistributionEstimation::Estimator >::set_mindiff;
unsigned int (::statiskit::Optimization< ::statiskit::DiscreteMultivariateDistributionEstimation::Estimator >::*method_pointer_83064646869d5d85a9ac96b3e9c8a59a)()const= &::statiskit::Optimization< struct ::statiskit::DiscreteMultivariateDistributionEstimation::Estimator >::get_minits;
void (::statiskit::Optimization< ::statiskit::DiscreteMultivariateDistributionEstimation::Estimator >::*method_pointer_da042cc8718c58c5b1f93c727825184b)(unsigned int const &)= &::statiskit::Optimization< struct ::statiskit::DiscreteMultivariateDistributionEstimation::Estimator >::set_minits;
unsigned int (::statiskit::Optimization< ::statiskit::DiscreteMultivariateDistributionEstimation::Estimator >::*method_pointer_b163c4dfab725029a48aa0aacfca11b8)()const= &::statiskit::Optimization< struct ::statiskit::DiscreteMultivariateDistributionEstimation::Estimator >::get_maxits;
void (::statiskit::Optimization< ::statiskit::DiscreteMultivariateDistributionEstimation::Estimator >::*method_pointer_499fd696e18e520599ff940988b0bcb7)(unsigned int const &)= &::statiskit::Optimization< struct ::statiskit::DiscreteMultivariateDistributionEstimation::Estimator >::set_maxits;
namespace autowig {
}
void wrapper_3d6a15edb2225daba874c2b80defe6b4(pybind11::module& module)
{
pybind11::class_<class ::statiskit::Optimization< struct ::statiskit::DiscreteMultivariateDistributionEstimation::Estimator >, autowig::Trampoline, autowig::HolderType< class ::statiskit::Optimization< struct ::statiskit::DiscreteMultivariateDistributionEstimation::Estimator > >::Type, struct ::statiskit::DiscreteMultivariateDistributionEstimation::Estimator > class_3d6a15edb2225daba874c2b80defe6b4(module, "_Optimization_3d6a15edb2225daba874c2b80defe6b4", "");
class_3d6a15edb2225daba874c2b80defe6b4.def(pybind11::init< >());
class_3d6a15edb2225daba874c2b80defe6b4.def("get_mindiff", method_pointer_35a1d72c2afe50abae544c7b85e81bf1, pybind11::return_value_policy::copy, "");
class_3d6a15edb2225daba874c2b80defe6b4.def("set_mindiff", method_pointer_99ae7dd9f31d5974bde957949a5035c4, "");
class_3d6a15edb2225daba874c2b80defe6b4.def("get_minits", method_pointer_83064646869d5d85a9ac96b3e9c8a59a, "");
class_3d6a15edb2225daba874c2b80defe6b4.def("set_minits", method_pointer_da042cc8718c58c5b1f93c727825184b, "");
class_3d6a15edb2225daba874c2b80defe6b4.def("get_maxits", method_pointer_b163c4dfab725029a48aa0aacfca11b8, "");
class_3d6a15edb2225daba874c2b80defe6b4.def("set_maxits", method_pointer_499fd696e18e520599ff940988b0bcb7, "");
} | 102.814815 | 468 | 0.810519 | StatisKit |
e0c33b06063fe323cfa12cbbbcd7acb1285cc2f1 | 8,142 | cpp | C++ | source/examples/common/ContextFormat.cpp | dgimb89/glannotations | df687dbae1906cdb08c7b10cb006c025c4ba6406 | [
"MIT"
] | null | null | null | source/examples/common/ContextFormat.cpp | dgimb89/glannotations | df687dbae1906cdb08c7b10cb006c025c4ba6406 | [
"MIT"
] | null | null | null | source/examples/common/ContextFormat.cpp | dgimb89/glannotations | df687dbae1906cdb08c7b10cb006c025c4ba6406 | [
"MIT"
] | null | null | null |
#include <common/ContextFormat.h>
#include <cassert>
#include <sstream>
#include <map>
#include <globjects/base/baselogging.h>
using namespace globjects;
ContextFormat::ContextFormat()
: m_version(glbinding::Version(4, 5))
, m_profile(Profile::None)
, m_debugContext(false)
, m_forwardCompatibility(false)
, m_redBufferSize(8)
, m_greenBufferSize(8)
, m_blueBufferSize(8)
, m_alphaBufferSize(8)
, m_depthBufferSize(24)
, m_stencilBufferSize(0)
, m_stereo(false)
, m_swapBehavior(SwapBehavior::DoubleBuffering)
, m_samples(0)
{
}
ContextFormat::~ContextFormat()
{
}
void ContextFormat::setVersion(
const unsigned int majorVersion
, const unsigned int minorVersion)
{
setVersion(glbinding::Version(majorVersion, minorVersion));
}
void ContextFormat::setVersion(const glbinding::Version & version)
{
m_version = version;
}
glbinding::Version ContextFormat::validateVersion(
const glbinding::Version & requestedVersion
, const glbinding::Version & supportedMaximumVersion)
{
#ifdef MAC_OS
return glbinding::Version(3, 2);
#endif
glbinding::Version maxv(supportedMaximumVersion);
if (maxv.isNull())
maxv = glbinding::Version(3, 0);
if (requestedVersion.isNull() || requestedVersion > maxv)
return maxv;
if (!requestedVersion.isValid())
{
glbinding::Version nearest = requestedVersion.nearest();
return nearest > maxv ? maxv : nearest;
}
return requestedVersion;
}
int ContextFormat::majorVersion() const
{
return m_version.m_major;
}
int ContextFormat::minorVersion() const
{
return m_version.m_minor;
}
const glbinding::Version & ContextFormat::version() const
{
return m_version;
}
ContextFormat::Profile ContextFormat::profile() const
{
return m_profile;
}
void ContextFormat::setProfile(const ContextFormat::Profile profile)
{
m_profile = profile;
}
bool ContextFormat::debugContext() const
{
return m_debugContext;
}
void ContextFormat::setDebugContext(const bool on)
{
m_debugContext = on;
}
bool ContextFormat::forwardCompatible() const
{
return m_forwardCompatibility;
}
void ContextFormat::setForwardCompatible(const bool on)
{
m_forwardCompatibility = on;
}
int ContextFormat::redBufferSize() const
{
return m_redBufferSize;
}
void ContextFormat::setRedBufferSize(const int size)
{
m_redBufferSize = size;
}
int ContextFormat::greenBufferSize() const
{
return m_greenBufferSize;
}
void ContextFormat::setGreenBufferSize(const int size)
{
m_greenBufferSize = size;
}
int ContextFormat::blueBufferSize() const
{
return m_blueBufferSize;
}
void ContextFormat::setBlueBufferSize(const int size)
{
m_blueBufferSize = size;
}
int ContextFormat::alphaBufferSize() const
{
return m_alphaBufferSize;
}
void ContextFormat::setAlphaBufferSize(const int size)
{
m_alphaBufferSize = size;
}
int ContextFormat::depthBufferSize() const
{
return m_depthBufferSize;
}
void ContextFormat::setDepthBufferSize(const int size)
{
m_depthBufferSize = size;
}
int ContextFormat::stencilBufferSize() const
{
return m_stencilBufferSize;
}
void ContextFormat::setStencilBufferSize(const int size)
{
m_stencilBufferSize = size;
}
ContextFormat::SwapBehavior ContextFormat::swapBehavior() const
{
return m_swapBehavior;
}
void ContextFormat::setSwapBehavior(const ContextFormat::SwapBehavior behavior)
{
m_swapBehavior = behavior;
}
bool ContextFormat::stereo() const
{
return m_stereo;
}
void ContextFormat::setStereo(const bool enable)
{
m_stereo = enable;
}
int ContextFormat::samples() const
{
return m_samples;
}
void ContextFormat::setSamples(const int samples)
{
m_samples = samples;
}
const std::string & ContextFormat::profileString(const Profile profile)
{
static const std::map<Profile, std::string> profileIdentifier = {
{ Profile::Core, "Core" }
, { Profile::Compatibility, "Compatibility" }
, { Profile::None, "None" } };
return profileIdentifier.at(profile);
}
const std::string & ContextFormat::swapBehaviorString(const SwapBehavior swapBehavior)
{
static const std::map<SwapBehavior, std::string> swapbIdentifier = {
{ SwapBehavior::Default, "Default" }
, { SwapBehavior::DoubleBuffering, "DoubleBuffering" }
, { SwapBehavior::SingleBuffering, "SingleBuffering" }
, { SwapBehavior::TripleBuffering, "TripleBuffering" } };
return swapbIdentifier.at(swapBehavior);
}
bool ContextFormat::verify(const ContextFormat & requested, const ContextFormat & created)
{
return
verifyVersionAndProfile(requested, created) &&
verifyPixelFormat(requested, created);
}
bool ContextFormat::verify(const ContextFormat & requested) const
{
return verify(requested, *this);
}
bool ContextFormat::verifyVersionAndProfile(const ContextFormat & requested, const ContextFormat & created)
{
const bool sameProfiles(requested.profile() == created.profile());
if (!sameProfiles)
{
warning() << "Profile mismatch for the current context: "
<< profileString(requested.profile()) << " requested, "
<< profileString(created.profile()) << " created.";
}
if (requested.version() != created.version())
{
warning() << "Version mismatch for the current context: "
<< requested.version().toString() << " requested, "
<< created.version().toString() << " created.";
if (requested.profile() == Profile::Core)
return false;
}
return sameProfiles;
}
void ContextFormat::verifyBufferSize(
const unsigned int sizeRequested
, const unsigned int sizeInitialized
, const std::string & warning
, std::vector<std::string> & issues)
{
if (sizeRequested == sizeInitialized)
return;
std::stringstream ss;
ss << warning << " size mismatch: " << sizeRequested << " requested, " << sizeInitialized << " created.";
issues.push_back(ss.str());
}
bool ContextFormat::verifyPixelFormat(
const ContextFormat & requested
, const ContextFormat & created)
{
std::vector<std::string> issues;
const bool sameSwapBehaviors(requested.swapBehavior() == created.swapBehavior());
if (!sameSwapBehaviors)
{
warning() << "Swap behavior mismatch for the current context: "
<< swapBehaviorString(requested.swapBehavior()) << " requested, "
<< swapBehaviorString(created.swapBehavior()) << " created.";
}
if (requested.depthBufferSize())
{
if (!created.depthBufferSize())
issues.push_back("- Depth Buffer requested, but none created.");
else
verifyBufferSize(requested.depthBufferSize(), created.depthBufferSize()
, "- Depth Buffer", issues);
}
verifyBufferSize(requested.redBufferSize(), created.redBufferSize()
, "- Red Buffer", issues);
verifyBufferSize(requested.greenBufferSize(), created.greenBufferSize()
, "- Green Buffer", issues);
verifyBufferSize(requested.blueBufferSize(), created.blueBufferSize()
, "- Blue Buffer", issues);
verifyBufferSize(requested.alphaBufferSize(), created.alphaBufferSize()
, "- Alpha Buffer", issues);
if (requested.stencilBufferSize())
{
if (!created.stencilBufferSize())
issues.push_back("- Stencil Buffer requested, but none created.");
else
verifyBufferSize(requested.stencilBufferSize(), created.stencilBufferSize()
, "- Stencil Buffer", issues);
}
if (requested.stereo() && !created.stereo())
issues.push_back("- Stereo Buffering requested, but not initialized.");
if (requested.samples())
{
if (!created.samples())
issues.push_back("- Sample Buffers requested, but none initialized.");
else
verifyBufferSize(requested.samples(), created.samples(), "- Samples ", issues);
}
if (issues.empty())
return true;
warning() << "Pixelformat mismatch for the current context:";
for (const std::string & issue : issues)
warning() << issue;
return false;
}
| 24.017699 | 109 | 0.688529 | dgimb89 |
e0c34532ae1ce2cd3841d45edc2aad9d860e5731 | 1,206 | hpp | C++ | Tests/UnitTests/Helper/Include/UTH/Config.hpp | SapphireSuite/Engine | f29821853aec6118508f31d3e063e83e603f52dd | [
"MIT"
] | 1 | 2022-01-20T23:17:18.000Z | 2022-01-20T23:17:18.000Z | Tests/UnitTests/Helper/Include/UTH/Config.hpp | SapphireSuite/Engine | f29821853aec6118508f31d3e063e83e603f52dd | [
"MIT"
] | null | null | null | Tests/UnitTests/Helper/Include/UTH/Config.hpp | SapphireSuite/Engine | f29821853aec6118508f31d3e063e83e603f52dd | [
"MIT"
] | null | null | null | // Copyright (c) 2021 Sapphire's Suite. All Rights Reserved.
#pragma once
#ifndef SAPPHIRE_UTH_CONFIG_GUARD
#define SAPPHIRE_UTH_CONFIG_GUARD
#include <SA/Core/Support/ModuleAPI.hpp>
/**
* \file UTH/Config.hpp
*
* \brief Sapphire Engine UnitTestHelper module config file.
*
* \ingroup UTH
* \{
*/
#if defined(SA_UnitTestHelper_EXPORTS)
/// Sapphire Engine API import/export preprocessor.
#define SA_UTH_API SA_MODUE_EXPORT
#else
/// Sapphire Engine API import/export preprocessor.
#define SA_UTH_API SA_MODUE_IMPORT
#endif
#ifndef SA_UTH_EXIT_ON_FAILURE
/**
* \brief Wether to exit program on failure or continue next tests.
* Can be defined within cmake options or before including the header.
*/
#define SA_UTH_EXIT_ON_FAILURE 0
#endif
#ifndef SA_UTH_EXIT_PAUSE
/**
* \brief Whether to pause program on exit.
* Always disabled in continuous integration (define SA_CI).
*/
#define SA_UTH_EXIT_PAUSE 0
#endif
namespace Sa
{
/// Unit Test Helper module main namespace.
namespace UTH
{
/// UTH Internal classes implementations.
namespace Intl
{
}
}
}
/**
* \defgroup UTH UnitTestHelper
* Sapphire Engine Unit Test Helper module.
*/
/** \} */
#endif // GUARD
| 16.08 | 70 | 0.733002 | SapphireSuite |
e0c714c77ac0f7076885184070940b1237484c26 | 3,846 | cpp | C++ | librankernet/object_ranker.cpp | Rufaim/Ranker-Net | a3100d7c5b0b51ad764abb8025f299be29b2f688 | [
"MIT"
] | null | null | null | librankernet/object_ranker.cpp | Rufaim/Ranker-Net | a3100d7c5b0b51ad764abb8025f299be29b2f688 | [
"MIT"
] | null | null | null | librankernet/object_ranker.cpp | Rufaim/Ranker-Net | a3100d7c5b0b51ad764abb8025f299be29b2f688 | [
"MIT"
] | null | null | null | #include <fstream>
#include "object_ranker.h"
#include "json/json.hpp"
#include "ranker/dense.h"
#include "ranker/nalu.h"
using json = nlohmann::json;
void InitRanker(ranker_context& ranker, std::string filename) {
std::ifstream i(filename);
json j;
i >> j;
// for previous versions capabilty
if (j.count("parameters")) {
json additional_parameters = j["parameters"];
ranker.use_abs = additional_parameters["use_abs"].get<bool>();
ranker.num_layers = j.size()-1;
assert(ranker.num_layers >= 1);
} else {
ranker.use_abs = false;
ranker.num_layers = j.size();
}
ranker.layers = new Layer*[ranker.num_layers];
std::string layer_prefix = "layer";
int max_dim = 0;
for(int i = 0; i < ranker.num_layers; i++) {
auto curr_layer_name = layer_prefix + std::to_string(i);
json curr_layer = j[curr_layer_name];
if(i == 0) {
ranker.input_dim = curr_layer["in_dim"];
max_dim = curr_layer["in_dim"];
}
std::string layer_type;
// for previous versions capabilty
if (curr_layer.count("type")) {
layer_type = curr_layer["type"];
} else {
layer_type = "DENSE";
}
if (layer_type == "DENSE") {
std::vector<std::vector<float>> W = curr_layer["W"];
std::vector<std::vector<float>> b = curr_layer["b"];
int in_dim = curr_layer["in_dim"];
int out_dim = curr_layer["out_dim"];
float* biases = new float[out_dim];
float* weights = new float[out_dim * in_dim];
for(int j = 0; j < out_dim; j++) {
biases[j] = b.at(j);
for(int k = 0; k < in_dim; k++) {
weights[j * in_dim + k] = W.at(k).at(j);
}
}
ranker.layers[i] = new Dense(in_dim,out_dim,weights,biases,curr_layer["activation"].get<std::string>());
} else if (layer_type == "NALU") {
std::vector<std::vector<float>> W = curr_layer["W"];
std::vector<std::vector<float>> G = curr_layer["G"];
int in_dim = curr_layer["in_dim"];
int out_dim = curr_layer["out_dim"];
float* gate = new float[out_dim * in_dim];
float* weights = new float[out_dim * in_dim];
for(int j = 0; j < out_dim; j++) {
for(int k = 0; k < in_dim; k++) {
weights[j * in_dim + k] = W.at(k).at(j);
gate[j * in_dim + k] = G.at(k).at(j);
}
}
ranker.layers[i] = new Nalu(in_dim,out_dim,weights,gate);
}
if(ranker.layers[i]->getOutputDim() > max_dim) {
max_dim = ranker.layers[i]->getOutputDim();
}
}
ranker.is_init = true;
ranker.max_dim = max_dim;
}
void FreeRanker(ranker_context& ranker) {
for(int i = 0; i < ranker.num_layers; i++) {
ranker.layers[i]->free();
}
delete [] ranker.layers;
}
float EstimateRank(ranker_context& ranker, std::vector<double>& features) {
if(!ranker.is_init) {
return 0;
}
float *curr_buff = new float[ranker.max_dim];
float *prev_buff = new float[ranker.max_dim];
assert(features.size() == ranker.input_dim);
for(int i = 0; i < ranker.input_dim; i++) {
prev_buff[i] = ranker.use_abs ? std::abs(features[i]) : features[i];
}
//memcpy(prev_buff, prev_vector.data(), prev_vector.size() * sizeof(float));
float result = 0;
for(int i = 0; i < ranker.num_layers; i++) {
ranker.layers[i]->process(prev_buff,curr_buff);
float *tmp = curr_buff;
curr_buff = prev_buff;
prev_buff = tmp;
}
result = prev_buff[0];
delete[] curr_buff;
delete[] prev_buff;
return result;
}
| 33.443478 | 116 | 0.547842 | Rufaim |
e0c89c9d0cb63d330787e21583f63bedea61b48f | 1,851 | cpp | C++ | test/auto/ListModel/ListModelTester.cpp | ericzh86/ModelsModule | e1f263420e5e54ac280d1c61485ccb6a0a625129 | [
"MIT"
] | 8 | 2019-12-11T08:52:37.000Z | 2021-08-04T03:42:55.000Z | test/auto/ListModel/ListModelTester.cpp | ericzh86/ModelsModule | e1f263420e5e54ac280d1c61485ccb6a0a625129 | [
"MIT"
] | null | null | null | test/auto/ListModel/ListModelTester.cpp | ericzh86/ModelsModule | e1f263420e5e54ac280d1c61485ccb6a0a625129 | [
"MIT"
] | 1 | 2020-04-16T07:07:50.000Z | 2020-04-16T07:07:50.000Z | #include "ListModelTester.h"
#include "ListModelTester_p.h"
#include <QAbstractItemModelTester>
// class ListModelTester
ListModelTester::ListModelTester(Internal::QCxxListModel *model, QObject *parent)
: QObject(parent ? parent : model)
, d_ptr(new ListModelTesterPrivate())
{
d_ptr->q_ptr = this;
Q_CHECK_PTR(model);
new QAbstractItemModelTester(model, this);
connect(model, &Internal::QCxxListModel::countChanged,
this, &ListModelTester::onCountChanged);
connect(model, &Internal::QCxxListModel::dataChanged,
this, &ListModelTester::onDataChanged);
}
ListModelTester::~ListModelTester()
{
}
int ListModelTester::count() const
{
Q_D(const ListModelTester);
return d->count;
}
void ListModelTester::resetCount()
{
Q_D(ListModelTester);
d->count = 0;
}
void ListModelTester::onCountChanged()
{
Q_D(ListModelTester);
++d->count;
}
int ListModelTester::changedSize() const
{
Q_D(const ListModelTester);
return d->changedList.count();
}
bool ListModelTester::isChanged(int index, int from, int to) const
{
Q_D(const ListModelTester);
ListModelChanged changed = d->changedList.at(index);
return ((from == changed.first) && (to == changed.second));
}
void ListModelTester::resetChangedList()
{
Q_D(ListModelTester);
d->changedList.clear();
}
void ListModelTester::onDataChanged(const QModelIndex &tl, const QModelIndex &br, const QVector<int> &roles)
{
Q_D(ListModelTester);
Q_UNUSED(roles);
Q_ASSERT(tl.column() == 0);
Q_ASSERT(br.column() == 0);
d->changedList.append(ListModelChanged(tl.row(), br.row()));
}
// class ListModelTesterPrivate
ListModelTesterPrivate::ListModelTesterPrivate()
: q_ptr(nullptr)
, model(nullptr)
, count(0)
{
}
ListModelTesterPrivate::~ListModelTesterPrivate()
{
}
| 19.691489 | 108 | 0.698541 | ericzh86 |
e0c8a438c45ad79cafe0a31514a8a0383c06cb43 | 2,795 | cpp | C++ | grasp_generation/graspitmodified_lm/Coin-3.1.3/src/fields/SoMFBitMask.cpp | KraftOreo/EBM_Hand | 9ab1722c196b7eb99b4c3ecc85cef6e8b1887053 | [
"MIT"
] | null | null | null | grasp_generation/graspitmodified_lm/Coin-3.1.3/src/fields/SoMFBitMask.cpp | KraftOreo/EBM_Hand | 9ab1722c196b7eb99b4c3ecc85cef6e8b1887053 | [
"MIT"
] | null | null | null | grasp_generation/graspitmodified_lm/Coin-3.1.3/src/fields/SoMFBitMask.cpp | KraftOreo/EBM_Hand | 9ab1722c196b7eb99b4c3ecc85cef6e8b1887053 | [
"MIT"
] | null | null | null | /**************************************************************************\
*
* This file is part of the Coin 3D visualization library.
* Copyright (C) by Kongsberg Oil & Gas Technologies.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* ("GPL") version 2 as published by the Free Software Foundation.
* See the file LICENSE.GPL at the root directory of this source
* distribution for additional information about the GNU GPL.
*
* For using Coin with software that can not be combined with the GNU
* GPL, and for taking advantage of the additional benefits of our
* support services, please contact Kongsberg Oil & Gas Technologies
* about acquiring a Coin Professional Edition License.
*
* See http://www.coin3d.org/ for more information.
*
* Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
* http://www.sim.no/ sales@sim.no coin-support@coin3d.org
*
\**************************************************************************/
/*!
\class SoMFBitMask SoMFBitMask.h Inventor/fields/SoMFBitMask.h
\brief The SoMFBitMask class is a container for a set of bitmasks.
\ingroup fields
This field is used where nodes, engines or other field containers
needs to store multiple bitmasks with values from an enumerated set.
\sa SoSFBitMask
*/
#include <Inventor/fields/SoMFBitMask.h>
#include <cassert>
#include <Inventor/fields/SoSFBitMask.h>
#if COIN_DEBUG
#include <Inventor/errors/SoDebugError.h>
#endif // COIN_DEBUG
#include "fields/SoSubFieldP.h"
SO_MFIELD_DERIVED_SOURCE(SoMFBitMask, not_used, not_used);
// Override from parent class.
void
SoMFBitMask::initClass(void)
{
SO_MFIELD_INTERNAL_INIT_CLASS(SoMFBitMask);
}
// No need to document readValue() and writeValue() here, as the
// necessary information is provided by the documentation of the
// parent classes.
#ifndef DOXYGEN_SKIP_THIS
SbBool
SoMFBitMask::read1Value(SoInput * in, int idx)
{
assert(idx < this->maxNum);
SoSFBitMask sfbitmask;
sfbitmask.setEnums(this->numEnums, this->enumValues, this->enumNames);
SbBool result;
if ((result = sfbitmask.readValue(in))) {
this->values[idx] = sfbitmask.getValue();
}
return result;
}
void
SoMFBitMask::write1Value(SoOutput * out, int idx) const
{
SoSFBitMask sfbitmask;
sfbitmask.setEnums(this->numEnums, this->enumValues, this->enumNames);
sfbitmask.setValue((*this)[idx]);
sfbitmask.writeValue(out);
}
#endif // DOXYGEN_SKIP_THIS
#ifdef COIN_TEST_SUITE
BOOST_AUTO_TEST_CASE(initialized)
{
SoMFBitMask field;
BOOST_CHECK_MESSAGE(field.getTypeId() != SoType::badType(),
"missing class initialization");
BOOST_CHECK_EQUAL(field.getNum(), 0);
}
#endif // COIN_TEST_SUITE
| 29.114583 | 76 | 0.699821 | KraftOreo |
e0cb366fd7ae6f2844eec0447288d324a9619fa0 | 25,763 | hpp | C++ | trng/special_functions.hpp | mminutoli/trng4 | 1ef58a7027242d395f4407d0ce0fe42e4904f9bf | [
"BSD-3-Clause"
] | null | null | null | trng/special_functions.hpp | mminutoli/trng4 | 1ef58a7027242d395f4407d0ce0fe42e4904f9bf | [
"BSD-3-Clause"
] | null | null | null | trng/special_functions.hpp | mminutoli/trng4 | 1ef58a7027242d395f4407d0ce0fe42e4904f9bf | [
"BSD-3-Clause"
] | null | null | null | // Copyright (c) 2000-2021, Heiko Bauke
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
//
// * Neither the name of the copyright holder 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 HOLDERS 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.
#if !(defined TRNG_SPECIAL_FUNCTIONS_HPP)
#define TRNG_SPECIAL_FUNCTIONS_HPP
#include <trng/cuda.hpp>
#include <trng/limits.hpp>
#include <trng/math.hpp>
#include <trng/constants.hpp>
#include <trng/utility.hpp>
#include <cerrno>
#include <algorithm>
#include <ciso646>
namespace trng {
namespace math {
TRNG_CUDA_ENABLE
inline float ln_Gamma(float x) { return ::std::lgamma(x); }
TRNG_CUDA_ENABLE
inline double ln_Gamma(double x) { return ::std::lgamma(x); }
#if !(defined __CUDA_ARCH__)
inline long double ln_Gamma(long double x) { return ::std::lgamma(x); }
#endif
TRNG_CUDA_ENABLE
inline float Gamma(float x) { return ::std::tgamma(x); }
TRNG_CUDA_ENABLE
inline double Gamma(double x) { return ::std::tgamma(x); }
#if !(defined __CUDA_ARCH__)
inline long double Gamma(long double x) { return ::std::tgamma(x); }
#endif
// --- Beta function -----------------------------------------------
namespace detail {
template<typename T>
T Beta(T x, T y) {
static const T ln_max{ln(std::numeric_limits<T>::max())};
if (x <= 0 or y <= 0) {
#if !(defined __CUDA_ARCH__)
errno = EDOM;
#endif
return std::numeric_limits<T>::signaling_NaN();
}
const T z{x + y};
if (z * ln(z) - z > ln_max)
// less accurate but avoids overflow
return exp(ln_Gamma(x) + ln_Gamma(y) - ln_Gamma(z));
return Gamma(x) / Gamma(z) * Gamma(y);
}
} // namespace detail
TRNG_CUDA_ENABLE
inline float Beta(float x, float y) { return detail::Beta(x, y); }
TRNG_CUDA_ENABLE
inline double Beta(double x, double y) { return detail::Beta(x, y); }
#if !(defined __CUDA_ARCH__)
inline long double Beta(long double x, long double y) { return detail::Beta(x, y); }
#endif
// --- ln of binomial coefficient ----------------------------------
TRNG_CUDA_ENABLE
inline float ln_binomial(float n, float m) {
return ln_Gamma(n + 1) - ln_Gamma(m + 1) - ln_Gamma(n - m + 1);
}
TRNG_CUDA_ENABLE
inline double ln_binomial(double n, double m) {
return ln_Gamma(n + 1) - ln_Gamma(m + 1) - ln_Gamma(n - m + 1);
}
#if !(defined __CUDA_ARCH__)
inline long double ln_binomial(long double n, long double m) {
return ln_Gamma(n + 1) - ln_Gamma(m + 1) - ln_Gamma(n - m + 1);
}
#endif
// --- Pochhammer function -----------------------------------------
inline float Pochhammer(float x, float a) { return exp(ln_Gamma(x + a) - ln_Gamma(x)); }
inline double Pochhammer(double x, double a) { return exp(ln_Gamma(x + a) - ln_Gamma(x)); }
#if !(defined __CUDA_ARCH__)
inline long double Pochhammer(long double x, long double a) {
return exp(ln_Gamma(x + a) - ln_Gamma(x));
}
#endif
// --- incomplete Gamma functions ----------------------------------
namespace detail {
// compute incomplete Gamma function
//
// gamma(a, x) = Int(exp(-t)*t^(a-1), t=0..x)
//
// or
//
// P(a, x) = gamma(a, x) / Gamma(a)
//
// by series expansion, see "Numerical Recipes" by W. H. Press et al., 3rd edition
template<typename T, bool by_Gamma_a>
TRNG_CUDA_ENABLE T GammaP_ser(T a, T x) {
const int itmax{64};
const T eps{4 * numeric_limits<T>::epsilon()};
if (x < eps)
return T{0};
T xx{1 / a}, n{a}, sum{xx};
int i{0};
do {
++n;
++i;
xx *= x / n;
sum += xx;
} while (abs(xx) > eps * abs(sum) and i < itmax);
#if __cplusplus >= 201703L
if constexpr (by_Gamma_a)
#else
if (by_Gamma_a)
#endif
return exp(-x + a * ln(x) - ln_Gamma(a)) * sum;
else
return exp(-x + a * ln(x)) * sum;
}
// compute complementary incomplete Gamma function
//
// Gamma(a, x) = Int(exp(-t)*t^(a-1), t=x..oo)
//
// or
//
// Q(a, x) = Gamma(a, x) / Gamma(a) = 1 - P(a, x)
//
// by continued fraction, see "Numerical Recipes" by W. H. Press et al., 3rd edition
template<typename T, bool by_Gamma_a>
TRNG_CUDA_ENABLE T GammaQ_cf(T a, T x) {
const T itmax{64};
const T eps{4 * numeric_limits<T>::epsilon()};
const T min{4 * numeric_limits<T>::min()};
// set up for evaluating continued fraction by modified Lentz's method
T del, bi{x + 1 - a}, ci{1 / min}, di{1 / bi}, h{di}, i{0};
do { // iterate
++i;
T ai{-i * (i - a)};
bi += 2;
di = ai * di + bi;
if (abs(di) < min)
di = min;
ci = bi + ai / ci;
if (abs(ci) < min)
ci = min;
di = 1 / di;
del = di * ci;
h *= del;
} while ((abs(del - 1) > eps) and i < itmax);
#if __cplusplus >= 201703L
if constexpr (by_Gamma_a)
#else
if (by_Gamma_a)
#endif
return exp(-x + a * ln(x) - ln_Gamma(a)) * h;
else
return exp(-x + a * ln(x)) * h;
}
// P(a, x) and gamma(a, x)
template<typename T, bool by_Gamma_a>
TRNG_CUDA_ENABLE T GammaP(T a, T x) {
if (x < 0 or a <= 0)
return numeric_limits<T>::signaling_NaN();
#if __cplusplus >= 201703L
if constexpr (by_Gamma_a) {
#else
if (by_Gamma_a) {
#endif
if (x < a + 1)
return GammaP_ser<T, true>(a, x);
return 1 - GammaQ_cf<T, true>(a, x);
} else {
if (x < a + 1)
return GammaP_ser<T, false>(a, x);
return Gamma(a) - GammaQ_cf<T, false>(a, x);
}
}
// Q(a, x) and Gamma(a, x)
template<typename T, bool by_Gamma_a>
TRNG_CUDA_ENABLE T GammaQ(T a, T x) {
if (x < 0 or a <= 0)
return numeric_limits<T>::signaling_NaN();
#if __cplusplus >= 201703L
if constexpr (by_Gamma_a) {
#else
if (by_Gamma_a) {
#endif
if (x < a + 1)
return T{1} - GammaP_ser<T, true>(a, x);
return GammaQ_cf<T, true>(a, x);
} else {
if (x < a + 1)
return Gamma(a) - GammaP_ser<T, false>(a, x);
return GammaQ_cf<T, false>(a, x);
}
}
} // namespace detail
// P(x, a)
TRNG_CUDA_ENABLE
inline float GammaP(float a, float x) { return detail::GammaP<float, true>(a, x); }
TRNG_CUDA_ENABLE
inline double GammaP(double a, double x) { return detail::GammaP<double, true>(a, x); }
#if !(defined __CUDA_ARCH__)
inline long double GammaP(long double a, long double x) {
return detail::GammaP<long double, true>(a, x);
}
#endif
// Q(x, a)
TRNG_CUDA_ENABLE
inline float GammaQ(float a, float x) { return detail::GammaQ<float, true>(a, x); }
TRNG_CUDA_ENABLE
inline double GammaQ(double a, double x) { return detail::GammaQ<double, true>(a, x); }
#if !(defined __CUDA_ARCH__)
inline long double GammaQ(long double a, long double x) {
return detail::GammaQ<long double, true>(a, x);
}
#endif
// gamma(x, a)
TRNG_CUDA_ENABLE
inline float inc_gamma(float a, float x) { return detail::GammaP<float, false>(a, x); }
TRNG_CUDA_ENABLE
inline double inc_gamma(double a, double x) { return detail::GammaP<double, false>(a, x); }
#if !(defined __CUDA_ARCH__)
inline long double inc_gamma(long double a, long double x) {
return detail::GammaP<long double, false>(a, x);
}
#endif
// Gamma(x, a)
TRNG_CUDA_ENABLE
inline float inc_Gamma(float a, float x) { return detail::GammaQ<float, false>(a, x); }
TRNG_CUDA_ENABLE
inline double inc_Gamma(double a, double x) { return detail::GammaQ<double, false>(a, x); }
#if !(defined __CUDA_ARCH__)
inline long double inc_Gamma(long double a, long double x) {
return detail::GammaQ<long double, false>(a, x);
}
#endif
namespace detail {
// compute inverse of the incomplete Gamma function p = P(a, x), see "Numerical Recipes"
// by W. H. Press et al., 3rd edition
template<typename T>
TRNG_CUDA_ENABLE T inv_GammaP(T a, T p) {
const T eps{sqrt(numeric_limits<T>::epsilon())};
T a1{a - 1};
T glna{ln_Gamma(a)};
T lna1{ln(a1)};
T afac{exp(a1 * (lna1 - 1) - glna)};
T x;
// initial guess
if (a > T{1}) {
const T pp{p < T{1} / T{2} ? p : 1 - p};
const T t = {sqrt(-2 * ln(pp))};
x = (T{2.30753} + t * T{0.27061}) / (1 + t * (T{0.99229} + t * T{0.04481})) - t;
x = p < T{1} / T{2} ? -x : x;
x = utility::max(T{1} / T{1000}, a * pow(1 - 1 / (9 * a) - x / (3 * sqrt(a)), T{3}));
} else {
const T t{1 - a * (T{0.253} + a * T{0.12})};
x = p < t ? pow(p / t, 1 / a) : 1 - ln1p(-(p - t) / (1 - t));
}
// refinement by Halley's method
for (int i{0}; i < 32; ++i) {
if (x <= 0) {
x = 0;
break;
}
const T err{GammaP<T, true>(a, x) - p};
T t;
if (a > 1)
t = afac * exp(-(x - a1) + a1 * (ln(x) - lna1));
else
t = exp(-x + a1 * ln(x) - glna);
const T u{err / t};
t = u / (1 - utility::min(T{1}, u * ((a - 1) / x - 1)) / 2);
x -= t;
x = x <= 0 ? (x + t) / 2 : x;
if (abs(t) < eps * x)
break;
}
return x;
}
} // namespace detail
// inverse of GammaP
TRNG_CUDA_ENABLE
inline float inv_GammaP(float a, float p) { return detail::inv_GammaP(a, p); }
// inverse of GammaP
TRNG_CUDA_ENABLE
inline double inv_GammaP(double a, double p) { return detail::inv_GammaP(a, p); }
// inverse of GammaP
#if !(defined __CUDA_ARCH__)
inline long double inv_GammaP(long double a, long double p) {
return detail::inv_GammaP(a, p);
}
#endif
// --- regularized incomplete Beta function ------------------------
// see Applied Statistics (1973), vol.22, no.3, pp.409--411
// algorithm AS 63
namespace detail {
template<typename T>
TRNG_CUDA_ENABLE T Beta_I(T x, T p, T q, T norm) {
if (p <= 0 or q <= 0 or x < 0 or x > 1) {
#if !(defined __CUDA_ARCH__)
errno = EDOM;
#endif
return numeric_limits<T>::quiet_NaN();
}
const T eps{4 * numeric_limits<T>::epsilon()};
T psq{p + q}, cx{1 - x};
const bool flag{p < psq * x};
if (flag) {
// use I(x, p, q) = 1 - I(1 - x, q, p)
utility::swap(x, cx);
utility::swap(p, q);
}
T term{1}, i{1}, y{1}, rx{x / cx}, temp{q - i};
int s{static_cast<int>(q + cx * psq)};
if (s == 0)
rx = x;
while (true) {
term *= temp * rx / (p + i);
y += term;
temp = abs(term);
if (temp <= eps and temp <= eps * y)
break;
++i;
--s;
if (s >= 0) {
temp = q - i;
if (s == 0)
rx = x;
} else {
temp = psq;
psq++;
}
}
y *= exp(p * ln(x) + (q - 1) * ln(cx)) / p / norm;
return flag ? 1 - y : y;
}
} // namespace detail
TRNG_CUDA_ENABLE
inline float Beta_I(float x, float p, float q, float norm) {
return detail::Beta_I(x, p, q, norm);
}
TRNG_CUDA_ENABLE
inline float Beta_I(float x, float p, float q) {
return detail::Beta_I(x, p, q, Beta(p, q));
}
TRNG_CUDA_ENABLE
inline double Beta_I(double x, double p, double q, double norm) {
return detail::Beta_I(x, p, q, norm);
}
TRNG_CUDA_ENABLE
inline double Beta_I(double x, double p, double q) {
return detail::Beta_I(x, p, q, Beta(p, q));
}
#if !(defined __CUDA_ARCH__)
inline long double Beta_I(long double x, long double p, long double q, long double norm) {
return detail::Beta_I(x, p, q, norm);
}
inline long double Beta_I(long double x, long double p, long double q) {
return detail::Beta_I(x, p, q, Beta(p, q));
}
#endif
// --- inverse of regularized incomplete Beta function -------------
namespace detail {
template<typename T>
TRNG_CUDA_ENABLE inline T inv_Beta_I(T x, T p, T q, T norm) {
if (x < numeric_limits<T>::epsilon())
return 0;
if (1 - x < numeric_limits<T>::epsilon())
return 1;
// solve via Newton method
T y{0};
if (2 * p >= 1 and 2 * q >= 1)
y = (3 * p - 1) / (3 * p + 3 * q - 2); // the approximate median
else {
// following initial guess given in "Numerical Recipes" by W. H. Press et al., 3rd
// edition
const T lnp{ln(p / (p + q))};
const T lnq{ln(q / (p + q))};
const T t{exp(p * lnp) / p};
const T u{exp(q * lnq) / q};
const T w{t + u};
if (x < t / w)
y = pow(p * w * x, 1 / p);
else
y = 1 - pow(q * w * (1 - x), 1 / q);
}
for (int i{0}; i < numeric_limits<T>::digits; ++i) {
const T f{Beta_I(y, p, q, norm) - x};
const T df{pow(1 - y, q - 1) * pow(y, p - 1) / norm};
T dy(f / df);
if (abs(f / y) < 2 * numeric_limits<T>::epsilon())
break;
// avoid overshooting
while (y - dy <= 0 or y - dy >= 1)
dy *= T{3} / T{4};
y -= dy;
}
return y;
}
} // namespace detail
TRNG_CUDA_ENABLE
inline float inv_Beta_I(float x, float p, float q, float norm) {
return detail::inv_Beta_I(x, p, q, norm);
}
TRNG_CUDA_ENABLE
inline float inv_Beta_I(float x, float p, float q) {
return detail::inv_Beta_I(x, p, q, Beta(p, q));
}
TRNG_CUDA_ENABLE
inline double inv_Beta_I(double x, double p, double q, double norm) {
return detail::inv_Beta_I(x, p, q, norm);
}
TRNG_CUDA_ENABLE
inline double inv_Beta_I(double x, double p, double q) {
return detail::inv_Beta_I(x, p, q, Beta(p, q));
}
#if !(defined __CUDA_ARCH__)
inline long double inv_Beta_I(long double x, long double p, long double q,
long double norm) {
return detail::inv_Beta_I(x, p, q, norm);
}
inline long double inv_Beta_I(long double x, long double p, long double q) {
return detail::inv_Beta_I(x, p, q, Beta(p, q));
}
#endif
// --- error function and complementary error function--------------
using ::std::erf;
using ::std::erfc;
// --- normal distribution function -------------------------------
TRNG_CUDA_ENABLE
inline float Phi(float x) {
x *= constants<float>::one_over_sqrt_2;
if (x < -0.6744897501960817f * constants<float>::one_over_sqrt_2)
return 0.5f * erfc(-x);
if (x > +0.6744897501960817f * constants<float>::one_over_sqrt_2)
return 1.0f - 0.5f * erfc(x);
return 0.5f + 0.5f * erf(x);
}
TRNG_CUDA_ENABLE
inline double Phi(double x) {
x *= constants<double>::one_over_sqrt_2;
if (x < -0.6744897501960817 * constants<double>::one_over_sqrt_2)
return 0.5 * erfc(-x);
if (x > +0.6744897501960817 * constants<double>::one_over_sqrt_2)
return 1.0 - 0.5 * erfc(x);
return 0.5 + 0.5 * erf(x);
}
#if !(defined __CUDA_ARCH__)
inline long double Phi(long double x) {
x *= constants<long double>::one_over_sqrt_2;
if (x < -0.6744897501960817l * constants<long double>::one_over_sqrt_2)
return 0.5l * erfc(-x);
if (x > +0.6744897501960817l * constants<long double>::one_over_sqrt_2)
return 1.0l - 0.5l * erfc(x);
return 0.5l + 0.5l * erf(x);
}
#endif
// --- inverse of normal distribution function --------------------
// this function is based on an approximation by Peter J. Acklam
// see http://home.online.no/~pjacklam/notes/invnorm/ or
// https://web.archive.org/web/20151030215612/http://home.online.no/~pjacklam/notes/invnorm/
// for details
namespace detail {
template<typename T>
struct inv_Phi_traits {
static constexpr T a[6]{
static_cast<T>(-3.969683028665376e+01l), static_cast<T>(2.209460984245205e+02l),
static_cast<T>(-2.759285104469687e+02l), static_cast<T>(1.383577518672690e+02l),
static_cast<T>(-3.066479806614716e+01l), static_cast<T>(2.506628277459239e+00l)};
static constexpr T b[5]{
static_cast<T>(-5.447609879822406e+01l), static_cast<T>(1.615858368580409e+02l),
static_cast<T>(-1.556989798598866e+02l), static_cast<T>(6.680131188771972e+01l),
static_cast<T>(-1.328068155288572e+01l)};
static constexpr T c[6]{
static_cast<T>(-7.784894002430293e-03l), static_cast<T>(-3.223964580411365e-01l),
static_cast<T>(-2.400758277161838e+00l), static_cast<T>(-2.549732539343734e+00l),
static_cast<T>(4.374664141464968e+00l), static_cast<T>(2.938163982698783e+00l)};
static constexpr T d[4]{
static_cast<T>(7.784695709041462e-03l), static_cast<T>(3.224671290700398e-01l),
static_cast<T>(2.445134137142996e+00l), static_cast<T>(3.754408661907416e+00l)};
static constexpr T x_low = static_cast<T>(0.02425l);
static constexpr T x_high = static_cast<T>(1.0l - 0.02425l);
static constexpr T one_half = static_cast<T>(0.5l);
};
template<typename T>
constexpr T inv_Phi_traits<T>::a[6];
template<typename T>
constexpr T inv_Phi_traits<T>::b[5];
template<typename T>
constexpr T inv_Phi_traits<T>::c[6];
template<typename T>
constexpr T inv_Phi_traits<T>::d[4];
// ---------------------------------------------------------------
template<typename T>
TRNG_CUDA_ENABLE T inv_Phi_approx(T x) {
using traits = inv_Phi_traits<T>;
if (x < 0 or x > 1) {
#if !(defined __CUDA_ARCH__)
errno = EDOM;
#endif
return numeric_limits<T>::quiet_NaN();
}
if (x == 0)
return -numeric_limits<T>::infinity();
if (x == 1)
return numeric_limits<T>::infinity();
if (x < traits::x_low) {
// rational approximation for lower region
const T q{sqrt(-2 * ln(x))};
return (((((traits::c[0] * q + traits::c[1]) * q + traits::c[2]) * q + traits::c[3]) *
q +
traits::c[4]) *
q +
traits::c[5]) /
((((traits::d[0] * q + traits::d[1]) * q + traits::d[2]) * q + traits::d[3]) *
q +
1);
} else if (x < traits::x_high) {
// rational approximation for central region
const T q{x - traits::one_half};
const T r{q * q};
return (((((traits::a[0] * r + traits::a[1]) * r + traits::a[2]) * r + traits::a[3]) *
r +
traits::a[4]) *
r +
traits::a[5]) *
q /
(((((traits::b[0] * r + traits::b[1]) * r + traits::b[2]) * r + traits::b[3]) *
r +
traits::b[4]) *
r +
1);
} else {
// rational approximation for upper region
const T q{sqrt(-2 * ln1p(-x))};
return -(((((traits::c[0] * q + traits::c[1]) * q + traits::c[2]) * q +
traits::c[3]) *
q +
traits::c[4]) *
q +
traits::c[5]) /
((((traits::d[0] * q + traits::d[1]) * q + traits::d[2]) * q + traits::d[3]) *
q +
1);
}
}
template<typename T>
TRNG_CUDA_ENABLE T inv_Phi(T x) {
using traits = inv_Phi_traits<T>;
T y{inv_Phi_approx(x)};
// refinement by Halley rational method
if (isfinite(y)) {
const T e{(Phi(y) - x)};
const T u{e * constants<T>::sqrt_2pi * exp(y * y * traits::one_half)};
y -= u / (1 + y * u * traits::one_half);
}
// T is a floating point number type with more than 80 bits, a 2nd iteration is
// required to reach full machine precision
#if __cplusplus >= 201703L
if constexpr (sizeof(T) > 10) {
#else
#if _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4127)
#endif
if (sizeof(T) > 10) {
#if _MSC_VER
#pragma warning(pop)
#endif
#endif
if (isfinite(y)) {
const T e{(Phi(y) - x)};
const T u{e * constants<T>::sqrt_2pi * exp(y * y * traits::one_half)};
y -= u / (1 + y * u * traits::one_half);
}
}
return y;
}
template<typename T>
TRNG_CUDA_ENABLE T inv_erf(T x) {
T y{inv_Phi_approx((x + 1) / 2) * constants<T>::one_over_sqrt_2};
// refinement by Halley rational method
if (isfinite(y)) {
const T e{erf(y) - x};
const T u{e * (constants<T>::sqrt_pi_over_2) * exp(y * y)};
y -= u / (1 + y * u);
}
// T is a floating point number type with more than 80 bits, a 2nd iteration is
// required to reach full machine precision
#if __cplusplus >= 201703L
if constexpr (sizeof(T) > 10) {
#else
#if _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4127)
#endif
if (sizeof(T) > 10) {
#if _MSC_VER
#pragma warning(pop)
#endif
#endif
if (isfinite(y)) {
const T e{erf(y) - x};
const T u{e * (constants<T>::sqrt_pi_over_2) * exp(y * y)};
y -= u / (1 + y * u);
}
}
return y;
}
template<typename T>
TRNG_CUDA_ENABLE T inv_erfc(T x) {
// step size in the Halley step is proportional to erfc, use symmetry to increase
// numerical accuracy
const bool flag{x > 1};
if (flag)
x = -(x - 1) + 1;
T y{-inv_Phi_approx(x / 2) * constants<T>::one_over_sqrt_2};
// refinement by Halley rational method
if (isfinite(y)) {
const T e{erfc(y) - x};
const T u{-e * (constants<T>::sqrt_pi_over_2) * exp(y * y)};
y -= u / (1 + y * u);
}
// T is a floating point number type with more than 80 bits, a 2nd iteration is
// required to reach full machine precision
#if __cplusplus >= 201703L
if constexpr (sizeof(T) > 10) {
#else
#if _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4127)
#endif
if (sizeof(T) > 10) {
#if _MSC_VER
#pragma warning(pop)
#endif
#endif
if (isfinite(y)) {
const T e{erfc(y) - x};
const T u{-e * (constants<T>::sqrt_pi_over_2) * exp(y * y)};
y -= u / (1 + y * u);
}
}
return flag ? -y : y;
}
} // namespace detail
TRNG_CUDA_ENABLE
inline float inv_Phi(float x) { return detail::inv_Phi<float>(x); }
TRNG_CUDA_ENABLE
inline double inv_Phi(double x) { return detail::inv_Phi<double>(x); }
#if !(defined __CUDA_ARCH__)
inline long double inv_Phi(long double x) { return detail::inv_Phi<long double>(x); }
#endif
// --- inverse of error function ----------------------------------
TRNG_CUDA_ENABLE
inline float inv_erf(float x) { return detail::inv_erf(x); }
TRNG_CUDA_ENABLE
inline double inv_erf(double x) { return detail::inv_erf(x); }
#if !(defined __CUDA_ARCH__)
inline long double inv_erf(long double x) { return detail::inv_erf(x); }
#endif
// --- inverse of complementary error function --------------------
TRNG_CUDA_ENABLE
inline float inv_erfc(float x) { return detail::inv_erfc(x); }
TRNG_CUDA_ENABLE
inline double inv_erfc(double x) { return detail::inv_erfc(x); }
#if !(defined __CUDA_ARCH__)
inline long double inv_erfc(long double x) { return detail::inv_erfc(x); }
#endif
} // namespace math
} // namespace trng
#endif
| 32.324969 | 96 | 0.539922 | mminutoli |
e0cc0f854c7d5aea69285822c51d07e14dfecbcd | 2,135 | cpp | C++ | polymorphism/cpp/volatility.cpp | DonatienB/cpp_dauphine | 530f9e62054675de0c075496e8695491988298e3 | [
"BSD-3-Clause"
] | null | null | null | polymorphism/cpp/volatility.cpp | DonatienB/cpp_dauphine | 530f9e62054675de0c075496e8695491988298e3 | [
"BSD-3-Clause"
] | null | null | null | polymorphism/cpp/volatility.cpp | DonatienB/cpp_dauphine | 530f9e62054675de0c075496e8695491988298e3 | [
"BSD-3-Clause"
] | null | null | null | #include "volatility.hpp"
#include <iostream>
namespace dauphine
{
/*****************************
* volatility implementation *
*****************************/
volatility::volatility(const std::string& name)
: m_name(name)
{
std::cout << "volatility constructor" << std::endl;
}
volatility::~volatility()
{
std::cout << "volatility destructor" << std::endl;
}
const std::string& volatility::underlying_name() const
{
return m_name;
}
/*************************************
* implied_volatility implementation *
*************************************/
implied_volatility::implied_volatility(const std::string& name, const std::vector<double>& vol)
: volatility(name), m_volatility(vol)
{
std::cout << "implied_volatility constructor" << std::endl;
}
implied_volatility::~implied_volatility()
{
std::cout << "implied_volatility destructor" << std::endl;
}
double implied_volatility::get_volatility(size_t index) const
{
return m_volatility[index];
}
/************************************
* bumped_volatility implementation *
************************************/
bumped_volatility::bumped_volatility(volatility* vol, double bump)
: volatility(vol->underlying_name()), p_volatility(vol), m_bump(bump)
{
std::cout << "bumped_volatility constructor" << std::endl;
}
bumped_volatility::~bumped_volatility()
{
std::cout << "bumped_volatility destructor" << std::endl;
}
double bumped_volatility::get_volatility(size_t index) const
{
return p_volatility->get_volatility(index) + m_bump;
}
/**********************************
* make_volatility implementation *
**********************************/
volatility* make_volatility(const std::string& ud, const std::vector<double>& vol)
{
return new implied_volatility(ud, vol);
}
volatility* make_volatility(volatility* vol, double bump)
{
return new bumped_volatility(vol, bump);
}
}
| 26.036585 | 99 | 0.545667 | DonatienB |
e0ccc49dffbbd481127e49788f840ba4c88eab48 | 7,336 | cc | C++ | src/cpu/power/ppred_stat.cc | JimmyZhang12/gem5 | 34a009b9f7f33667cc230ac7f7ebfb8705718c5d | [
"BSD-3-Clause"
] | null | null | null | src/cpu/power/ppred_stat.cc | JimmyZhang12/gem5 | 34a009b9f7f33667cc230ac7f7ebfb8705718c5d | [
"BSD-3-Clause"
] | null | null | null | src/cpu/power/ppred_stat.cc | JimmyZhang12/gem5 | 34a009b9f7f33667cc230ac7f7ebfb8705718c5d | [
"BSD-3-Clause"
] | null | null | null | /*
* Copyright (c) 2020, University of Illinois
* All rights reserved
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met: redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer;
* redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution;
* neither the name of the copyright holders 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.
*
* Authors: Andrew Smith
*/
#include "cpu/power/ppred_stat.hh"
#include "cpu/power/ppred_unit.hh"
#include <iostream>
#include "arch/isa_traits.hh"
#include "arch/types.hh"
#include "arch/utility.hh"
#include "base/trace.hh"
#include "config/the_isa.hh"
#include "debug/PPredStat.hh"
#include <chrono>
using namespace std::chrono;
PPredStat::PPredStat(const PPredStatParams *params):
ClockedObject(params),
tickEvent([this]{ tick(); }, "PPredStat tick", false, Event::Power_Event_Pri),
clkDomain(params->stat_clk_domain),
cycles(params->cycles_per_stat_dump),
num_dumps(params->num_dumps),
normal_freq(params->frequency),
throttle_freq(params->throttle_freq),
ncores(params->ncores),
mcpat_output_path(params->mcpat_output_path),
gem5_output_path(params->gem5_output_path),
debug_print_delay(params->debug_print_delay),
power_start_delay(params->power_start_delay),
run_verilog(params->run_verilog),
save_data(params->save_data),
debug_throttle(params->debug_throttle),
mp(save_data, gem5_output_path),
_pdn(
pdn(
params->ind,
params->cap,
params->res,
params->vdc,
params->frequency)),
power_data(gem5_output_path, "power"),
volt_data(gem5_output_path, "voltage"),
mispredict_data(gem5_output_path, "mispredict"),
fetch_data(gem5_output_path, "fetch"),
decodestatus_data(gem5_output_path, "decodestatus"),
fetchstatus_data(gem5_output_path, "fetchstatus"),
historyreg_data(gem5_output_path, "historyreg")
{
xml_path = mcpat_output_path + "/serial_mp.xml";
first_time = true;
mcpat_ready = false;
begin = false;
}
void
PPredStat::init(void){
Stats::reset();
first_time = false;
}
bool
PPredStat::is_first_time(void){
return first_time;
}
bool
PPredStat::get_begin(uint64_t num_cycles) const {
return begin;
}
/**
* Global Stat Dump
*/
void
PPredStat::tick(void){
if (Stats::pythonGetProfiling()) { //TODO move pythonGetProfiling to C++ side only
begin = true; //allow powerpred to start ticking
count++;
if (!mcpat_ready){
Stats::pythonGenerateXML(normal_freq);
mp.init(xml_path, save_data);
frequency = normal_freq;
clk_change(frequency);
if(run_verilog)
static_cast<void>(run_debug());
}
mp.init_wrapper(xml_path, mcpat_output_path);
if (!mcpat_ready){ //TODO FIX THE INITIAZATION OF MCPAT STATS SO YOU DONT GET HUGE POWER ON FIRST CYCLE
mcpat_ready = true;
mp.power = 10;
}
current = _pdn.get_current(mp.power);
voltage = _pdn.get_voltage(mp.power);
if(save_data){
power_data.save_data((float) mp.power);
volt_data.save_data((float) voltage);
}
//dump stats every cycle number of ticks
if (count % cycles == 0){
flush_savedata();
Stats::dump();
}
if (run_verilog){
if (debug_print_delay > 0){
if (count < debug_print_delay)
run_debug(); //also does a reset
}
else{
run_debug();
}
}
} //pythonGetProfiling()
else{
count_init++;
if (count_init % 2000000 == 0)
std::cout << "CPU Sim Only... at cycle "<<count_init << '\n';
if (count_init > power_start_delay && power_start_delay>=0){
enable_savedata();
std::cout << "Ppred stat python begin profile\n";
Stats::pythonBeginProfile();
Stats::reset();
}
}
}
/**
* get_begin:
* @return True if stats have begun
*/
void
PPredStat::run_debug() {
std::cout<<"**********CYCLE: " << count << " *****" << std::endl;
std::cout<<"******mcpat proc_internal:" << std::endl;
mp.save_output(mcpat_output_path);
mp.print_power();
std::cout << "---power = :" << mp.power << "\n";
std::cout << "---supply_current = :" << current << "\n";
std::cout << "---supply_voltage = :" << voltage << "\n";
if(run_verilog){
_pdn.print_params();
std::cout<<"******mcpat proc external:" << std::endl;
double verilog_power = Stats::runVerilog();
std::cout << "---verilog_power = :" << verilog_power << "\n";
// std::cout<<"******mcpat internal w serialization:" << std::endl;
// std::string xml_path_serial = mcpat_output_path + "/mp.xml";
// verilog_power = mp.run_with_xml(xml_path_serial, mcpat_output_path);
mp.reset_stats();
mp.stat_storage = Mcpat::_stat_storage();
mp.stat_storage_prev = Mcpat::_stat_storage_prev();
mp.proc.XML->reset_stats();
// if (std::abs(verilog_power - mp.power) > 0.1){
// std::cout << '\n' << "Press a key to continue...";
// do {
// } while (cin.get() != '\n');
// }
}
// else{
// std::cout << '\n' << "Press a key to continue...";
// do {
// } while (cin.get() != '\n');
// }
}
void
PPredStat::vdd_change(double new_vdd){
mp.vdd_change(new_vdd);
_pdn.vdd_change(new_vdd);
}
void
PPredStat::clk_change(double new_clk){
_pdn.clk_change(new_clk);
mp.clk_change(new_clk/1e6); //mcpat clk is in mHz
}
void
PPredStat::set_powerPred(PPredUnit* powerPred){
this->powerPred = powerPred;
mp.powerPred = powerPred;
}
void
PPredStat::flush_savedata(){
if(save_data){
power_data.data_to_file();
volt_data.data_to_file();
mp.stat_data.data_to_file();
mispredict_data.data_to_file();
fetch_data.data_to_file();
decodestatus_data.data_to_file();
fetchstatus_data.data_to_file();
historyreg_data.data_to_file();
}
}
void
PPredStat::enable_savedata(){
if(save_data){
power_data.enable();
volt_data.enable();
mispredict_data.enable();
mp.stat_data.enable();
fetch_data.enable();
decodestatus_data.enable();
fetchstatus_data.enable();
historyreg_data.enable();
}
}
PPredStat*
PPredStatParams::create()
{
return new PPredStat(this);
}
| 27.070111 | 107 | 0.676799 | JimmyZhang12 |
e0d15de572b1b9628e0974d02df5dcef9fb20fcd | 7,416 | cpp | C++ | Hash3/Hash3/Hash.cpp | Phetlada/learn-Cplusplus | 3e33a4fd6553bc36eec7a7be02db75c327401df7 | [
"MIT"
] | null | null | null | Hash3/Hash3/Hash.cpp | Phetlada/learn-Cplusplus | 3e33a4fd6553bc36eec7a7be02db75c327401df7 | [
"MIT"
] | null | null | null | Hash3/Hash3/Hash.cpp | Phetlada/learn-Cplusplus | 3e33a4fd6553bc36eec7a7be02db75c327401df7 | [
"MIT"
] | null | null | null | #include<iomanip>
#include<iostream>
#include<string>
#include<vector>
using namespace std;
template <class HashedObj>
class HashTable
{
public:
explicit HashTable(const HashedObj & notFound, int size = 31);
HashTable(const HashTable & rhs)
: currentSize(rhs.currentSize), ITEM_NOT_FOUND(rhs.ITEM_NOT_FOUND),
array(rhs.array) {}
HashedObj find(HashedObj & x);
void makeEmpty();
void insert( HashedObj & x);
void remove( HashedObj & x);
const HashTable & operator=(const HashTable & rhs);
enum EntryType { ACTIVE, EMPTY, DELETED };
//
void create(int size);
int nextPrime(int size);
int beforePrime(int size);
void printTable();
private:
struct HashEntry
{
HashedObj element;
EntryType info;
HashEntry(const HashedObj & e = HashedObj(),
EntryType i = EMPTY) : element(e), info(i) { }
};
vector<HashEntry> array;
int currentSize;
const HashedObj ITEM_NOT_FOUND;
bool isActive(int currentPos) const;
int findPos(HashedObj & x);
void rehash();
int hash(int x, int tableSize);
int hash2(int x);
};
//consturctor
template <class HashedObj>
HashTable <HashedObj>::HashTable(const HashedObj & notFound, int size)
: ITEM_NOT_FOUND(notFound), array(nextPrime(size))
{
makeEmpty();
}
//create table
template <class HashedObj>
void HashTable <HashedObj>::create(int size){
array.resize(size);
makeEmpty();
}
template <class HashedObj>
void HashTable <HashedObj>::makeEmpty()
{
currentSize = 0;
for (int i = 0; i<array.size(); i++){
array[i].element = 0;
array[i].info = EMPTY;
}
}
template <class HashedObj>
bool HashTable <HashedObj>::isActive( int currentPos) const
{
return array[ currentPos ].info == ACTIVE;
}
template <class HashedObj>
int HashTable <HashedObj>::nextPrime(int size){
int prime = 0;
while(size % 2 == 0 || size == 2)
size++;
for(int i = 1; i <= size; i++)
{
if(size % i == 0)
prime++;
}
if(prime == 2)
return size;
else
return nextPrime(size+2);
}
template <class HashedObj>
int HashTable <HashedObj>::beforePrime(int size){
int prime = 0;
while(size % 2 == 0)
size--;
for(int i = 1; i <= size; i++)
{
if(size % i == 0)
prime++;
}
if(prime == 2)
return size;
else
return beforePrime(size-2);
}
template <class HashedObj>
int HashTable <HashedObj>::hash(int x, int tableSize){
return x % tableSize;
}
template <class HashedObj>
int HashTable <HashedObj>::hash2(int x){
int r = beforePrime(array.size()-1);
return r - (x % r);
}
template <class HashedObj>
int HashTable <HashedObj>::findPos( HashedObj & x )
{
int collisionNum = 0;
int currentPos = hash(x, array.size());
while( array[ currentPos ].info != EMPTY && array[ currentPos ].element != x){
currentPos =
( hash(x, array.size()) + (++collisionNum * hash2(x)) ) % array.size();
if(currentPos >= array.size())
currentPos -= array.size();
}
return currentPos;
}
template <class HashedObj>
void HashTable <HashedObj>::insert( HashedObj & x)
{
int currentPos = findPos(x);
if( isActive( currentPos ) ) return;
array[currentPos] = HashEntry(x, ACTIVE);
if (++currentSize > (array.size() * 0.7))
rehash();
}
template <class HashedObj>
void HashTable <HashedObj>::rehash(){
vector<HashEntry> oldTable = array;
array.resize(nextPrime(2 * oldTable.size()));
makeEmpty();
for (int i = 0; i < oldTable.size(); i++)
if (oldTable[i].info == ACTIVE)
insert(oldTable[i].element);
}
template <class HashedObj>
void HashTable <HashedObj>::remove(HashedObj & x)
{
int currentPos = findPos( x );
if( isActive( currentPos ) )
array[ currentPos ].info = DELETED;
currentSize--;
}
template <class HashedObj>
HashedObj HashTable <HashedObj>::find(HashedObj & x)
{
int currentPos = findPos( x );
if( isActive( currentPos ) )
return array[ currentPos ].element;
else return ITEM_NOT_FOUND;
}
template <class HashedObj>
void HashTable <HashedObj>::printTable(){
cout << setfill('=') << "\t" << setw(43) << "" << endl << setfill(' ');
cout << "\t[ " << setw(4) << "N0." << " ]" << setw(5);
cout << "\t[ " << setw(7) << "Element" << " ]" << setw(5);
cout << "\t[ " << setw(7) << "Status" << " ]" << endl;
cout << setfill('=') << "\t" << setw(43) << "" << endl << setfill(' ');
for(int i = 0; i < array.size(); i++){
string status = (array[i].info == 0)? "ACTIVE" :
(array[i].info == 1)? "EMPTY" : "DELETED";
cout << "\t[ " << setw(4) << i << " ]" << setw(5);
cout << "\t[ " << setw(7) << array[i].element << " ]" << setw(5);
cout << "\t[ " << setw(7) << status << " ]" << endl;
}
}
void main(){
const int ITEM_NOT_FOUND = -999;
HashTable <int> a(ITEM_NOT_FOUND);
string choice;
bool exit = false;
bool createTable = false;
do{
system("cls");
cout << "===============================\n";
cout << ".:: [ Hashing ] ::.\n";
cout << "===============================\n";
cout << " 1.) Create Hash Table\n";
cout << " 2.) Insert\n";
cout << " 3.) Print\n";
cout << " 4.) Remove\n";
cout << " 5.) Find\n";
cout << " 6.) Quit\n";
cout <<"Enter Choice : ";
cin >> choice;
switch(choice[0])
{
case '1':
int tableSize;
if(!createTable)
{
do{
cout << "\nEnter TableSize (1 - 30): ";
cin >> tableSize;
}while(tableSize > 30 || tableSize < 1);
a.create(a.nextPrime(tableSize));
cout << "Prime Number After " << tableSize;
cout << " is " << a.nextPrime(tableSize) << endl;
cout << "\nCreate Hash Table Sucessful . . ." << endl;
createTable = true;
}
else
cout << "\nYou already have Hash Table !!" << endl;
system("pause");
break;
case '2':
int insertNum;
if(createTable){
cout << "\nEnter Element to insert : ";
cin >> insertNum;
if(a.find(insertNum) != ITEM_NOT_FOUND)
{
cout << "\n" << insertNum << " are already in the table" << endl;
}
else{
a.insert(insertNum);
cout << "\nInsert " << insertNum << " is Sucessful . . ." << endl;
}
}
else
cout << "\nHash Table is unready !!" << endl;
system("pause");
break;
case '3':
if(createTable){
cout << setfill('=') << "\t" << setw(43) << "" << endl << setfill(' ');
cout << "\t.:: Hash Table ::." << endl;
a.printTable();
}
else
cout << "\nHash Table is unready !!" << endl;
system("pause");
break;
case '4':
int removeNum;
if(createTable){
cout << "\nEnter Element to Remove : ";
cin >> removeNum;
if(a.find(removeNum) != ITEM_NOT_FOUND){
a.remove(removeNum);
cout << "\nRemove " << removeNum << " is Sucessful . . ." << endl;
}
else
cout << "\nElement not found" << endl;
}
else
cout << "\nHash Table is unready !!" << endl;
system("pause");
break;
case '5':
int findNum, found;
if(createTable){
cout << "\nEnter Element to Find : ";
cin >> findNum;
found = a.find(findNum);
if(found == ITEM_NOT_FOUND)
cout << "\nElement not found" << endl;
else
cout << "\nFound " << findNum << " in Hash Table" << endl;
}
else
cout << "\nHash Table is unready !!" << endl;
cout << endl;
system("pause");
break;
case '6':
exit = true;
cout << "\nClose Program . . ." << endl;
break;
default:
cout << "\nNot Choice in menu. Please Try again." << endl;
system("pause");
break;
}
}while(!exit);
}
| 22.818462 | 79 | 0.582255 | Phetlada |
e0d295cc92fee109923784b34b0a7d4a826114af | 19,125 | cpp | C++ | test/test_SequentialTask.cpp | SkyZH/CAHRR | ab24d3e437962caf7e545dac135fafa7537c40b0 | [
"MIT"
] | null | null | null | test/test_SequentialTask.cpp | SkyZH/CAHRR | ab24d3e437962caf7e545dac135fafa7537c40b0 | [
"MIT"
] | 1 | 2018-10-27T02:48:35.000Z | 2018-10-27T02:50:35.000Z | test/test_SequentialTask.cpp | SkyZH/CAHRR | ab24d3e437962caf7e545dac135fafa7537c40b0 | [
"MIT"
] | null | null | null | //
// Created by Alex Chi on 2018/11/11.
//
#include "gtest/gtest.h"
#include "MockTask.h"
#include "SequentialTask.h"
#include <vector>
namespace {
class SequentialTaskTest : public ::testing::Test {
protected:
SequentialTaskTest() {
}
~SequentialTaskTest() override {
}
void SetUp() override {
}
};
class MockCompletableTask : public MockTask {
bool is_end = false;
public:
virtual bool destroy() {
this->is_end = false;
return MockTask::destroy();
}
virtual bool isEnd() {
return is_end;
}
void complete() { this->is_end = true; }
void ready() { this->is_end = false; }
};
TEST_F(SequentialTaskTest, TestInitialize) {
MockCompletableTask *task1 = new MockCompletableTask;
MockCompletableTask *task2 = new MockCompletableTask;
MockCompletableTask *task3 = new MockCompletableTask;
MockCompletableTask *task4 = new MockCompletableTask;
SequentialTask *task = new SequentialTask(std::vector <Task*> ({ task1, task2, task3, task4 }));
EXPECT_TRUE(task->initialize());
EXPECT_TRUE(task1->initialized);
EXPECT_FALSE(task2->initialized);
EXPECT_FALSE(task3->initialized);
EXPECT_FALSE(task4->initialized);
}
TEST_F(SequentialTaskTest, TestUpdate) {
MockCompletableTask *task1 = new MockCompletableTask;
MockCompletableTask *task2 = new MockCompletableTask;
MockCompletableTask *task3 = new MockCompletableTask;
MockCompletableTask *task4 = new MockCompletableTask;
SequentialTask *task = new SequentialTask(std::vector <Task*> ({ task1, task2, task3, task4 }));
EXPECT_TRUE(task->initialize());
EXPECT_TRUE(task1->initialized);
EXPECT_FALSE(task2->initialized);
EXPECT_FALSE(task3->initialized);
EXPECT_FALSE(task4->initialized);
EXPECT_EQ(task2->initialize_count, 0);
EXPECT_EQ(task1->initialize_count, 1);
EXPECT_TRUE(task->update());
EXPECT_EQ(task1->update_count, 1);
EXPECT_TRUE(task1->initialized);
task1->complete();
EXPECT_TRUE(task1->isEnd());
EXPECT_FALSE(task2->isEnd());
EXPECT_TRUE(task->update());
EXPECT_FALSE(task1->isEnd());
EXPECT_FALSE(task2->isEnd());
EXPECT_FALSE(task1->initialized);
EXPECT_TRUE(task2->initialized);
EXPECT_FALSE(task3->initialized);
EXPECT_FALSE(task4->initialized);
EXPECT_EQ(task2->initialize_count, 1);
EXPECT_EQ(task1->initialize_count, 1);
EXPECT_EQ(task2->update_count, 1);
task2->complete();
EXPECT_TRUE(task->update());
EXPECT_TRUE(task->update());
EXPECT_FALSE(task1->initialized);
EXPECT_FALSE(task2->initialized);
EXPECT_TRUE(task3->initialized);
EXPECT_FALSE(task4->initialized);
EXPECT_EQ(task3->update_count, 2);
task3->complete();
EXPECT_TRUE(task->update());
EXPECT_FALSE(task1->initialized);
EXPECT_FALSE(task2->initialized);
EXPECT_FALSE(task3->initialized);
EXPECT_TRUE(task4->initialized);
EXPECT_EQ(task4->update_count, 1);
task4->complete();
EXPECT_TRUE(task->update());
EXPECT_TRUE(task->update());
EXPECT_TRUE(task1->initialized);
EXPECT_FALSE(task2->initialized);
EXPECT_FALSE(task3->initialized);
EXPECT_FALSE(task4->initialized);
EXPECT_EQ(task1->update_count, 2);
}
void test_sequence_update(MockCompletableTask* task1, MockCompletableTask* task2, MockCompletableTask* task3, MockCompletableTask* task4, SequentialTask* task) {
EXPECT_FALSE(task->isEnd());
EXPECT_TRUE(task->update());
EXPECT_TRUE(task1->initialized);
EXPECT_FALSE(task2->initialized);
EXPECT_FALSE(task3->initialized);
EXPECT_FALSE(task4->initialized);
EXPECT_EQ(task1->update_count, 1);
EXPECT_FALSE(task->isEnd());
task1->complete();
EXPECT_TRUE(task->update());
EXPECT_FALSE(task1->initialized);
EXPECT_TRUE(task2->initialized);
EXPECT_FALSE(task3->initialized);
EXPECT_FALSE(task4->initialized);
EXPECT_EQ(task2->update_count, 1);
EXPECT_FALSE(task->isEnd());
task2->complete();
EXPECT_TRUE(task->update());
EXPECT_TRUE(task->update());
EXPECT_FALSE(task1->initialized);
EXPECT_FALSE(task2->initialized);
EXPECT_TRUE(task3->initialized);
EXPECT_FALSE(task4->initialized);
EXPECT_EQ(task3->update_count, 2);
EXPECT_FALSE(task->isEnd());
EXPECT_TRUE(task->update());
EXPECT_TRUE(task->update());
EXPECT_FALSE(task1->initialized);
EXPECT_FALSE(task2->initialized);
EXPECT_TRUE(task3->initialized);
EXPECT_FALSE(task4->initialized);
EXPECT_EQ(task3->update_count, 4);
EXPECT_FALSE(task->isEnd());
task3->complete();
EXPECT_TRUE(task->update());
EXPECT_TRUE(task->update());
EXPECT_TRUE(task->update());
EXPECT_FALSE(task1->initialized);
EXPECT_FALSE(task2->initialized);
EXPECT_FALSE(task3->initialized);
EXPECT_TRUE(task4->initialized);
EXPECT_EQ(task4->update_count, 3);
EXPECT_FALSE(task->isEnd());
task4->complete();
}
void test_sequence_update_complete(MockCompletableTask* task1, MockCompletableTask* task2, MockCompletableTask* task3, MockCompletableTask* task4, SequentialTask* task) {
EXPECT_FALSE(task->isEnd());
EXPECT_TRUE(task->update());
EXPECT_TRUE(task1->initialized);
EXPECT_FALSE(task2->initialized);
EXPECT_FALSE(task3->initialized);
EXPECT_FALSE(task4->initialized);
task4->ready();
EXPECT_EQ(task1->update_count, 1);
EXPECT_FALSE(task->isEnd());
task1->complete();
EXPECT_TRUE(task->update());
EXPECT_FALSE(task1->initialized);
EXPECT_TRUE(task2->initialized);
EXPECT_FALSE(task3->initialized);
EXPECT_FALSE(task4->initialized);
EXPECT_EQ(task2->update_count, 1);
task1->ready();
EXPECT_FALSE(task->isEnd());
task2->complete();
EXPECT_TRUE(task->update());
EXPECT_TRUE(task->update());
EXPECT_FALSE(task1->initialized);
EXPECT_FALSE(task2->initialized);
EXPECT_TRUE(task3->initialized);
EXPECT_FALSE(task4->initialized);
EXPECT_EQ(task3->update_count, 2);
task2->ready();
EXPECT_FALSE(task->isEnd());
EXPECT_TRUE(task->update());
EXPECT_TRUE(task->update());
EXPECT_FALSE(task1->initialized);
EXPECT_FALSE(task2->initialized);
EXPECT_TRUE(task3->initialized);
EXPECT_FALSE(task4->initialized);
EXPECT_EQ(task3->update_count, 4);
EXPECT_FALSE(task->isEnd());
task3->complete();
EXPECT_TRUE(task->update());
EXPECT_TRUE(task->update());
EXPECT_TRUE(task->update());
EXPECT_FALSE(task1->initialized);
EXPECT_FALSE(task2->initialized);
EXPECT_FALSE(task3->initialized);
EXPECT_TRUE(task4->initialized);
EXPECT_EQ(task4->update_count, 3);
task3->ready();
EXPECT_FALSE(task->isEnd());
task4->complete();
}
TEST_F(SequentialTaskTest, TestUpdateMulti) {
MockCompletableTask *task1 = new MockCompletableTask;
MockCompletableTask *task2 = new MockCompletableTask;
MockCompletableTask *task3 = new MockCompletableTask;
MockCompletableTask *task4 = new MockCompletableTask;
SequentialTask *task = new SequentialTask(std::vector <Task*> ({ task1, task2, task3, task4 }));
EXPECT_TRUE(task->initialize());
test_sequence_update(task1, task2, task3, task4, task);
test_sequence_update(task1, task2, task3, task4, task);
test_sequence_update(task1, task2, task3, task4, task);
EXPECT_TRUE(task->update());
EXPECT_FALSE(task->isEnd());
EXPECT_TRUE(task->destroy());
}
TEST_F(SequentialTaskTest, TestUpdateNoCycle) {
MockCompletableTask *task1 = new MockCompletableTask;
MockCompletableTask *task2 = new MockCompletableTask;
MockCompletableTask *task3 = new MockCompletableTask;
MockCompletableTask *task4 = new MockCompletableTask;
SequentialTask *task = new SequentialTask(std::vector <Task*> ({ task1, task2, task3, task4 }), false);
EXPECT_TRUE(task->initialize());
EXPECT_FALSE(task->isEnd());
test_sequence_update(task1, task2, task3, task4, task);
EXPECT_TRUE(task->update());
EXPECT_TRUE(task->isEnd());
EXPECT_TRUE(task->destroy());
}
TEST_F(SequentialTaskTest, TestCompleteUpdateMulti) {
MockCompletableTask *task1 = new MockCompletableTask;
MockCompletableTask *task2 = new MockCompletableTask;
MockCompletableTask *task3 = new MockCompletableTask;
MockCompletableTask *task4 = new MockCompletableTask;
SequentialTask *task = new SequentialTask(std::vector <Task*> ({ task1, task2, task3, task4 }));
EXPECT_TRUE(task->initialize());
test_sequence_update_complete(task1, task2, task3, task4, task);
test_sequence_update_complete(task1, task2, task3, task4, task);
test_sequence_update_complete(task1, task2, task3, task4, task);
EXPECT_TRUE(task->update());
EXPECT_FALSE(task->isEnd());
EXPECT_TRUE(task->destroy());
}
TEST_F(SequentialTaskTest, TestCompleteUpdateNoCycle) {
MockCompletableTask *task1 = new MockCompletableTask;
MockCompletableTask *task2 = new MockCompletableTask;
MockCompletableTask *task3 = new MockCompletableTask;
MockCompletableTask *task4 = new MockCompletableTask;
SequentialTask *task = new SequentialTask(std::vector <Task*> ({ task1, task2, task3, task4 }), false);
EXPECT_TRUE(task->initialize());
EXPECT_FALSE(task->isEnd());
test_sequence_update_complete(task1, task2, task3, task4, task);
EXPECT_TRUE(task->update());
EXPECT_TRUE(task->isEnd());
EXPECT_TRUE(task->destroy());
}
TEST_F(SequentialTaskTest, TestCompleteUpdateWithInterrupt) {
MockCompletableTask *task1 = new MockCompletableTask;
MockCompletableTask *task2 = new MockCompletableTask;
MockCompletableTask *task3 = new MockCompletableTask;
MockCompletableTask *task4 = new MockCompletableTask;
SequentialTask *task = new SequentialTask(std::vector <Task*> ({ task1, task2, task3, task4 }));
EXPECT_TRUE(task->initialize());
EXPECT_TRUE(task1->initialized);
EXPECT_FALSE(task2->initialized);
EXPECT_FALSE(task3->initialized);
EXPECT_FALSE(task4->initialized);
EXPECT_EQ(task2->initialize_count, 0);
EXPECT_EQ(task1->initialize_count, 1);
EXPECT_TRUE(task->update());
EXPECT_EQ(task1->update_count, 1);
EXPECT_TRUE(task1->initialized);
task1->complete();
EXPECT_TRUE(task->update());
EXPECT_FALSE(task1->initialized);
EXPECT_TRUE(task2->initialized);
EXPECT_FALSE(task3->initialized);
EXPECT_FALSE(task4->initialized);
EXPECT_EQ(task2->update_count, 1);
task1->ready();
EXPECT_FALSE(task->isEnd());
task2->complete();
EXPECT_TRUE(task->update());
EXPECT_TRUE(task->update());
EXPECT_FALSE(task1->initialized);
EXPECT_FALSE(task2->initialized);
EXPECT_TRUE(task3->initialized);
EXPECT_FALSE(task4->initialized);
EXPECT_EQ(task3->update_count, 2);
task2->ready();
EXPECT_FALSE(task->isEnd());
ASSERT_TRUE(task->destroy());
ASSERT_TRUE(task->initialize());
test_sequence_update_complete(task1, task2, task3, task4, task);
test_sequence_update_complete(task1, task2, task3, task4, task);
test_sequence_update_complete(task1, task2, task3, task4, task);
EXPECT_TRUE(task->update());
EXPECT_FALSE(task->isEnd());
EXPECT_TRUE(task->destroy());
}
TEST_F(SequentialTaskTest, TestCompleteUpdateNoCycleWithInterrupt) {
MockCompletableTask *task1 = new MockCompletableTask;
MockCompletableTask *task2 = new MockCompletableTask;
MockCompletableTask *task3 = new MockCompletableTask;
MockCompletableTask *task4 = new MockCompletableTask;
SequentialTask *task = new SequentialTask(std::vector <Task*> ({ task1, task2, task3, task4 }), false);
EXPECT_TRUE(task->initialize());
EXPECT_TRUE(task1->initialized);
EXPECT_FALSE(task2->initialized);
EXPECT_FALSE(task3->initialized);
EXPECT_FALSE(task4->initialized);
EXPECT_EQ(task2->initialize_count, 0);
EXPECT_EQ(task1->initialize_count, 1);
EXPECT_TRUE(task->update());
EXPECT_EQ(task1->update_count, 1);
EXPECT_TRUE(task1->initialized);
task1->complete();
EXPECT_TRUE(task->update());
EXPECT_FALSE(task1->initialized);
EXPECT_TRUE(task2->initialized);
EXPECT_FALSE(task3->initialized);
EXPECT_FALSE(task4->initialized);
EXPECT_EQ(task2->update_count, 1);
task1->ready();
EXPECT_FALSE(task->isEnd());
task2->complete();
EXPECT_TRUE(task->update());
EXPECT_TRUE(task->update());
EXPECT_FALSE(task1->initialized);
EXPECT_FALSE(task2->initialized);
EXPECT_TRUE(task3->initialized);
EXPECT_FALSE(task4->initialized);
EXPECT_EQ(task3->update_count, 2);
task2->ready();
EXPECT_FALSE(task->isEnd());
EXPECT_TRUE(task->update());
EXPECT_TRUE(task->update());
ASSERT_TRUE(task->destroy());
ASSERT_TRUE(task->initialize());
test_sequence_update(task1, task2, task3, task4, task);
EXPECT_TRUE(task->update());
EXPECT_TRUE(task->isEnd());
EXPECT_TRUE(task->destroy());
}
TEST_F(SequentialTaskTest, TestDestroy) {
MockCompletableTask *task1 = new MockCompletableTask;
MockCompletableTask *task2 = new MockCompletableTask;
MockCompletableTask *task3 = new MockCompletableTask;
MockCompletableTask *task4 = new MockCompletableTask;
SequentialTask *task = new SequentialTask(std::vector <Task*> ({ task1, task2, task3, task4 }));
EXPECT_TRUE(task->initialize());
EXPECT_TRUE(task->update());
EXPECT_TRUE(task->destroy());
}
TEST_F(SequentialTaskTest, TestSequenceInSequence) {
MockCompletableTask *task1 = new MockCompletableTask;
MockCompletableTask *task2 = new MockCompletableTask;
MockCompletableTask *task3 = new MockCompletableTask;
MockCompletableTask *task4 = new MockCompletableTask;
SequentialTask *taskS1 = new SequentialTask(std::vector <Task*> ({ task1, task2 }), false);
SequentialTask *taskS2 = new SequentialTask(std::vector <Task*> ({ task3, task4 }), false);
SequentialTask *task = new SequentialTask(std::vector <Task*> ({ taskS1, taskS2 }), false);
ASSERT_TRUE(task->initialize());
ASSERT_TRUE(task->update());
EXPECT_TRUE(task1->initialized);
EXPECT_FALSE(task2->initialized);
EXPECT_FALSE(task3->initialized);
EXPECT_FALSE(task4->initialized);
task1->complete();
ASSERT_TRUE(task->update());
ASSERT_TRUE(task->update());
EXPECT_FALSE(task1->initialized);
EXPECT_TRUE(task2->initialized);
EXPECT_FALSE(task3->initialized);
EXPECT_FALSE(task4->initialized);
task2->complete();
EXPECT_FALSE(task->isEnd());
task1->ready();
ASSERT_TRUE(task->update());
task2->ready();
ASSERT_TRUE(task->update());
EXPECT_FALSE(task->isEnd());
EXPECT_FALSE(task1->initialized);
EXPECT_FALSE(task2->initialized);
EXPECT_TRUE(task3->initialized);
EXPECT_FALSE(task4->initialized);
EXPECT_FALSE(task->isEnd());
task3->complete();
ASSERT_TRUE(task->update());
ASSERT_TRUE(task->update());
EXPECT_FALSE(task1->initialized);
EXPECT_FALSE(task2->initialized);
EXPECT_FALSE(task3->initialized);
EXPECT_TRUE(task4->initialized);
task3->ready();
EXPECT_FALSE(task->isEnd());
task4->complete();
ASSERT_TRUE(task->update());
ASSERT_TRUE(task->update());
EXPECT_TRUE(task->isEnd());
ASSERT_TRUE(task->destroy());
}
TEST_F(SequentialTaskTest, TestSequenceInSequenceCycle) {
MockCompletableTask *task1 = new MockCompletableTask;
MockCompletableTask *task2 = new MockCompletableTask;
MockCompletableTask *task3 = new MockCompletableTask;
MockCompletableTask *task4 = new MockCompletableTask;
SequentialTask *taskS1 = new SequentialTask(std::vector <Task*> ({ task1, task2 }), false);
SequentialTask *taskS2 = new SequentialTask(std::vector <Task*> ({ task3, task4 }), false);
SequentialTask *task = new SequentialTask(std::vector <Task*> ({ taskS1, taskS2 }), true);
ASSERT_TRUE(task->initialize());
for (int i = 0; i < 10; i++) {
ASSERT_TRUE(task->update());
EXPECT_TRUE(task1->initialized);
EXPECT_FALSE(task2->initialized);
EXPECT_FALSE(task3->initialized);
EXPECT_FALSE(task4->initialized);
task1->complete();
ASSERT_TRUE(task->update());
ASSERT_TRUE(task->update());
EXPECT_FALSE(task1->initialized);
EXPECT_TRUE(task2->initialized);
EXPECT_FALSE(task3->initialized);
EXPECT_FALSE(task4->initialized);
task2->complete();
EXPECT_FALSE(task->isEnd());
task1->ready();
ASSERT_TRUE(task->update());
task2->ready();
ASSERT_TRUE(task->update());
EXPECT_FALSE(task->isEnd());
EXPECT_FALSE(task1->initialized);
EXPECT_FALSE(task2->initialized);
EXPECT_TRUE(task3->initialized);
EXPECT_FALSE(task4->initialized);
EXPECT_FALSE(task->isEnd());
task3->complete();
ASSERT_TRUE(task->update());
ASSERT_TRUE(task->update());
EXPECT_FALSE(task1->initialized);
EXPECT_FALSE(task2->initialized);
EXPECT_FALSE(task3->initialized);
EXPECT_TRUE(task4->initialized);
task3->ready();
EXPECT_FALSE(task->isEnd());
task4->complete();
ASSERT_TRUE(task->update());
ASSERT_TRUE(task->update());
EXPECT_FALSE(task->isEnd());
}
ASSERT_TRUE(task->destroy());
}
}
| 38.558468 | 174 | 0.634353 | SkyZH |
e0d32a8c54e5e1b0439375b1ad82999d7978fb13 | 1,528 | cc | C++ | drivers/gpu/msd-intel-gen/src/global_context.cc | PowerOlive/garnet | 16b5b38b765195699f41ccb6684cc58dd3512793 | [
"BSD-3-Clause"
] | 1 | 2019-10-09T10:50:57.000Z | 2019-10-09T10:50:57.000Z | drivers/gpu/msd-intel-gen/src/global_context.cc | PowerOlive/garnet | 16b5b38b765195699f41ccb6684cc58dd3512793 | [
"BSD-3-Clause"
] | 5 | 2020-09-06T09:02:06.000Z | 2022-03-02T04:44:22.000Z | garnet/drivers/gpu/msd-intel-gen/src/global_context.cc | ZVNexus/fuchsia | c5610ad15208208c98693618a79c705af935270c | [
"BSD-3-Clause"
] | null | null | null | // Copyright 2016 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "global_context.h"
bool GlobalContext::Map(std::shared_ptr<AddressSpace> address_space, EngineCommandStreamerId id)
{
DLOG("Map for engine %d", id);
if (!MsdIntelContext::Map(address_space, id))
return DRETF(false, "failed to map");
// Address space check is ok; if we're already mapped then we're done.
if (status_page_map_.find(id) != status_page_map_.end())
return true;
gpu_addr_t gpu_addr;
if (!GetGpuAddress(id, &gpu_addr))
return DRETF(false, "failed to get gpu address");
void* cpu_addr;
if (!get_context_buffer(id)->platform_buffer()->MapCpu(&cpu_addr))
return DRETF(false, "failed to get cpu address");
status_page_map_[id] = PerEngineHardwareStatus{
gpu_addr, cpu_addr, std::unique_ptr<HardwareStatusPage>(new HardwareStatusPage(this, id))};
return true;
}
bool GlobalContext::Unmap(EngineCommandStreamerId id)
{
DLOG("Unmap for engine %d", id);
auto iter = status_page_map_.find(id);
if (iter == status_page_map_.end())
return DRETF(false, "not mapped");
if (!MsdIntelContext::Unmap(id))
return DRETF(false, "failed to unmap gpu address");
if (!get_context_buffer(id)->platform_buffer()->UnmapCpu())
return DRETF(false, "failed to unmap cpu address");
status_page_map_.erase(iter);
return true;
}
| 30.56 | 99 | 0.687173 | PowerOlive |
e0d77997eb69e054af00c522e537309e8f7d221d | 9,637 | cpp | C++ | src/qt/blocknetcreateproposal2.cpp | braveheart12/Blocknet | b6676a92e0d485a32a3bb129c1e80ba2e2fe2f89 | [
"MIT"
] | null | null | null | src/qt/blocknetcreateproposal2.cpp | braveheart12/Blocknet | b6676a92e0d485a32a3bb129c1e80ba2e2fe2f89 | [
"MIT"
] | null | null | null | src/qt/blocknetcreateproposal2.cpp | braveheart12/Blocknet | b6676a92e0d485a32a3bb129c1e80ba2e2fe2f89 | [
"MIT"
] | null | null | null | // Copyright (c) 2018 The Blocknet Developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "blocknetcreateproposal2.h"
#include "blocknethdiv.h"
#include "init.h"
#include "util.h"
#include "servicenode-budget.h"
#include "bitcoinunits.h"
#include <QMessageBox>
#include <QKeyEvent>
BlocknetCreateProposal2::BlocknetCreateProposal2(int id, QFrame *parent) : BlocknetCreateProposalPage(id, parent),
layout(new QVBoxLayout) {
this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
this->setLayout(layout);
layout->setContentsMargins(52, 9, 50, 0);
titleLbl = new QLabel(tr("Proposals"));
titleLbl->setObjectName("h4");
subtitleLbl = new QLabel;
subtitleLbl->setObjectName("h2");
auto *div1 = new BlocknetHDiv;
auto *titleGrid = new QFrame;
QGridLayout *titleLayout = new QGridLayout;
titleLayout->setContentsMargins(QMargins());
titleGrid->setLayout(titleLayout);
proposalTitleLbl = new QLabel(tr("Name"));
proposalTitleLbl->setObjectName("h4");
proposalLbl = new QLabel;
proposalLbl->setObjectName("detail");
proposalLbl->setTextInteractionFlags(Qt::TextSelectableByMouse);
titleLayout->addWidget(proposalTitleLbl, 0, 0);
titleLayout->addWidget(proposalLbl, 0, 1, Qt::AlignRight);
auto *div2 = new BlocknetHDiv;
auto *proposalGrid = new QFrame;
QGridLayout *proposalLayout = new QGridLayout;
proposalLayout->setContentsMargins(QMargins());
proposalGrid->setLayout(proposalLayout);
proposalDetailTitleLbl = new QLabel(tr("Proposal"));
proposalDetailTitleLbl->setObjectName("h4");
proposalDetailLbl = new QLabel;
proposalDetailLbl->setObjectName("detail");
proposalDetailLbl->setTextInteractionFlags(Qt::TextSelectableByMouse);
proposalLayout->addWidget(proposalDetailTitleLbl, 0, 0);
proposalLayout->addWidget(proposalDetailLbl, 0, 1, Qt::AlignRight);
auto *div3 = new BlocknetHDiv;
auto *addrGrid = new QFrame;
auto *addrGridLayout = new QGridLayout;
addrGridLayout->setContentsMargins(QMargins());
addrGrid->setLayout(addrGridLayout);
proposalAddrLbl = new QLabel(tr("Payment Address"));
proposalAddrLbl->setObjectName("h4");
proposalAddrValLbl = new QLabel;
proposalAddrValLbl->setObjectName("detail");
proposalAddrValLbl->setTextInteractionFlags(Qt::TextSelectableByMouse);
addrGridLayout->addWidget(proposalAddrLbl, 0, 0);
addrGridLayout->addWidget(proposalAddrValLbl, 0, 1, Qt::AlignRight);
auto *div4 = new BlocknetHDiv;
auto *urlGrid = new QFrame;
auto *urlGridLayout = new QGridLayout;
urlGridLayout->setContentsMargins(QMargins());
urlGrid->setLayout(urlGridLayout);
urlLbl = new QLabel(tr("URL"));
urlLbl->setObjectName("h4");
urlValLbl = new QLabel;
urlValLbl->setObjectName("detail");
urlValLbl->setTextInteractionFlags(Qt::TextSelectableByMouse);
urlGridLayout->addWidget(urlLbl, 0, 0);
urlGridLayout->addWidget(urlValLbl, 0, 1, Qt::AlignRight);
auto *div5 = new BlocknetHDiv;
auto *feeGrid = new QFrame;
auto *feeLayout = new QGridLayout;
feeLayout->setContentsMargins(QMargins());
feeGrid->setLayout(feeLayout);
feeTitleLbl = new QLabel(tr("Submission Fee"));
feeTitleLbl->setObjectName("h4");
feeLbl = new QLabel(BitcoinUnits::floorWithUnit(0, GetProposalFee(), false, BitcoinUnits::separatorAlways));
feeLbl->setObjectName("detail");
feeLbl->setTextInteractionFlags(Qt::TextSelectableByMouse);
feeLayout->addWidget(feeTitleLbl, 0, 0);
feeLayout->addWidget(feeLbl, 0, 1, Qt::AlignRight);
auto *div6 = new BlocknetHDiv;
// Cancel/continue buttons
auto *btnBox = new QFrame;
btnBox->setObjectName("buttonSection");
auto *btnBoxLayout = new QHBoxLayout;
btnBoxLayout->setContentsMargins(QMargins());
btnBoxLayout->setSpacing(15);
btnBox->setLayout(btnBoxLayout);
backBtn = new BlocknetFormBtn;
backBtn->setText(tr("Back"));
submitBtn = new BlocknetFormBtn;
submitBtn->setText(tr("Pay Fee"));
cancelBtn = new BlocknetFormBtn;
cancelBtn->setObjectName("cancel");
cancelBtn->setText(tr("Cancel"));
btnBoxLayout->addWidget(backBtn, 0, Qt::AlignLeft | Qt::AlignBottom);
btnBoxLayout->addWidget(submitBtn, 0, Qt::AlignLeft | Qt::AlignBottom);
btnBoxLayout->addStretch(1);
btnBoxLayout->addWidget(cancelBtn, 0, Qt::AlignRight | Qt::AlignBottom);
int spacing = 10;
layout->addWidget(titleLbl, 0, Qt::AlignTop | Qt::AlignLeft);
layout->addSpacing(45);
layout->addWidget(subtitleLbl, 0, Qt::AlignTop);
layout->addSpacing(spacing);
layout->addWidget(div1);
layout->addSpacing(spacing);
layout->addWidget(titleGrid);
layout->addSpacing(spacing);
layout->addWidget(div2);
layout->addSpacing(spacing);
layout->addWidget(proposalGrid);
layout->addSpacing(spacing);
layout->addWidget(div3);
layout->addSpacing(spacing);
layout->addWidget(addrGrid);
layout->addSpacing(spacing);
layout->addWidget(div4);
layout->addSpacing(spacing);
layout->addWidget(urlGrid);
layout->addSpacing(spacing);
layout->addWidget(div5);
layout->addSpacing(spacing);
layout->addWidget(feeGrid);
layout->addSpacing(spacing);
layout->addWidget(div6);
layout->addSpacing(40);
layout->addStretch(1);
layout->addWidget(btnBox);
layout->addSpacing(30);
connect(submitBtn, SIGNAL(clicked()), this, SLOT(onSubmit()));
connect(cancelBtn, SIGNAL(clicked()), this, SLOT(onCancel()));
connect(backBtn, SIGNAL(clicked()), this, SLOT(onBack()));
}
void BlocknetCreateProposal2::setModel(const BlocknetCreateProposalPageModel &model) {
this->model = model;
subtitleLbl->setText(tr("Review Proposal (Superblock %1)").arg(model.superblock));
proposalLbl->setText(QString::fromStdString(model.name));
proposalDetailLbl->setText(tr("%1 payment(s) of %2 for a total of %3").arg(QString::number(model.paymentCount),
BitcoinUnits::floorWithUnit(BitcoinUnits::BLOCK, model.amount * COIN, false, BitcoinUnits::separatorNever),
BitcoinUnits::floorWithUnit(BitcoinUnits::BLOCK, model.amount * model.paymentCount * COIN, false, BitcoinUnits::separatorNever)));
proposalAddrValLbl->setText(QString::fromStdString(model.address.ToString()));
urlValLbl->setText(QString::fromStdString(model.url));
}
void BlocknetCreateProposal2::keyPressEvent(QKeyEvent *event) {
QWidget::keyPressEvent(event);
if (this->isHidden())
return;
if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
onSubmit();
}
bool BlocknetCreateProposal2::validated() {
if (model.collateral == uint256()) {
QMessageBox::warning(this->parentWidget(), tr("Issue"),
tr("The proposal fee submission is required before proceeding."));
return false;
}
return true;
}
void BlocknetCreateProposal2::onSubmit() {
disableButtons(true);
CScript scriptPubKey = GetScriptForDestination(model.address.Get());
std::string strError;
CBudgetProposalBroadcast budgetProposalBroadcast(model.name, model.url, model.paymentCount,
scriptPubKey, model.amount * COIN, model.superblock, 0);
if (!budgetProposalBroadcast.IsValid(strError, false)) {
QMessageBox::warning(this->parentWidget(), tr("Issue"),
tr("The proposal was rejected, please check all proposal information: %1").arg(QString::fromStdString(strError)));
disableButtons(false);
return;
}
// Display message box
auto fee = BitcoinUnits::floorWithUnit(0, GetProposalFee(), false, BitcoinUnits::separatorAlways);
QMessageBox::StandardButton retval = QMessageBox::question(this, tr("Confirm Submission Fee"),
tr("Are you sure you want to pay the proposal submission fee of %1?\n\nThis cannot be undone").arg(fee),
QMessageBox::Yes | QMessageBox::Cancel,
QMessageBox::Cancel);
if (retval != QMessageBox::Yes) {
disableButtons(false);
return;
}
CWalletTx wtx;
if (!pwalletMain->GetBudgetSystemCollateralTX(wtx, budgetProposalBroadcast.GetHash(), false)) {
QMessageBox::warning(this->parentWidget(), tr("Issue"),
tr("Could not submit proposal fee collateral. Please check your wallet balance and make sure your wallet is unlocked."));
disableButtons(false);
return;
}
// make our change address
CReserveKey reservekey(pwalletMain);
// send the tx to the network
pwalletMain->CommitTransaction(wtx, reservekey, "tx");
// store collateral hash
model.collateral = wtx.GetHash();
LogPrintf("Proposal fee successfully submitted for %s\n", model.name);
LogPrintf("mnbudget submit %s %s %d %d %s %d %s\n", model.name, model.url, model.paymentCount, model.superblock, model.address.ToString(), model.amount, model.collateral.ToString());
onNext();
disableButtons(false);
}
void BlocknetCreateProposal2::clear() {
}
void BlocknetCreateProposal2::disableButtons(const bool &disable) {
backBtn->setEnabled(!disable);
submitBtn->setEnabled(!disable);
cancelBtn->setEnabled(!disable);
}
| 38.090909 | 186 | 0.682474 | braveheart12 |
e0d7a69bd29a4914c38ab3ec02f9798a15a3648a | 2,692 | cpp | C++ | examples/cpp/example_s2.cpp | JeremyBYU/FastGaussianAccumulator | 995c1cb53485212bc2c71dad3ed3834caaa1f45b | [
"MIT"
] | 4 | 2020-10-20T15:54:00.000Z | 2021-09-05T22:24:57.000Z | examples/cpp/example_s2.cpp | JeremyBYU/GaussianAccumulator | 995c1cb53485212bc2c71dad3ed3834caaa1f45b | [
"MIT"
] | 1 | 2021-06-09T03:32:14.000Z | 2021-06-09T03:32:14.000Z | examples/cpp/example_s2.cpp | JeremyBYU/GaussianAccumulator | 995c1cb53485212bc2c71dad3ed3834caaa1f45b | [
"MIT"
] | 1 | 2021-04-13T09:24:30.000Z | 2021-04-13T09:24:30.000Z |
#include <random>
#include <cmath>
#include <chrono>
#include <vector>
#include <iostream>
#include "FastGA.hpp"
#include "Hilbert/Hilbert.hpp"
#include <cinttypes>
#include <cstdint>
#include <cstdio>
#include "s2/s2earth.h"
#include "s2/s1chord_angle.h"
#include "s2/s2closest_point_query.h"
#include "s2/s2point_index.h"
#include "s2/s2testing.h"
int main(int argc, char const *argv[])
{
auto GA = FastGA::GaussianAccumulatorOpt(4, 100.0);
FastGA::MatX3d normals = {{0.99177847, -0.11935933, -0.04613903}, {1, 1, 1}, {-1, 0, 0}, {0, 0 , 1}, {1, 0, 0}, {0, 1, 0}, {0, -1, 0}};
// S2PointIndex<int> s2_index;
// for(size_t i = 0; i < GA.buckets.size(); i++)
// {
// auto &bucket_normal = GA.buckets[i].normal;
// S2Point s2_point(bucket_normal[0], bucket_normal[1], bucket_normal[2]);
// s2_index.Add(s2_point, i);
// }
// S2ClosestPointQuery<int> query(&s2_index);
// query.mutable_options()->set_max_results(1);
// Query Points
for (size_t i =0; i < normals.size(); i++)
{
auto &normal = normals[i];
S2Point s2_point(normal[0], normal[1], normal[2]);
S2CellId s2_id(s2_point);
auto id = s2_id.id();
auto nano_id = NanoS2ID::S2CellId(normal);
double pu = 0.0;
double pv = 0.0;
auto face_s2 = S2::XYZtoFaceUV(s2_point, &pu, &pv);
auto st_u = S2::UVtoST(pu);
auto st_v = S2::UVtoST(pv);
auto ij_u = S2::STtoIJ(st_u);
auto ij_v = S2::STtoIJ(st_v);
std::cout << "S2 - ID " << id << ";Face: " << face_s2 << "; u:" << pu << " ;v: " << pv << "; st_u:" << st_u << " ; st_v: " << st_v << "; ij_u:" << ij_u << " ; ij_v: " << ij_v << std::endl;
face_s2 = NanoS2ID::XYZtoFaceUV(normal, &pu, &pv);
st_u = NanoS2ID::UVtoST(pu);
st_v = NanoS2ID::UVtoST(pv);
ij_u = NanoS2ID::STtoIJ(st_u);
ij_v = NanoS2ID::STtoIJ(st_v);
std::cout << "Nano S2 - ID " << nano_id << ";Face: " << face_s2 << "; u:" << pu << " ;v: " << pv << "; st_u:" << st_u << " ; st_v: " << st_v << "; ij_u:" << ij_u << " ; ij_v: " << ij_v << std::endl;
// S2ClosestPointQuery<int>::PointTarget target(s2_point);
// auto results = query.FindClosestPoints(&target);
// // std::cout << "Result Size: " << results.size() << std::endl;
// if (results.size() > 0)
// {
// auto bucket_point = results[0].point();
// std::cout << "Looking for: " << normal << "; S2ID is: " << id << "; NanoS2ID is: " << nano_id << "; Found " << bucket_point.x() << ", " << bucket_point.y() << ", " << bucket_point.z() << std::endl;
// }
}
return 0;
} | 39.014493 | 213 | 0.537519 | JeremyBYU |
e0d7ac4366277a63c3e040b69b48ac81c7ca9e2e | 670 | cpp | C++ | 01_simplest_programs/guessnumber.cpp | zaychenko-sergei/cpp_intro | 6f1786b18950bf47ee385c97084f3516734e5199 | [
"MIT"
] | 1 | 2021-03-05T01:14:00.000Z | 2021-03-05T01:14:00.000Z | 01_simplest_programs/guessnumber.cpp | zaychenko-sergei/cpp_intro | 6f1786b18950bf47ee385c97084f3516734e5199 | [
"MIT"
] | null | null | null | 01_simplest_programs/guessnumber.cpp | zaychenko-sergei/cpp_intro | 6f1786b18950bf47ee385c97084f3516734e5199 | [
"MIT"
] | 2 | 2015-01-13T11:25:07.000Z | 2021-04-29T12:58:51.000Z | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main ()
{
time_t currentTime;
time( & currentTime );
srand( ( unsigned ) currentTime );
const int numberToGuess = rand() % 100;
int userInput;
int steps = 0;
do
{
printf( "Try to guess the number within [ 0 : 99 ]: " );
scanf( "%d", &userInput );
++ steps;
if ( userInput > numberToGuess )
printf( "Too big\n" );
else if ( userInput < numberToGuess )
printf( "Too small\n" );
} while ( userInput != numberToGuess );
printf( "Right guess! Completed in %d steps.\n", steps );
return 0;
} | 20.9375 | 64 | 0.537313 | zaychenko-sergei |
e0d970306ec5850583e94d25e1abd5b2725fe1eb | 2,067 | cpp | C++ | oi/vijos/P1775/main.cpp | Riteme/test | b511d6616a25f4ae8c3861e2029789b8ee4dcb8d | [
"BSD-Source-Code"
] | 3 | 2018-08-30T09:43:20.000Z | 2019-12-03T04:53:43.000Z | oi/vijos/P1775/main.cpp | Riteme/test | b511d6616a25f4ae8c3861e2029789b8ee4dcb8d | [
"BSD-Source-Code"
] | null | null | null | oi/vijos/P1775/main.cpp | Riteme/test | b511d6616a25f4ae8c3861e2029789b8ee4dcb8d | [
"BSD-Source-Code"
] | null | null | null | #include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;
#define NMAX 350
#define MMAX 40
#define MOD 10000007
typedef pair<int, int> IntPair;
static int n, m;
static int score[NMAX + 10];
static int cnt[10];
// static int f[NMAX + 10][MMAX + 1][MMAX + 1][MMAX + 1][MMAX + 1];
static map<int, int> f;
static vector<IntPair> table[MOD];
inline void insert(int id, int v) {
int index = id % MOD;
for (size_t i = 0; i < table[index].size(); i++) {
if (table[index][i].first == id) {
table[index][i].second = v;
return;
}
} // for
table[index].push_back(IntPair(id, v));
}
inline int query(int id) {
int index = id % MOD;
for (size_t i = 0; i < table[index].size(); i++) {
if (table[index][i].first == id)
return table[index][i].second;
} // for
return -1;
}
inline int hashing(int x, int a, int b, int c, int d) {
return x * 100000000 + a * 1000000 + b * 10000 + c * 100 + d;
}
static void initialize() {
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; i++) {
scanf("%d", score + i);
} // for
for (int i = 0; i < m; i++) {
int id;
scanf("%d", &id);
cnt[id]++;
} // for
}
static int dfs(int x, int a, int b, int c, int d) {
if (x < 1)
return 0;
if (x == 1)
return score[1];
if (a > cnt[1] || b > cnt[2] || c > cnt[3] || d > cnt[4])
return 0;
int id = hashing(x, a, b, c, d);
int result = query(id);
if (result >= 0)
return result;
else {
int answer =
max(max(dfs(x - 1, a + 1, b, c, d), dfs(x - 2, a, b + 1, c, d)),
max(dfs(x - 3, a, b, c + 1, d), dfs(x - 4, a, b, c, d + 1)));
insert(id, answer + score[x]);
return answer + score[x];
}
}
int main() {
freopen("tortoise.in", "r", stdin);
freopen("tortoise.out", "w", stdout);
initialize();
printf("%d\n", dfs(n, 0, 0, 0, 0));
return 0;
} // function main
| 21.091837 | 77 | 0.496372 | Riteme |
e0dafaad61f52a0da6392bb59590fd828bbd5d2b | 5,727 | cc | C++ | chrome/browser/chromeos/child_accounts/family_user_session_metrics.cc | Ron423c/chromium | 2edf7b980065b648f8b2a6e52193d83832fe36b7 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 575 | 2015-06-18T23:58:20.000Z | 2022-03-23T09:32:39.000Z | chrome/browser/chromeos/child_accounts/family_user_session_metrics.cc | Ron423c/chromium | 2edf7b980065b648f8b2a6e52193d83832fe36b7 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 113 | 2015-05-04T09:58:14.000Z | 2022-01-31T19:35:03.000Z | chrome/browser/chromeos/child_accounts/family_user_session_metrics.cc | iridium-browser/iridium-browser | 907e31cf5ce5ad14d832796e3a7c11e496828959 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 52 | 2015-07-14T10:40:50.000Z | 2022-03-15T01:11:49.000Z | // Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/chromeos/child_accounts/family_user_session_metrics.h"
#include <string>
#include <utility>
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/user_metrics.h"
#include "chrome/common/pref_names.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
namespace chromeos {
namespace {
constexpr int kEngagementHourBuckets = base::Time::kHoursPerDay;
constexpr base::TimeDelta kOneHour = base::TimeDelta::FromHours(1);
constexpr base::TimeDelta kMinSessionDuration = base::TimeDelta::FromSeconds(1);
constexpr base::TimeDelta kMaxSessionDuration = base::TimeDelta::FromDays(1);
constexpr int kSessionDurationBuckets = 100;
// Returns the hour (0-23) within the day for given local time.
int HourOfDay(base::Time time) {
base::Time::Exploded exploded;
time.LocalExplode(&exploded);
return exploded.hour;
}
// Returns 0-based day of week (0 = Sunday, etc.)
int DayOfWeek(base::Time time) {
base::Time::Exploded exploded;
time.LocalExplode(&exploded);
return exploded.day_of_week;
}
// Reports every active hour between |start| and |end| to UMA.
void ReportUserEngagementHourToUma(base::Time start, base::Time end) {
if (start.is_null() || end.is_null() || end < start)
return;
base::Time time = start;
while (time <= end) {
int day_of_week = DayOfWeek(time);
int hour_of_day = HourOfDay(time);
if (day_of_week == 0 || day_of_week == 6) {
base::UmaHistogramExactLinear(
FamilyUserSessionMetrics::kSessionEngagementWeekendHistogramName,
hour_of_day, kEngagementHourBuckets);
} else {
base::UmaHistogramExactLinear(
FamilyUserSessionMetrics::kSessionEngagementWeekdayHistogramName,
hour_of_day, kEngagementHourBuckets);
}
base::UmaHistogramExactLinear(
FamilyUserSessionMetrics::kSessionEngagementTotalHistogramName,
hour_of_day, kEngagementHourBuckets);
// When the difference between end and time less than 1 hour and their hours
// of day are different, i.e. time = 10:55 and end = 11:05, we need to
// report both 10 and 11. To ensure we don't omit reporting 11, set |time|
// equal to |end|.
if (end - time < kOneHour && hour_of_day != HourOfDay(end)) {
time = end;
} else {
time += kOneHour;
}
}
}
} // namespace
// static
const char FamilyUserSessionMetrics::kSessionEngagementStartActionName[] =
"FamilyUser.SessionEngagement.Start";
const char FamilyUserSessionMetrics::kSessionEngagementWeekdayHistogramName[] =
"FamilyUser.SessionEngagement.Weekday";
const char FamilyUserSessionMetrics::kSessionEngagementWeekendHistogramName[] =
"FamilyUser.SessionEngagement.Weekend";
const char FamilyUserSessionMetrics::kSessionEngagementTotalHistogramName[] =
"FamilyUser.SessionEngagement.Total";
const char FamilyUserSessionMetrics::kSessionEngagementDurationHistogramName[] =
"FamilyUser.SessionEngagement.Duration";
// static
void FamilyUserSessionMetrics::RegisterProfilePrefs(
PrefRegistrySimple* registry) {
registry->RegisterTimeDeltaPref(
prefs::kFamilyUserMetricsSessionEngagementDuration, base::TimeDelta());
}
FamilyUserSessionMetrics::FamilyUserSessionMetrics(PrefService* pref_service)
: pref_service_(pref_service) {
DCHECK(pref_service_);
UsageTimeStateNotifier::GetInstance()->AddObserver(this);
}
FamilyUserSessionMetrics::~FamilyUserSessionMetrics() {
// |active_session_start_| will be reset in UpdateUserEngagement() after user
// becomes inactive. |active_session_start_| equals to base::Time() indicates
// that UpdateUserEngagement(false) has already been called.
if (active_session_start_ != base::Time()) {
UpdateUserEngagement(/*is_user_active=*/false);
}
UsageTimeStateNotifier::GetInstance()->RemoveObserver(this);
}
void FamilyUserSessionMetrics::OnNewDay() {
base::TimeDelta unreported_duration = pref_service_->GetTimeDelta(
prefs::kFamilyUserMetricsSessionEngagementDuration);
if (unreported_duration <= base::TimeDelta())
return;
base::UmaHistogramCustomTimes(kSessionEngagementDurationHistogramName,
unreported_duration, kMinSessionDuration,
kMaxSessionDuration, kSessionDurationBuckets);
pref_service_->ClearPref(prefs::kFamilyUserMetricsSessionEngagementDuration);
}
void FamilyUserSessionMetrics::SetActiveSessionStartForTesting(
base::Time time) {
active_session_start_ = time;
}
void FamilyUserSessionMetrics::OnUsageTimeStateChange(
UsageTimeStateNotifier::UsageTimeState state) {
UpdateUserEngagement(/*is_user_active=*/state ==
UsageTimeStateNotifier::UsageTimeState::ACTIVE);
}
void FamilyUserSessionMetrics::UpdateUserEngagement(bool is_user_active) {
base::Time now = base::Time::Now();
if (is_user_active) {
base::RecordAction(
base::UserMetricsAction(kSessionEngagementStartActionName));
active_session_start_ = now;
} else {
ReportUserEngagementHourToUma(
/*start=*/active_session_start_,
/*end=*/now);
if (now > active_session_start_) {
base::TimeDelta unreported_duration = pref_service_->GetTimeDelta(
prefs::kFamilyUserMetricsSessionEngagementDuration);
pref_service_->SetTimeDelta(
prefs::kFamilyUserMetricsSessionEngagementDuration,
unreported_duration + now - active_session_start_);
}
active_session_start_ = base::Time();
}
}
} // namespace chromeos
| 36.246835 | 80 | 0.743496 | Ron423c |
e0dd8dc839af8d643e510e0f0448524a3ea9592f | 83,849 | cpp | C++ | aten/src/TH/generic/THTensorMoreMath.cpp | DavidKo3/mctorch | 53ffe61763059677978b4592c8b2153b0c15428f | [
"BSD-3-Clause"
] | 1 | 2019-07-21T02:13:22.000Z | 2019-07-21T02:13:22.000Z | aten/src/TH/generic/THTensorMoreMath.cpp | DavidKo3/mctorch | 53ffe61763059677978b4592c8b2153b0c15428f | [
"BSD-3-Clause"
] | null | null | null | aten/src/TH/generic/THTensorMoreMath.cpp | DavidKo3/mctorch | 53ffe61763059677978b4592c8b2153b0c15428f | [
"BSD-3-Clause"
] | null | null | null | #ifndef TH_GENERIC_FILE
#define TH_GENERIC_FILE "generic/THTensorMoreMath.cpp"
#else
#include <TH/generic/THTensorApply.hpp>
void THTensor_(baddbmm)(THTensor *result, real beta, THTensor *t, real alpha, THTensor *batch1, THTensor *batch2)
{
int64_t batch;
THArgCheck(THTensor_(nDimensionLegacyNoScalars)(batch1) == 3, 1, "expected 3D tensor, got %dD", THTensor_(nDimensionLegacyNoScalars)(batch1));
THArgCheck(THTensor_(nDimensionLegacyNoScalars)(batch2) == 3, 2, "expected 3D tensor, got %dD", THTensor_(nDimensionLegacyNoScalars)(batch2));
THArgCheck(THTensor_(size)(batch1, 0) == THTensor_(size)(batch2, 0), 2,
"equal number of batches expected, got %d, %d",
THTensor_(size)(batch1, 0), THTensor_(size)(batch2, 0));
THArgCheck(THTensor_(size)(batch1, 2) == THTensor_(size)(batch2, 1), 2,
"wrong matrix size, batch1: %dx%d, batch2: %dx%d",
THTensor_(size)(batch1, 1), THTensor_(size)(batch1, 2),
THTensor_(size)(batch2, 1), THTensor_(size)(batch2, 2));
int64_t bs = THTensor_(size)(batch1, 0);
int64_t dim1 = THTensor_(size)(batch1, 1);
int64_t dim2 = THTensor_(size)(batch2, 2);
THArgCheck(THTensor_(size)(t, 0) == bs, 1, "output tensor of incorrect size");
THArgCheck(THTensor_(size)(t, 1) == dim1, 1, "output tensor of incorrect size");
THArgCheck(THTensor_(size)(t, 2) == dim2, 1, "output tensor of incorrect size");
if (t != result) {
THTensor_(resizeAs)(result, t);
if (beta != 0.0) {
THTensor_(copy)(result, t);
}
}
THTensor *matrix1 = THTensor_(new)();
THTensor *matrix2 = THTensor_(new)();
THTensor *result_matrix = THTensor_(new)();
for (batch = 0; batch < THTensor_(size)(batch1, 0); ++batch) {
THTensor_(select)(matrix1, batch1, 0, batch);
THTensor_(select)(matrix2, batch2, 0, batch);
THTensor_(select)(result_matrix, result, 0, batch);
THTensor_(addmm)(result_matrix, beta, result_matrix, alpha, matrix1, matrix2);
}
THTensor_(free)(matrix1);
THTensor_(free)(matrix2);
THTensor_(free)(result_matrix);
}
ptrdiff_t THTensor_(numel)(THTensor *t)
{
return THTensor_(nElement)(t);
}
// Helper function to be used in a reduction operation.
// Due to resize semantics of outputs, if the specified output tensor r_ has
// same size as the output of the reduction operation, then any noncontiguities
// in r_ should be preserved.
// The reduction operation, however, needs to act on r_ with an extra dimension
// (the reduced dimension), so this function "resizes" r_ and preserves its
// noncontiguities if necessary.
void THTensor_(preserveReduceDimSemantics)(
THTensor *r_, int in_dims, int reduce_dimension, int keepdim) {
if (r_ && !keepdim &&
THTensor_(nDimensionLegacyAll)(r_) == in_dims - 1 &&
THTensor_(nDimensionLegacyAll)(r_) != 0) {
THTensor_(unsqueeze1d)(r_, r_, reduce_dimension);
}
}
void THTensor_(max)(THTensor *values_, THLongTensor *indices_, THTensor *t, int dimension, int keepdim)
{
THLongStorage *dim;
THArgCheck(dimension >= 0 && dimension < THTensor_(nDimensionLegacyAll)(t), 2, "dimension %d out of range",
dimension + TH_INDEX_BASE);
int in_dims = THTensor_(nDimensionLegacyAll)(t);
THTensor_(preserveReduceDimSemantics)(values_, in_dims, dimension, keepdim);
THLongTensor_preserveReduceDimSemantics(indices_, in_dims, dimension, keepdim);
dim = THTensor_(newSizeOf)(t);
THLongStorage_set(dim, dimension, 1);
THTensor_(resize)(values_, dim, NULL);
THLongTensor_resize(indices_, dim, NULL);
THLongStorage_free(dim);
// two implementations optimized for data locality
if (THTensor_strideLegacyNoScalars(t, dimension) == 1) {
real theMax;
real value;
int64_t theIndex;
int64_t i;
TH_TENSOR_DIM_APPLY3(real, t, real, values_, int64_t, indices_, dimension,
TH_TENSOR_DIM_APPLY3_SIZE_EQ_EXCEPT_DIM,
theMax = t_data[0];
theIndex = 0;
for(i = 0; i < t_size; i++)
{
value = t_data[i*t_stride];
/* This is not the same as value>theMax in the case of NaNs */
if(!(value <= theMax))
{
theIndex = i;
theMax = value;
th_isnan_break(value)
}
}
*indices__data = theIndex;
*values__data = theMax;);
} else {
if (THTensor_(nDimensionLegacyAll)(t) > 1) {
THTensor *t0 = THTensor_(newSelect)(t, dimension, 0);
THTensor_(copy)(values_, t0);
THTensor_(free)(t0);
} else {
THTensor_(fill)(values_, THTensor_(get1d)(t, 0));
}
THLongTensor_zero(indices_);
if(THTensor_sizeLegacyNoScalars(t, dimension) == 1) {
if (!keepdim) {
THTensor_(squeeze1d)(values_, values_, dimension);
THLongTensor_squeeze1d(indices_, indices_, dimension);
}
return;
}
THTensor *tempValues_ = THTensor_(newWithTensor)(values_);
// tempValues_.expand_as(t)
THTensor_setSizeAtDim(tempValues_, dimension, THTensor_sizeLegacyNoScalars(t, dimension));
THTensor_setStrideAtDim(tempValues_, dimension, 0);
THLongTensor *tempIndices_ = THLongTensor_newWithTensor(indices_);
// tempIndices_.expand_as(t)
THTensor_setSizeAtDim(tempIndices_, dimension, THTensor_sizeLegacyNoScalars(t, dimension));
THTensor_setStrideAtDim(tempIndices_, dimension, 0);
TH_TENSOR_APPLY3_D(real, t, real, tempValues_, int64_t, tempIndices_, dimension,
if(!(*t_data <= *tempValues__data) && !th_isnan(*tempValues__data)) {
*tempValues__data = *t_data;
*tempIndices__data = *tempIndices__dimOffset;
});
THTensor_(free)(tempValues_);
THLongTensor_free(tempIndices_);
}
if (!keepdim) {
THTensor_(squeeze1d)(values_, values_, dimension);
THLongTensor_squeeze1d(indices_, indices_, dimension);
}
}
void THTensor_(min)(THTensor *values_, THLongTensor *indices_, THTensor *t, int dimension, int keepdim)
{
THLongStorage *dim;
THArgCheck(dimension >= 0 && dimension < THTensor_(nDimensionLegacyAll)(t), 2, "dimension %d out of range",
dimension + TH_INDEX_BASE);
int in_dims = THTensor_(nDimensionLegacyAll)(t);
THTensor_(preserveReduceDimSemantics)(values_, in_dims, dimension, keepdim);
THLongTensor_preserveReduceDimSemantics(indices_, in_dims, dimension, keepdim);
dim = THTensor_(newSizeOf)(t);
THLongStorage_set(dim, dimension, 1);
THTensor_(resize)(values_, dim, NULL);
THLongTensor_resize(indices_, dim, NULL);
THLongStorage_free(dim);
// two implementations optimized for data locality
if (THTensor_strideLegacyNoScalars(t, dimension) == 1) {
real theMax;
real value;
int64_t theIndex;
int64_t i;
TH_TENSOR_DIM_APPLY3(real, t, real, values_, int64_t, indices_, dimension,
TH_TENSOR_DIM_APPLY3_SIZE_EQ_EXCEPT_DIM,
theMax = t_data[0];
theIndex = 0;
for(i = 0; i < t_size; i++)
{
value = t_data[i*t_stride];
/* This is not the same as value>theMax in the case of NaNs */
if(!(value >= theMax))
{
theIndex = i;
theMax = value;
th_isnan_break(value)
}
}
*indices__data = theIndex;
*values__data = theMax;);
} else {
if (THTensor_(nDimensionLegacyAll)(t) > 1) {
THTensor *t0 = THTensor_(newSelect)(t, dimension, 0);
THTensor_(copy)(values_, t0);
THTensor_(free)(t0);
} else {
THTensor_(fill)(values_, THTensor_(get1d)(t, 0));
}
THLongTensor_zero(indices_);
if(THTensor_sizeLegacyNoScalars(t, dimension) == 1) {
if (!keepdim) {
THTensor_(squeeze1d)(values_, values_, dimension);
THLongTensor_squeeze1d(indices_, indices_, dimension);
}
return;
}
THTensor *tempValues_ = THTensor_(newWithTensor)(values_);
// tempValues_.expand_as(t)
THTensor_setSizeAtDim(tempValues_, dimension, THTensor_sizeLegacyNoScalars(t, dimension));
THTensor_setStrideAtDim(tempValues_, dimension, 0);
THLongTensor *tempIndices_ = THLongTensor_newWithTensor(indices_);
// tempIndices_.expand_as(t)
THTensor_setSizeAtDim(tempIndices_, dimension, THTensor_sizeLegacyNoScalars(t, dimension));
THTensor_setStrideAtDim(tempIndices_, dimension, 0);
TH_TENSOR_APPLY3_D(real, t, real, tempValues_, int64_t, tempIndices_, dimension,
if(!(*t_data >= *tempValues__data) && !th_isnan(*tempValues__data)) {
*tempValues__data = *t_data;
*tempIndices__data = *tempIndices__dimOffset;
});
THTensor_(free)(tempValues_);
THLongTensor_free(tempIndices_);
}
if (!keepdim) {
THTensor_(squeeze1d)(values_, values_, dimension);
THLongTensor_squeeze1d(indices_, indices_, dimension);
}
}
void THTensor_(sum)(THTensor *r_, THTensor *t, int dimension, int keepdim)
{
THLongStorage *dim;
THArgCheck(dimension >= 0 && dimension < THTensor_(nDimensionLegacyAll)(t), 2, "dimension %d out of range",
dimension + TH_INDEX_BASE);
THTensor_(preserveReduceDimSemantics)(r_, THTensor_(nDimensionLegacyAll)(t), dimension, keepdim);
dim = THTensor_(newSizeOf)(t);
THLongStorage_set(dim, dimension, 1);
THTensor_(resize)(r_, dim, NULL);
THLongStorage_free(dim);
int serial_path = 0;
#ifdef _OPENMP
int inOMP = omp_in_parallel();
if (inOMP) {
serial_path = 1;
} else {
int r_Contig = THTensor_(isContiguous)(r_);
real *tp = THTensor_(data)(t);
real *rp = THTensor_(data)(r_);
if(r_Contig && (tp != rp)){
ptrdiff_t iter = 0;
ptrdiff_t r_Size = THTensor_(nElement)(r_);
int r_Dim = THTensor_nDimensionLegacyAll(r_);
#pragma omp parallel for if ( r_Size > HYPER_TH_OMP_OVERHEAD_THRESHOLD)
for (iter = 0; iter < r_Size; iter++) {
int j;
int64_t quot;
int64_t rem = iter;
ptrdiff_t tBasicIndex = 0;
for(j = 0; j < r_Dim; ++j) {
if(j != dimension){
quot = rem/r_->stride(j);
rem = rem%r_->stride(j);
tBasicIndex += quot*t->stride(j);
}
}
real *t_data = tp+tBasicIndex;
real *r__data = rp+iter;
*r__data = 0;
for(j=0; j < THTensor_sizeLegacyNoScalars(t, dimension); ++j) {
*r__data += *(t_data + j*THTensor_strideLegacyNoScalars(t, dimension));
}
}
} else {
serial_path = 1;
}
}
#else
serial_path = 1;
#endif
if (serial_path) {
// two implementations optimized for data locality
if (THTensor_strideLegacyNoScalars(t, dimension) == 1) {
TH_TENSOR_DIM_APPLY2(real, t, real, r_, dimension,
accreal sum = 0;
int64_t i;
for(i = 0; i < t_size; i++)
sum += t_data[i*t_stride];
*r__data = (real)sum;);
} else {
THTensor_(zero)(r_);
THTensor *temp_ = THTensor_(newWithTensor)(r_);
// r_.expand_as(t)
THTensor_setSizeAtDim(temp_, dimension, THTensor_sizeLegacyNoScalars(t, dimension));
THTensor_setStrideAtDim(temp_, dimension, 0);
TH_TENSOR_APPLY2(real, temp_, real, t, *temp__data = *temp__data + *t_data;);
THTensor_(free)(temp_);
}
}
if (!keepdim) {
THTensor_(squeeze1d)(r_, r_, dimension);
}
}
void THTensor_(prod)(THTensor *r_, THTensor *t, int dimension, int keepdim)
{
THLongStorage *dim;
THArgCheck(dimension >= 0 && dimension < THTensor_(nDimensionLegacyAll)(t), 2, "dimension %d out of range",
dimension + TH_INDEX_BASE);
THTensor_(preserveReduceDimSemantics)(r_, THTensor_(nDimensionLegacyAll)(t), dimension, keepdim);
dim = THTensor_(newSizeOf)(t);
THLongStorage_set(dim, dimension, 1);
THTensor_(resize)(r_, dim, NULL);
THLongStorage_free(dim);
int serial_path = 0;
#ifdef _OPENMP
int inOMP = omp_in_parallel();
if (inOMP) {
serial_path = 1;
} else {
int r_Contig = THTensor_(isContiguous)(r_);
real *tp = THTensor_(data)(t);
real *rp = THTensor_(data)(r_);
if(r_Contig && (tp != rp)){
ptrdiff_t iter = 0;
ptrdiff_t r_Size = THTensor_(nElement)(r_);
int r_Dim = THTensor_nDimensionLegacyAll(r_);
#pragma omp parallel for if ( r_Size > HYPER_TH_OMP_OVERHEAD_THRESHOLD)
for (iter = 0; iter < r_Size; iter++) {
int j;
int64_t quot;
int64_t rem = iter;
ptrdiff_t tBasicIndex = 0;
for(j = 0; j < r_Dim; ++j) {
if(j != dimension){
quot = rem/r_->stride(j);
rem = rem%r_->stride(j);
tBasicIndex += quot*t->stride(j);
}
}
real *t_data = tp+tBasicIndex;
real *r__data = rp+iter;
*r__data = 1;
for(j=0; j < THTensor_sizeLegacyNoScalars(t, dimension); ++j) {
*r__data *= *(t_data + j*THTensor_strideLegacyNoScalars(t, dimension));
}
}
} else {
serial_path = 1;
}
}
#else
serial_path = 1;
#endif
if(serial_path) {
// two implementations optimized for data locality
if (THTensor_strideLegacyNoScalars(t, dimension) == 1) {
TH_TENSOR_DIM_APPLY2(real, t, real, r_, dimension,
accreal prod = 1;
int64_t i;
for(i = 0; i < t_size; i++)
prod *= t_data[i*t_stride];
*r__data = (real)prod;);
} else {
THTensor_(fill)(r_, 1);
THTensor *temp_ = THTensor_(newWithTensor)(r_);
// r_.expand_as(t)
THTensor_setSizeAtDim(temp_, dimension, THTensor_sizeLegacyNoScalars(t, dimension));
THTensor_setStrideAtDim(temp_, dimension, 0);
TH_TENSOR_APPLY2(real, temp_, real, t, *temp__data = *temp__data * *t_data;);
THTensor_(free)(temp_);
}
}
if (!keepdim) {
THTensor_(squeeze1d)(r_, r_, dimension);
}
}
void THTensor_(cumsum)(THTensor *r_, THTensor *t, int dimension)
{
THArgCheck(dimension >= 0 && dimension < THTensor_(nDimensionLegacyNoScalars)(t), 2, "dimension %d out of range",
dimension + TH_INDEX_BASE);
THTensor_(resizeAs)(r_, t);
TH_TENSOR_DIM_APPLY2(real, t, real, r_, dimension,
accreal cumsum = 0;
int64_t i;
for(i = 0; i < t_size; i++)
{
cumsum += t_data[i*t_stride];
r__data[i*r__stride] = (real)cumsum;
});
}
void THTensor_(cumprod)(THTensor *r_, THTensor *t, int dimension)
{
THArgCheck(dimension >= 0 && dimension < THTensor_(nDimensionLegacyNoScalars)(t), 2, "dimension %d out of range",
dimension + TH_INDEX_BASE);
THTensor_(resizeAs)(r_, t);
TH_TENSOR_DIM_APPLY2(real, t, real, r_, dimension,
accreal cumprod = 1;
int64_t i;
for(i = 0; i < t_size; i++)
{
cumprod *= t_data[i*t_stride];
r__data[i*r__stride] = (real)cumprod;
});
}
void THTensor_(sign)(THTensor *r_, THTensor *t)
{
THTensor_(resizeAs)(r_, t);
#if defined (TH_REAL_IS_BYTE)
TH_TENSOR_APPLY2(real, r_, real, t,
if (*t_data > 0) *r__data = 1;
else *r__data = 0;);
#else
TH_TENSOR_APPLY2(real, r_, real, t,
if (*t_data > 0) *r__data = 1;
else if (*t_data < 0) *r__data = -1;
else *r__data = 0;);
#endif
}
accreal THTensor_(trace)(THTensor *t)
{
real *t_data = THTensor_(data)(t);
accreal sum = 0;
int64_t i = 0;
int64_t t_stride_0, t_stride_1, t_diag_size;
THArgCheck(THTensor_(nDimensionLegacyAll)(t) == 2, 1, "expected a matrix");
t_stride_0 = THTensor_(stride)(t, 0);
t_stride_1 = THTensor_(stride)(t, 1);
t_diag_size = THMin(THTensor_(size)(t, 0), THTensor_(size)(t, 1));
while(i < t_diag_size)
{
sum += t_data[i*(t_stride_0+t_stride_1)];
i++;
}
return sum;
}
void THTensor_(cross)(THTensor *r_, THTensor *a, THTensor *b, int dimension)
{
int i;
if(THTensor_(nDimensionLegacyNoScalars)(a) != THTensor_(nDimensionLegacyNoScalars)(b))
THError("inconsistent tensor dimension %dD, %dD",
THTensor_(nDimensionLegacyNoScalars)(a), THTensor_(nDimensionLegacyNoScalars)(b));
for(i = 0; i < a->dim(); i++)
{
if(THTensor_(size)(a, i) != THTensor_(size)(b, i)) {
THDescBuff ba = THTensor_(sizeDesc)(a);
THDescBuff bb = THTensor_(sizeDesc)(b);
THError("inconsistent tensor sizes %s, %s", ba.str, bb.str);
}
}
if(dimension < 0)
{
for(i = 0; i < THTensor_(nDimensionLegacyNoScalars)(a); i++)
{
if(THTensor_sizeLegacyNoScalars(a, i) == 3)
{
dimension = i;
break;
}
}
if(dimension < 0) {
THDescBuff ba = THTensor_(sizeDesc)(a);
THError("no dimension of size 3 in a: %s", ba.str);
}
}
THArgCheck(dimension >= 0 && dimension < THTensor_(nDimensionLegacyNoScalars)(a), 3, "dimension %d out of range",
dimension + TH_INDEX_BASE);
THArgCheck(THTensor_sizeLegacyNoScalars(a, dimension) == 3, 3, "dimension %d does not have size 3",
dimension + TH_INDEX_BASE);
THTensor_(resizeAs)(r_, a);
TH_TENSOR_DIM_APPLY3(real, a, real, b, real, r_, dimension,
TH_TENSOR_DIM_APPLY3_SIZE_EQ_EXCEPT_DIM,
r__data[0*r__stride] = a_data[1*a_stride]*b_data[2*b_stride] - a_data[2*a_stride]*b_data[1*b_stride];
r__data[1*r__stride] = a_data[2*a_stride]*b_data[0*b_stride] - a_data[0*a_stride]*b_data[2*b_stride];
r__data[2*r__stride] = a_data[0*a_stride]*b_data[1*b_stride] - a_data[1*a_stride]*b_data[0*b_stride];);
}
void THTensor_(cmax)(THTensor *r, THTensor *t, THTensor *src) {
THTensor_(resizeAs)(r, t);
TH_TENSOR_APPLY3(real, r, real, t, real, src,
*r_data = *t_data > *src_data ? *t_data : *src_data;);
}
void THTensor_(cmin)(THTensor *r, THTensor *t, THTensor *src) {
THTensor_(resizeAs)(r, t);
TH_TENSOR_APPLY3(real, r, real, t, real, src,
*r_data = *t_data < *src_data ? *t_data : *src_data;);
}
void THTensor_(cmaxValue)(THTensor *r, THTensor *t, real value) {
THTensor_(resizeAs)(r, t);
TH_TENSOR_APPLY2(real, r, real, t,
*r_data = *t_data < value ? value : *t_data;); // this order propagates NaN
}
void THTensor_(cminValue)(THTensor *r, THTensor *t, real value) {
THTensor_(resizeAs)(r, t);
TH_TENSOR_APPLY2(real, r, real, t,
*r_data = *t_data > value ? value : *t_data;); // this order propagates NaN
}
void THTensor_(zerosLike)(THTensor *r_, THTensor *input)
{
THTensor_(resizeAs)(r_, input);
THTensor_(zero)(r_);
}
void THTensor_(onesLike)(THTensor *r_, THTensor *input)
{
THTensor_(resizeAs)(r_, input);
THTensor_(fill)(r_, 1);
}
void THTensor_(diag)(THTensor *r_, THTensor *t, int k)
{
THArgCheck(THTensor_(nDimensionLegacyNoScalars)(t) == 1 || THTensor_(nDimensionLegacyNoScalars)(t) == 2, 1, "matrix or a vector expected");
if(THTensor_(nDimensionLegacyNoScalars)(t) == 1)
{
real *t_data = THTensor_(data)(t);
int64_t t_stride_0 = THTensor_strideLegacyNoScalars(t, 0);
int64_t t_size = THTensor_sizeLegacyNoScalars(t, 0);
int64_t sz = t_size + (k >= 0 ? k : -k);
real *r__data;
int64_t r__stride_0;
int64_t r__stride_1;
int64_t i;
THTensor_(resize2d)(r_, sz, sz);
THTensor_(zero)(r_);
r__data = THTensor_(data)(r_);
r__stride_0 = THTensor_(stride)(r_, 0);
r__stride_1 = THTensor_(stride)(r_, 1);
r__data += (k >= 0 ? k*r__stride_1 : -k*r__stride_0);
for(i = 0; i < t_size; i++)
r__data[i*(r__stride_0+r__stride_1)] = t_data[i*t_stride_0];
}
else
{
real *t_data = THTensor_(data)(t);
int64_t t_stride_0 = THTensor_(stride)(t, 0);
int64_t t_stride_1 = THTensor_(stride)(t, 1);
int64_t sz;
real *r__data;
int64_t r__stride_0;
int64_t i;
if(k >= 0)
sz = THMin(THTensor_(size)(t, 0), THTensor_(size)(t, 1)-k);
else
sz = THMin(THTensor_(size)(t, 0)+k, THTensor_(size)(t, 1));
THTensor_(resize1d)(r_, sz);
r__data = THTensor_(data)(r_);
r__stride_0 = THTensor_(stride)(r_, 0);
t_data += (k >= 0 ? k*t_stride_1 : -k*t_stride_0);
for(i = 0; i < sz; i++)
r__data[i*r__stride_0] = t_data[i*(t_stride_0+t_stride_1)];
}
}
void THTensor_(eye)(THTensor *r_, int64_t n, int64_t m)
{
real *r__data;
int64_t i, sz;
THArgCheck(n > 0, 1, "invalid argument");
if(m <= 0)
m = n;
THTensor_(resize2d)(r_, n, m);
THTensor_(zero)(r_);
i = 0;
r__data = THTensor_(data)(r_);
sz = THMin(THTensor_(size)(r_, 0), THTensor_(size)(r_, 1));
for(i = 0; i < sz; i++)
r__data[i*(r_->stride(0)+r_->stride(1))] = 1;
}
void THTensor_(range)(THTensor *r_, accreal xmin, accreal xmax, accreal step)
{
ptrdiff_t size;
real i = 0;
THArgCheck(step > 0 || step < 0, 3, "step must be nonzero");
THArgCheck(((step > 0) && (xmax >= xmin)) || ((step < 0) && (xmax <= xmin))
, 2, "upper bound and larger bound inconsistent with step sign");
size = (ptrdiff_t) (((xmax - xmin) / step) + 1);
if (THTensor_(nElement)(r_) != size) {
THTensor_(resize1d)(r_, size);
}
TH_TENSOR_APPLY(real, r_, *r__data = xmin + (i++)*step;);
}
void THTensor_(arange)(THTensor *r_, accreal xmin, accreal xmax, accreal step) {
ptrdiff_t size;
real i = 0;
THArgCheck(step > 0 || step < 0, 3, "step must be nonzero");
THArgCheck(((step > 0) && (xmax >= xmin)) || ((step < 0) && (xmax <= xmin))
, 2, "upper bound and larger bound inconsistent with step sign");
size = (ptrdiff_t) ceil((double)(xmax - xmin) / step);
if (THTensor_(nElement)(r_) != size) {
THTensor_(resize1d)(r_, size);
}
TH_TENSOR_APPLY(real, r_, *r__data = xmin + (i++)*step;);
}
void THTensor_(randperm)(THTensor *r_, THGenerator *_generator, int64_t n)
{
real *r__data;
int64_t r__stride_0;
int64_t i;
THArgCheck(n > 0, 1, "must be strictly positive");
THTensor_(resize1d)(r_, n);
r__data = THTensor_(data)(r_);
r__stride_0 = THTensor_(stride)(r_,0);
for(i = 0; i < n; i++)
r__data[i*r__stride_0] = (real)(i);
for(i = 0; i < n-1; i++)
{
int64_t z = THRandom_random(_generator) % (n-i);
real sav = r__data[i*r__stride_0];
r__data[i*r__stride_0] = r__data[(z+i)*r__stride_0];
r__data[(z+i)*r__stride_0] = sav;
}
}
/* I cut and pasted (slightly adapted) the quicksort code from
Sedgewick's 1978 "Implementing Quicksort Programs" article
http://www.csie.ntu.edu.tw/~b93076/p847-sedgewick.pdf
It is the state of the art existing implementation. The macros
are here to make as close a match as possible to the pseudocode of
Program 2 p.851
Note that other partition schemes exist, and are typically presented
in textbook, but those are less efficient. See e.g.
http://cs.stackexchange.com/questions/11458/quicksort-partitioning-hoare-vs-lomuto
Julien, November 12th 2013
*/
#define MAX_LEVELS 300
#define M_SMALL 10 /* Limit for small subfiles */
#define ARR(III) arr[(III)*stride]
#define IDX(III) idx[(III)*stride]
#define LONG_SWAP(AAA, BBB) swap = AAA; AAA = BBB; BBB = swap
#define REAL_SWAP(AAA, BBB) rswap = AAA; AAA = BBB; BBB = rswap
#define ARR_SWAP(III, JJJ) \
REAL_SWAP(ARR(III), ARR(JJJ));
#define BOTH_SWAP(III, JJJ) \
REAL_SWAP(ARR(III), ARR(JJJ)); \
LONG_SWAP(IDX(III), IDX(JJJ))
static void THTensor_(quicksortascend)(real *arr, int64_t *idx, int64_t elements, int64_t stride)
{
int64_t beg[MAX_LEVELS], end[MAX_LEVELS], i, j, L, R, P, swap, pid, stack = 0, sz_right, sz_left;
real rswap, piv;
unsigned char done = 0;
/* beg[0]=0; end[0]=elements; */
stack = 0;
L = 0; R = elements-1;
done = elements-1 <= M_SMALL;
while(!done) {
/* Use median of three for pivot choice */
P=(L+R)>>1;
BOTH_SWAP(P, L+1);
if (ARR(L+1) > ARR(R)) { BOTH_SWAP(L+1, R); }
if (ARR(L) > ARR(R)) { BOTH_SWAP(L, R); }
if (ARR(L+1) > ARR(L)) { BOTH_SWAP(L+1, L); }
i = L+1; j = R; piv = ARR(L); pid = IDX(L);
do {
do { i = i+1; } while(ARR(i) < piv);
do { j = j-1; } while(ARR(j) > piv);
if (j < i)
break;
BOTH_SWAP(i, j);
} while(1);
BOTH_SWAP(L, j);
/* Left subfile is (L, j-1) */
/* Right subfile is (i, R) */
sz_left = j-L;
sz_right = R-i+1;
if (sz_left <= M_SMALL && sz_right <= M_SMALL) {
/* both subfiles are small */
/* if stack empty */
if (stack == 0) {
done = 1;
} else {
stack--;
L = beg[stack];
R = end[stack];
}
} else if (sz_left <= M_SMALL || sz_right <= M_SMALL) {
/* exactly one of the subfiles is small */
/* (L,R) = large subfile */
if (sz_left > sz_right) {
/* Implicit: L = L; */
R = j-1;
} else {
L = i;
/* Implicit: R = R; */
}
} else {
/* none of the subfiles is small */
/* push large subfile */
/* (L,R) = small subfile */
if (sz_left > sz_right) {
beg[stack] = L;
end[stack] = j-1;
stack++;
L = i;
/* Implicit: R = R */
} else {
beg[stack] = i;
end[stack] = R;
stack++;
/* Implicit: L = L; */
R = j-1;
}
}
} /* while not done */
/* Now insertion sort on the concatenation of subfiles */
for(i=elements-2; i>=0; i--) {
if (ARR(i) > ARR(i+1)) {
piv = ARR(i);
pid = IDX(i);
j = i+1;
do {
ARR(j-1) = ARR(j);
IDX(j-1) = IDX(j);
j = j+1;
} while(j < elements && ARR(j) < piv);
ARR(j-1) = piv;
IDX(j-1) = pid;
}
}
}
static void THTensor_(quicksortdescend)(real *arr, int64_t *idx, int64_t elements, int64_t stride)
{
int64_t beg[MAX_LEVELS], end[MAX_LEVELS], i, j, L, R, P, swap, pid, stack = 0, sz_right, sz_left;
real rswap, piv;
unsigned char done = 0;
/* beg[0]=0; end[0]=elements; */
stack = 0;
L = 0; R = elements-1;
done = elements-1 <= M_SMALL;
while(!done) {
/* Use median of three for pivot choice */
P=(L+R)>>1;
BOTH_SWAP(P, L+1);
if (ARR(L+1) < ARR(R)) { BOTH_SWAP(L+1, R); }
if (ARR(L) < ARR(R)) { BOTH_SWAP(L, R); }
if (ARR(L+1) < ARR(L)) { BOTH_SWAP(L+1, L); }
i = L+1; j = R; piv = ARR(L); pid = IDX(L);
do {
do { i = i+1; } while(ARR(i) > piv);
do { j = j-1; } while(ARR(j) < piv);
if (j < i)
break;
BOTH_SWAP(i, j);
} while(1);
BOTH_SWAP(L, j);
/* Left subfile is (L, j-1) */
/* Right subfile is (i, R) */
sz_left = j-L;
sz_right = R-i+1;
if (sz_left <= M_SMALL && sz_right <= M_SMALL) {
/* both subfiles are small */
/* if stack empty */
if (stack == 0) {
done = 1;
} else {
stack--;
L = beg[stack];
R = end[stack];
}
} else if (sz_left <= M_SMALL || sz_right <= M_SMALL) {
/* exactly one of the subfiles is small */
/* (L,R) = large subfile */
if (sz_left > sz_right) {
/* Implicit: L = L; */
R = j-1;
} else {
L = i;
/* Implicit: R = R; */
}
} else {
/* none of the subfiles is small */
/* push large subfile */
/* (L,R) = small subfile */
if (sz_left > sz_right) {
beg[stack] = L;
end[stack] = j-1;
stack++;
L = i;
/* Implicit: R = R */
} else {
beg[stack] = i;
end[stack] = R;
stack++;
/* Implicit: L = L; */
R = j-1;
}
}
} /* while not done */
/* Now insertion sort on the concatenation of subfiles */
for(i=elements-2; i>=0; i--) {
if (ARR(i) < ARR(i+1)) {
piv = ARR(i);
pid = IDX(i);
j = i+1;
do {
ARR(j-1) = ARR(j);
IDX(j-1) = IDX(j);
j = j+1;
} while(j < elements && ARR(j) > piv);
ARR(j-1) = piv;
IDX(j-1) = pid;
}
}
}
#undef MAX_LEVELS
#undef M_SMALL
void THTensor_(sort)(THTensor *rt_, THLongTensor *ri_, THTensor *t, int dimension, int descendingOrder)
{
THArgCheck(dimension >= 0 && dimension < THTensor_(nDimensionLegacyNoScalars)(t), 2, "invalid dimension %d",
dimension + TH_INDEX_BASE);
THTensor_(resizeAs)(rt_, t);
THTensor_(copy)(rt_, t);
{
THLongStorage *size = THTensor_(newSizeOf)(t);
THLongTensor_resize(ri_, size, NULL);
THLongStorage_free(size);
}
if(descendingOrder)
{
TH_TENSOR_DIM_APPLY2(real, rt_, int64_t, ri_, dimension,
int64_t i;
for(i = 0; i < ri__size; i++)
ri__data[i*ri__stride] = i;
THTensor_(quicksortdescend)(rt__data, ri__data, rt__size, rt__stride);)
}
else
{
TH_TENSOR_DIM_APPLY2(real, rt_, int64_t, ri_, dimension,
int64_t i;
for(i = 0; i < ri__size; i++)
ri__data[i*ri__stride] = i;
THTensor_(quicksortascend)(rt__data, ri__data, rt__size, rt__stride);)
}
}
/* Implementation of the Quickselect algorithm, based on Nicolas Devillard's
public domain implementation at http://ndevilla.free.fr/median/median/
Adapted similarly to the above Quicksort algorithm.
This version does not produce indices along with values. */
static void THTensor_(quickselectnoidx)(real *arr, int64_t k, int64_t elements, int64_t stride)
{
int64_t P, L, R, i, j;
real rswap, piv;
L = 0;
R = elements-1;
do {
if (R <= L) /* One element only */
return;
if (R == L+1) { /* Two elements only */
if (ARR(L) > ARR(R)) {
ARR_SWAP(L, R);
}
return;
}
/* Use median of three for pivot choice */
P=(L+R)>>1;
ARR_SWAP(P, L+1);
if (ARR(L+1) > ARR(R)) { ARR_SWAP(L+1, R); }
if (ARR(L) > ARR(R)) { ARR_SWAP(L, R); }
if (ARR(L+1) > ARR(L)) { ARR_SWAP(L+1, L); }
i = L+1;
j = R;
piv = ARR(L);
do {
do i++; while(ARR(i) < piv);
do j--; while(ARR(j) > piv);
if (j < i)
break;
ARR_SWAP(i, j);
} while(1);
ARR_SWAP(L, j);
/* Re-set active partition */
if (j <= k) L=i;
if (j >= k) R=j-1;
} while(1);
}
/* Implementation of the Quickselect algorithm, based on Nicolas Devillard's
public domain implementation at http://ndevilla.free.fr/median/median/
Adapted similarly to the above Quicksort algorithm. */
static void THTensor_(quickselect)(real *arr, int64_t *idx, int64_t k, int64_t elements, int64_t stride)
{
int64_t P, L, R, i, j, swap;
real rswap, piv;
L = 0;
R = elements-1;
do {
if (R <= L) /* One element only */
return;
if (R == L+1) { /* Two elements only */
if (ARR(L) > ARR(R)) {
BOTH_SWAP(L, R);
}
return;
}
/* Use median of three for pivot choice */
P=(L+R)>>1;
BOTH_SWAP(P, L+1);
if (ARR(L+1) > ARR(R)) { BOTH_SWAP(L+1, R); }
if (ARR(L) > ARR(R)) { BOTH_SWAP(L, R); }
if (ARR(L+1) > ARR(L)) { BOTH_SWAP(L+1, L); }
i = L+1;
j = R;
piv = ARR(L);
do {
do i++; while(ARR(i) < piv);
do j--; while(ARR(j) > piv);
if (j < i)
break;
BOTH_SWAP(i, j);
} while(1);
BOTH_SWAP(L, j);
/* Re-set active partition */
if (j <= k) L=i;
if (j >= k) R=j-1;
} while(1);
}
#undef ARR
#undef IDX
#undef LONG_SWAP
#undef REAL_SWAP
#undef BOTH_SWAP
real THTensor_(medianall)(THTensor *tensor)
{
THArgCheck(THTensor_nDimensionLegacyAll(tensor) > 0, 1, "tensor must have one dimension");
real theMedian;
ptrdiff_t numel;
int64_t k;
THTensor *temp_;
real *temp__data;
numel = THTensor_(nElement)(tensor);
k = (numel-1) >> 1;
temp_ = THTensor_(newClone)(tensor);
temp__data = THTensor_(data)(temp_);
THTensor_(quickselectnoidx)(temp__data, k, numel, 1);
theMedian = temp__data[k];
THTensor_(free)(temp_);
return theMedian;
}
void THTensor_(mode)(THTensor *values_, THLongTensor *indices_, THTensor *t, int dimension, int keepdim)
{
THLongStorage *dim;
THTensor *temp_;
THLongTensor *tempi_;
real *temp__data;
int64_t *tempi__data;
int64_t t_size_dim;
THArgCheck(dimension >= 0 && dimension < THTensor_(nDimensionLegacyAll)(t), 3, "dimension out of range");
int in_dims = THTensor_(nDimensionLegacyAll)(t);
THTensor_(preserveReduceDimSemantics)(values_, in_dims, dimension, keepdim);
THLongTensor_preserveReduceDimSemantics(indices_, in_dims, dimension, keepdim);
dim = THTensor_(newSizeOf)(t);
THLongStorage_set(dim, dimension, 1);
THTensor_(resize)(values_, dim, NULL);
THLongTensor_resize(indices_, dim, NULL);
THLongStorage_free(dim);
t_size_dim = THTensor_sizeLegacyNoScalars(t, dimension);
temp_ = THTensor_(new)();
THTensor_(resize1d)(temp_, t_size_dim);
temp__data = THTensor_(data)(temp_);
tempi_ = THLongTensor_new();
THLongTensor_resize1d(tempi_, t_size_dim);
tempi__data = THLongTensor_data(tempi_);
TH_TENSOR_DIM_APPLY3(real, t, real, values_, int64_t, indices_, dimension,
TH_TENSOR_DIM_APPLY3_SIZE_EQ_EXCEPT_DIM,
int64_t i;
real mode = 0;
int64_t modei = 0;
int64_t temp_freq = 0;
int64_t max_freq = 0;
for(i = 0; i < t_size_dim; i++)
temp__data[i] = t_data[i*t_stride];
for(i = 0; i < t_size_dim; i++)
tempi__data[i] = i;
THTensor_(quicksortascend)(temp__data, tempi__data, t_size_dim, 1);
for(i = 0; i < t_size_dim; i++)
{
temp_freq++;
if ((i == t_size_dim - 1) || (temp__data[i] != temp__data[i+1]))
{
if (temp_freq > max_freq)
{
mode = temp__data[i];
modei = tempi__data[i];
max_freq = temp_freq;
}
temp_freq = 0;
}
}
*values__data = mode;
*indices__data = modei;);
THTensor_(free)(temp_);
THLongTensor_free(tempi_);
if (!keepdim) {
THTensor_(squeeze1d)(values_, values_, dimension);
THLongTensor_squeeze1d(indices_, indices_, dimension);
}
}
void THTensor_(kthvalue)(THTensor *values_, THLongTensor *indices_, THTensor *t, int64_t k, int dimension, int keepdim)
{
THLongStorage *dim;
THTensor *temp_;
THLongTensor *tempi_;
real *temp__data;
int64_t *tempi__data;
int64_t t_size_dim;
THArgCheck(dimension >= 0 && dimension < THTensor_(nDimensionLegacyAll)(t), 3, "dimension out of range");
THArgCheck(k > 0 && k <= THTensor_sizeLegacyNoScalars(t, dimension), 2, "selected index out of range");
int in_dims = THTensor_(nDimensionLegacyAll)(t);
THTensor_(preserveReduceDimSemantics)(values_, in_dims, dimension, keepdim);
THLongTensor_preserveReduceDimSemantics(indices_, in_dims, dimension, keepdim);
dim = THTensor_(newSizeOf)(t);
THLongStorage_set(dim, dimension, 1);
THTensor_(resize)(values_, dim, NULL);
THLongTensor_resize(indices_, dim, NULL);
THLongStorage_free(dim);
t_size_dim = THTensor_sizeLegacyNoScalars(t, dimension);
temp_ = THTensor_(new)();
THTensor_(resize1d)(temp_, t_size_dim);
temp__data = THTensor_(data)(temp_);
tempi_ = THLongTensor_new();
THLongTensor_resize1d(tempi_, t_size_dim);
tempi__data = THLongTensor_data(tempi_);
TH_TENSOR_DIM_APPLY3(real, t, real, values_, int64_t, indices_, dimension,
TH_TENSOR_DIM_APPLY3_SIZE_EQ_EXCEPT_DIM,
int64_t i;
for(i = 0; i < t_size_dim; i++)
temp__data[i] = t_data[i*t_stride];
for(i = 0; i < t_size_dim; i++)
tempi__data[i] = i;
THTensor_(quickselect)(temp__data, tempi__data, k - 1, t_size_dim, 1);
*values__data = temp__data[k-1];
*indices__data = tempi__data[k-1];);
THTensor_(free)(temp_);
THLongTensor_free(tempi_);
if (!keepdim) {
THTensor_(squeeze1d)(values_, values_, dimension);
THLongTensor_squeeze1d(indices_, indices_, dimension);
}
}
void THTensor_(median)(THTensor *values_, THLongTensor *indices_, THTensor *t, int dimension, int keepdim)
{
int64_t t_size_dim, k;
THArgCheck(dimension >= 0 && dimension < THTensor_(nDimensionLegacyAll)(t), 3, "dimension out of range");
t_size_dim = THTensor_sizeLegacyNoScalars(t, dimension);
k = (t_size_dim-1) >> 1; /* take middle or one-before-middle element */
THTensor_(kthvalue)(values_, indices_, t, k+1, dimension, keepdim);
}
void THTensor_(topk)(THTensor *rt_, THLongTensor *ri_, THTensor *t, int64_t k, int dim, int dir, int sorted)
{
int numDims = THTensor_(nDimensionLegacyNoScalars)(t);
THArgCheck(dim >= 0 && dim < numDims, 3, "dim not in range");
int64_t sliceSize = THTensor_sizeLegacyNoScalars(t, dim);
THArgCheck(k >= 0 && k <= sliceSize, 2, "k not in range for dimension");
THTensor *tmpResults = THTensor_(new)();
THTensor_(resize1d)(tmpResults, sliceSize);
real *tmp__data = THTensor_(data)(tmpResults);
THLongTensor *tmpIndices = THLongTensor_new();
THLongTensor_resize1d(tmpIndices, sliceSize);
int64_t *tmpi__data = THLongTensor_data(tmpIndices);
THLongStorage *topKSize = THTensor_(newSizeOf)(t);
THLongStorage_set(topKSize, dim, k);
THTensor_(resize)(rt_, topKSize, NULL);
THLongTensor_resize(ri_, topKSize, NULL);
THLongStorage_free(topKSize);
if (dir) {
/* k largest elements, descending order (optional: see sorted) */
int64_t K = sliceSize - k;
TH_TENSOR_DIM_APPLY3(real, t, real, rt_, int64_t, ri_, dim,
TH_TENSOR_DIM_APPLY3_SIZE_EQ_EXCEPT_DIM,
int64_t i;
for(i = 0; i < sliceSize; i++)
{
tmp__data[i] = t_data[i*t_stride];
tmpi__data[i] = i;
}
if (K > 0)
THTensor_(quickselect)(tmp__data, tmpi__data, K - 1, sliceSize, 1);
if (sorted)
THTensor_(quicksortdescend)(tmp__data + K, tmpi__data + K, k, 1);
for(i = 0; i < k; i++)
{
rt__data[i*rt__stride] = tmp__data[i + K];
ri__data[i*ri__stride] = tmpi__data[i + K];
})
}
else {
/* k smallest elements, ascending order (optional: see sorted) */
TH_TENSOR_DIM_APPLY3(real, t, real, rt_, int64_t, ri_, dim,
TH_TENSOR_DIM_APPLY3_SIZE_EQ_EXCEPT_DIM,
int64_t i;
for(i = 0; i < sliceSize; i++)
{
tmp__data[i] = t_data[i*t_stride];
tmpi__data[i] = i;
}
THTensor_(quickselect)(tmp__data, tmpi__data, k - 1, sliceSize, 1);
if (sorted)
THTensor_(quicksortascend)(tmp__data, tmpi__data, k - 1, 1);
for(i = 0; i < k; i++)
{
rt__data[i*rt__stride] = tmp__data[i];
ri__data[i*ri__stride] = tmpi__data[i];
})
}
THTensor_(free)(tmpResults);
THLongTensor_free(tmpIndices);
}
void THTensor_(tril)(THTensor *r_, THTensor *t, int64_t k)
{
int64_t t_size_0, t_size_1;
int64_t t_stride_0, t_stride_1;
int64_t r__stride_0, r__stride_1;
real *t_data, *r__data;
int64_t r, c;
THArgCheck(THTensor_(nDimensionLegacyAll)(t) == 2, 1, "expected a matrix");
THTensor_(resizeAs)(r_, t);
t_size_0 = THTensor_(size)(t, 0);
t_size_1 = THTensor_(size)(t, 1);
t_stride_0 = THTensor_(stride)(t, 0);
t_stride_1 = THTensor_(stride)(t, 1);
r__stride_0 = THTensor_(stride)(r_, 0);
r__stride_1 = THTensor_(stride)(r_, 1);
r__data = THTensor_(data)(r_);
t_data = THTensor_(data)(t);
for(r = 0; r < t_size_0; r++)
{
int64_t sz = THMin(r+k+1, t_size_1);
for(c = THMax(0, r+k+1); c < t_size_1; c++)
r__data[r*r__stride_0+c*r__stride_1] = 0;
for(c = 0; c < sz; c++)
r__data[r*r__stride_0+c*r__stride_1] = t_data[r*t_stride_0+c*t_stride_1];
}
}
void THTensor_(triu)(THTensor *r_, THTensor *t, int64_t k)
{
int64_t t_size_0, t_size_1;
int64_t t_stride_0, t_stride_1;
int64_t r__stride_0, r__stride_1;
real *t_data, *r__data;
int64_t r, c;
THArgCheck(THTensor_(nDimensionLegacyAll)(t) == 2, 1, "expected a matrix");
THTensor_(resizeAs)(r_, t);
t_size_0 = THTensor_(size)(t, 0);
t_size_1 = THTensor_(size)(t, 1);
t_stride_0 = THTensor_(stride)(t, 0);
t_stride_1 = THTensor_(stride)(t, 1);
r__stride_0 = THTensor_(stride)(r_, 0);
r__stride_1 = THTensor_(stride)(r_, 1);
r__data = THTensor_(data)(r_);
t_data = THTensor_(data)(t);
for(r = 0; r < t_size_0; r++)
{
int64_t sz = THMin(r+k, t_size_1);
for(c = THMax(0, r+k); c < t_size_1; c++)
r__data[r*r__stride_0+c*r__stride_1] = t_data[r*t_stride_0+c*t_stride_1];
for(c = 0; c < sz; c++)
r__data[r*r__stride_0+c*r__stride_1] = 0;
}
}
void THTensor_(cat)(THTensor *r_, THTensor *ta, THTensor *tb, int dimension)
{
THTensor* inputs[2];
inputs[0] = ta;
inputs[1] = tb;
THTensor_(catArray)(r_, inputs, 2, dimension);
}
void THTensor_(check_shape_except_dim)(THTensor *first, THTensor *second, int dimension);
inline void THTensor_(check_shape_except_dim)(THTensor *first, THTensor *second, int dimension)
{
int first_dims = first->dim();
int second_dims = second->dim();
THArgCheck(first_dims == second_dims, 0,
"Tensors must have same number of dimensions: got %d and %d",
first_dims, second_dims);
for (int dim = 0; dim < first_dims; dim++) {
if (dim == dimension) {
continue;
}
int64_t first_dim_size = first->size(dim);
int64_t second_dim_size = second->size(dim);
THArgCheck(first_dim_size == second_dim_size, 0,
"Sizes of tensors must match except in dimension %d. Got %lld and %lld in dimension %d",
dimension, (long long)first_dim_size, (long long)second_dim_size, dim);
}
}
void THTensor_(catArray)(THTensor *result, THTensor **inputs, int numInputs, int dimension)
{
// previously, size [0] tensors were the only possible empty tensors; thus, it wasn't possible
// to cat empty tensors unless all the other tensors were 1-dimensional, so we allowed these tensors
// to be "skipped". We maintain this behavior for backwards compatibility, but only for this specific
// size (i.e. other empty sizes are not skipped).
// FIXME: warn if this is the case
bool allSkipped= true;
int64_t nDims = 0;
THTensor *notSkippedTensor; // non-owning reference
auto should_skip = [](THTensor *t) { return t->is_empty() && t->dim() == 1; };
for (int i = 0; i < numInputs; i++) {
if (should_skip(inputs[i])) {
continue;
}
// We've found a non-empty tensor
allSkipped = false;
notSkippedTensor = inputs[i];
nDims = notSkippedTensor->dim();
break;
}
if (allSkipped) {
return;
}
// Compute cat_dimension based on the non-empty tensor
THArgCheck(dimension < nDims, 4, "invalid dimension %d", dimension);
THArgCheck(numInputs > 0, 3, "invalid number of inputs %d", numInputs);
// Compute size of the result in the cat dimension
int64_t cat_dim_size = 0;
for (int i = 0; i < numInputs; i++) {
THTensor *tensor = inputs[i];
if (should_skip(tensor)) {
continue;
}
THTensor_(check_shape_except_dim)(notSkippedTensor, tensor, dimension);
cat_dim_size += tensor->size(dimension);
}
// Compute the size of the result
THLongStorage *size = THLongStorage_newWithSize(nDims);
for (int dim = 0; dim < nDims; dim++) {
int64_t result_dim_size = notSkippedTensor->size(dim);
if (dim == dimension) {
result_dim_size = cat_dim_size;
}
THLongStorage_data(size)[dim] = result_dim_size;
}
THTensor_(resize)(result, size, NULL);
// Check contiguity of all inputs and result
bool allContiguous = true;
for (int i = 0; i < numInputs; i++) {
if(!should_skip(inputs[i])) {
allContiguous = allContiguous && THTensor_(isContiguous)(inputs[i]);
}
}
allContiguous = allContiguous && THTensor_(isContiguous)(result);
// First path is for contiguous inputs along dim 0
// Second path for non-contiguous
int64_t offset;
if (dimension == 0 && allContiguous) {
real* result_data = THStorage_(data)(THTensor_getStoragePtr(result)) + result->storage_offset();
offset = 0;
for (int j = 0; j < numInputs; j++) {
if (!should_skip(inputs[j])) {
THTensor* input0 = inputs[j];
real* input0_data = THStorage_(data)(THTensor_getStoragePtr(input0)) + input0->storage_offset();
int64_t input0_size = THTensor_(nElement)(input0);
// C standard says you can't pass nullptrs to memcpy, even if the size is 0; ubsan checks this.
if (input0_size != 0) {
memcpy(result_data + offset, input0_data, input0_size*sizeof(real));
}
offset += input0_size;
}
}
} else {
offset = 0;
for (int j = 0; j < numInputs; j++) {
if (!should_skip(inputs[j])) {
int64_t dimSize = inputs[j]->size(dimension);
THTensor *nt = THTensor_(newWithTensor)(result);
THTensor_(narrow)(nt, NULL, dimension, offset, dimSize);
THTensor_(copy)(nt, inputs[j]);
THTensor_(free)(nt);
offset += dimSize;
}
}
}
THLongStorage_free(size);
}
int THTensor_(equal)(THTensor *ta, THTensor* tb)
{
int equal = 1;
if(!THTensor_(isSameSizeAs)(ta, tb))
return 0;
if (THTensor_(isContiguous)(ta) && THTensor_(isContiguous)(tb)) {
real *tap = THTensor_(data)(ta);
real *tbp = THTensor_(data)(tb);
ptrdiff_t sz = THTensor_(nElement)(ta);
ptrdiff_t i;
for (i=0; i<sz; ++i){
if(tap[i] != tbp[i]) return 0;
}
} else {
// Short-circuit the apply function on inequality
TH_TENSOR_APPLY2(real, ta, real, tb,
if (equal && *ta_data != *tb_data) {
equal = 0;
TH_TENSOR_APPLY_hasFinished = 1; break;
})
}
return equal;
}
#define TENSOR_IMPLEMENT_LOGICAL(NAME,OP) \
void THTensor_(NAME##Value)(THByteTensor *r_, THTensor* t, real value) \
{ \
THByteTensor_resizeNd(r_, t->dim(), THTensor_getSizePtr(t), NULL); \
TH_TENSOR_APPLY2(unsigned char, r_, real, t, \
*r__data = (*t_data OP value) ? 1 : 0;); \
} \
void THTensor_(NAME##ValueT)(THTensor* r_, THTensor* t, real value) \
{ \
THTensor_(resizeNd)(r_, t->dim(), THTensor_getSizePtr(t), NULL); \
TH_TENSOR_APPLY2(real, r_, real, t, \
*r__data = (*t_data OP value) ? 1 : 0;); \
} \
void THTensor_(NAME##Tensor)(THByteTensor *r_, THTensor *ta, THTensor *tb) \
{ \
THByteTensor_resizeNd(r_, ta->dim(), THTensor_getSizePtr(ta), NULL); \
TH_TENSOR_APPLY3(unsigned char, r_, real, ta, real, tb, \
*r__data = (*ta_data OP *tb_data) ? 1 : 0;); \
} \
void THTensor_(NAME##TensorT)(THTensor *r_, THTensor *ta, THTensor *tb) \
{ \
THTensor_(resizeNd)(r_, ta->dim(), THTensor_getSizePtr(ta), NULL); \
TH_TENSOR_APPLY3(real, r_, real, ta, real, tb, \
*r__data = (*ta_data OP *tb_data) ? 1 : 0;); \
} \
TENSOR_IMPLEMENT_LOGICAL(lt,<)
TENSOR_IMPLEMENT_LOGICAL(gt,>)
TENSOR_IMPLEMENT_LOGICAL(le,<=)
TENSOR_IMPLEMENT_LOGICAL(ge,>=)
TENSOR_IMPLEMENT_LOGICAL(eq,==)
TENSOR_IMPLEMENT_LOGICAL(ne,!=)
#ifdef _OPENMP
#define LAB_IMPLEMENT_BASIC_FUNCTION_3_ARGS(NAME, CFUNC, OMP_THRESHOLD) \
void THTensor_(NAME)(THTensor *r_, THTensor *t) \
{ \
THTensor_(resizeAs)(r_, t); \
ptrdiff_t r_Size = THTensor_(nElement)(r_); \
int r_Contig = THTensor_(isContiguous)(r_); \
int tContig = THTensor_(isContiguous)(t); \
int inOMP = omp_in_parallel(); \
if( !inOMP ){ \
TH_TENSOR_APPLY2_OMP(r_Size, r_Contig, tContig, real, r_, real, t, *r__data = CFUNC(*t_data);, OMP_THRESHOLD); \
} else { \
TH_TENSOR_APPLY2(real, r_, real, t, *r__data = CFUNC(*t_data);); \
} \
}
#define LAB_IMPLEMENT_BASIC_FUNCTION_2_ARGS(NAME, CFUNC) \
LAB_IMPLEMENT_BASIC_FUNCTION_3_ARGS(NAME, CFUNC, UNCERTAIN_TH_OMP_OVERHEAD_THRESHOLD)
#define LAB_IMPLEMENT_VECTORIZED_FUNCTION_3_ARGS(NAME, CFUNC, OMP_THRESHOLD) \
void THTensor_(NAME)(THTensor *r_, THTensor *t) \
{ \
THTensor_(resizeAs)(r_, t); \
ptrdiff_t r_Size = THTensor_(nElement)(r_); \
int r_Contig = THTensor_(isContiguous)(r_); \
int tContig = THTensor_(isContiguous)(t); \
if (r_Contig && tContig) { \
TH_TENSOR_APPLY2_CONTIG(real, r_, real, t, THVector_(NAME)(r__data, t_data, r__len);); \
} else { \
int inOMP = omp_in_parallel(); \
if( !inOMP ){ \
TH_TENSOR_APPLY2_OMP(r_Size, r_Contig, tContig, real, r_, real, t, *r__data = CFUNC(*t_data);, OMP_THRESHOLD); \
} \
else { \
TH_TENSOR_APPLY2(real, r_, real, t, *r__data = CFUNC(*t_data);); \
} \
} \
}
#define LAB_IMPLEMENT_VECTORIZED_FUNCTION_2_ARGS(NAME, CFUNC) \
LAB_IMPLEMENT_VECTORIZED_FUNCTION_3_ARGS(NAME, CFUNC, UNCERTAIN_TH_OMP_OVERHEAD_THRESHOLD)
#else
#define LAB_IMPLEMENT_BASIC_FUNCTION_2_ARGS(NAME, CFUNC) \
void THTensor_(NAME)(THTensor *r_, THTensor *t) \
{ \
THTensor_(resizeAs)(r_, t); \
TH_TENSOR_APPLY2(real, t, real, r_, *r__data = CFUNC(*t_data);); \
} \
#define LAB_IMPLEMENT_BASIC_FUNCTION_3_ARGS(NAME, CFUNC, PSEUDO_OMP_THRESHOLD) \
LAB_IMPLEMENT_BASIC_FUNCTION_2_ARGS(NAME, CFUNC)
#define LAB_IMPLEMENT_VECTORIZED_FUNCTION_2_ARGS(NAME, CFUNC) \
void THTensor_(NAME)(THTensor *r_, THTensor *t) \
{ \
THTensor_(resizeAs)(r_, t); \
int r_Contig = THTensor_(isContiguous)(r_); \
int tContig = THTensor_(isContiguous)(t); \
if (r_Contig && tContig) { \
TH_TENSOR_APPLY2_CONTIG(real, r_, real, t, THVector_(NAME)(r__data, t_data, r__len);); \
} else { \
TH_TENSOR_APPLY2(real, t, real, r_, *r__data = CFUNC(*t_data);); \
} \
} \
#define LAB_IMPLEMENT_VECTORIZED_FUNCTION_3_ARGS(NAME, CFUNC, PSEUDO_OMP_THRESHOLD) \
LAB_IMPLEMENT_VECTORIZED_FUNCTION_2_ARGS(NAME, CFUNC)
#endif
#define EXPAND(...) __VA_ARGS__
#define GET_4TH_ARG(ARG0, ARG1, ARG2, ARG3, ...) ARG3
#define LAB_IMPLEMENT_BASIC_FUNCTION_CHOOSE(...) \
EXPAND(GET_4TH_ARG(__VA_ARGS__, LAB_IMPLEMENT_BASIC_FUNCTION_3_ARGS, LAB_IMPLEMENT_BASIC_FUNCTION_2_ARGS, ))
#define LAB_IMPLEMENT_VECTORIZED_FUNCTION_CHOOSE(...) \
EXPAND(GET_4TH_ARG(__VA_ARGS__, LAB_IMPLEMENT_VECTORIZED_FUNCTION_3_ARGS, LAB_IMPLEMENT_VECTORIZED_FUNCTION_2_ARGS, ))
#define LAB_IMPLEMENT_BASIC_FUNCTION(...) EXPAND(LAB_IMPLEMENT_BASIC_FUNCTION_CHOOSE(__VA_ARGS__)(__VA_ARGS__))
#define LAB_IMPLEMENT_VECTORIZED_FUNCTION(...) EXPAND(LAB_IMPLEMENT_VECTORIZED_FUNCTION_CHOOSE(__VA_ARGS__)(__VA_ARGS__))
/*
* LAB_IMPLEMENT_BASIC_FUNCTION is a macro with optional parameters, you can use it flexibly.
* The macro will discard the invalid openmp threshold if openmp is unavailable. The macro will give a default threshold even if you forget to pass one.
* In other word,
* (A), If openmp is UNavailable, the two usage below is both right.
* (1) LAB_IMPLEMENT_BASIC_FUNCTION(type_func, func_entity, OMP_OVERHEAD_THRESHOLD) // discard the invalid openmp threshold
* (2) LAB_IMPLEMENT_BASIC_FUNCTION(type_func, func_entity)
* (B), If openmp is available, the two usage below is also both right.
* (1) LAB_IMPLEMENT_BASIC_FUNCTION(type_func, func_entity, OMP_OVERHEAD_THRESHOLD)
* (2) LAB_IMPLEMENT_BASIC_FUNCTION(type_func, func_entity) // pass the default openmp threshold
* So do LAB_IMPLEMENT_VECTORIZED_FUNCTION.
*/
LAB_IMPLEMENT_BASIC_FUNCTION(neg,-)
#if defined(TH_REAL_IS_LONG)
LAB_IMPLEMENT_BASIC_FUNCTION(abs,labs)
#endif /* int64_t only part */
#if defined(TH_REAL_IS_SHORT) || defined(TH_REAL_IS_INT)
LAB_IMPLEMENT_BASIC_FUNCTION(abs,abs)
#endif /* int only part */
#if defined(TH_REAL_IS_BYTE) /* Byte only part */
int THTensor_(logicalAndAll)(THTensor *tensor)
{
real prod = 1;
int serial_path = 0;
#ifdef _OPENMP
int inOMP = omp_in_parallel();
if(inOMP) {
serial_path = 1;
} else {
TH_TENSOR_APPLY_REDUCTION_OMP(real, tensor, &&:prod, prod = prod && *tensor_data;, UNCERTAIN_TH_OMP_OVERHEAD_THRESHOLD);
}
#else
serial_path = 1;
#endif
if (serial_path) {
TH_TENSOR_APPLY(real, tensor, prod = prod && *tensor_data;);
}
return prod;
}
int THTensor_(logicalAnyAll)(THTensor *tensor)
{
real sum = 0;
int serial_path = 0;
#ifdef _OPENMP
int inOMP = omp_in_parallel();
if(inOMP) {
serial_path = 1;
} else {
TH_TENSOR_APPLY_REDUCTION_OMP(real, tensor, ||:sum, sum = sum || *tensor_data;, UNCERTAIN_TH_OMP_OVERHEAD_THRESHOLD);
}
#else
serial_path = 1;
#endif
if (serial_path) {
TH_TENSOR_APPLY(real, tensor, sum = sum || *tensor_data;);
}
return (bool)sum;
}
void THTensor_(logicalAnd)(THTensor *r_, THTensor *t, int dimension, int keepdim)
{
THLongStorage *dim;
THArgCheck(dimension >= 0 && dimension < THTensor_(nDimensionLegacyAll)(t), 2, "dimension %d out of range",
dimension + TH_INDEX_BASE);
THTensor_(preserveReduceDimSemantics)(r_, THTensor_(nDimensionLegacyAll)(t), dimension, keepdim);
dim = THTensor_(newSizeOf)(t);
THLongStorage_set(dim, dimension, 1);
THTensor_(resize)(r_, dim, NULL);
THLongStorage_free(dim);
int serial_path = 0;
#ifdef _OPENMP
int inOMP = omp_in_parallel();
if (inOMP) {
serial_path = 1;
} else {
int r_Contig = THTensor_(isContiguous)(r_);
real *tp = THTensor_(data)(t);
real *rp = THTensor_(data)(r_);
if(r_Contig && (tp != rp)){
ptrdiff_t iter = 0;
ptrdiff_t r_Size = THTensor_(nElement)(r_);
int r_Dim = THTensor_nDimensionLegacyAll(r_);
#pragma omp parallel for if ( r_Size > TH_OMP_OVERHEAD_THRESHOLD)
for (iter = 0; iter < r_Size; iter++) {
int j;
int64_t quot;
int64_t rem = iter;
ptrdiff_t tBasicIndex = 0;
for(j = 0; j < r_Dim; ++j) {
if(j != dimension){
quot = rem/r_->stride(j);
rem = rem%r_->stride(j);
tBasicIndex += quot*t->stride(j);
}
}
real *t_data = tp+tBasicIndex;
real *r__data = rp+iter;
*r__data = 1;
for(j=0; j < THTensor_sizeLegacyNoScalars(t, dimension); ++j) {
*r__data = *r__data && *(t_data + j*THTensor_strideLegacyNoScalars(t, dimension));
}
}
} else {
serial_path = 1;
}
}
#else
serial_path = 1;
#endif
if(serial_path) {
// two implementations optimized for data locality
if (THTensor_strideLegacyNoScalars(t, dimension) == 1) {
TH_TENSOR_DIM_APPLY2(real, t, real, r_, dimension,
accreal prod = 1;
int64_t i;
for(i = 0; i < t_size; i++)
prod = prod && t_data[i*t_stride];
*r__data = (real)prod;);
} else {
THTensor_(fill)(r_, 1);
THTensor *temp_ = THTensor_(newWithTensor)(r_);
// r_.expand_as(t)
THTensor_setSizeAtDim(temp_, dimension, THTensor_sizeLegacyNoScalars(t, dimension));
THTensor_setStrideAtDim(temp_, dimension, 0);
TH_TENSOR_APPLY2(real, temp_, real, t, *temp__data = *temp__data && *t_data;);
THTensor_(free)(temp_);
}
}
if (!keepdim) {
THTensor_(squeeze1d)(r_, r_, dimension);
}
}
void THTensor_(logicalAny)(THTensor *r_, THTensor *t, int dimension, int keepdim)
{
THLongStorage *dim;
THArgCheck(dimension >= 0 && dimension < THTensor_(nDimensionLegacyAll)(t), 2, "dimension %d out of range",
dimension + TH_INDEX_BASE);
THTensor_(preserveReduceDimSemantics)(r_, THTensor_(nDimensionLegacyAll)(t), dimension, keepdim);
dim = THTensor_(newSizeOf)(t);
THLongStorage_set(dim, dimension, 1);
THTensor_(resize)(r_, dim, NULL);
THLongStorage_free(dim);
int serial_path = 0;
#ifdef _OPENMP
int inOMP = omp_in_parallel();
if (inOMP) {
serial_path = 1;
} else {
int r_Contig = THTensor_(isContiguous)(r_);
real *tp = THTensor_(data)(t);
real *rp = THTensor_(data)(r_);
if(r_Contig && (tp != rp)){
ptrdiff_t iter = 0;
ptrdiff_t r_Size = THTensor_(nElement)(r_);
int r_Dim = THTensor_nDimensionLegacyAll(r_);
#pragma omp parallel for if ( r_Size > TH_OMP_OVERHEAD_THRESHOLD)
for (iter = 0; iter < r_Size; iter++) {
int j;
int64_t quot;
int64_t rem = iter;
ptrdiff_t tBasicIndex = 0;
for(j = 0; j < r_Dim; ++j) {
if(j != dimension){
quot = rem/r_->stride(j);
rem = rem%r_->stride(j);
tBasicIndex += quot*t->stride(j);
}
}
real *t_data = tp+tBasicIndex;
real *r__data = rp+iter;
*r__data = 0;
for(j=0; j < THTensor_sizeLegacyNoScalars(t, dimension); ++j) {
*r__data = *r__data || *(t_data + j*THTensor_strideLegacyNoScalars(t, dimension));
}
}
} else {
serial_path = 1;
}
}
#else
serial_path = 1;
#endif
if (serial_path) {
// two implementations optimized for data locality
if (THTensor_strideLegacyNoScalars(t, dimension) == 1) {
TH_TENSOR_DIM_APPLY2(real, t, real, r_, dimension,
accreal sum = 0;
int64_t i;
for(i = 0; i < t_size; i++)
sum = sum || t_data[i*t_stride];
*r__data = (real)sum;);
} else {
THTensor_(zero)(r_);
THTensor *temp_ = THTensor_(newWithTensor)(r_);
// r_.expand_as(t)
THTensor_setSizeAtDim(temp_, dimension, THTensor_sizeLegacyNoScalars(t, dimension));
THTensor_setStrideAtDim(temp_, dimension, 0);
TH_TENSOR_APPLY2(real, temp_, real, t, *temp__data = *temp__data || *t_data;);
THTensor_(free)(temp_);
}
}
if (!keepdim) {
THTensor_(squeeze1d)(r_, r_, dimension);
}
}
#endif /* Byte only part */
/* floating point only now */
#if defined(TH_REAL_IS_FLOAT) || defined(TH_REAL_IS_DOUBLE)
#if defined (TH_REAL_IS_FLOAT)
#define TH_MATH_NAME(fn) fn##f
#else
#define TH_MATH_NAME(fn) fn
#endif
LAB_IMPLEMENT_BASIC_FUNCTION(log,TH_MATH_NAME(log))
LAB_IMPLEMENT_BASIC_FUNCTION(lgamma,TH_MATH_NAME(lgamma))
LAB_IMPLEMENT_BASIC_FUNCTION(digamma,TH_MATH_NAME(TH_digamma))
LAB_IMPLEMENT_BASIC_FUNCTION(trigamma,TH_MATH_NAME(TH_trigamma))
LAB_IMPLEMENT_BASIC_FUNCTION(log10,TH_MATH_NAME(log10))
LAB_IMPLEMENT_BASIC_FUNCTION(log1p,TH_MATH_NAME(log1p))
LAB_IMPLEMENT_BASIC_FUNCTION(log2,TH_MATH_NAME(log2))
LAB_IMPLEMENT_BASIC_FUNCTION(erf,TH_MATH_NAME(erf))
LAB_IMPLEMENT_BASIC_FUNCTION(erfc,TH_MATH_NAME(erfc))
LAB_IMPLEMENT_BASIC_FUNCTION(erfinv,TH_erfinv)
LAB_IMPLEMENT_BASIC_FUNCTION(ceil,TH_MATH_NAME(ceil))
LAB_IMPLEMENT_BASIC_FUNCTION(floor,TH_MATH_NAME(floor))
LAB_IMPLEMENT_BASIC_FUNCTION(round,TH_MATH_NAME(round))
LAB_IMPLEMENT_BASIC_FUNCTION(abs,TH_MATH_NAME(fabs))
LAB_IMPLEMENT_BASIC_FUNCTION(trunc,TH_MATH_NAME(trunc))
LAB_IMPLEMENT_BASIC_FUNCTION(frac,TH_MATH_NAME(TH_frac))
LAB_IMPLEMENT_BASIC_FUNCTION(cinv, TH_MATH_NAME(1.0) / )
LAB_IMPLEMENT_BASIC_FUNCTION(exp,TH_MATH_NAME(exp),HYPER_TH_OMP_OVERHEAD_THRESHOLD)
LAB_IMPLEMENT_BASIC_FUNCTION(expm1,TH_MATH_NAME(expm1),HYPER_TH_OMP_OVERHEAD_THRESHOLD)
LAB_IMPLEMENT_BASIC_FUNCTION(cos,TH_MATH_NAME(cos),HYPER_TH_OMP_OVERHEAD_THRESHOLD)
LAB_IMPLEMENT_BASIC_FUNCTION(acos,TH_MATH_NAME(acos),HYPER_TH_OMP_OVERHEAD_THRESHOLD)
LAB_IMPLEMENT_BASIC_FUNCTION(cosh,TH_MATH_NAME(cosh),HYPER_TH_OMP_OVERHEAD_THRESHOLD)
LAB_IMPLEMENT_BASIC_FUNCTION(sin,TH_MATH_NAME(sin),HYPER_TH_OMP_OVERHEAD_THRESHOLD)
LAB_IMPLEMENT_BASIC_FUNCTION(asin,TH_MATH_NAME(asin),HYPER_TH_OMP_OVERHEAD_THRESHOLD)
LAB_IMPLEMENT_BASIC_FUNCTION(sinh,TH_MATH_NAME(sinh),HYPER_TH_OMP_OVERHEAD_THRESHOLD)
LAB_IMPLEMENT_BASIC_FUNCTION(tan,TH_MATH_NAME(tan),HYPER_TH_OMP_OVERHEAD_THRESHOLD)
LAB_IMPLEMENT_BASIC_FUNCTION(atan,TH_MATH_NAME(atan),HYPER_TH_OMP_OVERHEAD_THRESHOLD)
LAB_IMPLEMENT_BASIC_FUNCTION(tanh,TH_MATH_NAME(tanh),HYPER_TH_OMP_OVERHEAD_THRESHOLD)
LAB_IMPLEMENT_BASIC_FUNCTION(sqrt,TH_MATH_NAME(sqrt),HYPER_TH_OMP_OVERHEAD_THRESHOLD)
LAB_IMPLEMENT_BASIC_FUNCTION(rsqrt,TH_MATH_NAME(TH_rsqrt),HYPER_TH_OMP_OVERHEAD_THRESHOLD)
LAB_IMPLEMENT_VECTORIZED_FUNCTION(sigmoid,TH_MATH_NAME(TH_sigmoid),HYPER_TH_OMP_OVERHEAD_THRESHOLD)
void THTensor_(atan2)(THTensor *r_, THTensor *tx, THTensor *ty)
{
THTensor_(resizeAs)(r_, tx);
TH_TENSOR_APPLY3(real, r_, real, tx, real, ty, *r__data = TH_MATH_NAME(atan2)(*tx_data,*ty_data););
}
void THTensor_(polygamma)(THTensor *r_, int64_t n, THTensor *t) {
switch (n) {
case 0: THTensor_(digamma)(r_, t); return;
case 1: THTensor_(trigamma)(r_, t); return;
default: THError("polygamma(n,x) is not implemented for n>=2");
}
}
void THTensor_(lerp)(THTensor *r_, THTensor *a, THTensor *b, real weight)
{
THArgCheck(THTensor_(nElement)(a) == THTensor_(nElement)(b), 2, "sizes do not match");
THTensor_(resizeAs)(r_, a);
TH_TENSOR_APPLY3(real, r_, real, a, real, b, *r__data = TH_MATH_NAME(TH_lerp)(*a_data, *b_data, weight););
}
void THTensor_(mean)(THTensor *r_, THTensor *t, int dimension, int keepdim)
{
THArgCheck(dimension >= 0 && dimension < THTensor_(nDimensionLegacyAll)(t), 2, "invalid dimension %d",
dimension + TH_INDEX_BASE);
THTensor_(sum)(r_, t, dimension, keepdim);
THTensor_(div)(r_, r_, THTensor_sizeLegacyNoScalars(t, dimension));
}
void THTensor_(std)(THTensor *r_, THTensor *t, int dimension, int biased, int keepdim)
{
THLongStorage *dim;
THArgCheck(dimension >= 0 && dimension < THTensor_(nDimensionLegacyAll)(t), 3, "invalid dimension %d",
dimension + TH_INDEX_BASE);
THTensor_(preserveReduceDimSemantics)(r_, THTensor_(nDimensionLegacyAll)(t), dimension, keepdim);
dim = THTensor_(newSizeOf)(t);
THLongStorage_set(dim, dimension, 1);
THTensor_(resize)(r_, dim, NULL);
THLongStorage_free(dim);
TH_TENSOR_DIM_APPLY2(real, t, real, r_, dimension,
// Uses Welford's algorithm for numeric stability
accreal mean = 0;
accreal M2 = 0;
int64_t i;
for (i = 0; i < t_size; i++)
{
real z = t_data[i*t_stride];
real delta = z - mean;
mean += delta / (i + 1);
real delta2 = z - mean;
M2 += delta * delta2;
}
if (biased && t_size >= 2)
{
*r__data = TH_MATH_NAME(sqrt)(M2 / t_size);
} else if (!biased && t_size >= 2) {
*r__data = TH_MATH_NAME(sqrt)(M2 / (t_size - 1));
} else if (biased && t_size == 1) {
*r__data = 0;
} else {
*r__data = NAN;
});
if (!keepdim) {
THTensor_(squeeze1d)(r_, r_, dimension);
}
}
void THTensor_(var)(THTensor *r_, THTensor *t, int dimension, int biased, int keepdim)
{
THLongStorage *dim;
THArgCheck(dimension >= 0 && dimension < THTensor_(nDimensionLegacyAll)(t), 3, "invalid dimension %d",
dimension + TH_INDEX_BASE);
THTensor_(preserveReduceDimSemantics)(r_, THTensor_(nDimensionLegacyAll)(t), dimension, keepdim);
dim = THTensor_(newSizeOf)(t);
THLongStorage_set(dim, dimension, 1);
THTensor_(resize)(r_, dim, NULL);
THLongStorage_free(dim);
TH_TENSOR_DIM_APPLY2(real, t, real, r_, dimension,
// Uses Welford's algorithm for numeric stability
accreal mean = 0;
accreal M2 = 0;
int64_t i;
for (i = 0; i < t_size; i++)
{
real z = t_data[i*t_stride];
real delta = z - mean;
mean += delta / (i + 1);
real delta2 = z - mean;
M2 += delta * delta2;
}
if (biased && t_size >= 2)
{
*r__data = M2 / t_size;
} else if (!biased && t_size >= 2) {
*r__data = M2 / (t_size - 1);
} else if (biased && t_size == 1) {
*r__data = 0;
} else {
*r__data = NAN;
});
if (!keepdim) {
THTensor_(squeeze1d)(r_, r_, dimension);
}
}
void THTensor_(norm)(THTensor *r_, THTensor *t, real value, int dimension, int keepdim)
{
THLongStorage *dim;
THArgCheck(dimension >= 0 && dimension < THTensor_(nDimensionLegacyAll)(t), 3, "invalid dimension %d",
dimension + TH_INDEX_BASE);
THTensor_(preserveReduceDimSemantics)(r_, THTensor_(nDimensionLegacyAll)(t), dimension, keepdim);
dim = THTensor_(newSizeOf)(t);
THLongStorage_set(dim, dimension, 1);
THTensor_(resize)(r_, dim, NULL);
THLongStorage_free(dim);
#define DIM_REDUCE(reduce, transform) \
TH_TENSOR_DIM_APPLY2(real, t, real, r_, dimension, \
accreal sum = 0; \
int64_t i; \
for(i = 0; i < t_size; i++) { \
(reduce); \
} \
(transform);) \
if(value == 0) {
DIM_REDUCE(sum += t_data[i*t_stride] != 0.0,
*r__data = sum);
} else if (value == 1) {
DIM_REDUCE(sum += TH_MATH_NAME(fabs)(t_data[i*t_stride]),
*r__data = sum);
} else if (value == 2) {
DIM_REDUCE(sum += t_data[i*t_stride] * t_data[i*t_stride],
*r__data = TH_MATH_NAME(sqrt)(sum));
} else if (value == 3) {
DIM_REDUCE(sum += TH_MATH_NAME(fabs)(t_data[i*t_stride] * t_data[i*t_stride] * t_data[i*t_stride]),
*r__data = TH_MATH_NAME(pow)(sum, 1.0/3));
} else if (value == INFINITY) {
DIM_REDUCE(sum = THMax(sum, TH_MATH_NAME(fabs)(t_data[i*t_stride])),
*r__data = sum);
} else {
DIM_REDUCE(sum += TH_MATH_NAME(pow)(TH_MATH_NAME(fabs)(t_data[i*t_stride]), value),
*r__data = TH_MATH_NAME(pow)(sum, 1.0/value));
}
if (!keepdim) {
THTensor_(squeeze1d)(r_, r_, dimension);
}
#undef DIM_REDUCE
}
accreal THTensor_(normall)(THTensor *tensor, real value)
{
accreal sum = 0;
if(value == 0) {
TH_TENSOR_APPLY(real, tensor, sum += *tensor_data != 0.0;);
return sum;
} else if(value == 1) {
TH_TENSOR_APPLY(real, tensor, sum += TH_MATH_NAME(fabs)(*tensor_data););
return sum;
} else if(value == 2) {
TH_TENSOR_APPLY(real, tensor, accreal z = *tensor_data; sum += z*z;);
return sqrt(sum);
} else if(value == 3) {
TH_TENSOR_APPLY(real, tensor, accreal z = *tensor_data; sum += std::abs(z*z*z););
return TH_MATH_NAME(pow)(sum, 1.0/3);
} else if(value == INFINITY) {
TH_TENSOR_APPLY(real, tensor, sum = THMax(sum, TH_MATH_NAME(fabs)(*tensor_data)););
return sum;
} else {
TH_TENSOR_APPLY(real, tensor, sum += TH_MATH_NAME(pow)(TH_MATH_NAME(fabs)(*tensor_data), value););
return TH_MATH_NAME(pow)(sum, 1.0/value);
}
}
void THTensor_(renorm)(THTensor *res, THTensor *src, real value, int dimension, real maxnorm)
{
THTensor *rowR, *rowS;
THArgCheck(dimension >= 0 && dimension < THTensor_(nDimensionLegacyNoScalars)(src), 3, "invalid dimension %d",
dimension + TH_INDEX_BASE);
THArgCheck(value > 0, 2, "non-positive-norm not supported");
THArgCheck(THTensor_(nDimensionLegacyNoScalars)(src) > 1, 1, "need at least 2 dimensions, got %d dimensions",
THTensor_(nDimensionLegacyNoScalars)(src));
rowR = THTensor_(new)();
rowS = THTensor_(new)();
THTensor_(resizeAs)(res, src);
for (int64_t i = 0; i < THTensor_sizeLegacyNoScalars(src, dimension); i++)
{
real norm = 0;
real new_norm;
THTensor_(select)(rowS, src, dimension, i);
THTensor_(select)(rowR, res, dimension, i);
if (value == 1) {
TH_TENSOR_APPLY(real, rowS, norm += fabs(*rowS_data););
} else if (value == 2) {
TH_TENSOR_APPLY(real, rowS, accreal z = *rowS_data; norm += z*z;);
} else if (value == INFINITY) {
TH_TENSOR_APPLY(real, rowS, norm = THMax(norm, TH_MATH_NAME(fabs)(*rowS_data)););
} else {
TH_TENSOR_APPLY(real, rowS, norm += TH_MATH_NAME(pow)(TH_MATH_NAME(fabs)(*rowS_data), value););
}
if (value != INFINITY) {
norm = pow(norm, 1/value);
}
if (norm > maxnorm)
{
new_norm = maxnorm / (norm + 1e-7);
TH_TENSOR_APPLY2(
real, rowR, real, rowS,
*rowR_data = (*rowS_data) * new_norm;
)
}
else
THTensor_(copy)(rowR, rowS);
}
THTensor_(free)(rowR);
THTensor_(free)(rowS);
}
accreal THTensor_(dist)(THTensor *tensor, THTensor *src, real value)
{
real sum = 0;
TH_TENSOR_APPLY2(real, tensor, real, src,
sum += TH_MATH_NAME(pow)(
TH_MATH_NAME(fabs)(*tensor_data - *src_data), value););
return TH_MATH_NAME(pow)(sum, 1.0/value);
}
accreal THTensor_(meanall)(THTensor *tensor)
{
return THTensor_(sumall)(tensor)/THTensor_(nElement)(tensor);
}
accreal THTensor_(varall)(THTensor *tensor, int biased)
{
accreal mean = THTensor_(meanall)(tensor);
accreal sum = 0;
TH_TENSOR_APPLY(real, tensor, sum += (*tensor_data - mean)*(*tensor_data - mean););
sum /= std::max<int64_t>(0, THTensor_(nElement)(tensor) - (biased ? 0 : 1));
return sum;
}
accreal THTensor_(stdall)(THTensor *tensor, int biased)
{
return sqrt(THTensor_(varall)(tensor, biased));
}
void THTensor_(linspace)(THTensor *r_, real a, real b, int64_t n)
{
real i = 0;
// NumPy allows you to pass different points even if n <= 1 -- should we?
THArgCheck(n > 1 || ((n == 0 || n == 1) && (a == b)), 3, "invalid number of points");
if (THTensor_(nElement)(r_) != n) {
THTensor_(resize1d)(r_, n);
}
if (n == 0) {
} else if (n == 1) {
THTensor_(set1d)(r_, 0, a);
} else {
TH_TENSOR_APPLY(real, r_,
*r__data = a + (b-a)/((real)(n-1))*i;
i++;
);
}
}
void THTensor_(logspace)(THTensor *r_, real a, real b, int64_t n)
{
real i = 0;
// NumPy allows you to pass different points even if n <= 1 -- should we?
THArgCheck(n > 1 || ((n == 0 || n == 1) && (a == b)), 3, "invalid number of points");
if (THTensor_(nElement)(r_) != n) {
THTensor_(resize1d)(r_, n);
}
if (n == 0) {
} else if (n == 1) {
THTensor_(set1d)(r_, 0, TH_MATH_NAME(pow)(10.0, a));
} else {
TH_TENSOR_APPLY(real, r_,
*r__data = TH_MATH_NAME(pow)(10.0, a + i*(b-a)/((real)(n-1)));
i++;
);
}
}
void THTensor_(histc)(THTensor *hist, THTensor *tensor, int64_t nbins, real minvalue, real maxvalue)
{
real minval;
real maxval;
real *h_data;
THTensor_(resize1d)(hist, nbins);
THTensor_(zero)(hist);
minval = minvalue;
maxval = maxvalue;
if (minval == maxval)
{
minval = THTensor_(minall)(tensor);
maxval = THTensor_(maxall)(tensor);
}
if (minval == maxval)
{
minval = minval - 1;
maxval = maxval + 1;
}
h_data = THTensor_(data)(hist);
TH_TENSOR_APPLY(real, tensor,
if (*tensor_data >= minval && *tensor_data <= maxval) {
const int bin = (int)((*tensor_data-minval) / (maxval-minval) * nbins);
h_data[THMin(bin, nbins-1)] += 1;
}
);
}
void THTensor_(bhistc)(THTensor *hist, THTensor *tensor, int64_t nbins, real minvalue, real maxvalue)
{
THArgCheck(THTensor_(nDimensionLegacyAll)(tensor) < 3, 2, "invalid dimension %d, the input must be a 2d tensor", THTensor_(nDimensionLegacyAll)(tensor));
int dimension = 1;
THArgCheck(dimension >= 0 && dimension < THTensor_(nDimensionLegacyAll)(tensor), 2, "invalid dimension %d",
dimension + TH_INDEX_BASE);
real minval;
real maxval;
THTensor_(resize2d)(hist, THTensor_sizeLegacyNoScalars(tensor, 0), nbins);
THTensor_(zero)(hist);
minval = minvalue;
maxval = maxvalue;
if (minval == maxval)
{
minval = THTensor_(minall)(tensor);
maxval = THTensor_(maxall)(tensor);
}
if (minval == maxval)
{
minval = minval - 1;
maxval = maxval + 1;
}
TH_TENSOR_DIM_APPLY2(real, tensor, real, hist, dimension, int64_t i;
for(i = 0; i < tensor_size; i++)
{
if(tensor_data[i*tensor_stride] >= minval && tensor_data[i*tensor_stride] <= maxval) {
const int bin = (int)((tensor_data[i*tensor_stride]-minval) / (maxval-minval) * nbins);
hist_data[THMin(bin, nbins-1)] += 1;
}
}
);
}
// Approximate reparameterized gradient of Beta(x,alpha,beta) wrt alpha.
// Assumes x is close to zero and uses a Taylor expansion.
static inline real THTensor_(beta_grad_alpha_small)(real x, real alpha, real beta) {
const real factor = TH_MATH_NAME(TH_digamma)(alpha) - TH_MATH_NAME(TH_digamma)(alpha + beta) - TH_MATH_NAME(log)(x);
real numer = 1;
real series = numer / alpha * (factor + 1 / alpha);
for (int i = 1; i <= 10; ++i) {
numer *= (i - beta) * x / i;
const real denom = alpha + i;
series += numer / denom * (factor + 1 / denom);
}
const real result = x * TH_MATH_NAME(pow)(1 - x, -beta) * series;
return th_isnan(result) ? 0.0 : result;
}
// Approximate reparameterized gradient of Beta(x,alpha,beta) wrt beta.
// Assumes x is close to zero and uses a Taylor expansion.
static inline real THTensor_(beta_grad_beta_small)(real x, real alpha, real beta) {
const real factor = TH_MATH_NAME(TH_digamma)(alpha+beta) - TH_MATH_NAME(TH_digamma)(beta);
real numer = 1;
real betas = 1;
real dbetas = 0;
real series = factor / alpha;
for (int i = 1; i <= 8; ++i) {
numer *= -x / i;
dbetas = dbetas * (beta - i) + betas;
betas = betas * (beta - i);
series += numer / (alpha + i) * (dbetas + factor * betas);
}
const real result = -TH_MATH_NAME(pow)(1 - x, 1 - beta) * series;
return th_isnan(result) ? 0.0 : result;
}
// Approximate reparameterized gradient of Beta(x,alpha,beta) wrt alpha.
// Assumes alpha and beta are both large and uses a Rice saddle point expansion.
// To ensure numerical stability, this computation is performed at higher precision.
static inline real THTensor_(beta_grad_alpha_mid)(double x, double alpha, double beta) {
const double total = alpha + beta;
const double mean = alpha / total;
const double std = sqrt(alpha * beta / (total + 1)) / total;
if (mean - 0.1 * std <= x && x <= mean + 0.1 * std) {
// Avoid the singularity at x = mean.
const double poly = 47 * x * (beta*beta)*(beta*beta) + alpha * (
(43 + 20 * (16 + 27 * beta) * x) * (beta*beta)*beta + alpha * (
3 * (59 + 180 * beta - 90 * x) * (beta*beta) + alpha * (
(453 + 1620 * beta * (1 - x) - 455 * x) * beta + alpha * (
8 * (1 - x) * (135 * beta - 11)))));
const double prefactor_num = (1 + 12 * alpha) * (1 + 12 * beta) / (total * total);
const double prefactor_den = 12960 * alpha * alpha * alpha * beta * beta * (1 + 12 * total);
return prefactor_num / (1 - x) * poly / prefactor_den;
}
const double prefactor = -x / sqrt(2 * alpha * beta / total);
const double stirling = (1 + 1 / (12 * alpha) + 1 / (288 * alpha*alpha))
* (1 + 1 / (12 * beta) + 1 / (288 * beta*beta))
/ (1 + 1 / (12 * total) + 1 / (288 * total*total));
const double term1_num = 2 * (alpha*alpha) * (x - 1) + alpha * beta * (x - 1) - x * (beta*beta);
const double axbx = alpha * (x-1) + beta * x;
const double term1_den = sqrt(2 * alpha / beta) * pow(total, 1.5f) * axbx*axbx;
const double term1 = term1_num / term1_den;
const double term2 = 0.5f * log(alpha / (total * x));
const double term3_num = sqrt(8 * alpha * beta / total);
const double term3_den = beta * x + alpha * (x - 1);
const double term3 = term3_num / term3_den;
const double term4_base = beta * log(beta / (total * (1 - x))) +
alpha * log(alpha / (total * x));
const double term4 = pow(term4_base, -1.5f);
const double term1234 = term1 + term2 * (term3 + (x < mean ? term4 : -term4));
return stirling * prefactor * term1234;
}
// Computes a scaled reparameterized gradient
// -(d/dalpha cdf(x;alpha,beta)) / pdf(x;alpha,beta) / (1-x)
// for random number x drawn from a Beta distribution Beta(alpha,beta).
// This function inputs total=alpha+beta to make it easy to implement
// Dirichlet reparameterized gradients in terms of Betas.
static inline real THTensor_(dirichlet_grad_one)(real x, real alpha, real total) {
const real beta = total - alpha;
const real boundary = total * x * (1 - x);
// Use an asymptotic approximation for x close to 0.
if (x <= 0.5f && boundary < 2.5f) {
return THTensor_(beta_grad_alpha_small)(x, alpha, beta);
}
// Use an asymptotic approximation for x close to 1.
if (x >= 0.5f && boundary < 0.75f) {
return -THTensor_(beta_grad_beta_small)(1 - x, beta, alpha);
}
// Use an asymptotic approximation when alpha and (total - alpha) are both large.
if (alpha > 6 && beta > 6) {
return THTensor_(beta_grad_alpha_mid)(x, alpha, beta);
}
// Use a rational correction to an analytic approximation.
static const real c[2][3][3][4] = {
{{{1.003668233, -0.01061107488, -0.0657888334, 0.01201642863},
{0.6336835991, -0.3557432599, 0.05486251648, -0.001465281033},
{-0.03276231906, 0.004474107445, 0.002429354597, -0.0001557569013}},
{{0.221950385, -0.3187676331, 0.01799915743, 0.01074823814},
{-0.2951249643, 0.06219954479, 0.01535556598, 0.001550077057},
{0.02155310298, 0.004170831599, 0.001292462449, 6.976601077e-05}},
{{-0.05980841433, 0.008441916499, 0.01085618172, 0.002319392565},
{0.02911413504, 0.01400243777, -0.002721828457, 0.000751041181},
{0.005900514878, -0.001936558688, -9.495446725e-06, 5.385558597e-05}}},
{{{1, -0.02924021934, -0.04438342661, 0.007285809825},
{0.6357567472, -0.3473456711, 0.05454656494, -0.002407477521},
{-0.03301322327, 0.004845219414, 0.00231480583, -0.0002307248149}},
{{0.5925320577, -0.1757678135, 0.01505928619, 0.000564515273},
{0.1014815858, -0.06589186703, 0.01272886114, -0.0007316646956},
{-0.007258481865, 0.001096195486, 0.0003934994223, -4.12701925e-05}},
{{0.06469649321, -0.0236701437, 0.002902096474, -5.896963079e-05},
{0.001925008108, -0.002869809258, 0.0008000589141, -6.063713228e-05},
{-0.0003477407336, 6.959756487e-05, 1.097287507e-05, -1.650964693e-06}}},
};
const real u = TH_MATH_NAME(log)(x);
const real a = TH_MATH_NAME(log)(alpha) - u;
const real b = TH_MATH_NAME(log)(total) - a;
const real pow_u[3] = {1, u, u * u};
const real pow_a[3] = {1, a, a * a};
real p = 0.0;
real q = 0.0;
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
const real ua = pow_u[i] * pow_a[j];
p += ua * (c[0][i][j][0] + b * (c[0][i][j][1] + b * (c[0][i][j][2] + b * c[0][i][j][3])));
q += ua * (c[1][i][j][0] + b * (c[1][i][j][1] + b * (c[1][i][j][2] + b * c[1][i][j][3])));
}
}
const real approx = x * (TH_MATH_NAME(TH_digamma)(total) - TH_MATH_NAME(TH_digamma)(alpha)) / beta;
return p / q * approx;
}
void THTensor_(dirichlet_grad)(THTensor *self, THTensor *x, THTensor *alpha, THTensor *total)
{
x = THTensor_(newContiguous)(x);
alpha = THTensor_(newContiguous)(alpha);
total = THTensor_(newContiguous)(total);
TH_CHECK_SAME_SIZE(alpha, x);
TH_CHECK_SAME_SIZE(total, x);
THTensor_(resizeAs)(self, x);
THTensor* grad = THTensor_(newContiguous)(self);
real*const grad_data = THTensor_(data)(grad);
real*const x_data = THTensor_(data)(x);
real*const alpha_data = THTensor_(data)(alpha);
real*const total_data = THTensor_(data)(total);
const int64_t numel = THTensor_(nElement)(x);
int64_t i;
#pragma omp parallel for if(numel > TH_OMP_OVERHEAD_THRESHOLD) private(i)
for(i = 0; i < numel; ++i) {
grad_data[i] = THTensor_(dirichlet_grad_one)(x_data[i], alpha_data[i], total_data[i]);
}
THTensor_(freeCopyTo)(grad, self);
}
#undef TH_MATH_NAME
#endif /* floating point only part */
#undef IS_NONZERO
#endif /* TH_GENERIC_FILE */
| 34.966222 | 155 | 0.595213 | DavidKo3 |
e0df631bb5eacd0a9c41369dbe29293f02b1dd49 | 5,093 | cxx | C++ | src/par/src/MLPart/mlpart/HGraph/subHGraph.cxx | JayjeetAtGithub/OpenROAD | 751d7860e2e2929a3b3f8a163c79d843f252ad5b | [
"BSD-3-Clause"
] | null | null | null | src/par/src/MLPart/mlpart/HGraph/subHGraph.cxx | JayjeetAtGithub/OpenROAD | 751d7860e2e2929a3b3f8a163c79d843f252ad5b | [
"BSD-3-Clause"
] | 1 | 2021-08-20T07:50:34.000Z | 2021-08-20T07:50:34.000Z | src/par/src/MLPart/mlpart/HGraph/subHGraph.cxx | JayjeetAtGithub/OpenROAD | 751d7860e2e2929a3b3f8a163c79d843f252ad5b | [
"BSD-3-Clause"
] | 2 | 2021-06-27T09:48:36.000Z | 2021-07-23T08:08:01.000Z | /**************************************************************************
***
*** Copyright (c) 1995-2000 Regents of the University of California,
*** Andrew E. Caldwell, Andrew B. Kahng and Igor L. Markov
*** Copyright (c) 2000-2007 Regents of the University of Michigan,
*** Saurabh N. Adya, Jarrod A. Roy, David A. Papa and
*** Igor L. Markov
***
*** Contact author(s): abk@cs.ucsd.edu, imarkov@umich.edu
*** Original Affiliation: UCLA, Computer Science Department,
*** Los Angeles, CA 90095-1596 USA
***
*** 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.
***
***
***************************************************************************/
// class derived from HyperGraph with Constructor from
// nodes/edges of another HGraph.
#ifdef _MSC_VER
#pragma warning(disable : 4786)
#endif
#include <HGraph/subHGraph.h>
#include <iomanip>
using std::cout;
using std::endl;
using std::setw;
using std::vector;
SubHGraph::SubHGraph(const HGraphFixed& origHGraph, const vector<const HGFNode*>& nonTerminals, const vector<const HGFNode*>& terminals, const vector<const HGFEdge*>& nets, bool clearTerminalAreas, bool ignoreSize1Nets, unsigned threshold)
: HGraphFixed(nonTerminals.size() + terminals.size()),
newNodeToOrig(nonTerminals.size() + terminals.size(), UINT_MAX),
// newEdgeToOrig(nets.size(), UINT_MAX),
newEdgeToOrig(0),
_clearTerminalAreas(clearTerminalAreas),
_ignoreSize1Nets(ignoreSize1Nets),
_threshold(threshold) {
_numTerminals = terminals.size();
// _nodeNames = vector<string>(_nodes.size(), string() );
newEdgeToOrig = new Mapping(nets.size(), UINT_MAX);
// the HGraph constructor produces the HG nodes with
// id's 0->numTerminals + numNonTerminals - 1 in the default
// constructor.
// setup a mapping from Cluster::_index to HGFNode::mIndex
// put the terminal nodes first..
unsigned i, p;
for (p = 0, i = 0; p < terminals.size(); p++, i++) addTerminal(origHGraph, *(terminals[p]), i);
for (p = 0; p < nonTerminals.size(); p++, i++) addNode(origHGraph, *(nonTerminals[p]), i);
vector<const HGFEdge*>::const_iterator e;
for (e = nets.begin(), i = 0; e != nets.end(); e++, i++) {
if (_ignoreSize1Nets && (*e)->getDegree() < 2) continue;
if (threshold > 0 && (*e)->getDegree() >= threshold) continue;
HGFEdge& newEdge = addNewEdge(**e);
itHGFNodeLocal n;
for (n = (*e)->nodesBegin(); n != (*e)->nodesEnd(); n++) {
OrigToNewMap::iterator ndItr = origNodeToNew.find((*n)->getIndex());
unsigned hgNodeIdx = (*ndItr).second;
#ifdef SIGNAL_DIRECTIONS
if ((*e)->isNodeSrc(*n))
addSrc(getNodeByIdx(hgNodeIdx), newEdge);
else if ((*e)->isNodeSnk(*n))
addSnk(getNodeByIdx(hgNodeIdx), newEdge);
else
addSrcSnk(getNodeByIdx(hgNodeIdx), newEdge);
#else
addSrcSnk(getNodeByIdx(hgNodeIdx), newEdge);
#endif
}
}
finalize();
clearNameMaps();
clearNames();
}
SubHGraph::~SubHGraph() {}
void SubHGraph::printNodeMap() const {
cout << endl << "*****************" << endl << "Node's HASH_MAP" << endl;
OrigToNewMap::const_iterator m;
unsigned* toprint;
toprint = reinterpret_cast<unsigned*>(&m);
unsigned i = 0;
for (m = origNodeToNew.begin(); m != origNodeToNew.end(); m++) {
if (i++ % 5 == 0) {
if (i) cout << "\n";
cout << " ";
}
cout << setw(4) << (*m).first << ":" << setw(4) << (*m).second << endl;
}
cout << "*********************"
<< "done printing" << endl;
}
| 41.406504 | 239 | 0.572943 | JayjeetAtGithub |
e0dfacd64f22906c454e38b0f0aa630fa73afad6 | 2,436 | cpp | C++ | C++/UCIApp3/UCIApp3/UCIApp3.cpp | MuscleNrd/Student-Self-Completed | 87c20c4cbd561554eb112047660b698d58711cdc | [
"MIT"
] | null | null | null | C++/UCIApp3/UCIApp3/UCIApp3.cpp | MuscleNrd/Student-Self-Completed | 87c20c4cbd561554eb112047660b698d58711cdc | [
"MIT"
] | null | null | null | C++/UCIApp3/UCIApp3/UCIApp3.cpp | MuscleNrd/Student-Self-Completed | 87c20c4cbd561554eb112047660b698d58711cdc | [
"MIT"
] | null | null | null | // UCIApp3.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
template <class T>
class setList
{
private:
struct setListNode
{
T info;
setListNode* next;
setListNode() : next(0) {}
//setListNode(const T& newinfo) : info(newinfo), next(0) {}
setListNode(T& newinfo, setListNode *newnext = 0)
:info(newinfo), next(newnext) {}
static void deleteSetList(setListNode *S)
{
if (S != NULL)
{
deleteSetList(S->next);
}
}
};
setListNode *buf;
int itemCount;
void init()
{
itemCount = 0;
buf = new setListNode();
}
public:
setList() : buf(0), itemCount(0) {}
//setList(initializer_list<T> s)
//: buf(new setListNode) { uninitialized_copy(s.begin(), s.end(), buf);}
setList(const setList<T>& aSet)
{
init();
*this = aSet;
}
void insert(const T& newEntry)
{
setListNode* nextListNode = new setListNode();
nextListNode->info = newEntry;
nextListNode->next = buf;
buf = nextListNode;
itemCount++;
}
//int getSize() {return itemCount;}
class setListIter
{
typedef setListIter iterator;
typedef ptrdiff_t difference_type;
typedef size_t size_type;
typedef T value_type;
typedef T* ptr;
typedef T& reference;
private:
setList ibuf;
public:
setListIter(setList p) : ibuf(p) {}
// setListIter(const setList<T>& SL)
setListIter& operator++()
{
ibuf.buf = ibuf.buf->next;
return *this;
}
setListIter operator++(int postfix)
{
setListIter temp = ibuf;
ibuf++;
return temp;
}
setListIter operator=(const setListIter& rhs)
{
ibuf = rhs.ibuf;
return *this;
}
bool operator==(const setListIter& rhs) { return ibuf->info == rhs.ibuf->info; }
bool operator!=(const setListIter& rhs) { return ibuf.buf->info != rhs.ibuf.buf->info; }
ptr operator->() { return ibuf; }
reference operator*() { return ibuf.buf->info; }
};
setListIter find(const T& val) const;
setListIter begin() { return setListIter(*this); }
setListIter end() {
while (buf->next != NULL)
{
buf++;
}
return *this;
}
~setList()
{
buf->deleteSetList(buf);
}
};
using namespace std;
int main()
{
setList<int> A;
A.insert(1);
A.insert(2);
for (int i = 3; i <= 10; i++)
A.insert(i);
setList<int> B;
for (int i = 20; i <= 40; i++)
B.insert(i);
setList<int> C(B);
for (setList<int>::setListIter it = A.begin(); it != A.end(); ++it)
cout << *it << endl;
return 0;
}
| 16.459459 | 90 | 0.626847 | MuscleNrd |
e0e0900842540fe857d203c84206d53231838295 | 7,474 | cpp | C++ | CocosNet/CCNetDelegate.cpp | leecjson/CocosNet | e762999aa6c0be276bc6d3eb0b511e921b792f36 | [
"MIT"
] | 8 | 2018-11-29T02:07:44.000Z | 2020-12-24T09:34:06.000Z | CocosNet/CCNetDelegate.cpp | leecjson/CocosNet | e762999aa6c0be276bc6d3eb0b511e921b792f36 | [
"MIT"
] | null | null | null | CocosNet/CCNetDelegate.cpp | leecjson/CocosNet | e762999aa6c0be276bc6d3eb0b511e921b792f36 | [
"MIT"
] | 4 | 2019-01-14T13:33:14.000Z | 2020-06-06T06:42:50.000Z | /****************************************************************************
Copyright (c) 2014 Lijunlin - Jason lee
Created by Lijunlin - Jason lee on 2014
jason.lee.c@foxmail.com
http://www.cocos2d-x.org
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.
****************************************************************************/
#include "CCNetDelegate.h"
NS_CC_BEGIN
CCNetDelegate::CCNetDelegate()
: m_fSoTimeout(SOCKET_SOTIMEOUT)
, m_eStatus(eSocketIoClosed)
, m_fConnectingDuration(0.0f)
, m_bRunSchedule(false)
{
}
CCNetDelegate::~CCNetDelegate()
{
m_oSocket.ccClose();
while(!m_lSendBuffers.empty())
{
CC_SAFE_DELETE_ARRAY(m_lSendBuffers.front().pBuffer);
m_lSendBuffers.pop_front();
}
}
void CCNetDelegate::setInetAddress(const CCInetAddress& oInetAddress)
{
m_oInetAddress = oInetAddress;
}
const CCInetAddress& CCNetDelegate::getInetAddress() const
{
return m_oInetAddress;
}
void CCNetDelegate::setSoTimeout(float fSoTimeout)
{
m_fSoTimeout = fSoTimeout;
}
float CCNetDelegate::getSoTimeout() const
{
return m_fSoTimeout;
}
void CCNetDelegate::send(char* pBuffer, unsigned int uLen)
{
if( !pBuffer || uLen == 0 || !isConnected() )
return;
#if USING_PACKAGE_HEAD_LENGTH
CCBuffer* pBuf = new CCBuffer(pBuffer, uLen);
pBuf->autorelease();
send(pBuf);
#else
char* pTemp = new char[uLen];
memcpy(pTemp, pBuffer, uLen);
_SENDBUFFER tBuf;
tBuf.pBuffer = pTemp;
tBuf.nLength = (int)uLen;
tBuf.nOffset = 0;
m_lSendBuffers.push_back(tBuf);
#endif
}
void CCNetDelegate::send(CCBuffer* pBuffer)
{
if( pBuffer->empty() || !isConnected() )
return;
#if USING_PACKAGE_HEAD_LENGTH
unsigned int u_len = pBuffer->length();
pBuffer->moveRight(sizeof(unsigned int));
pBuffer->moveWriterIndexToFront();
pBuffer->writeUInt(u_len);
#endif
pBuffer->moveReaderIndexToFront();
char* pData = pBuffer->readWholeData();
int nLength = (int)pBuffer->length();
pBuffer->moveReaderIndexToFront();
_SENDBUFFER tBuf;
tBuf.pBuffer = pData;
tBuf.nLength = nLength;
tBuf.nOffset = 0;
m_lSendBuffers.push_back(tBuf);
}
bool CCNetDelegate::isConnected()
{
return m_eStatus == eSocketConnected;
}
bool CCNetDelegate::connect()
{
if( m_eStatus != eSocketConnected && m_eStatus != eSocketConnecting )
{
m_oSocket.setInetAddress(m_oInetAddress);
if( m_oSocket.ccConnect() )
{
registerScheduler();
m_eStatus = eSocketConnecting;
return true;
}
else
{
m_oSocket.ccClose();
m_eStatus = eSocketConnectFailed;
onExceptionCaught(eSocketConnectFailed);
}
}
return false;
}
void CCNetDelegate::disconnect()
{
if( m_eStatus == eSocketConnected )
{
unregisterScheduler();
m_oSocket.ccDisconnect();
m_eStatus = eSocketDisconnected;
onDisconnected();
}
}
void CCNetDelegate::close()
{
if( m_eStatus == eSocketConnected )
{
unregisterScheduler();
m_oSocket.ccClose();
m_eStatus = eSocketIoClosed;
onDisconnected();
}
}
void CCNetDelegate::runSchedule(float dt)
{
switch( m_eStatus )
{
case eSocketConnecting:
{
switch( m_oSocket.ccIsConnected() )
{
case eSocketConnected:
{
m_eStatus = eSocketConnected;
onConnected();
}
break;
case eSocketConnectFailed:
{
unregisterScheduler();
m_oSocket.ccClose();
m_eStatus = eSocketConnectFailed;
onExceptionCaught(eSocketConnectFailed);
}
break;
case eSocketConnecting:
{
if( m_fConnectingDuration > m_fSoTimeout )
{
unregisterScheduler();
m_oSocket.ccDisconnect();
m_eStatus = eSocketDisconnected;
onConnectTimeout();
m_fConnectingDuration = 0.0f;
}
else
{
m_fConnectingDuration += dt;
}
}
break;
default:
break;
}
}
break;
case eSocketConnected:
{
#if HANDLE_ON_SINGLE_FRAME
while( m_oSocket.ccIsReadable() )
#else
if( m_oSocket.ccIsReadable() )
#endif
{
if( this->runRead() ) return;
}
#if HANDLE_ON_SINGLE_FRAME
while( m_oSocket.ccIsWritable() && !m_lSendBuffers.empty() )
#else
if( m_oSocket.ccIsWritable() && !m_lSendBuffers.empty() )
#endif
{
if( this->runWrite() ) return;
}
}
break;
default:
break;
}
}
bool CCNetDelegate::runRead()
{
int nRet = m_oSocket.ccRead(m_pReadBuffer, SOCKET_READ_BUFFER_SIZE);
if( nRet == eSocketIoError || nRet == eSocketIoClosed )
{
unregisterScheduler();
m_oSocket.ccClose();
m_eStatus = eSocketIoClosed;
onDisconnected();
return true;
}
else
{
#if 1
CCLOG("CCSOCKET READ %d", nRet);
#endif
m_oReadBuffer.writeData(m_pReadBuffer, (unsigned int)nRet);
#if USING_PACKAGE_HEAD_LENGTH
while( m_oReadBuffer.isReadable(sizeof(int)) )
{
m_oReadBuffer.moveReaderIndexToFront();
int n_head_len = m_oReadBuffer.readInt();
if( n_head_len <= 0 )
{
CCLOGERROR("invalidate head length");
m_oReadBuffer.moveLeft(sizeof(int));
}
int n_content_len = (int)m_oReadBuffer.length();
if( n_content_len - (int)(sizeof(int)) >= n_head_len )
{
m_oReadBuffer.moveLeft(sizeof(unsigned int));
CCBuffer* pData = m_oReadBuffer.readData(n_head_len);
m_oReadBuffer.moveLeft(n_head_len);
m_oReadBuffer.moveReaderIndexToFront();
m_oReadBuffer.moveWriterIndexToBack();
onMessageReceived(*pData);
}
else
{
break;
}
}
#else
CCBuffer* pData = (CCBuffer*) m_oReadBuffer.copy();
pData->autorelease();
m_oReadBuffer.clear();
onMessageReceived(*pData);
#endif
}
return false;
}
bool CCNetDelegate::runWrite()
{
_SENDBUFFER& tBuffer = m_lSendBuffers.front();
int nRet = m_oSocket.ccWrite(tBuffer.pBuffer + tBuffer.nOffset, tBuffer.nLength - tBuffer.nOffset);
#if 1
CCLOG("CCSOCKET WRITE %d", nRet);
#endif
if( nRet == eSocketIoError )
{
unregisterScheduler();
m_oSocket.ccClose();
m_eStatus = eSocketIoClosed;
onDisconnected();
return true;
}
else if( nRet == tBuffer.nLength - tBuffer.nOffset )
{
CC_SAFE_DELETE_ARRAY(tBuffer.pBuffer);
m_lSendBuffers.pop_front();
}
else
{
tBuffer.nOffset += nRet;
}
return false;
}
void CCNetDelegate::registerScheduler()
{
if( m_bRunSchedule )
return;
CCDirector::sharedDirector()->getScheduler()->scheduleSelector(
schedule_selector(CCNetDelegate::runSchedule),
this,
0.0f,
false
);
m_bRunSchedule = true;
}
void CCNetDelegate::unregisterScheduler()
{
if( !m_bRunSchedule )
return;
CCDirector::sharedDirector()->getScheduler()->unscheduleSelector(
schedule_selector(CCNetDelegate::runSchedule),
this
);
m_bRunSchedule = false;
}
NS_CC_END | 21.601156 | 100 | 0.701766 | leecjson |
e0e3a3f3e1e98ff3452f99a0064ce44d6eca3529 | 703 | cpp | C++ | tests/multiArray.cpp | Oparilames/aNDAr-library | 304e4923a3777b73d63964460a859896583b8a3d | [
"MIT"
] | null | null | null | tests/multiArray.cpp | Oparilames/aNDAr-library | 304e4923a3777b73d63964460a859896583b8a3d | [
"MIT"
] | 1 | 2022-03-31T17:07:07.000Z | 2022-03-31T17:07:07.000Z | tests/multiArray.cpp | Oparilames/aNDAr-library | 304e4923a3777b73d63964460a859896583b8a3d | [
"MIT"
] | null | null | null |
#include <aNDAr/multiDimensionalArray.hpp>
using namespace aNDAr;
int main(){
using T = multiDimensionalArray<int,3,3,3>;
using C = multiDimensionalArray<char,3,3,3>;
{T ar{};}
{T ar(5);}
/// {T ar(initialisationMethod::incrementFrom,1);} // 2022
{T ar{initialisationMethod::decrementFrom,1};}
{T ar(initialisationMethod::incrementFrom,10,2);}
{T ar(initialiseByIncrementFrom,10,2);}
{T ar(aNDAr::incrementFrom,10,2);}
{C ar("ThisIsATestThisIsATest!!!!!");}
{C ar(aNDAr::incrementFrom,'a');}
return EXIT_SUCCESS;
}
/*
LANG=en g++ -Wfatal-errors -std=c++20 -O2 -I./src -I./include tests/multiArray.cpp -o ./bin/Test_multiArray && ./bin/Test_multiArray
*/
| 33.47619 | 132 | 0.664296 | Oparilames |
e0e3d1b6e8b7d7c1456019b81cd135f4e2c532e0 | 32,257 | cpp | C++ | DumpDWG/maps.cpp | MadhukarMoogala/RealDWGInstallerWithWix | ad7734ec2e968bb192b4d0a827d60647066df6a6 | [
"MIT"
] | 11 | 2018-08-03T19:22:03.000Z | 2021-12-16T15:33:00.000Z | DumpDWG/maps.cpp | MadhukarMoogala/RealDWGInstallerWithWix | ad7734ec2e968bb192b4d0a827d60647066df6a6 | [
"MIT"
] | null | null | null | DumpDWG/maps.cpp | MadhukarMoogala/RealDWGInstallerWithWix | ad7734ec2e968bb192b4d0a827d60647066df6a6 | [
"MIT"
] | 6 | 2019-01-10T09:16:23.000Z | 2021-12-08T16:29:24.000Z | //
//////////////////////////////////////////////////////////////////////////////
//
// Copyright 2018 Autodesk, Inc. All rights reserved.
//
// Use of this software is subject to the terms of the Autodesk license
// agreement provided at the time of installation or download, or which
// otherwise accompanies this software in either electronic or hard copy form.
//
//////////////////////////////////////////////////////////////////////////////
//
// MAPS.CPP
//
// DESCRIPTION:
//
// Port of MFC maps.
//
/////////////////////////////////////////////////////////////////////////////
//
// Implementation of parmeterized Map
//
/////////////////////////////////////////////////////////////////////////////
#define DEBUG_NEW new
#include "assert.h"
#ifdef _DEBUG
#define ASSERT(a) assert(a)
#else
#define ASSERT(a)
#endif
#ifdef AFX_COLL2_SEG
#pragma code_seg(AFX_COLL2_SEG)
#endif
#include "wtypes.h"
#include "maps.h"
IMPLEMENT_DYNAMIC(CMapWordToPtr, CObject)
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
#define new DEBUG_NEW
/////////////////////////////////////////////////////////////////////////////
CMapWordToPtr::CMapWordToPtr(int nBlockSize)
{
ASSERT(nBlockSize > 0);
m_pHashTable = NULL;
m_nHashTableSize = RX_HASHTABLESIZE; // default size
m_nCount = 0;
m_pFreeList = NULL;
m_pBlocks = NULL;
m_nBlockSize = nBlockSize;
}
inline UINT_PTR CMapWordToPtr::HashKey(WORD key) const
{
// Default identity hash, works for most primitive values.
return ((DWORD_PTR)key) >> 4;
}
void CMapWordToPtr::InitHashTable(UINT_PTR nHashSize)
//
// Used to force allocation of a hash table or to override the default
// hash table size of (which is fairly small).
{
ASSERT_VALID(this);
ASSERT(m_nCount == 0);
ASSERT(nHashSize > 0);
// If had a hash table, get rid of it.
if (m_pHashTable != NULL)
delete [] m_pHashTable;
m_pHashTable = NULL;
m_pHashTable = new CAssoc* [nHashSize];
memset(m_pHashTable, 0, sizeof(CAssoc*) * nHashSize);
m_nHashTableSize = nHashSize;
}
void CMapWordToPtr::RemoveAll()
{
ASSERT_VALID(this);
if (m_pHashTable != NULL)
{
// Free hash table.
delete [] m_pHashTable;
m_pHashTable = NULL;
}
m_nCount = 0;
m_pFreeList = NULL;
m_pBlocks->FreeDataChain();
m_pBlocks = NULL;
}
CMapWordToPtr::~CMapWordToPtr()
{
RemoveAll();
ASSERT(m_nCount == 0);
}
/////////////////////////////////////////////////////////////////////////////
// Assoc helpers
// same as CList implementation except we store CAssoc's not CNode's
// and CAssoc's are singly linked all the time
CMapWordToPtr::CAssoc* CMapWordToPtr::NewAssoc()
{
if (m_pFreeList == NULL)
{
// Add another block.
CPlex* newBlock = CPlex::Create(m_pBlocks, m_nBlockSize, sizeof(CMapWordToPtr::CAssoc));
// Chain them into free list.
CMapWordToPtr::CAssoc* pAssoc = (CMapWordToPtr::CAssoc*) newBlock->data();
// Free in reverse order to make it easier to debug.
pAssoc += m_nBlockSize - 1;
for (int i = m_nBlockSize-1; i >= 0; i--, pAssoc--)
{
pAssoc->pNext = m_pFreeList;
m_pFreeList = pAssoc;
}
}
ASSERT(m_pFreeList != NULL); // we must have something
CMapWordToPtr::CAssoc* pAssoc = m_pFreeList;
m_pFreeList = m_pFreeList->pNext;
m_nCount++;
ASSERT(m_nCount > 0); // Make sure we don't overflow.
memset(&pAssoc->key, 0, sizeof(WORD));
memset(&pAssoc->value, 0, sizeof(void*));
return pAssoc;
}
void CMapWordToPtr::FreeAssoc(CMapWordToPtr::CAssoc* pAssoc)
{
pAssoc->pNext = m_pFreeList;
m_pFreeList = pAssoc;
m_nCount--;
ASSERT(m_nCount >= 0); // Make sure we don't underflow.
}
CMapWordToPtr::CAssoc*
CMapWordToPtr::GetAssocAt(WORD key, UINT_PTR& nHash) const
// Find association (or return NULL).
{
nHash = HashKey(key) % m_nHashTableSize;
if (m_pHashTable == NULL)
return NULL;
// See if it exists.
CAssoc* pAssoc;
for (pAssoc = m_pHashTable[nHash]; pAssoc != NULL; pAssoc = pAssoc->pNext)
{
if (pAssoc->key == key)
return pAssoc;
}
return NULL;
}
/////////////////////////////////////////////////////////////////////////////
BOOL CMapWordToPtr::Lookup(WORD key, void*& rValue) const
{
ASSERT_VALID(this);
UINT_PTR nHash;
CAssoc* pAssoc = GetAssocAt(key, nHash);
if (pAssoc == NULL)
return FALSE; // Not in map.
rValue = pAssoc->value;
return TRUE;
}
void*& CMapWordToPtr::operator[](WORD key)
{
ASSERT_VALID(this);
UINT_PTR nHash;
CAssoc* pAssoc;
if ((pAssoc = GetAssocAt(key, nHash)) == NULL)
{
if (m_pHashTable == NULL)
InitHashTable(m_nHashTableSize);
// It doesn't exist, add a new Association.
pAssoc = NewAssoc();
pAssoc->nHashValue = nHash;
pAssoc->key = key;
// 'pAssoc->value' is a constructed object, nothing more
// Put into hash table.
pAssoc->pNext = m_pHashTable[nHash];
m_pHashTable[nHash] = pAssoc;
}
return pAssoc->value; // return new reference
}
BOOL CMapWordToPtr::RemoveKey(WORD key)
// Remove key - return TRUE if removed.
{
ASSERT_VALID(this);
if (m_pHashTable == NULL)
return FALSE; // nothing in the table
CAssoc** ppAssocPrev;
ppAssocPrev = &m_pHashTable[HashKey(key) % m_nHashTableSize];
CAssoc* pAssoc;
for (pAssoc = *ppAssocPrev; pAssoc != NULL; pAssoc = pAssoc->pNext)
{
if (pAssoc->key == key)
{
// Remove it.
*ppAssocPrev = pAssoc->pNext; // Remove from list.
FreeAssoc(pAssoc);
return TRUE;
}
ppAssocPrev = &pAssoc->pNext;
}
return FALSE; // Not found.
}
/////////////////////////////////////////////////////////////////////////////
// Iterating
void CMapWordToPtr::GetNextAssoc(RXPOSITION& rNextPosition,
WORD& rKey, void*& rValue) const
{
ASSERT_VALID(this);
ASSERT(m_pHashTable != NULL); // never call on empty map
CAssoc* pAssocRet = (CAssoc*)rNextPosition;
ASSERT(pAssocRet != NULL);
if (pAssocRet == (CAssoc*) BEFORE_START_RXPOSITION)
{
// Find the first association.
for (UINT nBucket = 0; nBucket < m_nHashTableSize; nBucket++)
if ((pAssocRet = m_pHashTable[nBucket]) != NULL)
break;
ASSERT(pAssocRet != NULL); // Must find something.
}
// Find next association.
ASSERT(AfxIsValidAddress(pAssocRet, sizeof(CAssoc)));
CAssoc* pAssocNext;
if ((pAssocNext = pAssocRet->pNext) == NULL)
{
// Go to next bucket.
for (UINT_PTR nBucket = pAssocRet->nHashValue + 1;
nBucket < m_nHashTableSize; nBucket++)
if ((pAssocNext = m_pHashTable[nBucket]) != NULL)
break;
}
rNextPosition = (RXPOSITION) pAssocNext;
// Fill in return data.
rKey = pAssocRet->key;
rValue = pAssocRet->value;
}
/////////////////////////////////////////////////////////////////////////////
// Serialization
/////////////////////////////////////////////////////////////////////////////
// Diagnostics
#ifdef _DEBUG
void CMapWordToPtr::Dump(CDumpContext& dc) const
{
ASSERT_VALID(this);
#define MAKESTRING(x) #x
AFX_DUMP1(dc, "a " MAKESTRING(CMapWordToPtr) " with ", m_nCount);
AFX_DUMP0(dc, " elements");
#undef MAKESTRING
if (dc.GetDepth() > 0)
{
// Dump in format "[key] -> value".
RXPOSITION pos = GetStartPosition();
WORD key;
void* val;
AFX_DUMP0(dc, "\n");
while (pos != NULL)
{
GetNextAssoc(pos, key, val);
AFX_DUMP1(dc, "\n\t[", key);
AFX_DUMP1(dc, "] = ", val);
}
}
}
void CMapWordToPtr::AssertValid() const
{
CObject::AssertValid();
ASSERT(m_nHashTableSize > 0);
ASSERT(m_nCount == 0 || m_pHashTable != NULL);
// Non-empty map should have hash table.
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//
// Implementation of parmeterized Map
//
/////////////////////////////////////////////////////////////////////////////
#ifdef AFX_COLL2_SEG
#pragma code_seg(AFX_COLL2_SEG)
#endif
IMPLEMENT_DYNAMIC(CMapPtrToWord, CObject)
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
#define new DEBUG_NEW
/////////////////////////////////////////////////////////////////////////////
CMapPtrToWord::CMapPtrToWord(int nBlockSize)
{
ASSERT(nBlockSize > 0);
m_pHashTable = NULL;
m_nHashTableSize = RX_HASHTABLESIZE; // default size
m_nCount = 0;
m_pFreeList = NULL;
m_pBlocks = NULL;
m_nBlockSize = nBlockSize;
}
inline UINT_PTR CMapPtrToWord::HashKey(void* key) const
{
// Default identity hash - works for most primitive values.
return UINT_PTR(DWORD_PTR(key)>>4);
}
void CMapPtrToWord::InitHashTable(UINT_PTR nHashSize)
//
// Used to force allocation of a hash table or to override the default
// hash table size of (which is fairly small).
{
ASSERT_VALID(this);
ASSERT(m_nCount == 0);
ASSERT(nHashSize > 0);
// if had a hash table - get rid of it
if (m_pHashTable != NULL)
delete [] m_pHashTable;
m_pHashTable = NULL;
m_pHashTable = new CAssoc* [nHashSize];
memset(m_pHashTable, 0, sizeof(CAssoc*) * nHashSize);
m_nHashTableSize = nHashSize;
}
void CMapPtrToWord::RemoveAll()
{
ASSERT_VALID(this);
if (m_pHashTable != NULL)
{
// free hash table
delete [] m_pHashTable;
m_pHashTable = NULL;
}
m_nCount = 0;
m_pFreeList = NULL;
m_pBlocks->FreeDataChain();
m_pBlocks = NULL;
}
CMapPtrToWord::~CMapPtrToWord()
{
RemoveAll();
ASSERT(m_nCount == 0);
}
/////////////////////////////////////////////////////////////////////////////
// Assoc helpers
// same as CList implementation except we store CAssoc's not CNode's
// and CAssoc's are singly linked all the time
CMapPtrToWord::CAssoc* CMapPtrToWord::NewAssoc()
{
if (m_pFreeList == NULL)
{
// add another block
CPlex* newBlock = CPlex::Create(m_pBlocks, m_nBlockSize, sizeof(CMapPtrToWord::CAssoc));
// chain them into free list
CMapPtrToWord::CAssoc* pAssoc = (CMapPtrToWord::CAssoc*) newBlock->data();
// free in reverse order to make it easier to debug
pAssoc += m_nBlockSize - 1;
for (int i = m_nBlockSize-1; i >= 0; i--, pAssoc--)
{
pAssoc->pNext = m_pFreeList;
m_pFreeList = pAssoc;
}
}
ASSERT(m_pFreeList != NULL); // we must have something
CMapPtrToWord::CAssoc* pAssoc = m_pFreeList;
m_pFreeList = m_pFreeList->pNext;
m_nCount++;
ASSERT(m_nCount > 0); // make sure we don't overflow
memset(&pAssoc->key, 0, sizeof(void*));
memset(&pAssoc->value, 0, sizeof(WORD));
return pAssoc;
}
void CMapPtrToWord::FreeAssoc(CMapPtrToWord::CAssoc* pAssoc)
{
pAssoc->pNext = m_pFreeList;
m_pFreeList = pAssoc;
m_nCount--;
ASSERT(m_nCount >= 0); // make sure we don't underflow
}
CMapPtrToWord::CAssoc*
CMapPtrToWord::GetAssocAt(void* key, UINT_PTR& nHash) const
// find association (or return NULL)
{
nHash = HashKey(key) % m_nHashTableSize;
if (m_pHashTable == NULL)
return NULL;
// see if it exists
CAssoc* pAssoc;
for (pAssoc = m_pHashTable[nHash]; pAssoc != NULL; pAssoc = pAssoc->pNext)
{
if (pAssoc->key == key)
return pAssoc;
}
return NULL;
}
/////////////////////////////////////////////////////////////////////////////
BOOL CMapPtrToWord::Lookup(void* key, WORD& rValue) const
{
ASSERT_VALID(this);
UINT_PTR nHash;
CAssoc* pAssoc = GetAssocAt(key, nHash);
if (pAssoc == NULL)
return FALSE; // not in map
rValue = pAssoc->value;
return TRUE;
}
WORD& CMapPtrToWord::operator[](void* key)
{
ASSERT_VALID(this);
UINT_PTR nHash;
CAssoc* pAssoc;
if ((pAssoc = GetAssocAt(key, nHash)) == NULL)
{
if (m_pHashTable == NULL)
InitHashTable(m_nHashTableSize);
// it doesn't exist, add a new Association
pAssoc = NewAssoc();
pAssoc->nHashValue = nHash;
pAssoc->key = key;
// 'pAssoc->value' is a constructed object, nothing more
// put into hash table
pAssoc->pNext = m_pHashTable[nHash];
m_pHashTable[nHash] = pAssoc;
}
return pAssoc->value; // return new reference
}
BOOL CMapPtrToWord::RemoveKey(void* key)
// remove key - return TRUE if removed
{
ASSERT_VALID(this);
if (m_pHashTable == NULL)
return FALSE; // nothing in the table
CAssoc** ppAssocPrev;
ppAssocPrev = &m_pHashTable[HashKey(key) % m_nHashTableSize];
CAssoc* pAssoc;
for (pAssoc = *ppAssocPrev; pAssoc != NULL; pAssoc = pAssoc->pNext)
{
if (pAssoc->key == key)
{
// remove it
*ppAssocPrev = pAssoc->pNext; // remove from list
FreeAssoc(pAssoc);
return TRUE;
}
ppAssocPrev = &pAssoc->pNext;
}
return FALSE; // not found
}
/////////////////////////////////////////////////////////////////////////////
// Iterating
void CMapPtrToWord::GetNextAssoc(RXPOSITION& rNextPosition,
void*& rKey, WORD& rValue) const
{
ASSERT_VALID(this);
ASSERT(m_pHashTable != NULL); // never call on empty map
CAssoc* pAssocRet = (CAssoc*)rNextPosition;
ASSERT(pAssocRet != NULL);
if (pAssocRet == (CAssoc*) BEFORE_START_RXPOSITION)
{
// find the first association
for (UINT nBucket = 0; nBucket < m_nHashTableSize; nBucket++)
if ((pAssocRet = m_pHashTable[nBucket]) != NULL)
break;
ASSERT(pAssocRet != NULL); // must find something
}
// find next association
ASSERT(AfxIsValidAddress(pAssocRet, sizeof(CAssoc)));
CAssoc* pAssocNext;
if ((pAssocNext = pAssocRet->pNext) == NULL)
{
// go to next bucket
for (UINT_PTR nBucket = pAssocRet->nHashValue + 1;
nBucket < m_nHashTableSize; nBucket++)
if ((pAssocNext = m_pHashTable[nBucket]) != NULL)
break;
}
rNextPosition = (RXPOSITION) pAssocNext;
// fill in return data
rKey = pAssocRet->key;
rValue = pAssocRet->value;
}
/////////////////////////////////////////////////////////////////////////////
// Serialization
/////////////////////////////////////////////////////////////////////////////
// Diagnostics
#ifdef _DEBUG
void CMapPtrToWord::Dump(CDumpContext& dc) const
{
ASSERT_VALID(this);
#define MAKESTRING(x) #x
AFX_DUMP1(dc, "a " MAKESTRING(CMapPtrToWord) " with ", m_nCount);
AFX_DUMP0(dc, " elements");
#undef MAKESTRING
if (dc.GetDepth() > 0)
{
// Dump in format "[key] -> value"
RXPOSITION pos = GetStartPosition();
void* key;
WORD val;
AFX_DUMP0(dc, "\n");
while (pos != NULL)
{
GetNextAssoc(pos, key, val);
AFX_DUMP1(dc, "\n\t[", key);
AFX_DUMP1(dc, "] = ", val);
}
}
}
void CMapPtrToWord::AssertValid() const
{
CObject::AssertValid();
ASSERT(m_nHashTableSize > 0);
ASSERT(m_nCount == 0 || m_pHashTable != NULL);
// non-empty map should have hash table
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//
// Implementation of parmeterized Map
//
/////////////////////////////////////////////////////////////////////////////
#ifdef AFX_COLL2_SEG
#pragma code_seg(AFX_COLL2_SEG)
#endif
IMPLEMENT_DYNAMIC(CMapPtrToPtr, CObject)
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
#define new DEBUG_NEW
/////////////////////////////////////////////////////////////////////////////
CMapPtrToPtr::CMapPtrToPtr(int nBlockSize)
{
ASSERT(nBlockSize > 0);
m_pHashTable = NULL;
m_nHashTableSize = RX_HASHTABLESIZE; // default size
m_nCount = 0;
m_pFreeList = NULL;
m_pBlocks = NULL;
m_nBlockSize = nBlockSize;
}
inline UINT_PTR CMapPtrToPtr::HashKey(void* key) const
{
// default identity hash - works for most primitive values
return UINT_PTR(DWORD_PTR(key)>>4);
}
void CMapPtrToPtr::InitHashTable(UINT_PTR nHashSize)
//
// Used to force allocation of a hash table or to override the default
// hash table size of (which is fairly small)
{
ASSERT_VALID(this);
ASSERT(m_nCount == 0);
ASSERT(nHashSize > 0);
// if had a hash table - get rid of it
if (m_pHashTable != NULL)
delete [] m_pHashTable;
m_pHashTable = NULL;
m_pHashTable = new CAssoc* [nHashSize];
memset(m_pHashTable, 0, sizeof(CAssoc*) * nHashSize);
m_nHashTableSize = nHashSize;
}
void CMapPtrToPtr::RemoveAll()
{
ASSERT_VALID(this);
if (m_pHashTable != NULL)
{
// free hash table
delete [] m_pHashTable;
m_pHashTable = NULL;
}
m_nCount = 0;
m_pFreeList = NULL;
m_pBlocks->FreeDataChain();
m_pBlocks = NULL;
}
CMapPtrToPtr::~CMapPtrToPtr()
{
RemoveAll();
ASSERT(m_nCount == 0);
}
/////////////////////////////////////////////////////////////////////////////
// Assoc helpers
// same as CList implementation except we store CAssoc's not CNode's
// and CAssoc's are singly linked all the time
CMapPtrToPtr::CAssoc* CMapPtrToPtr::NewAssoc()
{
if (m_pFreeList == NULL)
{
// add another block
CPlex* newBlock = CPlex::Create(m_pBlocks, m_nBlockSize, sizeof(CMapPtrToPtr::CAssoc));
// chain them into free list
CMapPtrToPtr::CAssoc* pAssoc = (CMapPtrToPtr::CAssoc*) newBlock->data();
// free in reverse order to make it easier to debug
pAssoc += m_nBlockSize - 1;
for (int i = m_nBlockSize-1; i >= 0; i--, pAssoc--)
{
pAssoc->pNext = m_pFreeList;
m_pFreeList = pAssoc;
}
}
ASSERT(m_pFreeList != NULL); // we must have something
CMapPtrToPtr::CAssoc* pAssoc = m_pFreeList;
m_pFreeList = m_pFreeList->pNext;
m_nCount++;
ASSERT(m_nCount > 0); // make sure we don't overflow
memset(&pAssoc->key, 0, sizeof(void*));
memset(&pAssoc->value, 0, sizeof(void*));
return pAssoc;
}
void CMapPtrToPtr::FreeAssoc(CMapPtrToPtr::CAssoc* pAssoc)
{
pAssoc->pNext = m_pFreeList;
m_pFreeList = pAssoc;
m_nCount--;
ASSERT(m_nCount >= 0); // make sure we don't underflow
}
CMapPtrToPtr::CAssoc*
CMapPtrToPtr::GetAssocAt(void* key, UINT_PTR& nHash) const
// find association (or return NULL)
{
nHash = HashKey(key) % m_nHashTableSize;
if (m_pHashTable == NULL)
return NULL;
// see if it exists
CAssoc* pAssoc;
for (pAssoc = m_pHashTable[nHash]; pAssoc != NULL; pAssoc = pAssoc->pNext)
{
if (pAssoc->key == key)
return pAssoc;
}
return NULL;
}
/////////////////////////////////////////////////////////////////////////////
BOOL CMapPtrToPtr::Lookup(void* key, void*& rValue) const
{
ASSERT_VALID(this);
UINT_PTR nHash;
CAssoc* pAssoc = GetAssocAt(key, nHash);
if (pAssoc == NULL)
return FALSE; // not in map
rValue = pAssoc->value;
return TRUE;
}
void*& CMapPtrToPtr::operator[](void* key)
{
ASSERT_VALID(this);
UINT_PTR nHash;
CAssoc* pAssoc;
if ((pAssoc = GetAssocAt(key, nHash)) == NULL)
{
if (m_pHashTable == NULL)
InitHashTable(m_nHashTableSize);
// it doesn't exist, add a new Association
pAssoc = NewAssoc();
pAssoc->nHashValue = nHash;
pAssoc->key = key;
// 'pAssoc->value' is a constructed object, nothing more
// put into hash table
pAssoc->pNext = m_pHashTable[nHash];
m_pHashTable[nHash] = pAssoc;
}
return pAssoc->value; // return new reference
}
BOOL CMapPtrToPtr::RemoveKey(void* key)
// remove key - return TRUE if removed
{
ASSERT_VALID(this);
if (m_pHashTable == NULL)
return FALSE; // nothing in the table
CAssoc** ppAssocPrev;
ppAssocPrev = &m_pHashTable[HashKey(key) % m_nHashTableSize];
CAssoc* pAssoc;
for (pAssoc = *ppAssocPrev; pAssoc != NULL; pAssoc = pAssoc->pNext)
{
if (pAssoc->key == key)
{
// remove it
*ppAssocPrev = pAssoc->pNext; // remove from list
FreeAssoc(pAssoc);
return TRUE;
}
ppAssocPrev = &pAssoc->pNext;
}
return FALSE; // not found
}
/////////////////////////////////////////////////////////////////////////////
// Iterating
void CMapPtrToPtr::GetNextAssoc(RXPOSITION& rNextPosition,
void*& rKey, void*& rValue) const
{
ASSERT_VALID(this);
ASSERT(m_pHashTable != NULL); // never call on empty map
CAssoc* pAssocRet = (CAssoc*)rNextPosition;
ASSERT(pAssocRet != NULL);
if (pAssocRet == (CAssoc*) BEFORE_START_RXPOSITION)
{
// find the first association
for (UINT nBucket = 0; nBucket < m_nHashTableSize; nBucket++)
if ((pAssocRet = m_pHashTable[nBucket]) != NULL)
break;
ASSERT(pAssocRet != NULL); // must find something
}
// find next association
ASSERT(AfxIsValidAddress(pAssocRet, sizeof(CAssoc)));
CAssoc* pAssocNext;
if ((pAssocNext = pAssocRet->pNext) == NULL)
{
// go to next bucket
for (UINT_PTR nBucket = pAssocRet->nHashValue + 1;
nBucket < m_nHashTableSize; nBucket++)
if ((pAssocNext = m_pHashTable[nBucket]) != NULL)
break;
}
rNextPosition = (RXPOSITION) pAssocNext;
// fill in return data
rKey = pAssocRet->key;
rValue = pAssocRet->value;
}
/////////////////////////////////////////////////////////////////////////////
// Serialization
/////////////////////////////////////////////////////////////////////////////
// Diagnostics
#ifdef _DEBUG
void CMapPtrToPtr::Dump(CDumpContext& dc) const
{
ASSERT_VALID(this);
#define MAKESTRING(x) #x
AFX_DUMP1(dc, "a " MAKESTRING(CMapPtrToPtr) " with ", m_nCount);
AFX_DUMP0(dc, " elements");
#undef MAKESTRING
if (dc.GetDepth() > 0)
{
// Dump in format "[key] -> value"
RXPOSITION pos = GetStartPosition();
void* key;
void* val;
AFX_DUMP0(dc, "\n");
while (pos != NULL)
{
GetNextAssoc(pos, key, val);
AFX_DUMP1(dc, "\n\t[", key);
AFX_DUMP1(dc, "] = ", val);
}
}
}
void CMapPtrToPtr::AssertValid() const
{
CObject::AssertValid();
ASSERT(m_nHashTableSize > 0);
ASSERT(m_nCount == 0 || m_pHashTable != NULL);
// non-empty map should have hash table
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//
// Implementation of parmeterized Map from CString to value
//
/////////////////////////////////////////////////////////////////////////////
#include <string.h>
#ifdef AFX_COLL2_SEG
#pragma code_seg(AFX_COLL2_SEG)
#endif
IMPLEMENT_SERIAL(CMapStringToOb, CObject, 0)
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
#define new DEBUG_NEW
const char *afxEmptyString = "";
extern const char *afxEmptyString; // for creating empty key strings
/////////////////////////////////////////////////////////////////////////////
CMapStringToOb::CMapStringToOb(int nBlockSize)
{
ASSERT(nBlockSize > 0);
m_pHashTable = NULL;
m_nHashTableSize = RX_HASHTABLESIZE; // default size
m_nCount = 0;
m_pFreeList = NULL;
m_pBlocks = NULL;
m_nBlockSize = nBlockSize;
}
inline UINT_PTR CMapStringToOb::HashKey(const char* key) const
{
UINT_PTR nHash = 0;
while (*key)
nHash = (nHash<<5) + nHash + *key++;
return nHash;
}
void CMapStringToOb::InitHashTable(UINT_PTR nHashSize)
//
// Used to force allocation of a hash table or to override the default
// hash table size of (which is fairly small)
{
ASSERT_VALID(this);
ASSERT(m_nCount == 0);
ASSERT(nHashSize > 0);
// if had a hash table - get rid of it
if (m_pHashTable != NULL)
delete [] m_pHashTable;
m_pHashTable = NULL;
m_pHashTable = new CAssoc* [nHashSize];
memset(m_pHashTable, 0, sizeof(CAssoc*) * nHashSize);
m_nHashTableSize = nHashSize;
}
void CMapStringToOb::RemoveAll()
{
ASSERT_VALID(this);
if (m_pHashTable != NULL)
{
// destroy elements
for (UINT nHash = 0; nHash < m_nHashTableSize; nHash++)
{
CAssoc* pAssoc;
for (pAssoc = m_pHashTable[nHash]; pAssoc != NULL;
pAssoc = pAssoc->pNext)
{
delete pAssoc->key; // free up string data
}
}
// free hash table
delete [] m_pHashTable;
m_pHashTable = NULL;
}
m_nCount = 0;
m_pFreeList = NULL;
m_pBlocks->FreeDataChain();
m_pBlocks = NULL;
}
CMapStringToOb::~CMapStringToOb()
{
RemoveAll();
ASSERT(m_nCount == 0);
}
/////////////////////////////////////////////////////////////////////////////
// Assoc helpers
// same as CList implementation except we store CAssoc's not CNode's
// and CAssoc's are singly linked all the time
CMapStringToOb::CAssoc* CMapStringToOb::NewAssoc()
{
if (m_pFreeList == NULL)
{
// add another block
CPlex* newBlock = CPlex::Create(m_pBlocks, m_nBlockSize,
sizeof(CMapStringToOb::CAssoc));
// chain them into free list
CMapStringToOb::CAssoc* pAssoc =
(CMapStringToOb::CAssoc*) newBlock->data();
// free in reverse order to make it easier to debug
pAssoc += m_nBlockSize - 1;
for (int i = m_nBlockSize-1; i >= 0; i--, pAssoc--)
{
pAssoc->pNext = m_pFreeList;
m_pFreeList = pAssoc;
}
}
ASSERT(m_pFreeList != NULL); // we must have something
CMapStringToOb::CAssoc* pAssoc = m_pFreeList;
m_pFreeList = m_pFreeList->pNext;
m_nCount++;
ASSERT(m_nCount > 0); // make sure we don't overflow
// memcpy(&pAssoc->key, &afxEmptyString, sizeof(CString));
pAssoc->key = NULL;
memset(&pAssoc->value, 0, sizeof(CObject*));
return pAssoc;
}
void CMapStringToOb::FreeAssoc(CMapStringToOb::CAssoc* pAssoc)
{
delete pAssoc->key; // free up string data
pAssoc->key = NULL;
pAssoc->pNext = m_pFreeList;
m_pFreeList = pAssoc;
m_nCount--;
ASSERT(m_nCount >= 0); // make sure we don't underflow
}
CMapStringToOb::CAssoc*
CMapStringToOb::GetAssocAt(const char* key, UINT_PTR& nHash) const
// find association (or return NULL)
{
nHash = HashKey(key) % m_nHashTableSize;
if (m_pHashTable == NULL)
return NULL;
// see if it exists
CAssoc* pAssoc;
for (pAssoc = m_pHashTable[nHash]; pAssoc != NULL; pAssoc = pAssoc->pNext)
{
if (!strcmp(pAssoc->key,key))
return pAssoc;
}
return NULL;
}
/////////////////////////////////////////////////////////////////////////////
BOOL CMapStringToOb::Lookup(const char* key, CObject*& rValue) const
{
ASSERT_VALID(this);
UINT_PTR nHash;
CAssoc* pAssoc = GetAssocAt(key, nHash);
if (pAssoc == NULL)
return FALSE; // not in map
rValue = pAssoc->value;
return TRUE;
}
CObject*& CMapStringToOb::operator[](const char* key)
{
ASSERT_VALID(this);
UINT_PTR nHash;
CAssoc* pAssoc;
if ((pAssoc = GetAssocAt(key, nHash)) == NULL)
{
if (m_pHashTable == NULL)
InitHashTable(m_nHashTableSize);
// it doesn't exist, add a new Association
pAssoc = NewAssoc();
pAssoc->nHashValue = nHash;
const size_t nKeySize = strlen(key)+1;
pAssoc->key = new char [nKeySize];
strcpy_s(pAssoc->key, nKeySize, key);
// 'pAssoc->value' is a constructed object, nothing more
// put into hash table
pAssoc->pNext = m_pHashTable[nHash];
m_pHashTable[nHash] = pAssoc;
}
return pAssoc->value; // return new reference
}
BOOL CMapStringToOb::RemoveKey(const char* key)
// remove key - return TRUE if removed
{
ASSERT_VALID(this);
if (m_pHashTable == NULL)
return FALSE; // nothing in the table
CAssoc** ppAssocPrev;
ppAssocPrev = &m_pHashTable[HashKey(key) % m_nHashTableSize];
CAssoc* pAssoc;
for (pAssoc = *ppAssocPrev; pAssoc != NULL; pAssoc = pAssoc->pNext)
{
if (pAssoc->key == key)
{
// remove it
*ppAssocPrev = pAssoc->pNext; // remove from list
FreeAssoc(pAssoc);
return TRUE;
}
ppAssocPrev = &pAssoc->pNext;
}
return FALSE; // not found
}
/////////////////////////////////////////////////////////////////////////////
// Iterating
void CMapStringToOb::GetNextAssoc(RXPOSITION& rNextPosition,
char *& rKey, CObject*& rValue) const
{
ASSERT_VALID(this);
ASSERT(m_pHashTable != NULL); // never call on empty map
CAssoc* pAssocRet = (CAssoc*)rNextPosition;
ASSERT(pAssocRet != NULL);
if (pAssocRet == (CAssoc*) BEFORE_START_RXPOSITION)
{
// find the first association
for (UINT nBucket = 0; nBucket < m_nHashTableSize; nBucket++)
if ((pAssocRet = m_pHashTable[nBucket]) != NULL)
break;
ASSERT(pAssocRet != NULL); // must find something
}
// find next association
ASSERT(AfxIsValidAddress(pAssocRet, sizeof(CAssoc)));
CAssoc* pAssocNext;
if ((pAssocNext = pAssocRet->pNext) == NULL)
{
// go to next bucket
for (UINT_PTR nBucket = pAssocRet->nHashValue + 1;
nBucket < m_nHashTableSize; nBucket++)
if ((pAssocNext = m_pHashTable[nBucket]) != NULL)
break;
}
rNextPosition = (RXPOSITION) pAssocNext;
// fill in return data
rKey = pAssocRet->key;
rValue = pAssocRet->value;
}
/////////////////////////////////////////////////////////////////////////////
// Diagnostics
#ifdef _DEBUG
void CMapStringToOb::Dump(CDumpContext& dc) const
{
ASSERT_VALID(this);
#define MAKESTRING(x) #x
AFX_DUMP1(dc, "A " MAKESTRING(CMapStringToOb) " with ", m_nCount);
AFX_DUMP0(dc, " elements\n");
#undef MAKESTRING
if (dc.GetDepth() > 0)
{
// Dump in format "[key] -> value"
AFX_DUMP0(dc, "\n");
RXPOSITION pos = GetStartPosition();
CString key;
CObject* val;
while (pos != NULL)
{
GetNextAssoc(pos, key, val);
AFX_DUMP1(dc, "\n\t[", key);
AFX_DUMP1(dc, "] = ", val);
}
}
}
void CMapStringToOb::AssertValid() const
{
CObject::AssertValid();
ASSERT(m_nHashTableSize > 0);
ASSERT(m_nCount == 0 || m_pHashTable != NULL);
// non-empty map should have hash table
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// Collection support
#ifdef AFX_COLL_SEG
#pragma code_seg(AFX_COLL_SEG)
#endif
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
#define new DEBUG_NEW
CPlex* CPlex::Create(CPlex*& pHead, UINT nMax, UINT cbElement)
{
ASSERT(nMax > 0 && cbElement > 0);
CPlex* p = (CPlex*) new BYTE[sizeof(CPlex) + nMax * cbElement];
// may throw exception
p->nMax = nMax;
p->nCur = 0;
p->pNext = pHead;
pHead = p; // change head (adds in reverse order for simplicity)
return p;
}
void CPlex::FreeDataChain() // free this one and links
{
CPlex* p = this;
while (p != NULL)
{
BYTE* bytes = (BYTE*) p;
CPlex* pNextt = p->pNext;
delete bytes;
p = pNextt;
}
}
| 24.813077 | 96 | 0.561026 | MadhukarMoogala |
e0e66a0a8dfdbcd05cf7c8c06ba0e679ce34314f | 603 | cpp | C++ | Assignment4/main.cpp | rehman000/Data_Structures | 32e0d5dcb6e787c17f2ee65939b6500984d46338 | [
"MIT"
] | null | null | null | Assignment4/main.cpp | rehman000/Data_Structures | 32e0d5dcb6e787c17f2ee65939b6500984d46338 | [
"MIT"
] | null | null | null | Assignment4/main.cpp | rehman000/Data_Structures | 32e0d5dcb6e787c17f2ee65939b6500984d46338 | [
"MIT"
] | null | null | null | #include <iostream>
#include "sequence3.h"
int main()
{
data_structures_assignment3::sequence s1;
s1.insert(1);
s1.insert(2);
s1.insert(3);
s1.insert(4);
s1.insert(5);
s1.insert(6);
s1.insert(7);
std::cout << s1.current() << std::endl;
s1.advance();
std::cout << s1.current() << std::endl;
s1.advance();
std::cout << s1.current() << std::endl;
s1.advance();
std::cout << s1.current() << std::endl;
s1.advance();
std::cout << s1.current() << std::endl;
s1.advance();
std::cout << s1.current() << std::endl;
return 0;
}
| 19.451613 | 45 | 0.545605 | rehman000 |
e0e7efca5e7330bec9b876a88ce5ab668ab601fb | 5,350 | cpp | C++ | ComputerGraphicsProject/Viewer/imgLoad.cpp | KvanTTT/Education | e9dc00bfc25ccf0e25c4e7ec187bccb680f126f9 | [
"MIT"
] | 1 | 2018-04-06T19:47:37.000Z | 2018-04-06T19:47:37.000Z | ComputerGraphicsProject/Viewer/imgLoad.cpp | KvanTTT/Education | e9dc00bfc25ccf0e25c4e7ec187bccb680f126f9 | [
"MIT"
] | null | null | null | ComputerGraphicsProject/Viewer/imgLoad.cpp | KvanTTT/Education | e9dc00bfc25ccf0e25c4e7ec187bccb680f126f9 | [
"MIT"
] | null | null | null |
#include "std.h"
#include "imgLoad.h"
#include "Image.h"
#include "IOFile.h"
#include "IJL/ijl.h"
#pragma comment(lib, "IJL/ijl15.lib" )
typedef struct bmpFileHeader_tag_
{
UInt8 B, M;
UInt32 nSize;
UInt32 nReserved;
UInt32 nOffsetToBits;
} BMPFileHeader;
typedef struct bmpImageHeader_tag_
{
UInt32 nSize;
Int32 nWidth;
Int32 nHeight;
UInt16 nPlanes;
UInt16 nBPP;
UInt32 nCompression;
UInt32 nImageSize;
Int32 nWidthPPM;
Int32 nHeightPPM;
UInt32 nColorUsed;
UInt32 nColorImportant;
} BMPImageHeader;
// This is our actual BMP image loading function.
bool imgLoadBMP(char* szImageName, Image *img)
{
BMPFileHeader bfh;
BMPImageHeader bih;
UInt8 *pBMPData=0;
IOFile filebmp;
if( img == 0 )
return false;
if( filebmp.Create( szImageName, "rb" ) == false )
return false;
filebmp >> bfh.B; filebmp >> bfh.M;
filebmp >> bfh.nSize;
filebmp >> bfh.nReserved;
filebmp >> bfh.nOffsetToBits;
if(( bfh.B != 'B' ) || (bfh.M != 'M') || filebmp.IsEOF())
{
filebmp.Free();
return false;
}
filebmp >> bih.nSize;
filebmp >> bih.nWidth;
filebmp >> bih.nHeight;
filebmp >> bih.nPlanes;
filebmp >> bih.nBPP;
filebmp >> bih.nCompression;
filebmp >> bih.nImageSize;
filebmp >> bih.nWidthPPM;
filebmp >> bih.nHeightPPM;
filebmp >> bih.nColorUsed;
filebmp >> bih.nColorImportant;
// Validate the image header results.
if( (bih.nCompression != 0) ||
(bih.nHeight == 0) ||
(bih.nWidth == 0) )
{
filebmp.Free();
return false;
}
// We must have either an 8, 24, or 32bit image.
if( (bih.nBPP != 8) && (bih.nBPP != 24) && (bih.nBPP != 32) )
{
filebmp.Free();
return false;
}
// Jump to the image data.
filebmp.SeekFromStart( bfh.nOffsetToBits );
// Prep the image data for loading.
UInt32 nStride = (bih.nWidth * (bih.nBPP/8) + 1) & (~1); // Stride is the BMP's bytes per row.
bih.nImageSize = nStride * bih.nHeight;
pBMPData = new UInt8[bih.nImageSize];
if( pBMPData == 0 )
{
filebmp.Free();
return false;
}
// Load it up.. we want the image data raw.
// for (int i=bih.nHeight-1; i; i--)
for (signed int i=bih.nHeight-1; i>=0; i--)
{
if( filebmp.Read( pBMPData+i*nStride, nStride ) == false )
{
filebmp.Free();
delete pBMPData;
return false; // In case we hit an IOFile error by now.
}
}
/* if( filebmp.Read( pBMPData, bih.nImageSize ) == false )
{
filebmp.Free();
delete pBMPData;
return false; // In case we hit an IOFile error by now.
}*/
// Create our target Image.
img->Create( bih.nWidth, bih.nHeight, bih.nBPP );
bool bFlipY;
if( bih.nHeight < 0 ) // Negative height is top to bottom, right side up.
{
bih.nHeight = -bih.nHeight;
bFlipY = false;
}
else // Positive height is bottom to top, or upside down.
bFlipY = true;
UInt8 *pDest=(UInt8*)img->GetData(), *pSrc;
for( UInt32 y=0; y<(UInt32)bih.nHeight; y++ )
{
if( bFlipY ) // Handle pointer calculations for yFlip situations.
pSrc = pBMPData + bih.nImageSize - (y * nStride) - nStride;
else
pSrc = pBMPData + (y * nStride);
// Perform row copy of image data, and in 24 & 32bit cases,
// swizzle those blue and red bytes around.
switch( bih.nBPP )
{
case 8:
{
memcpy( pDest, pSrc, img->GetStride() );
}
break;
case 24: // from BGR order to RGB. So swap blue and red bytes.
{
for( UInt32 x=0; x<img->GetStride(); x+=3 )
{
pDest[x] = pSrc[x+2];
pDest[x+1] = pSrc[x+1];
pDest[x+2] = pSrc[x];
}
}
break;
case 32: // 32bit is just like 24bit, but we go from BGRA to RGBA,
{ // so green and alpha are left alone.
for( UInt32 x=0; x<img->GetStride(); x+=4 )
{
pDest[x] = pSrc[x+2];
pDest[x+1] = pSrc[x+1];
pDest[x+2] = pSrc[x];
pDest[x+3] = pSrc[x+3];
}
}
break;
default: // Only supporting 8, 24, and 32 image formats.
{
filebmp.Free();
delete pBMPData;
img->Free();
return false;
}
}
pDest += img->GetStride();
}
filebmp.Free();
delete pBMPData;
return true;
}
bool imgLoadJPG(char* szImageName, Image *img)
{
BYTE Bpp8 = 3;
int RetVal;
JPEG_CORE_PROPERTIES image;
ZeroMemory(&image, sizeof( JPEG_CORE_PROPERTIES ) );
if( ijlInit(&image ) != IJL_OK )
return false;
image.JPGFile = szImageName;
if ((RetVal = ijlRead(&image,IJL_JFILE_READPARAMS)) == IJL_OK)
{
img->Create(image.JPGHeight, image.JPGWidth, Bpp8*8);
UInt8 *pDest = (UInt8*)img->GetData();
UINT ImageSize = img->GetHeight() * img->GetWidth() * Bpp8;
UInt8 *pSrc = new UInt8[ImageSize];
if (pSrc)
{
image.DIBBytes = pSrc;
image.DIBColor = IJL_RGB;
image.DIBHeight = img->GetHeight();
image.DIBWidth = img->GetWidth();
image.DIBChannels = Bpp8;
if ((RetVal = ijlRead(&image, IJL_JFILE_READWHOLEIMAGE)) == IJL_OK)
{
switch (img->GetBPP())
{
case 24:
{
for(UINT i = 0; i < ImageSize; i += 3)
{
pDest[i + 0] = pSrc[i + 0];
pDest[i + 1] = pSrc[i + 1];
pDest[i + 2] = pSrc[i + 2];
}
break;
}
case 32:
{
for(UINT i = 0; i < ImageSize; i += 4)
{
pDest[i + 0] = pSrc[i + 0];
pDest[i + 1] = pSrc[i + 1];
pDest[i + 2] = pSrc[i + 2];
pDest[i + 3] = pSrc[i + 3];
}
break;
}
}
}
}
delete pSrc;
}
ijlFree(&image);
return true;
} | 21.230159 | 95 | 0.603178 | KvanTTT |
e0e8c70b6b068e99814f9bcec6f25ba7633c35e0 | 15,007 | cpp | C++ | source/GameLib/RaceMotionData.cpp | beetle2k/Metin2Client | 114f492b71fcc90e8f5010c5b35b9fddb51639ca | [
"MIT"
] | 13 | 2018-08-27T19:06:54.000Z | 2021-11-12T05:44:04.000Z | source/GameLib/RaceMotionData.cpp | stempomzeskas/Metin2Client | 114f492b71fcc90e8f5010c5b35b9fddb51639ca | [
"MIT"
] | null | null | null | source/GameLib/RaceMotionData.cpp | stempomzeskas/Metin2Client | 114f492b71fcc90e8f5010c5b35b9fddb51639ca | [
"MIT"
] | 15 | 2018-10-25T14:28:10.000Z | 2022-03-25T14:05:09.000Z | #include "StdAfx.h"
#include "../EffectLib/EffectManager.h"
#include "FlyingObjectManager.h"
#include "RaceMotionData.h"
CDynamicPool<CRaceMotionData> CRaceMotionData::ms_kPool;
void CRaceMotionData::CreateSystem(UINT uCapacity)
{
ms_kPool.Create(uCapacity);
}
void CRaceMotionData::DestroySystem()
{
ms_kPool.Clear();
}
CRaceMotionData* CRaceMotionData::New()
{
return ms_kPool.Alloc();
}
void CRaceMotionData::Delete(CRaceMotionData* pkData)
{
pkData->Destroy();
ms_kPool.Free(pkData);
}
void CRaceMotionData::SetName(UINT eName)
{
m_eName=eName;
switch (m_eName)
{
case NAME_NONE:
SetType(TYPE_NONE);
break;
case NAME_WAIT:
case NAME_INTRO_WAIT:
case NAME_STOP:
SetType(TYPE_WAIT);
break;
case NAME_WALK:
case NAME_RUN:
SetType(TYPE_MOVE);
break;
case NAME_DAMAGE:
case NAME_DAMAGE_BACK:
SetType(TYPE_DAMAGE);
break;
case NAME_DAMAGE_FLYING:
case NAME_DAMAGE_FLYING_BACK:
SetType(TYPE_KNOCKDOWN);
break;
case NAME_STAND_UP:
case NAME_STAND_UP_BACK:
SetType(TYPE_STANDUP);
break;
case NAME_SPAWN:
case NAME_CHANGE_WEAPON:
case NAME_INTRO_SELECTED:
case NAME_INTRO_NOT_SELECTED:
case NAME_SPECIAL_1:
case NAME_SPECIAL_2:
case NAME_SPECIAL_3:
case NAME_SPECIAL_4:
case NAME_SPECIAL_5:
case NAME_SPECIAL_6:
case NAME_CLAP:
case NAME_DANCE_1:
case NAME_DANCE_2:
case NAME_DANCE_3:
case NAME_DANCE_4:
case NAME_DANCE_5:
case NAME_DANCE_6:
case NAME_CONGRATULATION:
case NAME_FORGIVE:
case NAME_ANGRY:
case NAME_ATTRACTIVE:
case NAME_SAD:
case NAME_SHY:
case NAME_CHEERUP:
case NAME_BANTER:
case NAME_JOY:
case NAME_CHEERS_1:
case NAME_CHEERS_2:
case NAME_KISS_WITH_WARRIOR:
case NAME_KISS_WITH_ASSASSIN:
case NAME_KISS_WITH_SURA:
case NAME_KISS_WITH_SHAMAN:
case NAME_FRENCH_KISS_WITH_WARRIOR:
case NAME_FRENCH_KISS_WITH_ASSASSIN:
case NAME_FRENCH_KISS_WITH_SURA:
case NAME_FRENCH_KISS_WITH_SHAMAN:
case NAME_SLAP_HIT_WITH_WARRIOR:
case NAME_SLAP_HIT_WITH_ASSASSIN:
case NAME_SLAP_HIT_WITH_SURA:
case NAME_SLAP_HIT_WITH_SHAMAN:
case NAME_SLAP_HURT_WITH_WARRIOR:
case NAME_SLAP_HURT_WITH_ASSASSIN:
case NAME_SLAP_HURT_WITH_SURA:
case NAME_SLAP_HURT_WITH_SHAMAN:
case NAME_DIG:
SetType(TYPE_EVENT);
break;
case NAME_DEAD:
case NAME_DEAD_BACK:
SetType(TYPE_DIE);
break;
case NAME_NORMAL_ATTACK:
SetType(TYPE_ATTACK);
break;
case NAME_COMBO_ATTACK_1:
case NAME_COMBO_ATTACK_2:
case NAME_COMBO_ATTACK_3:
case NAME_COMBO_ATTACK_4:
case NAME_COMBO_ATTACK_5:
case NAME_COMBO_ATTACK_6:
case NAME_COMBO_ATTACK_7:
case NAME_COMBO_ATTACK_8:
SetType(TYPE_COMBO);
break;
case NAME_FISHING_THROW:
case NAME_FISHING_WAIT:
case NAME_FISHING_REACT:
case NAME_FISHING_CATCH:
case NAME_FISHING_FAIL:
case NAME_FISHING_STOP:
SetType(TYPE_FISHING);
break;
default:
if (eName>=NAME_SKILL && eName<=NAME_SKILL+SKILL_NUM)
SetType(TYPE_SKILL);
else
TraceError("CRaceMotionData::SetName - UNKNOWN NAME %d", eName);
break;
}
}
void CRaceMotionData::SetType(UINT eType)
{
m_eType=eType;
switch (m_eType)
{
case TYPE_ATTACK:
case TYPE_COMBO:
case TYPE_SKILL:
m_isLock=TRUE;
break;
default:
m_isLock=FALSE;
break;
}
}
UINT CRaceMotionData::GetType() const
{
return m_eType;
}
bool CRaceMotionData::IsLock() const
{
return m_isLock ? true : false;
}
int CRaceMotionData::GetLoopCount() const
{
return m_iLoopCount;
}
float CRaceMotionData::GetMotionDuration()
{
return m_fMotionDuration;
}
void CRaceMotionData::SetMotionDuration(float fDuration)
{
m_fMotionDuration = fDuration;
}
// Combo
BOOL CRaceMotionData::IsComboInputTimeData() const
{
return m_isComboMotion;
}
float CRaceMotionData::GetComboInputStartTime() const
{
assert(m_isComboMotion);
return m_ComboInputData.fInputStartTime;
}
float CRaceMotionData::GetNextComboTime() const
{
assert(m_isComboMotion);
return m_ComboInputData.fNextComboTime;
}
float CRaceMotionData::GetComboInputEndTime() const
{
assert(m_isComboMotion);
return m_ComboInputData.fInputEndTime;
}
// Attacking
BOOL CRaceMotionData::isAttackingMotion() const
{
return m_isAttackingMotion;
}
const NRaceData::TMotionAttackData * CRaceMotionData::GetMotionAttackDataPointer() const
{
return & m_MotionAttackData;
}
const NRaceData::TMotionAttackData & CRaceMotionData::GetMotionAttackDataReference() const
{
assert(m_isAttackingMotion);
return m_MotionAttackData;
}
BOOL CRaceMotionData::HasSplashMotionEvent() const
{
return m_hasSplashEvent;
}
// Skill
BOOL CRaceMotionData::IsCancelEnableSkill() const
{
return m_bCancelEnableSkill;
}
// Loop
BOOL CRaceMotionData::IsLoopMotion() const
{
return m_isLoopMotion;
}
float CRaceMotionData::GetLoopStartTime() const
{
return m_fLoopStartTime;
}
float CRaceMotionData::GetLoopEndTime() const
{
return m_fLoopEndTime;
}
// Motion Event Data
DWORD CRaceMotionData::GetMotionEventDataCount() const
{
return m_MotionEventDataVector.size();
}
BOOL CRaceMotionData::GetMotionEventDataPointer(BYTE byIndex, const CRaceMotionData::TMotionEventData ** c_ppData) const
{
if (byIndex >= m_MotionEventDataVector.size())
return FALSE;
*c_ppData = m_MotionEventDataVector[byIndex];
return TRUE;
}
BOOL CRaceMotionData::GetMotionAttackingEventDataPointer(BYTE byIndex, const CRaceMotionData::TMotionAttackingEventData ** c_ppData) const
{
if (byIndex >= m_MotionEventDataVector.size())
return FALSE;
const CRaceMotionData::TMotionEventData * pData = m_MotionEventDataVector[byIndex];
const CRaceMotionData::TMotionAttackingEventData * pAttackingEvent = (const CRaceMotionData::TMotionAttackingEventData *)pData;
if (MOTION_EVENT_TYPE_SPECIAL_ATTACKING == pAttackingEvent->iType)
return FALSE;
*c_ppData = pAttackingEvent;
return TRUE;
}
int CRaceMotionData::GetEventType(DWORD dwIndex) const
{
if (dwIndex >= m_MotionEventDataVector.size())
return MOTION_EVENT_TYPE_NONE;
return m_MotionEventDataVector[dwIndex]->iType;
}
float CRaceMotionData::GetEventStartTime(DWORD dwIndex) const
{
if (dwIndex >= m_MotionEventDataVector.size())
return 0.0f;
return m_MotionEventDataVector[dwIndex]->fStartingTime;
}
const NSound::TSoundInstanceVector * CRaceMotionData::GetSoundInstanceVectorPointer() const
{
return &m_SoundInstanceVector;
}
void CRaceMotionData::SetAccumulationPosition(const TPixelPosition & c_rPos)
{
m_accumulationPosition = c_rPos;
m_isAccumulationMotion = TRUE;
}
bool CRaceMotionData::LoadMotionData(const char * c_szFileName)
{
const float c_fFrameTime = 1.0f / g_fGameFPS;
CTextFileLoader* pkTextFileLoader=CTextFileLoader::Cache(c_szFileName);
if (!pkTextFileLoader)
return false;
CTextFileLoader& rkTextFileLoader=*pkTextFileLoader;
if (rkTextFileLoader.IsEmpty())
return false;
rkTextFileLoader.SetTop();
if (!rkTextFileLoader.GetTokenString("motionfilename", &m_strMotionFileName))
return false;
if (!rkTextFileLoader.GetTokenFloat("motionduration", &m_fMotionDuration))
return false;
CTokenVector * pTokenVector;
if (rkTextFileLoader.GetTokenVector("accumulation", &pTokenVector))
{
if (pTokenVector->size() != 3)
{
TraceError("CRaceMotioNData::LoadMotionData : syntax error on accumulation, vector size %d", pTokenVector->size());
return false;
}
TPixelPosition pos(atof(pTokenVector->at(0).c_str()),
atof(pTokenVector->at(1).c_str()),
atof(pTokenVector->at(2).c_str()));
SetAccumulationPosition(pos);
}
std::string strNodeName;
for (DWORD i = 0; i < rkTextFileLoader.GetChildNodeCount(); ++i)
{
CTextFileLoader::CGotoChild GotoChild(&rkTextFileLoader, i);
rkTextFileLoader.GetCurrentNodeName(&strNodeName);
if (0 == strNodeName.compare("comboinputdata"))
{
m_isComboMotion = TRUE;
if (!rkTextFileLoader.GetTokenFloat("preinputtime", &m_ComboInputData.fInputStartTime))
return false;
if (!rkTextFileLoader.GetTokenFloat("directinputtime", &m_ComboInputData.fNextComboTime))
return false;
if (!rkTextFileLoader.GetTokenFloat("inputlimittime", &m_ComboInputData.fInputEndTime))
return false;
}
else if (0 == strNodeName.compare("attackingdata"))
{
m_isAttackingMotion = TRUE;
if (!NRaceData::LoadMotionAttackData(rkTextFileLoader, &m_MotionAttackData))
return false;
}
else if (0 == strNodeName.compare("loopdata"))
{
m_isLoopMotion = TRUE;
if (!rkTextFileLoader.GetTokenInteger("motionloopcount", &m_iLoopCount))
{
m_iLoopCount = -1;
}
if (!rkTextFileLoader.GetTokenInteger("loopcancelenable", &m_bCancelEnableSkill))
{
m_bCancelEnableSkill = FALSE;
}
if (!rkTextFileLoader.GetTokenFloat("loopstarttime", &m_fLoopStartTime))
return false;
if (!rkTextFileLoader.GetTokenFloat("loopendtime", &m_fLoopEndTime))
return false;
}
else if (0 == strNodeName.compare("motioneventdata"))
{
DWORD dwMotionEventDataCount;
if (!rkTextFileLoader.GetTokenDoubleWord("motioneventdatacount", &dwMotionEventDataCount))
continue;
stl_wipe(m_MotionEventDataVector);
m_MotionEventDataVector.resize(dwMotionEventDataCount, NULL);
for (DWORD j = 0; j < m_MotionEventDataVector.size(); ++j)
{
if (!rkTextFileLoader.SetChildNode("event", j))
return false;
int iType;
if (!rkTextFileLoader.GetTokenInteger("motioneventtype", &iType))
return false;
TMotionEventData * pData = NULL;
switch(iType)
{
case MOTION_EVENT_TYPE_FLY:
pData = new TMotionFlyEventData;
break;
case MOTION_EVENT_TYPE_EFFECT:
pData = new TMotionEffectEventData;
break;
case MOTION_EVENT_TYPE_SCREEN_WAVING:
pData = new TScreenWavingEventData;
break;
case MOTION_EVENT_TYPE_SPECIAL_ATTACKING:
pData = new TMotionAttackingEventData;
m_hasSplashEvent = TRUE;
break;
case MOTION_EVENT_TYPE_SOUND:
pData = new TMotionSoundEventData;
break;
case MOTION_EVENT_TYPE_CHARACTER_SHOW:
pData = new TMotionCharacterShowEventData;
break;
case MOTION_EVENT_TYPE_CHARACTER_HIDE:
pData = new TMotionCharacterHideEventData;
break;
case MOTION_EVENT_TYPE_WARP:
pData = new TMotionWarpEventData;
break;
case MOTION_EVENT_TYPE_EFFECT_TO_TARGET:
pData = new TMotionEffectToTargetEventData;
break;
default:
assert(!" CRaceMotionData::LoadMotionData - Strange Event Type");
return false;
break;
}
m_MotionEventDataVector[j] = pData;
m_MotionEventDataVector[j]->Load(rkTextFileLoader);
m_MotionEventDataVector[j]->iType = iType;
if (!rkTextFileLoader.GetTokenFloat("startingtime", &m_MotionEventDataVector[j]->fStartingTime))
return false;
m_MotionEventDataVector[j]->dwFrame = (m_MotionEventDataVector[j]->fStartingTime / c_fFrameTime);
rkTextFileLoader.SetParentNode();
}
}
}
std::string strSoundFileNameTemp=c_szFileName;
strSoundFileNameTemp = CFileNameHelper::NoExtension(strSoundFileNameTemp);
strSoundFileNameTemp+= ".mss";
if (strSoundFileNameTemp.length() > 13)
{
const char * c_szHeader = &strSoundFileNameTemp[13];
m_strSoundScriptDataFileName = "sound/";
m_strSoundScriptDataFileName += c_szHeader;
LoadSoundScriptData(m_strSoundScriptDataFileName.c_str());
}
return true;
}
#ifdef WORLD_EDITOR
bool CRaceMotionData::SaveMotionData(const char * c_szFileName)
{
FILE * File;
SetFileAttributes(c_szFileName, FILE_ATTRIBUTE_NORMAL);
File = fopen(c_szFileName, "w");
if (!File)
{
TraceError("CRaceMotionData::SaveMotionData : cannot open file for writing (filename: %s)", c_szFileName);
return false;
}
fprintf(File, "ScriptType MotionData\n");
fprintf(File, "\n");
fprintf(File, "MotionFileName \"%s\"\n", m_strMotionFileName.c_str());
fprintf(File, "MotionDuration %f\n", m_fMotionDuration);
if (m_isAccumulationMotion)
fprintf(File, "Accumulation %.2f\t%.2f\t%.2f\n", m_accumulationPosition.x, m_accumulationPosition.y, m_accumulationPosition.z);
fprintf(File, "\n");
if (m_isComboMotion)
{
fprintf(File, "Group ComboInputData\n");
fprintf(File, "{\n");
fprintf(File, " PreInputTime %f\n", m_ComboInputData.fInputStartTime);
fprintf(File, " DirectInputTime %f\n", m_ComboInputData.fNextComboTime);
fprintf(File, " InputLimitTime %f\n", m_ComboInputData.fInputEndTime);
fprintf(File, "}\n");
fprintf(File, "\n");
}
if (m_isAttackingMotion)
{
fprintf(File, "Group AttackingData\n");
fprintf(File, "{\n");
NRaceData::SaveMotionAttackData(File, 1, m_MotionAttackData);
fprintf(File, "}\n");
fprintf(File, "\n");
}
if (m_isLoopMotion)
{
fprintf(File, "Group LoopData\n");
fprintf(File, "{\n");
fprintf(File, " MotionLoopCount %d\n", m_iLoopCount);
fprintf(File, " LoopCancelEnable %d\n", m_bCancelEnableSkill);
fprintf(File, " LoopStartTime %f\n", m_fLoopStartTime);
fprintf(File, " LoopEndTime %f\n", m_fLoopEndTime);
fprintf(File, "}\n");
fprintf(File, "\n");
}
if (!m_MotionEventDataVector.empty())
{
fprintf(File, "Group MotionEventData\n");
fprintf(File, "{\n");
fprintf(File, " MotionEventDataCount %d\n", m_MotionEventDataVector.size());
for (DWORD j = 0; j < m_MotionEventDataVector.size(); ++j)
{
TMotionEventData * c_pData = m_MotionEventDataVector[j];
fprintf(File, " Group Event%02d\n", j);
fprintf(File, " {\n");
fprintf(File, " MotionEventType %d\n", c_pData->iType);
fprintf(File, " StartingTime %f\n", c_pData->fStartingTime);
c_pData->Save(File, 2);
fprintf(File, " }\n");
}
fprintf(File, "}\n");
}
fclose(File);
return true;
}
#endif
bool CRaceMotionData::LoadSoundScriptData(const char * c_szFileName)
{
NSound::TSoundDataVector SoundDataVector;
if (!NSound::LoadSoundInformationPiece(c_szFileName, SoundDataVector))
{
return false;
}
NSound::DataToInstance(SoundDataVector, &m_SoundInstanceVector);
return true;
}
const char * CRaceMotionData::GetMotionFileName() const
{
return m_strMotionFileName.c_str();
}
const char * CRaceMotionData::GetSoundScriptFileName() const
{
return m_strSoundScriptDataFileName.c_str();
}
void CRaceMotionData::Initialize()
{
m_iLoopCount = 0;
m_fMotionDuration = 0.0f;
m_accumulationPosition.x = 0.0f;
m_accumulationPosition.y = 0.0f;
m_accumulationPosition.z = 0.0f;
m_fLoopStartTime = 0.0f;
m_fLoopEndTime = 0.0f;
m_isAccumulationMotion = FALSE;
m_isComboMotion = FALSE;
m_isLoopMotion = FALSE;
m_isAttackingMotion = FALSE;
m_bCancelEnableSkill = FALSE;
m_hasSplashEvent = FALSE;
m_isLock = FALSE;
m_eType=TYPE_NONE;
m_eName=NAME_NONE;
m_MotionEventDataVector.clear();
m_SoundInstanceVector.clear();
}
void CRaceMotionData::Destroy()
{
stl_wipe(m_MotionEventDataVector);
Initialize();
}
CRaceMotionData::CRaceMotionData()
{
Initialize();
}
CRaceMotionData::~CRaceMotionData()
{
Destroy();
}
| 24.283172 | 139 | 0.738589 | beetle2k |
e0ecddff9542367d0ac444c99ed054e6e5a29875 | 1,199 | hpp | C++ | include/asioext/detail/chrono.hpp | zweistein-frm2/asio-extensions | bafea77c48d674930405cb7f93bdfe65539abc39 | [
"BSL-1.0"
] | 17 | 2018-04-13T00:38:55.000Z | 2022-01-21T08:38:36.000Z | include/asioext/detail/chrono.hpp | zweistein-frm2/asio-extensions | bafea77c48d674930405cb7f93bdfe65539abc39 | [
"BSL-1.0"
] | 4 | 2017-03-16T03:34:38.000Z | 2020-05-08T00:05:51.000Z | include/asioext/detail/chrono.hpp | zweistein-frm2/asio-extensions | bafea77c48d674930405cb7f93bdfe65539abc39 | [
"BSL-1.0"
] | 5 | 2017-09-06T15:56:04.000Z | 2021-09-14T07:38:02.000Z | /// @copyright Copyright (c) 2017 Tim Niederhausen (tim@rnc-ag.de)
/// Distributed under the Boost Software License, Version 1.0.
/// (See accompanying file LICENSE_1_0.txt or copy at
/// http://www.boost.org/LICENSE_1_0.txt)
#ifndef ASIOEXT_DETAIL_CHRONO_HPP
#define ASIOEXT_DETAIL_CHRONO_HPP
#include "asioext/detail/config.hpp"
#if ASIOEXT_HAS_PRAGMA_ONCE
# pragma once
#endif
#include "asioext/chrono.hpp"
#include "asioext/detail/cstdint.hpp"
#include <ctime>
ASIOEXT_NS_BEGIN
namespace detail {
template <class RepIn, class PeriodIn, class RepOut, class PeriodOut>
ASIOEXT_CONSTEXPR14 bool safe_duration_cast(
const chrono::duration<RepIn, PeriodIn>& in,
chrono::duration<RepOut, PeriodOut>& out) ASIOEXT_NOEXCEPT;
template <class Duration, class FirstDuration, class SecondDuration>
bool decompose_time(const Duration& in, FirstDuration& first,
SecondDuration& second) ASIOEXT_NOEXCEPT;
template <class Duration, class FirstDuration, class SecondDuration>
bool compose_time(const FirstDuration& first, const SecondDuration& second,
Duration& out) ASIOEXT_NOEXCEPT;
}
ASIOEXT_NS_END
#include "asioext/detail/impl/chrono.hpp"
#endif
| 26.644444 | 75 | 0.765638 | zweistein-frm2 |
e0ee282577ff44a28cbc0d6dc40e72db7788f70e | 2,862 | cpp | C++ | ClasificadoresSensor/GeneradorDatosEntrenamiento/main.cpp | mrcportillo/Guda | 12be3c7d80d25fb041ac2a61ecf8b3f9be43eb23 | [
"MIT"
] | null | null | null | ClasificadoresSensor/GeneradorDatosEntrenamiento/main.cpp | mrcportillo/Guda | 12be3c7d80d25fb041ac2a61ecf8b3f9be43eb23 | [
"MIT"
] | null | null | null | ClasificadoresSensor/GeneradorDatosEntrenamiento/main.cpp | mrcportillo/Guda | 12be3c7d80d25fb041ac2a61ecf8b3f9be43eb23 | [
"MIT"
] | null | null | null | // prueba6.cpp : Defines the entry point for the console application.
//
// practica6.c - creacion y visualizacion de una imagen usando OpenCV
//
// Robotica y Vision por Computador
#include "cv.h" // incluye las definiciones de OpenCV
#include "cvaux.h" // Stuff.
#include "highgui.h" // incluye highGUI. Necesario para crear ventanas de visualizacion
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <iostream>
#include <fstream>
using namespace std;
int dato1 = 5;
#define PI 3.14159265
char c ;
int dato;
int x,y;
float xx1,yy1;
float dx=(230-161);
float dy=(302-161);
float ro=0.0;
float alfa=atan2(dx,dy)*180/PI;
float delta=0;
bool detecta1=false;
bool detecta2=false;
CvCapture* capture = NULL;
IplImage *cuadro;
IplImage *imagen;
int main(void) {
CvScalar s;
CvScalar color = CV_RGB(0,120,0);
char texto[100];
int vector[180];
float temp=0.0;
int conta=0;
CvFont font;
cvInitFont(&font, CV_FONT_HERSHEY_SIMPLEX, 0.5, 0.5, 0, 1, CV_AA);
cvNamedWindow( "Transito", CV_WINDOW_AUTOSIZE );
capture = cvCaptureFromAVI( "/home/mrc/ProyectosQt/Guda/ClasificadoresSensor/GeneradorDatosEntrenamiento/ca1.avi" );
dato= (int) cvGetCaptureProperty(capture,CV_CAP_PROP_FRAME_COUNT);
ofstream fs("/home/mrc/ProyectosQt/Guda/ClasificadoresSensor/GeneradorDatosEntrenamiento/samples.txt");
while(1) {
imagen = cvQueryFrame(capture);
cuadro = cvCreateImage( cvGetSize(imagen), IPL_DEPTH_8U, 3 );
cvSmooth( imagen, cuadro, CV_GAUSSIAN, 5, 5 );
sprintf( texto, "%d %d", x,y);
cvPutText( cuadro, texto, cvPoint(x,y),&font,cvScalar(0,255,0));
cvCircle(cuadro,cvPoint(x,y),20,cvScalar(255,255,255),1,8);
for(delta=0.0;delta<180;delta++) {
vector[(int)delta]=0.0;
}
temp=100;
for(delta=-100;delta<80;delta=delta+15) {
for(ro=40;ro<120;ro=ro+7) {
xx1=230+cos(delta*PI/180)*ro/sin(alfa*PI/180);
yy1=302+sin(delta*PI/180)*ro/cos(alfa*PI/180);
cvCircle(cuadro,cvPoint((int)xx1,(int)yy1),4,cvScalar(255,255,255),1,8);
cvFloodFill( cuadro, cvPoint((int)xx1,(int)yy1), color, cvScalarAll(5.0), cvScalarAll(5.0), NULL, 4, NULL );
s=cvGet2D(cuadro,(int)yy1-1,(int)xx1-1);
if((int)s.val[1]!=120) break;
}
vector[(int)(temp+delta)]=(int)ro;
}
cvShowImage( "Transito", cuadro);
if( !cuadro ) break;
c= cvWaitKey(0);
if(c == 27) {
fs.close();
break;
} else if(c != ' '){
for(conta=0;conta<180;conta=conta+15) {
fs << vector[conta] <<" ";
}
fs << c <<endl;
}
}
cvReleaseCapture( &capture );
cvDestroyWindow( "Ejemplo0" );
return 0;
}
| 29.8125 | 124 | 0.605521 | mrcportillo |
e0f173909783178ef17e264ac572d9f5f83cc624 | 25,081 | cpp | C++ | examples/0400-stl-template-classes/cib/__zz_cib_bidirectional_iterator.h.cpp | satya-das/cib | 369333ea58b0530b8789a340e21096ba7d159d0e | [
"MIT"
] | 30 | 2018-03-05T17:35:29.000Z | 2022-03-17T18:59:34.000Z | examples/0400-stl-template-classes/cib/__zz_cib_bidirectional_iterator.h.cpp | satya-das/cib | 369333ea58b0530b8789a340e21096ba7d159d0e | [
"MIT"
] | 2 | 2016-05-26T04:47:13.000Z | 2019-02-15T05:17:43.000Z | examples/0400-stl-template-classes/cib/__zz_cib_bidirectional_iterator.h.cpp | satya-das/cib | 369333ea58b0530b8789a340e21096ba7d159d0e | [
"MIT"
] | 5 | 2019-02-15T05:09:22.000Z | 2021-04-14T12:10:16.000Z | #include "C.h"
#include "__zz_cib_stl-helpers/__zz_cib_bidirectional_iterator.h"
#include "__zz_cib_Example-class-down-cast.h"
#include "__zz_cib_Example-delegate-helper.h"
#include "__zz_cib_Example-generic.h"
#include "__zz_cib_Example-ids.h"
#include "__zz_cib_Example-type-converters.h"
#include "__zz_cib_Example-mtable-helper.h"
#include "__zz_cib_Example-proxy-mgr.h"
namespace __zz_cib_ {
using namespace ::__zz_cib_stl_helpers;
template <>
struct __zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C const >> : public ::__zz_cib_stl_helpers::bidirectional_iterator<::C const > {
using __zz_cib_Delegatee = __zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C const >>;
using __zz_cib_AbiType = __zz_cib_Delegatee*;
using ::__zz_cib_stl_helpers::bidirectional_iterator<::C const >::bidirectional_iterator;
static __zz_cib_AbiType __zz_cib_decl __zz_cib_Copy_0(const __zz_cib_Delegatee* __zz_cib_obj) {
return new __zz_cib_Delegatee(*__zz_cib_obj);
}
static void __zz_cib_decl __zz_cib_Delete_1(__zz_cib_Delegatee* __zz_cib_obj) {
delete __zz_cib_obj;
}
static __zz_cib_AbiType __zz_cib_decl __zz_cib_New_2() {
return new __zz_cib_Delegatee();
}
static __zz_cib_AbiType_t<::__zz_cib_stl_helpers::bidirectional_iterator<::C const >::reference> __zz_cib_decl __zz_cib_OperatorMul_3(const __zz_cib_Delegatee* __zz_cib_obj) {
return __zz_cib_ToAbiType<::__zz_cib_stl_helpers::bidirectional_iterator<::C const >::reference>(
__zz_cib_obj->::__zz_cib_stl_helpers::bidirectional_iterator<::C const >::operator*()
);
}
static __zz_cib_AbiType_t<::__zz_cib_stl_helpers::bidirectional_iterator<::C const >::pointer> __zz_cib_decl __zz_cib_OperatorArrow_4(const __zz_cib_Delegatee* __zz_cib_obj) {
return __zz_cib_ToAbiType<::__zz_cib_stl_helpers::bidirectional_iterator<::C const >::pointer>(
__zz_cib_obj->::__zz_cib_stl_helpers::bidirectional_iterator<::C const >::operator->()
);
}
static __zz_cib_AbiType_t<::__zz_cib_stl_helpers::bidirectional_iterator<::C const >&> __zz_cib_decl __zz_cib_OperatorInc_5(__zz_cib_Delegatee* __zz_cib_obj) {
return __zz_cib_ToAbiType<::__zz_cib_stl_helpers::bidirectional_iterator<::C const >&>(
__zz_cib_obj->::__zz_cib_stl_helpers::bidirectional_iterator<::C const >::operator++()
);
}
static __zz_cib_AbiType_t<::__zz_cib_stl_helpers::bidirectional_iterator<::C const >> __zz_cib_decl __zz_cib_OperatorInc_6(__zz_cib_Delegatee* __zz_cib_obj, __zz_cib_AbiType_t<int> __zz_cib_param0) {
return __zz_cib_ToAbiType<::__zz_cib_stl_helpers::bidirectional_iterator<::C const >>(
__zz_cib_obj->::__zz_cib_stl_helpers::bidirectional_iterator<::C const >::operator++(
__zz_cib_::__zz_cib_FromAbiType<int>(__zz_cib_param0)
)
);
}
static __zz_cib_AbiType_t<::__zz_cib_stl_helpers::bidirectional_iterator<::C const >&> __zz_cib_decl __zz_cib_OperatorDec_7(__zz_cib_Delegatee* __zz_cib_obj) {
return __zz_cib_ToAbiType<::__zz_cib_stl_helpers::bidirectional_iterator<::C const >&>(
__zz_cib_obj->::__zz_cib_stl_helpers::bidirectional_iterator<::C const >::operator--()
);
}
static __zz_cib_AbiType_t<::__zz_cib_stl_helpers::bidirectional_iterator<::C const >> __zz_cib_decl __zz_cib_OperatorDec_8(__zz_cib_Delegatee* __zz_cib_obj, __zz_cib_AbiType_t<int> __zz_cib_param0) {
return __zz_cib_ToAbiType<::__zz_cib_stl_helpers::bidirectional_iterator<::C const >>(
__zz_cib_obj->::__zz_cib_stl_helpers::bidirectional_iterator<::C const >::operator--(
__zz_cib_::__zz_cib_FromAbiType<int>(__zz_cib_param0)
)
);
}
static __zz_cib_AbiType_t<bool> __zz_cib_decl __zz_cib_OperatorCmpEq_9(__zz_cib_Delegatee* __zz_cib_obj, __zz_cib_AbiType_t<const ::__zz_cib_stl_helpers::bidirectional_iterator<::C const >&> rhs) {
return __zz_cib_ToAbiType<bool>(
__zz_cib_obj->::__zz_cib_stl_helpers::bidirectional_iterator<::C const >::operator==(
__zz_cib_::__zz_cib_FromAbiType<const ::__zz_cib_stl_helpers::bidirectional_iterator<::C const >&>(rhs)
)
);
}
static __zz_cib_AbiType_t<bool> __zz_cib_decl __zz_cib_OperatorNotEq_10(__zz_cib_Delegatee* __zz_cib_obj, __zz_cib_AbiType_t<const ::__zz_cib_stl_helpers::bidirectional_iterator<::C const >&> rhs) {
return __zz_cib_ToAbiType<bool>(
__zz_cib_obj->::__zz_cib_stl_helpers::bidirectional_iterator<::C const >::operator!=(
__zz_cib_::__zz_cib_FromAbiType<const ::__zz_cib_stl_helpers::bidirectional_iterator<::C const >&>(rhs)
)
);
}
};
}
namespace __zz_cib_ {
namespace __zz_cib_Class256 {
using namespace ::__zz_cib_stl_helpers;
namespace __zz_cib_Class269 {
const __zz_cib_MethodTable* __zz_cib_GetMethodTable() {
static const __zz_cib_MTableEntry methodArray[] = {
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C const >>::__zz_cib_Copy_0),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C const >>::__zz_cib_Delete_1),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C const >>::__zz_cib_New_2),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C const >>::__zz_cib_OperatorMul_3),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C const >>::__zz_cib_OperatorArrow_4),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C const >>::__zz_cib_OperatorInc_5),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C const >>::__zz_cib_OperatorInc_6),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C const >>::__zz_cib_OperatorDec_7),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C const >>::__zz_cib_OperatorDec_8),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C const >>::__zz_cib_OperatorCmpEq_9),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C const >>::__zz_cib_OperatorNotEq_10)
};
static const __zz_cib_MethodTable methodTable = { methodArray, 11 };
return &methodTable;
}
}}}
namespace __zz_cib_ {
using namespace ::__zz_cib_stl_helpers;
template <>
struct __zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >> : public ::__zz_cib_stl_helpers::bidirectional_iterator<::C* const > {
using __zz_cib_Delegatee = __zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >>;
using __zz_cib_AbiType = __zz_cib_Delegatee*;
using ::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >::bidirectional_iterator;
static __zz_cib_AbiType __zz_cib_decl __zz_cib_Copy_0(const __zz_cib_Delegatee* __zz_cib_obj) {
return new __zz_cib_Delegatee(*__zz_cib_obj);
}
static void __zz_cib_decl __zz_cib_Delete_1(__zz_cib_Delegatee* __zz_cib_obj) {
delete __zz_cib_obj;
}
static __zz_cib_AbiType __zz_cib_decl __zz_cib_New_2() {
return new __zz_cib_Delegatee();
}
static __zz_cib_AbiType_t<::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >::reference> __zz_cib_decl __zz_cib_OperatorMul_3(const __zz_cib_Delegatee* __zz_cib_obj) {
return __zz_cib_ToAbiType<::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >::reference>(
__zz_cib_obj->::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >::operator*()
);
}
static __zz_cib_AbiType_t<::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >::pointer> __zz_cib_decl __zz_cib_OperatorArrow_4(const __zz_cib_Delegatee* __zz_cib_obj) {
return __zz_cib_ToAbiType<::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >::pointer>(
__zz_cib_obj->::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >::operator->()
);
}
static __zz_cib_AbiType_t<::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >&> __zz_cib_decl __zz_cib_OperatorInc_5(__zz_cib_Delegatee* __zz_cib_obj) {
return __zz_cib_ToAbiType<::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >&>(
__zz_cib_obj->::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >::operator++()
);
}
static __zz_cib_AbiType_t<::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >> __zz_cib_decl __zz_cib_OperatorInc_6(__zz_cib_Delegatee* __zz_cib_obj, __zz_cib_AbiType_t<int> __zz_cib_param0) {
return __zz_cib_ToAbiType<::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >>(
__zz_cib_obj->::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >::operator++(
__zz_cib_::__zz_cib_FromAbiType<int>(__zz_cib_param0)
)
);
}
static __zz_cib_AbiType_t<::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >&> __zz_cib_decl __zz_cib_OperatorDec_7(__zz_cib_Delegatee* __zz_cib_obj) {
return __zz_cib_ToAbiType<::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >&>(
__zz_cib_obj->::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >::operator--()
);
}
static __zz_cib_AbiType_t<::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >> __zz_cib_decl __zz_cib_OperatorDec_8(__zz_cib_Delegatee* __zz_cib_obj, __zz_cib_AbiType_t<int> __zz_cib_param0) {
return __zz_cib_ToAbiType<::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >>(
__zz_cib_obj->::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >::operator--(
__zz_cib_::__zz_cib_FromAbiType<int>(__zz_cib_param0)
)
);
}
static __zz_cib_AbiType_t<bool> __zz_cib_decl __zz_cib_OperatorCmpEq_9(__zz_cib_Delegatee* __zz_cib_obj, __zz_cib_AbiType_t<const ::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >&> rhs) {
return __zz_cib_ToAbiType<bool>(
__zz_cib_obj->::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >::operator==(
__zz_cib_::__zz_cib_FromAbiType<const ::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >&>(rhs)
)
);
}
static __zz_cib_AbiType_t<bool> __zz_cib_decl __zz_cib_OperatorNotEq_10(__zz_cib_Delegatee* __zz_cib_obj, __zz_cib_AbiType_t<const ::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >&> rhs) {
return __zz_cib_ToAbiType<bool>(
__zz_cib_obj->::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >::operator!=(
__zz_cib_::__zz_cib_FromAbiType<const ::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >&>(rhs)
)
);
}
};
}
namespace __zz_cib_ {
namespace __zz_cib_Class256 {
using namespace ::__zz_cib_stl_helpers;
namespace __zz_cib_Class274 {
const __zz_cib_MethodTable* __zz_cib_GetMethodTable() {
static const __zz_cib_MTableEntry methodArray[] = {
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >>::__zz_cib_Copy_0),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >>::__zz_cib_Delete_1),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >>::__zz_cib_New_2),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >>::__zz_cib_OperatorMul_3),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >>::__zz_cib_OperatorArrow_4),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >>::__zz_cib_OperatorInc_5),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >>::__zz_cib_OperatorInc_6),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >>::__zz_cib_OperatorDec_7),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >>::__zz_cib_OperatorDec_8),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >>::__zz_cib_OperatorCmpEq_9),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C* const >>::__zz_cib_OperatorNotEq_10)
};
static const __zz_cib_MethodTable methodTable = { methodArray, 11 };
return &methodTable;
}
}}}
namespace __zz_cib_ {
using namespace ::__zz_cib_stl_helpers;
template <>
struct __zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C*>> : public ::__zz_cib_stl_helpers::bidirectional_iterator<::C*> {
using __zz_cib_Delegatee = __zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C*>>;
using __zz_cib_AbiType = __zz_cib_Delegatee*;
using ::__zz_cib_stl_helpers::bidirectional_iterator<::C*>::bidirectional_iterator;
static __zz_cib_AbiType __zz_cib_decl __zz_cib_Copy_0(const __zz_cib_Delegatee* __zz_cib_obj) {
return new __zz_cib_Delegatee(*__zz_cib_obj);
}
static void __zz_cib_decl __zz_cib_Delete_1(__zz_cib_Delegatee* __zz_cib_obj) {
delete __zz_cib_obj;
}
static __zz_cib_AbiType __zz_cib_decl __zz_cib_New_2() {
return new __zz_cib_Delegatee();
}
static __zz_cib_AbiType_t<::__zz_cib_stl_helpers::bidirectional_iterator<::C*>::reference> __zz_cib_decl __zz_cib_OperatorMul_3(const __zz_cib_Delegatee* __zz_cib_obj) {
return __zz_cib_ToAbiType<::__zz_cib_stl_helpers::bidirectional_iterator<::C*>::reference>(
__zz_cib_obj->::__zz_cib_stl_helpers::bidirectional_iterator<::C*>::operator*()
);
}
static __zz_cib_AbiType_t<::__zz_cib_stl_helpers::bidirectional_iterator<::C*>::pointer> __zz_cib_decl __zz_cib_OperatorArrow_4(const __zz_cib_Delegatee* __zz_cib_obj) {
return __zz_cib_ToAbiType<::__zz_cib_stl_helpers::bidirectional_iterator<::C*>::pointer>(
__zz_cib_obj->::__zz_cib_stl_helpers::bidirectional_iterator<::C*>::operator->()
);
}
static __zz_cib_AbiType_t<::__zz_cib_stl_helpers::bidirectional_iterator<::C*>&> __zz_cib_decl __zz_cib_OperatorInc_5(__zz_cib_Delegatee* __zz_cib_obj) {
return __zz_cib_ToAbiType<::__zz_cib_stl_helpers::bidirectional_iterator<::C*>&>(
__zz_cib_obj->::__zz_cib_stl_helpers::bidirectional_iterator<::C*>::operator++()
);
}
static __zz_cib_AbiType_t<::__zz_cib_stl_helpers::bidirectional_iterator<::C*>> __zz_cib_decl __zz_cib_OperatorInc_6(__zz_cib_Delegatee* __zz_cib_obj, __zz_cib_AbiType_t<int> __zz_cib_param0) {
return __zz_cib_ToAbiType<::__zz_cib_stl_helpers::bidirectional_iterator<::C*>>(
__zz_cib_obj->::__zz_cib_stl_helpers::bidirectional_iterator<::C*>::operator++(
__zz_cib_::__zz_cib_FromAbiType<int>(__zz_cib_param0)
)
);
}
static __zz_cib_AbiType_t<::__zz_cib_stl_helpers::bidirectional_iterator<::C*>&> __zz_cib_decl __zz_cib_OperatorDec_7(__zz_cib_Delegatee* __zz_cib_obj) {
return __zz_cib_ToAbiType<::__zz_cib_stl_helpers::bidirectional_iterator<::C*>&>(
__zz_cib_obj->::__zz_cib_stl_helpers::bidirectional_iterator<::C*>::operator--()
);
}
static __zz_cib_AbiType_t<::__zz_cib_stl_helpers::bidirectional_iterator<::C*>> __zz_cib_decl __zz_cib_OperatorDec_8(__zz_cib_Delegatee* __zz_cib_obj, __zz_cib_AbiType_t<int> __zz_cib_param0) {
return __zz_cib_ToAbiType<::__zz_cib_stl_helpers::bidirectional_iterator<::C*>>(
__zz_cib_obj->::__zz_cib_stl_helpers::bidirectional_iterator<::C*>::operator--(
__zz_cib_::__zz_cib_FromAbiType<int>(__zz_cib_param0)
)
);
}
static __zz_cib_AbiType_t<bool> __zz_cib_decl __zz_cib_OperatorCmpEq_9(__zz_cib_Delegatee* __zz_cib_obj, __zz_cib_AbiType_t<const ::__zz_cib_stl_helpers::bidirectional_iterator<::C*>&> rhs) {
return __zz_cib_ToAbiType<bool>(
__zz_cib_obj->::__zz_cib_stl_helpers::bidirectional_iterator<::C*>::operator==(
__zz_cib_::__zz_cib_FromAbiType<const ::__zz_cib_stl_helpers::bidirectional_iterator<::C*>&>(rhs)
)
);
}
static __zz_cib_AbiType_t<bool> __zz_cib_decl __zz_cib_OperatorNotEq_10(__zz_cib_Delegatee* __zz_cib_obj, __zz_cib_AbiType_t<const ::__zz_cib_stl_helpers::bidirectional_iterator<::C*>&> rhs) {
return __zz_cib_ToAbiType<bool>(
__zz_cib_obj->::__zz_cib_stl_helpers::bidirectional_iterator<::C*>::operator!=(
__zz_cib_::__zz_cib_FromAbiType<const ::__zz_cib_stl_helpers::bidirectional_iterator<::C*>&>(rhs)
)
);
}
};
}
namespace __zz_cib_ {
namespace __zz_cib_Class256 {
using namespace ::__zz_cib_stl_helpers;
namespace __zz_cib_Class273 {
const __zz_cib_MethodTable* __zz_cib_GetMethodTable() {
static const __zz_cib_MTableEntry methodArray[] = {
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C*>>::__zz_cib_Copy_0),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C*>>::__zz_cib_Delete_1),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C*>>::__zz_cib_New_2),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C*>>::__zz_cib_OperatorMul_3),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C*>>::__zz_cib_OperatorArrow_4),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C*>>::__zz_cib_OperatorInc_5),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C*>>::__zz_cib_OperatorInc_6),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C*>>::__zz_cib_OperatorDec_7),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C*>>::__zz_cib_OperatorDec_8),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C*>>::__zz_cib_OperatorCmpEq_9),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C*>>::__zz_cib_OperatorNotEq_10)
};
static const __zz_cib_MethodTable methodTable = { methodArray, 11 };
return &methodTable;
}
}}}
namespace __zz_cib_ {
using namespace ::__zz_cib_stl_helpers;
template <>
struct __zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C>> : public ::__zz_cib_stl_helpers::bidirectional_iterator<::C> {
using __zz_cib_Delegatee = __zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C>>;
using __zz_cib_AbiType = __zz_cib_Delegatee*;
using ::__zz_cib_stl_helpers::bidirectional_iterator<::C>::bidirectional_iterator;
static __zz_cib_AbiType __zz_cib_decl __zz_cib_Copy_0(const __zz_cib_Delegatee* __zz_cib_obj) {
return new __zz_cib_Delegatee(*__zz_cib_obj);
}
static void __zz_cib_decl __zz_cib_Delete_1(__zz_cib_Delegatee* __zz_cib_obj) {
delete __zz_cib_obj;
}
static __zz_cib_AbiType __zz_cib_decl __zz_cib_New_2() {
return new __zz_cib_Delegatee();
}
static __zz_cib_AbiType_t<::__zz_cib_stl_helpers::bidirectional_iterator<::C>::reference> __zz_cib_decl __zz_cib_OperatorMul_3(const __zz_cib_Delegatee* __zz_cib_obj) {
return __zz_cib_ToAbiType<::__zz_cib_stl_helpers::bidirectional_iterator<::C>::reference>(
__zz_cib_obj->::__zz_cib_stl_helpers::bidirectional_iterator<::C>::operator*()
);
}
static __zz_cib_AbiType_t<::__zz_cib_stl_helpers::bidirectional_iterator<::C>::pointer> __zz_cib_decl __zz_cib_OperatorArrow_4(const __zz_cib_Delegatee* __zz_cib_obj) {
return __zz_cib_ToAbiType<::__zz_cib_stl_helpers::bidirectional_iterator<::C>::pointer>(
__zz_cib_obj->::__zz_cib_stl_helpers::bidirectional_iterator<::C>::operator->()
);
}
static __zz_cib_AbiType_t<::__zz_cib_stl_helpers::bidirectional_iterator<::C>&> __zz_cib_decl __zz_cib_OperatorInc_5(__zz_cib_Delegatee* __zz_cib_obj) {
return __zz_cib_ToAbiType<::__zz_cib_stl_helpers::bidirectional_iterator<::C>&>(
__zz_cib_obj->::__zz_cib_stl_helpers::bidirectional_iterator<::C>::operator++()
);
}
static __zz_cib_AbiType_t<::__zz_cib_stl_helpers::bidirectional_iterator<::C>> __zz_cib_decl __zz_cib_OperatorInc_6(__zz_cib_Delegatee* __zz_cib_obj, __zz_cib_AbiType_t<int> __zz_cib_param0) {
return __zz_cib_ToAbiType<::__zz_cib_stl_helpers::bidirectional_iterator<::C>>(
__zz_cib_obj->::__zz_cib_stl_helpers::bidirectional_iterator<::C>::operator++(
__zz_cib_::__zz_cib_FromAbiType<int>(__zz_cib_param0)
)
);
}
static __zz_cib_AbiType_t<::__zz_cib_stl_helpers::bidirectional_iterator<::C>&> __zz_cib_decl __zz_cib_OperatorDec_7(__zz_cib_Delegatee* __zz_cib_obj) {
return __zz_cib_ToAbiType<::__zz_cib_stl_helpers::bidirectional_iterator<::C>&>(
__zz_cib_obj->::__zz_cib_stl_helpers::bidirectional_iterator<::C>::operator--()
);
}
static __zz_cib_AbiType_t<::__zz_cib_stl_helpers::bidirectional_iterator<::C>> __zz_cib_decl __zz_cib_OperatorDec_8(__zz_cib_Delegatee* __zz_cib_obj, __zz_cib_AbiType_t<int> __zz_cib_param0) {
return __zz_cib_ToAbiType<::__zz_cib_stl_helpers::bidirectional_iterator<::C>>(
__zz_cib_obj->::__zz_cib_stl_helpers::bidirectional_iterator<::C>::operator--(
__zz_cib_::__zz_cib_FromAbiType<int>(__zz_cib_param0)
)
);
}
static __zz_cib_AbiType_t<bool> __zz_cib_decl __zz_cib_OperatorCmpEq_9(__zz_cib_Delegatee* __zz_cib_obj, __zz_cib_AbiType_t<const ::__zz_cib_stl_helpers::bidirectional_iterator<::C>&> rhs) {
return __zz_cib_ToAbiType<bool>(
__zz_cib_obj->::__zz_cib_stl_helpers::bidirectional_iterator<::C>::operator==(
__zz_cib_::__zz_cib_FromAbiType<const ::__zz_cib_stl_helpers::bidirectional_iterator<::C>&>(rhs)
)
);
}
static __zz_cib_AbiType_t<bool> __zz_cib_decl __zz_cib_OperatorNotEq_10(__zz_cib_Delegatee* __zz_cib_obj, __zz_cib_AbiType_t<const ::__zz_cib_stl_helpers::bidirectional_iterator<::C>&> rhs) {
return __zz_cib_ToAbiType<bool>(
__zz_cib_obj->::__zz_cib_stl_helpers::bidirectional_iterator<::C>::operator!=(
__zz_cib_::__zz_cib_FromAbiType<const ::__zz_cib_stl_helpers::bidirectional_iterator<::C>&>(rhs)
)
);
}
};
}
namespace __zz_cib_ {
namespace __zz_cib_Class256 {
using namespace ::__zz_cib_stl_helpers;
namespace __zz_cib_Class268 {
const __zz_cib_MethodTable* __zz_cib_GetMethodTable() {
static const __zz_cib_MTableEntry methodArray[] = {
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C>>::__zz_cib_Copy_0),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C>>::__zz_cib_Delete_1),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C>>::__zz_cib_New_2),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C>>::__zz_cib_OperatorMul_3),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C>>::__zz_cib_OperatorArrow_4),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C>>::__zz_cib_OperatorInc_5),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C>>::__zz_cib_OperatorInc_6),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C>>::__zz_cib_OperatorDec_7),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C>>::__zz_cib_OperatorDec_8),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C>>::__zz_cib_OperatorCmpEq_9),
reinterpret_cast<__zz_cib_MTableEntry> (&__zz_cib_::__zz_cib_Delegator<::__zz_cib_stl_helpers::bidirectional_iterator<::C>>::__zz_cib_OperatorNotEq_10)
};
static const __zz_cib_MethodTable methodTable = { methodArray, 11 };
return &methodTable;
}
}}}
| 66.704787 | 202 | 0.79008 | satya-das |
e0f287d44faf17bf633f0ac7720ca847dedf37d8 | 562 | cpp | C++ | src/DataStreams/MaterializingBlockInputStream.cpp | lizhichao/ClickHouse | 3f5dc37095ccca18de490fab162d6e3cb99756aa | [
"Apache-2.0"
] | 18 | 2021-05-29T01:12:33.000Z | 2021-11-18T12:34:48.000Z | src/DataStreams/MaterializingBlockInputStream.cpp | lizhichao/ClickHouse | 3f5dc37095ccca18de490fab162d6e3cb99756aa | [
"Apache-2.0"
] | 16 | 2021-06-07T21:32:30.000Z | 2022-03-31T21:08:29.000Z | src/DataStreams/MaterializingBlockInputStream.cpp | lizhichao/ClickHouse | 3f5dc37095ccca18de490fab162d6e3cb99756aa | [
"Apache-2.0"
] | 22 | 2019-06-14T10:31:51.000Z | 2020-10-12T14:57:44.000Z | #include <DataStreams/MaterializingBlockInputStream.h>
#include <DataStreams/materializeBlock.h>
namespace DB
{
MaterializingBlockInputStream::MaterializingBlockInputStream(const BlockInputStreamPtr & input)
{
children.push_back(input);
}
String MaterializingBlockInputStream::getName() const
{
return "Materializing";
}
Block MaterializingBlockInputStream::getHeader() const
{
return materializeBlock(children.back()->getHeader());
}
Block MaterializingBlockInputStream::readImpl()
{
return materializeBlock(children.back()->read());
}
}
| 19.37931 | 95 | 0.782918 | lizhichao |
e0f298ee5f5c25ba3cb97af084526bc0d2ea8ada | 950 | cpp | C++ | Trees/diameter_of_BT.cpp | jatin-code21/DSA-CP- | e29e1fd7ab4860a4eb46d11f6a42a285be1216cb | [
"MIT"
] | 5 | 2021-12-28T01:48:46.000Z | 2022-02-18T05:57:10.000Z | Trees/diameter_of_BT.cpp | jatin-code21/DSA-CP- | e29e1fd7ab4860a4eb46d11f6a42a285be1216cb | [
"MIT"
] | null | null | null | Trees/diameter_of_BT.cpp | jatin-code21/DSA-CP- | e29e1fd7ab4860a4eb46d11f6a42a285be1216cb | [
"MIT"
] | null | null | null | // Diameter is the longest path betweeen any 2 nodes;
// It is not necessary that it will pass through root;
#include <bits/stdc++.h>
using namespace std;
class TreeNode
{
public:
int data;
TreeNode *left,*right;
TreeNode(int val)
{
data = val;
left = right = NULL;
}
};
int height(TreeNode *root, int &diameter)
{
if (root == NULL) return 0;
int lh = height(root->left, diameter);
int rh = height(root->right, diameter);
diameter = max(diameter, lh + rh);
return max(lh, rh) + 1;
}
int diameterOfBt(TreeNode *root)
{
int diameter = 0;
height(root, diameter);
return diameter;
}
int main()
{
TreeNode *root = new TreeNode(5);
root->left = new TreeNode(8);
root->right = new TreeNode(3);
root->left->left = new TreeNode(21);
root->left->right = new TreeNode(15);
root->right->right = new TreeNode(23);
cout << diameterOfBt(root);
}
// This is the optimized way of finding the diameter with Time Complexity -> O(N); | 18.627451 | 82 | 0.668421 | jatin-code21 |
e0f29da9409cec332f9026ae61f9640b6f1e19e2 | 234 | cpp | C++ | src/dbc.cpp | SoultatosStefanos/dbc | aa9c787cd383c8b8f110f779ad0978e4512c7811 | [
"MIT"
] | 1 | 2021-09-08T11:41:58.000Z | 2021-09-08T11:41:58.000Z | src/dbc.cpp | SoultatosStefanos/dbc | aa9c787cd383c8b8f110f779ad0978e4512c7811 | [
"MIT"
] | null | null | null | src/dbc.cpp | SoultatosStefanos/dbc | aa9c787cd383c8b8f110f779ad0978e4512c7811 | [
"MIT"
] | null | null | null | /**
* @file dbc.cpp
* @author Soultatos Stefanos (stefanoss1498@gmail.com)
* @brief Includes the dbc header for linking purposes.
* @version 3.0
* @date 2021-10-29
*
* @copyright Copyright (c) 2021
*
*/
#include "dbc/dbc.hpp" | 21.272727 | 55 | 0.67094 | SoultatosStefanos |
e0f84c6dfe4651427c40133f3f8a8da1aaaa6618 | 3,002 | hpp | C++ | stapl_release/stapl/runtime/request/header_decoder.hpp | parasol-ppl/PPL_utils | 92728bb89692fda1705a0dee436592d97922a6cb | [
"BSD-3-Clause"
] | null | null | null | stapl_release/stapl/runtime/request/header_decoder.hpp | parasol-ppl/PPL_utils | 92728bb89692fda1705a0dee436592d97922a6cb | [
"BSD-3-Clause"
] | null | null | null | stapl_release/stapl/runtime/request/header_decoder.hpp | parasol-ppl/PPL_utils | 92728bb89692fda1705a0dee436592d97922a6cb | [
"BSD-3-Clause"
] | null | null | null |
/*
// Copyright (c) 2000-2009, Texas Engineering Experiment Station (TEES), a
// component of the Texas A&M University System.
// All rights reserved.
// The information and source code contained herein is the exclusive
// property of TEES and may not be disclosed, examined or reproduced
// in whole or in part without explicit written authorization from TEES.
*/
#ifndef STAPL_RUNTIME_REQUEST_HEADER_DECODER_HPP
#define STAPL_RUNTIME_REQUEST_HEADER_DECODER_HPP
#include "header.hpp"
#include "../context_id.hpp"
#include "../exception.hpp"
#include "../message.hpp"
#include "../runtime_fwd.hpp"
namespace stapl {
namespace runtime {
//////////////////////////////////////////////////////////////////////
/// @brief Returns the epoch @p m was sent from.
///
/// @ingroup runtimeMetadata
//////////////////////////////////////////////////////////////////////
inline header::epoch_type get_message_epoch(message const& m) noexcept
{
switch (m.type()) {
case header::RMI:
return m.get_extended_header<header::request>().get_epoch();
case header::BCAST_RMI:
case header::UNORDERED_BCAST_RMI:
return m.get_extended_header<header::bcast_request>().get_epoch();
default:
STAPL_RUNTIME_ERROR("Unexpected request type.");
return header::epoch_type{};
}
}
//////////////////////////////////////////////////////////////////////
/// @brief Returns the context id, the epoch and the process id @p m was sent
/// from as a @c std::tuple.
///
/// @param lid Location id of the receiving location.
///
/// @ingroup runtimeMetadata
//////////////////////////////////////////////////////////////////////
inline std::tuple<context_id, header::epoch_type, process_id>
get_message_info(message const& m, const location_id lid) noexcept
{
switch (m.type()) {
case header::LOCATION_RPC: {
auto const& h = m.get_extended_header<header::location_rpc>();
return std::make_tuple(context_id{}, h.get_epoch(), h.get_process_id());
}
case header::BCAST_LOCATION_RPC: {
auto const& h = m.get_extended_header<header::bcast_location_rpc>();
return std::make_tuple(context_id{}, h.get_epoch(), h.get_process_id());
}
case header::RMI: {
auto const& h = m.get_extended_header<header::request>();
STAPL_RUNTIME_ASSERT(lid==h.get_context_id().current.get_location_id());
return std::make_tuple(h.get_context_id(),
h.get_epoch(),
h.get_process_id());
}
case header::BCAST_RMI:
case header::UNORDERED_BCAST_RMI: {
auto const& h = m.get_extended_header<header::bcast_request>();
return std::make_tuple(h.make_context_id(lid),
h.get_epoch(),
h.get_process_id());
}
default:
STAPL_RUNTIME_ERROR("Unexpected request type.");
return std::tuple<context_id, header::epoch_type, process_id>{};
}
}
} // namespace runtime
} // namespace stapl
#endif
| 30.632653 | 78 | 0.60926 | parasol-ppl |
e0f93b88c7d1f16101f5ecc33cdd51c78ac31949 | 9,040 | cpp | C++ | algorithms/kernel/optimization_solver/adagrad/adagrad_types.cpp | h2oai/daal | d49815df3040f3872a1fdb9dc99ee86148e4494e | [
"Apache-2.0"
] | 2 | 2020-05-16T00:57:44.000Z | 2020-05-17T15:56:38.000Z | algorithms/kernel/optimization_solver/adagrad/adagrad_types.cpp | afcarl/daal | d49815df3040f3872a1fdb9dc99ee86148e4494e | [
"Apache-2.0"
] | null | null | null | algorithms/kernel/optimization_solver/adagrad/adagrad_types.cpp | afcarl/daal | d49815df3040f3872a1fdb9dc99ee86148e4494e | [
"Apache-2.0"
] | 3 | 2017-09-29T19:51:42.000Z | 2020-12-03T09:09:48.000Z | /* file: adagrad_types.cpp */
/*******************************************************************************
* Copyright 2014-2017 Intel Corporation
*
* 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.
*******************************************************************************/
/*
//++
// Implementation of adagrad solver classes.
//--
*/
#include "algorithms/optimization_solver/adagrad/adagrad_types.h"
#include "serialization_utils.h"
#include "daal_strings.h"
namespace daal
{
namespace algorithms
{
namespace optimization_solver
{
namespace adagrad
{
namespace interface1
{
__DAAL_REGISTER_SERIALIZATION_CLASS(Result, SERIALIZATION_ADAGRAD_RESULT_ID);
/**
* Constructs the parameter base class of the Adaptive gradient descent algorithm
* \param[in] function_ Objective function represented as sum of functions
* \param[in] nIterations_ Maximal number of iterations of the algorithm
* \param[in] accuracyThreshold_ Accuracy of the algorithm. The algorithm terminates when this accuracy is achieved
* \param[in] batchIndices_ Numeric table that represents 32 bit integer indices of terms in the objective function.
* If no indices are provided, the implementation will generate random indices.
* \param[in] batchSize_ Number of batch indices to compute the stochastic gradient. If batchSize is equal to the number of terms
in objective function then no random sampling is performed, and all terms are used to calculate the gradient.
This parameter is ignored if batchIndices is provided.
* \param[in] learningRate_ Numeric table that contains value of the learning rate
* \param[in] degenerateCasesThreshold_ Value needed to avoid degenerate cases in square root computing.
* \param[in] seed_ Seed for random generation of 32 bit integer indices of terms in the objective function.
*/
Parameter::Parameter(
const sum_of_functions::BatchPtr& function_, size_t nIterations_,
double accuracyThreshold_, data_management::NumericTablePtr batchIndices_,
const size_t batchSize_, data_management::NumericTablePtr learningRate_,
double degenerateCasesThreshold_, size_t seed_) :
optimization_solver::iterative_solver::Parameter(function_, nIterations_, accuracyThreshold_, false, batchSize_),
batchIndices(batchIndices_),
learningRate(learningRate_),
degenerateCasesThreshold(degenerateCasesThreshold_),
seed(seed_)
{}
services::Status Parameter::check() const
{
services::Status s = iterative_solver::Parameter::check();
if(!s) return s;
DAAL_CHECK_STATUS(s, data_management::checkNumericTable(learningRate.get(), learningRateStr(), 0, 0, 1, 1));
if(batchSize > function->sumOfFunctionsParameter->numberOfTerms || batchSize == 0)
return services::Status(services::Error::create(services::ErrorIncorrectParameter, services::ArgumentName, batchSizeStr()));
if(batchIndices)
return data_management::checkNumericTable(batchIndices.get(), batchIndicesStr(), 0, 0, batchSize, nIterations);
return s;
}
Input::Input() {}
Input::Input(const Input& other) {}
data_management::NumericTablePtr Input::get(OptionalDataId id) const
{
algorithms::OptionalArgumentPtr pOpt = get(iterative_solver::optionalArgument);
if(pOpt.get())
return data_management::NumericTable::cast(pOpt->get(id));
return data_management::NumericTablePtr();
}
void Input::set(OptionalDataId id, const data_management::NumericTablePtr &ptr)
{
algorithms::OptionalArgumentPtr pOpt = get(iterative_solver::optionalArgument);
if(!pOpt.get())
{
pOpt = algorithms::OptionalArgumentPtr(new algorithms::OptionalArgument(optionalDataSize));
set(iterative_solver::optionalArgument, pOpt);
}
pOpt->set(id, ptr);
}
static services::Status checkGradientSquareSumData(const daal::algorithms::Input *input, const data_management::SerializationIfacePtr& pItem, bool bInput)
{
const services::ErrorDetailID det = bInput ? services::OptionalInput : services::OptionalResult;
data_management::NumericTablePtr pData = data_management::NumericTable::cast(pItem);
if(!pData.get())
{
return services::Status(services::Error::create(bInput ? services::ErrorIncorrectOptionalInput : services::ErrorIncorrectOptionalResult, det, gradientSquareSumStr()));
}
const Input* algInput = static_cast<const Input *>(input);
auto arg = algInput->get(iterative_solver::inputArgument);
if(pData->getNumberOfColumns() != arg->getNumberOfColumns())
{
return services::Status(services::Error::create(services::ErrorIncorrectNumberOfColumns, det, gradientSquareSumStr()));
}
if(pData->getNumberOfRows() != arg->getNumberOfRows())
{
return services::Status(services::Error::create(services::ErrorIncorrectNumberOfRows, det, gradientSquareSumStr()));
}
return services::Status();
}
static services::Status checkRngState(const daal::algorithms::Input *input,
const daal::algorithms::Parameter *par, const data_management::SerializationIface* pItem, bool bInput)
{
const Parameter *algParam = static_cast<const Parameter *>(par);
//if random numbers generator in the algorithm is not required
if(algParam->batchIndices.get())
return services::Status();// rgnState doesn't matter
//but if it is present then the SerializationIface should be an instance of expected type
if(pItem)
{
if(!dynamic_cast<const data_management::MemoryBlock*>(pItem))
{
const services::ErrorDetailID det = bInput ? services::OptionalInput : services::OptionalResult;
return services::Status(services::Error::create(bInput ?
services::ErrorIncorrectOptionalInput : services::ErrorIncorrectOptionalResult, det, rngStateStr()));
}
}
else if(!bInput)
{
return services::Status(services::Error::create(services::ErrorNullOptionalResult, services::OptionalResult, rngStateStr()));
}
return services::Status();
}
services::Status Input::check(const daal::algorithms::Parameter *par, int method) const
{
services::Status s = super::check(par, method);
if(!s) return s;
algorithms::OptionalArgumentPtr pOpt = get(iterative_solver::optionalArgument);
if(!pOpt.get())
return services::Status();//ok
if(pOpt->size() != optionalDataSize)
{
return services::Status(services::ErrorIncorrectOptionalInput);
}
auto pItem = pOpt->get(gradientSquareSum);
if(pItem.get())
{
s |= checkGradientSquareSumData(this, pItem, true);
if(!s) return s;
}
return checkRngState(this, par, pOpt->get(rngState).get(),true);
}
data_management::NumericTablePtr Result::get(OptionalDataId id) const
{
algorithms::OptionalArgumentPtr pOpt = get(iterative_solver::optionalResult);
if(pOpt.get())
return data_management::NumericTable::cast(pOpt->get(id));
return data_management::NumericTablePtr();
}
void Result::set(OptionalDataId id, const data_management::NumericTablePtr &ptr)
{
algorithms::OptionalArgumentPtr pOpt = get(iterative_solver::optionalResult);
if(!pOpt.get())
{
pOpt = algorithms::OptionalArgumentPtr(new algorithms::OptionalArgument(optionalDataSize));
set(iterative_solver::optionalResult, pOpt);
}
pOpt->set(id, ptr);
}
services::Status Result::check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par,
int method) const
{
services::Status s = super::check(input, par, method);
if(!s || !static_cast<const Parameter*>(par)->optionalResultRequired)
return s;
algorithms::OptionalArgumentPtr pOpt = get(iterative_solver::optionalResult);
if(!pOpt.get())
{
return services::Status(services::ErrorNullOptionalResult);
}
if(pOpt->size() != optionalDataSize)
{
return services::Status(services::ErrorIncorrectOptionalResult);
}
auto pItem = pOpt->get(gradientSquareSum);
if(!pItem.get())
{
return services::Status(services::ErrorNullOptionalResult);
}
s |= checkGradientSquareSumData(input, pItem, false);
if(!s) return s;
s |= checkRngState(input, par, pOpt->get(rngState).get(), false);
return s;
}
} // namespace interface1
} // namespace adagrad
} // namespace optimization_solver
} // namespace algorithm
} // namespace daal
| 41.278539 | 175 | 0.701659 | h2oai |
804108c1d686266a438f95572009bc04f2b7682f | 1,062 | cpp | C++ | src/problems/51-100/91/problem91.cpp | abeccaro/project-euler | c3b124bb973dc3a1cf29e8c96c3e70c8816d5fa3 | [
"MIT"
] | 1 | 2019-12-25T10:17:15.000Z | 2019-12-25T10:17:15.000Z | src/problems/51-100/91/problem91.cpp | abeccaro/project-euler | c3b124bb973dc3a1cf29e8c96c3e70c8816d5fa3 | [
"MIT"
] | null | null | null | src/problems/51-100/91/problem91.cpp | abeccaro/project-euler | c3b124bb973dc3a1cf29e8c96c3e70c8816d5fa3 | [
"MIT"
] | null | null | null | //
// Created by Alex Beccaro on 28/02/18.
//
#include "problem91.hpp"
namespace problems {
bool problem91::has_right_angle(uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2) {
// check right angle in origin
if (y2 == 0 && x1 == 0)
return true;
// cross product
int dx = x1 - x2;
int dy = y1 - y2;
if (dx * x2 + dy * y2 == 0)
return true;
if (dx * x1 + dy * y1 == 0)
return true;
return false;
}
uint32_t problem91::solve(uint32_t max_x, uint32_t max_y) {
uint32_t result = 0;
for (uint32_t x1 = 0; x1 <= max_x; x1++)
for (uint32_t y1 = 0; y1 <= max_y; y1++) {
if (x1 == 0 && y1 == 0)
continue;
for (uint32_t x2 = x1; x2 <= max_x; x2++)
for (uint32_t y2 = x2 == x1 ? y1 + 1 : 0; y2 <= max_y; y2++)
if (has_right_angle(x1, y1, x2, y2))
++result;
}
return result;
}
} | 26.55 | 89 | 0.450094 | abeccaro |
8044935b81414a4f2a0cd031ed2cfb9fa25a8729 | 2,182 | cpp | C++ | tests/atomic_test.cpp | xiyou-linuxer/demo | e1176dde72be50732e39e289d91a0c14ece964d7 | [
"MIT"
] | 7 | 2019-04-26T03:49:55.000Z | 2019-04-27T10:03:00.000Z | tests/atomic_test.cpp | xiyou-linuxer/demo | e1176dde72be50732e39e289d91a0c14ece964d7 | [
"MIT"
] | null | null | null | tests/atomic_test.cpp | xiyou-linuxer/demo | e1176dde72be50732e39e289d91a0c14ece964d7 | [
"MIT"
] | null | null | null | #include "gtest/gtest.h"
#include "atomic.hpp"
using namespace Demo;
TEST(TEST_ATOMIC_INT32, ONLY_TEST) {
AtomicInt32 refCount;
ASSERT_EQ(0, refCount.get());
ASSERT_EQ(1, refCount.incrementAndGet());
ASSERT_EQ(2, refCount.incrementAndGet());
ASSERT_EQ(3, refCount.incrementAndGet());
ASSERT_EQ(2, refCount.decrementAndGet());
ASSERT_EQ(1, refCount.decrementAndGet());
ASSERT_EQ(0, refCount.decrementAndGet());
ASSERT_EQ(0, refCount.getAndSet(10));
ASSERT_EQ(10, refCount.get());
ASSERT_EQ(10, refCount.getAndSet(0));
ASSERT_EQ(0, refCount.get());
ASSERT_EQ(0, refCount.getAndAdd(5));
ASSERT_EQ(5, refCount.get());
ASSERT_EQ(5, refCount.getAndAdd(-5));
ASSERT_EQ(0, refCount.get());
ASSERT_EQ(5, refCount.addAndGet(5));
ASSERT_EQ(0, refCount.addAndGet(-5));
refCount.add(5);
ASSERT_EQ(5, refCount.get());
refCount.add(-5);
ASSERT_EQ(0, refCount.get());
refCount.increment();
ASSERT_EQ(1, refCount.get());
refCount.decrement();
ASSERT_EQ(0, refCount.get());
}
TEST(TEST_ATOMIC_INT64, ONLY_TEST) {
AtomicInt64 refCount;
ASSERT_EQ(0, refCount.get());
ASSERT_EQ(1, refCount.incrementAndGet());
ASSERT_EQ(2, refCount.incrementAndGet());
ASSERT_EQ(3, refCount.incrementAndGet());
ASSERT_EQ(2, refCount.decrementAndGet());
ASSERT_EQ(1, refCount.decrementAndGet());
ASSERT_EQ(0, refCount.decrementAndGet());
ASSERT_EQ(0, refCount.getAndSet(10));
ASSERT_EQ(10, refCount.get());
ASSERT_EQ(10, refCount.getAndSet(0));
ASSERT_EQ(0, refCount.get());
ASSERT_EQ(0, refCount.getAndAdd(5));
ASSERT_EQ(5, refCount.get());
ASSERT_EQ(5, refCount.getAndAdd(-5));
ASSERT_EQ(0, refCount.get());
ASSERT_EQ(5, refCount.addAndGet(5));
ASSERT_EQ(0, refCount.addAndGet(-5));
refCount.add(5);
ASSERT_EQ(5, refCount.get());
refCount.add(-5);
ASSERT_EQ(0, refCount.get());
refCount.increment();
ASSERT_EQ(1, refCount.get());
refCount.decrement();
ASSERT_EQ(0, refCount.get());
}
int main(int argc, char *argv[]) {
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
| 25.97619 | 45 | 0.665445 | xiyou-linuxer |
8045db2c9775a6856e93e8d3de12b42ac7fb7e56 | 1,278 | inl | C++ | TAO/tao/AnyTypeCode/TypeCode_Base_Attributes.inl | cflowe/ACE | 5ff60b41adbe1772372d1a43bcc1f2726ff8f810 | [
"DOC"
] | 36 | 2015-01-10T07:27:33.000Z | 2022-03-07T03:32:08.000Z | TAO/tao/AnyTypeCode/TypeCode_Base_Attributes.inl | cflowe/ACE | 5ff60b41adbe1772372d1a43bcc1f2726ff8f810 | [
"DOC"
] | 2 | 2018-08-13T07:30:51.000Z | 2019-02-25T03:04:31.000Z | TAO/tao/AnyTypeCode/TypeCode_Base_Attributes.inl | cflowe/ACE | 5ff60b41adbe1772372d1a43bcc1f2726ff8f810 | [
"DOC"
] | 38 | 2015-01-08T14:12:06.000Z | 2022-01-19T08:33:00.000Z | // -*- C++ -*-
//
// $Id: TypeCode_Base_Attributes.inl 69182 2005-11-03 17:38:46Z ossama $
#include "tao/AnyTypeCode/TypeCode_Traits.h"
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
template <typename STRING_TYPE>
ACE_INLINE
TAO::TypeCode::Base_Attributes<STRING_TYPE>::Base_Attributes (
char const * id,
char const * name)
: id_ (id),
name_ (name)
{
}
template <typename STRING_TYPE>
ACE_INLINE
TAO::TypeCode::Base_Attributes<STRING_TYPE>::Base_Attributes (
char const * id)
: id_ (id),
name_ ()
{
// Only used in the dynamic (when STRING_TYPE == CORBA::String_var)
// recursive TypeCode case.
}
template <typename STRING_TYPE>
ACE_INLINE char const *
TAO::TypeCode::Base_Attributes<STRING_TYPE>::id (void) const
{
return Traits<STRING_TYPE>::get_string (this->id_);
}
template <typename STRING_TYPE>
ACE_INLINE char const *
TAO::TypeCode::Base_Attributes<STRING_TYPE>::name (void) const
{
return Traits<STRING_TYPE>::get_string (this->name_);
}
template <typename STRING_TYPE>
ACE_INLINE void
TAO::TypeCode::Base_Attributes<STRING_TYPE>::name (char const * the_name)
{
// This method will only be instantiated in the dynamic TypeCode
// case, i.e. when STRING_TYPE is CORBA::String_var.
this->name_ = the_name;
}
TAO_END_VERSIONED_NAMESPACE_DECL
| 23.236364 | 73 | 0.739437 | cflowe |
8045fefca3d7b3e52a78a4a2fd3f39d1e076d441 | 1,032 | cc | C++ | leetcode/0664-strange-printer.cc | Magic07/online-judge-solutions | 02a289dd7eb52d7eafabc97bd1a043213b65f70a | [
"MIT"
] | null | null | null | leetcode/0664-strange-printer.cc | Magic07/online-judge-solutions | 02a289dd7eb52d7eafabc97bd1a043213b65f70a | [
"MIT"
] | null | null | null | leetcode/0664-strange-printer.cc | Magic07/online-judge-solutions | 02a289dd7eb52d7eafabc97bd1a043213b65f70a | [
"MIT"
] | null | null | null | #include <string>
using namespace std;
class Solution {
public:
int calulateDp(const string& s, int dp[100][100], int start, int end) {
if (dp[start][end] != 0) {
return dp[start][end];
}
if (start == end) {
dp[start][start] = 1;
return 1;
} else {
int c[3] = {INT_MAX, INT_MAX, INT_MAX};
if (s[end] == s[start] || s[end] == s[end - 1]) {
c[0] = calulateDp(s, dp, start, end - 1);
} else if (s[start] == s[start + 1] || s[start] == s[end]) {
c[1] = calulateDp(s, dp, start + 1, end);
} else {
for (int i = start; i < end; i++) {
c[2] = min(c[2], calulateDp(s, dp, start, i) +
calulateDp(s, dp, i + 1, end));
}
}
dp[start][end] = *std::min_element(c, c + 3);
return dp[start][end];
}
}
int strangePrinter(string s) {
if (s.size() == 0) {
return 0;
}
int dp[100][100];
memset(dp, 0, sizeof(dp));
return calulateDp(s, dp, 0, s.size() - 1);
}
}; | 26.461538 | 73 | 0.471899 | Magic07 |
804c2d590906fed27e88df282f388bfead6f1d94 | 656,961 | cpp | C++ | hphp/parser/hphp.7.tab.cpp | fredemmott/hhvm | e819c0c5016607c286384d9c76e33fa4ef42d4bb | [
"PHP-3.01",
"Zend-2.0"
] | 1 | 2016-10-08T12:13:09.000Z | 2016-10-08T12:13:09.000Z | hphp/parser/hphp.7.tab.cpp | fredemmott/hhvm | e819c0c5016607c286384d9c76e33fa4ef42d4bb | [
"PHP-3.01",
"Zend-2.0"
] | null | null | null | hphp/parser/hphp.7.tab.cpp | fredemmott/hhvm | e819c0c5016607c286384d9c76e33fa4ef42d4bb | [
"PHP-3.01",
"Zend-2.0"
] | null | null | null | // @generated
/* A Bison parser, made by GNU Bison 3.0.4. */
/* Bison implementation for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
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/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* C LALR(1) parser skeleton written by Richard Stallman, by
simplifying the original so-called "semantic" parser. */
/* All symbols defined below should begin with yy or YY, to avoid
infringing on user name space. This should be done even for local
variables, as they might otherwise be expanded by user macros.
There are some unavoidable exceptions within include files to
define necessary library symbols; they are noted "INFRINGES ON
USER NAME SPACE" below. */
/* Identify Bison output. */
#define YYBISON 1
/* Bison version. */
#define YYBISON_VERSION "3.0.4"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
/* Pure parsers. */
#define YYPURE 1
/* Push parsers. */
#define YYPUSH 0
/* Pull parsers. */
#define YYPULL 1
/* Substitute the variable and function names. */
#define yyparse Compiler7parse
#define yylex Compiler7lex
#define yyerror Compiler7error
#define yydebug Compiler7debug
#define yynerrs Compiler7nerrs
/* Copy the first part of user declarations. */
#line 1 "hphp.y" /* yacc.c:339 */
/* By default this grammar is set up to be used by HPHP's compile parser.
* However, it can be used to make parsers for different purposes by
* making a Parser implementation with the same interface as
* HPHP::Compiler::Parser in a header file specified by
* PARSER_DEFINITIONS_HEADER, and specifying an alternate namespace with
* HPHP_PARSER_NS.
*/
// macros for bison
#define YYSTYPE HPHP::HPHP_PARSER_NS::Token
#define YYSTYPE_IS_TRIVIAL false
#define YYLTYPE HPHP::Location
#define YYLTYPE_IS_TRIVIAL true
#define YYERROR_VERBOSE
#define YYINITDEPTH 500
#define YYLEX_PARAM _p
#ifdef PARSER_DEFINITIONS_HEADER
#include PARSER_DEFINITIONS_HEADER
#else
#include "hphp/compiler/parser/parser.h"
#endif
#include <folly/Conv.h>
#include <folly/String.h>
#include "hphp/util/logger.h"
#define line0 r.line0
#define char0 r.char0
#define line1 r.line1
#define char1 r.char1
#ifdef yyerror
#undef yyerror
#endif
#define yyerror(loc,p,msg) p->parseFatal(loc,msg)
#ifdef YYLLOC_DEFAULT
# undef YYLLOC_DEFAULT
#endif
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
#define YYLLOC_DEFAULT(Current, Rhs, N) \
do \
if (N) { \
(Current).first(YYRHSLOC (Rhs, 1)); \
(Current).last (YYRHSLOC (Rhs, N)); \
} else { \
(Current).line0 = (Current).line1 = YYRHSLOC (Rhs, 0).line1;\
(Current).char0 = (Current).char1 = YYRHSLOC (Rhs, 0).char1;\
} \
while (0); \
_p->setRuleLocation(&Current);
#define YYCOPY(To, From, Count) \
do { \
YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) { \
(To)[yyi] = (From)[yyi]; \
} \
if (From != From ## a) { \
YYSTACK_FREE (From); \
} \
} \
while (0)
#define YYCOPY_RESET(To, From, Count) \
do \
{ \
YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) { \
(To)[yyi] = (From)[yyi]; \
(From)[yyi].reset(); \
} \
if (From != From ## a) { \
YYSTACK_FREE (From); \
} \
} \
while (0)
#define YYTOKEN_RESET(From, Count) \
do \
{ \
YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) { \
(From)[yyi].reset(); \
} \
if (From != From ## a) { \
YYSTACK_FREE (From); \
} \
} \
while (0)
# define YYSTACK_RELOCATE_RESET(Stack_alloc, Stack) \
do \
{ \
YYSIZE_T yynewbytes; \
YYCOPY_RESET (&yyptr->Stack_alloc, Stack, yysize); \
Stack = &yyptr->Stack_alloc; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
while (0)
#define YYSTACK_CLEANUP \
YYTOKEN_RESET (yyvs, yystacksize); \
if (yyvs != yyvsa) { \
YYSTACK_FREE (yyvs); \
} \
if (yyls != yylsa) { \
YYSTACK_FREE (yyls); \
} \
// macros for rules
#define BEXP(...) _p->onBinaryOpExp(__VA_ARGS__);
#define UEXP(...) _p->onUnaryOpExp(__VA_ARGS__);
using namespace HPHP::HPHP_PARSER_NS;
using LS = Parser::LabelScopeKind;
using ParamMode = HPHP::ParamMode;
typedef HPHP::ClosureType ClosureType;
///////////////////////////////////////////////////////////////////////////////
// helpers
static void scalar_num(Parser *_p, Token &out, const char *num) {
Token t;
t.setText(num);
_p->onScalar(out, T_LNUMBER, t);
}
static void scalar_num(Parser *_p, Token &out, int num) {
Token t;
t.setText(folly::to<std::string>(num));
_p->onScalar(out, T_LNUMBER, t);
}
static void scalar_null(Parser *_p, Token &out) {
Token tnull; tnull.setText("null");
_p->onConstantValue(out, tnull);
}
static void scalar_file(Parser *_p, Token &out) {
Token file; file.setText("__FILE__");
_p->onScalar(out, T_FILE, file);
}
static void scalar_line(Parser *_p, Token &out) {
Token line; line.setText("__LINE__");
_p->onScalar(out, T_LINE, line);
}
///////////////////////////////////////////////////////////////////////////////
static void constant_ae(Parser *_p, Token &out, Token &value) {
const std::string& valueStr = value.text();
if (valueStr.size() < 3 || valueStr.size() > 5 ||
(strcasecmp("true", valueStr.c_str()) != 0 &&
strcasecmp("false", valueStr.c_str()) != 0 &&
strcasecmp("null", valueStr.c_str()) != 0 &&
strcasecmp("inf", valueStr.c_str()) != 0 &&
strcasecmp("nan", valueStr.c_str()) != 0)) {
HPHP_PARSER_ERROR("User-defined constants are not allowed in user "
"attribute expressions", _p);
}
_p->onConstantValue(out, value);
}
///////////////////////////////////////////////////////////////////////////////
/**
* XHP functions: They are defined here, so different parsers don't have to
* handle XHP rules at all.
*/
static void xhp_tag(Parser *_p, Token &out, Token &label, Token &body) {
if (!body.text().empty() && body.text() != label.text()) {
HPHP_PARSER_ERROR("XHP: mismatched tag: '%s' not the same as '%s'",
_p, body.text().c_str(), label.text().c_str());
}
_p->onXhpAttributesEnd();
label.xhpLabel();
Token name; _p->onName(name, label, Parser::StringName);
_p->onNewObject(out, name, body);
}
static void xhp_attribute(Parser *_p, Token &out, Token &type, Token &label,
Token &def, Token &req) {
/**
* The bool, int, float, and string typenames are not given any special
* treatment by the parser and are treated the same as regular class names
* (which initially gets marked as type code 5). However, XHP wants to use
* different type codes for bool, int, float, and string, so we need to fix
* up the type code here to make XHP happy.
*/
if (type.num() == 5) {
auto* str = type.text().c_str();
if (_p->scanner().isHHSyntaxEnabled()) {
switch (type.text().size()) {
case 6:
if (!strcasecmp(str, "HH\\int")) {
type.reset(); type.setNum(3);
}
break;
case 7:
if (!strcasecmp(str, "HH\\bool")) {
type.reset(); type.setNum(2);
}
break;
case 8:
if (!strcasecmp(str, "HH\\float")) {
type.reset(); type.setNum(8);
} else if (!strcasecmp(str, "HH\\mixed")) {
type.reset(); type.setNum(6);
}
break;
case 9:
if (!strcasecmp(str, "HH\\string")) {
type.reset(); type.setNum(1);
}
break;
default:
break;
}
} else {
switch (type.text().size()) {
case 3:
if (!strcasecmp(str, "int")) {
type.reset(); type.setNum(3);
}
break;
case 4:
if (!strcasecmp(str, "bool")) {
type.reset(); type.setNum(2);
} else if (!strcasecmp(str, "real")) {
type.reset(); type.setNum(8);
}
break;
case 5:
if (!strcasecmp(str, "float")) {
type.reset(); type.setNum(8);
} else if (!strcasecmp(str, "mixed")) {
type.reset(); type.setNum(6);
}
break;
case 6:
if (!strcasecmp(str, "string")) {
type.reset(); type.setNum(1);
} else if (!strcasecmp(str, "double")) {
type.reset(); type.setNum(8);
}
break;
case 7:
if (!strcasecmp(str, "integer")) {
type.reset(); type.setNum(3);
} else if (!strcasecmp(str, "boolean")) {
type.reset(); type.setNum(2);
}
break;
default:
break;
}
}
}
Token num; scalar_num(_p, num, type.num());
Token arr1; _p->onExprListElem(arr1, nullptr, num);
Token arr2;
switch (type.num()) {
case 5: /* class */ {
Token cls; _p->onScalar(cls, T_CONSTANT_ENCAPSED_STRING, type);
_p->onExprListElem(arr2, &arr1, cls);
break;
}
case 7: /* enum */ {
Token arr; _p->onVArray(arr, type);
_p->onExprListElem(arr2, &arr1, arr);
break;
}
default: {
Token tnull; scalar_null(_p, tnull);
_p->onExprListElem(arr2, &arr1, tnull);
break;
}
}
Token arr3; _p->onExprListElem(arr3, &arr2, def);
Token arr4; _p->onExprListElem(arr4, &arr3, req);
_p->onVArray(out, arr4);
out.setText(label);
}
static void xhp_attribute_list(Parser *_p, Token &out, Token *list,
Token &decl) {
if (decl.num() == 0) {
decl.xhpLabel();
if (list) {
out = *list;
out.setText(list->text() + ":" + decl.text()); // avoiding vector<string>
} else {
out.setText(decl);
}
} else {
Token name; _p->onScalar(name, T_CONSTANT_ENCAPSED_STRING, decl);
_p->onArrayPair(out, list, &name, decl, 0);
if (list) {
out.setText(list->text());
} else {
out.setText("");
}
}
}
static void xhp_attribute_stmt(Parser *_p, Token &out, Token &attributes) {
Token modifiers;
Token fname; fname.setText("__xhpAttributeDeclaration");
{
Token m;
Token m1; m1.setNum(T_PROTECTED); _p->onMemberModifier(m, NULL, m1);
Token m2; m2.setNum(T_STATIC); _p->onMemberModifier(modifiers, &m, m2);
}
_p->pushFuncLocation();
_p->onMethodStart(fname, modifiers);
std::vector<std::string> classes;
folly::split(':', attributes.text(), classes, true);
Token arrAttributes; _p->onDArray(arrAttributes, attributes);
Token dummy;
Token stmts0;
{
_p->onStatementListStart(stmts0);
}
Token stmts1;
{
// static $_ = null;
Token null; scalar_null(_p, null);
Token var; var.set(T_VARIABLE, "_");
Token decl; _p->onStaticVariable(decl, 0, var, &null);
Token sdecl; _p->onStatic(sdecl, decl);
_p->addStatement(stmts1, stmts0, sdecl);
}
Token stmts2;
{
// if ($_ === null) {
// $_ = __SystemLib\\merge_xhp_attr_declarations(
// parent::__xhpAttributeDeclaration(),
// attributes
// );
// }
Token parent; parent.set(T_STRING, "parent");
Token cls; _p->onName(cls, parent, Parser::StringName);
Token fname2; fname2.setText("__xhpAttributeDeclaration");
Token param1; _p->onCall(param1, 0, fname2, dummy, &cls);
Token params1; _p->onCallParam(params1, NULL, param1, ParamMode::In, false);
for (unsigned int i = 0; i < classes.size(); i++) {
Token parent2; parent2.set(T_STRING, classes[i]);
Token cls2; _p->onName(cls2, parent2, Parser::StringName);
Token fname3; fname3.setText("__xhpAttributeDeclaration");
Token param; _p->onCall(param, 0, fname3, dummy, &cls2);
Token params; _p->onCallParam(params, ¶ms1, param, ParamMode::In,
false);
params1 = params;
}
Token params2; _p->onCallParam(params2, ¶ms1, arrAttributes,
ParamMode::In, false);
Token name; name.set(T_STRING, "__SystemLib\\merge_xhp_attr_declarations");
name = name.num() | 2; // WTH???
Token call; _p->onCall(call, 0, name, params2, NULL);
Token tvar; tvar.set(T_VARIABLE, "_");
Token var; _p->onSimpleVariable(var, tvar);
Token assign; _p->onAssign(assign, var, call, 0);
Token exp; _p->onExpStatement(exp, assign);
Token block; _p->onBlock(block, exp);
Token tvar2; tvar2.set(T_VARIABLE, "_");
Token var2; _p->onSimpleVariable(var2, tvar2);
Token null; scalar_null(_p, null);
Token cond; BEXP(cond, var2, null, T_IS_IDENTICAL);
Token dummy1, dummy2;
Token sif; _p->onIf(sif, cond, block, dummy1, dummy2);
_p->addStatement(stmts2, stmts1, sif);
}
Token stmts3;
{
// return $_;
Token tvar; tvar.set(T_VARIABLE, "_");
Token var; _p->onSimpleVariable(var, tvar);
Token ret; _p->onReturn(ret, &var);
_p->addStatement(stmts3, stmts2, ret);
}
Token stmt;
{
_p->finishStatement(stmt, stmts3);
stmt = 1;
}
{
Token params, ret, ref; ref = 0;
_p->onMethod(out, modifiers, ret, ref, fname, params, stmt, nullptr, false);
}
}
static void xhp_collect_attributes(Parser *_p, Token &out, Token &stmts) {
Token *attr = _p->xhpGetAttributes();
if (attr) {
Token stmt;
xhp_attribute_stmt(_p, stmt, *attr);
_p->onClassStatement(out, stmts, stmt);
} else {
out = stmts;
}
}
static void xhp_category_stmt(Parser *_p, Token &out, Token &categories) {
Token fname; fname.setText("__xhpCategoryDeclaration");
Token m1; m1.setNum(T_PROTECTED);
Token modifiers; _p->onMemberModifier(modifiers, 0, m1);
_p->pushFuncLocation();
_p->onMethodStart(fname, modifiers);
Token stmts0;
{
_p->onStatementListStart(stmts0);
}
Token stmts1;
{
// static $_ = categories;
Token arr; _p->onDArray(arr, categories);
Token var; var.set(T_VARIABLE, "_");
Token decl; _p->onStaticVariable(decl, 0, var, &arr);
Token sdecl; _p->onStatic(sdecl, decl);
_p->addStatement(stmts1, stmts0, sdecl);
}
Token stmts2;
{
// return $_;
Token tvar; tvar.set(T_VARIABLE, "_");
Token var; _p->onSimpleVariable(var, tvar);
Token ret; _p->onReturn(ret, &var);
_p->addStatement(stmts2, stmts1, ret);
}
Token stmt;
{
_p->finishStatement(stmt, stmts2);
stmt = 1;
}
{
Token params, ret, ref; ref = 0;
_p->onMethod(out, modifiers, ret, ref, fname, params, stmt, nullptr, false);
}
}
static void xhp_children_decl_tag(Parser *_p, Token &arr, Token &tag) {
Token num; scalar_num(_p, num, tag.num());
Token arr1; _p->onExprListElem(arr1, &arr, num);
Token name;
if (tag.num() == 3 || tag.num() == 4) {
_p->onScalar(name, T_CONSTANT_ENCAPSED_STRING, tag);
} else if (tag.num() >= 0) {
scalar_null(_p, name);
} else {
HPHP_PARSER_ERROR("XHP: unknown children declaration", _p);
}
Token arr2; _p->onExprListElem(arr2, &arr1, name);
arr = arr2;
}
static void xhp_children_decl(Parser *_p, Token &out, Token &op1, int op,
Token *op2) {
Token num; scalar_num(_p, num, op);
Token arr; _p->onExprListElem(arr, nullptr, num);
if (op2) {
Token arr1; _p->onExprListElem(arr1, &arr, op1);
Token arr2; _p->onExprListElem(arr2, &arr1, *op2);
_p->onVArray(out, arr2);
} else {
xhp_children_decl_tag(_p, arr, op1);
_p->onVArray(out, arr);
}
}
static void xhp_children_paren(Parser *_p, Token &out, Token exp, int op) {
Token num; scalar_num(_p, num, op);
Token arr1; _p->onExprListElem(arr1, nullptr, num);
Token num5; scalar_num(_p, num5, 5);
Token arr2; _p->onExprListElem(arr2, &arr1, num5);
Token arr3; _p->onExprListElem(arr3, &arr2, exp);
_p->onVArray(out, arr3);
}
static void xhp_children_stmt(Parser *_p, Token &out, Token &children) {
Token fname; fname.setText("__xhpChildrenDeclaration");
Token m1; m1.setNum(T_PROTECTED);
Token modifiers; _p->onMemberModifier(modifiers, 0, m1);
_p->pushFuncLocation();
_p->onMethodStart(fname, modifiers);
Token stmts0;
{
_p->onStatementListStart(stmts0);
}
Token stmts1;
{
// static $_ = children;
Token arr;
if (children.num() == 2) {
arr = children;
} else if (children.num() >= 0) {
scalar_num(_p, arr, children.num());
} else {
HPHP_PARSER_ERROR("XHP: XHP unknown children declaration", _p);
}
Token var; var.set(T_VARIABLE, "_");
Token decl; _p->onStaticVariable(decl, 0, var, &arr);
Token sdecl; _p->onStatic(sdecl, decl);
_p->addStatement(stmts1, stmts0, sdecl);
}
Token stmts2;
{
// return $_;
Token tvar; tvar.set(T_VARIABLE, "_");
Token var; _p->onSimpleVariable(var, tvar);
Token ret; _p->onReturn(ret, &var);
_p->addStatement(stmts2, stmts1, ret);
}
Token stmt;
{
_p->finishStatement(stmt, stmts2);
stmt = 1;
}
{
Token params, ret, ref; ref = 0;
_p->onMethod(out, modifiers, ret, ref, fname, params, stmt, nullptr, false);
}
}
static void only_in_hh_syntax(Parser *_p) {
if (!_p->scanner().isHHSyntaxEnabled()) {
HPHP_PARSER_ERROR(
"Syntax only allowed in Hack files (<?hh) or with -v "
"Eval.EnableHipHopSyntax=true",
_p);
}
}
static void validate_hh_variadic_variant(Parser* _p,
Token& userAttrs, Token& typehint,
Token* mod) {
if (!userAttrs.text().empty() || !typehint.text().empty() ||
(mod && !mod->text().empty())) {
HPHP_PARSER_ERROR("Variadic '...' should be followed by a '$variable'", _p);
}
only_in_hh_syntax(_p);
}
// Shapes may not have leading integers in key names, considered as a
// parse time error. This is because at runtime they are currently
// hphp arrays, which will treat leading integer keys as numbers.
static void validate_shape_keyname(Token& tok, Parser* _p) {
if (tok.text().empty()) {
HPHP_PARSER_ERROR("Shape key names may not be empty", _p);
}
if (isdigit(tok.text()[0])) {
HPHP_PARSER_ERROR("Shape key names may not start with integers", _p);
}
}
///////////////////////////////////////////////////////////////////////////////
static int yylex(YYSTYPE* token, HPHP::Location* loc, Parser* _p) {
return _p->scan(token, loc);
}
#line 662 "hphp.7.tab.cpp" /* yacc.c:339 */
# ifndef YY_NULLPTR
# if defined __cplusplus && 201103L <= __cplusplus
# define YY_NULLPTR nullptr
# else
# define YY_NULLPTR 0
# endif
# endif
/* Enabling verbose error messages. */
#ifdef YYERROR_VERBOSE
# undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1
#else
# define YYERROR_VERBOSE 0
#endif
/* In a future release of Bison, this section will be replaced
by #include "hphp.7.tab.hpp". */
#ifndef YY_YY_HPHP_Y_INCLUDED
# define YY_YY_HPHP_Y_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
#if YYDEBUG
extern int Compiler7debug;
#endif
/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype
{
T_INCLUDE = 258,
T_INCLUDE_ONCE = 259,
T_EVAL = 260,
T_REQUIRE = 261,
T_REQUIRE_ONCE = 262,
T_LAMBDA_ARROW = 263,
T_LOGICAL_OR = 264,
T_LOGICAL_XOR = 265,
T_LOGICAL_AND = 266,
T_PRINT = 267,
T_PLUS_EQUAL = 268,
T_MINUS_EQUAL = 269,
T_MUL_EQUAL = 270,
T_DIV_EQUAL = 271,
T_CONCAT_EQUAL = 272,
T_MOD_EQUAL = 273,
T_AND_EQUAL = 274,
T_OR_EQUAL = 275,
T_XOR_EQUAL = 276,
T_SL_EQUAL = 277,
T_SR_EQUAL = 278,
T_POW_EQUAL = 279,
T_AWAIT = 280,
T_YIELD = 281,
T_YIELD_FROM = 282,
T_PIPE = 283,
T_COALESCE = 284,
T_BOOLEAN_OR = 285,
T_BOOLEAN_AND = 286,
T_IS_EQUAL = 287,
T_IS_NOT_EQUAL = 288,
T_IS_IDENTICAL = 289,
T_IS_NOT_IDENTICAL = 290,
T_IS_SMALLER_OR_EQUAL = 291,
T_IS_GREATER_OR_EQUAL = 292,
T_SPACESHIP = 293,
T_SL = 294,
T_SR = 295,
T_INSTANCEOF = 296,
T_INC = 297,
T_DEC = 298,
T_INT_CAST = 299,
T_DOUBLE_CAST = 300,
T_STRING_CAST = 301,
T_ARRAY_CAST = 302,
T_OBJECT_CAST = 303,
T_BOOL_CAST = 304,
T_UNSET_CAST = 305,
T_POW = 306,
T_NEW = 307,
T_CLONE = 308,
T_EXIT = 309,
T_IF = 310,
T_ELSEIF = 311,
T_ELSE = 312,
T_ENDIF = 313,
T_LNUMBER = 314,
T_DNUMBER = 315,
T_ONUMBER = 316,
T_STRING = 317,
T_STRING_VARNAME = 318,
T_VARIABLE = 319,
T_PIPE_VAR = 320,
T_NUM_STRING = 321,
T_INLINE_HTML = 322,
T_INOUT = 323,
T_HASHBANG = 324,
T_CHARACTER = 325,
T_BAD_CHARACTER = 326,
T_ENCAPSED_AND_WHITESPACE = 327,
T_CONSTANT_ENCAPSED_STRING = 328,
T_ECHO = 329,
T_DO = 330,
T_WHILE = 331,
T_ENDWHILE = 332,
T_FOR = 333,
T_ENDFOR = 334,
T_FOREACH = 335,
T_ENDFOREACH = 336,
T_DECLARE = 337,
T_ENDDECLARE = 338,
T_AS = 339,
T_SUPER = 340,
T_SWITCH = 341,
T_ENDSWITCH = 342,
T_CASE = 343,
T_DEFAULT = 344,
T_BREAK = 345,
T_GOTO = 346,
T_CONTINUE = 347,
T_FUNCTION = 348,
T_CONST = 349,
T_RETURN = 350,
T_TRY = 351,
T_CATCH = 352,
T_THROW = 353,
T_USING = 354,
T_USE = 355,
T_GLOBAL = 356,
T_STATIC = 357,
T_ABSTRACT = 358,
T_FINAL = 359,
T_PRIVATE = 360,
T_PROTECTED = 361,
T_PUBLIC = 362,
T_VAR = 363,
T_UNSET = 364,
T_ISSET = 365,
T_EMPTY = 366,
T_HALT_COMPILER = 367,
T_CLASS = 368,
T_INTERFACE = 369,
T_EXTENDS = 370,
T_IMPLEMENTS = 371,
T_OBJECT_OPERATOR = 372,
T_NULLSAFE_OBJECT_OPERATOR = 373,
T_DOUBLE_ARROW = 374,
T_LIST = 375,
T_ARRAY = 376,
T_DICT = 377,
T_VEC = 378,
T_VARRAY = 379,
T_DARRAY = 380,
T_KEYSET = 381,
T_CALLABLE = 382,
T_CLASS_C = 383,
T_METHOD_C = 384,
T_FUNC_C = 385,
T_LINE = 386,
T_FILE = 387,
T_COMMENT = 388,
T_DOC_COMMENT = 389,
T_OPEN_TAG = 390,
T_OPEN_TAG_WITH_ECHO = 391,
T_CLOSE_TAG = 392,
T_WHITESPACE = 393,
T_START_HEREDOC = 394,
T_END_HEREDOC = 395,
T_DOLLAR_OPEN_CURLY_BRACES = 396,
T_CURLY_OPEN = 397,
T_DOUBLE_COLON = 398,
T_NAMESPACE = 399,
T_NS_C = 400,
T_DIR = 401,
T_NS_SEPARATOR = 402,
T_XHP_LABEL = 403,
T_XHP_TEXT = 404,
T_XHP_ATTRIBUTE = 405,
T_XHP_CATEGORY = 406,
T_XHP_CATEGORY_LABEL = 407,
T_XHP_CHILDREN = 408,
T_ENUM = 409,
T_XHP_REQUIRED = 410,
T_TRAIT = 411,
T_ELLIPSIS = 412,
T_INSTEADOF = 413,
T_TRAIT_C = 414,
T_HH_ERROR = 415,
T_FINALLY = 416,
T_XHP_TAG_LT = 417,
T_XHP_TAG_GT = 418,
T_TYPELIST_LT = 419,
T_TYPELIST_GT = 420,
T_UNRESOLVED_LT = 421,
T_COLLECTION = 422,
T_SHAPE = 423,
T_TUPLE = 424,
T_TYPE = 425,
T_UNRESOLVED_TYPE = 426,
T_NEWTYPE = 427,
T_UNRESOLVED_NEWTYPE = 428,
T_COMPILER_HALT_OFFSET = 429,
T_ASYNC = 430,
T_LAMBDA_OP = 431,
T_LAMBDA_CP = 432,
T_UNRESOLVED_OP = 433,
T_WHERE = 434
};
#endif
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef int YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
#endif
/* Location type. */
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
typedef struct YYLTYPE YYLTYPE;
struct YYLTYPE
{
int line0;
int char0;
int line1;
int char1;
};
# define YYLTYPE_IS_DECLARED 1
# define YYLTYPE_IS_TRIVIAL 1
#endif
int Compiler7parse (HPHP::HPHP_PARSER_NS::Parser *_p);
#endif /* !YY_YY_HPHP_Y_INCLUDED */
/* Copy the second part of user declarations. */
#line 906 "hphp.7.tab.cpp" /* yacc.c:358 */
#ifdef short
# undef short
#endif
#ifdef YYTYPE_UINT8
typedef YYTYPE_UINT8 yytype_uint8;
#else
typedef unsigned char yytype_uint8;
#endif
#ifdef YYTYPE_INT8
typedef YYTYPE_INT8 yytype_int8;
#else
typedef signed char yytype_int8;
#endif
#ifdef YYTYPE_UINT16
typedef YYTYPE_UINT16 yytype_uint16;
#else
typedef unsigned short int yytype_uint16;
#endif
#ifdef YYTYPE_INT16
typedef YYTYPE_INT16 yytype_int16;
#else
typedef short int yytype_int16;
#endif
#ifndef YYSIZE_T
# ifdef __SIZE_TYPE__
# define YYSIZE_T __SIZE_TYPE__
# elif defined size_t
# define YYSIZE_T size_t
# elif ! defined YYSIZE_T
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# else
# define YYSIZE_T unsigned int
# endif
#endif
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
#ifndef YY_
# if defined YYENABLE_NLS && YYENABLE_NLS
# if ENABLE_NLS
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
# endif
# endif
# ifndef YY_
# define YY_(Msgid) Msgid
# endif
#endif
#ifndef YY_ATTRIBUTE
# if (defined __GNUC__ \
&& (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
|| defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
# else
# define YY_ATTRIBUTE(Spec) /* empty */
# endif
#endif
#ifndef YY_ATTRIBUTE_PURE
# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
#endif
#ifndef YY_ATTRIBUTE_UNUSED
# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
#endif
#if !defined _Noreturn \
&& (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
# if defined _MSC_VER && 1200 <= _MSC_VER
# define _Noreturn __declspec (noreturn)
# else
# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
# endif
#endif
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
# define YYUSE(E) ((void) (E))
#else
# define YYUSE(E) /* empty */
#endif
#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
_Pragma ("GCC diagnostic pop")
#else
# define YY_INITIAL_VALUE(Value) Value
#endif
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
#endif
#ifndef YY_INITIAL_VALUE
# define YY_INITIAL_VALUE(Value) /* Nothing. */
#endif
#if ! defined yyoverflow || YYERROR_VERBOSE
/* The parser invokes alloca or malloc; define the necessary symbols. */
# ifdef YYSTACK_USE_ALLOCA
# if YYSTACK_USE_ALLOCA
# ifdef __GNUC__
# define YYSTACK_ALLOC __builtin_alloca
# elif defined __BUILTIN_VA_ARG_INCR
# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
# elif defined _AIX
# define YYSTACK_ALLOC __alloca
# elif defined _MSC_VER
# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
/* Use EXIT_SUCCESS as a witness for stdlib.h. */
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
# endif
# endif
# endif
# endif
# endif
# ifdef YYSTACK_ALLOC
/* Pacify GCC's 'empty if-body' warning. */
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
# ifndef YYSTACK_ALLOC_MAXIMUM
/* The OS might guarantee only one guard page at the bottom of the stack,
and a page size can be as small as 4096 bytes. So we cannot safely
invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
to allow for a few compiler-allocated temporary stack slots. */
# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
# endif
# else
# define YYSTACK_ALLOC YYMALLOC
# define YYSTACK_FREE YYFREE
# ifndef YYSTACK_ALLOC_MAXIMUM
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
# endif
# if (defined __cplusplus && ! defined EXIT_SUCCESS \
&& ! ((defined YYMALLOC || defined malloc) \
&& (defined YYFREE || defined free)))
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
# endif
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
# if ! defined malloc && ! defined EXIT_SUCCESS
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
# define YYFREE free
# if ! defined free && ! defined EXIT_SUCCESS
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# endif
#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
#if (! defined yyoverflow \
&& (! defined __cplusplus \
|| (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
&& defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
struct yyalloc
{
yytype_int16 yyss_alloc;
YYSTYPE yyvs_alloc;
YYLTYPE yyls_alloc;
};
/* The size of the maximum gap between one aligned stack and the next. */
# define YYSTACK_GAP_MAXIMUM (sizeof (struct yyalloc) - 1)
/* The size of an array large to enough to hold all stacks, each with
N elements. */
# define YYSTACK_BYTES(N) \
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
+ 2 * YYSTACK_GAP_MAXIMUM)
# define YYCOPY_NEEDED 1
/* Relocate STACK from its old location to the new one. The
local variables YYSIZE and YYSTACKSIZE give the old and new number of
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
do \
{ \
YYSIZE_T yynewbytes; \
YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
Stack = &yyptr->Stack_alloc; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
while (0)
#endif
#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
/* Copy COUNT objects from SRC to DST. The source and destination do
not overlap. */
# ifndef YYCOPY
# if defined __GNUC__ && 1 < __GNUC__
# define YYCOPY(Dst, Src, Count) \
__builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
# else
# define YYCOPY(Dst, Src, Count) \
do \
{ \
YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
(Dst)[yyi] = (Src)[yyi]; \
} \
while (0)
# endif
# endif
#endif /* !YYCOPY_NEEDED */
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 3
/* YYLAST -- Last index in YYTABLE. */
#define YYLAST 20435
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 209
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 315
/* YYNRULES -- Number of rules. */
#define YYNRULES 1136
/* YYNSTATES -- Number of states. */
#define YYNSTATES 2124
/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
by yylex, with out-of-bounds checking. */
#define YYUNDEFTOK 2
#define YYMAXUTOK 434
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
as returned by yylex, without out-of-bounds checking. */
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 56, 207, 2, 205, 55, 38, 208,
199, 200, 53, 50, 9, 51, 52, 54, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 32, 201,
43, 14, 45, 31, 68, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 70, 2, 204, 37, 2, 206, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 202, 36, 203, 58, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
5, 6, 7, 8, 10, 11, 12, 13, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
27, 28, 29, 30, 33, 34, 35, 39, 40, 41,
42, 44, 46, 47, 48, 49, 57, 59, 60, 61,
62, 63, 64, 65, 66, 67, 69, 71, 72, 73,
74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
94, 95, 96, 97, 98, 99, 100, 101, 102, 103,
104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
124, 125, 126, 127, 128, 129, 130, 131, 132, 133,
134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
144, 145, 146, 147, 148, 149, 150, 151, 152, 153,
154, 155, 156, 157, 158, 159, 160, 161, 162, 163,
164, 165, 166, 167, 168, 169, 170, 171, 172, 173,
174, 175, 176, 177, 178, 179, 180, 181, 182, 183,
184, 185, 186, 187, 188, 189, 190, 191, 192, 193,
194, 195, 196, 197, 198
};
#if YYDEBUG
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 760, 760, 760, 769, 771, 774, 775, 776, 777,
778, 779, 780, 783, 785, 785, 787, 787, 789, 792,
797, 802, 805, 808, 812, 816, 820, 824, 828, 833,
834, 835, 836, 837, 838, 839, 840, 841, 842, 843,
844, 845, 849, 850, 851, 852, 853, 854, 855, 856,
857, 858, 859, 860, 861, 862, 863, 864, 865, 866,
867, 868, 869, 870, 871, 872, 873, 874, 875, 876,
877, 878, 879, 880, 881, 882, 883, 884, 885, 886,
887, 888, 889, 890, 891, 892, 893, 894, 895, 896,
897, 898, 899, 900, 901, 902, 903, 904, 905, 906,
907, 908, 909, 910, 911, 912, 913, 917, 918, 922,
923, 927, 928, 933, 935, 940, 945, 946, 947, 949,
954, 956, 961, 966, 968, 970, 975, 976, 980, 981,
983, 987, 994, 1001, 1005, 1011, 1013, 1017, 1018, 1024,
1026, 1030, 1032, 1037, 1038, 1039, 1040, 1043, 1044, 1048,
1053, 1053, 1059, 1059, 1066, 1065, 1071, 1071, 1076, 1077,
1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087,
1088, 1089, 1090, 1094, 1092, 1101, 1099, 1106, 1116, 1110,
1120, 1118, 1122, 1126, 1130, 1134, 1138, 1142, 1146, 1151,
1152, 1156, 1157, 1158, 1159, 1160, 1161, 1162, 1163, 1164,
1165, 1166, 1167, 1189, 1195, 1196, 1205, 1207, 1211, 1212,
1213, 1217, 1218, 1222, 1222, 1227, 1233, 1237, 1237, 1245,
1246, 1250, 1251, 1255, 1261, 1259, 1276, 1273, 1291, 1288,
1306, 1305, 1314, 1312, 1324, 1323, 1342, 1340, 1359, 1358,
1367, 1365, 1376, 1376, 1383, 1382, 1394, 1392, 1405, 1406,
1410, 1413, 1416, 1417, 1418, 1421, 1422, 1425, 1427, 1430,
1431, 1434, 1435, 1438, 1439, 1443, 1444, 1449, 1450, 1453,
1454, 1455, 1459, 1460, 1464, 1465, 1469, 1470, 1474, 1475,
1480, 1481, 1487, 1488, 1489, 1490, 1493, 1496, 1498, 1501,
1502, 1506, 1508, 1511, 1514, 1517, 1518, 1521, 1522, 1526,
1532, 1538, 1545, 1547, 1552, 1557, 1563, 1567, 1572, 1577,
1582, 1588, 1594, 1600, 1606, 1612, 1619, 1629, 1634, 1639,
1645, 1647, 1651, 1655, 1660, 1664, 1668, 1672, 1676, 1681,
1686, 1691, 1696, 1701, 1707, 1716, 1717, 1718, 1722, 1724,
1727, 1729, 1731, 1733, 1735, 1738, 1741, 1744, 1750, 1751,
1754, 1755, 1756, 1760, 1761, 1763, 1764, 1768, 1770, 1773,
1777, 1783, 1785, 1788, 1791, 1795, 1799, 1804, 1806, 1809,
1812, 1810, 1827, 1824, 1839, 1841, 1843, 1845, 1847, 1849,
1851, 1855, 1856, 1857, 1860, 1866, 1870, 1876, 1879, 1884,
1886, 1891, 1896, 1900, 1901, 1905, 1906, 1908, 1910, 1916,
1917, 1919, 1923, 1924, 1929, 1933, 1934, 1938, 1939, 1943,
1945, 1951, 1956, 1957, 1959, 1963, 1964, 1965, 1966, 1970,
1971, 1972, 1973, 1974, 1975, 1977, 1982, 1985, 1986, 1990,
1991, 1995, 1996, 1999, 2000, 2003, 2004, 2007, 2008, 2012,
2013, 2014, 2015, 2016, 2017, 2018, 2022, 2023, 2026, 2027,
2028, 2031, 2033, 2035, 2036, 2039, 2041, 2044, 2050, 2052,
2056, 2060, 2064, 2069, 2073, 2074, 2076, 2077, 2078, 2079,
2082, 2083, 2087, 2088, 2092, 2093, 2094, 2095, 2099, 2103,
2108, 2112, 2116, 2120, 2124, 2129, 2133, 2134, 2135, 2136,
2137, 2141, 2145, 2147, 2148, 2149, 2152, 2153, 2154, 2155,
2156, 2157, 2158, 2159, 2160, 2161, 2162, 2163, 2164, 2165,
2166, 2167, 2168, 2169, 2170, 2171, 2172, 2173, 2174, 2175,
2176, 2177, 2178, 2179, 2180, 2181, 2182, 2183, 2184, 2185,
2186, 2187, 2188, 2189, 2190, 2191, 2192, 2193, 2194, 2195,
2197, 2198, 2200, 2201, 2203, 2204, 2205, 2206, 2207, 2208,
2209, 2210, 2211, 2212, 2213, 2214, 2215, 2216, 2217, 2218,
2219, 2220, 2221, 2222, 2223, 2224, 2225, 2226, 2227, 2228,
2232, 2236, 2241, 2240, 2256, 2254, 2273, 2272, 2293, 2292,
2312, 2311, 2330, 2330, 2347, 2347, 2366, 2367, 2368, 2373,
2375, 2379, 2383, 2389, 2393, 2399, 2401, 2405, 2407, 2411,
2415, 2416, 2420, 2422, 2426, 2428, 2432, 2434, 2438, 2441,
2446, 2448, 2452, 2455, 2460, 2464, 2468, 2472, 2476, 2480,
2484, 2488, 2492, 2496, 2500, 2504, 2508, 2512, 2516, 2520,
2524, 2528, 2532, 2534, 2538, 2540, 2544, 2546, 2550, 2557,
2564, 2566, 2571, 2572, 2573, 2574, 2575, 2576, 2577, 2578,
2579, 2580, 2582, 2583, 2587, 2588, 2589, 2590, 2594, 2600,
2613, 2630, 2631, 2634, 2635, 2637, 2642, 2643, 2646, 2650,
2653, 2656, 2663, 2664, 2668, 2669, 2671, 2676, 2677, 2678,
2679, 2680, 2681, 2682, 2683, 2684, 2685, 2686, 2687, 2688,
2689, 2690, 2691, 2692, 2693, 2694, 2695, 2696, 2697, 2698,
2699, 2700, 2701, 2702, 2703, 2704, 2705, 2706, 2707, 2708,
2709, 2710, 2711, 2712, 2713, 2714, 2715, 2716, 2717, 2718,
2719, 2720, 2721, 2722, 2723, 2724, 2725, 2726, 2727, 2728,
2729, 2730, 2731, 2732, 2733, 2734, 2735, 2736, 2737, 2738,
2739, 2740, 2741, 2742, 2743, 2744, 2745, 2746, 2747, 2748,
2749, 2750, 2751, 2752, 2753, 2754, 2755, 2756, 2757, 2758,
2762, 2767, 2768, 2772, 2773, 2774, 2775, 2777, 2781, 2782,
2793, 2794, 2796, 2798, 2810, 2811, 2812, 2816, 2817, 2818,
2822, 2823, 2824, 2827, 2829, 2833, 2834, 2835, 2836, 2838,
2839, 2840, 2841, 2842, 2843, 2844, 2845, 2846, 2847, 2850,
2855, 2856, 2857, 2859, 2860, 2862, 2863, 2864, 2865, 2866,
2867, 2868, 2869, 2870, 2871, 2873, 2875, 2877, 2879, 2881,
2882, 2883, 2884, 2885, 2886, 2887, 2888, 2889, 2890, 2891,
2892, 2893, 2894, 2895, 2896, 2897, 2899, 2901, 2903, 2905,
2906, 2909, 2910, 2914, 2918, 2920, 2924, 2925, 2929, 2935,
2938, 2942, 2943, 2944, 2945, 2946, 2947, 2948, 2953, 2955,
2959, 2960, 2963, 2964, 2968, 2971, 2973, 2975, 2979, 2980,
2981, 2982, 2985, 2989, 2990, 2991, 2992, 2996, 2998, 3005,
3006, 3007, 3008, 3013, 3014, 3015, 3016, 3018, 3019, 3021,
3022, 3023, 3024, 3025, 3026, 3030, 3032, 3036, 3038, 3041,
3044, 3046, 3048, 3051, 3053, 3057, 3059, 3062, 3065, 3071,
3073, 3076, 3077, 3082, 3085, 3089, 3089, 3094, 3097, 3098,
3102, 3103, 3107, 3108, 3109, 3113, 3118, 3123, 3124, 3128,
3133, 3138, 3139, 3143, 3145, 3146, 3151, 3153, 3158, 3169,
3183, 3195, 3210, 3211, 3212, 3213, 3214, 3215, 3216, 3226,
3235, 3237, 3239, 3243, 3247, 3248, 3249, 3250, 3251, 3267,
3268, 3271, 3278, 3279, 3280, 3281, 3282, 3283, 3284, 3286,
3287, 3289, 3291, 3296, 3300, 3301, 3305, 3308, 3312, 3319,
3323, 3332, 3339, 3347, 3349, 3350, 3354, 3355, 3356, 3358,
3363, 3364, 3375, 3376, 3377, 3378, 3389, 3392, 3395, 3396,
3397, 3398, 3409, 3413, 3414, 3415, 3417, 3418, 3419, 3423,
3425, 3428, 3430, 3431, 3432, 3433, 3436, 3438, 3439, 3443,
3445, 3448, 3450, 3451, 3452, 3456, 3458, 3461, 3464, 3466,
3468, 3472, 3473, 3475, 3476, 3482, 3483, 3485, 3495, 3497,
3499, 3502, 3503, 3504, 3508, 3509, 3510, 3511, 3512, 3513,
3514, 3515, 3516, 3517, 3518, 3522, 3523, 3527, 3529, 3537,
3539, 3543, 3547, 3552, 3556, 3564, 3565, 3569, 3570, 3576,
3577, 3586, 3587, 3595, 3598, 3602, 3605, 3610, 3615, 3618,
3621, 3623, 3625, 3627, 3631, 3633, 3634, 3635, 3638, 3640,
3646, 3647, 3651, 3652, 3656, 3657, 3661, 3662, 3665, 3670,
3671, 3675, 3678, 3680, 3684, 3690, 3691, 3692, 3696, 3700,
3708, 3713, 3725, 3727, 3731, 3734, 3736, 3741, 3746, 3752,
3755, 3760, 3765, 3767, 3774, 3776, 3779, 3780, 3783, 3786,
3787, 3792, 3794, 3798, 3804, 3814, 3815
};
#endif
#if YYDEBUG || YYERROR_VERBOSE || 0
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
"$end", "error", "$undefined", "T_INCLUDE", "T_INCLUDE_ONCE", "T_EVAL",
"T_REQUIRE", "T_REQUIRE_ONCE", "T_LAMBDA_ARROW", "','", "T_LOGICAL_OR",
"T_LOGICAL_XOR", "T_LOGICAL_AND", "T_PRINT", "'='", "T_PLUS_EQUAL",
"T_MINUS_EQUAL", "T_MUL_EQUAL", "T_DIV_EQUAL", "T_CONCAT_EQUAL",
"T_MOD_EQUAL", "T_AND_EQUAL", "T_OR_EQUAL", "T_XOR_EQUAL", "T_SL_EQUAL",
"T_SR_EQUAL", "T_POW_EQUAL", "T_AWAIT", "T_YIELD", "T_YIELD_FROM",
"T_PIPE", "'?'", "':'", "\"??\"", "T_BOOLEAN_OR", "T_BOOLEAN_AND", "'|'",
"'^'", "'&'", "T_IS_EQUAL", "T_IS_NOT_EQUAL", "T_IS_IDENTICAL",
"T_IS_NOT_IDENTICAL", "'<'", "T_IS_SMALLER_OR_EQUAL", "'>'",
"T_IS_GREATER_OR_EQUAL", "T_SPACESHIP", "T_SL", "T_SR", "'+'", "'-'",
"'.'", "'*'", "'/'", "'%'", "'!'", "T_INSTANCEOF", "'~'", "T_INC",
"T_DEC", "T_INT_CAST", "T_DOUBLE_CAST", "T_STRING_CAST", "T_ARRAY_CAST",
"T_OBJECT_CAST", "T_BOOL_CAST", "T_UNSET_CAST", "'@'", "T_POW", "'['",
"T_NEW", "T_CLONE", "T_EXIT", "T_IF", "T_ELSEIF", "T_ELSE", "T_ENDIF",
"T_LNUMBER", "T_DNUMBER", "T_ONUMBER", "T_STRING", "T_STRING_VARNAME",
"T_VARIABLE", "T_PIPE_VAR", "T_NUM_STRING", "T_INLINE_HTML", "T_INOUT",
"T_HASHBANG", "T_CHARACTER", "T_BAD_CHARACTER",
"T_ENCAPSED_AND_WHITESPACE", "T_CONSTANT_ENCAPSED_STRING", "T_ECHO",
"T_DO", "T_WHILE", "T_ENDWHILE", "T_FOR", "T_ENDFOR", "T_FOREACH",
"T_ENDFOREACH", "T_DECLARE", "T_ENDDECLARE", "T_AS", "T_SUPER",
"T_SWITCH", "T_ENDSWITCH", "T_CASE", "T_DEFAULT", "T_BREAK", "T_GOTO",
"T_CONTINUE", "T_FUNCTION", "T_CONST", "T_RETURN", "T_TRY", "T_CATCH",
"T_THROW", "T_USING", "T_USE", "T_GLOBAL", "T_STATIC", "T_ABSTRACT",
"T_FINAL", "T_PRIVATE", "T_PROTECTED", "T_PUBLIC", "T_VAR", "T_UNSET",
"T_ISSET", "T_EMPTY", "T_HALT_COMPILER", "T_CLASS", "T_INTERFACE",
"T_EXTENDS", "T_IMPLEMENTS", "T_OBJECT_OPERATOR",
"T_NULLSAFE_OBJECT_OPERATOR", "T_DOUBLE_ARROW", "T_LIST", "T_ARRAY",
"T_DICT", "T_VEC", "T_VARRAY", "T_DARRAY", "T_KEYSET", "T_CALLABLE",
"T_CLASS_C", "T_METHOD_C", "T_FUNC_C", "T_LINE", "T_FILE", "T_COMMENT",
"T_DOC_COMMENT", "T_OPEN_TAG", "T_OPEN_TAG_WITH_ECHO", "T_CLOSE_TAG",
"T_WHITESPACE", "T_START_HEREDOC", "T_END_HEREDOC",
"T_DOLLAR_OPEN_CURLY_BRACES", "T_CURLY_OPEN", "T_DOUBLE_COLON",
"T_NAMESPACE", "T_NS_C", "T_DIR", "T_NS_SEPARATOR", "T_XHP_LABEL",
"T_XHP_TEXT", "T_XHP_ATTRIBUTE", "T_XHP_CATEGORY",
"T_XHP_CATEGORY_LABEL", "T_XHP_CHILDREN", "T_ENUM", "T_XHP_REQUIRED",
"T_TRAIT", "\"...\"", "T_INSTEADOF", "T_TRAIT_C", "T_HH_ERROR",
"T_FINALLY", "T_XHP_TAG_LT", "T_XHP_TAG_GT", "T_TYPELIST_LT",
"T_TYPELIST_GT", "T_UNRESOLVED_LT", "T_COLLECTION", "T_SHAPE", "T_TUPLE",
"T_TYPE", "T_UNRESOLVED_TYPE", "T_NEWTYPE", "T_UNRESOLVED_NEWTYPE",
"T_COMPILER_HALT_OFFSET", "T_ASYNC", "T_LAMBDA_OP", "T_LAMBDA_CP",
"T_UNRESOLVED_OP", "T_WHERE", "'('", "')'", "';'", "'{'", "'}'", "']'",
"'$'", "'`'", "'\"'", "'\\''", "$accept", "start", "$@1",
"top_statement_list", "top_statement", "$@2", "$@3",
"ident_no_semireserved", "ident_for_class_const", "ident",
"group_use_prefix", "non_empty_use_declarations", "use_declarations",
"use_declaration", "non_empty_mixed_use_declarations",
"mixed_use_declarations", "mixed_use_declaration", "namespace_name",
"namespace_string", "namespace_string_typeargs",
"class_namespace_string_typeargs", "constant_declaration",
"function_statement_list", "function_statement", "inner_statement_list",
"inner_statement_list_nonempty", "inner_statement", "statement", "$@4",
"$@5", "$@6", "$@7", "$@8", "$@9", "$@10", "$@11", "using_prologue",
"opt_await", "using_expr_list", "using_expr", "using_statement_list",
"try_statement_list", "$@12", "additional_catches",
"finally_statement_list", "$@13", "optional_finally", "is_reference",
"function_loc", "function_declaration_statement", "$@14", "$@15", "$@16",
"enum_declaration_statement", "$@17", "$@18",
"class_declaration_statement", "$@19", "$@20", "$@21", "$@22",
"class_expression", "$@23", "trait_declaration_statement", "$@24",
"$@25", "class_decl_name", "interface_decl_name", "trait_decl_name",
"class_entry_type", "extends_from", "implements_list",
"interface_extends_list", "interface_list", "trait_list",
"foreach_optional_arg", "foreach_variable", "for_statement",
"foreach_statement", "while_statement", "declare_statement",
"declare_list", "switch_case_list", "case_list", "case_separator",
"elseif_list", "new_elseif_list", "else_single", "new_else_single",
"method_parameter_list", "non_empty_method_parameter_list",
"parameter_list", "non_empty_parameter_list", "inout_variable",
"function_call_parameter_list", "non_empty_fcall_parameter_list",
"global_var_list", "global_var", "static_var_list",
"enum_statement_list", "enum_statement", "enum_constant_declaration",
"class_statement_list", "class_statement", "$@26", "$@27", "trait_rules",
"trait_precedence_rule", "trait_alias_rule", "trait_alias_rule_method",
"xhp_attribute_stmt", "xhp_attribute_decl",
"xhp_nullable_attribute_decl_type", "xhp_attribute_decl_type",
"non_empty_xhp_attribute_enum", "xhp_attribute_enum",
"xhp_attribute_default", "xhp_attribute_is_required",
"xhp_category_stmt", "xhp_category_decl", "xhp_children_stmt",
"xhp_children_paren_expr", "xhp_children_decl_expr",
"xhp_children_decl_tag", "function_body", "method_body",
"variable_modifiers", "method_modifiers", "non_empty_member_modifiers",
"member_modifier", "parameter_modifiers", "parameter_modifier",
"class_variable_declaration", "class_constant_declaration",
"class_abstract_constant_declaration", "class_type_constant_declaration",
"class_type_constant", "parenthesis_expr_with_parens",
"expr_with_parens", "expr_list", "for_expr", "yield_expr",
"yield_assign_expr", "yield_list_assign_expr", "yield_from_expr",
"yield_from_assign_expr", "await_expr", "await_assign_expr",
"await_list_assign_expr", "parenthesis_expr", "expr",
"parenthesis_expr_no_variable", "expr_no_variable", "lambda_use_vars",
"closure_expression", "$@28", "$@29", "lambda_expression", "$@30",
"$@31", "$@32", "$@33", "$@34", "lambda_body", "shape_keyname",
"non_empty_shape_pair_list", "non_empty_static_shape_pair_list",
"shape_pair_list", "static_shape_pair_list", "shape_literal",
"array_literal", "dict_pair_list", "non_empty_dict_pair_list",
"static_dict_pair_list", "non_empty_static_dict_pair_list",
"static_dict_pair_list_ae", "non_empty_static_dict_pair_list_ae",
"dict_literal", "static_dict_literal", "static_dict_literal_ae",
"vec_literal", "static_vec_literal", "static_vec_literal_ae",
"keyset_literal", "static_keyset_literal", "static_keyset_literal_ae",
"tuple_literal", "static_tuple_literal", "static_tuple_literal_ae",
"varray_literal", "static_varray_literal", "static_varray_literal_ae",
"darray_literal", "static_darray_literal", "static_darray_literal_ae",
"vec_ks_expr_list", "static_vec_ks_expr_list",
"static_vec_ks_expr_list_ae", "collection_literal",
"static_collection_literal", "dim_expr", "dim_expr_base",
"lexical_var_list", "xhp_tag", "xhp_tag_body", "xhp_opt_end_label",
"xhp_attributes", "xhp_children", "xhp_attribute_name",
"xhp_attribute_value", "xhp_child", "xhp_label_ws", "xhp_bareword",
"simple_function_call", "fully_qualified_class_name",
"static_class_name_base", "static_class_name_no_calls",
"static_class_name", "class_name_reference", "exit_expr",
"backticks_expr", "ctor_arguments", "common_scalar", "static_expr",
"static_expr_list", "static_class_class_constant",
"static_class_constant", "scalar", "static_array_pair_list",
"possible_comma", "hh_possible_comma",
"non_empty_static_array_pair_list", "common_scalar_ae",
"static_numeric_scalar_ae", "static_string_expr_ae", "static_scalar_ae",
"static_scalar_ae_list", "static_array_pair_list_ae",
"non_empty_static_array_pair_list_ae", "non_empty_static_scalar_list_ae",
"static_shape_pair_list_ae", "non_empty_static_shape_pair_list_ae",
"static_scalar_list_ae", "attribute_static_scalar_list",
"non_empty_user_attribute_list", "user_attribute_list", "$@35",
"non_empty_user_attributes", "optional_user_attributes",
"object_operator", "object_property_name_no_variables",
"object_property_name", "object_method_name_no_variables",
"object_method_name", "array_access", "dimmable_variable_access",
"dimmable_variable_no_calls_access", "object_property_access_on_expr",
"object_property_access_on_expr_no_variables", "variable",
"parenthesis_variable", "dimmable_variable_no_parens",
"callable_variable", "lambda_or_closure_with_parens",
"lambda_or_closure", "object_method_call", "class_method_call",
"variable_no_objects", "reference_variable", "compound_variable",
"dim_offset", "variable_no_calls", "dimmable_variable_no_calls",
"assignment_list", "array_pair_list", "non_empty_array_pair_list",
"collection_init", "non_empty_collection_init", "static_collection_init",
"non_empty_static_collection_init", "encaps_list", "encaps_var",
"encaps_var_offset", "internal_functions", "variable_list",
"class_constant", "hh_opt_constraint", "hh_type_alias_statement",
"hh_name_with_type", "hh_constname_with_type", "hh_name_with_typevar",
"hh_name_no_semireserved_with_typevar", "hh_typeargs_opt",
"hh_non_empty_type_list", "hh_type_list", "hh_non_empty_func_type_list",
"hh_func_type_list", "opt_type_constraint_where_clause",
"non_empty_constraint_list", "hh_generalised_constraint",
"opt_return_type", "hh_constraint", "hh_typevar_list",
"hh_non_empty_constraint_list", "hh_non_empty_typevar_list",
"hh_typevar_variance", "hh_shape_member_type",
"hh_non_empty_shape_member_list", "hh_shape_member_list",
"hh_shape_type", "hh_access_type_start", "hh_access_type",
"array_typelist", "hh_type", "hh_type_opt", YY_NULLPTR
};
#endif
# ifdef YYPRINT
/* YYTOKNUM[NUM] -- (External) token number corresponding to the
(internal) symbol number NUM (which must be that of a token). */
static const yytype_uint16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 44,
264, 265, 266, 267, 61, 268, 269, 270, 271, 272,
273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
283, 63, 58, 284, 285, 286, 124, 94, 38, 287,
288, 289, 290, 60, 291, 62, 292, 293, 294, 295,
43, 45, 46, 42, 47, 37, 33, 296, 126, 297,
298, 299, 300, 301, 302, 303, 304, 305, 64, 306,
91, 307, 308, 309, 310, 311, 312, 313, 314, 315,
316, 317, 318, 319, 320, 321, 322, 323, 324, 325,
326, 327, 328, 329, 330, 331, 332, 333, 334, 335,
336, 337, 338, 339, 340, 341, 342, 343, 344, 345,
346, 347, 348, 349, 350, 351, 352, 353, 354, 355,
356, 357, 358, 359, 360, 361, 362, 363, 364, 365,
366, 367, 368, 369, 370, 371, 372, 373, 374, 375,
376, 377, 378, 379, 380, 381, 382, 383, 384, 385,
386, 387, 388, 389, 390, 391, 392, 393, 394, 395,
396, 397, 398, 399, 400, 401, 402, 403, 404, 405,
406, 407, 408, 409, 410, 411, 412, 413, 414, 415,
416, 417, 418, 419, 420, 421, 422, 423, 424, 425,
426, 427, 428, 429, 430, 431, 432, 433, 434, 40,
41, 59, 123, 125, 93, 36, 96, 34, 39
};
# endif
#define YYPACT_NINF -1833
#define yypact_value_is_default(Yystate) \
(!!((Yystate) == (-1833)))
#define YYTABLE_NINF -1137
#define yytable_value_is_error(Yytable_value) \
(!!((Yytable_value) == (-1137)))
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
static const yytype_int16 yypact[] =
{
-1833, 221, -1833, -1833, 5792, 15293, 15293, 19, 15293, 15293,
15293, 15293, 12894, 15293, -1833, 15293, 15293, 15293, 15293, 18512,
18512, 15293, 15293, 15293, 15293, 15293, 15293, 15293, 15293, 13073,
19247, 15293, 173, 223, -1833, -1833, -1833, 178, -1833, 333,
-1833, -1833, -1833, 181, 15293, -1833, 223, 238, 261, 265,
-1833, 223, 13252, 16417, 13431, -1833, 16157, 11757, 303, 15293,
19496, 104, 106, 334, 462, -1833, -1833, -1833, 330, 359,
398, 407, -1833, 16417, 429, 432, 583, 590, 606, 622,
626, -1833, -1833, -1833, -1833, -1833, 15293, 604, 3055, -1833,
-1833, 16417, -1833, -1833, -1833, -1833, 16417, -1833, 16417, -1833,
533, 504, 513, 16417, 16417, -1833, 448, -1833, -1833, 13637,
-1833, -1833, 325, 642, 764, 764, -1833, 686, 556, 536,
530, -1833, 122, -1833, 544, 629, 729, -1833, -1833, -1833,
-1833, 1189, 698, -1833, 174, -1833, 561, 574, 580, 587,
595, 603, 624, 645, 17572, -1833, -1833, -1833, -1833, -1833,
182, 714, 779, 782, 787, 803, 805, -1833, 813, 815,
-1833, 236, 589, -1833, 726, 252, -1833, 2238, 243, -1833,
-1833, 4504, 174, 174, 692, 363, -1833, 248, 92, 694,
172, -1833, -1833, 832, -1833, 742, -1833, -1833, 707, 744,
-1833, 15293, -1833, 729, 698, 19784, 4712, 19784, 15293, 19784,
19784, 16706, 16706, 712, 17982, 19784, 859, 16417, 854, 854,
153, 854, -1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833,
-1833, 101, 15293, 749, -1833, -1833, 772, 765, 70, 768,
70, 854, 854, 854, 854, 854, 854, 854, 854, 18512,
18685, 737, 954, 742, -1833, 15293, 749, -1833, 806, -1833,
810, 778, -1833, 180, -1833, -1833, -1833, 70, 174, -1833,
13816, -1833, -1833, 15293, 10324, 972, 124, 19784, 11354, -1833,
15293, 15293, 16417, -1833, -1833, 17620, 781, -1833, 17690, -1833,
-1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833, 4256,
-1833, 4256, -1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833,
-1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833,
-1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833,
-1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833,
-1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833,
-1833, 103, 113, 744, -1833, -1833, -1833, -1833, 788, -1833,
4476, 116, -1833, -1833, 824, 976, -1833, 834, 16898, 15293,
-1833, 798, 800, 17741, -1833, 57, 17789, 3596, 3596, 3596,
16417, 3596, 802, 997, 807, -1833, 73, -1833, 18179, 125,
-1833, 995, 136, 881, -1833, 886, -1833, 18512, 15293, 15293,
819, 839, -1833, -1833, 18255, 13073, 15293, 15293, 15293, 15293,
15293, 137, 475, 69, -1833, 15472, 18512, 677, -1833, 16417,
-1833, 540, 556, -1833, -1833, -1833, -1833, 19349, 15293, 1010,
922, -1833, -1833, -1833, 87, 15293, 828, 829, 19784, 831,
2550, 833, 6410, 15293, -1833, 632, 830, 775, 632, 541,
491, -1833, 16417, 4256, 835, 11936, 16157, -1833, 14022, 852,
852, 852, 852, -1833, -1833, 2768, -1833, -1833, -1833, -1833,
-1833, 729, -1833, 15293, 15293, -1833, -1833, -1833, -1833, -1833,
-1833, -1833, -1833, -1833, 15293, 15293, 15293, 15293, 14201, 15293,
15293, 15293, 15293, 15293, 15293, 15293, 15293, 15293, 15293, 15293,
15293, 15293, 15293, 15293, 15293, 15293, 15293, 15293, 15293, 15293,
15293, 15293, 19425, 15293, -1833, 15293, 15293, 15293, 5384, 16417,
16417, 16417, 16417, 16417, 1189, 925, 795, 11560, 15293, 15293,
15293, 15293, 15293, 15293, 15293, 15293, 15293, 15293, 15293, 15293,
-1833, -1833, -1833, -1833, 2600, -1833, -1833, 11936, 11936, 15293,
15293, 18255, 856, 729, 14380, 5700, -1833, 15293, -1833, 862,
1049, 903, 863, 866, 15645, 70, 14559, -1833, 14738, -1833,
778, 869, 873, 3105, -1833, 384, 11936, -1833, 2616, -1833,
-1833, 17859, -1833, -1833, 12312, -1833, 15293, -1833, 973, 10530,
1065, 879, 19662, 1068, 110, 88, -1833, -1833, -1833, 913,
-1833, -1833, -1833, 4256, -1833, 613, 901, 1093, 18103, 16417,
-1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833, 911,
-1833, -1833, 909, 912, 917, 914, 921, 926, 109, 932,
929, 1770, 16408, -1833, -1833, 16417, 16417, 15293, 70, 104,
-1833, 18103, 1052, -1833, -1833, -1833, 70, 115, 119, 938,
939, 3188, 218, 941, 945, 722, 1013, 949, 70, 135,
950, 18733, 952, 1144, 1145, 953, 955, 957, 960, -1833,
1387, 16417, -1833, -1833, 1088, 3328, 67, -1833, -1833, -1833,
556, -1833, -1833, -1833, 1133, 1031, 985, 82, 1009, 15293,
1034, 1165, 975, -1833, 1016, -1833, 186, -1833, 983, 4256,
4256, 1170, 972, 87, -1833, 998, 1184, -1833, 4635, 242,
-1833, 439, 263, -1833, -1833, -1833, -1833, -1833, -1833, -1833,
1635, 4338, -1833, -1833, -1833, -1833, 1187, 1019, -1833, 18512,
503, 15293, 1000, 1196, 19784, 1193, 149, 1202, 1012, 1015,
1018, 19784, 1020, 3384, 6616, -1833, -1833, -1833, -1833, -1833,
-1833, 1079, 5057, 19784, 1022, 4969, 19923, 20014, 16706, 20095,
15293, 19736, 20168, 5077, 20238, 20271, 15979, 19432, 20335, 20335,
20335, 20335, 2926, 2926, 2926, 2926, 2926, 1135, 1135, 825,
825, 825, 153, 153, 153, -1833, 854, 1024, 1025, 18794,
1021, 1210, 14, 15293, 33, 749, 486, -1833, -1833, -1833,
1208, 922, -1833, 729, 18360, -1833, -1833, -1833, 16706, 16706,
16706, 16706, 16706, 16706, 16706, 16706, 16706, 16706, 16706, 16706,
16706, -1833, 15293, 364, -1833, 199, -1833, 749, 365, 1032,
1035, 1027, 5140, 156, 1037, -1833, 19784, 3970, -1833, 16417,
-1833, 70, 54, 18512, 19784, 18512, 18842, 1079, 83, 70,
204, -1833, 186, 1072, 1038, 15293, -1833, 225, -1833, -1833,
-1833, 6822, 724, -1833, -1833, 19784, 19784, 223, -1833, -1833,
-1833, 15293, 1136, 18027, 18103, 16417, 10736, 1039, 1040, -1833,
1233, 16050, 1105, -1833, 1082, -1833, 1236, 1046, 3819, 4256,
18103, 18103, 18103, 18103, 18103, 1048, 1179, 1180, 1181, 1186,
1188, 1055, 1058, 18103, 32, -1833, -1833, -1833, -1833, -1833,
-1833, -1833, 36, -1833, 19878, -1833, -1833, 43, -1833, 7028,
16229, 1057, 16408, -1833, 16408, -1833, 16408, -1833, 16417, 16417,
16408, -1833, 16408, 16408, 16417, -1833, 1253, 1060, -1833, 433,
-1833, -1833, 5237, -1833, 19878, 1252, 18512, 1074, -1833, -1833,
-1833, -1833, -1833, -1833, -1833, -1833, -1833, 1085, 1264, 16417,
16229, 1078, 18255, 18436, 1268, -1833, 15293, -1833, 15293, -1833,
15293, -1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833, 1087,
-1833, 15293, -1833, -1833, 5998, -1833, 4256, 16229, 1092, -1833,
-1833, -1833, -1833, 1119, 1283, 1100, 15293, 19349, -1833, -1833,
5384, -1833, 1097, -1833, 4256, -1833, 1107, 7234, 1269, 81,
-1833, 4256, -1833, 193, 2600, 2600, -1833, 4256, -1833, -1833,
70, -1833, -1833, 1234, 19784, -1833, 12115, -1833, 18103, 14022,
852, 14022, -1833, 852, 852, -1833, 12518, -1833, -1833, 7440,
-1833, 140, 1108, 16229, 1031, -1833, -1833, -1833, -1833, 20168,
15293, -1833, -1833, 15293, -1833, 15293, -1833, 5329, 1109, 11936,
1013, 1274, 1031, 4256, 1295, 1079, 16417, 19425, 70, 5557,
1111, 353, 1112, -1833, -1833, 1298, 5063, 5063, 3970, -1833,
-1833, -1833, 1265, 1117, 1248, 1250, 1254, 1255, 1256, 108,
1128, 1130, 451, -1833, -1833, -1833, -1833, -1833, -1833, 1173,
-1833, -1833, -1833, -1833, 1334, 1146, 862, 70, 70, 14917,
1031, 2616, -1833, 2616, -1833, 5628, 738, 223, 11354, -1833,
7646, 1147, 7852, 1148, 18027, 18512, 1151, 1207, 70, 19878,
1333, -1833, -1833, -1833, -1833, 838, -1833, 93, 4256, 1168,
1215, 1195, 4256, 16417, 3583, -1833, -1833, 4256, 1351, 1167,
1192, 1194, 1187, 763, 763, 1296, 1296, 19011, 1171, 1360,
18103, 18103, 18103, 18103, 18103, 18103, 19349, 18103, 2849, 17052,
18103, 18103, 18103, 18103, 17905, 18103, 18103, 18103, 18103, 18103,
18103, 18103, 18103, 18103, 18103, 18103, 18103, 18103, 18103, 18103,
18103, 18103, 18103, 18103, 18103, 18103, 18103, 18103, 16417, -1833,
-1833, 1289, -1833, -1833, 1174, 1175, 1178, -1833, 1182, -1833,
-1833, 470, 1770, -1833, 1185, -1833, 18103, 70, -1833, -1833,
145, -1833, 121, 1365, -1833, -1833, 162, 1177, 70, 12715,
19784, 18903, -1833, 2623, -1833, 6204, 922, 1365, -1833, 568,
15293, 219, -1833, 19784, 1244, 1205, -1833, 1206, 1269, -1833,
-1833, -1833, 15114, 4256, 972, 17780, 1300, 97, 1392, 1326,
232, -1833, 749, 366, -1833, 749, -1833, 15293, 18512, 503,
15293, 19784, 19878, -1833, -1833, -1833, 5080, -1833, -1833, -1833,
-1833, -1833, -1833, 1211, 140, -1833, 1216, 140, 1214, 20168,
19784, 18951, 1218, 11936, 1219, 1223, 4256, 1224, 1209, 4256,
1031, -1833, 778, 421, 11936, 15293, -1833, -1833, -1833, -1833,
-1833, -1833, 1290, 1217, 1418, 1337, 3970, 3970, 3970, 3970,
3970, 3970, 1272, -1833, 19349, 3970, 498, 3970, -1833, -1833,
-1833, 18512, 19784, 1230, -1833, 223, 1401, 1357, 11354, -1833,
-1833, -1833, 1237, 15293, 1207, 70, 18255, 18027, 1235, 18103,
8058, 868, 1239, 15293, 100, 488, -1833, 1257, -1833, 4256,
16417, -1833, 1307, -1833, -1833, -1833, 4405, -1833, 1416, -1833,
1258, 18103, -1833, 18103, -1833, 1259, 1246, 1443, 19057, 1249,
19878, 1453, 1260, 1261, 1262, 1331, 1462, 1275, 1277, -1833,
-1833, -1833, 19117, 1276, 1469, 19970, 20058, 20131, 18103, 19832,
15646, 5739, 20304, 18444, 4861, 20366, 20366, 20366, 20366, 1346,
1346, 1346, 1346, 1346, 846, 846, 763, 763, 763, 1296,
1296, 1296, 1296, -1833, 1280, -1833, 1281, 1288, 1292, 1293,
-1833, -1833, 19878, 16417, 4256, 4256, -1833, 121, 16229, 1621,
-1833, 18255, -1833, -1833, 16706, 15293, 1278, -1833, 1294, 1850,
-1833, 130, 15293, -1833, -1833, 17377, -1833, 15293, -1833, 15293,
-1833, 972, 14022, 1297, 378, 852, 378, 379, -1833, -1833,
4256, 195, -1833, 1476, 1412, 15293, -1833, 1301, 1302, 1299,
70, 1234, 19784, 1269, 1306, -1833, 1308, 140, 15293, 11936,
1309, -1833, -1833, 922, -1833, -1833, 1311, 1314, 1303, -1833,
1310, 3970, -1833, 3970, -1833, -1833, 1313, 1315, 1488, 1361,
1316, -1833, 1508, 1317, 1319, 1322, -1833, 1380, 1336, 1524,
1339, -1833, -1833, 70, -1833, 1505, -1833, 1342, -1833, -1833,
1340, 1349, 165, -1833, -1833, 19878, 1350, 1362, -1833, 17521,
-1833, -1833, -1833, -1833, -1833, -1833, 1420, 4256, 4256, 1192,
1374, 4256, -1833, 19878, 19163, -1833, -1833, 18103, -1833, 18103,
-1833, 18103, -1833, -1833, -1833, -1833, 18103, 19349, -1833, -1833,
-1833, 18103, -1833, 18103, -1833, 20204, 18103, 1363, 8264, -1833,
-1833, -1833, -1833, 121, -1833, -1833, -1833, -1833, 693, 16336,
16229, 1449, 1451, 1454, 1455, -1833, 4042, 1398, 15871, -1833,
-1833, 1495, 925, 3496, 1466, 138, 141, 1379, 922, 795,
168, 19784, -1833, -1833, -1833, 1414, 17425, -1833, 17473, 19784,
-1833, 3536, -1833, 6616, 1499, 287, 1570, 1504, 15293, -1833,
19784, 11936, 11936, -1833, 1470, 1269, 1870, 1269, 1388, 19784,
1390, -1833, 1975, 1389, 2149, -1833, -1833, 140, -1833, -1833,
1456, -1833, -1833, 3970, -1833, 3970, -1833, 3970, -1833, -1833,
-1833, -1833, 3970, -1833, 19349, -1833, -1833, 2278, -1833, 8470,
-1833, -1833, -1833, -1833, 10942, -1833, -1833, -1833, 6822, 4256,
-1833, -1833, -1833, 1395, 18103, 19223, 19878, 19878, 19878, 1458,
19878, 19269, 20204, -1833, -1833, 121, 16229, 16229, 16417, -1833,
1578, 17206, 98, -1833, 16336, 922, 16791, -1833, 1415, -1833,
142, 1397, 150, -1833, 16705, -1833, -1833, -1833, 151, -1833,
-1833, 1403, -1833, 1399, -1833, 1592, 152, 729, 1495, 16526,
16526, -1833, 16526, -1833, -1833, 1593, 925, 4123, -1833, 15799,
-1833, -1833, -1833, -1833, 2978, -1833, 1595, 1527, 15293, -1833,
19784, 1411, 1419, 1413, 1269, 1417, -1833, 1470, 1269, -1833,
-1833, -1833, -1833, 2339, 1423, 3970, 1480, -1833, -1833, -1833,
1486, -1833, 6822, 11148, 10942, -1833, -1833, -1833, 6822, -1833,
-1833, 19878, 18103, 18103, 18103, 8676, 1425, 1427, -1833, 18103,
-1833, 16229, -1833, -1833, -1833, -1833, -1833, 4256, 1542, 4042,
-1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833,
-1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833,
-1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833,
-1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833,
-1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833,
-1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833,
-1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833,
-1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833,
-1833, -1833, -1833, -1833, 699, -1833, 1398, -1833, -1833, -1833,
-1833, -1833, 131, 636, -1833, 18103, 1531, -1833, 16898, 154,
1617, 1618, -1833, 4256, 729, 157, 1495, -1833, -1833, 1432,
1622, 15293, -1833, 19784, -1833, -1833, 189, 1433, 4256, 728,
1269, 1417, 15978, -1833, 1269, -1833, 3970, 3970, -1833, -1833,
-1833, -1833, 8882, 19878, 19878, 19878, -1833, -1833, -1833, 19878,
-1833, 3752, 1628, 1634, 1445, -1833, -1833, 18103, 16705, 16705,
1582, -1833, 1403, 1403, 721, -1833, -1833, -1833, 19878, 1632,
1468, 1459, -1833, 18103, 18103, -1833, 16898, -1833, 159, -1833,
18103, 19784, 1569, -1833, 1644, -1833, 1646, -1833, 512, -1833,
-1833, -1833, 1457, 728, -1833, 728, -1833, -1833, 9088, 1460,
1541, -1833, 1560, 1506, -1833, -1833, 1563, 4256, 1483, 1542,
-1833, -1833, 19878, -1833, -1833, 1497, -1833, 1638, -1833, -1833,
-1833, -1833, 18103, 722, -1833, 19878, 19878, 1477, -1833, 19878,
-1833, 224, 1475, 9294, 4256, -1833, 4256, -1833, 9500, -1833,
-1833, -1833, 1479, -1833, 1478, 1498, 16417, 795, 1500, -1833,
-1833, -1833, 19878, 1502, 163, -1833, 1598, -1833, -1833, -1833,
-1833, -1833, -1833, 9706, -1833, 16229, 1057, -1833, 1511, 16417,
739, -1833, -1833, 1482, 1674, 521, 163, -1833, -1833, 1614,
-1833, 16229, 1503, -1833, 1269, 166, -1833, 4256, -1833, -1833,
-1833, 4256, -1833, 1501, 1510, 160, -1833, 1417, 555, 1615,
197, 1269, 1509, -1833, 736, 4256, 4256, -1833, 427, 1685,
1625, 1417, -1833, -1833, -1833, -1833, 1629, 209, 1691, 1630,
15293, -1833, 736, 9912, 10118, -1833, 442, 1700, 1633, 15293,
-1833, 19784, -1833, -1833, -1833, 1704, 1636, 15293, -1833, 19784,
15293, -1833, 19784, 19784
};
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
Performed when YYTABLE does not specify something else to do. Zero
means the default is an error. */
static const yytype_uint16 yydefact[] =
{
2, 0, 5, 1, 3, 0, 0, 0, 0, 0,
0, 204, 474, 0, 915, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1010,
998, 0, 779, 0, 785, 786, 787, 29, 852, 986,
987, 171, 172, 788, 0, 152, 0, 0, 0, 0,
30, 0, 0, 0, 0, 223, 0, 0, 0, 0,
0, 0, 442, 443, 444, 441, 440, 439, 0, 0,
0, 0, 252, 0, 0, 0, 37, 38, 40, 41,
39, 792, 794, 795, 789, 790, 0, 0, 0, 796,
791, 0, 762, 32, 33, 34, 36, 35, 0, 793,
0, 0, 0, 0, 0, 797, 445, 584, 31, 0,
170, 140, 0, 780, 0, 0, 4, 126, 128, 851,
0, 761, 0, 6, 0, 0, 222, 7, 9, 8,
10, 0, 0, 437, 969, 488, 0, 0, 0, 0,
0, 0, 0, 0, 0, 544, 486, 974, 975, 566,
559, 560, 561, 562, 565, 563, 564, 469, 569, 0,
468, 943, 763, 770, 0, 854, 558, 436, 946, 947,
959, 487, 0, 0, 0, 490, 489, 944, 945, 942,
982, 985, 548, 853, 11, 442, 443, 444, 0, 0,
36, 0, 126, 222, 0, 1050, 487, 1051, 0, 1053,
1054, 568, 482, 0, 475, 480, 0, 0, 530, 531,
532, 533, 29, 986, 788, 765, 37, 38, 40, 41,
39, 0, 0, 1074, 965, 763, 0, 764, 509, 0,
511, 549, 550, 551, 552, 553, 554, 555, 557, 0,
1014, 0, 861, 775, 242, 0, 1074, 466, 774, 768,
0, 784, 764, 993, 994, 1000, 992, 776, 0, 467,
0, 778, 556, 0, 205, 0, 0, 471, 205, 150,
473, 0, 0, 156, 158, 0, 0, 160, 0, 75,
76, 82, 83, 67, 68, 59, 80, 91, 92, 0,
62, 0, 66, 74, 72, 94, 86, 85, 57, 108,
81, 101, 102, 58, 97, 55, 98, 56, 99, 54,
103, 90, 95, 100, 87, 88, 61, 89, 93, 53,
84, 69, 104, 77, 106, 70, 60, 47, 48, 49,
50, 51, 52, 71, 107, 105, 110, 64, 45, 46,
73, 1127, 1128, 65, 1132, 44, 63, 96, 0, 79,
0, 126, 109, 1065, 1126, 0, 1129, 0, 0, 0,
162, 0, 0, 0, 213, 0, 0, 0, 0, 0,
0, 0, 0, 863, 0, 114, 116, 350, 0, 0,
349, 355, 0, 0, 253, 0, 256, 0, 0, 0,
0, 1071, 238, 250, 1006, 1010, 603, 633, 633, 603,
633, 0, 1035, 0, 799, 0, 0, 0, 1033, 0,
16, 0, 130, 230, 244, 251, 663, 596, 633, 0,
1059, 576, 578, 580, 919, 474, 488, 0, 0, 486,
487, 489, 205, 0, 989, 781, 0, 782, 0, 0,
0, 202, 0, 0, 132, 339, 0, 28, 0, 0,
0, 0, 0, 203, 221, 0, 249, 234, 248, 442,
445, 222, 438, 991, 0, 935, 192, 193, 194, 195,
196, 198, 199, 201, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 998, 0, 191, 991, 991, 1020, 0, 0,
0, 0, 0, 0, 0, 0, 435, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
508, 510, 920, 921, 0, 934, 933, 339, 339, 991,
0, 1006, 0, 222, 0, 0, 164, 0, 917, 912,
861, 0, 488, 486, 0, 1018, 0, 601, 860, 1009,
784, 488, 486, 487, 132, 0, 339, 465, 0, 936,
777, 0, 140, 292, 0, 583, 0, 167, 0, 205,
472, 0, 0, 0, 0, 0, 159, 190, 161, 1127,
1128, 1124, 1125, 0, 1131, 1117, 0, 0, 0, 0,
78, 43, 65, 42, 1066, 197, 200, 163, 140, 0,
180, 189, 0, 0, 0, 0, 0, 0, 117, 0,
0, 0, 862, 115, 18, 0, 111, 0, 351, 0,
165, 0, 0, 166, 254, 255, 1055, 0, 0, 488,
486, 487, 490, 489, 0, 1107, 262, 0, 1007, 0,
0, 0, 0, 861, 861, 0, 0, 0, 0, 168,
0, 0, 798, 1034, 852, 0, 0, 1032, 857, 1031,
129, 5, 13, 14, 0, 260, 0, 0, 589, 0,
0, 861, 0, 772, 0, 771, 766, 590, 0, 0,
0, 0, 0, 919, 136, 0, 863, 918, 1136, 464,
477, 491, 952, 973, 147, 139, 143, 144, 145, 146,
436, 0, 567, 855, 856, 127, 861, 0, 1075, 0,
0, 0, 0, 863, 340, 0, 0, 0, 488, 209,
210, 208, 486, 487, 205, 184, 182, 183, 185, 572,
224, 258, 0, 990, 0, 0, 514, 516, 515, 527,
0, 0, 547, 512, 513, 517, 519, 518, 536, 537,
534, 535, 538, 539, 540, 541, 542, 528, 529, 521,
522, 520, 523, 524, 526, 543, 525, 0, 0, 1024,
0, 861, 1058, 0, 1057, 1074, 949, 240, 232, 246,
0, 1059, 236, 222, 0, 478, 481, 483, 493, 496,
497, 498, 499, 500, 501, 502, 503, 504, 505, 506,
507, 923, 0, 922, 925, 948, 929, 1074, 926, 0,
0, 0, 0, 0, 0, 1052, 476, 910, 914, 860,
916, 463, 767, 0, 1013, 0, 1012, 258, 0, 767,
997, 996, 982, 985, 0, 0, 922, 925, 995, 926,
485, 294, 296, 136, 587, 586, 470, 0, 140, 276,
151, 473, 0, 0, 0, 0, 205, 288, 288, 157,
861, 0, 0, 1116, 0, 1113, 861, 0, 1087, 0,
0, 0, 0, 0, 859, 0, 37, 38, 40, 41,
39, 0, 0, 0, 801, 805, 806, 807, 810, 808,
809, 812, 0, 800, 134, 850, 811, 1074, 1130, 205,
0, 0, 0, 21, 0, 22, 0, 19, 0, 112,
0, 20, 0, 0, 0, 123, 863, 0, 121, 116,
113, 118, 0, 348, 356, 353, 0, 0, 1044, 1049,
1046, 1045, 1048, 1047, 12, 1105, 1106, 0, 861, 0,
0, 0, 1006, 1003, 0, 600, 0, 614, 860, 602,
860, 632, 617, 626, 629, 620, 1043, 1042, 1041, 0,
1037, 0, 1038, 1040, 205, 5, 0, 0, 0, 658,
659, 668, 667, 0, 0, 486, 0, 860, 595, 599,
0, 623, 0, 1060, 0, 577, 0, 205, 1094, 919,
320, 1136, 1135, 0, 0, 0, 988, 860, 1077, 1073,
342, 336, 337, 341, 343, 760, 862, 338, 0, 0,
0, 0, 463, 0, 0, 491, 0, 953, 212, 205,
142, 919, 0, 0, 260, 574, 226, 931, 932, 546,
0, 640, 641, 0, 638, 860, 1019, 0, 0, 339,
262, 0, 260, 0, 0, 258, 0, 998, 494, 0,
0, 950, 951, 983, 984, 0, 0, 0, 898, 868,
869, 870, 877, 0, 37, 38, 40, 41, 39, 0,
0, 0, 883, 889, 890, 891, 894, 892, 893, 0,
881, 879, 880, 904, 861, 0, 912, 1017, 1016, 0,
260, 0, 937, 0, 783, 0, 298, 0, 205, 148,
205, 0, 205, 0, 0, 0, 0, 268, 269, 280,
0, 140, 278, 177, 288, 0, 288, 0, 860, 0,
0, 0, 0, 0, 860, 1115, 1118, 1083, 861, 0,
1078, 0, 861, 833, 834, 831, 832, 867, 0, 861,
859, 607, 635, 635, 607, 635, 598, 635, 0, 0,
1026, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1121,
214, 0, 217, 181, 0, 0, 0, 119, 0, 124,
125, 117, 862, 122, 0, 352, 0, 1056, 169, 1072,
1107, 1098, 1102, 261, 263, 362, 0, 0, 1004, 0,
605, 0, 1036, 0, 17, 205, 1059, 259, 362, 0,
0, 0, 767, 592, 0, 773, 1061, 0, 1094, 581,
135, 137, 0, 0, 0, 1136, 0, 0, 325, 323,
925, 938, 1074, 925, 939, 1074, 1076, 991, 0, 0,
0, 344, 133, 207, 209, 210, 487, 188, 206, 186,
187, 211, 141, 0, 919, 257, 0, 919, 0, 545,
1023, 1022, 0, 339, 0, 0, 0, 0, 0, 0,
260, 228, 784, 924, 339, 0, 873, 874, 875, 876,
884, 885, 902, 0, 861, 0, 898, 611, 637, 637,
611, 637, 0, 872, 906, 637, 0, 860, 909, 911,
913, 0, 1011, 0, 924, 0, 0, 0, 205, 295,
588, 153, 0, 473, 268, 270, 1006, 0, 0, 0,
205, 0, 0, 0, 0, 0, 282, 0, 1122, 0,
0, 1108, 0, 1114, 1112, 1079, 860, 1085, 0, 1086,
0, 0, 803, 860, 858, 0, 0, 861, 0, 0,
847, 861, 0, 0, 0, 0, 861, 0, 0, 813,
848, 849, 1030, 0, 861, 816, 818, 817, 0, 0,
814, 815, 819, 821, 820, 837, 838, 835, 836, 839,
840, 841, 842, 843, 828, 829, 823, 824, 822, 825,
826, 827, 830, 1120, 0, 140, 0, 0, 0, 0,
120, 23, 354, 0, 0, 0, 1099, 1104, 0, 436,
1008, 1006, 479, 484, 492, 0, 0, 15, 0, 436,
671, 0, 0, 673, 666, 0, 669, 0, 665, 0,
1063, 0, 0, 0, 969, 544, 0, 490, 1095, 585,
1136, 0, 326, 327, 0, 0, 321, 0, 0, 0,
346, 347, 345, 1094, 0, 362, 0, 919, 0, 339,
0, 980, 362, 1059, 362, 1062, 0, 0, 0, 495,
0, 0, 887, 860, 897, 878, 0, 0, 861, 0,
0, 896, 861, 0, 0, 0, 871, 0, 0, 861,
0, 882, 903, 1015, 362, 0, 140, 0, 291, 277,
0, 0, 0, 267, 173, 281, 0, 0, 284, 0,
289, 290, 140, 283, 1123, 1109, 0, 0, 1082, 1081,
0, 0, 1134, 866, 865, 802, 615, 860, 606, 0,
618, 860, 634, 627, 630, 621, 0, 860, 597, 804,
624, 0, 639, 860, 1025, 845, 0, 0, 205, 24,
25, 26, 27, 1101, 1096, 1097, 1100, 264, 0, 0,
0, 443, 441, 440, 439, 434, 0, 0, 0, 239,
361, 0, 0, 433, 0, 0, 0, 0, 1059, 436,
0, 604, 1039, 358, 245, 661, 0, 664, 0, 591,
579, 487, 138, 205, 0, 0, 330, 319, 0, 322,
329, 339, 339, 335, 571, 1094, 436, 1094, 0, 1021,
0, 979, 436, 0, 436, 1064, 362, 919, 976, 901,
900, 886, 616, 860, 610, 0, 619, 860, 636, 628,
631, 622, 0, 888, 860, 905, 625, 436, 140, 205,
149, 154, 175, 271, 205, 279, 285, 140, 287, 0,
1110, 1080, 1084, 0, 0, 0, 609, 846, 594, 0,
1029, 1028, 844, 140, 218, 1103, 0, 0, 0, 1067,
0, 0, 0, 265, 0, 1059, 0, 399, 395, 401,
762, 36, 0, 389, 0, 394, 398, 411, 0, 409,
414, 0, 413, 0, 412, 453, 0, 222, 0, 0,
0, 367, 0, 368, 369, 0, 0, 435, 1005, 0,
662, 660, 672, 670, 0, 331, 332, 0, 0, 317,
328, 0, 0, 0, 1094, 1088, 235, 571, 1094, 981,
241, 358, 247, 436, 0, 0, 0, 613, 895, 908,
0, 243, 293, 205, 205, 140, 274, 174, 286, 1111,
1133, 864, 0, 0, 0, 205, 0, 0, 462, 0,
1068, 0, 379, 383, 459, 460, 393, 0, 0, 0,
374, 721, 722, 720, 723, 724, 741, 743, 742, 712,
684, 682, 683, 702, 717, 718, 678, 689, 690, 692,
691, 759, 711, 695, 693, 694, 696, 697, 698, 699,
700, 701, 703, 704, 705, 706, 707, 708, 710, 709,
679, 680, 681, 685, 686, 688, 758, 726, 727, 731,
732, 733, 734, 735, 736, 719, 738, 728, 729, 730,
713, 714, 715, 716, 739, 740, 744, 746, 745, 747,
748, 725, 750, 749, 752, 754, 753, 687, 757, 755,
756, 751, 737, 677, 406, 674, 0, 375, 427, 428,
426, 419, 0, 420, 376, 0, 0, 363, 0, 0,
0, 0, 458, 0, 222, 0, 0, 231, 357, 0,
0, 0, 318, 334, 977, 978, 0, 0, 0, 0,
1094, 1088, 0, 237, 1094, 899, 0, 0, 140, 272,
155, 176, 205, 608, 593, 1027, 216, 377, 378, 456,
266, 0, 861, 861, 0, 402, 390, 0, 0, 0,
408, 410, 0, 0, 415, 422, 423, 421, 454, 451,
1069, 0, 364, 0, 0, 461, 0, 365, 0, 359,
0, 333, 0, 656, 863, 136, 863, 1090, 0, 429,
136, 225, 0, 0, 233, 0, 612, 907, 205, 0,
178, 380, 126, 0, 381, 382, 0, 860, 0, 860,
404, 400, 405, 675, 676, 0, 391, 424, 425, 417,
418, 416, 0, 1107, 370, 457, 455, 0, 366, 360,
657, 862, 0, 205, 862, 1089, 0, 1093, 205, 136,
227, 229, 0, 275, 0, 220, 0, 436, 0, 396,
403, 407, 452, 0, 919, 372, 0, 654, 570, 573,
1091, 1092, 430, 205, 273, 0, 0, 179, 387, 0,
435, 397, 1070, 0, 863, 447, 919, 655, 575, 0,
219, 0, 0, 386, 1094, 919, 302, 1136, 450, 449,
448, 1136, 446, 0, 0, 0, 385, 1088, 447, 0,
0, 1094, 0, 384, 0, 1136, 1136, 308, 0, 307,
305, 1088, 140, 431, 136, 371, 0, 0, 309, 0,
0, 303, 0, 205, 205, 313, 0, 312, 301, 0,
304, 311, 373, 215, 432, 314, 0, 0, 299, 310,
0, 300, 316, 315
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
-1833, -1833, -1833, -565, -1833, -1833, -1833, 537, -47, -31,
710, -1833, -186, -520, -1833, -1833, 519, 500, 1929, -1833,
2904, -1833, -810, -1833, -538, -1833, -699, 23, -1833, -1833,
-1833, -1833, -1833, -1833, -1833, -1833, -953, -1833, -1833, -910,
-313, -1833, -1833, -1833, -323, -1833, -1833, -179, 111, 49,
-1833, -1833, -1833, -1833, -1833, -1833, 52, -1833, -1833, -1833,
-1833, -1833, -1833, 56, -1833, -1833, 1212, 1220, 1221, -87,
-752, -944, 681, 750, -325, 403, -1015, -1833, -26, -1833,
-1833, -1833, -1833, -779, 222, -1833, -1833, -1833, -1833, -306,
-1833, -605, -1833, 493, -440, -1833, -1833, 1125, -1833, 12,
-1833, -1833, -1125, -1833, -1833, -1833, -1833, -1833, -1833, -1833,
-1833, -24, -1833, 75, -1833, -1833, -1833, -1833, -1833, -110,
-1833, 184, -993, -1833, -1300, -333, -1833, -138, 96, -130,
-305, -1832, -1548, -1833, -1833, -1833, 194, -93, -73, -11,
-783, -18, -1833, -1833, 37, -1833, -9, -355, -1833, 17,
-5, -63, -81, 29, -1833, -1833, -1833, -1833, -1833, -1833,
-1833, -1833, -1833, -625, -895, -1833, -1833, -1833, -1833, -1833,
689, 1378, -1833, 628, -1833, 468, -1833, -1833, -1833, -1833,
-1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833, -1833,
-1833, -1833, -1833, -1833, -1833, 397, -322, -467, -1833, -1833,
-1833, -1833, -1833, 551, -1833, -1833, -1833, -1833, -1833, -1833,
-1833, -1833, -981, -366, 2915, 35, -1833, 1098, -418, -1833,
-1833, -484, 3772, 3881, -1833, -652, -1833, -1833, 633, -445,
-681, -1833, -1833, 717, 480, -740, -1833, 482, -1833, -1833,
-1833, -1833, -1833, 696, -1833, -1833, -1833, 28, -928, -161,
-420, -413, -1833, -44, -115, -1833, -1833, 44, 47, 720,
-62, -1833, -1833, 18, -68, -1833, -362, 42, -387, 212,
-423, -1833, -1833, -446, 1394, -1833, -1833, -1833, -1833, -1833,
928, 649, -1833, -1833, -1833, -358, -722, -1833, 1348, -1290,
-160, -58, -180, 916, -1833, -1833, -1833, -1798, -1833, -217,
-741, -1341, -205, 226, -1833, 591, 666, -1833, -1833, -1833,
-1833, 614, -1833, 1718, -799
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
-1, 1, 2, 4, 116, 975, 671, 192, 1689, 785,
372, 373, 374, 375, 926, 927, 928, 118, 119, 120,
121, 122, 997, 1240, 432, 1029, 705, 706, 579, 268,
1763, 585, 1664, 1764, 2025, 911, 124, 125, 726, 727,
735, 365, 608, 1980, 1193, 1415, 2047, 455, 193, 707,
1032, 1278, 1488, 128, 674, 1051, 708, 741, 1055, 646,
1050, 247, 560, 709, 675, 1052, 457, 392, 414, 131,
1034, 978, 951, 1213, 1692, 1338, 1117, 1920, 1767, 860,
1123, 584, 869, 1125, 1532, 852, 1106, 1109, 1327, 2053,
2054, 695, 696, 1013, 722, 723, 379, 380, 382, 1729,
1898, 1899, 1429, 1590, 2034, 2056, 1931, 1984, 1985, 1986,
1702, 1703, 1704, 1705, 1933, 1934, 1940, 1996, 1708, 1709,
1713, 1881, 1882, 1883, 1971, 2095, 1591, 1592, 194, 133,
2071, 1594, 1716, 1595, 1596, 1597, 1598, 134, 135, 654,
581, 136, 137, 138, 139, 140, 141, 142, 143, 261,
144, 145, 146, 1744, 147, 1031, 1277, 148, 692, 693,
694, 265, 424, 575, 680, 681, 1376, 682, 1377, 149,
150, 652, 653, 1366, 1367, 1497, 1498, 151, 895, 1083,
152, 896, 1084, 153, 897, 1085, 154, 898, 1086, 155,
899, 1087, 156, 900, 1088, 655, 1369, 1500, 157, 901,
158, 159, 1964, 160, 676, 1731, 677, 1229, 984, 1448,
1444, 1874, 1875, 161, 162, 163, 250, 164, 251, 262,
436, 567, 165, 1370, 1371, 905, 906, 166, 1148, 559,
623, 1149, 1091, 1300, 1092, 1501, 1502, 1303, 1304, 1094,
1508, 1509, 1095, 828, 550, 206, 207, 710, 698, 534,
1250, 1251, 816, 817, 465, 168, 253, 169, 170, 196,
172, 173, 174, 175, 176, 177, 178, 179, 180, 181,
744, 257, 258, 649, 241, 242, 780, 781, 1383, 1384,
407, 408, 969, 182, 637, 183, 691, 184, 355, 1900,
1951, 393, 444, 716, 717, 1138, 1139, 1909, 1966, 1967,
1244, 1426, 947, 1427, 948, 949, 875, 876, 877, 356,
357, 908, 594, 1002, 1003
};
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule whose
number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_int16 yytable[] =
{
195, 197, 462, 199, 200, 201, 202, 204, 205, 352,
208, 209, 210, 211, 542, 1000, 231, 232, 233, 234,
235, 236, 237, 238, 240, 353, 259, 123, 429, 515,
686, 449, 167, 266, 851, 1030, 426, 229, 229, 267,
415, 431, 1017, 1110, 1242, 419, 420, 275, 362, 278,
264, 683, 363, 127, 366, 685, 129, 535, 536, 687,
130, 450, 451, 269, 462, 249, 564, 995, 273, 1054,
909, 1245, 256, 458, 254, 401, 837, 255, 1113, 1141,
514, 267, 777, 778, 775, 1100, 1576, 1093, 996, 1127,
1276, 427, 1234, 730, 361, 823, 568, 819, 820, 1334,
132, 925, 930, 1439, 428, 830, 974, 1781, 1287, 1263,
429, 1268, -78, 1973, 814, 126, 821, -78, 426, 865,
867, 815, -43, 431, 936, -42, 844, -43, 576, 14,
-42, 446, 1530, 576, 629, 14, 980, 736, 737, 738,
1942, 553, 452, 569, 953, 632, 576, 1720, 847, 552,
1722, -392, 402, 463, 431, 848, 1323, 1242, 1019, 1789,
1876, 1886, -956, 1886, 562, 953, 1886, 1943, 1886, 1781,
1889, 953, 561, 609, 953, 1090, 625, 953, 842, 1895,
1463, 613, 615, 617, 1605, 620, 428, 377, 14, 381,
532, 533, 551, 545, -1074, 945, 946, -110, 1159, 1312,
1343, 1344, 1246, 532, 533, 1188, 532, 533, 959, 961,
502, 14, 918, -110, 14, 443, -109, 428, 198, 532,
533, 3, 503, 2072, 1424, 1425, 443, 1962, 662, 405,
406, 1247, -109, 1615, -1074, 2088, 988, 610, 1160, 626,
428, 661, 539, 461, 463, 1203, 2072, 2106, -653, 981,
-999, -651, -642, -968, -771, 571, 539, 229, 571, 580,
404, 1375, 2036, 516, 982, 267, 582, 1313, -765, -958,
973, 1008, 1963, 1464, -1002, 919, 1248, -862, 1616, 2084,
2089, -862, 742, -324, 983, 464, 593, 573, -650, 1690,
868, 578, 2107, 2102, -956, -1001, 1346, 416, 1241, 1782,
1783, 1531, -940, 1290, -78, 543, -954, 2037, 640, 378,
866, 352, -463, -957, -43, 937, 639, -42, -955, 938,
1112, 643, 1523, 447, 434, 577, 630, 604, 1302, -860,
1272, 1944, 1453, -953, -766, 954, 1046, 633, 659, 1721,
-324, -582, 1723, -392, 1576, 1341, 1487, 1345, 1958, 1020,
1626, 1790, 1877, 1887, 202, 1952, 1065, 1632, 1957, 1634,
2008, 2083, 1430, -306, 824, 1663, -862, 732, 1728, 1249,
1736, 1617, 260, 2090, 540, 728, 464, 638, 532, 533,
431, -965, -999, 267, 428, 2108, 462, 1446, 540, 1657,
240, 651, 267, 267, 651, 267, 229, 740, -772, 352,
665, -958, 1199, 1200, 1784, 229, -1002, 642, 213, 40,
1225, 1241, 229, 267, -764, 353, 1090, 538, 942, 1507,
204, 1447, 263, -960, 229, 1129, 1273, -1001, 711, 1890,
1891, 1135, 1892, -650, -940, -964, -941, 270, -954, 729,
724, -463, -963, 731, -463, -957, 1461, -970, 463, -650,
-955, -966, 697, 415, 790, 791, 458, 383, 743, 745,
271, 784, -967, 1737, 272, -953, 384, 213, 40, 746,
747, 748, 749, 751, 752, 753, 754, 755, 756, 757,
758, 759, 760, 761, 762, 763, 764, 765, 766, 767,
768, 769, 770, 771, 772, 773, 774, 1451, 776, 795,
743, 743, 779, 1211, 1438, 364, 1216, 352, 797, -652,
2098, 1753, 798, 799, 800, 801, 802, 803, 804, 805,
806, 807, 808, 809, 810, 2115, 2016, 433, 132, 387,
112, 421, 724, 724, 743, 822, 625, 249, 1004, 798,
1005, 117, 826, 126, 256, 660, 254, -927, -930, 255,
1520, 834, -972, 836, 796, -960, -961, 1540, 388, 229,
376, 724, 538, -927, -930, 854, 1302, 1499, -941, 855,
1499, 856, 515, 918, 402, 532, 533, 1512, 538, 1511,
1613, 734, 667, 1340, 385, 1253, 1011, 1012, 411, 112,
276, 412, 1254, 351, 386, 1343, 1344, 389, 985, 442,
686, -767, 859, 2099, -928, 1048, 390, 841, 2067, 1284,
391, 532, 533, -126, 1056, 1424, 1425, -126, 2116, 1459,
-928, 683, 932, 514, 402, 685, 793, 2017, 394, 687,
1380, 395, 667, 413, -126, 391, 442, 1060, -968, 1292,
391, 391, 2085, 422, 871, 2068, 2069, 2070, -773, 1318,
423, 405, 406, 396, 1090, 1090, 1090, 1090, 1090, 1090,
397, 1614, 1679, 1090, 1265, 1090, 1265, 1945, 391, 1474,
1004, 1005, 1476, 2020, 428, 2021, 398, 1101, 1103, 2068,
2069, 2070, 925, 1253, 1036, 1049, 1946, 402, -961, 1947,
1254, 1533, 399, 1357, 212, 403, 400, 1360, -1074, 714,
416, 405, 406, 417, 1364, 872, 442, 1267, 224, 224,
1269, 1270, 418, 1937, 564, 402, 1014, 50, 441, 443,
786, 697, 442, 1102, 171, 402, 1194, 1189, 1195, 445,
1196, 1938, 1624, 435, 1198, -1074, 1440, 229, -1074, 228,
230, 672, 673, 448, 549, 1039, 818, 453, 713, 1441,
1939, 1639, 1999, 1640, 216, 217, 218, 219, 220, 1760,
402, 1633, 466, 404, 405, 406, 786, 454, 667, 686,
1442, 2000, 945, 946, 2001, 467, 189, 843, 1047, 91,
849, 468, 93, 94, -643, 95, 190, 97, 469, 873,
683, 507, 405, 406, 685, 656, 470, 658, 687, 1107,
1108, 117, 405, 406, 471, 117, 516, 1059, 1489, 583,
55, 108, 229, 1325, 1326, 688, 1184, 1185, 1186, 459,
186, 187, 65, 66, 67, 472, 1610, 1686, 1687, 430,
132, 1372, 1187, 1374, 1469, 1378, 668, 405, 406, 1090,
1105, 1090, 1503, 1480, 1505, 126, 473, 402, 1510, -644,
580, 229, -645, 229, 1490, 438, 267, -648, 402, 1494,
459, 186, 187, 65, 66, 67, 667, 376, 376, 376,
618, 376, 1628, -646, 1111, -647, 1725, 1568, 499, 500,
501, 229, 502, 505, 1745, 506, 1747, 1265, 508, 1122,
1522, 537, 460, -962, 503, 603, 1181, 1182, 1183, 1184,
1185, 1186, -649, 1756, -765, 1757, 541, 1758, 548, 670,
409, 430, 1759, 546, 1030, 1187, 459, 186, 187, 65,
66, 67, 1548, 503, 405, 406, 1552, 686, 224, 1969,
1970, 1558, 443, 460, 554, 405, 406, 2093, 2094, 1564,
2063, 557, 430, 784, 1342, 1343, 1344, 132, 683, 1997,
1998, 1220, 685, 1221, 229, 856, 687, 1993, 1994, 555,
1252, 1255, 126, 558, -966, 563, 1223, 538, -763, 117,
229, 229, 565, 1785, 1527, 1343, 1344, 566, 1659, 715,
574, 1233, 587, 351, 171, 1600, -1119, 595, 171, 460,
598, 1090, 391, 1090, 1668, 1090, 599, 123, 1291, 605,
1090, 606, 167, 1907, 621, 132, 622, 1911, 624, 631,
1264, 1261, 1264, 634, 731, 1915, 731, 797, 635, 644,
126, 798, 645, 127, 689, 690, 129, 697, 699, 700,
130, 701, 1754, 703, -131, 1279, 712, 55, 1280, 1630,
1281, 437, 439, 440, 724, 603, 391, 788, 391, 391,
391, 391, 663, 1644, 734, 739, 669, 1648, 829, 697,
1242, 827, 662, 831, 1655, 1242, 832, 224, 857, 838,
132, 813, 1467, 839, 576, 1468, 224, 612, 614, 616,
861, 619, 864, 224, 663, 126, 669, 663, 669, 669,
1242, 603, 249, 132, 1322, 224, 593, 730, 628, 256,
878, 254, 879, 1090, 255, 846, 2055, 636, 126, 641,
910, 912, 1381, 913, 648, 915, 117, 226, 226, 914,
1762, 929, 929, 916, 1328, 132, 666, 917, 2055, 1768,
921, 1329, 229, 229, 920, 935, 907, 2078, 939, 940,
126, 943, 736, 737, 738, 1775, 944, 950, 952, 1454,
955, 1242, 171, 958, 960, 2013, 957, 962, 971, 963,
2018, 964, 931, 715, 965, 976, 977, 979, 733, 1972,
686, -788, 986, 1975, 987, 989, 1976, 1977, 990, 1455,
1456, 1741, 1742, 991, 994, 496, 497, 498, 499, 500,
501, 683, 502, 999, 998, 685, 1007, 968, 970, 687,
1015, 1432, 1235, 1009, 503, 1016, 132, 1018, 132, 2043,
1433, 1021, 1022, 1033, 1434, 1023, 818, 818, 1024, 1045,
1025, 126, 1053, 126, 1044, 1445, 1037, 1922, 1041, 1042,
224, 1063, 1061, 1264, -769, 1062, 1035, 731, 1104, 1114,
1124, 1126, 1128, 1132, 1133, 1134, 1136, 1150, 123, 1151,
1152, 1153, 743, 167, 1156, 1472, 1154, 1157, 1155, 1192,
1457, 648, 1202, 1204, 1090, 1090, 1206, 686, 2079, 1209,
212, 117, 2080, 1210, 127, 1208, 229, 129, 724, 391,
1215, 130, 1219, 2012, 2104, 2015, 2096, 2097, 683, 724,
1434, 1222, 685, 50, 1228, 1230, 687, 1231, 1236, 171,
1232, 1243, 697, 1238, 1257, 697, 1286, 1274, 1283, 1289,
1294, -971, 1295, 849, 1241, 849, 1306, 1305, 1307, 1241,
1308, 132, 580, 2077, 1309, 1310, 1311, 1314, 267, 1315,
216, 217, 218, 219, 220, 1316, 126, 226, 1529, 229,
2091, 535, 1515, 1317, 1241, 1337, 1319, 1339, 1331, 1333,
1336, 1518, 1348, 1349, 229, 229, 456, 1350, 93, 94,
1356, 95, 190, 97, 1082, 1187, 1096, 1358, -1135, 1363,
1359, 429, 1414, 2066, 1428, 1362, 1431, 1416, 1417, 426,
1978, 1418, 1449, 1462, 431, 1419, 1421, 108, 117, -1137,
-1137, -1137, -1137, -1137, 1179, 1180, 1181, 1182, 1183, 1184,
1185, 1186, 1120, 117, 1049, 1241, 1465, 1450, 224, 1466,
1485, 1473, 929, 1477, 929, 1187, 929, 1479, 1475, 1481,
929, 1492, 929, 929, 1201, 1482, 1484, 1493, 1491, 1072,
1601, 1506, 1514, 1516, 1517, 1524, 132, 1606, 1519, 1010,
1528, 1534, 1608, 729, 1609, 1537, 117, 731, 1541, 229,
1546, 126, 1547, 1550, 171, 1197, 715, 1599, 1542, 1545,
1620, 1726, 1551, 462, 1553, 1554, 1555, 1599, 212, 1556,
966, 1557, 967, 1629, 724, 1559, 226, 1560, 1563, 1562,
1567, 1602, 1569, 224, 212, 226, 1212, 1988, 1990, 1570,
1618, 50, 226, 1571, 1572, 1619, 1603, 1643, 1612, 1645,
1621, 1622, 1637, 1623, 226, 697, 1625, 50, 1627, 1631,
1638, 117, 1635, 1641, 1058, 684, 1636, 1647, 1652, 1642,
1646, 1649, 224, 1650, 224, 1593, 1651, 603, 216, 217,
218, 219, 220, 1654, 117, 1593, 1653, 1658, 1888, 1656,
1661, 813, 813, 1660, 216, 217, 218, 219, 220, 1662,
1672, 1665, 224, 1097, 2103, 1098, 93, 94, 1669, 95,
190, 97, 1694, 1666, -450, 1683, 117, -449, -448, 1707,
1878, 171, 93, 94, 1879, 95, 190, 97, 1715, 1719,
1724, 1730, 1735, 1118, 1738, 108, 171, 1739, 1748, 1743,
1749, 1751, 1779, 391, 1755, 1770, 1773, 462, 1787, 1788,
1884, 108, 1711, 1299, 1299, 1082, 1885, 1893, 1734, 1901,
1902, 1904, 1906, 1740, 1949, 1908, 724, 724, 1916, 1905,
34, 35, 36, 1914, 1917, 224, 1927, 1578, 1928, 171,
1778, 1953, 1954, 1959, 214, 1965, 1960, 1987, 846, 226,
846, 224, 224, 1989, 1780, 117, 2002, 117, 1991, 117,
1995, 2003, 2010, 2011, 1599, 2014, 1207, 2024, 2004, 2019,
1599, 2023, 1599, -388, 132, 697, 2027, 2029, 2026, 14,
1352, 2031, 648, 1218, 1943, 2038, 2035, 2045, 2046, 126,
2044, 2057, 2064, 2065, 2051, 1599, 2052, 1766, 2061, 81,
82, 83, 84, 85, 171, 1727, 603, 2074, 2087, 2100,
221, 2081, 929, 1717, 2076, 2109, 89, 90, 2101, 132,
2082, 2092, 2105, 2110, 2117, 1956, 2118, 171, 2120, 2121,
99, 1420, 1593, 2060, 126, 907, 792, 1227, 1593, 787,
1593, 1285, 789, 1903, 1579, 105, 2075, 1521, 1921, 1266,
1580, 1266, 459, 1581, 187, 1582, 1583, 1584, 1585, 171,
2073, 1667, 1471, 1593, 933, 132, 459, 63, 64, 65,
66, 67, 117, 1912, 132, 1936, 1941, 72, 509, 2112,
126, 1786, 1714, 2086, 358, 1695, 1910, 657, 1504, 126,
1443, 1599, 1373, 1365, 1301, 1495, 1919, 1766, 1496, 650,
1586, 1587, 1320, 1588, 725, 1142, 2007, 2040, 2033, 1685,
1354, 1423, 1413, 224, 224, 0, 0, 0, 0, 0,
511, 0, 0, 0, 0, 460, 0, 226, 0, 0,
0, 0, 0, 0, 1589, 0, 0, 0, 171, 460,
171, 0, 171, 0, 1118, 1335, 0, 1894, 0, 0,
0, 352, 0, 1082, 1082, 1082, 1082, 1082, 1082, 1593,
0, 212, 1082, 0, 1082, 0, 1578, 1950, 132, 0,
0, 0, 0, 0, 132, 117, 0, 0, 0, 0,
0, 132, 0, 126, 50, 0, 1578, 117, 0, 126,
0, 0, 922, 923, 0, 0, 126, 1536, 0, 2049,
0, 0, 226, 0, 0, 0, 1961, 0, 14, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 352,
0, 216, 217, 218, 219, 220, 0, 0, 14, 0,
462, 0, 0, 0, 0, 1950, 0, 0, 0, 0,
0, 226, 0, 226, 0, 0, 924, 0, 0, 93,
94, 0, 95, 190, 97, 171, 0, 224, 223, 223,
0, 0, 0, 0, 0, 0, 0, 0, 0, 246,
1573, 226, 1266, 1579, 0, 0, 0, 0, 108, 1580,
0, 459, 1581, 187, 1582, 1583, 1584, 1585, 1470, 0,
0, 1578, 0, 1579, 0, 246, 0, 0, 0, 1580,
0, 459, 1581, 187, 1582, 1583, 1584, 1585, 0, 0,
0, 0, 0, 0, 0, 0, 0, 591, 0, 592,
224, 0, 0, 0, 0, 0, 0, 0, 132, 1586,
1587, 0, 1588, 14, 0, 224, 224, 0, 1082, 0,
1082, 0, 0, 126, 226, 0, 0, 0, 0, 1586,
1587, 1513, 1588, 0, 460, 0, 0, 0, 171, 0,
226, 226, 0, 1604, 0, 0, 648, 1118, 0, 0,
171, 0, 697, 0, 460, 0, 0, 0, 597, 0,
0, 0, 0, 1746, 132, 0, 0, 0, 0, 0,
0, 0, 0, 0, 697, 684, 0, 0, 1579, 126,
0, 0, 0, 697, 1580, 2111, 459, 1581, 187, 1582,
1583, 1584, 1585, 0, 2119, 117, 0, 0, 0, 132,
0, 0, 2122, 0, 132, 2123, 351, 0, 0, 0,
224, 0, 0, 2050, 126, 1712, 0, 0, 0, 126,
0, 0, 0, 0, 0, 0, 0, 0, 0, 132,
0, 0, 0, 0, 1586, 1587, 0, 1588, 0, 0,
117, 648, 0, 0, 126, 1578, 0, 0, 0, 0,
0, 718, 0, 0, 358, 0, 0, 0, 223, 460,
0, 0, 1611, 0, 0, 0, 0, 0, 1750, 0,
1082, 0, 1082, 0, 1082, 0, 0, 0, 0, 1082,
0, 0, 0, 0, 0, 0, 117, 14, 0, 132,
132, 117, 0, 0, 0, 117, 0, 0, 0, 0,
0, 0, 226, 226, 126, 126, 0, 0, 246, 0,
246, 0, 0, 0, 0, 391, 0, 0, 603, 0,
0, 351, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1873, 0, 0, 0, 0, 0, 0, 1880, 0,
0, 0, 0, 0, 684, 0, 351, 351, 0, 351,
0, 0, 1579, 0, 0, 0, 351, 0, 1580, 0,
459, 1581, 187, 1582, 1583, 1584, 1585, 0, 0, 246,
0, 0, 0, 0, 1578, 0, 0, 0, 171, 0,
0, 0, 1082, 0, 0, 0, 0, 0, 0, 117,
117, 117, 0, 0, 0, 117, 0, 223, 0, 0,
0, 870, 117, 0, 0, 0, 223, 0, 1586, 1587,
0, 1588, 0, 223, 0, 0, 14, 0, 0, 0,
0, 0, 0, 171, 0, 223, 0, 0, 0, 0,
0, 0, 0, 460, 0, 1578, 223, 0, 0, 0,
0, 0, 1752, 0, 0, 0, 226, 0, 0, 459,
63, 64, 65, 66, 67, 0, 0, 0, 0, 0,
72, 509, 246, 0, 0, 246, 0, 0, 0, 171,
0, 0, 0, 0, 171, 0, 0, 14, 171, 0,
0, 1579, 0, 0, 0, 0, 0, 1580, 0, 459,
1581, 187, 1582, 1583, 1584, 1585, 0, 992, 993, 0,
0, 510, 684, 511, 0, 0, 0, 0, 0, 226,
0, 0, 0, 0, 0, 603, 0, 512, 0, 513,
0, 246, 460, 0, 226, 226, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1586, 1587, 351,
1588, 0, 1579, 1082, 1082, 0, 0, 0, 1580, 117,
459, 1581, 187, 1582, 1583, 1584, 1585, 0, 1982, 0,
223, 0, 460, 0, 0, 1873, 1873, 0, 0, 1880,
1880, 1761, 171, 171, 171, 0, 0, 0, 171, 0,
0, 0, 0, 603, 0, 171, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1586, 1587,
0, 1588, 0, 0, 0, 117, 0, 0, 0, 0,
0, 0, 246, 0, 246, 0, 0, 894, 0, 226,
0, 0, 0, 460, 0, 0, 0, 0, 0, 0,
0, 0, 1913, 0, 0, 0, 0, 0, 0, 0,
117, 0, 0, 0, 0, 117, 0, 0, 0, 0,
894, 0, 0, 2048, 544, 518, 519, 520, 521, 522,
523, 524, 525, 526, 527, 528, 529, 0, 0, 0,
117, 0, 0, 0, 0, 0, 2062, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1140, 718, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 530,
531, 0, 0, 0, 0, 0, 0, 0, 246, 246,
0, 0, 0, 0, 0, 0, 0, 246, 0, 0,
0, 0, 0, 474, 475, 476, 0, 0, 0, 0,
117, 117, 171, 0, 0, 0, 0, 0, 223, 0,
0, 0, 0, 477, 478, 684, 479, 480, 481, 482,
483, 484, 485, 486, 487, 488, 489, 490, 491, 492,
493, 494, 495, 496, 497, 498, 499, 500, 501, 0,
502, 212, 0, 213, 40, 0, 532, 533, 0, 0,
0, 0, 503, 0, 1226, 0, 0, 212, 171, 213,
40, 0, 0, 0, 50, 0, 0, 0, 0, 0,
0, 0, 1237, 0, 0, 0, 0, 0, 0, 0,
50, 0, 0, 223, 0, 1256, 0, 0, 0, 0,
0, 0, 0, 171, 0, 0, 0, 0, 171, 0,
0, 216, 217, 218, 219, 220, 0, 0, 0, 0,
702, 0, 684, 0, 0, 0, 246, 216, 217, 218,
219, 220, 223, 171, 223, 0, 0, 811, 0, 93,
94, 1288, 95, 190, 97, 0, 0, 0, 0, 0,
0, 0, 0, 811, 0, 93, 94, 0, 95, 190,
97, 0, 223, 894, 0, 0, 0, 0, 108, 0,
246, 0, 812, 0, 0, 112, 0, 246, 246, 894,
894, 894, 894, 894, 108, 0, 0, 0, 845, 0,
0, 112, 894, 171, 171, 0, 0, 1436, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 246,
0, 0, 0, 0, 0, 0, 1347, 0, 0, 212,
1351, 0, 0, 0, 0, 1355, 0, 0, 0, 1161,
1162, 1163, 0, 0, 0, 223, 0, 0, 0, 0,
0, 0, 50, 0, 0, 0, 0, 0, 0, 246,
1164, 223, 223, 1165, 1166, 1167, 1168, 1169, 1170, 1171,
1172, 1173, 1174, 1175, 1176, 1177, 1178, 1179, 1180, 1181,
1182, 1183, 1184, 1185, 1186, 246, 246, 0, 0, 216,
217, 218, 219, 220, 0, 0, 223, 0, 1187, 0,
0, 0, 0, 246, 0, 0, 0, 0, 0, 0,
246, 0, 0, 0, 225, 225, 246, 93, 94, 0,
95, 190, 97, 0, 0, 248, 0, 894, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
354, 1458, 246, 0, 0, 0, 108, 739, 0, -1137,
-1137, -1137, -1137, -1137, 494, 495, 496, 497, 498, 499,
500, 501, 246, 502, 0, 0, 246, 0, 474, 475,
476, 0, 0, 0, 0, 503, 0, 246, 0, 0,
0, 0, 0, 0, 1483, 0, 0, 1486, 477, 478,
0, 479, 480, 481, 482, 483, 484, 485, 486, 487,
488, 489, 490, 491, 492, 493, 494, 495, 496, 497,
498, 499, 500, 501, 0, 502, 0, 0, 0, 0,
0, 0, 0, 223, 223, 0, 0, 503, 0, 1379,
0, 0, 0, 0, 0, 0, 0, 246, 0, 0,
0, 246, 0, 246, 0, 0, 246, 1535, 0, 0,
0, 0, 0, 0, 1539, 0, 0, 0, 0, 894,
894, 894, 894, 894, 894, 223, 894, 0, 0, 894,
894, 894, 894, 894, 894, 894, 894, 894, 894, 894,
894, 894, 894, 894, 894, 894, 894, 894, 894, 894,
894, 894, 894, 894, 894, 894, 894, 0, 0, 544,
518, 519, 520, 521, 522, 523, 524, 525, 526, 527,
528, 529, 0, 0, 0, 894, 212, 0, 0, 0,
0, 0, 1574, 1575, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 225, 0, 0, 0, 0, 50,
0, 0, 0, 0, 530, 531, 0, 0, 0, 0,
0, 0, 246, 0, 246, 0, 0, 0, 0, 504,
0, 1038, 0, 0, 0, 0, 0, 223, 0, 0,
0, 0, 0, 354, 0, 354, 216, 217, 218, 219,
220, 0, 544, 518, 519, 520, 521, 522, 523, 524,
525, 526, 527, 528, 529, 246, 0, 0, 246, 0,
0, 409, 0, 0, 93, 94, 0, 95, 190, 97,
0, 0, 0, 0, 0, 246, 246, 246, 246, 246,
246, 532, 533, 223, 246, 0, 246, 530, 531, 0,
223, 0, 0, 108, 354, 1670, 1671, 410, 0, 1673,
0, 0, 0, 0, 0, 223, 223, 0, 894, 0,
0, 0, 0, 0, 0, 0, 0, 0, 246, 0,
0, 0, 0, 0, 0, 246, 0, 0, 0, 0,
894, 0, 894, 225, 0, 0, 0, 1691, 0, 0,
0, 0, 225, 0, 0, 840, 0, 0, 0, 225,
0, 1718, 0, 0, 0, 0, 0, 894, 0, 0,
0, 225, 0, 0, 532, 533, 0, 0, 0, 0,
0, 0, 225, 0, 0, 0, 0, 0, 474, 475,
476, 0, 0, 0, 0, 0, 0, 354, 0, 0,
354, 0, 0, 246, 246, 0, 0, 246, 477, 478,
223, 479, 480, 481, 482, 483, 484, 485, 486, 487,
488, 489, 490, 491, 492, 493, 494, 495, 496, 497,
498, 499, 500, 501, 0, 502, 0, 1769, 941, 246,
0, 0, 0, 0, 0, 0, 0, 503, 1026, 518,
519, 520, 521, 522, 523, 524, 525, 526, 527, 528,
529, 0, 1691, 0, 0, 0, 0, 248, 0, 0,
246, 0, 246, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1691, 1691, 0,
1691, 0, 0, 530, 531, 1896, 0, 1691, 0, 0,
0, 0, 0, 0, 0, 0, 225, 0, 0, 0,
0, 0, 0, 0, 0, 0, 246, 246, 0, 0,
246, 0, 0, 0, 0, 0, 894, 0, 894, 0,
894, 0, 0, 0, 0, 894, 223, 0, 0, 0,
894, 0, 894, 0, 0, 894, 0, 354, 0, 874,
0, 0, 0, 0, 0, 1932, 0, 0, 246, 246,
0, 0, 0, 902, 0, 246, 0, 0, 0, 0,
532, 533, 246, 0, 0, 0, 0, 289, 0, 0,
0, 972, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 902, 0, 0, 0,
1026, 518, 519, 520, 521, 522, 523, 524, 525, 526,
527, 528, 529, 0, 291, 0, 0, 0, 0, 0,
0, 0, 246, 0, 246, 0, 246, 212, 0, 0,
0, 246, 0, 223, 1027, 0, 0, 0, 0, 0,
0, 0, 0, 354, 354, 530, 531, 0, 246, 0,
50, 0, 354, 894, 0, 0, 0, 0, -435, 0,
0, 1955, 0, 0, 871, 246, 246, 459, 186, 187,
65, 66, 67, 246, 0, 246, 1968, 0, 0, 0,
1691, 0, 0, 0, 225, 0, 589, 216, 217, 218,
219, 220, 590, 0, 0, 0, 0, 0, 246, 246,
0, 246, 0, 0, 0, 0, 246, 0, 246, 189,
0, 0, 91, 344, 212, 93, 94, 0, 95, 190,
97, 0, 532, 533, 0, 872, 0, 212, 0, 0,
0, 0, 0, 348, 246, 0, 0, 50, 0, 0,
460, 0, 0, 0, 108, 350, 0, 0, 0, 0,
50, 894, 894, 894, 0, 2028, 0, 0, 894, 225,
246, 0, 0, 0, 0, 0, 246, 0, 246, 0,
0, 0, 0, 0, 216, 217, 218, 219, 220, 0,
0, 0, 1968, 0, 2041, 0, 702, 216, 217, 218,
219, 220, 1089, 0, 0, 0, 189, 0, 225, 91,
225, 0, 93, 94, 0, 95, 190, 97, 0, 1353,
0, 0, 370, 0, 0, 93, 94, 0, 95, 190,
97, 0, 0, 0, 0, 1131, 0, 0, 225, 902,
0, 108, 354, 354, 0, 0, 0, 0, 0, 0,
0, 227, 227, 0, 108, 902, 902, 902, 902, 902,
0, 0, 252, 0, 0, 0, 0, 0, 902, 0,
0, 0, 0, 0, 894, 0, 0, 0, 0, 0,
0, 0, 246, 0, 0, 1191, 0, 0, 0, 0,
0, 0, 0, 212, 0, 0, 0, 246, 0, 0,
0, 246, 0, 0, 0, 246, 246, 0, 0, 0,
289, 225, 0, 0, 0, 0, 50, 0, 0, 0,
246, 0, 0, 0, 0, 1214, 894, 225, 225, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
354, 0, 894, 894, 0, 0, 0, 291, 0, 894,
0, 0, 1214, 216, 217, 218, 219, 220, 354, 0,
212, 0, 225, 0, 0, 354, 1137, 0, 0, 0,
0, 354, 0, 0, 0, 189, 246, 0, 91, 0,
0, 93, 94, 50, 95, 190, 97, 0, 0, 0,
0, 894, 0, 902, 0, 0, 0, 0, 0, 0,
0, 0, 0, 246, 0, 246, 0, 0, 1275, 0,
108, 0, 0, 0, 0, 1981, 0, 354, 0, 589,
216, 217, 218, 219, 220, 590, 0, 0, 0, 0,
0, 0, 248, 0, 246, 0, 0, 0, 0, 0,
0, 0, 189, 1089, 0, 91, 344, 0, 93, 94,
246, 95, 190, 97, 0, -1136, 246, 0, 0, 0,
246, 0, 0, 0, 0, 0, 348, 0, 0, 0,
0, 227, 0, 0, 246, 246, 0, 108, 350, 0,
1066, 1067, 0, 0, 0, 0, 0, 0, 0, 225,
225, 0, 354, 0, 0, 0, 354, 0, 874, 0,
1068, 354, 0, 0, 0, 0, 0, 0, 1069, 1070,
1071, 212, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1072, 0, 0, 902, 902, 902, 902, 902,
902, 225, 902, 1696, 50, 902, 902, 902, 902, 902,
902, 902, 902, 902, 902, 902, 902, 902, 902, 902,
902, 902, 902, 902, 902, 902, 902, 902, 902, 902,
902, 902, 902, 0, 0, 0, 0, 0, 0, 0,
1073, 1074, 1075, 1076, 1077, 1078, 0, 0, 0, 0,
0, 902, 0, 212, 0, 0, 0, 0, 1079, 0,
0, 0, 0, 189, 0, 0, 91, 92, 0, 93,
94, 0, 95, 190, 97, 0, 50, 354, 0, 354,
227, 0, 0, 0, 289, 0, 0, 1080, 1081, 227,
0, 0, 0, 0, 0, 0, 227, 0, 108, 1697,
0, 0, 0, 225, 0, 0, 0, 0, 227, 0,
0, 0, 1698, 216, 217, 218, 219, 220, 1699, 252,
354, 291, 0, 354, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 212, 189, 1715, 0, 91, 1700,
0, 93, 94, 0, 95, 1701, 97, 0, 0, 0,
0, 1089, 1089, 1089, 1089, 1089, 1089, 50, 0, 225,
1089, 0, 1089, 0, 0, 0, 225, 0, 0, 0,
108, 0, 0, 0, 459, 186, 187, 65, 66, 67,
0, 225, 225, 354, 902, 0, 0, 0, 0, 0,
354, 0, 0, 589, 216, 217, 218, 219, 220, 590,
0, 0, 0, 0, 252, 0, 902, 0, 902, 0,
0, 0, 0, 0, 0, 0, 189, 289, 0, 91,
344, 0, 93, 94, 0, 95, 190, 97, 0, 0,
0, 0, 0, 902, 0, 0, 0, 0, 0, 0,
348, 0, 0, 227, 0, 0, 0, 460, 0, 0,
0, 108, 350, 0, 291, 0, 0, 0, 354, 354,
0, 0, 0, 0, 0, 0, 0, 212, 0, 0,
0, 0, 0, 1577, 0, 0, 225, 0, 474, 475,
476, 0, 0, 0, 0, 0, 0, 0, 0, 0,
50, 0, 0, 0, 354, 0, 0, 0, 477, 478,
903, 479, 480, 481, 482, 483, 484, 485, 486, 487,
488, 489, 490, 491, 492, 493, 494, 495, 496, 497,
498, 499, 500, 501, 0, 502, 589, 216, 217, 218,
219, 220, 590, 903, 0, 0, 1089, 503, 1089, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 189,
0, 0, 91, 344, 0, 93, 94, 0, 95, 190,
97, 0, 0, 0, 0, 0, 289, 0, 0, 0,
0, 354, 354, 348, 0, 354, 0, 0, 0, 0,
0, 0, 0, 0, 108, 350, 0, 0, 0, 0,
0, 0, 902, 0, 902, 0, 902, 0, 0, 0,
0, 902, 225, 291, 0, 0, 902, 0, 902, 904,
0, 902, 0, 354, 0, 0, 212, 0, 0, 0,
0, 227, 1538, 0, 0, 1693, 0, 354, 0, 0,
0, 1706, 0, 0, 0, 0, 0, 289, 0, 50,
0, 0, 934, 0, 0, 0, 0, 0, 517, 518,
519, 520, 521, 522, 523, 524, 525, 526, 527, 528,
529, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1006, 0, 0, 291, 589, 216, 217, 218, 219,
220, 590, 0, 0, 0, 0, 0, 212, 1089, 0,
1089, 0, 1089, 530, 531, 0, 227, 1089, 189, 225,
0, 91, 344, 354, 93, 94, 0, 95, 190, 97,
50, -1136, 0, 0, 0, 0, 0, 0, 596, 902,
0, 0, 348, 0, 0, 0, 0, 0, 354, 0,
0, 1776, 1777, 108, 350, 227, 0, 227, 0, 0,
0, 1706, 0, 0, 0, 0, 589, 216, 217, 218,
219, 220, 590, 354, 354, 0, 354, 0, 0, 0,
0, 354, 0, 354, 0, 227, 903, 0, 0, 189,
532, 533, 91, 344, 0, 93, 94, 0, 95, 190,
97, 0, 903, 903, 903, 903, 903, 0, 0, 0,
0, 0, 0, 348, 0, 903, 289, 0, 0, 0,
1089, 0, 0, 0, 108, 350, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 902, 902, 902,
0, 354, 0, 0, 902, 0, 1930, 0, 0, 0,
0, 0, 0, 291, 1706, 0, 0, 0, 227, 0,
0, 0, 0, 0, 0, 0, 212, 0, 0, 0,
0, 0, 1001, 0, 227, 227, 544, 518, 519, 520,
521, 522, 523, 524, 525, 526, 527, 528, 529, 50,
0, 0, 0, 0, 0, 1119, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 252,
0, 1143, 1144, 1145, 1146, 1147, 0, 0, 0, 0,
0, 530, 531, 0, 1158, 589, 216, 217, 218, 219,
220, 590, 0, 0, 0, 0, 0, 0, 0, 0,
903, 0, 0, 0, 0, 0, 0, 354, 189, 0,
902, 91, 344, 0, 93, 94, 0, 95, 190, 97,
0, 0, 354, 0, 0, 0, 354, 0, 0, 0,
0, 0, 348, 0, 0, 0, 0, 0, 0, 252,
0, 1089, 1089, 108, 350, 1983, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 532, 533,
0, 0, 902, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 902, 902,
0, 0, 0, 0, 0, 902, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 227, 227, 0, 0,
0, 354, 0, 0, 0, 0, 0, 0, 0, 1262,
1170, 1171, 1172, 1173, 1174, 1175, 1176, 1177, 1178, 1179,
1180, 1181, 1182, 1183, 1184, 1185, 1186, 902, 354, 0,
354, 0, 903, 903, 903, 903, 903, 903, 252, 903,
1187, 0, 903, 903, 903, 903, 903, 903, 903, 903,
903, 903, 903, 903, 903, 903, 903, 903, 903, 903,
903, 903, 903, 903, 903, 903, 903, 903, 903, 903,
2059, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 354, 0, 0, 0, 354, 1693, 0, 903, 474,
475, 476, 0, 0, 0, 0, 0, 0, 0, 354,
354, 0, 0, 0, 0, 0, 0, 0, 0, 477,
478, 0, 479, 480, 481, 482, 483, 484, 485, 486,
487, 488, 489, 490, 491, 492, 493, 494, 495, 496,
497, 498, 499, 500, 501, 0, 502, 0, 0, 0,
227, 1147, 1368, 0, 0, 1368, 0, 0, 503, 0,
0, 1382, 1385, 1386, 1387, 1389, 1390, 1391, 1392, 1393,
1394, 1395, 1396, 1397, 1398, 1399, 1400, 1401, 1402, 1403,
1404, 1405, 1406, 1407, 1408, 1409, 1410, 1411, 1412, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 252, 1422, 0, 0,
0, 0, 0, 227, 1026, 518, 519, 520, 521, 522,
523, 524, 525, 526, 527, 528, 529, 0, 227, 227,
0, 903, 481, 482, 483, 484, 485, 486, 487, 488,
489, 490, 491, 492, 493, 494, 495, 496, 497, 498,
499, 500, 501, 903, 502, 903, 0, 0, 212, 530,
531, 1296, 1297, 1298, 212, 0, 503, 0, 0, 0,
474, 475, 476, 0, 0, 0, 0, 0, 0, 0,
903, 50, 0, 0, 0, 0, 0, 50, 0, 0,
477, 478, 1038, 479, 480, 481, 482, 483, 484, 485,
486, 487, 488, 489, 490, 491, 492, 493, 494, 495,
496, 497, 498, 499, 500, 501, 0, 502, 216, 217,
218, 219, 220, 227, 216, 217, 218, 219, 220, 503,
0, 0, 0, 0, 0, 0, 532, 533, 0, 0,
1525, 0, 0, 0, 0, 0, 93, 94, 0, 95,
190, 97, 93, 94, 0, 95, 190, 97, 0, 0,
0, 0, 1543, 0, 1544, 0, 0, 474, 475, 476,
0, 0, 0, 0, 0, 108, 1035, 0, 0, 0,
0, 108, 0, 0, 0, 0, 0, 477, 478, 1565,
479, 480, 481, 482, 483, 484, 485, 486, 487, 488,
489, 490, 491, 492, 493, 494, 495, 496, 497, 498,
499, 500, 501, 0, 502, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 503, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 903,
0, 903, 0, 903, 0, 0, 0, 0, 903, 252,
0, 0, 0, 903, 0, 903, 0, 0, 903, 474,
475, 476, 0, 1064, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 477,
478, 0, 479, 480, 481, 482, 483, 484, 485, 486,
487, 488, 489, 490, 491, 492, 493, 494, 495, 496,
497, 498, 499, 500, 501, 0, 502, 279, 280, 0,
281, 282, 0, 0, 283, 284, 285, 286, 503, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 287, 288, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 252, 0, 1675, 0,
1676, 0, 1677, 0, 0, 0, 0, 1678, 0, 0,
1205, 290, 1680, 0, 1681, 0, 903, 1682, 0, 0,
0, 0, 0, 0, 0, 292, 293, 294, 295, 296,
297, 298, 0, 0, 0, 212, 0, 213, 40, 0,
0, 299, 0, 0, 0, 0, 0, 300, 301, 302,
303, 304, 305, 306, 307, 308, 309, 310, 50, 311,
312, 313, 314, 315, 316, 317, 318, 319, 320, 321,
322, 323, 324, 325, 326, 327, 328, 329, 330, 331,
332, 333, 334, 0, 335, 0, 782, 337, 338, 339,
0, 0, 0, 340, 600, 216, 217, 218, 219, 220,
601, 0, 1282, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 903, 903, 903, 602, 0, 0,
0, 903, 0, 93, 94, 1771, 95, 190, 97, 345,
1935, 346, 0, 0, 347, 0, 0, 474, 475, 476,
0, 0, 349, 0, 0, 0, 0, 0, 0, 0,
0, 0, 108, 0, 0, 0, 783, 477, 478, 112,
479, 480, 481, 482, 483, 484, 485, 486, 487, 488,
489, 490, 491, 492, 493, 494, 495, 496, 497, 498,
499, 500, 501, 0, 502, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 503, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 474, 475,
476, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1923, 1924, 1925, 0, 903, 477, 478,
1929, 479, 480, 481, 482, 483, 484, 485, 486, 487,
488, 489, 490, 491, 492, 493, 494, 495, 496, 497,
498, 499, 500, 501, 0, 502, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 503, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 903,
474, 475, 476, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 903, 903, 0, 0, 0,
477, 478, 903, 479, 480, 481, 482, 483, 484, 485,
486, 487, 488, 489, 490, 491, 492, 493, 494, 495,
496, 497, 498, 499, 500, 501, 0, 502, 0, 0,
1293, 2030, 0, 0, 0, 0, 1948, 0, 0, 503,
0, 0, 0, 0, 903, 1167, 1168, 1169, 1170, 1171,
1172, 1173, 1174, 1175, 1176, 1177, 1178, 1179, 1180, 1181,
1182, 1183, 1184, 1185, 1186, 5, 6, 7, 8, 9,
0, 0, 0, 0, 0, 10, 0, 0, 1187, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1992, 11,
12, 13, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1324, 0, 0, 2005, 2006, 0, 0, 0, 0,
14, 2009, 15, 16, 0, 0, 0, 0, 17, 0,
18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
28, 0, 29, 30, 31, 32, 33, 0, 0, 0,
34, 35, 36, 37, 38, 39, 40, 0, 41, 0,
42, 0, 0, 2032, 43, 44, 45, 46, 0, 47,
0, 48, 0, 49, 0, 0, 50, 51, 0, 0,
825, 52, 53, 54, 55, 56, 57, 58, 0, 59,
-205, 60, 61, 62, 63, 64, 65, 66, 67, 0,
68, 69, 70, 71, 72, 73, 0, 0, 0, 0,
0, 74, 75, 76, 77, 78, 79, 80, 0, 81,
82, 83, 84, 85, 0, 0, 0, 86, 0, 0,
87, 0, 0, 0, 0, 88, 89, 90, 91, 92,
0, 93, 94, 0, 95, 96, 97, 98, 0, 0,
99, 0, 0, 100, 0, 0, 0, 0, 0, 101,
102, 103, 0, 104, 0, 105, 106, 107, 0, 0,
108, 109, 0, 110, 111, 0, 0, 112, 113, 114,
115, 5, 6, 7, 8, 9, 0, 0, 0, 0,
0, 10, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 11, 12, 13, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 14, 0, 15, 16,
0, 0, 0, 0, 17, 0, 18, 19, 20, 21,
22, 23, 24, 25, 26, 27, 28, 0, 29, 30,
31, 32, 33, 0, 0, 0, 34, 35, 36, 37,
38, 39, 40, 0, 41, 0, 42, 0, 0, 0,
43, 44, 45, 46, 0, 47, 0, 48, 0, 49,
0, 0, 50, 51, 0, 0, 0, 52, 53, 54,
55, 56, 57, 58, 0, 59, 0, 60, 61, 62,
63, 64, 65, 66, 67, 0, 68, 69, 70, 71,
72, 73, 0, 0, 0, 0, 0, 74, 75, 76,
77, 78, 79, 80, 0, 81, 82, 83, 84, 85,
0, 0, 0, 86, 0, 0, 87, 0, 0, 0,
0, 88, 89, 90, 91, 92, 0, 93, 94, 0,
95, 96, 97, 98, 0, 0, 99, 0, 0, 100,
0, 0, 0, 0, 0, 101, 102, 103, 0, 104,
0, 105, 106, 107, 0, 0, 108, 109, 0, 110,
111, 1224, 0, 112, 113, 114, 115, 5, 6, 7,
8, 9, 0, 0, 0, 0, 0, 10, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 11, 12, 13, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 14, 0, 15, 16, 0, 0, 0, 0,
17, 0, 18, 19, 20, 21, 22, 23, 24, 25,
26, 27, 28, 0, 29, 30, 31, 32, 33, 0,
0, 0, 34, 35, 36, 37, 38, 39, 40, 0,
41, 0, 42, 0, 0, 0, 43, 44, 45, 46,
0, 47, 0, 48, 0, 49, 0, 0, 50, 51,
0, 0, 0, 52, 53, 54, 55, 56, 57, 58,
0, 59, 0, 60, 61, 62, 63, 64, 65, 66,
67, 0, 68, 69, 70, 71, 72, 73, 0, 0,
0, 0, 0, 74, 75, 76, 77, 78, 79, 80,
0, 81, 82, 83, 84, 85, 0, 0, 0, 86,
0, 0, 87, 0, 0, 0, 0, 88, 89, 90,
91, 92, 0, 93, 94, 0, 95, 96, 97, 98,
0, 0, 99, 0, 0, 100, 0, 0, 0, 0,
0, 101, 102, 103, 0, 104, 0, 105, 106, 107,
0, 0, 108, 109, 0, 110, 111, 1437, 0, 112,
113, 114, 115, 5, 6, 7, 8, 9, 0, 0,
0, 0, 0, 10, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 11, 12, 13,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 14, 0,
15, 16, 0, 0, 0, 0, 17, 0, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 0,
29, 30, 31, 32, 33, 0, 0, 0, 34, 35,
36, 37, 38, 39, 40, 0, 41, 0, 42, 0,
0, 0, 43, 44, 45, 46, 0, 47, 0, 48,
0, 49, 0, 0, 50, 51, 0, 0, 0, 52,
53, 54, 55, 0, 57, 58, 0, 59, 0, 0,
61, 62, 63, 64, 65, 66, 67, 0, 68, 69,
70, 0, 72, 73, 0, 0, 0, 0, 0, 74,
75, 76, 77, 78, 79, 80, 0, 81, 82, 83,
84, 85, 0, 0, 0, 86, 0, 0, 87, 0,
0, 0, 0, 189, 89, 90, 91, 92, 0, 93,
94, 0, 95, 190, 97, 98, 0, 0, 99, 0,
0, 100, 0, 0, 0, 0, 0, 101, 102, 0,
0, 0, 0, 105, 106, 107, 0, 0, 108, 109,
0, 110, 111, 704, 0, 112, 113, 114, 115, 5,
6, 7, 8, 9, 0, 0, 0, 0, 0, 10,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 11, 12, 13, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 14, 0, 15, 16, 0, 0,
0, 0, 17, 0, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 0, 29, 30, 31, 32,
33, 0, 0, 0, 34, 35, 36, 37, 38, 39,
40, 0, 41, 0, 42, 0, 0, 0, 43, 44,
45, 46, 0, 47, 0, 48, 0, 49, 0, 0,
50, 51, 0, 0, 0, 52, 53, 54, 55, 0,
57, 58, 0, 59, 0, 0, 61, 62, 63, 64,
65, 66, 67, 0, 68, 69, 70, 0, 72, 73,
0, 0, 0, 0, 0, 74, 75, 76, 77, 78,
79, 80, 0, 81, 82, 83, 84, 85, 0, 0,
0, 86, 0, 0, 87, 0, 0, 0, 0, 189,
89, 90, 91, 92, 0, 93, 94, 0, 95, 190,
97, 98, 0, 0, 99, 0, 0, 100, 0, 0,
0, 0, 0, 101, 102, 0, 0, 0, 0, 105,
106, 107, 0, 0, 108, 109, 0, 110, 111, 1028,
0, 112, 113, 114, 115, 5, 6, 7, 8, 9,
0, 0, 0, 0, 0, 10, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 11,
12, 13, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
14, 0, 15, 16, 0, 0, 0, 0, 17, 0,
18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
28, 0, 29, 30, 31, 32, 33, 0, 0, 0,
34, 35, 36, 37, 38, 39, 40, 0, 41, 0,
42, 0, 0, 0, 43, 44, 45, 46, 0, 47,
0, 48, 0, 49, 0, 0, 50, 51, 0, 0,
0, 52, 53, 54, 55, 0, 57, 58, 0, 59,
-205, 0, 61, 62, 63, 64, 65, 66, 67, 0,
68, 69, 70, 0, 72, 73, 0, 0, 0, 0,
0, 74, 75, 76, 77, 78, 79, 80, 0, 81,
82, 83, 84, 85, 0, 0, 0, 86, 0, 0,
87, 0, 0, 0, 0, 189, 89, 90, 91, 92,
0, 93, 94, 0, 95, 190, 97, 98, 0, 0,
99, 0, 0, 100, 0, 0, 0, 0, 0, 101,
102, 0, 0, 0, 0, 105, 106, 107, 0, 0,
108, 109, 0, 110, 111, 0, 0, 112, 113, 114,
115, 5, 6, 7, 8, 9, 0, 0, 0, 0,
0, 10, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 11, 12, 13, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 14, 0, 15, 16,
0, 0, 0, 0, 17, 0, 18, 19, 20, 21,
22, 23, 24, 25, 26, 27, 28, 0, 29, 30,
31, 32, 33, 0, 0, 0, 34, 35, 36, 37,
38, 39, 40, 0, 41, 0, 42, 0, 0, 0,
43, 44, 45, 46, 0, 47, 0, 48, 0, 49,
0, 0, 50, 51, 0, 0, 0, 52, 53, 54,
55, 0, 57, 58, 0, 59, 0, 0, 61, 62,
63, 64, 65, 66, 67, 0, 68, 69, 70, 0,
72, 73, 0, 0, 0, 0, 0, 74, 75, 76,
77, 78, 79, 80, 0, 81, 82, 83, 84, 85,
0, 0, 0, 86, 0, 0, 87, 0, 0, 0,
0, 189, 89, 90, 91, 92, 0, 93, 94, 0,
95, 190, 97, 98, 0, 0, 99, 0, 0, 100,
0, 0, 0, 0, 0, 101, 102, 0, 0, 0,
0, 105, 106, 107, 0, 0, 108, 109, 0, 110,
111, 1190, 0, 112, 113, 114, 115, 5, 6, 7,
8, 9, 0, 0, 0, 0, 0, 10, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 11, 12, 13, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 14, 0, 15, 16, 0, 0, 0, 0,
17, 0, 18, 19, 20, 21, 22, 23, 24, 25,
26, 27, 28, 0, 29, 30, 31, 32, 33, 0,
0, 0, 34, 35, 36, 37, 38, 39, 40, 0,
41, 0, 42, 0, 0, 0, 43, 44, 45, 46,
0, 47, 0, 48, 0, 49, 0, 0, 50, 51,
0, 0, 0, 52, 53, 54, 55, 0, 57, 58,
0, 59, 0, 0, 61, 62, 63, 64, 65, 66,
67, 0, 68, 69, 70, 0, 72, 73, 0, 0,
0, 0, 0, 74, 75, 76, 77, 78, 79, 80,
0, 81, 82, 83, 84, 85, 0, 0, 0, 86,
0, 0, 87, 0, 0, 0, 0, 189, 89, 90,
91, 92, 0, 93, 94, 0, 95, 190, 97, 98,
0, 0, 99, 0, 0, 100, 0, 0, 0, 0,
0, 101, 102, 0, 0, 0, 0, 105, 106, 107,
0, 0, 108, 109, 0, 110, 111, 1239, 0, 112,
113, 114, 115, 5, 6, 7, 8, 9, 0, 0,
0, 0, 0, 10, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 11, 12, 13,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 14, 0,
15, 16, 0, 0, 0, 0, 17, 0, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 0,
29, 30, 31, 32, 33, 0, 0, 0, 34, 35,
36, 37, 38, 39, 40, 0, 41, 0, 42, 0,
0, 0, 43, 44, 45, 46, 0, 47, 0, 48,
0, 49, 0, 0, 50, 51, 0, 0, 0, 52,
53, 54, 55, 0, 57, 58, 0, 59, 0, 0,
61, 62, 63, 64, 65, 66, 67, 0, 68, 69,
70, 0, 72, 73, 0, 0, 0, 0, 0, 74,
75, 76, 77, 78, 79, 80, 0, 81, 82, 83,
84, 85, 0, 0, 0, 86, 0, 0, 87, 0,
0, 0, 0, 189, 89, 90, 91, 92, 0, 93,
94, 0, 95, 190, 97, 98, 0, 0, 99, 0,
0, 100, 0, 0, 0, 0, 0, 101, 102, 0,
0, 0, 0, 105, 106, 107, 0, 0, 108, 109,
0, 110, 111, 1271, 0, 112, 113, 114, 115, 5,
6, 7, 8, 9, 0, 0, 0, 0, 0, 10,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 11, 12, 13, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 14, 0, 15, 16, 0, 0,
0, 0, 17, 0, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 0, 29, 30, 31, 32,
33, 0, 0, 0, 34, 35, 36, 37, 38, 39,
40, 0, 41, 0, 42, 0, 0, 0, 43, 44,
45, 46, 0, 47, 0, 48, 0, 49, 0, 0,
50, 51, 0, 0, 0, 52, 53, 54, 55, 0,
57, 58, 0, 59, 0, 0, 61, 62, 63, 64,
65, 66, 67, 0, 68, 69, 70, 0, 72, 73,
0, 0, 0, 0, 0, 74, 75, 76, 77, 78,
79, 80, 0, 81, 82, 83, 84, 85, 0, 0,
0, 86, 0, 0, 87, 0, 0, 0, 0, 189,
89, 90, 91, 92, 0, 93, 94, 0, 95, 190,
97, 98, 0, 0, 99, 0, 0, 100, 0, 0,
0, 0, 0, 101, 102, 0, 0, 0, 0, 105,
106, 107, 0, 0, 108, 109, 0, 110, 111, 1330,
0, 112, 113, 114, 115, 5, 6, 7, 8, 9,
0, 0, 0, 0, 0, 10, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 11,
12, 13, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
14, 0, 15, 16, 0, 0, 0, 0, 17, 0,
18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
28, 0, 29, 30, 31, 32, 33, 0, 0, 0,
34, 35, 36, 37, 38, 39, 40, 0, 41, 0,
42, 0, 0, 0, 43, 44, 45, 46, 1332, 47,
0, 48, 0, 49, 0, 0, 50, 51, 0, 0,
0, 52, 53, 54, 55, 0, 57, 58, 0, 59,
0, 0, 61, 62, 63, 64, 65, 66, 67, 0,
68, 69, 70, 0, 72, 73, 0, 0, 0, 0,
0, 74, 75, 76, 77, 78, 79, 80, 0, 81,
82, 83, 84, 85, 0, 0, 0, 86, 0, 0,
87, 0, 0, 0, 0, 189, 89, 90, 91, 92,
0, 93, 94, 0, 95, 190, 97, 98, 0, 0,
99, 0, 0, 100, 0, 0, 0, 0, 0, 101,
102, 0, 0, 0, 0, 105, 106, 107, 0, 0,
108, 109, 0, 110, 111, 0, 0, 112, 113, 114,
115, 5, 6, 7, 8, 9, 0, 0, 0, 0,
0, 10, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 11, 12, 13, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 14, 0, 15, 16,
0, 0, 0, 0, 17, 0, 18, 19, 20, 21,
22, 23, 24, 25, 26, 27, 28, 0, 29, 30,
31, 32, 33, 0, 0, 0, 34, 35, 36, 37,
38, 39, 40, 0, 41, 0, 42, 0, 0, 0,
43, 44, 45, 46, 0, 47, 0, 48, 0, 49,
1526, 0, 50, 51, 0, 0, 0, 52, 53, 54,
55, 0, 57, 58, 0, 59, 0, 0, 61, 62,
63, 64, 65, 66, 67, 0, 68, 69, 70, 0,
72, 73, 0, 0, 0, 0, 0, 74, 75, 76,
77, 78, 79, 80, 0, 81, 82, 83, 84, 85,
0, 0, 0, 86, 0, 0, 87, 0, 0, 0,
0, 189, 89, 90, 91, 92, 0, 93, 94, 0,
95, 190, 97, 98, 0, 0, 99, 0, 0, 100,
0, 0, 0, 0, 0, 101, 102, 0, 0, 0,
0, 105, 106, 107, 0, 0, 108, 109, 0, 110,
111, 0, 0, 112, 113, 114, 115, 5, 6, 7,
8, 9, 0, 0, 0, 0, 0, 10, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 11, 12, 13, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 14, 0, 15, 16, 0, 0, 0, 0,
17, 0, 18, 19, 20, 21, 22, 23, 24, 25,
26, 27, 28, 0, 29, 30, 31, 32, 33, 0,
0, 0, 34, 35, 36, 37, 38, 39, 40, 0,
41, 0, 42, 0, 0, 0, 43, 44, 45, 46,
0, 47, 0, 48, 0, 49, 0, 0, 50, 51,
0, 0, 0, 52, 53, 54, 55, 0, 57, 58,
0, 59, 0, 0, 61, 62, 63, 64, 65, 66,
67, 0, 68, 69, 70, 0, 72, 73, 0, 0,
0, 0, 0, 74, 75, 76, 77, 78, 79, 80,
0, 81, 82, 83, 84, 85, 0, 0, 0, 86,
0, 0, 87, 0, 0, 0, 0, 189, 89, 90,
91, 92, 0, 93, 94, 0, 95, 190, 97, 98,
0, 0, 99, 0, 0, 100, 0, 0, 0, 0,
0, 101, 102, 0, 0, 0, 0, 105, 106, 107,
0, 0, 108, 109, 0, 110, 111, 1684, 0, 112,
113, 114, 115, 5, 6, 7, 8, 9, 0, 0,
0, 0, 0, 10, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 11, 12, 13,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 14, 0,
15, 16, 0, 0, 0, 0, 17, 0, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 0,
29, 30, 31, 32, 33, 0, 0, -297, 34, 35,
36, 37, 38, 39, 40, 0, 41, 0, 42, 0,
0, 0, 43, 44, 45, 46, 0, 47, 0, 48,
0, 49, 0, 0, 50, 51, 0, 0, 0, 52,
53, 54, 55, 0, 57, 58, 0, 59, 0, 0,
61, 62, 63, 64, 65, 66, 67, 0, 68, 69,
70, 0, 72, 73, 0, 0, 0, 0, 0, 74,
75, 76, 77, 78, 79, 80, 0, 81, 82, 83,
84, 85, 0, 0, 0, 86, 0, 0, 87, 0,
0, 0, 0, 189, 89, 90, 91, 92, 0, 93,
94, 0, 95, 190, 97, 98, 0, 0, 99, 0,
0, 100, 0, 0, 0, 0, 0, 101, 102, 0,
0, 0, 0, 105, 106, 107, 0, 0, 108, 109,
0, 110, 111, 0, 0, 112, 113, 114, 115, 5,
6, 7, 8, 9, 0, 0, 0, 0, 0, 10,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 11, 12, 13, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 14, 0, 15, 16, 0, 0,
0, 0, 17, 0, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 0, 29, 30, 31, 32,
33, 0, 0, 0, 34, 35, 36, 37, 38, 39,
40, 0, 41, 0, 42, 0, 0, 0, 43, 44,
45, 46, 0, 47, 0, 48, 0, 49, 0, 0,
50, 51, 0, 0, 0, 52, 53, 54, 55, 0,
57, 58, 0, 59, 0, 0, 61, 62, 63, 64,
65, 66, 67, 0, 68, 69, 70, 0, 72, 73,
0, 0, 0, 0, 0, 74, 75, 76, 77, 78,
79, 80, 0, 81, 82, 83, 84, 85, 0, 0,
0, 86, 0, 0, 87, 0, 0, 0, 0, 189,
89, 90, 91, 92, 0, 93, 94, 0, 95, 190,
97, 98, 0, 0, 99, 0, 0, 100, 0, 0,
0, 0, 0, 101, 102, 0, 0, 0, 0, 105,
106, 107, 0, 0, 108, 109, 0, 110, 111, 1926,
0, 112, 113, 114, 115, 5, 6, 7, 8, 9,
0, 0, 0, 0, 0, 10, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 11,
12, 13, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
14, 0, 15, 16, 0, 0, 0, 0, 17, 0,
18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
28, 0, 29, 30, 31, 32, 33, 0, 0, 0,
34, 35, 36, 37, 38, 39, 40, 0, 41, 0,
42, 0, 0, 0, 43, 44, 45, 46, 0, 47,
0, 48, 1979, 49, 0, 0, 50, 51, 0, 0,
0, 52, 53, 54, 55, 0, 57, 58, 0, 59,
0, 0, 61, 62, 63, 64, 65, 66, 67, 0,
68, 69, 70, 0, 72, 73, 0, 0, 0, 0,
0, 74, 75, 76, 77, 78, 79, 80, 0, 81,
82, 83, 84, 85, 0, 0, 0, 86, 0, 0,
87, 0, 0, 0, 0, 189, 89, 90, 91, 92,
0, 93, 94, 0, 95, 190, 97, 98, 0, 0,
99, 0, 0, 100, 0, 0, 0, 0, 0, 101,
102, 0, 0, 0, 0, 105, 106, 107, 0, 0,
108, 109, 0, 110, 111, 0, 0, 112, 113, 114,
115, 5, 6, 7, 8, 9, 0, 0, 0, 0,
0, 10, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 11, 12, 13, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 14, 0, 15, 16,
0, 0, 0, 0, 17, 0, 18, 19, 20, 21,
22, 23, 24, 25, 26, 27, 28, 0, 29, 30,
31, 32, 33, 0, 0, 0, 34, 35, 36, 37,
38, 39, 40, 0, 41, 0, 42, 0, 0, 0,
43, 44, 45, 46, 0, 47, 2022, 48, 0, 49,
0, 0, 50, 51, 0, 0, 0, 52, 53, 54,
55, 0, 57, 58, 0, 59, 0, 0, 61, 62,
63, 64, 65, 66, 67, 0, 68, 69, 70, 0,
72, 73, 0, 0, 0, 0, 0, 74, 75, 76,
77, 78, 79, 80, 0, 81, 82, 83, 84, 85,
0, 0, 0, 86, 0, 0, 87, 0, 0, 0,
0, 189, 89, 90, 91, 92, 0, 93, 94, 0,
95, 190, 97, 98, 0, 0, 99, 0, 0, 100,
0, 0, 0, 0, 0, 101, 102, 0, 0, 0,
0, 105, 106, 107, 0, 0, 108, 109, 0, 110,
111, 0, 0, 112, 113, 114, 115, 5, 6, 7,
8, 9, 0, 0, 0, 0, 0, 10, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 11, 12, 13, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 14, 0, 15, 16, 0, 0, 0, 0,
17, 0, 18, 19, 20, 21, 22, 23, 24, 25,
26, 27, 28, 0, 29, 30, 31, 32, 33, 0,
0, 0, 34, 35, 36, 37, 38, 39, 40, 0,
41, 0, 42, 0, 0, 0, 43, 44, 45, 46,
0, 47, 0, 48, 0, 49, 0, 0, 50, 51,
0, 0, 0, 52, 53, 54, 55, 0, 57, 58,
0, 59, 0, 0, 61, 62, 63, 64, 65, 66,
67, 0, 68, 69, 70, 0, 72, 73, 0, 0,
0, 0, 0, 74, 75, 76, 77, 78, 79, 80,
0, 81, 82, 83, 84, 85, 0, 0, 0, 86,
0, 0, 87, 0, 0, 0, 0, 189, 89, 90,
91, 92, 0, 93, 94, 0, 95, 190, 97, 98,
0, 0, 99, 0, 0, 100, 0, 0, 0, 0,
0, 101, 102, 0, 0, 0, 0, 105, 106, 107,
0, 0, 108, 109, 0, 110, 111, 2039, 0, 112,
113, 114, 115, 5, 6, 7, 8, 9, 0, 0,
0, 0, 0, 10, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 11, 12, 13,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 14, 0,
15, 16, 0, 0, 0, 0, 17, 0, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 0,
29, 30, 31, 32, 33, 0, 0, 0, 34, 35,
36, 37, 38, 39, 40, 0, 41, 0, 42, 0,
0, 0, 43, 44, 45, 46, 0, 47, 0, 48,
0, 49, 0, 0, 50, 51, 0, 0, 0, 52,
53, 54, 55, 0, 57, 58, 0, 59, 0, 0,
61, 62, 63, 64, 65, 66, 67, 0, 68, 69,
70, 0, 72, 73, 0, 0, 0, 0, 0, 74,
75, 76, 77, 78, 79, 80, 0, 81, 82, 83,
84, 85, 0, 0, 0, 86, 0, 0, 87, 0,
0, 0, 0, 189, 89, 90, 91, 92, 0, 93,
94, 0, 95, 190, 97, 98, 0, 0, 99, 0,
0, 100, 0, 0, 0, 0, 0, 101, 102, 0,
0, 0, 0, 105, 106, 107, 0, 0, 108, 109,
0, 110, 111, 2042, 0, 112, 113, 114, 115, 5,
6, 7, 8, 9, 0, 0, 0, 0, 0, 10,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 11, 12, 13, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 14, 0, 15, 16, 0, 0,
0, 0, 17, 0, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 0, 29, 30, 31, 32,
33, 0, 0, 0, 34, 35, 36, 37, 38, 39,
40, 0, 41, 0, 42, 0, 0, 0, 43, 44,
45, 46, 0, 47, 0, 48, 0, 49, 0, 0,
50, 51, 0, 0, 0, 52, 53, 54, 55, 0,
57, 58, 0, 59, 0, 0, 61, 62, 63, 64,
65, 66, 67, 0, 68, 69, 70, 0, 72, 73,
0, 0, 0, 0, 0, 74, 75, 76, 77, 78,
79, 80, 0, 81, 82, 83, 84, 85, 0, 0,
0, 86, 0, 0, 87, 0, 0, 0, 0, 189,
89, 90, 91, 92, 0, 93, 94, 0, 95, 190,
97, 98, 0, 0, 99, 0, 0, 100, 0, 0,
0, 0, 0, 101, 102, 0, 0, 0, 0, 105,
106, 107, 0, 0, 108, 109, 0, 110, 111, 2058,
0, 112, 113, 114, 115, 5, 6, 7, 8, 9,
0, 0, 0, 0, 0, 10, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 11,
12, 13, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
14, 0, 15, 16, 0, 0, 0, 0, 17, 0,
18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
28, 0, 29, 30, 31, 32, 33, 0, 0, 0,
34, 35, 36, 37, 38, 39, 40, 0, 41, 0,
42, 0, 0, 0, 43, 44, 45, 46, 0, 47,
0, 48, 0, 49, 0, 0, 50, 51, 0, 0,
0, 52, 53, 54, 55, 0, 57, 58, 0, 59,
0, 0, 61, 62, 63, 64, 65, 66, 67, 0,
68, 69, 70, 0, 72, 73, 0, 0, 0, 0,
0, 74, 75, 76, 77, 78, 79, 80, 0, 81,
82, 83, 84, 85, 0, 0, 0, 86, 0, 0,
87, 0, 0, 0, 0, 189, 89, 90, 91, 92,
0, 93, 94, 0, 95, 190, 97, 98, 0, 0,
99, 0, 0, 100, 0, 0, 0, 0, 0, 101,
102, 0, 0, 0, 0, 105, 106, 107, 0, 0,
108, 109, 0, 110, 111, 2113, 0, 112, 113, 114,
115, 5, 6, 7, 8, 9, 0, 0, 0, 0,
0, 10, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 11, 12, 13, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 14, 0, 15, 16,
0, 0, 0, 0, 17, 0, 18, 19, 20, 21,
22, 23, 24, 25, 26, 27, 28, 0, 29, 30,
31, 32, 33, 0, 0, 0, 34, 35, 36, 37,
38, 39, 40, 0, 41, 0, 42, 0, 0, 0,
43, 44, 45, 46, 0, 47, 0, 48, 0, 49,
0, 0, 50, 51, 0, 0, 0, 52, 53, 54,
55, 0, 57, 58, 0, 59, 0, 0, 61, 62,
63, 64, 65, 66, 67, 0, 68, 69, 70, 0,
72, 73, 0, 0, 0, 0, 0, 74, 75, 76,
77, 78, 79, 80, 0, 81, 82, 83, 84, 85,
0, 0, 0, 86, 0, 0, 87, 0, 0, 0,
0, 189, 89, 90, 91, 92, 0, 93, 94, 0,
95, 190, 97, 98, 0, 0, 99, 0, 0, 100,
0, 0, 0, 0, 0, 101, 102, 0, 0, 0,
0, 105, 106, 107, 0, 0, 108, 109, 0, 110,
111, 2114, 0, 112, 113, 114, 115, 5, 6, 7,
8, 9, 0, 0, 0, 0, 0, 10, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 11, 12, 13, 0, 0, 572, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 15, 16, 0, 0, 0, 0,
17, 0, 18, 19, 20, 21, 22, 23, 24, 25,
26, 27, 28, 0, 29, 30, 31, 32, 33, 0,
0, 0, 34, 35, 36, 37, 38, 39, 40, 0,
41, 0, 42, 0, 0, 0, 43, 44, 45, 46,
0, 47, 0, 48, 0, 49, 0, 0, 50, 51,
0, 0, 0, 52, 53, 54, 55, 0, 57, 58,
0, 59, 0, 0, 61, 62, 186, 187, 65, 66,
67, 0, 68, 69, 70, 0, 0, 0, 0, 0,
0, 0, 0, 74, 75, 76, 77, 78, 79, 80,
0, 81, 82, 83, 84, 85, 0, 0, 0, 86,
0, 0, 87, 0, 0, 0, 0, 189, 89, 90,
91, 92, 0, 93, 94, 0, 95, 190, 97, 0,
0, 0, 99, 0, 0, 100, 0, 0, 0, 0,
0, 101, 102, 0, 0, 0, 0, 105, 106, 107,
0, 0, 108, 109, 0, 110, 111, 0, 0, 112,
113, 114, 115, 5, 6, 7, 8, 9, 0, 0,
0, 0, 0, 10, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 11, 12, 13,
0, 0, 858, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
15, 16, 0, 0, 0, 0, 17, 0, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 0,
29, 30, 31, 32, 33, 0, 0, 0, 34, 35,
36, 37, 38, 39, 40, 0, 41, 0, 42, 0,
0, 0, 43, 44, 45, 46, 0, 47, 0, 48,
0, 49, 0, 0, 50, 51, 0, 0, 0, 52,
53, 54, 55, 0, 57, 58, 0, 59, 0, 0,
61, 62, 186, 187, 65, 66, 67, 0, 68, 69,
70, 0, 0, 0, 0, 0, 0, 0, 0, 74,
75, 76, 77, 78, 79, 80, 0, 81, 82, 83,
84, 85, 0, 0, 0, 86, 0, 0, 87, 0,
0, 0, 0, 189, 89, 90, 91, 92, 0, 93,
94, 0, 95, 190, 97, 0, 0, 0, 99, 0,
0, 100, 0, 0, 0, 0, 0, 101, 102, 0,
0, 0, 0, 105, 106, 107, 0, 0, 108, 109,
0, 110, 111, 0, 0, 112, 113, 114, 115, 5,
6, 7, 8, 9, 0, 0, 0, 0, 0, 10,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 11, 12, 13, 0, 0, 1121, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 15, 16, 0, 0,
0, 0, 17, 0, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 0, 29, 30, 31, 32,
33, 0, 0, 0, 34, 35, 36, 37, 38, 39,
40, 0, 41, 0, 42, 0, 0, 0, 43, 44,
45, 46, 0, 47, 0, 48, 0, 49, 0, 0,
50, 51, 0, 0, 0, 52, 53, 54, 55, 0,
57, 58, 0, 59, 0, 0, 61, 62, 186, 187,
65, 66, 67, 0, 68, 69, 70, 0, 0, 0,
0, 0, 0, 0, 0, 74, 75, 76, 77, 78,
79, 80, 0, 81, 82, 83, 84, 85, 0, 0,
0, 86, 0, 0, 87, 0, 0, 0, 0, 189,
89, 90, 91, 92, 0, 93, 94, 0, 95, 190,
97, 0, 0, 0, 99, 0, 0, 100, 0, 0,
0, 0, 0, 101, 102, 0, 0, 0, 0, 105,
106, 107, 0, 0, 108, 109, 0, 110, 111, 0,
0, 112, 113, 114, 115, 5, 6, 7, 8, 9,
0, 0, 0, 0, 0, 10, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 11,
12, 13, 0, 0, 1765, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 15, 16, 0, 0, 0, 0, 17, 0,
18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
28, 0, 29, 30, 31, 32, 33, 0, 0, 0,
34, 35, 36, 37, 38, 39, 40, 0, 41, 0,
42, 0, 0, 0, 43, 44, 45, 46, 0, 47,
0, 48, 0, 49, 0, 0, 50, 51, 0, 0,
0, 52, 53, 54, 55, 0, 57, 58, 0, 59,
0, 0, 61, 62, 186, 187, 65, 66, 67, 0,
68, 69, 70, 0, 0, 0, 0, 0, 0, 0,
0, 74, 75, 76, 77, 78, 79, 80, 0, 81,
82, 83, 84, 85, 0, 0, 0, 86, 0, 0,
87, 0, 0, 0, 0, 189, 89, 90, 91, 92,
0, 93, 94, 0, 95, 190, 97, 0, 0, 0,
99, 0, 0, 100, 0, 0, 0, 0, 0, 101,
102, 0, 0, 0, 0, 105, 106, 107, 0, 0,
108, 109, 0, 110, 111, 0, 0, 112, 113, 114,
115, 5, 6, 7, 8, 9, 0, 0, 0, 0,
0, 10, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 11, 12, 13, 0, 0,
1918, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 15, 16,
0, 0, 0, 0, 17, 0, 18, 19, 20, 21,
22, 23, 24, 25, 26, 27, 28, 0, 29, 30,
31, 32, 33, 0, 0, 0, 34, 35, 36, 37,
38, 39, 40, 0, 41, 0, 42, 0, 0, 0,
43, 44, 45, 46, 0, 47, 0, 48, 0, 49,
0, 0, 50, 51, 0, 0, 0, 52, 53, 54,
55, 0, 57, 58, 0, 59, 0, 0, 61, 62,
186, 187, 65, 66, 67, 0, 68, 69, 70, 0,
0, 0, 0, 0, 0, 0, 0, 74, 75, 76,
77, 78, 79, 80, 0, 81, 82, 83, 84, 85,
0, 0, 0, 86, 0, 0, 87, 0, 0, 0,
0, 189, 89, 90, 91, 92, 0, 93, 94, 0,
95, 190, 97, 0, 0, 0, 99, 0, 0, 100,
0, 0, 0, 0, 0, 101, 102, 0, 0, 0,
0, 105, 106, 107, 0, 0, 108, 109, 0, 110,
111, 0, 0, 112, 113, 114, 115, 5, 6, 7,
8, 9, 0, 0, 0, 0, 0, 10, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 11, 12, 13, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 15, 16, 0, 0, 0, 0,
17, 0, 18, 19, 20, 21, 22, 23, 24, 25,
26, 27, 28, 0, 29, 30, 31, 32, 33, 0,
0, 0, 34, 35, 36, 37, 38, 39, 40, 0,
41, 0, 42, 0, 0, 0, 43, 44, 45, 46,
0, 47, 0, 48, 0, 49, 0, 0, 50, 51,
0, 0, 0, 52, 53, 54, 55, 0, 57, 58,
0, 59, 0, 0, 61, 62, 186, 187, 65, 66,
67, 0, 68, 69, 70, 0, 0, 0, 0, 0,
0, 0, 0, 74, 75, 76, 77, 78, 79, 80,
0, 81, 82, 83, 84, 85, 0, 0, 0, 86,
0, 0, 87, 0, 0, 0, 0, 189, 89, 90,
91, 92, 0, 93, 94, 0, 95, 190, 97, 0,
0, 0, 99, 0, 0, 100, 0, 0, 0, 0,
0, 101, 102, 0, 0, 0, 0, 105, 106, 107,
0, 0, 108, 109, 0, 110, 111, 0, 0, 112,
113, 114, 115, 5, 6, 7, 8, 9, 0, 0,
0, 0, 0, 10, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 359, 425, 13,
0, 0, 0, 0, 0, 0, 0, 0, 794, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
15, 16, 0, 0, 0, 0, 17, 0, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 0,
29, 30, 31, 32, 0, 0, 0, 0, 34, 35,
36, 37, 38, 39, 40, 0, 0, 0, 0, 0,
0, 0, 43, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 50, 0, 0, 0, 0, 0,
0, 0, 55, 0, 0, 0, 0, 0, 0, 0,
0, 185, 186, 187, 65, 66, 67, 0, 0, 69,
70, 0, 0, 0, 0, 0, 0, 0, 0, 188,
75, 76, 77, 78, 79, 80, 0, 81, 82, 83,
84, 85, 0, 0, 0, 0, 0, 0, 87, 0,
0, 0, 0, 189, 89, 90, 91, 92, 0, 93,
94, 0, 95, 190, 97, 0, 0, 0, 99, 0,
0, 100, 0, 0, 0, 0, 0, 101, 102, 0,
0, 0, 0, 105, 106, 107, 0, 0, 108, 109,
5, 6, 7, 8, 9, 112, 113, 114, 115, 0,
10, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 359, 0, 13, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 15, 16, 0,
0, 0, 0, 17, 0, 18, 19, 20, 21, 22,
23, 24, 25, 26, 27, 28, 0, 29, 30, 31,
32, 0, 0, 0, 0, 34, 35, 36, 37, 38,
39, 40, 0, 0, 0, 0, 0, 0, 0, 43,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 50, 0, 0, 0, 0, 0, 0, 0, 55,
0, 0, 0, 0, 0, 0, 0, 0, 185, 186,
187, 65, 66, 67, 0, 0, 69, 70, 0, 0,
0, 0, 0, 0, 0, 0, 188, 75, 76, 77,
78, 79, 80, 0, 81, 82, 83, 84, 85, 0,
0, 0, 0, 0, 0, 87, 0, 0, 0, 0,
189, 89, 90, 91, 92, 0, 93, 94, 0, 95,
190, 97, 0, 0, 0, 99, 0, 0, 100, 5,
6, 7, 8, 9, 101, 102, 0, 0, 0, 10,
105, 106, 107, 0, 0, 108, 191, 0, 360, 0,
0, 0, 112, 113, 114, 115, 0, 0, 0, 0,
0, 0, 0, 0, 719, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 15, 16, 0, 0,
0, 0, 17, 0, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 0, 29, 30, 31, 32,
0, 0, 0, 0, 34, 35, 36, 37, 38, 39,
40, 0, 0, 720, 0, 0, 0, 0, 43, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
50, 0, 0, 0, 0, 0, 0, 0, 55, 0,
0, 0, 0, 0, 0, 0, 0, 185, 186, 187,
65, 66, 67, 0, 0, 69, 70, 0, 0, 0,
0, 0, 0, 0, 0, 188, 75, 76, 77, 78,
79, 80, 0, 81, 82, 83, 84, 85, 0, 0,
0, 0, 0, 0, 87, 0, 0, 0, 0, 189,
89, 90, 91, 92, 0, 93, 94, 0, 95, 190,
97, 0, 721, 0, 99, 0, 0, 100, 5, 6,
7, 8, 9, 101, 102, 0, 0, 0, 10, 105,
106, 107, 0, 0, 108, 191, 0, 0, 0, 0,
0, 112, 113, 114, 115, 0, 0, 0, 0, 0,
0, 0, 0, 1258, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 15, 16, 0, 0, 0,
0, 17, 0, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 0, 29, 30, 31, 32, 0,
0, 0, 0, 34, 35, 36, 37, 38, 39, 40,
0, 0, 1259, 0, 0, 0, 0, 43, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 50,
0, 0, 0, 0, 0, 0, 0, 55, 0, 0,
0, 0, 0, 0, 0, 0, 185, 186, 187, 65,
66, 67, 0, 0, 69, 70, 0, 0, 0, 0,
0, 0, 0, 0, 188, 75, 76, 77, 78, 79,
80, 0, 81, 82, 83, 84, 85, 0, 0, 0,
0, 0, 0, 87, 0, 0, 0, 0, 189, 89,
90, 91, 92, 0, 93, 94, 0, 95, 190, 97,
0, 1260, 0, 99, 0, 0, 100, 0, 0, 0,
0, 0, 101, 102, 0, 0, 0, 0, 105, 106,
107, 0, 0, 108, 191, 5, 6, 7, 8, 9,
112, 113, 114, 115, 0, 10, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 359,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 15, 16, 0, 0, 0, 0, 17, 0,
18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
28, 0, 29, 30, 31, 32, 0, 0, 0, 0,
34, 35, 36, 37, 38, 39, 40, 0, 0, 0,
0, 0, 0, 0, 43, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 50, 0, 0, 0,
0, 0, 0, 0, 55, 0, 0, 0, 0, 0,
0, 0, 0, 185, 186, 187, 65, 66, 67, 0,
0, 69, 70, 0, 0, 0, 0, 0, 0, 0,
0, 188, 75, 76, 77, 78, 79, 80, 0, 81,
82, 83, 84, 85, 0, 0, 0, 0, 0, 0,
87, 0, 0, 0, 0, 189, 89, 90, 91, 92,
0, 93, 94, 0, 95, 190, 97, 0, 0, 0,
99, 0, 0, 100, 0, 0, 0, 0, 0, 101,
102, 0, 0, 0, 0, 105, 106, 107, 0, 0,
108, 191, 0, 0, 853, 0, 0, 112, 113, 114,
115, 5, 6, 7, 8, 9, 0, 0, 0, 0,
0, 10, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 359, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 794, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 15, 16,
0, 0, 0, 0, 17, 0, 18, 19, 20, 21,
22, 23, 24, 25, 26, 27, 28, 0, 29, 30,
31, 32, 0, 0, 0, 0, 34, 35, 36, 37,
38, 39, 40, 0, 0, 0, 0, 0, 0, 0,
43, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 50, 0, 0, 0, 0, 0, 0, 0,
55, 0, 0, 0, 0, 0, 0, 0, 0, 185,
186, 187, 65, 66, 67, 0, 0, 69, 70, 0,
0, 0, 0, 0, 0, 0, 0, 188, 75, 76,
77, 78, 79, 80, 0, 81, 82, 83, 84, 85,
0, 0, 0, 0, 0, 0, 87, 0, 0, 0,
0, 189, 89, 90, 91, 92, 0, 93, 94, 0,
95, 190, 97, 0, 0, 0, 99, 0, 0, 100,
0, 0, 0, 0, 0, 101, 102, 0, 0, 0,
0, 105, 106, 107, 0, 0, 108, 191, 5, 6,
7, 8, 9, 112, 113, 114, 115, 0, 10, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 359, 425, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 15, 16, 0, 0, 0,
0, 17, 0, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 0, 29, 30, 31, 32, 0,
0, 0, 0, 34, 35, 36, 37, 38, 39, 40,
0, 0, 0, 0, 0, 0, 0, 43, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 50,
0, 0, 0, 0, 0, 0, 0, 55, 0, 0,
0, 0, 0, 0, 0, 0, 185, 186, 187, 65,
66, 67, 0, 0, 69, 70, 0, 0, 0, 0,
0, 0, 0, 0, 188, 75, 76, 77, 78, 79,
80, 0, 81, 82, 83, 84, 85, 0, 0, 0,
0, 0, 0, 87, 0, 0, 0, 0, 189, 89,
90, 91, 92, 0, 93, 94, 0, 95, 190, 97,
0, 0, 0, 99, 0, 0, 100, 5, 6, 7,
8, 9, 101, 102, 0, 0, 0, 10, 105, 106,
107, 0, 0, 108, 109, 0, 0, 0, 0, 0,
112, 113, 114, 115, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 15, 16, 0, 0, 0, 0,
17, 0, 18, 19, 20, 21, 22, 23, 24, 25,
26, 27, 28, 0, 29, 30, 31, 32, 0, 0,
0, 0, 34, 35, 36, 37, 38, 39, 40, 0,
0, 0, 0, 0, 0, 0, 43, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 50, 0,
0, 0, 0, 203, 0, 0, 55, 0, 0, 0,
0, 0, 0, 0, 0, 185, 186, 187, 65, 66,
67, 0, 0, 69, 70, 0, 0, 0, 0, 0,
0, 0, 0, 188, 75, 76, 77, 78, 79, 80,
0, 81, 82, 83, 84, 85, 0, 0, 0, 0,
0, 0, 87, 0, 0, 0, 0, 189, 89, 90,
91, 92, 0, 93, 94, 0, 95, 190, 97, 0,
0, 0, 99, 0, 0, 100, 5, 6, 7, 8,
9, 101, 102, 0, 0, 0, 10, 105, 106, 107,
0, 0, 108, 191, 0, 0, 0, 0, 0, 112,
113, 114, 115, 0, 0, 0, 0, 0, 0, 0,
0, 239, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 15, 16, 0, 0, 0, 0, 17,
0, 18, 19, 20, 21, 22, 23, 24, 25, 26,
27, 28, 0, 29, 30, 31, 32, 0, 0, 0,
0, 34, 35, 36, 37, 38, 39, 40, 0, 0,
0, 0, 0, 0, 0, 43, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 50, 0, 0,
0, 0, 0, 0, 0, 55, 0, 0, 0, 0,
0, 0, 0, 0, 185, 186, 187, 65, 66, 67,
0, 0, 69, 70, 0, 0, 0, 0, 0, 0,
0, 0, 188, 75, 76, 77, 78, 79, 80, 0,
81, 82, 83, 84, 85, 0, 0, 0, 0, 0,
0, 87, 0, 0, 0, 0, 189, 89, 90, 91,
92, 0, 93, 94, 0, 95, 190, 97, 0, 0,
0, 99, 0, 0, 100, 5, 6, 7, 8, 9,
101, 102, 0, 0, 0, 10, 105, 106, 107, 0,
0, 108, 191, 0, 0, 0, 0, 0, 112, 113,
114, 115, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 15, 16, 0, 0, 0, 0, 17, 0,
18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
28, 0, 29, 30, 31, 32, 0, 0, 0, 0,
34, 35, 36, 37, 38, 39, 40, 0, 0, 0,
0, 0, 0, 0, 43, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 50, 0, 0, 0,
0, 0, 0, 0, 55, 0, 0, 0, 0, 0,
0, 0, 0, 185, 186, 187, 65, 66, 67, 0,
0, 69, 70, 0, 0, 0, 0, 0, 0, 0,
0, 188, 75, 76, 77, 78, 79, 80, 0, 81,
82, 83, 84, 85, 0, 0, 0, 0, 0, 0,
87, 0, 0, 0, 0, 189, 89, 90, 91, 92,
0, 93, 94, 0, 95, 190, 97, 0, 0, 0,
99, 0, 0, 100, 5, 6, 7, 8, 9, 101,
102, 0, 0, 0, 10, 105, 106, 107, 0, 0,
108, 191, 0, 274, 0, 0, 0, 112, 113, 114,
115, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 15, 16, 0, 0, 0, 0, 17, 0, 18,
19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
0, 29, 30, 31, 32, 0, 0, 0, 0, 34,
35, 36, 37, 38, 39, 40, 0, 0, 0, 0,
0, 0, 0, 43, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 50, 0, 0, 0, 0,
0, 0, 0, 55, 0, 0, 0, 0, 0, 0,
0, 0, 185, 186, 187, 65, 66, 67, 0, 0,
69, 70, 0, 0, 0, 0, 0, 0, 0, 0,
188, 75, 76, 77, 78, 79, 80, 0, 81, 82,
83, 84, 85, 0, 0, 0, 0, 0, 0, 87,
0, 0, 0, 0, 189, 89, 90, 91, 92, 0,
93, 94, 0, 95, 190, 97, 0, 0, 0, 99,
0, 0, 100, 0, 0, 0, 0, 0, 101, 102,
0, 0, 0, 0, 105, 106, 107, 0, 0, 108,
191, 0, 277, 0, 0, 0, 112, 113, 114, 115,
5, 6, 7, 8, 9, 0, 0, 0, 0, 0,
10, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 425, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 15, 16, 0,
0, 0, 0, 17, 0, 18, 19, 20, 21, 22,
23, 24, 25, 26, 27, 28, 0, 29, 30, 31,
32, 0, 0, 0, 0, 34, 35, 36, 37, 38,
39, 40, 0, 0, 0, 0, 0, 0, 0, 43,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 50, 0, 0, 0, 0, 0, 0, 0, 55,
0, 0, 0, 0, 0, 0, 0, 0, 185, 186,
187, 65, 66, 67, 0, 0, 69, 70, 0, 0,
0, 0, 0, 0, 0, 0, 188, 75, 76, 77,
78, 79, 80, 0, 81, 82, 83, 84, 85, 0,
0, 0, 0, 0, 0, 87, 0, 0, 0, 0,
189, 89, 90, 91, 92, 0, 93, 94, 0, 95,
190, 97, 0, 0, 0, 99, 0, 0, 100, 5,
6, 7, 8, 9, 101, 102, 0, 0, 0, 10,
105, 106, 107, 0, 0, 108, 109, 0, 0, 0,
0, 0, 112, 113, 114, 115, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 15, 16, 0, 0,
0, 0, 17, 0, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 0, 29, 30, 31, 32,
0, 0, 0, 0, 34, 35, 36, 37, 38, 39,
40, 0, 0, 0, 0, 0, 0, 0, 43, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
50, 0, 0, 0, 0, 0, 0, 0, 55, 0,
0, 0, 0, 0, 0, 0, 0, 185, 186, 187,
65, 66, 67, 0, 0, 69, 70, 0, 0, 0,
0, 0, 0, 0, 0, 188, 75, 76, 77, 78,
79, 80, 0, 81, 82, 83, 84, 85, 0, 0,
0, 0, 0, 0, 87, 0, 0, 0, 0, 189,
89, 90, 91, 92, 0, 93, 94, 0, 95, 190,
97, 0, 0, 0, 99, 0, 0, 100, 0, 0,
0, 0, 0, 101, 102, 0, 0, 0, 0, 105,
106, 107, 0, 0, 108, 191, 570, 0, 0, 0,
0, 112, 113, 114, 115, 5, 6, 7, 8, 9,
0, 0, 0, 0, 0, 10, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 359,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 15, 16, 0, 0, 0, 0, 17, 0,
18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
28, 0, 29, 30, 31, 32, 0, 0, 0, 0,
34, 35, 36, 37, 38, 39, 40, 0, 0, 0,
0, 0, 0, 0, 43, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 50, 0, 0, 0,
0, 0, 0, 0, 55, 0, 0, 0, 0, 0,
0, 0, 0, 185, 186, 187, 65, 66, 67, 0,
0, 69, 70, 0, 0, 0, 0, 0, 0, 0,
0, 188, 75, 76, 77, 78, 79, 80, 0, 81,
82, 83, 84, 85, 0, 0, 0, 0, 0, 0,
87, 0, 0, 0, 0, 189, 89, 90, 91, 92,
0, 93, 94, 0, 95, 190, 97, 0, 0, 0,
99, 0, 0, 100, 5, 6, 7, 8, 9, 101,
102, 0, 0, 0, 10, 105, 106, 107, 0, 0,
108, 191, 0, 0, 0, 0, 0, 112, 113, 114,
115, 0, 0, 750, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 15, 16, 0, 0, 0, 0, 17, 0, 18,
19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
0, 29, 30, 31, 32, 0, 0, 0, 0, 34,
35, 36, 37, 38, 39, 40, 0, 0, 0, 0,
0, 0, 0, 43, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 50, 0, 0, 0, 0,
0, 0, 0, 55, 0, 0, 0, 0, 0, 0,
0, 0, 185, 186, 187, 65, 66, 67, 0, 0,
69, 70, 0, 0, 0, 0, 0, 0, 0, 0,
188, 75, 76, 77, 78, 79, 80, 0, 81, 82,
83, 84, 85, 0, 0, 0, 0, 0, 0, 87,
0, 0, 0, 0, 189, 89, 90, 91, 92, 0,
93, 94, 0, 95, 190, 97, 0, 0, 0, 99,
0, 0, 100, 5, 6, 7, 8, 9, 101, 102,
0, 0, 0, 10, 105, 106, 107, 0, 0, 108,
191, 0, 0, 0, 0, 0, 112, 113, 114, 115,
0, 0, 0, 0, 0, 0, 0, 0, 794, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
15, 16, 0, 0, 0, 0, 17, 0, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 0,
29, 30, 31, 32, 0, 0, 0, 0, 34, 35,
36, 37, 38, 39, 40, 0, 0, 0, 0, 0,
0, 0, 43, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 50, 0, 0, 0, 0, 0,
0, 0, 55, 0, 0, 0, 0, 0, 0, 0,
0, 185, 186, 187, 65, 66, 67, 0, 0, 69,
70, 0, 0, 0, 0, 0, 0, 0, 0, 188,
75, 76, 77, 78, 79, 80, 0, 81, 82, 83,
84, 85, 0, 0, 0, 0, 0, 0, 87, 0,
0, 0, 0, 189, 89, 90, 91, 92, 0, 93,
94, 0, 95, 190, 97, 0, 0, 0, 99, 0,
0, 100, 5, 6, 7, 8, 9, 101, 102, 0,
0, 0, 10, 105, 106, 107, 0, 0, 108, 191,
0, 0, 0, 0, 0, 112, 113, 114, 115, 0,
0, 0, 0, 0, 0, 0, 0, 833, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 15,
16, 0, 0, 0, 0, 17, 0, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 0, 29,
30, 31, 32, 0, 0, 0, 0, 34, 35, 36,
37, 38, 39, 40, 0, 0, 0, 0, 0, 0,
0, 43, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 50, 0, 0, 0, 0, 0, 0,
0, 55, 0, 0, 0, 0, 0, 0, 0, 0,
185, 186, 187, 65, 66, 67, 0, 0, 69, 70,
0, 0, 0, 0, 0, 0, 0, 0, 188, 75,
76, 77, 78, 79, 80, 0, 81, 82, 83, 84,
85, 0, 0, 0, 0, 0, 0, 87, 0, 0,
0, 0, 189, 89, 90, 91, 92, 0, 93, 94,
0, 95, 190, 97, 0, 0, 0, 99, 0, 0,
100, 5, 6, 7, 8, 9, 101, 102, 0, 0,
0, 10, 105, 106, 107, 0, 0, 108, 191, 0,
0, 0, 0, 0, 112, 113, 114, 115, 0, 0,
0, 0, 0, 0, 0, 0, 835, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 15, 16,
0, 0, 0, 0, 17, 0, 18, 19, 20, 21,
22, 23, 24, 25, 26, 27, 28, 0, 29, 30,
31, 32, 0, 0, 0, 0, 34, 35, 36, 37,
38, 39, 40, 0, 0, 0, 0, 0, 0, 0,
43, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 50, 0, 0, 0, 0, 0, 0, 0,
55, 0, 0, 0, 0, 0, 0, 0, 0, 185,
186, 187, 65, 66, 67, 0, 0, 69, 70, 0,
0, 0, 0, 0, 0, 0, 0, 188, 75, 76,
77, 78, 79, 80, 0, 81, 82, 83, 84, 85,
0, 0, 0, 0, 0, 0, 87, 0, 0, 0,
0, 189, 89, 90, 91, 92, 0, 93, 94, 0,
95, 190, 97, 0, 0, 0, 99, 0, 0, 100,
5, 6, 7, 8, 9, 101, 102, 0, 0, 0,
10, 105, 106, 107, 0, 0, 108, 191, 0, 0,
0, 0, 0, 112, 113, 114, 115, 0, 0, 0,
0, 0, 0, 0, 0, 1321, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 15, 16, 0,
0, 0, 0, 17, 0, 18, 19, 20, 21, 22,
23, 24, 25, 26, 27, 28, 0, 29, 30, 31,
32, 0, 0, 0, 0, 34, 35, 36, 37, 38,
39, 40, 0, 0, 0, 0, 0, 0, 0, 43,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 50, 0, 0, 0, 0, 0, 0, 0, 55,
0, 0, 0, 0, 0, 0, 0, 0, 185, 186,
187, 65, 66, 67, 0, 0, 69, 70, 0, 0,
0, 0, 0, 0, 0, 0, 188, 75, 76, 77,
78, 79, 80, 0, 81, 82, 83, 84, 85, 0,
0, 0, 0, 0, 0, 87, 0, 0, 0, 0,
189, 89, 90, 91, 92, 0, 93, 94, 0, 95,
190, 97, 0, 0, 0, 99, 0, 0, 100, 0,
0, 0, 0, 0, 101, 102, 0, 0, 0, 0,
105, 106, 107, 0, 0, 108, 191, 5, 6, 7,
8, 9, 112, 113, 114, 115, 0, 10, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 359, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 15, 16, 0, 0, 0, 0,
17, 0, 18, 19, 20, 21, 22, 23, 24, 25,
26, 27, 28, 0, 29, 30, 31, 32, 0, 0,
0, 0, 34, 35, 36, 37, 38, 39, 40, 0,
0, 0, 0, 0, 0, 0, 43, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 50, 0,
0, 0, 0, 0, 0, 0, 55, 0, 0, 0,
0, 0, 0, 0, 0, 185, 186, 187, 65, 66,
67, 0, 0, 69, 70, 0, 0, 0, 0, 0,
0, 0, 0, 188, 75, 76, 77, 78, 79, 80,
0, 81, 82, 83, 84, 85, 0, 0, 0, 0,
0, 0, 87, 0, 0, 0, 0, 189, 89, 90,
91, 92, 0, 93, 94, 0, 95, 190, 97, 0,
0, 0, 99, 0, 0, 100, 5, 6, 7, 8,
9, 101, 102, 0, 0, 0, 10, 105, 106, 107,
0, 0, 108, 1452, 0, 0, 0, 0, 0, 112,
113, 114, 115, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 15, 16, 0, 0, 0, 0, 17,
0, 18, 19, 20, 21, 22, 23, 24, 25, 26,
27, 28, 0, 29, 30, 31, 32, 0, 0, 0,
0, 34, 35, 36, 37, 38, 39, 40, 0, 0,
0, 0, 0, 0, 0, 43, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 50, 0, 0,
0, 0, 0, 0, 0, 55, 0, 0, 0, 0,
0, 0, 0, 0, 185, 186, 187, 65, 66, 67,
0, 0, 69, 70, 0, 0, 0, 0, 0, 0,
0, 0, 188, 75, 76, 77, 78, 79, 80, 0,
81, 82, 83, 84, 85, 0, 0, 0, 0, 0,
0, 87, 0, 0, 0, 0, 189, 89, 90, 91,
92, 0, 93, 94, 0, 95, 190, 97, 0, 0,
0, 99, 0, 0, 100, 5, 6, 7, 8, 9,
101, 102, 0, 0, 0, 10, 105, 106, 107, 0,
0, 108, 191, 0, 0, 0, 0, 0, 112, 113,
114, 115, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 15, 16, 0, 0, 0, 0, 17, 0,
18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
28, 0, 29, 30, 31, 32, 0, 0, 0, 0,
34, 35, 36, 37, 664, 39, 40, 0, 0, 0,
0, 0, 0, 0, 43, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 50, 0, 0, 0,
0, 0, 0, 0, 55, 0, 0, 0, 0, 0,
0, 0, 0, 185, 186, 187, 65, 66, 67, 0,
0, 69, 70, 0, 0, 0, 0, 0, 0, 0,
0, 188, 75, 76, 77, 78, 79, 80, 0, 81,
82, 83, 84, 85, 0, 0, 0, 0, 0, 0,
87, 0, 0, 0, 0, 189, 89, 90, 91, 92,
0, 93, 94, 0, 95, 190, 97, 0, 279, 280,
99, 281, 282, 100, 0, 283, 284, 285, 286, 101,
102, 0, 0, 0, 0, 105, 106, 107, 0, 0,
108, 191, 0, 287, 288, 0, 0, 112, 113, 114,
115, 1166, 1167, 1168, 1169, 1170, 1171, 1172, 1173, 1174,
1175, 1176, 1177, 1178, 1179, 1180, 1181, 1182, 1183, 1184,
1185, 1186, 290, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1187, 292, 293, 294, 295,
296, 297, 298, 0, 0, 0, 212, 0, 213, 40,
0, 0, 299, 0, 0, 0, 0, 0, 300, 301,
302, 303, 304, 305, 306, 307, 308, 309, 310, 50,
311, 312, 313, 314, 315, 316, 317, 318, 319, 320,
321, 322, 323, 324, 325, 326, 327, 328, 329, 330,
331, 332, 333, 334, 0, 335, 0, 336, 337, 338,
339, 0, 0, 0, 340, 600, 216, 217, 218, 219,
220, 601, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 279, 280, 0, 281, 282, 0, 602, 283,
284, 285, 286, 0, 93, 94, 0, 95, 190, 97,
345, 0, 346, 0, 0, 347, 0, 287, 288, 0,
289, 0, 0, 349, 0, 0, 0, 0, 0, 0,
0, 0, 0, 108, 0, 0, 0, 783, 0, 0,
112, 0, 0, 0, 0, 0, 290, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 291, 0, 0,
292, 293, 294, 295, 296, 297, 298, 0, 0, 0,
212, 0, 0, 0, 0, 0, 299, 0, 0, 0,
0, 0, 300, 301, 302, 303, 304, 305, 306, 307,
308, 309, 310, 50, 311, 312, 313, 314, 315, 316,
317, 318, 319, 320, 321, 322, 323, 324, 325, 326,
327, 328, 329, 330, 331, 332, 333, 334, 0, 335,
0, 0, 337, 338, 339, 0, 0, 0, 340, 341,
216, 217, 218, 219, 220, 342, 0, 0, 0, 0,
0, 0, 212, 0, 0, 0, 0, 0, 0, 0,
0, 0, 343, 0, 0, 91, 344, 0, 93, 94,
0, 95, 190, 97, 345, 50, 346, 0, 0, 347,
0, 279, 280, 0, 281, 282, 348, 349, 283, 284,
285, 286, 0, 0, 0, 0, 0, 108, 350, 0,
0, 1710, 1897, 0, 0, 0, 287, 288, 0, 289,
0, 0, 216, 217, 218, 219, 220, 484, 485, 486,
487, 488, 489, 490, 491, 492, 493, 494, 495, 496,
497, 498, 499, 500, 501, 290, 502, 0, 0, 0,
93, 94, 0, 95, 190, 97, 291, 0, 503, 292,
293, 294, 295, 296, 297, 298, 0, 0, 0, 212,
0, 0, 0, 0, 0, 299, 0, 0, 0, 108,
1711, 300, 301, 302, 303, 304, 305, 306, 307, 308,
309, 310, 50, 311, 312, 313, 314, 315, 316, 317,
318, 319, 320, 321, 322, 323, 324, 325, 326, 327,
328, 329, 330, 331, 332, 333, 334, 0, 335, 0,
0, 337, 338, 339, 0, 0, 0, 340, 341, 216,
217, 218, 219, 220, 342, 0, 0, 0, 0, 0,
0, 212, 0, 0, 0, 0, 0, 0, 0, 0,
0, 343, 1130, 0, 91, 344, 0, 93, 94, 0,
95, 190, 97, 345, 50, 346, 0, 0, 347, 0,
279, 280, 0, 281, 282, 348, 349, 283, 284, 285,
286, 0, 0, 0, 0, 0, 108, 350, 0, 0,
0, 1974, 0, 0, 0, 287, 288, 0, 289, 0,
0, 216, 217, 218, 219, 220, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 189, 290, 0, 91, 0, 0, 93,
94, 0, 95, 190, 97, 291, 0, 0, 292, 293,
294, 295, 296, 297, 298, 0, 0, 0, 212, 0,
0, 0, 0, 0, 299, 0, 0, 0, 108, 0,
300, 301, 302, 303, 304, 305, 306, 307, 308, 309,
310, 50, 311, 312, 313, 314, 315, 316, 317, 318,
319, 320, 321, 322, 323, 324, 325, 326, 327, 328,
329, 330, 331, 332, 333, 334, 0, 335, 0, 336,
337, 338, 339, 0, 0, 0, 340, 341, 216, 217,
218, 219, 220, 342, 0, 0, 0, 0, 0, 0,
212, 0, 0, 0, 0, 0, 0, 0, 0, 0,
343, 0, 0, 91, 344, 0, 93, 94, 0, 95,
190, 97, 345, 50, 346, 0, 0, 347, 0, 279,
280, 0, 281, 282, 348, 349, 283, 284, 285, 286,
0, 0, 0, 0, 0, 108, 350, 0, 0, 0,
0, 0, 0, 0, 287, 288, 0, 289, 0, 0,
216, 217, 218, 219, 220, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 189, 290, 0, 91, 92, 0, 93, 94,
0, 95, 190, 97, 291, 0, 0, 292, 293, 294,
295, 296, 297, 298, 0, 0, 0, 212, 0, 0,
0, 0, 0, 299, 0, 0, 0, 108, 0, 300,
301, 302, 303, 304, 305, 306, 307, 308, 309, 310,
50, 311, 312, 313, 314, 315, 316, 317, 318, 319,
320, 321, 322, 323, 324, 325, 326, 327, 328, 329,
330, 331, 332, 333, 334, 0, 335, 0, 0, 337,
338, 339, 0, 0, 0, 340, 341, 216, 217, 218,
219, 220, 342, 0, 0, 0, 0, 0, 0, 212,
0, 0, 0, 0, 0, 0, 0, 0, 212, 343,
0, 0, 91, 344, 0, 93, 94, 0, 95, 190,
97, 345, 50, 346, 0, 0, 347, 0, 0, 0,
0, 50, 0, 348, 349, 1688, 0, 0, 0, 279,
280, 0, 281, 282, 108, 350, 283, 284, 285, 286,
0, 0, 0, 0, 0, 0, 0, 0, 0, 216,
217, 218, 219, 220, 287, 288, 0, 289, 216, 217,
218, 219, 220, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 924, 0, 0, 93, 94, 0,
95, 190, 97, 290, 0, 0, 93, 94, 0, 95,
190, 97, 0, 0, 291, 0, 0, 292, 293, 294,
295, 296, 297, 298, 0, 0, 108, 212, 0, 0,
0, 0, 0, 299, 0, 108, 0, 0, 0, 300,
301, 302, 303, 304, 305, 306, 307, 308, 309, 310,
50, 311, 312, 313, 314, 315, 316, 317, 318, 319,
320, 321, 322, 323, 324, 325, 326, 327, 328, 329,
330, 331, 332, 333, 334, 0, 335, 0, 0, 337,
338, 339, 0, 0, 0, 340, 341, 216, 217, 218,
219, 220, 342, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 343,
0, 0, 91, 344, 0, 93, 94, 0, 95, 190,
97, 345, 0, 346, 0, 0, 347, 0, 1791, 1792,
1793, 1794, 1795, 348, 349, 1796, 1797, 1798, 1799, 0,
0, 0, 0, 0, 108, 350, 0, 0, 0, 0,
0, 0, 1800, 1801, 1802, 0, 477, 478, 0, 479,
480, 481, 482, 483, 484, 485, 486, 487, 488, 489,
490, 491, 492, 493, 494, 495, 496, 497, 498, 499,
500, 501, 1803, 502, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 503, 1804, 1805, 1806, 1807,
1808, 1809, 1810, 0, 0, 0, 212, 0, 0, 0,
0, 0, 1811, 0, 0, 0, 0, 0, 1812, 1813,
1814, 1815, 1816, 1817, 1818, 1819, 1820, 1821, 1822, 50,
1823, 1824, 1825, 1826, 1827, 1828, 1829, 1830, 1831, 1832,
1833, 1834, 1835, 1836, 1837, 1838, 1839, 1840, 1841, 1842,
1843, 1844, 1845, 1846, 1847, 1848, 1849, 1850, 1851, 1852,
1853, 0, 0, 0, 1854, 1855, 216, 217, 218, 219,
220, 0, 1856, 1857, 1858, 1859, 1860, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1861, 1862,
1863, 0, 212, 0, 93, 94, 0, 95, 190, 97,
1864, 0, 1865, 1866, 0, 1867, 0, 0, 0, 0,
0, 0, 1868, 0, 1869, 50, 1870, 0, 1871, 1872,
0, 279, 280, 108, 281, 282, 0, 0, 283, 284,
285, 286, 0, 0, 0, 0, 0, 0, 1697, 0,
0, 0, 0, 0, 0, 0, 287, 288, 0, 0,
0, 1698, 216, 217, 218, 219, 220, 1699, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 189, 290, 0, 91, 92, 0,
93, 94, 0, 95, 1701, 97, 0, 0, 0, 292,
293, 294, 295, 296, 297, 298, 0, 0, 0, 212,
0, 0, 0, 0, 0, 299, 0, 0, 0, 108,
0, 300, 301, 302, 303, 304, 305, 306, 307, 308,
309, 310, 50, 311, 312, 313, 314, 315, 316, 317,
318, 319, 320, 321, 322, 323, 324, 325, 326, 327,
328, 329, 330, 331, 332, 333, 334, 0, 335, 0,
336, 337, 338, 339, 0, 0, 0, 340, 600, 216,
217, 218, 219, 220, 601, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 279, 280, 0, 281, 282,
0, 602, 283, 284, 285, 286, 0, 93, 94, 0,
95, 190, 97, 345, 0, 346, 0, 0, 347, 0,
287, 288, 0, 0, 0, 0, 349, 0, 0, 0,
0, 0, 0, 0, 0, 0, 108, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 290,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 292, 293, 294, 295, 296, 297, 298,
0, 0, 0, 212, 0, 0, 0, 0, 0, 299,
0, 0, 0, 0, 0, 300, 301, 302, 303, 304,
305, 306, 307, 308, 309, 310, 50, 311, 312, 313,
314, 315, 316, 317, 318, 319, 320, 321, 322, 323,
324, 325, 326, 327, 328, 329, 330, 331, 332, 333,
334, 0, 335, 0, 1380, 337, 338, 339, 0, 0,
0, 340, 600, 216, 217, 218, 219, 220, 601, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 279,
280, 0, 281, 282, 0, 602, 283, 284, 285, 286,
0, 93, 94, 0, 95, 190, 97, 345, 0, 346,
0, 0, 347, 0, 287, 288, 0, 0, 0, 0,
349, 0, 0, 0, 0, 0, 0, 0, 0, 0,
108, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 290, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 292, 293, 294,
295, 296, 297, 298, 0, 0, 0, 212, 0, 0,
0, 0, 0, 299, 0, 0, 0, 0, 0, 300,
301, 302, 303, 304, 305, 306, 307, 308, 309, 310,
50, 311, 312, 313, 314, 315, 316, 317, 318, 319,
320, 321, 322, 323, 324, 325, 326, 327, 328, 329,
330, 331, 332, 333, 334, 0, 335, 0, 0, 337,
338, 339, 0, 0, 0, 340, 600, 216, 217, 218,
219, 220, 601, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 602,
0, 0, 0, 0, 0, 93, 94, 0, 95, 190,
97, 345, 0, 346, 0, 0, 347, 474, 475, 476,
0, 0, 0, 0, 349, 0, 0, 0, 0, 0,
0, 0, 0, 0, 108, 0, 0, 477, 478, 0,
479, 480, 481, 482, 483, 484, 485, 486, 487, 488,
489, 490, 491, 492, 493, 494, 495, 496, 497, 498,
499, 500, 501, 0, 502, 474, 475, 476, 0, 0,
0, 0, 0, 0, 0, 0, 503, 0, 0, 0,
0, 0, 0, 0, 0, 477, 478, 0, 479, 480,
481, 482, 483, 484, 485, 486, 487, 488, 489, 490,
491, 492, 493, 494, 495, 496, 497, 498, 499, 500,
501, 0, 502, 474, 475, 476, 0, 0, 0, 0,
0, 0, 0, 0, 503, 0, 0, 0, 0, 0,
0, 0, 0, 477, 478, 0, 479, 480, 481, 482,
483, 484, 485, 486, 487, 488, 489, 490, 491, 492,
493, 494, 495, 496, 497, 498, 499, 500, 501, 0,
502, 474, 475, 476, 0, 0, 0, 0, 0, 0,
0, 0, 503, 0, 0, 0, 0, 0, 0, 0,
0, 477, 478, 1530, 479, 480, 481, 482, 483, 484,
485, 486, 487, 488, 489, 490, 491, 492, 493, 494,
495, 496, 497, 498, 499, 500, 501, 0, 502, 0,
1607, 0, 474, 475, 476, 0, 0, 0, 0, 0,
503, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 477, 478, 0, 479, 480, 481, 482, 483,
484, 485, 486, 487, 488, 489, 490, 491, 492, 493,
494, 495, 496, 497, 498, 499, 500, 501, 1732, 502,
474, 475, 476, 0, 0, 0, 0, 0, 0, 0,
0, 503, 0, 0, 0, 0, 0, 0, 0, 0,
477, 478, 0, 479, 480, 481, 482, 483, 484, 485,
486, 487, 488, 489, 490, 491, 492, 493, 494, 495,
496, 497, 498, 499, 500, 501, 1733, 502, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 503,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
474, 475, 476, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
477, 478, 1531, 479, 480, 481, 482, 483, 484, 485,
486, 487, 488, 489, 490, 491, 492, 493, 494, 495,
496, 497, 498, 499, 500, 501, 0, 502, 0, 0,
0, 474, 475, 476, 0, 0, 0, 0, 0, 503,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 477, 478, 504, 479, 480, 481, 482, 483, 484,
485, 486, 487, 488, 489, 490, 491, 492, 493, 494,
495, 496, 497, 498, 499, 500, 501, 0, 502, 474,
475, 476, 0, 0, 0, 0, 0, 0, 0, 0,
503, 289, 0, 0, 0, 0, 0, 0, 0, 477,
478, 586, 479, 480, 481, 482, 483, 484, 485, 486,
487, 488, 489, 490, 491, 492, 493, 494, 495, 496,
497, 498, 499, 500, 501, 0, 502, 0, 291, 0,
0, 0, 0, 0, 0, 0, 0, 0, 503, 0,
0, 212, 0, 0, 0, 0, 0, 1460, 0, 474,
475, 476, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 50, 0, 0, 0, 0, 477,
478, 588, 479, 480, 481, 482, 483, 484, 485, 486,
487, 488, 489, 490, 491, 492, 493, 494, 495, 496,
497, 498, 499, 500, 501, 0, 502, 0, 0, 0,
589, 216, 217, 218, 219, 220, 590, 0, 503, 0,
0, 0, 0, 0, 0, 0, 0, 1388, 0, 0,
0, 0, 607, 189, 0, 0, 91, 344, 0, 93,
94, 0, 95, 190, 97, 880, 881, 0, 0, 0,
0, 882, 0, 883, 0, 0, 0, 348, 0, 0,
0, 0, 0, 0, 0, 884, 0, 0, 108, 350,
0, 0, 0, 34, 35, 36, 212, 0, 0, 0,
611, 0, 474, 475, 476, 0, 0, 214, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 50,
0, 0, 477, 478, 0, 479, 480, 481, 482, 483,
484, 485, 486, 487, 488, 489, 490, 491, 492, 493,
494, 495, 496, 497, 498, 499, 500, 501, 0, 502,
0, 0, 0, 0, 0, 885, 886, 887, 888, 889,
890, 503, 81, 82, 83, 84, 85, 0, 0, 850,
0, 0, 0, 221, 0, 1115, 0, 0, 189, 89,
90, 91, 92, 0, 93, 94, 0, 95, 190, 97,
0, 0, 0, 99, 0, 0, 0, 0, 0, 0,
0, 0, 891, 892, 0, 0, 0, 29, 105, 0,
0, 0, 0, 108, 893, 34, 35, 36, 212, 0,
213, 40, 0, 0, 0, 0, 0, 0, 0, 214,
547, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 50, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 215, 0,
0, 0, 0, 880, 881, 0, 0, 0, 0, 882,
0, 883, 0, 0, 0, 0, 1116, 75, 216, 217,
218, 219, 220, 884, 81, 82, 83, 84, 85, 0,
0, 34, 35, 36, 212, 221, 0, 0, 0, 0,
189, 89, 90, 91, 92, 214, 93, 94, 0, 95,
190, 97, 0, 0, 0, 99, 0, 50, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
105, 0, 0, 0, 0, 108, 222, 0, 0, 0,
0, 0, 112, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 885, 886, 887, 888, 889, 890, 29,
81, 82, 83, 84, 85, 0, 0, 34, 35, 36,
212, 221, 213, 40, 0, 0, 189, 89, 90, 91,
92, 214, 93, 94, 0, 95, 190, 97, 0, 0,
0, 99, 0, 50, 0, 0, 0, 0, 0, 0,
891, 892, 0, 0, 0, 0, 105, 0, 0, 0,
215, 108, 893, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 75,
216, 217, 218, 219, 220, 29, 81, 82, 83, 84,
85, 0, 0, 34, 35, 36, 212, 221, 213, 40,
0, 0, 189, 89, 90, 91, 92, 214, 93, 94,
0, 95, 190, 97, 0, 0, 0, 99, 0, 50,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 105, 0, 0, 0, 215, 108, 222, 0,
0, 627, 0, 0, 112, 0, 0, 0, 0, 0,
0, 0, 0, 0, 647, 75, 216, 217, 218, 219,
220, 0, 81, 82, 83, 84, 85, 0, 0, 0,
0, 0, 0, 221, 0, 0, 0, 0, 189, 89,
90, 91, 92, 0, 93, 94, 0, 95, 190, 97,
29, 1057, 0, 99, 0, 0, 0, 0, 34, 35,
36, 212, 0, 213, 40, 0, 0, 0, 105, 0,
0, 0, 214, 108, 222, 0, 0, 0, 0, 0,
112, 0, 0, 0, 50, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 215, 1169, 1170, 1171, 1172, 1173, 1174, 1175, 1176,
1177, 1178, 1179, 1180, 1181, 1182, 1183, 1184, 1185, 1186,
75, 216, 217, 218, 219, 220, 29, 81, 82, 83,
84, 85, 0, 1187, 34, 35, 36, 212, 221, 213,
40, 0, 0, 189, 89, 90, 91, 92, 214, 93,
94, 0, 95, 190, 97, 0, 0, 0, 99, 0,
50, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 105, 0, 0, 0, 215, 108, 222,
0, 0, 0, 0, 0, 112, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1217, 75, 216, 217, 218,
219, 220, 29, 81, 82, 83, 84, 85, 0, 0,
34, 35, 36, 212, 221, 213, 40, 0, 0, 189,
89, 90, 91, 92, 214, 93, 94, 0, 95, 190,
97, 0, 0, 0, 99, 0, 50, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 105,
0, 0, 0, 215, 108, 222, 0, 0, 0, 0,
0, 112, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 75, 216, 217, 218, 219, 220, 0, 81,
82, 83, 84, 85, 0, 0, 0, 0, 0, 0,
221, 0, 0, 0, 0, 189, 89, 90, 91, 92,
0, 93, 94, 0, 95, 190, 97, 0, 0, 0,
99, 0, 0, 0, 0, 474, 475, 476, 0, 0,
0, 0, 0, 0, 0, 105, 0, 0, 0, 0,
108, 222, 0, 0, 0, 477, 478, 112, 479, 480,
481, 482, 483, 484, 485, 486, 487, 488, 489, 490,
491, 492, 493, 494, 495, 496, 497, 498, 499, 500,
501, 0, 502, 474, 475, 476, 0, 0, 0, 0,
0, 0, 0, 0, 503, 0, 0, 0, 0, 0,
0, 0, 0, 477, 478, 0, 479, 480, 481, 482,
483, 484, 485, 486, 487, 488, 489, 490, 491, 492,
493, 494, 495, 496, 497, 498, 499, 500, 501, 0,
502, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 503, 0, 474, 475, 476, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 556, 477, 478, 0, 479, 480, 481,
482, 483, 484, 485, 486, 487, 488, 489, 490, 491,
492, 493, 494, 495, 496, 497, 498, 499, 500, 501,
0, 502, 474, 475, 476, 0, 0, 0, 0, 0,
0, 0, 0, 503, 0, 0, 0, 0, 0, 0,
0, 956, 477, 478, 0, 479, 480, 481, 482, 483,
484, 485, 486, 487, 488, 489, 490, 491, 492, 493,
494, 495, 496, 497, 498, 499, 500, 501, 0, 502,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 503, 0, 474, 475, 476, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1043, 477, 478, 0, 479, 480, 481, 482,
483, 484, 485, 486, 487, 488, 489, 490, 491, 492,
493, 494, 495, 496, 497, 498, 499, 500, 501, 0,
502, 474, 475, 476, 0, 0, 0, 0, 0, 0,
0, 0, 503, 0, 0, 0, 0, 0, 0, 0,
1099, 477, 478, 0, 479, 480, 481, 482, 483, 484,
485, 486, 487, 488, 489, 490, 491, 492, 493, 494,
495, 496, 497, 498, 499, 500, 501, 0, 502, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
503, 1161, 1162, 1163, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1435, 1164, 0, 0, 1165, 1166, 1167, 1168, 1169,
1170, 1171, 1172, 1173, 1174, 1175, 1176, 1177, 1178, 1179,
1180, 1181, 1182, 1183, 1184, 1185, 1186, 1161, 1162, 1163,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1187, 0, 0, 0, 0, 0, 0, 0, 1164, 1478,
0, 1165, 1166, 1167, 1168, 1169, 1170, 1171, 1172, 1173,
1174, 1175, 1176, 1177, 1178, 1179, 1180, 1181, 1182, 1183,
1184, 1185, 1186, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1187, 1161, 1162, 1163,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1164, 1361,
0, 1165, 1166, 1167, 1168, 1169, 1170, 1171, 1172, 1173,
1174, 1175, 1176, 1177, 1178, 1179, 1180, 1181, 1182, 1183,
1184, 1185, 1186, 1161, 1162, 1163, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1187, 0, 0, 0,
0, 0, 0, 0, 1164, 1549, 0, 1165, 1166, 1167,
1168, 1169, 1170, 1171, 1172, 1173, 1174, 1175, 1176, 1177,
1178, 1179, 1180, 1181, 1182, 1183, 1184, 1185, 1186, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1187, 1161, 1162, 1163, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1164, 1561, 0, 1165, 1166, 1167,
1168, 1169, 1170, 1171, 1172, 1173, 1174, 1175, 1176, 1177,
1178, 1179, 1180, 1181, 1182, 1183, 1184, 1185, 1186, 1161,
1162, 1163, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1187, 0, 0, 0, 0, 0, 0, 0,
1164, 1674, 0, 1165, 1166, 1167, 1168, 1169, 1170, 1171,
1172, 1173, 1174, 1175, 1176, 1177, 1178, 1179, 1180, 1181,
1182, 1183, 1184, 1185, 1186, 34, 35, 36, 212, 0,
213, 40, 0, 0, 0, 0, 0, 0, 1187, 214,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 50, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1772, 0, 0, 0, 0, 0, 0, 243, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 244,
0, 0, 0, 0, 0, 0, 0, 0, 216, 217,
218, 219, 220, 0, 81, 82, 83, 84, 85, 0,
0, 0, 0, 0, 0, 221, 0, 1774, 0, 0,
189, 89, 90, 91, 92, 0, 93, 94, 0, 95,
190, 97, 0, 0, 0, 99, 0, 34, 35, 36,
212, 0, 213, 40, 0, 0, 0, 0, 0, 0,
105, 678, 0, 0, 0, 108, 245, 0, 0, 0,
0, 0, 112, 50, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
215, 485, 486, 487, 488, 489, 490, 491, 492, 493,
494, 495, 496, 497, 498, 499, 500, 501, 0, 502,
216, 217, 218, 219, 220, 0, 81, 82, 83, 84,
85, 503, 0, 34, 35, 36, 212, 221, 213, 40,
0, 0, 189, 89, 90, 91, 92, 214, 93, 94,
0, 95, 190, 97, 0, 0, 0, 99, 0, 50,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 105, 0, 0, 0, 243, 108, 679, 0,
0, 0, 0, 0, 112, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 216, 217, 218, 219,
220, 0, 81, 82, 83, 84, 85, 212, 0, 0,
0, 0, 0, 221, 0, 0, 0, 0, 189, 89,
90, 91, 92, 0, 93, 94, 0, 95, 190, 97,
50, 0, 0, 99, 0, 0, 0, 0, 367, 368,
0, 0, 0, 0, 0, 0, 0, 0, 105, 0,
0, 0, 0, 108, 245, 0, 0, 0, 0, 0,
112, 0, 0, 0, 0, 0, 0, 216, 217, 218,
219, 220, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 369,
0, 0, 370, 0, 0, 93, 94, 0, 95, 190,
97, 0, 474, 475, 476, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 371, 0, 0, 0, 862,
0, 0, 477, 478, 108, 479, 480, 481, 482, 483,
484, 485, 486, 487, 488, 489, 490, 491, 492, 493,
494, 495, 496, 497, 498, 499, 500, 501, 0, 502,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 503, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 474, 475, 476, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 863, 477, 478, 1040, 479,
480, 481, 482, 483, 484, 485, 486, 487, 488, 489,
490, 491, 492, 493, 494, 495, 496, 497, 498, 499,
500, 501, 0, 502, 474, 475, 476, 0, 0, 0,
0, 0, 0, 0, 0, 503, 0, 0, 0, 0,
0, 0, 0, 0, 477, 478, 0, 479, 480, 481,
482, 483, 484, 485, 486, 487, 488, 489, 490, 491,
492, 493, 494, 495, 496, 497, 498, 499, 500, 501,
0, 502, 1161, 1162, 1163, 0, 0, 0, 0, 0,
0, 0, 0, 503, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1164, 1566, 0, 1165, 1166, 1167, 1168,
1169, 1170, 1171, 1172, 1173, 1174, 1175, 1176, 1177, 1178,
1179, 1180, 1181, 1182, 1183, 1184, 1185, 1186, 1161, 1162,
1163, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1187, 0, 0, 0, 0, 0, 0, 0, 1164,
0, 0, 1165, 1166, 1167, 1168, 1169, 1170, 1171, 1172,
1173, 1174, 1175, 1176, 1177, 1178, 1179, 1180, 1181, 1182,
1183, 1184, 1185, 1186, 475, 476, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1187, 0, 0,
0, 0, 0, 477, 478, 0, 479, 480, 481, 482,
483, 484, 485, 486, 487, 488, 489, 490, 491, 492,
493, 494, 495, 496, 497, 498, 499, 500, 501, 0,
502, 1162, 1163, 0, 0, 0, 0, 0, 0, 0,
0, 0, 503, 0, 0, 0, 0, 0, 0, 0,
0, 1164, 0, 0, 1165, 1166, 1167, 1168, 1169, 1170,
1171, 1172, 1173, 1174, 1175, 1176, 1177, 1178, 1179, 1180,
1181, 1182, 1183, 1184, 1185, 1186, 476, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1187,
0, 0, 0, 0, 477, 478, 0, 479, 480, 481,
482, 483, 484, 485, 486, 487, 488, 489, 490, 491,
492, 493, 494, 495, 496, 497, 498, 499, 500, 501,
1163, 502, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 503, 0, 0, 0, 0, 0, 1164,
0, 0, 1165, 1166, 1167, 1168, 1169, 1170, 1171, 1172,
1173, 1174, 1175, 1176, 1177, 1178, 1179, 1180, 1181, 1182,
1183, 1184, 1185, 1186, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 478, 1187, 479, 480,
481, 482, 483, 484, 485, 486, 487, 488, 489, 490,
491, 492, 493, 494, 495, 496, 497, 498, 499, 500,
501, 0, 502, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1164, 0, 503, 1165, 1166, 1167, 1168, 1169,
1170, 1171, 1172, 1173, 1174, 1175, 1176, 1177, 1178, 1179,
1180, 1181, 1182, 1183, 1184, 1185, 1186, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1187, 479, 480, 481, 482, 483, 484, 485, 486, 487,
488, 489, 490, 491, 492, 493, 494, 495, 496, 497,
498, 499, 500, 501, 0, 502, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 503, 1165, 1166,
1167, 1168, 1169, 1170, 1171, 1172, 1173, 1174, 1175, 1176,
1177, 1178, 1179, 1180, 1181, 1182, 1183, 1184, 1185, 1186,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1187, 482, 483, 484, 485, 486, 487,
488, 489, 490, 491, 492, 493, 494, 495, 496, 497,
498, 499, 500, 501, 0, 502, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 503, 483, 484,
485, 486, 487, 488, 489, 490, 491, 492, 493, 494,
495, 496, 497, 498, 499, 500, 501, 0, 502, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
503, 1168, 1169, 1170, 1171, 1172, 1173, 1174, 1175, 1176,
1177, 1178, 1179, 1180, 1181, 1182, 1183, 1184, 1185, 1186,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1187, -1137, -1137, -1137, -1137, 489, 490,
491, 492, 493, 494, 495, 496, 497, 498, 499, 500,
501, 0, 502, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 503, -1137, -1137, -1137, -1137, 1174,
1175, 1176, 1177, 1178, 1179, 1180, 1181, 1182, 1183, 1184,
1185, 1186, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1187
};
static const yytype_int16 yycheck[] =
{
5, 6, 132, 8, 9, 10, 11, 12, 13, 56,
15, 16, 17, 18, 193, 696, 21, 22, 23, 24,
25, 26, 27, 28, 29, 56, 31, 4, 109, 167,
417, 124, 4, 44, 572, 734, 109, 19, 20, 44,
98, 109, 723, 853, 997, 103, 104, 52, 57, 54,
33, 417, 57, 4, 59, 417, 4, 172, 173, 417,
4, 124, 124, 46, 194, 30, 246, 692, 51, 791,
608, 999, 30, 131, 30, 86, 560, 30, 861, 878,
167, 86, 505, 506, 502, 837, 1427, 827, 693, 868,
1034, 109, 987, 448, 57, 541, 257, 537, 538, 1114,
4, 621, 622, 1228, 109, 550, 671, 9, 1052, 1019,
191, 1021, 9, 1911, 534, 4, 539, 14, 191, 9,
32, 534, 9, 191, 9, 9, 566, 14, 9, 48,
14, 9, 32, 9, 9, 48, 54, 450, 451, 452,
9, 222, 124, 258, 9, 9, 9, 9, 568, 222,
9, 9, 83, 70, 222, 568, 1100, 1110, 9, 9,
9, 9, 70, 9, 245, 9, 9, 36, 9, 9,
1718, 9, 245, 116, 9, 827, 103, 9, 565, 1727,
83, 367, 368, 369, 54, 371, 191, 83, 48, 83,
136, 137, 91, 198, 162, 50, 51, 183, 162, 91,
107, 108, 1001, 136, 137, 162, 136, 137, 653, 654,
57, 48, 103, 199, 48, 183, 183, 222, 199, 136,
137, 0, 69, 2055, 103, 104, 183, 38, 159, 160,
161, 38, 199, 38, 202, 38, 681, 180, 202, 166,
245, 402, 70, 132, 70, 926, 2078, 38, 70, 167,
70, 70, 70, 199, 162, 260, 70, 239, 263, 270,
159, 1156, 38, 167, 182, 270, 271, 159, 162, 70,
203, 716, 83, 176, 70, 166, 83, 196, 83, 2077,
83, 200, 461, 196, 202, 202, 183, 264, 70, 1579,
202, 268, 83, 2091, 202, 70, 203, 167, 997, 201,
202, 201, 70, 1055, 201, 194, 70, 83, 389, 205,
200, 358, 70, 70, 201, 200, 389, 201, 70, 200,
858, 389, 1337, 201, 112, 201, 201, 358, 1068, 184,
1029, 200, 1242, 70, 162, 200, 781, 201, 201, 201,
200, 8, 201, 201, 1685, 1124, 1290, 1126, 1896, 200,
1475, 201, 201, 201, 359, 201, 200, 1482, 201, 1484,
201, 201, 200, 200, 543, 200, 200, 448, 200, 176,
83, 176, 199, 176, 202, 448, 202, 388, 136, 137,
448, 199, 202, 388, 389, 176, 516, 168, 202, 1514,
395, 396, 397, 398, 399, 400, 378, 455, 162, 446,
405, 202, 922, 923, 1694, 387, 202, 389, 83, 84,
975, 1110, 394, 418, 162, 446, 1068, 199, 200, 1314,
425, 202, 199, 70, 406, 870, 1031, 202, 433, 1719,
1720, 876, 1722, 70, 202, 199, 70, 199, 202, 448,
445, 199, 199, 448, 202, 202, 1245, 199, 70, 70,
202, 199, 424, 511, 512, 513, 514, 123, 463, 464,
199, 508, 199, 176, 199, 202, 132, 83, 84, 474,
475, 476, 477, 478, 479, 480, 481, 482, 483, 484,
485, 486, 487, 488, 489, 490, 491, 492, 493, 494,
495, 496, 497, 498, 499, 500, 501, 1238, 503, 517,
505, 506, 507, 948, 1226, 202, 952, 554, 517, 70,
83, 1636, 517, 518, 519, 520, 521, 522, 523, 524,
525, 526, 527, 528, 529, 83, 14, 202, 432, 199,
205, 83, 537, 538, 539, 540, 103, 502, 699, 544,
701, 4, 547, 432, 502, 70, 502, 183, 183, 502,
1333, 556, 199, 558, 517, 202, 70, 1356, 199, 541,
60, 566, 199, 199, 199, 574, 1306, 1307, 202, 574,
1310, 576, 710, 103, 83, 136, 137, 1317, 199, 81,
202, 202, 91, 1121, 122, 1005, 83, 84, 88, 205,
53, 91, 1005, 56, 132, 107, 108, 199, 679, 166,
987, 162, 579, 176, 183, 785, 199, 565, 87, 1049,
73, 136, 137, 162, 793, 103, 104, 166, 176, 1244,
199, 987, 627, 710, 83, 987, 515, 1968, 199, 987,
132, 199, 91, 96, 183, 98, 166, 817, 199, 1057,
103, 104, 87, 195, 31, 124, 125, 126, 162, 1094,
202, 160, 161, 70, 1306, 1307, 1308, 1309, 1310, 1311,
70, 1460, 1557, 1315, 1019, 1317, 1021, 31, 131, 1274,
831, 832, 1277, 1973, 679, 1975, 70, 838, 839, 124,
125, 126, 1202, 1103, 742, 199, 50, 83, 202, 53,
1103, 203, 70, 1138, 81, 91, 70, 1142, 162, 208,
167, 160, 161, 199, 1149, 92, 166, 1020, 19, 20,
1023, 1024, 199, 14, 894, 83, 721, 104, 32, 183,
508, 693, 166, 838, 4, 83, 912, 907, 914, 199,
916, 32, 1473, 91, 920, 199, 168, 719, 202, 19,
20, 201, 202, 199, 207, 750, 534, 118, 207, 181,
51, 1491, 31, 1493, 141, 142, 143, 144, 145, 1654,
83, 1483, 201, 159, 160, 161, 554, 38, 91, 1156,
202, 50, 50, 51, 53, 201, 163, 565, 783, 166,
568, 201, 169, 170, 70, 172, 173, 174, 201, 176,
1156, 202, 160, 161, 1156, 398, 201, 400, 1156, 75,
76, 264, 160, 161, 201, 268, 710, 812, 1292, 272,
112, 198, 794, 75, 76, 418, 53, 54, 55, 121,
122, 123, 124, 125, 126, 201, 1451, 134, 135, 109,
734, 1153, 69, 1155, 1257, 1157, 159, 160, 161, 1491,
845, 1493, 1309, 1283, 1311, 734, 201, 83, 1315, 70,
861, 833, 70, 835, 1294, 91, 861, 70, 83, 1304,
121, 122, 123, 124, 125, 126, 91, 367, 368, 369,
370, 371, 1477, 70, 857, 70, 1598, 1415, 53, 54,
55, 863, 57, 70, 1625, 70, 1627, 1242, 162, 866,
1336, 199, 194, 199, 69, 358, 50, 51, 52, 53,
54, 55, 70, 1643, 162, 1645, 199, 1647, 49, 409,
166, 191, 1652, 201, 1613, 69, 121, 122, 123, 124,
125, 126, 1367, 69, 160, 161, 1371, 1314, 239, 201,
202, 1376, 183, 194, 162, 160, 161, 201, 202, 1384,
201, 204, 222, 990, 106, 107, 108, 851, 1314, 1942,
1943, 956, 1314, 958, 936, 960, 1314, 1938, 1939, 239,
1004, 1005, 851, 9, 199, 245, 971, 199, 162, 432,
952, 953, 162, 1695, 106, 107, 108, 199, 1516, 442,
8, 986, 201, 446, 264, 1431, 162, 199, 268, 194,
14, 1643, 455, 1645, 1532, 1647, 162, 974, 1056, 201,
1652, 201, 974, 1744, 202, 909, 9, 1748, 201, 14,
1019, 1016, 1021, 132, 1019, 1755, 1021, 1026, 132, 200,
909, 1026, 183, 974, 14, 103, 974, 999, 200, 200,
974, 200, 1637, 200, 199, 1040, 206, 112, 1043, 1479,
1045, 113, 114, 115, 1049, 508, 509, 510, 511, 512,
513, 514, 403, 1498, 202, 199, 407, 1502, 9, 1031,
2013, 199, 159, 200, 1509, 2018, 200, 378, 95, 200,
974, 534, 1252, 200, 9, 1255, 387, 367, 368, 369,
201, 371, 14, 394, 435, 974, 437, 438, 439, 440,
2043, 554, 1057, 997, 1099, 406, 183, 1452, 378, 1057,
199, 1057, 9, 1755, 1057, 568, 2034, 387, 997, 389,
199, 202, 1159, 201, 394, 201, 579, 19, 20, 202,
1658, 621, 622, 202, 1107, 1029, 406, 201, 2056, 1667,
201, 1108, 1114, 1115, 202, 83, 599, 2065, 200, 200,
1029, 200, 1455, 1456, 1457, 1683, 201, 134, 199, 1242,
200, 2104, 432, 9, 9, 1965, 204, 204, 70, 204,
1970, 204, 625, 626, 204, 32, 135, 182, 448, 1910,
1557, 162, 138, 1914, 9, 200, 1916, 1917, 162, 1242,
1242, 1621, 1622, 200, 14, 50, 51, 52, 53, 54,
55, 1557, 57, 9, 196, 1557, 9, 660, 661, 1557,
200, 1219, 990, 184, 69, 9, 1110, 14, 1112, 2019,
1219, 9, 200, 134, 1219, 200, 1004, 1005, 200, 9,
200, 1110, 14, 1112, 203, 1230, 204, 1765, 204, 204,
541, 204, 200, 1242, 162, 200, 199, 1242, 200, 103,
201, 201, 9, 138, 162, 9, 200, 199, 1225, 70,
70, 70, 1257, 1225, 199, 1260, 70, 199, 70, 202,
1242, 541, 9, 203, 1916, 1917, 14, 1654, 2067, 184,
81, 734, 2071, 9, 1225, 201, 1258, 1225, 1283, 742,
202, 1225, 14, 1964, 2094, 1966, 2085, 2086, 1654, 1294,
1295, 204, 1654, 104, 202, 176, 1654, 14, 201, 579,
200, 32, 1274, 196, 70, 1277, 32, 199, 199, 14,
199, 199, 14, 1101, 2013, 1103, 199, 52, 70, 2018,
70, 1225, 1333, 2064, 70, 70, 70, 199, 1333, 199,
141, 142, 143, 144, 145, 162, 1225, 239, 1343, 1321,
2081, 1456, 1325, 9, 2043, 138, 200, 14, 201, 201,
199, 1328, 184, 138, 1336, 1337, 167, 162, 169, 170,
9, 172, 173, 174, 827, 69, 829, 200, 176, 9,
176, 1452, 83, 2054, 9, 204, 199, 203, 203, 1452,
1918, 203, 138, 83, 1452, 203, 201, 198, 851, 43,
44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
54, 55, 865, 866, 199, 2104, 14, 201, 719, 83,
201, 200, 912, 199, 914, 69, 916, 199, 202, 200,
920, 204, 922, 923, 924, 202, 202, 9, 138, 92,
1435, 159, 202, 32, 77, 200, 1340, 1442, 201, 719,
201, 184, 1447, 1452, 1449, 138, 909, 1452, 32, 1431,
204, 1340, 9, 204, 734, 918, 919, 1429, 200, 200,
1465, 1599, 9, 1593, 204, 204, 204, 1439, 81, 138,
83, 9, 85, 1478, 1479, 200, 378, 200, 9, 203,
200, 203, 201, 794, 81, 387, 949, 1932, 1933, 201,
14, 104, 394, 201, 201, 83, 202, 9, 201, 138,
199, 199, 199, 204, 406, 1477, 200, 104, 200, 200,
200, 974, 201, 200, 794, 417, 202, 9, 138, 204,
204, 204, 833, 204, 835, 1429, 204, 990, 141, 142,
143, 144, 145, 9, 997, 1439, 200, 32, 1717, 200,
200, 1004, 1005, 201, 141, 142, 143, 144, 145, 200,
176, 201, 863, 833, 2092, 835, 169, 170, 138, 172,
173, 174, 113, 201, 113, 202, 1029, 113, 113, 171,
167, 851, 169, 170, 171, 172, 173, 174, 83, 113,
201, 167, 83, 863, 14, 198, 866, 83, 200, 119,
200, 202, 14, 1056, 138, 200, 138, 1727, 183, 202,
201, 198, 199, 1066, 1067, 1068, 14, 14, 1613, 14,
83, 200, 199, 1618, 83, 198, 1621, 1622, 138, 200,
78, 79, 80, 200, 138, 936, 201, 6, 201, 909,
1688, 14, 14, 201, 92, 202, 14, 9, 1101, 541,
1103, 952, 953, 9, 1691, 1108, 14, 1110, 203, 1112,
68, 183, 83, 9, 1626, 9, 936, 116, 199, 202,
1632, 201, 1634, 103, 1568, 1637, 103, 184, 162, 48,
1133, 174, 952, 953, 36, 200, 199, 199, 180, 1568,
201, 83, 200, 9, 184, 1657, 184, 1664, 177, 147,
148, 149, 150, 151, 974, 1599, 1159, 83, 83, 14,
158, 200, 1202, 1592, 201, 14, 164, 165, 83, 1613,
200, 202, 83, 83, 14, 1894, 83, 997, 14, 83,
178, 1202, 1626, 2046, 1613, 1188, 514, 977, 1632, 509,
1634, 1050, 511, 1738, 113, 193, 2061, 1334, 1764, 1019,
119, 1021, 121, 122, 123, 124, 125, 126, 127, 1029,
2056, 1529, 1259, 1657, 629, 1659, 121, 122, 123, 124,
125, 126, 1225, 1751, 1668, 1789, 1876, 132, 133, 2102,
1659, 1696, 1588, 2078, 56, 1581, 1747, 399, 1310, 1668,
1229, 1753, 1154, 1150, 1067, 1305, 1763, 1764, 1306, 395,
169, 170, 1096, 172, 446, 879, 1956, 2014, 2003, 1573,
1134, 1210, 1188, 1114, 1115, -1, -1, -1, -1, -1,
175, -1, -1, -1, -1, 194, -1, 719, -1, -1,
-1, -1, -1, -1, 203, -1, -1, -1, 1108, 194,
1110, -1, 1112, -1, 1114, 1115, -1, 1726, -1, -1,
-1, 1888, -1, 1306, 1307, 1308, 1309, 1310, 1311, 1753,
-1, 81, 1315, -1, 1317, -1, 6, 1888, 1762, -1,
-1, -1, -1, -1, 1768, 1328, -1, -1, -1, -1,
-1, 1775, -1, 1762, 104, -1, 6, 1340, -1, 1768,
-1, -1, 112, 113, -1, -1, 1775, 1350, -1, 2027,
-1, -1, 794, -1, -1, -1, 1901, -1, 48, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 1956,
-1, 141, 142, 143, 144, 145, -1, -1, 48, -1,
2050, -1, -1, -1, -1, 1956, -1, -1, -1, -1,
-1, 833, -1, 835, -1, -1, 166, -1, -1, 169,
170, -1, 172, 173, 174, 1225, -1, 1258, 19, 20,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 30,
1423, 863, 1242, 113, -1, -1, -1, -1, 198, 119,
-1, 121, 122, 123, 124, 125, 126, 127, 1258, -1,
-1, 6, -1, 113, -1, 56, -1, -1, -1, 119,
-1, 121, 122, 123, 124, 125, 126, 127, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 289, -1, 291,
1321, -1, -1, -1, -1, -1, -1, -1, 1922, 169,
170, -1, 172, 48, -1, 1336, 1337, -1, 1491, -1,
1493, -1, -1, 1922, 936, -1, -1, -1, -1, 169,
170, 1321, 172, -1, 194, -1, -1, -1, 1328, -1,
952, 953, -1, 203, -1, -1, 1336, 1337, -1, -1,
1340, -1, 2034, -1, 194, -1, -1, -1, 350, -1,
-1, -1, -1, 203, 1978, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 2056, 987, -1, -1, 113, 1978,
-1, -1, -1, 2065, 119, 2100, 121, 122, 123, 124,
125, 126, 127, -1, 2109, 1568, -1, -1, -1, 2013,
-1, -1, 2117, -1, 2018, 2120, 1579, -1, -1, -1,
1431, -1, -1, 2027, 2013, 1588, -1, -1, -1, 2018,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 2043,
-1, -1, -1, -1, 169, 170, -1, 172, -1, -1,
1613, 1431, -1, -1, 2043, 6, -1, -1, -1, -1,
-1, 443, -1, -1, 446, -1, -1, -1, 239, 194,
-1, -1, 1452, -1, -1, -1, -1, -1, 203, -1,
1643, -1, 1645, -1, 1647, -1, -1, -1, -1, 1652,
-1, -1, -1, -1, -1, -1, 1659, 48, -1, 2103,
2104, 1664, -1, -1, -1, 1668, -1, -1, -1, -1,
-1, -1, 1114, 1115, 2103, 2104, -1, -1, 289, -1,
291, -1, -1, -1, -1, 1688, -1, -1, 1691, -1,
-1, 1694, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 1704, -1, -1, -1, -1, -1, -1, 1711, -1,
-1, -1, -1, -1, 1156, -1, 1719, 1720, -1, 1722,
-1, -1, 113, -1, -1, -1, 1729, -1, 119, -1,
121, 122, 123, 124, 125, 126, 127, -1, -1, 350,
-1, -1, -1, -1, 6, -1, -1, -1, 1568, -1,
-1, -1, 1755, -1, -1, -1, -1, -1, -1, 1762,
1763, 1764, -1, -1, -1, 1768, -1, 378, -1, -1,
-1, 593, 1775, -1, -1, -1, 387, -1, 169, 170,
-1, 172, -1, 394, -1, -1, 48, -1, -1, -1,
-1, -1, -1, 1613, -1, 406, -1, -1, -1, -1,
-1, -1, -1, 194, -1, 6, 417, -1, -1, -1,
-1, -1, 203, -1, -1, -1, 1258, -1, -1, 121,
122, 123, 124, 125, 126, -1, -1, -1, -1, -1,
132, 133, 443, -1, -1, 446, -1, -1, -1, 1659,
-1, -1, -1, -1, 1664, -1, -1, 48, 1668, -1,
-1, 113, -1, -1, -1, -1, -1, 119, -1, 121,
122, 123, 124, 125, 126, 127, -1, 689, 690, -1,
-1, 173, 1314, 175, -1, -1, -1, -1, -1, 1321,
-1, -1, -1, -1, -1, 1888, -1, 189, -1, 191,
-1, 502, 194, -1, 1336, 1337, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 169, 170, 1912,
172, -1, 113, 1916, 1917, -1, -1, -1, 119, 1922,
121, 122, 123, 124, 125, 126, 127, -1, 1931, -1,
541, -1, 194, -1, -1, 1938, 1939, -1, -1, 1942,
1943, 203, 1762, 1763, 1764, -1, -1, -1, 1768, -1,
-1, -1, -1, 1956, -1, 1775, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 169, 170,
-1, 172, -1, -1, -1, 1978, -1, -1, -1, -1,
-1, -1, 593, -1, 595, -1, -1, 598, -1, 1431,
-1, -1, -1, 194, -1, -1, -1, -1, -1, -1,
-1, -1, 203, -1, -1, -1, -1, -1, -1, -1,
2013, -1, -1, -1, -1, 2018, -1, -1, -1, -1,
631, -1, -1, 2026, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, -1, -1, -1,
2043, -1, -1, -1, -1, -1, 2049, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 878, 879, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 59,
60, -1, -1, -1, -1, -1, -1, -1, 689, 690,
-1, -1, -1, -1, -1, -1, -1, 698, -1, -1,
-1, -1, -1, 10, 11, 12, -1, -1, -1, -1,
2103, 2104, 1922, -1, -1, -1, -1, -1, 719, -1,
-1, -1, -1, 30, 31, 1557, 33, 34, 35, 36,
37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
47, 48, 49, 50, 51, 52, 53, 54, 55, -1,
57, 81, -1, 83, 84, -1, 136, 137, -1, -1,
-1, -1, 69, -1, 976, -1, -1, 81, 1978, 83,
84, -1, -1, -1, 104, -1, -1, -1, -1, -1,
-1, -1, 994, -1, -1, -1, -1, -1, -1, -1,
104, -1, -1, 794, -1, 1007, -1, -1, -1, -1,
-1, -1, -1, 2013, -1, -1, -1, -1, 2018, -1,
-1, 141, 142, 143, 144, 145, -1, -1, -1, -1,
200, -1, 1654, -1, -1, -1, 827, 141, 142, 143,
144, 145, 833, 2043, 835, -1, -1, 167, -1, 169,
170, 1053, 172, 173, 174, -1, -1, -1, -1, -1,
-1, -1, -1, 167, -1, 169, 170, -1, 172, 173,
174, -1, 863, 864, -1, -1, -1, -1, 198, -1,
871, -1, 202, -1, -1, 205, -1, 878, 879, 880,
881, 882, 883, 884, 198, -1, -1, -1, 202, -1,
-1, 205, 893, 2103, 2104, -1, -1, 204, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 910,
-1, -1, -1, -1, -1, -1, 1128, -1, -1, 81,
1132, -1, -1, -1, -1, 1137, -1, -1, -1, 10,
11, 12, -1, -1, -1, 936, -1, -1, -1, -1,
-1, -1, 104, -1, -1, -1, -1, -1, -1, 950,
31, 952, 953, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
51, 52, 53, 54, 55, 976, 977, -1, -1, 141,
142, 143, 144, 145, -1, -1, 987, -1, 69, -1,
-1, -1, -1, 994, -1, -1, -1, -1, -1, -1,
1001, -1, -1, -1, 19, 20, 1007, 169, 170, -1,
172, 173, 174, -1, -1, 30, -1, 1018, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
56, 1243, 1033, -1, -1, -1, 198, 199, -1, 43,
44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
54, 55, 1053, 57, -1, -1, 1057, -1, 10, 11,
12, -1, -1, -1, -1, 69, -1, 1068, -1, -1,
-1, -1, -1, -1, 1286, -1, -1, 1289, 30, 31,
-1, 33, 34, 35, 36, 37, 38, 39, 40, 41,
42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
52, 53, 54, 55, -1, 57, -1, -1, -1, -1,
-1, -1, -1, 1114, 1115, -1, -1, 69, -1, 200,
-1, -1, -1, -1, -1, -1, -1, 1128, -1, -1,
-1, 1132, -1, 1134, -1, -1, 1137, 1349, -1, -1,
-1, -1, -1, -1, 1356, -1, -1, -1, -1, 1150,
1151, 1152, 1153, 1154, 1155, 1156, 1157, -1, -1, 1160,
1161, 1162, 1163, 1164, 1165, 1166, 1167, 1168, 1169, 1170,
1171, 1172, 1173, 1174, 1175, 1176, 1177, 1178, 1179, 1180,
1181, 1182, 1183, 1184, 1185, 1186, 1187, -1, -1, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, -1, -1, -1, 1206, 81, -1, -1, -1,
-1, -1, 1424, 1425, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 239, -1, -1, -1, -1, 104,
-1, -1, -1, -1, 59, 60, -1, -1, -1, -1,
-1, -1, 1243, -1, 1245, -1, -1, -1, -1, 201,
-1, 203, -1, -1, -1, -1, -1, 1258, -1, -1,
-1, -1, -1, 289, -1, 291, 141, 142, 143, 144,
145, -1, 14, 15, 16, 17, 18, 19, 20, 21,
22, 23, 24, 25, 26, 1286, -1, -1, 1289, -1,
-1, 166, -1, -1, 169, 170, -1, 172, 173, 174,
-1, -1, -1, -1, -1, 1306, 1307, 1308, 1309, 1310,
1311, 136, 137, 1314, 1315, -1, 1317, 59, 60, -1,
1321, -1, -1, 198, 350, 1537, 1538, 202, -1, 1541,
-1, -1, -1, -1, -1, 1336, 1337, -1, 1339, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 1349, -1,
-1, -1, -1, -1, -1, 1356, -1, -1, -1, -1,
1361, -1, 1363, 378, -1, -1, -1, 1579, -1, -1,
-1, -1, 387, -1, -1, 200, -1, -1, -1, 394,
-1, 1593, -1, -1, -1, -1, -1, 1388, -1, -1,
-1, 406, -1, -1, 136, 137, -1, -1, -1, -1,
-1, -1, 417, -1, -1, -1, -1, -1, 10, 11,
12, -1, -1, -1, -1, -1, -1, 443, -1, -1,
446, -1, -1, 1424, 1425, -1, -1, 1428, 30, 31,
1431, 33, 34, 35, 36, 37, 38, 39, 40, 41,
42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
52, 53, 54, 55, -1, 57, -1, 1669, 200, 1460,
-1, -1, -1, -1, -1, -1, -1, 69, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
26, -1, 1694, -1, -1, -1, -1, 502, -1, -1,
1491, -1, 1493, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 1719, 1720, -1,
1722, -1, -1, 59, 60, 1727, -1, 1729, -1, -1,
-1, -1, -1, -1, -1, -1, 541, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 1537, 1538, -1, -1,
1541, -1, -1, -1, -1, -1, 1547, -1, 1549, -1,
1551, -1, -1, -1, -1, 1556, 1557, -1, -1, -1,
1561, -1, 1563, -1, -1, 1566, -1, 593, -1, 595,
-1, -1, -1, -1, -1, 1787, -1, -1, 1579, 1580,
-1, -1, -1, 598, -1, 1586, -1, -1, -1, -1,
136, 137, 1593, -1, -1, -1, -1, 31, -1, -1,
-1, 203, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 631, -1, -1, -1,
14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, -1, 68, -1, -1, -1, -1, -1,
-1, -1, 1643, -1, 1645, -1, 1647, 81, -1, -1,
-1, 1652, -1, 1654, 200, -1, -1, -1, -1, -1,
-1, -1, -1, 689, 690, 59, 60, -1, 1669, -1,
104, -1, 698, 1674, -1, -1, -1, -1, 112, -1,
-1, 1893, -1, -1, 31, 1686, 1687, 121, 122, 123,
124, 125, 126, 1694, -1, 1696, 1908, -1, -1, -1,
1912, -1, -1, -1, 719, -1, 140, 141, 142, 143,
144, 145, 146, -1, -1, -1, -1, -1, 1719, 1720,
-1, 1722, -1, -1, -1, -1, 1727, -1, 1729, 163,
-1, -1, 166, 167, 81, 169, 170, -1, 172, 173,
174, -1, 136, 137, -1, 92, -1, 81, -1, -1,
-1, -1, -1, 187, 1755, -1, -1, 104, -1, -1,
194, -1, -1, -1, 198, 199, -1, -1, -1, -1,
104, 1772, 1773, 1774, -1, 1987, -1, -1, 1779, 794,
1781, -1, -1, -1, -1, -1, 1787, -1, 1789, -1,
-1, -1, -1, -1, 141, 142, 143, 144, 145, -1,
-1, -1, 2014, -1, 2016, -1, 200, 141, 142, 143,
144, 145, 827, -1, -1, -1, 163, -1, 833, 166,
835, -1, 169, 170, -1, 172, 173, 174, -1, 176,
-1, -1, 166, -1, -1, 169, 170, -1, 172, 173,
174, -1, -1, -1, -1, 871, -1, -1, 863, 864,
-1, 198, 878, 879, -1, -1, -1, -1, -1, -1,
-1, 19, 20, -1, 198, 880, 881, 882, 883, 884,
-1, -1, 30, -1, -1, -1, -1, -1, 893, -1,
-1, -1, -1, -1, 1885, -1, -1, -1, -1, -1,
-1, -1, 1893, -1, -1, 910, -1, -1, -1, -1,
-1, -1, -1, 81, -1, -1, -1, 1908, -1, -1,
-1, 1912, -1, -1, -1, 1916, 1917, -1, -1, -1,
31, 936, -1, -1, -1, -1, 104, -1, -1, -1,
1931, -1, -1, -1, -1, 950, 1937, 952, 953, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
976, -1, 1953, 1954, -1, -1, -1, 68, -1, 1960,
-1, -1, 977, 141, 142, 143, 144, 145, 994, -1,
81, -1, 987, -1, -1, 1001, 87, -1, -1, -1,
-1, 1007, -1, -1, -1, 163, 1987, -1, 166, -1,
-1, 169, 170, 104, 172, 173, 174, -1, -1, -1,
-1, 2002, -1, 1018, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 2014, -1, 2016, -1, -1, 1033, -1,
198, -1, -1, -1, -1, 203, -1, 1053, -1, 140,
141, 142, 143, 144, 145, 146, -1, -1, -1, -1,
-1, -1, 1057, -1, 2045, -1, -1, -1, -1, -1,
-1, -1, 163, 1068, -1, 166, 167, -1, 169, 170,
2061, 172, 173, 174, -1, 176, 2067, -1, -1, -1,
2071, -1, -1, -1, -1, -1, 187, -1, -1, -1,
-1, 239, -1, -1, 2085, 2086, -1, 198, 199, -1,
50, 51, -1, -1, -1, -1, -1, -1, -1, 1114,
1115, -1, 1128, -1, -1, -1, 1132, -1, 1134, -1,
70, 1137, -1, -1, -1, -1, -1, -1, 78, 79,
80, 81, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 92, -1, -1, 1150, 1151, 1152, 1153, 1154,
1155, 1156, 1157, 31, 104, 1160, 1161, 1162, 1163, 1164,
1165, 1166, 1167, 1168, 1169, 1170, 1171, 1172, 1173, 1174,
1175, 1176, 1177, 1178, 1179, 1180, 1181, 1182, 1183, 1184,
1185, 1186, 1187, -1, -1, -1, -1, -1, -1, -1,
140, 141, 142, 143, 144, 145, -1, -1, -1, -1,
-1, 1206, -1, 81, -1, -1, -1, -1, 158, -1,
-1, -1, -1, 163, -1, -1, 166, 167, -1, 169,
170, -1, 172, 173, 174, -1, 104, 1243, -1, 1245,
378, -1, -1, -1, 31, -1, -1, 187, 188, 387,
-1, -1, -1, -1, -1, -1, 394, -1, 198, 127,
-1, -1, -1, 1258, -1, -1, -1, -1, 406, -1,
-1, -1, 140, 141, 142, 143, 144, 145, 146, 417,
1286, 68, -1, 1289, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 81, 163, 83, -1, 166, 167,
-1, 169, 170, -1, 172, 173, 174, -1, -1, -1,
-1, 1306, 1307, 1308, 1309, 1310, 1311, 104, -1, 1314,
1315, -1, 1317, -1, -1, -1, 1321, -1, -1, -1,
198, -1, -1, -1, 121, 122, 123, 124, 125, 126,
-1, 1336, 1337, 1349, 1339, -1, -1, -1, -1, -1,
1356, -1, -1, 140, 141, 142, 143, 144, 145, 146,
-1, -1, -1, -1, 502, -1, 1361, -1, 1363, -1,
-1, -1, -1, -1, -1, -1, 163, 31, -1, 166,
167, -1, 169, 170, -1, 172, 173, 174, -1, -1,
-1, -1, -1, 1388, -1, -1, -1, -1, -1, -1,
187, -1, -1, 541, -1, -1, -1, 194, -1, -1,
-1, 198, 199, -1, 68, -1, -1, -1, 1424, 1425,
-1, -1, -1, -1, -1, -1, -1, 81, -1, -1,
-1, -1, -1, 1428, -1, -1, 1431, -1, 10, 11,
12, -1, -1, -1, -1, -1, -1, -1, -1, -1,
104, -1, -1, -1, 1460, -1, -1, -1, 30, 31,
598, 33, 34, 35, 36, 37, 38, 39, 40, 41,
42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
52, 53, 54, 55, -1, 57, 140, 141, 142, 143,
144, 145, 146, 631, -1, -1, 1491, 69, 1493, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 163,
-1, -1, 166, 167, -1, 169, 170, -1, 172, 173,
174, -1, -1, -1, -1, -1, 31, -1, -1, -1,
-1, 1537, 1538, 187, -1, 1541, -1, -1, -1, -1,
-1, -1, -1, -1, 198, 199, -1, -1, -1, -1,
-1, -1, 1547, -1, 1549, -1, 1551, -1, -1, -1,
-1, 1556, 1557, 68, -1, -1, 1561, -1, 1563, 598,
-1, 1566, -1, 1579, -1, -1, 81, -1, -1, -1,
-1, 719, 87, -1, -1, 1580, -1, 1593, -1, -1,
-1, 1586, -1, -1, -1, -1, -1, 31, -1, 104,
-1, -1, 631, -1, -1, -1, -1, -1, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
26, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 203, -1, -1, 68, 140, 141, 142, 143, 144,
145, 146, -1, -1, -1, -1, -1, 81, 1643, -1,
1645, -1, 1647, 59, 60, -1, 794, 1652, 163, 1654,
-1, 166, 167, 1669, 169, 170, -1, 172, 173, 174,
104, 176, -1, -1, -1, -1, -1, -1, 112, 1674,
-1, -1, 187, -1, -1, -1, -1, -1, 1694, -1,
-1, 1686, 1687, 198, 199, 833, -1, 835, -1, -1,
-1, 1696, -1, -1, -1, -1, 140, 141, 142, 143,
144, 145, 146, 1719, 1720, -1, 1722, -1, -1, -1,
-1, 1727, -1, 1729, -1, 863, 864, -1, -1, 163,
136, 137, 166, 167, -1, 169, 170, -1, 172, 173,
174, -1, 880, 881, 882, 883, 884, -1, -1, -1,
-1, -1, -1, 187, -1, 893, 31, -1, -1, -1,
1755, -1, -1, -1, 198, 199, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 1772, 1773, 1774,
-1, 1787, -1, -1, 1779, -1, 1781, -1, -1, -1,
-1, -1, -1, 68, 1789, -1, -1, -1, 936, -1,
-1, -1, -1, -1, -1, -1, 81, -1, -1, -1,
-1, -1, 87, -1, 952, 953, 14, 15, 16, 17,
18, 19, 20, 21, 22, 23, 24, 25, 26, 104,
-1, -1, -1, -1, -1, 864, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 987,
-1, 880, 881, 882, 883, 884, -1, -1, -1, -1,
-1, 59, 60, -1, 893, 140, 141, 142, 143, 144,
145, 146, -1, -1, -1, -1, -1, -1, -1, -1,
1018, -1, -1, -1, -1, -1, -1, 1893, 163, -1,
1885, 166, 167, -1, 169, 170, -1, 172, 173, 174,
-1, -1, 1908, -1, -1, -1, 1912, -1, -1, -1,
-1, -1, 187, -1, -1, -1, -1, -1, -1, 1057,
-1, 1916, 1917, 198, 199, 1931, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 136, 137,
-1, -1, 1937, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 1953, 1954,
-1, -1, -1, -1, -1, 1960, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 1114, 1115, -1, -1,
-1, 1987, -1, -1, -1, -1, -1, -1, -1, 1018,
39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 51, 52, 53, 54, 55, 2002, 2014, -1,
2016, -1, 1150, 1151, 1152, 1153, 1154, 1155, 1156, 1157,
69, -1, 1160, 1161, 1162, 1163, 1164, 1165, 1166, 1167,
1168, 1169, 1170, 1171, 1172, 1173, 1174, 1175, 1176, 1177,
1178, 1179, 1180, 1181, 1182, 1183, 1184, 1185, 1186, 1187,
2045, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 2067, -1, -1, -1, 2071, 2061, -1, 1206, 10,
11, 12, -1, -1, -1, -1, -1, -1, -1, 2085,
2086, -1, -1, -1, -1, -1, -1, -1, -1, 30,
31, -1, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
51, 52, 53, 54, 55, -1, 57, -1, -1, -1,
1258, 1150, 1151, -1, -1, 1154, -1, -1, 69, -1,
-1, 1160, 1161, 1162, 1163, 1164, 1165, 1166, 1167, 1168,
1169, 1170, 1171, 1172, 1173, 1174, 1175, 1176, 1177, 1178,
1179, 1180, 1181, 1182, 1183, 1184, 1185, 1186, 1187, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 1314, 1206, -1, -1,
-1, -1, -1, 1321, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, -1, 1336, 1337,
-1, 1339, 35, 36, 37, 38, 39, 40, 41, 42,
43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
53, 54, 55, 1361, 57, 1363, -1, -1, 81, 59,
60, 78, 79, 80, 81, -1, 69, -1, -1, -1,
10, 11, 12, -1, -1, -1, -1, -1, -1, -1,
1388, 104, -1, -1, -1, -1, -1, 104, -1, -1,
30, 31, 203, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
50, 51, 52, 53, 54, 55, -1, 57, 141, 142,
143, 144, 145, 1431, 141, 142, 143, 144, 145, 69,
-1, -1, -1, -1, -1, -1, 136, 137, -1, -1,
1339, -1, -1, -1, -1, -1, 169, 170, -1, 172,
173, 174, 169, 170, -1, 172, 173, 174, -1, -1,
-1, -1, 1361, -1, 1363, -1, -1, 10, 11, 12,
-1, -1, -1, -1, -1, 198, 199, -1, -1, -1,
-1, 198, -1, -1, -1, -1, -1, 30, 31, 1388,
33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
53, 54, 55, -1, 57, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 69, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 1547,
-1, 1549, -1, 1551, -1, -1, -1, -1, 1556, 1557,
-1, -1, -1, 1561, -1, 1563, -1, -1, 1566, 10,
11, 12, -1, 203, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 30,
31, -1, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
51, 52, 53, 54, 55, -1, 57, 3, 4, -1,
6, 7, -1, -1, 10, 11, 12, 13, 69, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 28, 29, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 1654, -1, 1547, -1,
1549, -1, 1551, -1, -1, -1, -1, 1556, -1, -1,
203, 57, 1561, -1, 1563, -1, 1674, 1566, -1, -1,
-1, -1, -1, -1, -1, 71, 72, 73, 74, 75,
76, 77, -1, -1, -1, 81, -1, 83, 84, -1,
-1, 87, -1, -1, -1, -1, -1, 93, 94, 95,
96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
126, 127, 128, -1, 130, -1, 132, 133, 134, 135,
-1, -1, -1, 139, 140, 141, 142, 143, 144, 145,
146, -1, 203, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 1772, 1773, 1774, 163, -1, -1,
-1, 1779, -1, 169, 170, 1674, 172, 173, 174, 175,
1788, 177, -1, -1, 180, -1, -1, 10, 11, 12,
-1, -1, 188, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 198, -1, -1, -1, 202, 30, 31, 205,
33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
53, 54, 55, -1, 57, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 69, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 10, 11,
12, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 1772, 1773, 1774, -1, 1885, 30, 31,
1779, 33, 34, 35, 36, 37, 38, 39, 40, 41,
42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
52, 53, 54, 55, -1, 57, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 69, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 1937,
10, 11, 12, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 1953, 1954, -1, -1, -1,
30, 31, 1960, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
50, 51, 52, 53, 54, 55, -1, 57, -1, -1,
203, 1989, -1, -1, -1, -1, 1885, -1, -1, 69,
-1, -1, -1, -1, 2002, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
51, 52, 53, 54, 55, 3, 4, 5, 6, 7,
-1, -1, -1, -1, -1, 13, -1, -1, 69, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 1937, 27,
28, 29, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 203, -1, -1, 1953, 1954, -1, -1, -1, -1,
48, 1960, 50, 51, -1, -1, -1, -1, 56, -1,
58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
68, -1, 70, 71, 72, 73, 74, -1, -1, -1,
78, 79, 80, 81, 82, 83, 84, -1, 86, -1,
88, -1, -1, 2002, 92, 93, 94, 95, -1, 97,
-1, 99, -1, 101, -1, -1, 104, 105, -1, -1,
200, 109, 110, 111, 112, 113, 114, 115, -1, 117,
118, 119, 120, 121, 122, 123, 124, 125, 126, -1,
128, 129, 130, 131, 132, 133, -1, -1, -1, -1,
-1, 139, 140, 141, 142, 143, 144, 145, -1, 147,
148, 149, 150, 151, -1, -1, -1, 155, -1, -1,
158, -1, -1, -1, -1, 163, 164, 165, 166, 167,
-1, 169, 170, -1, 172, 173, 174, 175, -1, -1,
178, -1, -1, 181, -1, -1, -1, -1, -1, 187,
188, 189, -1, 191, -1, 193, 194, 195, -1, -1,
198, 199, -1, 201, 202, -1, -1, 205, 206, 207,
208, 3, 4, 5, 6, 7, -1, -1, -1, -1,
-1, 13, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 27, 28, 29, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 48, -1, 50, 51,
-1, -1, -1, -1, 56, -1, 58, 59, 60, 61,
62, 63, 64, 65, 66, 67, 68, -1, 70, 71,
72, 73, 74, -1, -1, -1, 78, 79, 80, 81,
82, 83, 84, -1, 86, -1, 88, -1, -1, -1,
92, 93, 94, 95, -1, 97, -1, 99, -1, 101,
-1, -1, 104, 105, -1, -1, -1, 109, 110, 111,
112, 113, 114, 115, -1, 117, -1, 119, 120, 121,
122, 123, 124, 125, 126, -1, 128, 129, 130, 131,
132, 133, -1, -1, -1, -1, -1, 139, 140, 141,
142, 143, 144, 145, -1, 147, 148, 149, 150, 151,
-1, -1, -1, 155, -1, -1, 158, -1, -1, -1,
-1, 163, 164, 165, 166, 167, -1, 169, 170, -1,
172, 173, 174, 175, -1, -1, 178, -1, -1, 181,
-1, -1, -1, -1, -1, 187, 188, 189, -1, 191,
-1, 193, 194, 195, -1, -1, 198, 199, -1, 201,
202, 203, -1, 205, 206, 207, 208, 3, 4, 5,
6, 7, -1, -1, -1, -1, -1, 13, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 27, 28, 29, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 48, -1, 50, 51, -1, -1, -1, -1,
56, -1, 58, 59, 60, 61, 62, 63, 64, 65,
66, 67, 68, -1, 70, 71, 72, 73, 74, -1,
-1, -1, 78, 79, 80, 81, 82, 83, 84, -1,
86, -1, 88, -1, -1, -1, 92, 93, 94, 95,
-1, 97, -1, 99, -1, 101, -1, -1, 104, 105,
-1, -1, -1, 109, 110, 111, 112, 113, 114, 115,
-1, 117, -1, 119, 120, 121, 122, 123, 124, 125,
126, -1, 128, 129, 130, 131, 132, 133, -1, -1,
-1, -1, -1, 139, 140, 141, 142, 143, 144, 145,
-1, 147, 148, 149, 150, 151, -1, -1, -1, 155,
-1, -1, 158, -1, -1, -1, -1, 163, 164, 165,
166, 167, -1, 169, 170, -1, 172, 173, 174, 175,
-1, -1, 178, -1, -1, 181, -1, -1, -1, -1,
-1, 187, 188, 189, -1, 191, -1, 193, 194, 195,
-1, -1, 198, 199, -1, 201, 202, 203, -1, 205,
206, 207, 208, 3, 4, 5, 6, 7, -1, -1,
-1, -1, -1, 13, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 27, 28, 29,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 48, -1,
50, 51, -1, -1, -1, -1, 56, -1, 58, 59,
60, 61, 62, 63, 64, 65, 66, 67, 68, -1,
70, 71, 72, 73, 74, -1, -1, -1, 78, 79,
80, 81, 82, 83, 84, -1, 86, -1, 88, -1,
-1, -1, 92, 93, 94, 95, -1, 97, -1, 99,
-1, 101, -1, -1, 104, 105, -1, -1, -1, 109,
110, 111, 112, -1, 114, 115, -1, 117, -1, -1,
120, 121, 122, 123, 124, 125, 126, -1, 128, 129,
130, -1, 132, 133, -1, -1, -1, -1, -1, 139,
140, 141, 142, 143, 144, 145, -1, 147, 148, 149,
150, 151, -1, -1, -1, 155, -1, -1, 158, -1,
-1, -1, -1, 163, 164, 165, 166, 167, -1, 169,
170, -1, 172, 173, 174, 175, -1, -1, 178, -1,
-1, 181, -1, -1, -1, -1, -1, 187, 188, -1,
-1, -1, -1, 193, 194, 195, -1, -1, 198, 199,
-1, 201, 202, 203, -1, 205, 206, 207, 208, 3,
4, 5, 6, 7, -1, -1, -1, -1, -1, 13,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 27, 28, 29, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 48, -1, 50, 51, -1, -1,
-1, -1, 56, -1, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, -1, 70, 71, 72, 73,
74, -1, -1, -1, 78, 79, 80, 81, 82, 83,
84, -1, 86, -1, 88, -1, -1, -1, 92, 93,
94, 95, -1, 97, -1, 99, -1, 101, -1, -1,
104, 105, -1, -1, -1, 109, 110, 111, 112, -1,
114, 115, -1, 117, -1, -1, 120, 121, 122, 123,
124, 125, 126, -1, 128, 129, 130, -1, 132, 133,
-1, -1, -1, -1, -1, 139, 140, 141, 142, 143,
144, 145, -1, 147, 148, 149, 150, 151, -1, -1,
-1, 155, -1, -1, 158, -1, -1, -1, -1, 163,
164, 165, 166, 167, -1, 169, 170, -1, 172, 173,
174, 175, -1, -1, 178, -1, -1, 181, -1, -1,
-1, -1, -1, 187, 188, -1, -1, -1, -1, 193,
194, 195, -1, -1, 198, 199, -1, 201, 202, 203,
-1, 205, 206, 207, 208, 3, 4, 5, 6, 7,
-1, -1, -1, -1, -1, 13, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 27,
28, 29, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
48, -1, 50, 51, -1, -1, -1, -1, 56, -1,
58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
68, -1, 70, 71, 72, 73, 74, -1, -1, -1,
78, 79, 80, 81, 82, 83, 84, -1, 86, -1,
88, -1, -1, -1, 92, 93, 94, 95, -1, 97,
-1, 99, -1, 101, -1, -1, 104, 105, -1, -1,
-1, 109, 110, 111, 112, -1, 114, 115, -1, 117,
118, -1, 120, 121, 122, 123, 124, 125, 126, -1,
128, 129, 130, -1, 132, 133, -1, -1, -1, -1,
-1, 139, 140, 141, 142, 143, 144, 145, -1, 147,
148, 149, 150, 151, -1, -1, -1, 155, -1, -1,
158, -1, -1, -1, -1, 163, 164, 165, 166, 167,
-1, 169, 170, -1, 172, 173, 174, 175, -1, -1,
178, -1, -1, 181, -1, -1, -1, -1, -1, 187,
188, -1, -1, -1, -1, 193, 194, 195, -1, -1,
198, 199, -1, 201, 202, -1, -1, 205, 206, 207,
208, 3, 4, 5, 6, 7, -1, -1, -1, -1,
-1, 13, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 27, 28, 29, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 48, -1, 50, 51,
-1, -1, -1, -1, 56, -1, 58, 59, 60, 61,
62, 63, 64, 65, 66, 67, 68, -1, 70, 71,
72, 73, 74, -1, -1, -1, 78, 79, 80, 81,
82, 83, 84, -1, 86, -1, 88, -1, -1, -1,
92, 93, 94, 95, -1, 97, -1, 99, -1, 101,
-1, -1, 104, 105, -1, -1, -1, 109, 110, 111,
112, -1, 114, 115, -1, 117, -1, -1, 120, 121,
122, 123, 124, 125, 126, -1, 128, 129, 130, -1,
132, 133, -1, -1, -1, -1, -1, 139, 140, 141,
142, 143, 144, 145, -1, 147, 148, 149, 150, 151,
-1, -1, -1, 155, -1, -1, 158, -1, -1, -1,
-1, 163, 164, 165, 166, 167, -1, 169, 170, -1,
172, 173, 174, 175, -1, -1, 178, -1, -1, 181,
-1, -1, -1, -1, -1, 187, 188, -1, -1, -1,
-1, 193, 194, 195, -1, -1, 198, 199, -1, 201,
202, 203, -1, 205, 206, 207, 208, 3, 4, 5,
6, 7, -1, -1, -1, -1, -1, 13, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 27, 28, 29, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 48, -1, 50, 51, -1, -1, -1, -1,
56, -1, 58, 59, 60, 61, 62, 63, 64, 65,
66, 67, 68, -1, 70, 71, 72, 73, 74, -1,
-1, -1, 78, 79, 80, 81, 82, 83, 84, -1,
86, -1, 88, -1, -1, -1, 92, 93, 94, 95,
-1, 97, -1, 99, -1, 101, -1, -1, 104, 105,
-1, -1, -1, 109, 110, 111, 112, -1, 114, 115,
-1, 117, -1, -1, 120, 121, 122, 123, 124, 125,
126, -1, 128, 129, 130, -1, 132, 133, -1, -1,
-1, -1, -1, 139, 140, 141, 142, 143, 144, 145,
-1, 147, 148, 149, 150, 151, -1, -1, -1, 155,
-1, -1, 158, -1, -1, -1, -1, 163, 164, 165,
166, 167, -1, 169, 170, -1, 172, 173, 174, 175,
-1, -1, 178, -1, -1, 181, -1, -1, -1, -1,
-1, 187, 188, -1, -1, -1, -1, 193, 194, 195,
-1, -1, 198, 199, -1, 201, 202, 203, -1, 205,
206, 207, 208, 3, 4, 5, 6, 7, -1, -1,
-1, -1, -1, 13, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 27, 28, 29,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 48, -1,
50, 51, -1, -1, -1, -1, 56, -1, 58, 59,
60, 61, 62, 63, 64, 65, 66, 67, 68, -1,
70, 71, 72, 73, 74, -1, -1, -1, 78, 79,
80, 81, 82, 83, 84, -1, 86, -1, 88, -1,
-1, -1, 92, 93, 94, 95, -1, 97, -1, 99,
-1, 101, -1, -1, 104, 105, -1, -1, -1, 109,
110, 111, 112, -1, 114, 115, -1, 117, -1, -1,
120, 121, 122, 123, 124, 125, 126, -1, 128, 129,
130, -1, 132, 133, -1, -1, -1, -1, -1, 139,
140, 141, 142, 143, 144, 145, -1, 147, 148, 149,
150, 151, -1, -1, -1, 155, -1, -1, 158, -1,
-1, -1, -1, 163, 164, 165, 166, 167, -1, 169,
170, -1, 172, 173, 174, 175, -1, -1, 178, -1,
-1, 181, -1, -1, -1, -1, -1, 187, 188, -1,
-1, -1, -1, 193, 194, 195, -1, -1, 198, 199,
-1, 201, 202, 203, -1, 205, 206, 207, 208, 3,
4, 5, 6, 7, -1, -1, -1, -1, -1, 13,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 27, 28, 29, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 48, -1, 50, 51, -1, -1,
-1, -1, 56, -1, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, -1, 70, 71, 72, 73,
74, -1, -1, -1, 78, 79, 80, 81, 82, 83,
84, -1, 86, -1, 88, -1, -1, -1, 92, 93,
94, 95, -1, 97, -1, 99, -1, 101, -1, -1,
104, 105, -1, -1, -1, 109, 110, 111, 112, -1,
114, 115, -1, 117, -1, -1, 120, 121, 122, 123,
124, 125, 126, -1, 128, 129, 130, -1, 132, 133,
-1, -1, -1, -1, -1, 139, 140, 141, 142, 143,
144, 145, -1, 147, 148, 149, 150, 151, -1, -1,
-1, 155, -1, -1, 158, -1, -1, -1, -1, 163,
164, 165, 166, 167, -1, 169, 170, -1, 172, 173,
174, 175, -1, -1, 178, -1, -1, 181, -1, -1,
-1, -1, -1, 187, 188, -1, -1, -1, -1, 193,
194, 195, -1, -1, 198, 199, -1, 201, 202, 203,
-1, 205, 206, 207, 208, 3, 4, 5, 6, 7,
-1, -1, -1, -1, -1, 13, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 27,
28, 29, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
48, -1, 50, 51, -1, -1, -1, -1, 56, -1,
58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
68, -1, 70, 71, 72, 73, 74, -1, -1, -1,
78, 79, 80, 81, 82, 83, 84, -1, 86, -1,
88, -1, -1, -1, 92, 93, 94, 95, 96, 97,
-1, 99, -1, 101, -1, -1, 104, 105, -1, -1,
-1, 109, 110, 111, 112, -1, 114, 115, -1, 117,
-1, -1, 120, 121, 122, 123, 124, 125, 126, -1,
128, 129, 130, -1, 132, 133, -1, -1, -1, -1,
-1, 139, 140, 141, 142, 143, 144, 145, -1, 147,
148, 149, 150, 151, -1, -1, -1, 155, -1, -1,
158, -1, -1, -1, -1, 163, 164, 165, 166, 167,
-1, 169, 170, -1, 172, 173, 174, 175, -1, -1,
178, -1, -1, 181, -1, -1, -1, -1, -1, 187,
188, -1, -1, -1, -1, 193, 194, 195, -1, -1,
198, 199, -1, 201, 202, -1, -1, 205, 206, 207,
208, 3, 4, 5, 6, 7, -1, -1, -1, -1,
-1, 13, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 27, 28, 29, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 48, -1, 50, 51,
-1, -1, -1, -1, 56, -1, 58, 59, 60, 61,
62, 63, 64, 65, 66, 67, 68, -1, 70, 71,
72, 73, 74, -1, -1, -1, 78, 79, 80, 81,
82, 83, 84, -1, 86, -1, 88, -1, -1, -1,
92, 93, 94, 95, -1, 97, -1, 99, -1, 101,
102, -1, 104, 105, -1, -1, -1, 109, 110, 111,
112, -1, 114, 115, -1, 117, -1, -1, 120, 121,
122, 123, 124, 125, 126, -1, 128, 129, 130, -1,
132, 133, -1, -1, -1, -1, -1, 139, 140, 141,
142, 143, 144, 145, -1, 147, 148, 149, 150, 151,
-1, -1, -1, 155, -1, -1, 158, -1, -1, -1,
-1, 163, 164, 165, 166, 167, -1, 169, 170, -1,
172, 173, 174, 175, -1, -1, 178, -1, -1, 181,
-1, -1, -1, -1, -1, 187, 188, -1, -1, -1,
-1, 193, 194, 195, -1, -1, 198, 199, -1, 201,
202, -1, -1, 205, 206, 207, 208, 3, 4, 5,
6, 7, -1, -1, -1, -1, -1, 13, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 27, 28, 29, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 48, -1, 50, 51, -1, -1, -1, -1,
56, -1, 58, 59, 60, 61, 62, 63, 64, 65,
66, 67, 68, -1, 70, 71, 72, 73, 74, -1,
-1, -1, 78, 79, 80, 81, 82, 83, 84, -1,
86, -1, 88, -1, -1, -1, 92, 93, 94, 95,
-1, 97, -1, 99, -1, 101, -1, -1, 104, 105,
-1, -1, -1, 109, 110, 111, 112, -1, 114, 115,
-1, 117, -1, -1, 120, 121, 122, 123, 124, 125,
126, -1, 128, 129, 130, -1, 132, 133, -1, -1,
-1, -1, -1, 139, 140, 141, 142, 143, 144, 145,
-1, 147, 148, 149, 150, 151, -1, -1, -1, 155,
-1, -1, 158, -1, -1, -1, -1, 163, 164, 165,
166, 167, -1, 169, 170, -1, 172, 173, 174, 175,
-1, -1, 178, -1, -1, 181, -1, -1, -1, -1,
-1, 187, 188, -1, -1, -1, -1, 193, 194, 195,
-1, -1, 198, 199, -1, 201, 202, 203, -1, 205,
206, 207, 208, 3, 4, 5, 6, 7, -1, -1,
-1, -1, -1, 13, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 27, 28, 29,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 48, -1,
50, 51, -1, -1, -1, -1, 56, -1, 58, 59,
60, 61, 62, 63, 64, 65, 66, 67, 68, -1,
70, 71, 72, 73, 74, -1, -1, 77, 78, 79,
80, 81, 82, 83, 84, -1, 86, -1, 88, -1,
-1, -1, 92, 93, 94, 95, -1, 97, -1, 99,
-1, 101, -1, -1, 104, 105, -1, -1, -1, 109,
110, 111, 112, -1, 114, 115, -1, 117, -1, -1,
120, 121, 122, 123, 124, 125, 126, -1, 128, 129,
130, -1, 132, 133, -1, -1, -1, -1, -1, 139,
140, 141, 142, 143, 144, 145, -1, 147, 148, 149,
150, 151, -1, -1, -1, 155, -1, -1, 158, -1,
-1, -1, -1, 163, 164, 165, 166, 167, -1, 169,
170, -1, 172, 173, 174, 175, -1, -1, 178, -1,
-1, 181, -1, -1, -1, -1, -1, 187, 188, -1,
-1, -1, -1, 193, 194, 195, -1, -1, 198, 199,
-1, 201, 202, -1, -1, 205, 206, 207, 208, 3,
4, 5, 6, 7, -1, -1, -1, -1, -1, 13,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 27, 28, 29, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 48, -1, 50, 51, -1, -1,
-1, -1, 56, -1, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, -1, 70, 71, 72, 73,
74, -1, -1, -1, 78, 79, 80, 81, 82, 83,
84, -1, 86, -1, 88, -1, -1, -1, 92, 93,
94, 95, -1, 97, -1, 99, -1, 101, -1, -1,
104, 105, -1, -1, -1, 109, 110, 111, 112, -1,
114, 115, -1, 117, -1, -1, 120, 121, 122, 123,
124, 125, 126, -1, 128, 129, 130, -1, 132, 133,
-1, -1, -1, -1, -1, 139, 140, 141, 142, 143,
144, 145, -1, 147, 148, 149, 150, 151, -1, -1,
-1, 155, -1, -1, 158, -1, -1, -1, -1, 163,
164, 165, 166, 167, -1, 169, 170, -1, 172, 173,
174, 175, -1, -1, 178, -1, -1, 181, -1, -1,
-1, -1, -1, 187, 188, -1, -1, -1, -1, 193,
194, 195, -1, -1, 198, 199, -1, 201, 202, 203,
-1, 205, 206, 207, 208, 3, 4, 5, 6, 7,
-1, -1, -1, -1, -1, 13, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 27,
28, 29, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
48, -1, 50, 51, -1, -1, -1, -1, 56, -1,
58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
68, -1, 70, 71, 72, 73, 74, -1, -1, -1,
78, 79, 80, 81, 82, 83, 84, -1, 86, -1,
88, -1, -1, -1, 92, 93, 94, 95, -1, 97,
-1, 99, 100, 101, -1, -1, 104, 105, -1, -1,
-1, 109, 110, 111, 112, -1, 114, 115, -1, 117,
-1, -1, 120, 121, 122, 123, 124, 125, 126, -1,
128, 129, 130, -1, 132, 133, -1, -1, -1, -1,
-1, 139, 140, 141, 142, 143, 144, 145, -1, 147,
148, 149, 150, 151, -1, -1, -1, 155, -1, -1,
158, -1, -1, -1, -1, 163, 164, 165, 166, 167,
-1, 169, 170, -1, 172, 173, 174, 175, -1, -1,
178, -1, -1, 181, -1, -1, -1, -1, -1, 187,
188, -1, -1, -1, -1, 193, 194, 195, -1, -1,
198, 199, -1, 201, 202, -1, -1, 205, 206, 207,
208, 3, 4, 5, 6, 7, -1, -1, -1, -1,
-1, 13, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 27, 28, 29, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 48, -1, 50, 51,
-1, -1, -1, -1, 56, -1, 58, 59, 60, 61,
62, 63, 64, 65, 66, 67, 68, -1, 70, 71,
72, 73, 74, -1, -1, -1, 78, 79, 80, 81,
82, 83, 84, -1, 86, -1, 88, -1, -1, -1,
92, 93, 94, 95, -1, 97, 98, 99, -1, 101,
-1, -1, 104, 105, -1, -1, -1, 109, 110, 111,
112, -1, 114, 115, -1, 117, -1, -1, 120, 121,
122, 123, 124, 125, 126, -1, 128, 129, 130, -1,
132, 133, -1, -1, -1, -1, -1, 139, 140, 141,
142, 143, 144, 145, -1, 147, 148, 149, 150, 151,
-1, -1, -1, 155, -1, -1, 158, -1, -1, -1,
-1, 163, 164, 165, 166, 167, -1, 169, 170, -1,
172, 173, 174, 175, -1, -1, 178, -1, -1, 181,
-1, -1, -1, -1, -1, 187, 188, -1, -1, -1,
-1, 193, 194, 195, -1, -1, 198, 199, -1, 201,
202, -1, -1, 205, 206, 207, 208, 3, 4, 5,
6, 7, -1, -1, -1, -1, -1, 13, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 27, 28, 29, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 48, -1, 50, 51, -1, -1, -1, -1,
56, -1, 58, 59, 60, 61, 62, 63, 64, 65,
66, 67, 68, -1, 70, 71, 72, 73, 74, -1,
-1, -1, 78, 79, 80, 81, 82, 83, 84, -1,
86, -1, 88, -1, -1, -1, 92, 93, 94, 95,
-1, 97, -1, 99, -1, 101, -1, -1, 104, 105,
-1, -1, -1, 109, 110, 111, 112, -1, 114, 115,
-1, 117, -1, -1, 120, 121, 122, 123, 124, 125,
126, -1, 128, 129, 130, -1, 132, 133, -1, -1,
-1, -1, -1, 139, 140, 141, 142, 143, 144, 145,
-1, 147, 148, 149, 150, 151, -1, -1, -1, 155,
-1, -1, 158, -1, -1, -1, -1, 163, 164, 165,
166, 167, -1, 169, 170, -1, 172, 173, 174, 175,
-1, -1, 178, -1, -1, 181, -1, -1, -1, -1,
-1, 187, 188, -1, -1, -1, -1, 193, 194, 195,
-1, -1, 198, 199, -1, 201, 202, 203, -1, 205,
206, 207, 208, 3, 4, 5, 6, 7, -1, -1,
-1, -1, -1, 13, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 27, 28, 29,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 48, -1,
50, 51, -1, -1, -1, -1, 56, -1, 58, 59,
60, 61, 62, 63, 64, 65, 66, 67, 68, -1,
70, 71, 72, 73, 74, -1, -1, -1, 78, 79,
80, 81, 82, 83, 84, -1, 86, -1, 88, -1,
-1, -1, 92, 93, 94, 95, -1, 97, -1, 99,
-1, 101, -1, -1, 104, 105, -1, -1, -1, 109,
110, 111, 112, -1, 114, 115, -1, 117, -1, -1,
120, 121, 122, 123, 124, 125, 126, -1, 128, 129,
130, -1, 132, 133, -1, -1, -1, -1, -1, 139,
140, 141, 142, 143, 144, 145, -1, 147, 148, 149,
150, 151, -1, -1, -1, 155, -1, -1, 158, -1,
-1, -1, -1, 163, 164, 165, 166, 167, -1, 169,
170, -1, 172, 173, 174, 175, -1, -1, 178, -1,
-1, 181, -1, -1, -1, -1, -1, 187, 188, -1,
-1, -1, -1, 193, 194, 195, -1, -1, 198, 199,
-1, 201, 202, 203, -1, 205, 206, 207, 208, 3,
4, 5, 6, 7, -1, -1, -1, -1, -1, 13,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 27, 28, 29, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 48, -1, 50, 51, -1, -1,
-1, -1, 56, -1, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, -1, 70, 71, 72, 73,
74, -1, -1, -1, 78, 79, 80, 81, 82, 83,
84, -1, 86, -1, 88, -1, -1, -1, 92, 93,
94, 95, -1, 97, -1, 99, -1, 101, -1, -1,
104, 105, -1, -1, -1, 109, 110, 111, 112, -1,
114, 115, -1, 117, -1, -1, 120, 121, 122, 123,
124, 125, 126, -1, 128, 129, 130, -1, 132, 133,
-1, -1, -1, -1, -1, 139, 140, 141, 142, 143,
144, 145, -1, 147, 148, 149, 150, 151, -1, -1,
-1, 155, -1, -1, 158, -1, -1, -1, -1, 163,
164, 165, 166, 167, -1, 169, 170, -1, 172, 173,
174, 175, -1, -1, 178, -1, -1, 181, -1, -1,
-1, -1, -1, 187, 188, -1, -1, -1, -1, 193,
194, 195, -1, -1, 198, 199, -1, 201, 202, 203,
-1, 205, 206, 207, 208, 3, 4, 5, 6, 7,
-1, -1, -1, -1, -1, 13, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 27,
28, 29, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
48, -1, 50, 51, -1, -1, -1, -1, 56, -1,
58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
68, -1, 70, 71, 72, 73, 74, -1, -1, -1,
78, 79, 80, 81, 82, 83, 84, -1, 86, -1,
88, -1, -1, -1, 92, 93, 94, 95, -1, 97,
-1, 99, -1, 101, -1, -1, 104, 105, -1, -1,
-1, 109, 110, 111, 112, -1, 114, 115, -1, 117,
-1, -1, 120, 121, 122, 123, 124, 125, 126, -1,
128, 129, 130, -1, 132, 133, -1, -1, -1, -1,
-1, 139, 140, 141, 142, 143, 144, 145, -1, 147,
148, 149, 150, 151, -1, -1, -1, 155, -1, -1,
158, -1, -1, -1, -1, 163, 164, 165, 166, 167,
-1, 169, 170, -1, 172, 173, 174, 175, -1, -1,
178, -1, -1, 181, -1, -1, -1, -1, -1, 187,
188, -1, -1, -1, -1, 193, 194, 195, -1, -1,
198, 199, -1, 201, 202, 203, -1, 205, 206, 207,
208, 3, 4, 5, 6, 7, -1, -1, -1, -1,
-1, 13, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 27, 28, 29, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 48, -1, 50, 51,
-1, -1, -1, -1, 56, -1, 58, 59, 60, 61,
62, 63, 64, 65, 66, 67, 68, -1, 70, 71,
72, 73, 74, -1, -1, -1, 78, 79, 80, 81,
82, 83, 84, -1, 86, -1, 88, -1, -1, -1,
92, 93, 94, 95, -1, 97, -1, 99, -1, 101,
-1, -1, 104, 105, -1, -1, -1, 109, 110, 111,
112, -1, 114, 115, -1, 117, -1, -1, 120, 121,
122, 123, 124, 125, 126, -1, 128, 129, 130, -1,
132, 133, -1, -1, -1, -1, -1, 139, 140, 141,
142, 143, 144, 145, -1, 147, 148, 149, 150, 151,
-1, -1, -1, 155, -1, -1, 158, -1, -1, -1,
-1, 163, 164, 165, 166, 167, -1, 169, 170, -1,
172, 173, 174, 175, -1, -1, 178, -1, -1, 181,
-1, -1, -1, -1, -1, 187, 188, -1, -1, -1,
-1, 193, 194, 195, -1, -1, 198, 199, -1, 201,
202, 203, -1, 205, 206, 207, 208, 3, 4, 5,
6, 7, -1, -1, -1, -1, -1, 13, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 27, 28, 29, -1, -1, 32, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 50, 51, -1, -1, -1, -1,
56, -1, 58, 59, 60, 61, 62, 63, 64, 65,
66, 67, 68, -1, 70, 71, 72, 73, 74, -1,
-1, -1, 78, 79, 80, 81, 82, 83, 84, -1,
86, -1, 88, -1, -1, -1, 92, 93, 94, 95,
-1, 97, -1, 99, -1, 101, -1, -1, 104, 105,
-1, -1, -1, 109, 110, 111, 112, -1, 114, 115,
-1, 117, -1, -1, 120, 121, 122, 123, 124, 125,
126, -1, 128, 129, 130, -1, -1, -1, -1, -1,
-1, -1, -1, 139, 140, 141, 142, 143, 144, 145,
-1, 147, 148, 149, 150, 151, -1, -1, -1, 155,
-1, -1, 158, -1, -1, -1, -1, 163, 164, 165,
166, 167, -1, 169, 170, -1, 172, 173, 174, -1,
-1, -1, 178, -1, -1, 181, -1, -1, -1, -1,
-1, 187, 188, -1, -1, -1, -1, 193, 194, 195,
-1, -1, 198, 199, -1, 201, 202, -1, -1, 205,
206, 207, 208, 3, 4, 5, 6, 7, -1, -1,
-1, -1, -1, 13, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 27, 28, 29,
-1, -1, 32, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
50, 51, -1, -1, -1, -1, 56, -1, 58, 59,
60, 61, 62, 63, 64, 65, 66, 67, 68, -1,
70, 71, 72, 73, 74, -1, -1, -1, 78, 79,
80, 81, 82, 83, 84, -1, 86, -1, 88, -1,
-1, -1, 92, 93, 94, 95, -1, 97, -1, 99,
-1, 101, -1, -1, 104, 105, -1, -1, -1, 109,
110, 111, 112, -1, 114, 115, -1, 117, -1, -1,
120, 121, 122, 123, 124, 125, 126, -1, 128, 129,
130, -1, -1, -1, -1, -1, -1, -1, -1, 139,
140, 141, 142, 143, 144, 145, -1, 147, 148, 149,
150, 151, -1, -1, -1, 155, -1, -1, 158, -1,
-1, -1, -1, 163, 164, 165, 166, 167, -1, 169,
170, -1, 172, 173, 174, -1, -1, -1, 178, -1,
-1, 181, -1, -1, -1, -1, -1, 187, 188, -1,
-1, -1, -1, 193, 194, 195, -1, -1, 198, 199,
-1, 201, 202, -1, -1, 205, 206, 207, 208, 3,
4, 5, 6, 7, -1, -1, -1, -1, -1, 13,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 27, 28, 29, -1, -1, 32, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 50, 51, -1, -1,
-1, -1, 56, -1, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, -1, 70, 71, 72, 73,
74, -1, -1, -1, 78, 79, 80, 81, 82, 83,
84, -1, 86, -1, 88, -1, -1, -1, 92, 93,
94, 95, -1, 97, -1, 99, -1, 101, -1, -1,
104, 105, -1, -1, -1, 109, 110, 111, 112, -1,
114, 115, -1, 117, -1, -1, 120, 121, 122, 123,
124, 125, 126, -1, 128, 129, 130, -1, -1, -1,
-1, -1, -1, -1, -1, 139, 140, 141, 142, 143,
144, 145, -1, 147, 148, 149, 150, 151, -1, -1,
-1, 155, -1, -1, 158, -1, -1, -1, -1, 163,
164, 165, 166, 167, -1, 169, 170, -1, 172, 173,
174, -1, -1, -1, 178, -1, -1, 181, -1, -1,
-1, -1, -1, 187, 188, -1, -1, -1, -1, 193,
194, 195, -1, -1, 198, 199, -1, 201, 202, -1,
-1, 205, 206, 207, 208, 3, 4, 5, 6, 7,
-1, -1, -1, -1, -1, 13, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 27,
28, 29, -1, -1, 32, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 50, 51, -1, -1, -1, -1, 56, -1,
58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
68, -1, 70, 71, 72, 73, 74, -1, -1, -1,
78, 79, 80, 81, 82, 83, 84, -1, 86, -1,
88, -1, -1, -1, 92, 93, 94, 95, -1, 97,
-1, 99, -1, 101, -1, -1, 104, 105, -1, -1,
-1, 109, 110, 111, 112, -1, 114, 115, -1, 117,
-1, -1, 120, 121, 122, 123, 124, 125, 126, -1,
128, 129, 130, -1, -1, -1, -1, -1, -1, -1,
-1, 139, 140, 141, 142, 143, 144, 145, -1, 147,
148, 149, 150, 151, -1, -1, -1, 155, -1, -1,
158, -1, -1, -1, -1, 163, 164, 165, 166, 167,
-1, 169, 170, -1, 172, 173, 174, -1, -1, -1,
178, -1, -1, 181, -1, -1, -1, -1, -1, 187,
188, -1, -1, -1, -1, 193, 194, 195, -1, -1,
198, 199, -1, 201, 202, -1, -1, 205, 206, 207,
208, 3, 4, 5, 6, 7, -1, -1, -1, -1,
-1, 13, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 27, 28, 29, -1, -1,
32, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 50, 51,
-1, -1, -1, -1, 56, -1, 58, 59, 60, 61,
62, 63, 64, 65, 66, 67, 68, -1, 70, 71,
72, 73, 74, -1, -1, -1, 78, 79, 80, 81,
82, 83, 84, -1, 86, -1, 88, -1, -1, -1,
92, 93, 94, 95, -1, 97, -1, 99, -1, 101,
-1, -1, 104, 105, -1, -1, -1, 109, 110, 111,
112, -1, 114, 115, -1, 117, -1, -1, 120, 121,
122, 123, 124, 125, 126, -1, 128, 129, 130, -1,
-1, -1, -1, -1, -1, -1, -1, 139, 140, 141,
142, 143, 144, 145, -1, 147, 148, 149, 150, 151,
-1, -1, -1, 155, -1, -1, 158, -1, -1, -1,
-1, 163, 164, 165, 166, 167, -1, 169, 170, -1,
172, 173, 174, -1, -1, -1, 178, -1, -1, 181,
-1, -1, -1, -1, -1, 187, 188, -1, -1, -1,
-1, 193, 194, 195, -1, -1, 198, 199, -1, 201,
202, -1, -1, 205, 206, 207, 208, 3, 4, 5,
6, 7, -1, -1, -1, -1, -1, 13, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 27, 28, 29, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 50, 51, -1, -1, -1, -1,
56, -1, 58, 59, 60, 61, 62, 63, 64, 65,
66, 67, 68, -1, 70, 71, 72, 73, 74, -1,
-1, -1, 78, 79, 80, 81, 82, 83, 84, -1,
86, -1, 88, -1, -1, -1, 92, 93, 94, 95,
-1, 97, -1, 99, -1, 101, -1, -1, 104, 105,
-1, -1, -1, 109, 110, 111, 112, -1, 114, 115,
-1, 117, -1, -1, 120, 121, 122, 123, 124, 125,
126, -1, 128, 129, 130, -1, -1, -1, -1, -1,
-1, -1, -1, 139, 140, 141, 142, 143, 144, 145,
-1, 147, 148, 149, 150, 151, -1, -1, -1, 155,
-1, -1, 158, -1, -1, -1, -1, 163, 164, 165,
166, 167, -1, 169, 170, -1, 172, 173, 174, -1,
-1, -1, 178, -1, -1, 181, -1, -1, -1, -1,
-1, 187, 188, -1, -1, -1, -1, 193, 194, 195,
-1, -1, 198, 199, -1, 201, 202, -1, -1, 205,
206, 207, 208, 3, 4, 5, 6, 7, -1, -1,
-1, -1, -1, 13, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 27, 28, 29,
-1, -1, -1, -1, -1, -1, -1, -1, 38, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
50, 51, -1, -1, -1, -1, 56, -1, 58, 59,
60, 61, 62, 63, 64, 65, 66, 67, 68, -1,
70, 71, 72, 73, -1, -1, -1, -1, 78, 79,
80, 81, 82, 83, 84, -1, -1, -1, -1, -1,
-1, -1, 92, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 104, -1, -1, -1, -1, -1,
-1, -1, 112, -1, -1, -1, -1, -1, -1, -1,
-1, 121, 122, 123, 124, 125, 126, -1, -1, 129,
130, -1, -1, -1, -1, -1, -1, -1, -1, 139,
140, 141, 142, 143, 144, 145, -1, 147, 148, 149,
150, 151, -1, -1, -1, -1, -1, -1, 158, -1,
-1, -1, -1, 163, 164, 165, 166, 167, -1, 169,
170, -1, 172, 173, 174, -1, -1, -1, 178, -1,
-1, 181, -1, -1, -1, -1, -1, 187, 188, -1,
-1, -1, -1, 193, 194, 195, -1, -1, 198, 199,
3, 4, 5, 6, 7, 205, 206, 207, 208, -1,
13, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 27, -1, 29, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 50, 51, -1,
-1, -1, -1, 56, -1, 58, 59, 60, 61, 62,
63, 64, 65, 66, 67, 68, -1, 70, 71, 72,
73, -1, -1, -1, -1, 78, 79, 80, 81, 82,
83, 84, -1, -1, -1, -1, -1, -1, -1, 92,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 104, -1, -1, -1, -1, -1, -1, -1, 112,
-1, -1, -1, -1, -1, -1, -1, -1, 121, 122,
123, 124, 125, 126, -1, -1, 129, 130, -1, -1,
-1, -1, -1, -1, -1, -1, 139, 140, 141, 142,
143, 144, 145, -1, 147, 148, 149, 150, 151, -1,
-1, -1, -1, -1, -1, 158, -1, -1, -1, -1,
163, 164, 165, 166, 167, -1, 169, 170, -1, 172,
173, 174, -1, -1, -1, 178, -1, -1, 181, 3,
4, 5, 6, 7, 187, 188, -1, -1, -1, 13,
193, 194, 195, -1, -1, 198, 199, -1, 201, -1,
-1, -1, 205, 206, 207, 208, -1, -1, -1, -1,
-1, -1, -1, -1, 38, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 50, 51, -1, -1,
-1, -1, 56, -1, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, -1, 70, 71, 72, 73,
-1, -1, -1, -1, 78, 79, 80, 81, 82, 83,
84, -1, -1, 87, -1, -1, -1, -1, 92, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
104, -1, -1, -1, -1, -1, -1, -1, 112, -1,
-1, -1, -1, -1, -1, -1, -1, 121, 122, 123,
124, 125, 126, -1, -1, 129, 130, -1, -1, -1,
-1, -1, -1, -1, -1, 139, 140, 141, 142, 143,
144, 145, -1, 147, 148, 149, 150, 151, -1, -1,
-1, -1, -1, -1, 158, -1, -1, -1, -1, 163,
164, 165, 166, 167, -1, 169, 170, -1, 172, 173,
174, -1, 176, -1, 178, -1, -1, 181, 3, 4,
5, 6, 7, 187, 188, -1, -1, -1, 13, 193,
194, 195, -1, -1, 198, 199, -1, -1, -1, -1,
-1, 205, 206, 207, 208, -1, -1, -1, -1, -1,
-1, -1, -1, 38, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 50, 51, -1, -1, -1,
-1, 56, -1, 58, 59, 60, 61, 62, 63, 64,
65, 66, 67, 68, -1, 70, 71, 72, 73, -1,
-1, -1, -1, 78, 79, 80, 81, 82, 83, 84,
-1, -1, 87, -1, -1, -1, -1, 92, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 104,
-1, -1, -1, -1, -1, -1, -1, 112, -1, -1,
-1, -1, -1, -1, -1, -1, 121, 122, 123, 124,
125, 126, -1, -1, 129, 130, -1, -1, -1, -1,
-1, -1, -1, -1, 139, 140, 141, 142, 143, 144,
145, -1, 147, 148, 149, 150, 151, -1, -1, -1,
-1, -1, -1, 158, -1, -1, -1, -1, 163, 164,
165, 166, 167, -1, 169, 170, -1, 172, 173, 174,
-1, 176, -1, 178, -1, -1, 181, -1, -1, -1,
-1, -1, 187, 188, -1, -1, -1, -1, 193, 194,
195, -1, -1, 198, 199, 3, 4, 5, 6, 7,
205, 206, 207, 208, -1, 13, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 27,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 50, 51, -1, -1, -1, -1, 56, -1,
58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
68, -1, 70, 71, 72, 73, -1, -1, -1, -1,
78, 79, 80, 81, 82, 83, 84, -1, -1, -1,
-1, -1, -1, -1, 92, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 104, -1, -1, -1,
-1, -1, -1, -1, 112, -1, -1, -1, -1, -1,
-1, -1, -1, 121, 122, 123, 124, 125, 126, -1,
-1, 129, 130, -1, -1, -1, -1, -1, -1, -1,
-1, 139, 140, 141, 142, 143, 144, 145, -1, 147,
148, 149, 150, 151, -1, -1, -1, -1, -1, -1,
158, -1, -1, -1, -1, 163, 164, 165, 166, 167,
-1, 169, 170, -1, 172, 173, 174, -1, -1, -1,
178, -1, -1, 181, -1, -1, -1, -1, -1, 187,
188, -1, -1, -1, -1, 193, 194, 195, -1, -1,
198, 199, -1, -1, 202, -1, -1, 205, 206, 207,
208, 3, 4, 5, 6, 7, -1, -1, -1, -1,
-1, 13, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 27, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 38, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 50, 51,
-1, -1, -1, -1, 56, -1, 58, 59, 60, 61,
62, 63, 64, 65, 66, 67, 68, -1, 70, 71,
72, 73, -1, -1, -1, -1, 78, 79, 80, 81,
82, 83, 84, -1, -1, -1, -1, -1, -1, -1,
92, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 104, -1, -1, -1, -1, -1, -1, -1,
112, -1, -1, -1, -1, -1, -1, -1, -1, 121,
122, 123, 124, 125, 126, -1, -1, 129, 130, -1,
-1, -1, -1, -1, -1, -1, -1, 139, 140, 141,
142, 143, 144, 145, -1, 147, 148, 149, 150, 151,
-1, -1, -1, -1, -1, -1, 158, -1, -1, -1,
-1, 163, 164, 165, 166, 167, -1, 169, 170, -1,
172, 173, 174, -1, -1, -1, 178, -1, -1, 181,
-1, -1, -1, -1, -1, 187, 188, -1, -1, -1,
-1, 193, 194, 195, -1, -1, 198, 199, 3, 4,
5, 6, 7, 205, 206, 207, 208, -1, 13, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 27, 28, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 50, 51, -1, -1, -1,
-1, 56, -1, 58, 59, 60, 61, 62, 63, 64,
65, 66, 67, 68, -1, 70, 71, 72, 73, -1,
-1, -1, -1, 78, 79, 80, 81, 82, 83, 84,
-1, -1, -1, -1, -1, -1, -1, 92, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 104,
-1, -1, -1, -1, -1, -1, -1, 112, -1, -1,
-1, -1, -1, -1, -1, -1, 121, 122, 123, 124,
125, 126, -1, -1, 129, 130, -1, -1, -1, -1,
-1, -1, -1, -1, 139, 140, 141, 142, 143, 144,
145, -1, 147, 148, 149, 150, 151, -1, -1, -1,
-1, -1, -1, 158, -1, -1, -1, -1, 163, 164,
165, 166, 167, -1, 169, 170, -1, 172, 173, 174,
-1, -1, -1, 178, -1, -1, 181, 3, 4, 5,
6, 7, 187, 188, -1, -1, -1, 13, 193, 194,
195, -1, -1, 198, 199, -1, -1, -1, -1, -1,
205, 206, 207, 208, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 50, 51, -1, -1, -1, -1,
56, -1, 58, 59, 60, 61, 62, 63, 64, 65,
66, 67, 68, -1, 70, 71, 72, 73, -1, -1,
-1, -1, 78, 79, 80, 81, 82, 83, 84, -1,
-1, -1, -1, -1, -1, -1, 92, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 104, -1,
-1, -1, -1, 109, -1, -1, 112, -1, -1, -1,
-1, -1, -1, -1, -1, 121, 122, 123, 124, 125,
126, -1, -1, 129, 130, -1, -1, -1, -1, -1,
-1, -1, -1, 139, 140, 141, 142, 143, 144, 145,
-1, 147, 148, 149, 150, 151, -1, -1, -1, -1,
-1, -1, 158, -1, -1, -1, -1, 163, 164, 165,
166, 167, -1, 169, 170, -1, 172, 173, 174, -1,
-1, -1, 178, -1, -1, 181, 3, 4, 5, 6,
7, 187, 188, -1, -1, -1, 13, 193, 194, 195,
-1, -1, 198, 199, -1, -1, -1, -1, -1, 205,
206, 207, 208, -1, -1, -1, -1, -1, -1, -1,
-1, 38, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 50, 51, -1, -1, -1, -1, 56,
-1, 58, 59, 60, 61, 62, 63, 64, 65, 66,
67, 68, -1, 70, 71, 72, 73, -1, -1, -1,
-1, 78, 79, 80, 81, 82, 83, 84, -1, -1,
-1, -1, -1, -1, -1, 92, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 104, -1, -1,
-1, -1, -1, -1, -1, 112, -1, -1, -1, -1,
-1, -1, -1, -1, 121, 122, 123, 124, 125, 126,
-1, -1, 129, 130, -1, -1, -1, -1, -1, -1,
-1, -1, 139, 140, 141, 142, 143, 144, 145, -1,
147, 148, 149, 150, 151, -1, -1, -1, -1, -1,
-1, 158, -1, -1, -1, -1, 163, 164, 165, 166,
167, -1, 169, 170, -1, 172, 173, 174, -1, -1,
-1, 178, -1, -1, 181, 3, 4, 5, 6, 7,
187, 188, -1, -1, -1, 13, 193, 194, 195, -1,
-1, 198, 199, -1, -1, -1, -1, -1, 205, 206,
207, 208, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 50, 51, -1, -1, -1, -1, 56, -1,
58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
68, -1, 70, 71, 72, 73, -1, -1, -1, -1,
78, 79, 80, 81, 82, 83, 84, -1, -1, -1,
-1, -1, -1, -1, 92, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 104, -1, -1, -1,
-1, -1, -1, -1, 112, -1, -1, -1, -1, -1,
-1, -1, -1, 121, 122, 123, 124, 125, 126, -1,
-1, 129, 130, -1, -1, -1, -1, -1, -1, -1,
-1, 139, 140, 141, 142, 143, 144, 145, -1, 147,
148, 149, 150, 151, -1, -1, -1, -1, -1, -1,
158, -1, -1, -1, -1, 163, 164, 165, 166, 167,
-1, 169, 170, -1, 172, 173, 174, -1, -1, -1,
178, -1, -1, 181, 3, 4, 5, 6, 7, 187,
188, -1, -1, -1, 13, 193, 194, 195, -1, -1,
198, 199, -1, 201, -1, -1, -1, 205, 206, 207,
208, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 50, 51, -1, -1, -1, -1, 56, -1, 58,
59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
-1, 70, 71, 72, 73, -1, -1, -1, -1, 78,
79, 80, 81, 82, 83, 84, -1, -1, -1, -1,
-1, -1, -1, 92, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 104, -1, -1, -1, -1,
-1, -1, -1, 112, -1, -1, -1, -1, -1, -1,
-1, -1, 121, 122, 123, 124, 125, 126, -1, -1,
129, 130, -1, -1, -1, -1, -1, -1, -1, -1,
139, 140, 141, 142, 143, 144, 145, -1, 147, 148,
149, 150, 151, -1, -1, -1, -1, -1, -1, 158,
-1, -1, -1, -1, 163, 164, 165, 166, 167, -1,
169, 170, -1, 172, 173, 174, -1, -1, -1, 178,
-1, -1, 181, -1, -1, -1, -1, -1, 187, 188,
-1, -1, -1, -1, 193, 194, 195, -1, -1, 198,
199, -1, 201, -1, -1, -1, 205, 206, 207, 208,
3, 4, 5, 6, 7, -1, -1, -1, -1, -1,
13, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 28, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 50, 51, -1,
-1, -1, -1, 56, -1, 58, 59, 60, 61, 62,
63, 64, 65, 66, 67, 68, -1, 70, 71, 72,
73, -1, -1, -1, -1, 78, 79, 80, 81, 82,
83, 84, -1, -1, -1, -1, -1, -1, -1, 92,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 104, -1, -1, -1, -1, -1, -1, -1, 112,
-1, -1, -1, -1, -1, -1, -1, -1, 121, 122,
123, 124, 125, 126, -1, -1, 129, 130, -1, -1,
-1, -1, -1, -1, -1, -1, 139, 140, 141, 142,
143, 144, 145, -1, 147, 148, 149, 150, 151, -1,
-1, -1, -1, -1, -1, 158, -1, -1, -1, -1,
163, 164, 165, 166, 167, -1, 169, 170, -1, 172,
173, 174, -1, -1, -1, 178, -1, -1, 181, 3,
4, 5, 6, 7, 187, 188, -1, -1, -1, 13,
193, 194, 195, -1, -1, 198, 199, -1, -1, -1,
-1, -1, 205, 206, 207, 208, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 50, 51, -1, -1,
-1, -1, 56, -1, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, -1, 70, 71, 72, 73,
-1, -1, -1, -1, 78, 79, 80, 81, 82, 83,
84, -1, -1, -1, -1, -1, -1, -1, 92, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
104, -1, -1, -1, -1, -1, -1, -1, 112, -1,
-1, -1, -1, -1, -1, -1, -1, 121, 122, 123,
124, 125, 126, -1, -1, 129, 130, -1, -1, -1,
-1, -1, -1, -1, -1, 139, 140, 141, 142, 143,
144, 145, -1, 147, 148, 149, 150, 151, -1, -1,
-1, -1, -1, -1, 158, -1, -1, -1, -1, 163,
164, 165, 166, 167, -1, 169, 170, -1, 172, 173,
174, -1, -1, -1, 178, -1, -1, 181, -1, -1,
-1, -1, -1, 187, 188, -1, -1, -1, -1, 193,
194, 195, -1, -1, 198, 199, 200, -1, -1, -1,
-1, 205, 206, 207, 208, 3, 4, 5, 6, 7,
-1, -1, -1, -1, -1, 13, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 27,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 50, 51, -1, -1, -1, -1, 56, -1,
58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
68, -1, 70, 71, 72, 73, -1, -1, -1, -1,
78, 79, 80, 81, 82, 83, 84, -1, -1, -1,
-1, -1, -1, -1, 92, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 104, -1, -1, -1,
-1, -1, -1, -1, 112, -1, -1, -1, -1, -1,
-1, -1, -1, 121, 122, 123, 124, 125, 126, -1,
-1, 129, 130, -1, -1, -1, -1, -1, -1, -1,
-1, 139, 140, 141, 142, 143, 144, 145, -1, 147,
148, 149, 150, 151, -1, -1, -1, -1, -1, -1,
158, -1, -1, -1, -1, 163, 164, 165, 166, 167,
-1, 169, 170, -1, 172, 173, 174, -1, -1, -1,
178, -1, -1, 181, 3, 4, 5, 6, 7, 187,
188, -1, -1, -1, 13, 193, 194, 195, -1, -1,
198, 199, -1, -1, -1, -1, -1, 205, 206, 207,
208, -1, -1, 32, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 50, 51, -1, -1, -1, -1, 56, -1, 58,
59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
-1, 70, 71, 72, 73, -1, -1, -1, -1, 78,
79, 80, 81, 82, 83, 84, -1, -1, -1, -1,
-1, -1, -1, 92, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 104, -1, -1, -1, -1,
-1, -1, -1, 112, -1, -1, -1, -1, -1, -1,
-1, -1, 121, 122, 123, 124, 125, 126, -1, -1,
129, 130, -1, -1, -1, -1, -1, -1, -1, -1,
139, 140, 141, 142, 143, 144, 145, -1, 147, 148,
149, 150, 151, -1, -1, -1, -1, -1, -1, 158,
-1, -1, -1, -1, 163, 164, 165, 166, 167, -1,
169, 170, -1, 172, 173, 174, -1, -1, -1, 178,
-1, -1, 181, 3, 4, 5, 6, 7, 187, 188,
-1, -1, -1, 13, 193, 194, 195, -1, -1, 198,
199, -1, -1, -1, -1, -1, 205, 206, 207, 208,
-1, -1, -1, -1, -1, -1, -1, -1, 38, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
50, 51, -1, -1, -1, -1, 56, -1, 58, 59,
60, 61, 62, 63, 64, 65, 66, 67, 68, -1,
70, 71, 72, 73, -1, -1, -1, -1, 78, 79,
80, 81, 82, 83, 84, -1, -1, -1, -1, -1,
-1, -1, 92, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 104, -1, -1, -1, -1, -1,
-1, -1, 112, -1, -1, -1, -1, -1, -1, -1,
-1, 121, 122, 123, 124, 125, 126, -1, -1, 129,
130, -1, -1, -1, -1, -1, -1, -1, -1, 139,
140, 141, 142, 143, 144, 145, -1, 147, 148, 149,
150, 151, -1, -1, -1, -1, -1, -1, 158, -1,
-1, -1, -1, 163, 164, 165, 166, 167, -1, 169,
170, -1, 172, 173, 174, -1, -1, -1, 178, -1,
-1, 181, 3, 4, 5, 6, 7, 187, 188, -1,
-1, -1, 13, 193, 194, 195, -1, -1, 198, 199,
-1, -1, -1, -1, -1, 205, 206, 207, 208, -1,
-1, -1, -1, -1, -1, -1, -1, 38, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 50,
51, -1, -1, -1, -1, 56, -1, 58, 59, 60,
61, 62, 63, 64, 65, 66, 67, 68, -1, 70,
71, 72, 73, -1, -1, -1, -1, 78, 79, 80,
81, 82, 83, 84, -1, -1, -1, -1, -1, -1,
-1, 92, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 104, -1, -1, -1, -1, -1, -1,
-1, 112, -1, -1, -1, -1, -1, -1, -1, -1,
121, 122, 123, 124, 125, 126, -1, -1, 129, 130,
-1, -1, -1, -1, -1, -1, -1, -1, 139, 140,
141, 142, 143, 144, 145, -1, 147, 148, 149, 150,
151, -1, -1, -1, -1, -1, -1, 158, -1, -1,
-1, -1, 163, 164, 165, 166, 167, -1, 169, 170,
-1, 172, 173, 174, -1, -1, -1, 178, -1, -1,
181, 3, 4, 5, 6, 7, 187, 188, -1, -1,
-1, 13, 193, 194, 195, -1, -1, 198, 199, -1,
-1, -1, -1, -1, 205, 206, 207, 208, -1, -1,
-1, -1, -1, -1, -1, -1, 38, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 50, 51,
-1, -1, -1, -1, 56, -1, 58, 59, 60, 61,
62, 63, 64, 65, 66, 67, 68, -1, 70, 71,
72, 73, -1, -1, -1, -1, 78, 79, 80, 81,
82, 83, 84, -1, -1, -1, -1, -1, -1, -1,
92, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 104, -1, -1, -1, -1, -1, -1, -1,
112, -1, -1, -1, -1, -1, -1, -1, -1, 121,
122, 123, 124, 125, 126, -1, -1, 129, 130, -1,
-1, -1, -1, -1, -1, -1, -1, 139, 140, 141,
142, 143, 144, 145, -1, 147, 148, 149, 150, 151,
-1, -1, -1, -1, -1, -1, 158, -1, -1, -1,
-1, 163, 164, 165, 166, 167, -1, 169, 170, -1,
172, 173, 174, -1, -1, -1, 178, -1, -1, 181,
3, 4, 5, 6, 7, 187, 188, -1, -1, -1,
13, 193, 194, 195, -1, -1, 198, 199, -1, -1,
-1, -1, -1, 205, 206, 207, 208, -1, -1, -1,
-1, -1, -1, -1, -1, 38, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 50, 51, -1,
-1, -1, -1, 56, -1, 58, 59, 60, 61, 62,
63, 64, 65, 66, 67, 68, -1, 70, 71, 72,
73, -1, -1, -1, -1, 78, 79, 80, 81, 82,
83, 84, -1, -1, -1, -1, -1, -1, -1, 92,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 104, -1, -1, -1, -1, -1, -1, -1, 112,
-1, -1, -1, -1, -1, -1, -1, -1, 121, 122,
123, 124, 125, 126, -1, -1, 129, 130, -1, -1,
-1, -1, -1, -1, -1, -1, 139, 140, 141, 142,
143, 144, 145, -1, 147, 148, 149, 150, 151, -1,
-1, -1, -1, -1, -1, 158, -1, -1, -1, -1,
163, 164, 165, 166, 167, -1, 169, 170, -1, 172,
173, 174, -1, -1, -1, 178, -1, -1, 181, -1,
-1, -1, -1, -1, 187, 188, -1, -1, -1, -1,
193, 194, 195, -1, -1, 198, 199, 3, 4, 5,
6, 7, 205, 206, 207, 208, -1, 13, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 27, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 50, 51, -1, -1, -1, -1,
56, -1, 58, 59, 60, 61, 62, 63, 64, 65,
66, 67, 68, -1, 70, 71, 72, 73, -1, -1,
-1, -1, 78, 79, 80, 81, 82, 83, 84, -1,
-1, -1, -1, -1, -1, -1, 92, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 104, -1,
-1, -1, -1, -1, -1, -1, 112, -1, -1, -1,
-1, -1, -1, -1, -1, 121, 122, 123, 124, 125,
126, -1, -1, 129, 130, -1, -1, -1, -1, -1,
-1, -1, -1, 139, 140, 141, 142, 143, 144, 145,
-1, 147, 148, 149, 150, 151, -1, -1, -1, -1,
-1, -1, 158, -1, -1, -1, -1, 163, 164, 165,
166, 167, -1, 169, 170, -1, 172, 173, 174, -1,
-1, -1, 178, -1, -1, 181, 3, 4, 5, 6,
7, 187, 188, -1, -1, -1, 13, 193, 194, 195,
-1, -1, 198, 199, -1, -1, -1, -1, -1, 205,
206, 207, 208, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 50, 51, -1, -1, -1, -1, 56,
-1, 58, 59, 60, 61, 62, 63, 64, 65, 66,
67, 68, -1, 70, 71, 72, 73, -1, -1, -1,
-1, 78, 79, 80, 81, 82, 83, 84, -1, -1,
-1, -1, -1, -1, -1, 92, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 104, -1, -1,
-1, -1, -1, -1, -1, 112, -1, -1, -1, -1,
-1, -1, -1, -1, 121, 122, 123, 124, 125, 126,
-1, -1, 129, 130, -1, -1, -1, -1, -1, -1,
-1, -1, 139, 140, 141, 142, 143, 144, 145, -1,
147, 148, 149, 150, 151, -1, -1, -1, -1, -1,
-1, 158, -1, -1, -1, -1, 163, 164, 165, 166,
167, -1, 169, 170, -1, 172, 173, 174, -1, -1,
-1, 178, -1, -1, 181, 3, 4, 5, 6, 7,
187, 188, -1, -1, -1, 13, 193, 194, 195, -1,
-1, 198, 199, -1, -1, -1, -1, -1, 205, 206,
207, 208, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 50, 51, -1, -1, -1, -1, 56, -1,
58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
68, -1, 70, 71, 72, 73, -1, -1, -1, -1,
78, 79, 80, 81, 82, 83, 84, -1, -1, -1,
-1, -1, -1, -1, 92, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 104, -1, -1, -1,
-1, -1, -1, -1, 112, -1, -1, -1, -1, -1,
-1, -1, -1, 121, 122, 123, 124, 125, 126, -1,
-1, 129, 130, -1, -1, -1, -1, -1, -1, -1,
-1, 139, 140, 141, 142, 143, 144, 145, -1, 147,
148, 149, 150, 151, -1, -1, -1, -1, -1, -1,
158, -1, -1, -1, -1, 163, 164, 165, 166, 167,
-1, 169, 170, -1, 172, 173, 174, -1, 3, 4,
178, 6, 7, 181, -1, 10, 11, 12, 13, 187,
188, -1, -1, -1, -1, 193, 194, 195, -1, -1,
198, 199, -1, 28, 29, -1, -1, 205, 206, 207,
208, 35, 36, 37, 38, 39, 40, 41, 42, 43,
44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
54, 55, 57, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 69, 71, 72, 73, 74,
75, 76, 77, -1, -1, -1, 81, -1, 83, 84,
-1, -1, 87, -1, -1, -1, -1, -1, 93, 94,
95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
125, 126, 127, 128, -1, 130, -1, 132, 133, 134,
135, -1, -1, -1, 139, 140, 141, 142, 143, 144,
145, 146, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 3, 4, -1, 6, 7, -1, 163, 10,
11, 12, 13, -1, 169, 170, -1, 172, 173, 174,
175, -1, 177, -1, -1, 180, -1, 28, 29, -1,
31, -1, -1, 188, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 198, -1, -1, -1, 202, -1, -1,
205, -1, -1, -1, -1, -1, 57, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 68, -1, -1,
71, 72, 73, 74, 75, 76, 77, -1, -1, -1,
81, -1, -1, -1, -1, -1, 87, -1, -1, -1,
-1, -1, 93, 94, 95, 96, 97, 98, 99, 100,
101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
111, 112, 113, 114, 115, 116, 117, 118, 119, 120,
121, 122, 123, 124, 125, 126, 127, 128, -1, 130,
-1, -1, 133, 134, 135, -1, -1, -1, 139, 140,
141, 142, 143, 144, 145, 146, -1, -1, -1, -1,
-1, -1, 81, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 163, -1, -1, 166, 167, -1, 169, 170,
-1, 172, 173, 174, 175, 104, 177, -1, -1, 180,
-1, 3, 4, -1, 6, 7, 187, 188, 10, 11,
12, 13, -1, -1, -1, -1, -1, 198, 199, -1,
-1, 130, 203, -1, -1, -1, 28, 29, -1, 31,
-1, -1, 141, 142, 143, 144, 145, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
51, 52, 53, 54, 55, 57, 57, -1, -1, -1,
169, 170, -1, 172, 173, 174, 68, -1, 69, 71,
72, 73, 74, 75, 76, 77, -1, -1, -1, 81,
-1, -1, -1, -1, -1, 87, -1, -1, -1, 198,
199, 93, 94, 95, 96, 97, 98, 99, 100, 101,
102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
122, 123, 124, 125, 126, 127, 128, -1, 130, -1,
-1, 133, 134, 135, -1, -1, -1, 139, 140, 141,
142, 143, 144, 145, 146, -1, -1, -1, -1, -1,
-1, 81, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 163, 92, -1, 166, 167, -1, 169, 170, -1,
172, 173, 174, 175, 104, 177, -1, -1, 180, -1,
3, 4, -1, 6, 7, 187, 188, 10, 11, 12,
13, -1, -1, -1, -1, -1, 198, 199, -1, -1,
-1, 203, -1, -1, -1, 28, 29, -1, 31, -1,
-1, 141, 142, 143, 144, 145, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 163, 57, -1, 166, -1, -1, 169,
170, -1, 172, 173, 174, 68, -1, -1, 71, 72,
73, 74, 75, 76, 77, -1, -1, -1, 81, -1,
-1, -1, -1, -1, 87, -1, -1, -1, 198, -1,
93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
123, 124, 125, 126, 127, 128, -1, 130, -1, 132,
133, 134, 135, -1, -1, -1, 139, 140, 141, 142,
143, 144, 145, 146, -1, -1, -1, -1, -1, -1,
81, -1, -1, -1, -1, -1, -1, -1, -1, -1,
163, -1, -1, 166, 167, -1, 169, 170, -1, 172,
173, 174, 175, 104, 177, -1, -1, 180, -1, 3,
4, -1, 6, 7, 187, 188, 10, 11, 12, 13,
-1, -1, -1, -1, -1, 198, 199, -1, -1, -1,
-1, -1, -1, -1, 28, 29, -1, 31, -1, -1,
141, 142, 143, 144, 145, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 163, 57, -1, 166, 167, -1, 169, 170,
-1, 172, 173, 174, 68, -1, -1, 71, 72, 73,
74, 75, 76, 77, -1, -1, -1, 81, -1, -1,
-1, -1, -1, 87, -1, -1, -1, 198, -1, 93,
94, 95, 96, 97, 98, 99, 100, 101, 102, 103,
104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
124, 125, 126, 127, 128, -1, 130, -1, -1, 133,
134, 135, -1, -1, -1, 139, 140, 141, 142, 143,
144, 145, 146, -1, -1, -1, -1, -1, -1, 81,
-1, -1, -1, -1, -1, -1, -1, -1, 81, 163,
-1, -1, 166, 167, -1, 169, 170, -1, 172, 173,
174, 175, 104, 177, -1, -1, 180, -1, -1, -1,
-1, 104, -1, 187, 188, 189, -1, -1, -1, 3,
4, -1, 6, 7, 198, 199, 10, 11, 12, 13,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 141,
142, 143, 144, 145, 28, 29, -1, 31, 141, 142,
143, 144, 145, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 166, -1, -1, 169, 170, -1,
172, 173, 174, 57, -1, -1, 169, 170, -1, 172,
173, 174, -1, -1, 68, -1, -1, 71, 72, 73,
74, 75, 76, 77, -1, -1, 198, 81, -1, -1,
-1, -1, -1, 87, -1, 198, -1, -1, -1, 93,
94, 95, 96, 97, 98, 99, 100, 101, 102, 103,
104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
124, 125, 126, 127, 128, -1, 130, -1, -1, 133,
134, 135, -1, -1, -1, 139, 140, 141, 142, 143,
144, 145, 146, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 163,
-1, -1, 166, 167, -1, 169, 170, -1, 172, 173,
174, 175, -1, 177, -1, -1, 180, -1, 3, 4,
5, 6, 7, 187, 188, 10, 11, 12, 13, -1,
-1, -1, -1, -1, 198, 199, -1, -1, -1, -1,
-1, -1, 27, 28, 29, -1, 30, 31, -1, 33,
34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
54, 55, 57, 57, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 69, 71, 72, 73, 74,
75, 76, 77, -1, -1, -1, 81, -1, -1, -1,
-1, -1, 87, -1, -1, -1, -1, -1, 93, 94,
95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
135, -1, -1, -1, 139, 140, 141, 142, 143, 144,
145, -1, 147, 148, 149, 150, 151, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 163, 164,
165, -1, 81, -1, 169, 170, -1, 172, 173, 174,
175, -1, 177, 178, -1, 180, -1, -1, -1, -1,
-1, -1, 187, -1, 189, 104, 191, -1, 193, 194,
-1, 3, 4, 198, 6, 7, -1, -1, 10, 11,
12, 13, -1, -1, -1, -1, -1, -1, 127, -1,
-1, -1, -1, -1, -1, -1, 28, 29, -1, -1,
-1, 140, 141, 142, 143, 144, 145, 146, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 163, 57, -1, 166, 167, -1,
169, 170, -1, 172, 173, 174, -1, -1, -1, 71,
72, 73, 74, 75, 76, 77, -1, -1, -1, 81,
-1, -1, -1, -1, -1, 87, -1, -1, -1, 198,
-1, 93, 94, 95, 96, 97, 98, 99, 100, 101,
102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
122, 123, 124, 125, 126, 127, 128, -1, 130, -1,
132, 133, 134, 135, -1, -1, -1, 139, 140, 141,
142, 143, 144, 145, 146, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 3, 4, -1, 6, 7,
-1, 163, 10, 11, 12, 13, -1, 169, 170, -1,
172, 173, 174, 175, -1, 177, -1, -1, 180, -1,
28, 29, -1, -1, -1, -1, 188, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 198, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 57,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 71, 72, 73, 74, 75, 76, 77,
-1, -1, -1, 81, -1, -1, -1, -1, -1, 87,
-1, -1, -1, -1, -1, 93, 94, 95, 96, 97,
98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
128, -1, 130, -1, 132, 133, 134, 135, -1, -1,
-1, 139, 140, 141, 142, 143, 144, 145, 146, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 3,
4, -1, 6, 7, -1, 163, 10, 11, 12, 13,
-1, 169, 170, -1, 172, 173, 174, 175, -1, 177,
-1, -1, 180, -1, 28, 29, -1, -1, -1, -1,
188, -1, -1, -1, -1, -1, -1, -1, -1, -1,
198, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 57, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 71, 72, 73,
74, 75, 76, 77, -1, -1, -1, 81, -1, -1,
-1, -1, -1, 87, -1, -1, -1, -1, -1, 93,
94, 95, 96, 97, 98, 99, 100, 101, 102, 103,
104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
124, 125, 126, 127, 128, -1, 130, -1, -1, 133,
134, 135, -1, -1, -1, 139, 140, 141, 142, 143,
144, 145, 146, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 163,
-1, -1, -1, -1, -1, 169, 170, -1, 172, 173,
174, 175, -1, 177, -1, -1, 180, 10, 11, 12,
-1, -1, -1, -1, 188, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 198, -1, -1, 30, 31, -1,
33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
53, 54, 55, -1, 57, 10, 11, 12, -1, -1,
-1, -1, -1, -1, -1, -1, 69, -1, -1, -1,
-1, -1, -1, -1, -1, 30, 31, -1, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
55, -1, 57, 10, 11, 12, -1, -1, -1, -1,
-1, -1, -1, -1, 69, -1, -1, -1, -1, -1,
-1, -1, -1, 30, 31, -1, 33, 34, 35, 36,
37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
47, 48, 49, 50, 51, 52, 53, 54, 55, -1,
57, 10, 11, 12, -1, -1, -1, -1, -1, -1,
-1, -1, 69, -1, -1, -1, -1, -1, -1, -1,
-1, 30, 31, 32, 33, 34, 35, 36, 37, 38,
39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 51, 52, 53, 54, 55, -1, 57, -1,
203, -1, 10, 11, 12, -1, -1, -1, -1, -1,
69, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 30, 31, -1, 33, 34, 35, 36, 37,
38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 203, 57,
10, 11, 12, -1, -1, -1, -1, -1, -1, -1,
-1, 69, -1, -1, -1, -1, -1, -1, -1, -1,
30, 31, -1, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
50, 51, 52, 53, 54, 55, 203, 57, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 69,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
10, 11, 12, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
30, 31, 201, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
50, 51, 52, 53, 54, 55, -1, 57, -1, -1,
-1, 10, 11, 12, -1, -1, -1, -1, -1, 69,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 30, 31, 201, 33, 34, 35, 36, 37, 38,
39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 51, 52, 53, 54, 55, -1, 57, 10,
11, 12, -1, -1, -1, -1, -1, -1, -1, -1,
69, 31, -1, -1, -1, -1, -1, -1, -1, 30,
31, 201, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
51, 52, 53, 54, 55, -1, 57, -1, 68, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 69, -1,
-1, 81, -1, -1, -1, -1, -1, 87, -1, 10,
11, 12, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 104, -1, -1, -1, -1, 30,
31, 201, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
51, 52, 53, 54, 55, -1, 57, -1, -1, -1,
140, 141, 142, 143, 144, 145, 146, -1, 69, -1,
-1, -1, -1, -1, -1, -1, -1, 32, -1, -1,
-1, -1, 201, 163, -1, -1, 166, 167, -1, 169,
170, -1, 172, 173, 174, 50, 51, -1, -1, -1,
-1, 56, -1, 58, -1, -1, -1, 187, -1, -1,
-1, -1, -1, -1, -1, 70, -1, -1, 198, 199,
-1, -1, -1, 78, 79, 80, 81, -1, -1, -1,
201, -1, 10, 11, 12, -1, -1, 92, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 104,
-1, -1, 30, 31, -1, 33, 34, 35, 36, 37,
38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, -1, 57,
-1, -1, -1, -1, -1, 140, 141, 142, 143, 144,
145, 69, 147, 148, 149, 150, 151, -1, -1, 200,
-1, -1, -1, 158, -1, 38, -1, -1, 163, 164,
165, 166, 167, -1, 169, 170, -1, 172, 173, 174,
-1, -1, -1, 178, -1, -1, -1, -1, -1, -1,
-1, -1, 187, 188, -1, -1, -1, 70, 193, -1,
-1, -1, -1, 198, 199, 78, 79, 80, 81, -1,
83, 84, -1, -1, -1, -1, -1, -1, -1, 92,
138, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 104, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 121, -1,
-1, -1, -1, 50, 51, -1, -1, -1, -1, 56,
-1, 58, -1, -1, -1, -1, 139, 140, 141, 142,
143, 144, 145, 70, 147, 148, 149, 150, 151, -1,
-1, 78, 79, 80, 81, 158, -1, -1, -1, -1,
163, 164, 165, 166, 167, 92, 169, 170, -1, 172,
173, 174, -1, -1, -1, 178, -1, 104, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
193, -1, -1, -1, -1, 198, 199, -1, -1, -1,
-1, -1, 205, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 140, 141, 142, 143, 144, 145, 70,
147, 148, 149, 150, 151, -1, -1, 78, 79, 80,
81, 158, 83, 84, -1, -1, 163, 164, 165, 166,
167, 92, 169, 170, -1, 172, 173, 174, -1, -1,
-1, 178, -1, 104, -1, -1, -1, -1, -1, -1,
187, 188, -1, -1, -1, -1, 193, -1, -1, -1,
121, 198, 199, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 140,
141, 142, 143, 144, 145, 70, 147, 148, 149, 150,
151, -1, -1, 78, 79, 80, 81, 158, 83, 84,
-1, -1, 163, 164, 165, 166, 167, 92, 169, 170,
-1, 172, 173, 174, -1, -1, -1, 178, -1, 104,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 193, -1, -1, -1, 121, 198, 199, -1,
-1, 202, -1, -1, 205, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 139, 140, 141, 142, 143, 144,
145, -1, 147, 148, 149, 150, 151, -1, -1, -1,
-1, -1, -1, 158, -1, -1, -1, -1, 163, 164,
165, 166, 167, -1, 169, 170, -1, 172, 173, 174,
70, 71, -1, 178, -1, -1, -1, -1, 78, 79,
80, 81, -1, 83, 84, -1, -1, -1, 193, -1,
-1, -1, 92, 198, 199, -1, -1, -1, -1, -1,
205, -1, -1, -1, 104, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 121, 38, 39, 40, 41, 42, 43, 44, 45,
46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
140, 141, 142, 143, 144, 145, 70, 147, 148, 149,
150, 151, -1, 69, 78, 79, 80, 81, 158, 83,
84, -1, -1, 163, 164, 165, 166, 167, 92, 169,
170, -1, 172, 173, 174, -1, -1, -1, 178, -1,
104, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 193, -1, -1, -1, 121, 198, 199,
-1, -1, -1, -1, -1, 205, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 139, 140, 141, 142, 143,
144, 145, 70, 147, 148, 149, 150, 151, -1, -1,
78, 79, 80, 81, 158, 83, 84, -1, -1, 163,
164, 165, 166, 167, 92, 169, 170, -1, 172, 173,
174, -1, -1, -1, 178, -1, 104, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 193,
-1, -1, -1, 121, 198, 199, -1, -1, -1, -1,
-1, 205, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 140, 141, 142, 143, 144, 145, -1, 147,
148, 149, 150, 151, -1, -1, -1, -1, -1, -1,
158, -1, -1, -1, -1, 163, 164, 165, 166, 167,
-1, 169, 170, -1, 172, 173, 174, -1, -1, -1,
178, -1, -1, -1, -1, 10, 11, 12, -1, -1,
-1, -1, -1, -1, -1, 193, -1, -1, -1, -1,
198, 199, -1, -1, -1, 30, 31, 205, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
55, -1, 57, 10, 11, 12, -1, -1, -1, -1,
-1, -1, -1, -1, 69, -1, -1, -1, -1, -1,
-1, -1, -1, 30, 31, -1, 33, 34, 35, 36,
37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
47, 48, 49, 50, 51, 52, 53, 54, 55, -1,
57, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 69, -1, 10, 11, 12, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 138, 30, 31, -1, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
-1, 57, 10, 11, 12, -1, -1, -1, -1, -1,
-1, -1, -1, 69, -1, -1, -1, -1, -1, -1,
-1, 138, 30, 31, -1, 33, 34, 35, 36, 37,
38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, -1, 57,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 69, -1, 10, 11, 12, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 138, 30, 31, -1, 33, 34, 35, 36,
37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
47, 48, 49, 50, 51, 52, 53, 54, 55, -1,
57, 10, 11, 12, -1, -1, -1, -1, -1, -1,
-1, -1, 69, -1, -1, -1, -1, -1, -1, -1,
138, 30, 31, -1, 33, 34, 35, 36, 37, 38,
39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 51, 52, 53, 54, 55, -1, 57, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
69, 10, 11, 12, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 138, 31, -1, -1, 34, 35, 36, 37, 38,
39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 51, 52, 53, 54, 55, 10, 11, 12,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
69, -1, -1, -1, -1, -1, -1, -1, 31, 138,
-1, 34, 35, 36, 37, 38, 39, 40, 41, 42,
43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
53, 54, 55, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 69, 10, 11, 12,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 31, 138,
-1, 34, 35, 36, 37, 38, 39, 40, 41, 42,
43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
53, 54, 55, 10, 11, 12, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 69, -1, -1, -1,
-1, -1, -1, -1, 31, 138, -1, 34, 35, 36,
37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
47, 48, 49, 50, 51, 52, 53, 54, 55, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 69, 10, 11, 12, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 31, 138, -1, 34, 35, 36,
37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
47, 48, 49, 50, 51, 52, 53, 54, 55, 10,
11, 12, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 69, -1, -1, -1, -1, -1, -1, -1,
31, 138, -1, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
51, 52, 53, 54, 55, 78, 79, 80, 81, -1,
83, 84, -1, -1, -1, -1, -1, -1, 69, 92,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 104, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 138, -1, -1, -1, -1, -1, -1, 121, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 132,
-1, -1, -1, -1, -1, -1, -1, -1, 141, 142,
143, 144, 145, -1, 147, 148, 149, 150, 151, -1,
-1, -1, -1, -1, -1, 158, -1, 138, -1, -1,
163, 164, 165, 166, 167, -1, 169, 170, -1, 172,
173, 174, -1, -1, -1, 178, -1, 78, 79, 80,
81, -1, 83, 84, -1, -1, -1, -1, -1, -1,
193, 92, -1, -1, -1, 198, 199, -1, -1, -1,
-1, -1, 205, 104, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
121, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, -1, 57,
141, 142, 143, 144, 145, -1, 147, 148, 149, 150,
151, 69, -1, 78, 79, 80, 81, 158, 83, 84,
-1, -1, 163, 164, 165, 166, 167, 92, 169, 170,
-1, 172, 173, 174, -1, -1, -1, 178, -1, 104,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 193, -1, -1, -1, 121, 198, 199, -1,
-1, -1, -1, -1, 205, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 141, 142, 143, 144,
145, -1, 147, 148, 149, 150, 151, 81, -1, -1,
-1, -1, -1, 158, -1, -1, -1, -1, 163, 164,
165, 166, 167, -1, 169, 170, -1, 172, 173, 174,
104, -1, -1, 178, -1, -1, -1, -1, 112, 113,
-1, -1, -1, -1, -1, -1, -1, -1, 193, -1,
-1, -1, -1, 198, 199, -1, -1, -1, -1, -1,
205, -1, -1, -1, -1, -1, -1, 141, 142, 143,
144, 145, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 163,
-1, -1, 166, -1, -1, 169, 170, -1, 172, 173,
174, -1, 10, 11, 12, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 189, -1, -1, -1, 27,
-1, -1, 30, 31, 198, 33, 34, 35, 36, 37,
38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, -1, 57,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 69, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 10, 11, 12, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 103, 30, 31, 32, 33,
34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
54, 55, -1, 57, 10, 11, 12, -1, -1, -1,
-1, -1, -1, -1, -1, 69, -1, -1, -1, -1,
-1, -1, -1, -1, 30, 31, -1, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
-1, 57, 10, 11, 12, -1, -1, -1, -1, -1,
-1, -1, -1, 69, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 31, 32, -1, 34, 35, 36, 37,
38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 10, 11,
12, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 69, -1, -1, -1, -1, -1, -1, -1, 31,
-1, -1, 34, 35, 36, 37, 38, 39, 40, 41,
42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
52, 53, 54, 55, 11, 12, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 69, -1, -1,
-1, -1, -1, 30, 31, -1, 33, 34, 35, 36,
37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
47, 48, 49, 50, 51, 52, 53, 54, 55, -1,
57, 11, 12, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 69, -1, -1, -1, -1, -1, -1, -1,
-1, 31, -1, -1, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
50, 51, 52, 53, 54, 55, 12, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 69,
-1, -1, -1, -1, 30, 31, -1, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
12, 57, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 69, -1, -1, -1, -1, -1, 31,
-1, -1, 34, 35, 36, 37, 38, 39, 40, 41,
42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
52, 53, 54, 55, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 31, 69, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
55, -1, 57, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 31, -1, 69, 34, 35, 36, 37, 38,
39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 51, 52, 53, 54, 55, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
69, 33, 34, 35, 36, 37, 38, 39, 40, 41,
42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
52, 53, 54, 55, -1, 57, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 69, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 69, 36, 37, 38, 39, 40, 41,
42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
52, 53, 54, 55, -1, 57, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 69, 37, 38,
39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 51, 52, 53, 54, 55, -1, 57, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
69, 37, 38, 39, 40, 41, 42, 43, 44, 45,
46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 69, 39, 40, 41, 42, 43, 44,
45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
55, -1, 57, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 69, 39, 40, 41, 42, 43,
44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
54, 55, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 69
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint16 yystos[] =
{
0, 210, 211, 0, 212, 3, 4, 5, 6, 7,
13, 27, 28, 29, 48, 50, 51, 56, 58, 59,
60, 61, 62, 63, 64, 65, 66, 67, 68, 70,
71, 72, 73, 74, 78, 79, 80, 81, 82, 83,
84, 86, 88, 92, 93, 94, 95, 97, 99, 101,
104, 105, 109, 110, 111, 112, 113, 114, 115, 117,
119, 120, 121, 122, 123, 124, 125, 126, 128, 129,
130, 131, 132, 133, 139, 140, 141, 142, 143, 144,
145, 147, 148, 149, 150, 151, 155, 158, 163, 164,
165, 166, 167, 169, 170, 172, 173, 174, 175, 178,
181, 187, 188, 189, 191, 193, 194, 195, 198, 199,
201, 202, 205, 206, 207, 208, 213, 216, 226, 227,
228, 229, 230, 236, 245, 246, 257, 258, 262, 265,
272, 278, 337, 338, 346, 347, 350, 351, 352, 353,
354, 355, 356, 357, 359, 360, 361, 363, 366, 378,
379, 386, 389, 392, 395, 398, 401, 407, 409, 410,
412, 422, 423, 424, 426, 431, 436, 456, 464, 466,
467, 468, 469, 470, 471, 472, 473, 474, 475, 476,
477, 478, 492, 494, 496, 121, 122, 123, 139, 163,
173, 199, 216, 257, 337, 359, 468, 359, 199, 359,
359, 359, 359, 109, 359, 359, 454, 455, 359, 359,
359, 359, 81, 83, 92, 121, 141, 142, 143, 144,
145, 158, 199, 227, 379, 423, 426, 431, 468, 472,
468, 359, 359, 359, 359, 359, 359, 359, 359, 38,
359, 483, 484, 121, 132, 199, 227, 270, 423, 424,
425, 427, 431, 465, 466, 467, 476, 480, 481, 359,
199, 358, 428, 199, 358, 370, 348, 359, 238, 358,
199, 199, 199, 358, 201, 359, 216, 201, 359, 3,
4, 6, 7, 10, 11, 12, 13, 28, 29, 31,
57, 68, 71, 72, 73, 74, 75, 76, 77, 87,
93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
103, 105, 106, 107, 108, 109, 110, 111, 112, 113,
114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
124, 125, 126, 127, 128, 130, 132, 133, 134, 135,
139, 140, 146, 163, 167, 175, 177, 180, 187, 188,
199, 216, 217, 218, 229, 497, 518, 519, 522, 27,
201, 353, 355, 359, 202, 250, 359, 112, 113, 163,
166, 189, 219, 220, 221, 222, 226, 83, 205, 305,
306, 83, 307, 123, 132, 122, 132, 199, 199, 199,
199, 216, 276, 500, 199, 199, 70, 70, 70, 70,
70, 348, 83, 91, 159, 160, 161, 489, 490, 166,
202, 226, 226, 216, 277, 500, 167, 199, 199, 500,
500, 83, 195, 202, 371, 28, 347, 350, 359, 361,
468, 473, 233, 202, 478, 91, 429, 489, 91, 489,
489, 32, 166, 183, 501, 199, 9, 201, 199, 346,
360, 469, 472, 118, 38, 256, 167, 275, 500, 121,
194, 257, 338, 70, 202, 463, 201, 201, 201, 201,
201, 201, 201, 201, 10, 11, 12, 30, 31, 33,
34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
54, 55, 57, 69, 201, 70, 70, 202, 162, 133,
173, 175, 189, 191, 278, 336, 337, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
59, 60, 136, 137, 458, 463, 463, 199, 199, 70,
202, 199, 256, 257, 14, 359, 201, 138, 49, 216,
453, 91, 347, 361, 162, 468, 138, 204, 9, 438,
271, 347, 361, 468, 501, 162, 199, 430, 458, 463,
200, 359, 32, 236, 8, 372, 9, 201, 236, 237,
348, 349, 359, 216, 290, 240, 201, 201, 201, 140,
146, 522, 522, 183, 521, 199, 112, 522, 14, 162,
140, 146, 163, 216, 218, 201, 201, 201, 251, 116,
180, 201, 219, 221, 219, 221, 219, 221, 226, 219,
221, 202, 9, 439, 201, 103, 166, 202, 468, 9,
201, 14, 9, 201, 132, 132, 468, 493, 348, 347,
361, 468, 472, 473, 200, 183, 268, 139, 468, 482,
483, 359, 380, 381, 348, 404, 404, 380, 404, 201,
70, 458, 159, 490, 82, 359, 468, 91, 159, 490,
226, 215, 201, 202, 263, 273, 413, 415, 92, 199,
373, 374, 376, 422, 426, 475, 477, 494, 404, 14,
103, 495, 367, 368, 369, 300, 301, 456, 457, 200,
200, 200, 200, 200, 203, 235, 236, 258, 265, 272,
456, 359, 206, 207, 208, 216, 502, 503, 522, 38,
87, 176, 303, 304, 359, 497, 247, 248, 347, 355,
356, 359, 361, 468, 202, 249, 249, 249, 249, 199,
500, 266, 256, 359, 479, 359, 359, 359, 359, 359,
32, 359, 359, 359, 359, 359, 359, 359, 359, 359,
359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
359, 359, 359, 359, 359, 427, 359, 479, 479, 359,
485, 486, 132, 202, 217, 218, 478, 276, 216, 277,
500, 500, 275, 257, 38, 350, 353, 355, 359, 359,
359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
359, 167, 202, 216, 459, 460, 461, 462, 478, 303,
303, 479, 359, 482, 256, 200, 359, 199, 452, 9,
438, 200, 200, 38, 359, 38, 359, 430, 200, 200,
200, 476, 477, 478, 303, 202, 216, 459, 460, 478,
200, 233, 294, 202, 355, 359, 359, 95, 32, 236,
288, 201, 27, 103, 14, 9, 200, 32, 202, 291,
522, 31, 92, 176, 229, 515, 516, 517, 199, 9,
50, 51, 56, 58, 70, 140, 141, 142, 143, 144,
145, 187, 188, 199, 227, 387, 390, 393, 396, 399,
402, 408, 423, 431, 432, 434, 435, 216, 520, 233,
199, 244, 202, 201, 202, 201, 202, 201, 103, 166,
202, 201, 112, 113, 166, 222, 223, 224, 225, 226,
222, 216, 359, 306, 432, 83, 9, 200, 200, 200,
200, 200, 200, 200, 201, 50, 51, 511, 513, 514,
134, 281, 199, 9, 200, 200, 138, 204, 9, 438,
9, 438, 204, 204, 204, 204, 83, 85, 216, 491,
216, 70, 203, 203, 212, 214, 32, 135, 280, 182,
54, 167, 182, 202, 417, 361, 138, 9, 438, 200,
162, 200, 522, 522, 14, 372, 300, 231, 196, 9,
439, 87, 522, 523, 458, 458, 203, 9, 438, 184,
468, 83, 84, 302, 359, 200, 9, 439, 14, 9,
200, 9, 200, 200, 200, 200, 14, 200, 203, 234,
235, 364, 259, 134, 279, 199, 500, 204, 203, 359,
32, 204, 204, 138, 203, 9, 438, 359, 501, 199,
269, 264, 274, 14, 495, 267, 256, 71, 468, 359,
501, 200, 200, 204, 203, 200, 50, 51, 70, 78,
79, 80, 92, 140, 141, 142, 143, 144, 145, 158,
187, 188, 216, 388, 391, 394, 397, 400, 403, 423,
434, 441, 443, 444, 448, 451, 216, 468, 468, 138,
279, 458, 463, 458, 200, 359, 295, 75, 76, 296,
231, 358, 233, 349, 103, 38, 139, 285, 468, 432,
216, 32, 236, 289, 201, 292, 201, 292, 9, 438,
92, 229, 138, 162, 9, 438, 200, 87, 504, 505,
522, 523, 502, 432, 432, 432, 432, 432, 437, 440,
199, 70, 70, 70, 70, 70, 199, 199, 432, 162,
202, 10, 11, 12, 31, 34, 35, 36, 37, 38,
39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 51, 52, 53, 54, 55, 69, 162, 501,
203, 423, 202, 253, 221, 221, 221, 216, 221, 222,
222, 226, 9, 439, 203, 203, 14, 468, 201, 184,
9, 438, 216, 282, 423, 202, 482, 139, 468, 14,
359, 359, 204, 359, 203, 212, 522, 282, 202, 416,
176, 14, 200, 359, 373, 478, 201, 522, 196, 203,
232, 235, 245, 32, 509, 457, 523, 38, 83, 176,
459, 460, 462, 459, 460, 462, 522, 70, 38, 87,
176, 359, 432, 248, 355, 356, 468, 249, 248, 249,
249, 203, 235, 300, 199, 423, 280, 365, 260, 359,
359, 359, 203, 199, 303, 281, 32, 280, 522, 14,
279, 500, 427, 203, 199, 14, 78, 79, 80, 216,
442, 442, 444, 446, 447, 52, 199, 70, 70, 70,
70, 70, 91, 159, 199, 199, 162, 9, 438, 200,
452, 38, 359, 280, 203, 75, 76, 297, 358, 236,
203, 201, 96, 201, 285, 468, 199, 138, 284, 14,
233, 292, 106, 107, 108, 292, 203, 522, 184, 138,
162, 522, 216, 176, 515, 522, 9, 438, 200, 176,
438, 138, 204, 9, 438, 437, 382, 383, 432, 405,
432, 433, 405, 382, 405, 373, 375, 377, 405, 200,
132, 217, 432, 487, 488, 432, 432, 432, 32, 432,
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
432, 432, 432, 520, 83, 254, 203, 203, 203, 203,
225, 201, 432, 514, 103, 104, 510, 512, 9, 311,
200, 199, 350, 355, 359, 138, 204, 203, 495, 311,
168, 181, 202, 412, 419, 359, 168, 202, 418, 138,
201, 509, 199, 248, 346, 360, 469, 472, 522, 372,
87, 523, 83, 83, 176, 14, 83, 501, 501, 479,
468, 302, 359, 200, 300, 202, 300, 199, 138, 199,
303, 200, 202, 522, 202, 201, 522, 280, 261, 430,
303, 138, 204, 9, 438, 443, 446, 384, 385, 444,
406, 444, 445, 406, 384, 406, 159, 373, 449, 450,
406, 81, 444, 468, 202, 358, 32, 77, 236, 201,
349, 284, 482, 285, 200, 432, 102, 106, 201, 359,
32, 201, 293, 203, 184, 522, 216, 138, 87, 522,
523, 32, 200, 432, 432, 200, 204, 9, 438, 138,
204, 9, 438, 204, 204, 204, 138, 9, 438, 200,
200, 138, 203, 9, 438, 432, 32, 200, 233, 201,
201, 201, 201, 216, 522, 522, 510, 423, 6, 113,
119, 122, 124, 125, 126, 127, 169, 170, 172, 203,
312, 335, 336, 337, 340, 342, 343, 344, 345, 456,
482, 359, 203, 202, 203, 54, 359, 203, 359, 359,
372, 468, 201, 202, 523, 38, 83, 176, 14, 83,
359, 199, 199, 204, 509, 200, 311, 200, 300, 359,
303, 200, 311, 495, 311, 201, 202, 199, 200, 444,
444, 200, 204, 9, 438, 138, 204, 9, 438, 204,
204, 204, 138, 200, 9, 438, 200, 311, 32, 233,
201, 200, 200, 200, 241, 201, 201, 293, 233, 138,
522, 522, 176, 522, 138, 432, 432, 432, 432, 373,
432, 432, 432, 202, 203, 512, 134, 135, 189, 217,
498, 522, 283, 423, 113, 345, 31, 127, 140, 146,
167, 173, 319, 320, 321, 322, 423, 171, 327, 328,
130, 199, 216, 329, 330, 83, 341, 257, 522, 113,
9, 201, 9, 201, 201, 495, 336, 337, 200, 308,
167, 414, 203, 203, 359, 83, 83, 176, 14, 83,
359, 303, 303, 119, 362, 509, 203, 509, 200, 200,
203, 202, 203, 311, 300, 138, 444, 444, 444, 444,
373, 203, 233, 239, 242, 32, 236, 287, 233, 522,
200, 432, 138, 138, 138, 233, 423, 423, 500, 14,
217, 9, 201, 202, 498, 495, 322, 183, 202, 9,
201, 3, 4, 5, 6, 7, 10, 11, 12, 13,
27, 28, 29, 57, 71, 72, 73, 74, 75, 76,
77, 87, 93, 94, 95, 96, 97, 98, 99, 100,
101, 102, 103, 105, 106, 107, 108, 109, 110, 111,
112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
132, 133, 134, 135, 139, 140, 147, 148, 149, 150,
151, 163, 164, 165, 175, 177, 178, 180, 187, 189,
191, 193, 194, 216, 420, 421, 9, 201, 167, 171,
216, 330, 331, 332, 201, 14, 9, 201, 256, 341,
498, 498, 498, 14, 257, 341, 522, 203, 309, 310,
498, 14, 83, 359, 200, 200, 199, 509, 198, 506,
362, 509, 308, 203, 200, 444, 138, 138, 32, 236,
286, 287, 233, 432, 432, 432, 203, 201, 201, 432,
423, 315, 522, 323, 324, 431, 320, 14, 32, 51,
325, 328, 9, 36, 200, 31, 50, 53, 432, 83,
218, 499, 201, 14, 14, 522, 256, 201, 341, 201,
14, 359, 38, 83, 411, 202, 507, 508, 522, 201,
202, 333, 509, 506, 203, 509, 444, 444, 233, 100,
252, 203, 216, 229, 316, 317, 318, 9, 438, 9,
438, 203, 432, 421, 421, 68, 326, 331, 331, 31,
50, 53, 14, 183, 199, 432, 432, 499, 201, 432,
83, 9, 439, 231, 9, 439, 14, 510, 231, 202,
333, 333, 98, 201, 116, 243, 162, 103, 522, 184,
431, 174, 432, 511, 313, 199, 38, 83, 200, 203,
508, 522, 203, 231, 201, 199, 180, 255, 216, 336,
337, 184, 184, 298, 299, 457, 314, 83, 203, 423,
253, 177, 216, 201, 200, 9, 439, 87, 124, 125,
126, 339, 340, 298, 83, 283, 201, 509, 457, 523,
523, 200, 200, 201, 506, 87, 339, 83, 38, 83,
176, 509, 202, 201, 202, 334, 523, 523, 83, 176,
14, 83, 506, 233, 231, 83, 38, 83, 176, 14,
83, 359, 334, 203, 203, 83, 176, 14, 83, 359,
14, 83, 359, 359
};
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint16 yyr1[] =
{
0, 209, 211, 210, 212, 212, 213, 213, 213, 213,
213, 213, 213, 213, 214, 213, 215, 213, 213, 213,
213, 213, 213, 213, 213, 213, 213, 213, 213, 216,
216, 216, 216, 216, 216, 216, 216, 216, 216, 216,
216, 216, 217, 217, 217, 217, 217, 217, 217, 217,
217, 217, 217, 217, 217, 217, 217, 217, 217, 217,
217, 217, 217, 217, 217, 217, 217, 217, 217, 217,
217, 217, 217, 217, 217, 217, 217, 217, 217, 217,
217, 217, 217, 217, 217, 217, 217, 217, 217, 217,
217, 217, 217, 217, 217, 217, 217, 217, 217, 217,
217, 217, 217, 217, 217, 217, 217, 217, 217, 218,
218, 219, 219, 220, 220, 221, 222, 222, 222, 222,
223, 223, 224, 225, 225, 225, 226, 226, 227, 227,
227, 228, 229, 230, 230, 231, 231, 232, 232, 233,
233, 234, 234, 235, 235, 235, 235, 236, 236, 236,
237, 236, 238, 236, 239, 236, 240, 236, 236, 236,
236, 236, 236, 236, 236, 236, 236, 236, 236, 236,
236, 236, 236, 241, 236, 242, 236, 236, 243, 236,
244, 236, 236, 236, 236, 236, 236, 236, 236, 236,
236, 236, 236, 236, 236, 236, 236, 236, 236, 236,
236, 236, 236, 245, 246, 246, 247, 247, 248, 248,
248, 249, 249, 251, 250, 252, 252, 254, 253, 255,
255, 256, 256, 257, 259, 258, 260, 258, 261, 258,
263, 262, 264, 262, 266, 265, 267, 265, 268, 265,
269, 265, 271, 270, 273, 272, 274, 272, 275, 275,
276, 277, 278, 278, 278, 278, 278, 279, 279, 280,
280, 281, 281, 282, 282, 283, 283, 284, 284, 285,
285, 285, 286, 286, 287, 287, 288, 288, 289, 289,
290, 290, 291, 291, 291, 291, 292, 292, 292, 293,
293, 294, 294, 295, 295, 296, 296, 297, 297, 298,
298, 298, 298, 298, 298, 298, 298, 299, 299, 299,
299, 299, 299, 299, 299, 299, 299, 300, 300, 300,
300, 300, 300, 300, 300, 301, 301, 301, 301, 301,
301, 301, 301, 301, 301, 302, 302, 302, 303, 303,
304, 304, 304, 304, 304, 304, 304, 304, 305, 305,
306, 306, 306, 307, 307, 307, 307, 308, 308, 309,
310, 311, 311, 312, 312, 312, 312, 312, 312, 312,
313, 312, 314, 312, 312, 312, 312, 312, 312, 312,
312, 315, 315, 315, 316, 317, 317, 318, 318, 319,
319, 320, 320, 321, 321, 322, 322, 322, 322, 322,
322, 322, 323, 323, 324, 325, 325, 326, 326, 327,
327, 328, 329, 329, 329, 330, 330, 330, 330, 331,
331, 331, 331, 331, 331, 331, 332, 332, 332, 333,
333, 334, 334, 335, 335, 336, 336, 337, 337, 338,
338, 338, 338, 338, 338, 338, 339, 339, 340, 340,
340, 341, 341, 341, 341, 342, 342, 342, 343, 343,
344, 344, 345, 346, 347, 347, 347, 347, 347, 347,
348, 348, 349, 349, 350, 350, 350, 350, 351, 352,
353, 354, 355, 356, 357, 358, 359, 359, 359, 359,
359, 360, 361, 361, 361, 361, 361, 361, 361, 361,
361, 361, 361, 361, 361, 361, 361, 361, 361, 361,
361, 361, 361, 361, 361, 361, 361, 361, 361, 361,
361, 361, 361, 361, 361, 361, 361, 361, 361, 361,
361, 361, 361, 361, 361, 361, 361, 361, 361, 361,
361, 361, 361, 361, 361, 361, 361, 361, 361, 361,
361, 361, 361, 361, 361, 361, 361, 361, 361, 361,
361, 361, 361, 361, 361, 361, 361, 361, 361, 361,
362, 362, 364, 363, 365, 363, 367, 366, 368, 366,
369, 366, 370, 366, 371, 366, 372, 372, 372, 373,
373, 374, 374, 375, 375, 376, 376, 377, 377, 378,
379, 379, 380, 380, 381, 381, 382, 382, 383, 383,
384, 384, 385, 385, 386, 387, 388, 389, 390, 391,
392, 393, 394, 395, 396, 397, 398, 399, 400, 401,
402, 403, 404, 404, 405, 405, 406, 406, 407, 408,
409, 409, 410, 410, 410, 410, 410, 410, 410, 410,
410, 410, 410, 410, 411, 411, 411, 411, 412, 413,
413, 414, 414, 415, 415, 415, 416, 416, 417, 418,
418, 419, 419, 419, 420, 420, 420, 421, 421, 421,
421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
422, 423, 423, 424, 424, 424, 424, 424, 425, 425,
426, 426, 426, 426, 427, 427, 427, 428, 428, 428,
429, 429, 429, 430, 430, 431, 431, 431, 431, 431,
431, 431, 431, 431, 431, 431, 431, 431, 431, 431,
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
432, 432, 432, 432, 432, 432, 433, 433, 434, 435,
435, 436, 436, 436, 436, 436, 436, 436, 437, 437,
438, 438, 439, 439, 440, 440, 440, 440, 441, 441,
441, 441, 441, 442, 442, 442, 442, 443, 443, 444,
444, 444, 444, 444, 444, 444, 444, 444, 444, 444,
444, 444, 444, 444, 444, 445, 445, 446, 446, 447,
447, 447, 447, 448, 448, 449, 449, 450, 450, 451,
451, 452, 452, 453, 453, 455, 454, 456, 457, 457,
458, 458, 459, 459, 459, 460, 460, 461, 461, 462,
462, 463, 463, 464, 464, 464, 465, 465, 466, 466,
467, 467, 468, 468, 468, 468, 468, 468, 468, 468,
468, 468, 468, 469, 470, 470, 470, 470, 470, 470,
470, 470, 471, 471, 471, 471, 471, 471, 471, 471,
471, 471, 471, 472, 473, 473, 474, 474, 474, 475,
475, 475, 476, 477, 477, 477, 478, 478, 478, 478,
479, 479, 480, 480, 480, 480, 480, 480, 481, 481,
481, 481, 481, 482, 482, 482, 482, 482, 482, 483,
483, 484, 484, 484, 484, 484, 484, 484, 484, 485,
485, 486, 486, 486, 486, 487, 487, 488, 488, 488,
488, 489, 489, 489, 489, 490, 490, 490, 490, 490,
490, 491, 491, 491, 492, 492, 492, 492, 492, 492,
492, 492, 492, 492, 492, 493, 493, 494, 494, 495,
495, 496, 496, 496, 496, 497, 497, 498, 498, 499,
499, 500, 500, 501, 501, 502, 502, 503, 504, 504,
504, 504, 504, 504, 505, 505, 505, 505, 506, 506,
507, 507, 508, 508, 509, 509, 510, 510, 511, 512,
512, 513, 513, 513, 513, 514, 514, 514, 515, 515,
515, 515, 516, 516, 517, 517, 517, 517, 518, 519,
520, 520, 521, 521, 522, 522, 522, 522, 522, 522,
522, 522, 522, 522, 522, 523, 523
};
/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
0, 2, 0, 2, 2, 0, 1, 1, 1, 1,
1, 1, 4, 3, 0, 6, 0, 5, 3, 4,
4, 4, 4, 6, 7, 7, 7, 7, 2, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 2, 3, 3, 1, 2, 1, 2, 3, 4,
3, 1, 2, 1, 2, 2, 1, 3, 1, 3,
2, 2, 2, 5, 4, 2, 0, 1, 3, 2,
0, 2, 1, 1, 1, 1, 1, 3, 5, 8,
0, 4, 0, 6, 0, 10, 0, 4, 2, 3,
2, 3, 2, 3, 3, 3, 3, 3, 3, 5,
1, 1, 1, 0, 9, 0, 10, 5, 0, 13,
0, 5, 3, 3, 3, 3, 5, 5, 5, 3,
3, 2, 2, 2, 2, 2, 2, 3, 2, 2,
3, 2, 2, 2, 1, 0, 3, 3, 1, 1,
1, 3, 2, 0, 4, 9, 0, 0, 4, 2,
0, 1, 0, 1, 0, 10, 0, 11, 0, 11,
0, 9, 0, 10, 0, 8, 0, 9, 0, 7,
0, 8, 0, 8, 0, 7, 0, 8, 1, 1,
1, 1, 1, 2, 3, 3, 2, 2, 0, 2,
0, 2, 0, 1, 3, 1, 3, 2, 0, 1,
2, 4, 1, 4, 1, 4, 1, 4, 1, 4,
3, 5, 3, 4, 4, 5, 5, 4, 0, 1,
1, 4, 0, 5, 0, 2, 0, 3, 0, 7,
8, 6, 2, 5, 6, 4, 0, 4, 4, 5,
7, 6, 6, 6, 7, 9, 8, 6, 7, 5,
2, 4, 5, 3, 0, 3, 4, 4, 6, 5,
5, 6, 6, 8, 7, 4, 1, 1, 2, 0,
1, 2, 2, 2, 3, 4, 4, 4, 3, 1,
1, 2, 4, 3, 5, 1, 3, 2, 0, 2,
3, 2, 0, 3, 4, 4, 5, 2, 2, 2,
0, 11, 0, 12, 3, 3, 3, 4, 4, 3,
5, 2, 2, 0, 6, 5, 4, 3, 1, 1,
3, 4, 1, 2, 1, 1, 5, 6, 1, 1,
4, 1, 1, 3, 2, 2, 0, 2, 0, 1,
3, 1, 1, 1, 1, 3, 4, 4, 4, 1,
1, 2, 2, 2, 3, 3, 1, 1, 1, 1,
3, 1, 3, 1, 1, 1, 0, 1, 2, 1,
1, 1, 1, 1, 1, 1, 1, 0, 1, 1,
1, 3, 5, 1, 3, 5, 4, 5, 3, 3,
3, 4, 3, 3, 3, 3, 2, 2, 1, 1,
3, 1, 1, 0, 1, 2, 4, 3, 3, 6,
2, 3, 2, 3, 6, 3, 1, 1, 1, 1,
1, 3, 6, 3, 4, 6, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 2, 2,
2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
2, 2, 2, 2, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 1, 5, 4, 3, 1, 2,
2, 2, 2, 2, 2, 2, 2, 2, 1, 1,
1, 1, 1, 1, 1, 1, 1, 3, 2, 1,
5, 0, 0, 12, 0, 13, 0, 4, 0, 7,
0, 5, 0, 3, 0, 6, 2, 2, 4, 1,
1, 5, 3, 5, 3, 2, 0, 2, 0, 4,
4, 3, 2, 0, 5, 3, 2, 0, 5, 3,
2, 0, 5, 3, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 2, 0, 2, 0, 2, 0, 4, 4,
4, 4, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 3, 1, 3, 4, 1, 2, 4, 2,
6, 0, 1, 0, 5, 4, 2, 0, 1, 1,
3, 1, 3, 1, 1, 3, 3, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
4, 1, 1, 1, 1, 1, 1, 3, 1, 3,
1, 1, 1, 3, 1, 1, 1, 2, 1, 0,
0, 1, 1, 3, 0, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 3, 2,
1, 1, 4, 3, 4, 1, 1, 1, 1, 1,
1, 1, 1, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 2, 2, 2, 2, 3, 3, 3, 3, 3,
3, 3, 3, 3, 5, 4, 3, 1, 3, 3,
1, 1, 1, 1, 1, 3, 3, 3, 2, 0,
1, 0, 1, 0, 5, 3, 3, 1, 1, 1,
1, 3, 2, 1, 1, 1, 1, 1, 3, 1,
1, 1, 3, 1, 2, 2, 4, 3, 4, 1,
1, 1, 1, 1, 1, 3, 1, 2, 0, 5,
3, 3, 1, 3, 1, 2, 0, 5, 3, 2,
0, 3, 0, 4, 2, 0, 3, 3, 1, 0,
1, 1, 1, 1, 3, 1, 1, 1, 3, 1,
1, 3, 3, 2, 2, 2, 2, 4, 5, 5,
5, 5, 1, 1, 1, 1, 1, 1, 3, 3,
4, 4, 3, 3, 1, 1, 1, 1, 3, 1,
4, 3, 1, 1, 1, 1, 1, 3, 3, 1,
1, 4, 4, 3, 1, 1, 7, 9, 9, 7,
6, 8, 1, 4, 4, 1, 1, 1, 4, 2,
1, 0, 1, 1, 1, 3, 3, 3, 0, 1,
1, 3, 3, 2, 3, 6, 0, 1, 4, 2,
0, 5, 3, 3, 1, 6, 4, 4, 2, 2,
0, 5, 3, 3, 1, 2, 0, 5, 3, 3,
1, 2, 2, 1, 2, 1, 4, 3, 3, 6,
3, 1, 1, 1, 4, 4, 4, 4, 4, 4,
2, 2, 4, 2, 2, 1, 3, 3, 3, 0,
2, 5, 6, 6, 7, 1, 2, 1, 2, 1,
4, 1, 4, 3, 0, 1, 3, 2, 1, 2,
4, 3, 3, 1, 4, 2, 2, 0, 0, 3,
1, 3, 3, 2, 0, 2, 2, 2, 2, 1,
2, 4, 2, 5, 3, 1, 1, 0, 3, 4,
5, 6, 3, 1, 3, 2, 1, 0, 4, 1,
3, 2, 4, 5, 2, 2, 1, 1, 1, 1,
3, 2, 1, 8, 6, 1, 0
};
#define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
#define YYEMPTY (-2)
#define YYEOF 0
#define YYACCEPT goto yyacceptlab
#define YYABORT goto yyabortlab
#define YYERROR goto yyerrorlab
#define YYRECOVERING() (!!yyerrstatus)
#define YYBACKUP(Token, Value) \
do \
if (yychar == YYEMPTY) \
{ \
yychar = (Token); \
yylval = (Value); \
YYPOPSTACK (yylen); \
yystate = *yyssp; \
goto yybackup; \
} \
else \
{ \
yyerror (&yylloc, _p, YY_("syntax error: cannot back up")); \
YYERROR; \
} \
while (0)
/* Error token number */
#define YYTERROR 1
#define YYERRCODE 256
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
If N is 0, then set CURRENT to the empty location which ends
the previous symbol: RHS[0] (always defined). */
#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N) \
do \
if (N) \
{ \
(Current).line0 = YYRHSLOC (Rhs, 1).line0; \
(Current).char0 = YYRHSLOC (Rhs, 1).char0; \
(Current).line1 = YYRHSLOC (Rhs, N).line1; \
(Current).char1 = YYRHSLOC (Rhs, N).char1; \
} \
else \
{ \
(Current).line0 = (Current).line1 = \
YYRHSLOC (Rhs, 0).line1; \
(Current).char0 = (Current).char1 = \
YYRHSLOC (Rhs, 0).char1; \
} \
while (0)
#endif
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
/* Enable debugging if requested. */
#if YYDEBUG
# ifndef YYFPRINTF
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
# define YYFPRINTF fprintf
# endif
# define YYDPRINTF(Args) \
do { \
if (yydebug) \
YYFPRINTF Args; \
} while (0)
/* YY_LOCATION_PRINT -- Print the location on the stream.
This macro was not mandated originally: define only if we know
we won't break user code: when these are the locations we know. */
#ifndef YY_LOCATION_PRINT
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
YY_ATTRIBUTE_UNUSED
static unsigned
yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
{
unsigned res = 0;
int end_col = 0 != yylocp->char1 ? yylocp->char1 - 1 : 0;
if (0 <= yylocp->line0)
{
res += YYFPRINTF (yyo, "%d", yylocp->line0);
if (0 <= yylocp->char0)
res += YYFPRINTF (yyo, ".%d", yylocp->char0);
}
if (0 <= yylocp->line1)
{
if (yylocp->line0 < yylocp->line1)
{
res += YYFPRINTF (yyo, "-%d", yylocp->line1);
if (0 <= end_col)
res += YYFPRINTF (yyo, ".%d", end_col);
}
else if (0 <= end_col && yylocp->char0 < end_col)
res += YYFPRINTF (yyo, "-%d", end_col);
}
return res;
}
# define YY_LOCATION_PRINT(File, Loc) \
yy_location_print_ (File, &(Loc))
# else
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
# endif
#endif
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
do { \
if (yydebug) \
{ \
YYFPRINTF (stderr, "%s ", Title); \
yy_symbol_print (stderr, \
Type, Value, Location, _p); \
YYFPRINTF (stderr, "\n"); \
} \
} while (0)
/*----------------------------------------.
| Print this symbol's value on YYOUTPUT. |
`----------------------------------------*/
static void
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, HPHP::HPHP_PARSER_NS::Parser *_p)
{
FILE *yyo = yyoutput;
YYUSE (yyo);
YYUSE (yylocationp);
YYUSE (_p);
if (!yyvaluep)
return;
# ifdef YYPRINT
if (yytype < YYNTOKENS)
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
# endif
YYUSE (yytype);
}
/*--------------------------------.
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
static void
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, HPHP::HPHP_PARSER_NS::Parser *_p)
{
YYFPRINTF (yyoutput, "%s %s (",
yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
YY_LOCATION_PRINT (yyoutput, *yylocationp);
YYFPRINTF (yyoutput, ": ");
yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, _p);
YYFPRINTF (yyoutput, ")");
}
/*------------------------------------------------------------------.
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
| TOP (included). |
`------------------------------------------------------------------*/
static void
yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
{
YYFPRINTF (stderr, "Stack now");
for (; yybottom <= yytop; yybottom++)
{
int yybot = *yybottom;
YYFPRINTF (stderr, " %d", yybot);
}
YYFPRINTF (stderr, "\n");
}
# define YY_STACK_PRINT(Bottom, Top) \
do { \
if (yydebug) \
yy_stack_print ((Bottom), (Top)); \
} while (0)
/*------------------------------------------------.
| Report that the YYRULE is going to be reduced. |
`------------------------------------------------*/
static void
yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, HPHP::HPHP_PARSER_NS::Parser *_p)
{
unsigned long int yylno = yyrline[yyrule];
int yynrhs = yyr2[yyrule];
int yyi;
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
yyrule - 1, yylno);
/* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++)
{
YYFPRINTF (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr,
yystos[yyssp[yyi + 1 - yynrhs]],
&(yyvsp[(yyi + 1) - (yynrhs)])
, &(yylsp[(yyi + 1) - (yynrhs)]) , _p);
YYFPRINTF (stderr, "\n");
}
}
# define YY_REDUCE_PRINT(Rule) \
do { \
if (yydebug) \
yy_reduce_print (yyssp, yyvsp, yylsp, Rule, _p); \
} while (0)
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
int yydebug;
#else /* !YYDEBUG */
# define YYDPRINTF(Args)
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
# define YY_STACK_PRINT(Bottom, Top)
# define YY_REDUCE_PRINT(Rule)
#endif /* !YYDEBUG */
/* YYINITDEPTH -- initial size of the parser's stacks. */
#ifndef YYINITDEPTH
# define YYINITDEPTH 200
#endif
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
if the built-in stack extension method is used).
Do not make this value too large; the results are undefined if
YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
evaluated with infinite-precision integer arithmetic. */
#ifndef YYMAXDEPTH
# define YYMAXDEPTH 10000
#endif
#if YYERROR_VERBOSE
# ifndef yystrlen
# if defined __GLIBC__ && defined _STRING_H
# define yystrlen strlen
# else
/* Return the length of YYSTR. */
static YYSIZE_T
yystrlen (const char *yystr)
{
YYSIZE_T yylen;
for (yylen = 0; yystr[yylen]; yylen++)
continue;
return yylen;
}
# endif
# endif
# ifndef yystpcpy
# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
# define yystpcpy stpcpy
# else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
YYDEST. */
static char *
yystpcpy (char *yydest, const char *yysrc)
{
char *yyd = yydest;
const char *yys = yysrc;
while ((*yyd++ = *yys++) != '\0')
continue;
return yyd - 1;
}
# endif
# endif
# ifndef yytnamerr
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
quotes and backslashes, so that it's suitable for yyerror. The
heuristic is that double-quoting is unnecessary unless the string
contains an apostrophe, a comma, or backslash (other than
backslash-backslash). YYSTR is taken from yytname. If YYRES is
null, do not copy; instead, return the length of what the result
would have been. */
static YYSIZE_T
yytnamerr (char *yyres, const char *yystr)
{
if (*yystr == '"')
{
YYSIZE_T yyn = 0;
char const *yyp = yystr;
for (;;)
switch (*++yyp)
{
case '\'':
case ',':
goto do_not_strip_quotes;
case '\\':
if (*++yyp != '\\')
goto do_not_strip_quotes;
/* Fall through. */
default:
if (yyres)
yyres[yyn] = *yyp;
yyn++;
break;
case '"':
if (yyres)
yyres[yyn] = '\0';
return yyn;
}
do_not_strip_quotes: ;
}
if (! yyres)
return yystrlen (yystr);
return yystpcpy (yyres, yystr) - yyres;
}
# endif
/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
about the unexpected token YYTOKEN for the state stack whose top is
YYSSP.
Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
not large enough to hold the message. In that case, also set
*YYMSG_ALLOC to the required number of bytes. Return 2 if the
required number of bytes is too large to store. */
static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yytype_int16 *yyssp, int yytoken)
{
YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
const char *yyformat = YY_NULLPTR;
/* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per
"expected"). */
int yycount = 0;
/* There are many possibilities here to consider:
- If this state is a consistent state with a default action, then
the only way this function was invoked is if the default action
is an error action. In that case, don't check for expected
tokens because there are none.
- The only way there can be no lookahead present (in yychar) is if
this state is a consistent state with a default action. Thus,
detecting the absence of a lookahead is sufficient to determine
that there is no unexpected or expected token to report. In that
case, just report a simple "syntax error".
- Don't assume there isn't a lookahead just because this state is a
consistent state with a default action. There might have been a
previous inconsistent state, consistent state with a non-default
action, or user semantic action that manipulated yychar.
- Of course, the expected token list depends on states to have
correct lookahead information, and it depends on the parser not
to perform extra reductions after fetching a lookahead from the
scanner and before detecting a syntax error. Thus, state merging
(from LALR or IELR) and default reductions corrupt the expected
token list. However, the list is correct for canonical LR with
one exception: it will still contain any token that will not be
accepted due to an error action in a later state.
*/
if (yytoken != YYEMPTY)
{
int yyn = yypact[*yyssp];
yyarg[yycount++] = yytname[yytoken];
if (!yypact_value_is_default (yyn))
{
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. In other words, skip the first -YYN actions for
this state because they are default actions. */
int yyxbegin = yyn < 0 ? -yyn : 0;
/* Stay within bounds of both yycheck and yytname. */
int yychecklim = YYLAST - yyn + 1;
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
int yyx;
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
&& !yytable_value_is_error (yytable[yyx + yyn]))
{
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
{
yycount = 1;
yysize = yysize0;
break;
}
yyarg[yycount++] = yytname[yyx];
{
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
if (! (yysize <= yysize1
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
}
}
}
}
switch (yycount)
{
# define YYCASE_(N, S) \
case N: \
yyformat = S; \
break
YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
# undef YYCASE_
}
{
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
}
if (*yymsg_alloc < yysize)
{
*yymsg_alloc = 2 * yysize;
if (! (yysize <= *yymsg_alloc
&& *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
*yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
return 1;
}
/* Avoid sprintf, as that infringes on the user's name space.
Don't have undefined behavior even if the translation
produced a string with the wrong number of "%s"s. */
{
char *yyp = *yymsg;
int yyi = 0;
while ((*yyp = *yyformat) != '\0')
if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
{
yyp += yytnamerr (yyp, yyarg[yyi++]);
yyformat += 2;
}
else
{
yyp++;
yyformat++;
}
}
return 0;
}
#endif /* YYERROR_VERBOSE */
/*-----------------------------------------------.
| Release the memory associated to this symbol. |
`-----------------------------------------------*/
static void
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, HPHP::HPHP_PARSER_NS::Parser *_p)
{
YYUSE (yyvaluep);
YYUSE (yylocationp);
YYUSE (_p);
if (!yymsg)
yymsg = "Deleting";
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
YYUSE (yytype);
YY_IGNORE_MAYBE_UNINITIALIZED_END
}
/*----------.
| yyparse. |
`----------*/
int
yyparse (HPHP::HPHP_PARSER_NS::Parser *_p)
{
/* The lookahead symbol. */
int yychar;
/* The semantic value of the lookahead symbol. */
/* Default value used for initialization, for pacifying older GCCs
or non-GCC compilers. */
YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
/* Location data for the lookahead symbol. */
static YYLTYPE yyloc_default
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
= { 1, 1, 1, 1 }
# endif
;
YYLTYPE yylloc = yyloc_default;
/* Number of syntax errors so far. */
int yynerrs;
int yystate;
/* Number of tokens to shift before error messages enabled. */
int yyerrstatus;
/* The stacks and their tools:
'yyss': related to states.
'yyvs': related to semantic values.
'yyls': related to locations.
Refer to the stacks through separate pointers, to allow yyoverflow
to reallocate them elsewhere. */
/* The state stack. */
yytype_int16 yyssa[YYINITDEPTH];
yytype_int16 *yyss;
yytype_int16 *yyssp;
/* The semantic value stack. */
YYSTYPE yyvsa[YYINITDEPTH];
YYSTYPE *yyvs;
YYSTYPE *yyvsp;
/* The location stack. */
YYLTYPE yylsa[YYINITDEPTH];
YYLTYPE *yyls;
YYLTYPE *yylsp;
/* The locations where the error started and ended. */
YYLTYPE yyerror_range[3];
YYSIZE_T yystacksize;
int yyn;
int yyresult;
/* Lookahead token as an internal (translated) token number. */
int yytoken = 0;
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;
YYLTYPE yyloc;
#if YYERROR_VERBOSE
/* Buffer for error messages, and its allocated size. */
char yymsgbuf[128];
char *yymsg = yymsgbuf;
YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
#endif
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
/* The number of symbols on the RHS of the reduced rule.
Keep to zero when no symbol should be popped. */
int yylen = 0;
yyssp = yyss = yyssa;
yyvsp = yyvs = yyvsa;
yylsp = yyls = yylsa;
yystacksize = YYINITDEPTH;
YYDPRINTF ((stderr, "Starting parse\n"));
yystate = 0;
yyerrstatus = 0;
yynerrs = 0;
yychar = YYEMPTY; /* Cause a token to be read. */
yylsp[0] = yylloc;
goto yysetstate;
/*------------------------------------------------------------.
| yynewstate -- Push a new state, which is found in yystate. |
`------------------------------------------------------------*/
yynewstate:
/* In all cases, when you get here, the value and location stacks
have just been pushed. So pushing a state here evens the stacks. */
yyssp++;
yysetstate:
*yyssp = yystate;
if (yyss + yystacksize - 1 <= yyssp)
{
/* Get the current used size of the three stacks, in elements. */
YYSIZE_T yysize = yyssp - yyss + 1;
#ifdef yyoverflow
{
/* Give user a chance to reallocate the stack. Use copies of
these so that the &'s don't force the real ones into
memory. */
YYSTYPE *yyvs1 = yyvs;
yytype_int16 *yyss1 = yyss;
YYLTYPE *yyls1 = yyls;
/* Each stack pointer address is followed by the size of the
data in use in that stack, in bytes. This used to be a
conditional around just the two extra args, but that might
be undefined if yyoverflow is a macro. */
yyoverflow (YY_("memory exhausted"),
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
&yyls1, yysize * sizeof (*yylsp),
&yystacksize);
yyls = yyls1;
yyss = yyss1;
yyvs = yyvs1;
}
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
goto yyexhaustedlab;
# else
/* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize)
goto yyexhaustedlab;
yystacksize *= 2;
if (YYMAXDEPTH < yystacksize)
yystacksize = YYMAXDEPTH;
{
yytype_int16 *yyss1 = yyss;
struct yyalloc *yyptr =
(struct yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
memset(yyptr, 0, YYSTACK_BYTES (yystacksize));
if (! yyptr)
goto yyexhaustedlab;
YYSTACK_RELOCATE (yyss_alloc, yyss);
YYSTACK_RELOCATE_RESET (yyvs_alloc, yyvs);
YYSTACK_RELOCATE (yyls_alloc, yyls);
# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
}
# endif
#endif /* no yyoverflow */
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
yylsp = yyls + yysize - 1;
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
(unsigned long int) yystacksize));
if (yyss + yystacksize - 1 <= yyssp)
YYABORT;
}
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
if (yystate == YYFINAL)
YYACCEPT;
goto yybackup;
/*-----------.
| yybackup. |
`-----------*/
yybackup:
/* Do appropriate processing given the current state. Read a
lookahead token if we need one and don't already have one. */
/* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate];
if (yypact_value_is_default (yyn))
goto yydefault;
/* Not known => get a lookahead token if don't already have one. */
/* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
yychar = yylex (&yylval, &yylloc, _p);
}
if (yychar <= YYEOF)
{
yychar = yytoken = YYEOF;
YYDPRINTF ((stderr, "Now at end of input.\n"));
}
else
{
yytoken = YYTRANSLATE (yychar);
YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
}
/* If the proper action on seeing token YYTOKEN is to reduce or to
detect an error, take that action. */
yyn += yytoken;
if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
goto yydefault;
yyn = yytable[yyn];
if (yyn <= 0)
{
if (yytable_value_is_error (yyn))
goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
/* Count tokens shifted since error; after three, turn off error
status. */
if (yyerrstatus)
yyerrstatus--;
/* Shift the lookahead token. */
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
/* Discard the shifted token. */
yychar = YYEMPTY;
yystate = yyn;
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
YY_IGNORE_MAYBE_UNINITIALIZED_END
*++yylsp = yylloc;
goto yynewstate;
/*-----------------------------------------------------------.
| yydefault -- do the default action for the current state. |
`-----------------------------------------------------------*/
yydefault:
yyn = yydefact[yystate];
if (yyn == 0)
goto yyerrlab;
goto yyreduce;
/*-----------------------------.
| yyreduce -- Do a reduction. |
`-----------------------------*/
yyreduce:
/* yyn is the number of a rule to reduce with. */
yylen = yyr2[yyn];
/* If YYLEN is nonzero, implement the default value of the action:
'$$ = $1'.
Otherwise, the following line sets YYVAL to garbage.
This behavior is undocumented and Bison
users should not rely upon it. Assigning to YYVAL
unconditionally makes the parser a bit smaller, and it avoids a
GCC warning that YYVAL may be used uninitialized. */
yyval = yyvsp[1-yylen];
/* Default location. */
YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
YY_REDUCE_PRINT (yyn);
switch (yyn)
{
case 2:
#line 760 "hphp.y" /* yacc.c:1646 */
{ _p->onNewLabelScope(true);
_p->initParseTree();}
#line 7384 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 3:
#line 763 "hphp.y" /* yacc.c:1646 */
{ _p->popLabelInfo();
_p->finiParseTree();
_p->onCompleteLabelScope(true);}
#line 7392 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 4:
#line 770 "hphp.y" /* yacc.c:1646 */
{ _p->addTopStatement((yyvsp[0]));}
#line 7398 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 5:
#line 771 "hphp.y" /* yacc.c:1646 */
{ }
#line 7404 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 6:
#line 774 "hphp.y" /* yacc.c:1646 */
{ _p->nns((yyvsp[0]).num(), (yyvsp[0]).text()); (yyval) = (yyvsp[0]);}
#line 7410 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 7:
#line 775 "hphp.y" /* yacc.c:1646 */
{ _p->nns(); (yyval) = (yyvsp[0]);}
#line 7416 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 8:
#line 776 "hphp.y" /* yacc.c:1646 */
{ _p->nns(); (yyval) = (yyvsp[0]);}
#line 7422 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 9:
#line 777 "hphp.y" /* yacc.c:1646 */
{ _p->nns(); (yyval) = (yyvsp[0]);}
#line 7428 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 10:
#line 778 "hphp.y" /* yacc.c:1646 */
{ _p->nns(); (yyval) = (yyvsp[0]);}
#line 7434 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 11:
#line 779 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
#line 7440 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 12:
#line 780 "hphp.y" /* yacc.c:1646 */
{ _p->onHaltCompiler();
_p->finiParseTree();
YYACCEPT;}
#line 7448 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 13:
#line 783 "hphp.y" /* yacc.c:1646 */
{ _p->onNamespaceStart((yyvsp[-1]).text(), true);
(yyval).reset();}
#line 7455 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 14:
#line 785 "hphp.y" /* yacc.c:1646 */
{ _p->onNamespaceStart((yyvsp[-1]).text());}
#line 7461 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 15:
#line 786 "hphp.y" /* yacc.c:1646 */
{ _p->onNamespaceEnd(); (yyval) = (yyvsp[-1]);}
#line 7467 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 16:
#line 787 "hphp.y" /* yacc.c:1646 */
{ _p->onNamespaceStart("");}
#line 7473 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 17:
#line 788 "hphp.y" /* yacc.c:1646 */
{ _p->onNamespaceEnd(); (yyval) = (yyvsp[-1]);}
#line 7479 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 18:
#line 789 "hphp.y" /* yacc.c:1646 */
{ _p->onUse((yyvsp[-1]),
&Parser::useClassAndNamespace);
_p->nns(T_USE); (yyval).reset();}
#line 7487 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 19:
#line 793 "hphp.y" /* yacc.c:1646 */
{
only_in_hh_syntax(_p);
_p->onUse((yyvsp[-1]), &Parser::useNamespace);
_p->nns(T_USE); (yyval).reset();}
#line 7496 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 20:
#line 798 "hphp.y" /* yacc.c:1646 */
{
only_in_hh_syntax(_p);
_p->onUse((yyvsp[-1]), &Parser::useClass);
_p->nns(T_USE); (yyval).reset();}
#line 7505 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 21:
#line 803 "hphp.y" /* yacc.c:1646 */
{ _p->onUse((yyvsp[-1]), &Parser::useFunction);
_p->nns(T_USE); (yyval).reset();}
#line 7512 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 22:
#line 806 "hphp.y" /* yacc.c:1646 */
{ _p->onUse((yyvsp[-1]), &Parser::useConst);
_p->nns(T_USE); (yyval).reset();}
#line 7519 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 23:
#line 809 "hphp.y" /* yacc.c:1646 */
{ _p->onGroupUse((yyvsp[-4]).text(), (yyvsp[-2]),
nullptr);
_p->nns(T_USE); (yyval).reset();}
#line 7527 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 24:
#line 813 "hphp.y" /* yacc.c:1646 */
{ _p->onGroupUse((yyvsp[-4]).text(), (yyvsp[-2]),
&Parser::useFunction);
_p->nns(T_USE); (yyval).reset();}
#line 7535 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 25:
#line 817 "hphp.y" /* yacc.c:1646 */
{ _p->onGroupUse((yyvsp[-4]).text(), (yyvsp[-2]),
&Parser::useConst);
_p->nns(T_USE); (yyval).reset();}
#line 7543 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 26:
#line 821 "hphp.y" /* yacc.c:1646 */
{ _p->onGroupUse((yyvsp[-4]).text(), (yyvsp[-2]),
&Parser::useNamespace);
_p->nns(T_USE); (yyval).reset();}
#line 7551 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 27:
#line 825 "hphp.y" /* yacc.c:1646 */
{ _p->onGroupUse((yyvsp[-4]).text(), (yyvsp[-2]),
&Parser::useClass);
_p->nns(T_USE); (yyval).reset();}
#line 7559 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 28:
#line 828 "hphp.y" /* yacc.c:1646 */
{ _p->nns();
_p->finishStatement((yyval), (yyvsp[-1])); (yyval) = 1;}
#line 7566 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 29:
#line 833 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 7572 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 30:
#line 834 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 7578 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 31:
#line 835 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 7584 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 32:
#line 836 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 7590 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 33:
#line 837 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 7596 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 34:
#line 838 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 7602 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 35:
#line 839 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 7608 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 36:
#line 840 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 7614 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 37:
#line 841 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 7620 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 38:
#line 842 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 7626 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 39:
#line 843 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 7632 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 40:
#line 844 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 7638 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 41:
#line 845 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 7644 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 111:
#line 927 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 7650 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 112:
#line 929 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 7656 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 113:
#line 934 "hphp.y" /* yacc.c:1646 */
{ _p->addStatement((yyval),(yyvsp[-2]),(yyvsp[0]));}
#line 7662 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 114:
#line 935 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();
_p->addStatement((yyval),(yyval),(yyvsp[0]));}
#line 7669 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 115:
#line 941 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 7675 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 116:
#line 945 "hphp.y" /* yacc.c:1646 */
{ _p->onUseDeclaration((yyval), (yyvsp[0]).text(),"");}
#line 7681 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 117:
#line 946 "hphp.y" /* yacc.c:1646 */
{ _p->onUseDeclaration((yyval), (yyvsp[0]).text(),"");}
#line 7687 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 118:
#line 948 "hphp.y" /* yacc.c:1646 */
{ _p->onUseDeclaration((yyval), (yyvsp[-2]).text(),(yyvsp[0]).text());}
#line 7693 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 119:
#line 950 "hphp.y" /* yacc.c:1646 */
{ _p->onUseDeclaration((yyval), (yyvsp[-2]).text(),(yyvsp[0]).text());}
#line 7699 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 120:
#line 955 "hphp.y" /* yacc.c:1646 */
{ _p->addStatement((yyval),(yyvsp[-2]),(yyvsp[0]));}
#line 7705 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 121:
#line 956 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();
_p->addStatement((yyval),(yyval),(yyvsp[0]));}
#line 7712 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 122:
#line 962 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 7718 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 123:
#line 966 "hphp.y" /* yacc.c:1646 */
{ _p->onMixedUseDeclaration((yyval), (yyvsp[0]),
&Parser::useClassAndNamespace);}
#line 7725 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 124:
#line 968 "hphp.y" /* yacc.c:1646 */
{ _p->onMixedUseDeclaration((yyval), (yyvsp[0]),
&Parser::useFunction);}
#line 7732 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 125:
#line 970 "hphp.y" /* yacc.c:1646 */
{ _p->onMixedUseDeclaration((yyval), (yyvsp[0]),
&Parser::useConst);}
#line 7739 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 126:
#line 975 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 7745 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 127:
#line 977 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-2]) + (yyvsp[-1]) + (yyvsp[0]); (yyval) = (yyvsp[-2]).num() | 2;}
#line 7751 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 128:
#line 980 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); (yyval) = (yyval).num() | 1;}
#line 7757 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 129:
#line 982 "hphp.y" /* yacc.c:1646 */
{ (yyval).set((yyvsp[0]).num() | 2, _p->nsDecl((yyvsp[0]).text()));}
#line 7763 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 130:
#line 983 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); (yyval) = (yyval).num() | 2;}
#line 7769 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 131:
#line 988 "hphp.y" /* yacc.c:1646 */
{ if ((yyvsp[-1]).num() & 1) {
(yyvsp[-1]).setText(_p->resolve((yyvsp[-1]).text(),0));
}
(yyval) = (yyvsp[-1]);}
#line 7778 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 132:
#line 995 "hphp.y" /* yacc.c:1646 */
{ if ((yyvsp[-1]).num() & 1) {
(yyvsp[-1]).setText(_p->resolve((yyvsp[-1]).text(),1));
}
_p->onTypeAnnotation((yyval), (yyvsp[-1]), (yyvsp[0]));}
#line 7787 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 133:
#line 1003 "hphp.y" /* yacc.c:1646 */
{ (yyvsp[-2]).setText(_p->nsDecl((yyvsp[-2]).text()));
_p->onConst((yyval),(yyvsp[-2]),(yyvsp[0]));}
#line 7794 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 134:
#line 1006 "hphp.y" /* yacc.c:1646 */
{ (yyvsp[-2]).setText(_p->nsDecl((yyvsp[-2]).text()));
_p->onConst((yyval),(yyvsp[-2]),(yyvsp[0]));}
#line 7801 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 135:
#line 1012 "hphp.y" /* yacc.c:1646 */
{ _p->addStatement((yyval),(yyvsp[-1]),(yyvsp[0])); }
#line 7807 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 136:
#line 1013 "hphp.y" /* yacc.c:1646 */
{ _p->onStatementListStart((yyval)); }
#line 7813 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 138:
#line 1018 "hphp.y" /* yacc.c:1646 */
{
_p->onUsing((yyval), (yyvsp[-2]), true, (yyvsp[-1]), nullptr);
}
#line 7821 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 139:
#line 1025 "hphp.y" /* yacc.c:1646 */
{ _p->addStatement((yyval),(yyvsp[-1]),(yyvsp[0]));}
#line 7827 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 140:
#line 1026 "hphp.y" /* yacc.c:1646 */
{ _p->onStatementListStart((yyval));}
#line 7833 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 141:
#line 1031 "hphp.y" /* yacc.c:1646 */
{ _p->addStatement((yyval), (yyvsp[-1]), (yyvsp[0])); }
#line 7839 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 142:
#line 1032 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();
_p->addStatement((yyval), (yyval), (yyvsp[0])); }
#line 7846 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 143:
#line 1037 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 7852 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 144:
#line 1038 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 7858 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 145:
#line 1039 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 7864 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 146:
#line 1040 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 7870 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 147:
#line 1043 "hphp.y" /* yacc.c:1646 */
{ _p->onBlock((yyval), (yyvsp[-1]));}
#line 7876 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 148:
#line 1047 "hphp.y" /* yacc.c:1646 */
{ _p->onIf((yyval),(yyvsp[-3]),(yyvsp[-2]),(yyvsp[-1]),(yyvsp[0]));}
#line 7882 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 149:
#line 1052 "hphp.y" /* yacc.c:1646 */
{ _p->onIf((yyval),(yyvsp[-6]),(yyvsp[-4]),(yyvsp[-3]),(yyvsp[-2]));}
#line 7888 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 150:
#line 1053 "hphp.y" /* yacc.c:1646 */
{ _p->onNewLabelScope(false);
_p->pushLabelScope(LS::LoopSwitch);}
#line 7895 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 151:
#line 1055 "hphp.y" /* yacc.c:1646 */
{ _p->popLabelScope();
_p->onWhile((yyval),(yyvsp[-2]),(yyvsp[0]));
_p->onCompleteLabelScope(false);}
#line 7903 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 152:
#line 1059 "hphp.y" /* yacc.c:1646 */
{ _p->onNewLabelScope(false);
_p->pushLabelScope(LS::LoopSwitch);}
#line 7910 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 153:
#line 1062 "hphp.y" /* yacc.c:1646 */
{ _p->popLabelScope();
_p->onDo((yyval),(yyvsp[-3]),(yyvsp[-1]));
_p->onCompleteLabelScope(false);}
#line 7918 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 154:
#line 1066 "hphp.y" /* yacc.c:1646 */
{ _p->onNewLabelScope(false);
_p->pushLabelScope(LS::LoopSwitch);}
#line 7925 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 155:
#line 1068 "hphp.y" /* yacc.c:1646 */
{ _p->popLabelScope();
_p->onFor((yyval),(yyvsp[-7]),(yyvsp[-5]),(yyvsp[-3]),(yyvsp[0]));
_p->onCompleteLabelScope(false);}
#line 7933 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 156:
#line 1071 "hphp.y" /* yacc.c:1646 */
{ _p->onNewLabelScope(false);
_p->pushLabelScope(LS::LoopSwitch);}
#line 7940 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 157:
#line 1073 "hphp.y" /* yacc.c:1646 */
{ _p->popLabelScope();
_p->onSwitch((yyval),(yyvsp[-2]),(yyvsp[0]));
_p->onCompleteLabelScope(false);}
#line 7948 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 158:
#line 1076 "hphp.y" /* yacc.c:1646 */
{ _p->onBreakContinue((yyval), true, NULL);}
#line 7954 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 159:
#line 1077 "hphp.y" /* yacc.c:1646 */
{ _p->onBreakContinue((yyval), true, &(yyvsp[-1]));}
#line 7960 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 160:
#line 1078 "hphp.y" /* yacc.c:1646 */
{ _p->onBreakContinue((yyval), false, NULL);}
#line 7966 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 161:
#line 1079 "hphp.y" /* yacc.c:1646 */
{ _p->onBreakContinue((yyval), false, &(yyvsp[-1]));}
#line 7972 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 162:
#line 1080 "hphp.y" /* yacc.c:1646 */
{ _p->onReturn((yyval), NULL);}
#line 7978 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 163:
#line 1081 "hphp.y" /* yacc.c:1646 */
{ _p->onReturn((yyval), &(yyvsp[-1]));}
#line 7984 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 164:
#line 1082 "hphp.y" /* yacc.c:1646 */
{ _p->onYieldBreak((yyval));}
#line 7990 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 165:
#line 1083 "hphp.y" /* yacc.c:1646 */
{ _p->onGlobal((yyval), (yyvsp[-1]));}
#line 7996 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 166:
#line 1084 "hphp.y" /* yacc.c:1646 */
{ _p->onStatic((yyval), (yyvsp[-1]));}
#line 8002 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 167:
#line 1085 "hphp.y" /* yacc.c:1646 */
{ _p->onEcho((yyval), (yyvsp[-1]), 0);}
#line 8008 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 168:
#line 1086 "hphp.y" /* yacc.c:1646 */
{ _p->onEcho((yyval), (yyvsp[-1]), 0);}
#line 8014 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 169:
#line 1087 "hphp.y" /* yacc.c:1646 */
{ _p->onUnset((yyval), (yyvsp[-2]));}
#line 8020 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 170:
#line 1088 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset(); (yyval) = ';';}
#line 8026 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 171:
#line 1089 "hphp.y" /* yacc.c:1646 */
{ _p->onEcho((yyval), (yyvsp[0]), 1);}
#line 8032 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 172:
#line 1090 "hphp.y" /* yacc.c:1646 */
{ _p->onHashBang((yyval), (yyvsp[0]));
(yyval) = T_HASHBANG;}
#line 8039 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 173:
#line 1094 "hphp.y" /* yacc.c:1646 */
{ _p->onNewLabelScope(false);
_p->pushLabelScope(LS::LoopSwitch);}
#line 8046 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 174:
#line 1096 "hphp.y" /* yacc.c:1646 */
{ _p->popLabelScope();
_p->onForEach((yyval),(yyvsp[-6]),(yyvsp[-4]),(yyvsp[-3]),(yyvsp[0]), false);
_p->onCompleteLabelScope(false);}
#line 8054 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 175:
#line 1101 "hphp.y" /* yacc.c:1646 */
{ _p->onNewLabelScope(false);
_p->pushLabelScope(LS::LoopSwitch);}
#line 8061 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 176:
#line 1103 "hphp.y" /* yacc.c:1646 */
{ _p->popLabelScope();
_p->onForEach((yyval),(yyvsp[-7]),(yyvsp[-4]),(yyvsp[-3]),(yyvsp[0]), true);
_p->onCompleteLabelScope(false);}
#line 8069 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 177:
#line 1107 "hphp.y" /* yacc.c:1646 */
{ _p->onDeclare((yyvsp[-2]), (yyvsp[0]));
(yyval) = (yyvsp[-2]);
(yyval) = T_DECLARE;}
#line 8077 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 178:
#line 1116 "hphp.y" /* yacc.c:1646 */
{ _p->onCompleteLabelScope(false);}
#line 8083 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 179:
#line 1117 "hphp.y" /* yacc.c:1646 */
{ _p->onTry((yyval),(yyvsp[-11]),(yyvsp[-8]),(yyvsp[-7]),(yyvsp[-4]),(yyvsp[-2]),(yyvsp[0]));}
#line 8089 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 180:
#line 1120 "hphp.y" /* yacc.c:1646 */
{ _p->onCompleteLabelScope(false); }
#line 8095 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 181:
#line 1121 "hphp.y" /* yacc.c:1646 */
{ _p->onTry((yyval), (yyvsp[-3]), (yyvsp[0]));}
#line 8101 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 182:
#line 1123 "hphp.y" /* yacc.c:1646 */
{ _p->onUsing((yyval), (yyvsp[-2]), false, (yyvsp[-1]), &(yyvsp[0]));
_p->onCompleteLabelScope(false);
_p->popLabelScope(); }
#line 8109 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 183:
#line 1127 "hphp.y" /* yacc.c:1646 */
{ _p->onUsing((yyval), (yyvsp[-2]), false, (yyvsp[-1]), &(yyvsp[0]));
_p->onCompleteLabelScope(false);
_p->popLabelScope(); }
#line 8117 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 184:
#line 1131 "hphp.y" /* yacc.c:1646 */
{ _p->onUsing((yyval), (yyvsp[-2]), false, (yyvsp[-1]), &(yyvsp[0]));
_p->onCompleteLabelScope(false);
_p->popLabelScope(); }
#line 8125 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 185:
#line 1135 "hphp.y" /* yacc.c:1646 */
{ _p->onUsing((yyval), (yyvsp[-2]), false, (yyvsp[-1]), &(yyvsp[0]));
_p->onCompleteLabelScope(false);
_p->popLabelScope(); }
#line 8133 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 186:
#line 1139 "hphp.y" /* yacc.c:1646 */
{ _p->onUsing((yyval), (yyvsp[-4]), false, (yyvsp[-2]), &(yyvsp[0]));
_p->onCompleteLabelScope(false);
_p->popLabelScope(); }
#line 8141 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 187:
#line 1143 "hphp.y" /* yacc.c:1646 */
{ _p->onUsing((yyval), (yyvsp[-4]), false, (yyvsp[-2]), &(yyvsp[0]));
_p->onCompleteLabelScope(false);
_p->popLabelScope(); }
#line 8149 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 188:
#line 1148 "hphp.y" /* yacc.c:1646 */
{ _p->onUsing((yyval), (yyvsp[-4]), false, (yyvsp[-2]), &(yyvsp[0]));
_p->onCompleteLabelScope(false);
_p->popLabelScope(); }
#line 8157 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 189:
#line 1151 "hphp.y" /* yacc.c:1646 */
{ _p->onThrow((yyval), (yyvsp[-1]));}
#line 8163 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 190:
#line 1152 "hphp.y" /* yacc.c:1646 */
{ _p->onGoto((yyval), (yyvsp[-1]), true);
_p->addGoto((yyvsp[-1]).text(),
_p->getRange(),
&(yyval));}
#line 8172 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 191:
#line 1156 "hphp.y" /* yacc.c:1646 */
{ _p->onExpStatement((yyval), (yyvsp[-1]));}
#line 8178 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 192:
#line 1157 "hphp.y" /* yacc.c:1646 */
{ _p->onExpStatement((yyval), (yyvsp[-1]));}
#line 8184 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 193:
#line 1158 "hphp.y" /* yacc.c:1646 */
{ _p->onExpStatement((yyval), (yyvsp[-1]));}
#line 8190 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 194:
#line 1159 "hphp.y" /* yacc.c:1646 */
{ _p->onExpStatement((yyval), (yyvsp[-1]));}
#line 8196 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 195:
#line 1160 "hphp.y" /* yacc.c:1646 */
{ _p->onExpStatement((yyval), (yyvsp[-1]));}
#line 8202 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 196:
#line 1161 "hphp.y" /* yacc.c:1646 */
{ _p->onExpStatement((yyval), (yyvsp[-1]));}
#line 8208 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 197:
#line 1162 "hphp.y" /* yacc.c:1646 */
{ _p->onReturn((yyval), &(yyvsp[-1]));}
#line 8214 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 198:
#line 1163 "hphp.y" /* yacc.c:1646 */
{ _p->onExpStatement((yyval), (yyvsp[-1]));}
#line 8220 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 199:
#line 1164 "hphp.y" /* yacc.c:1646 */
{ _p->onExpStatement((yyval), (yyvsp[-1]));}
#line 8226 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 200:
#line 1165 "hphp.y" /* yacc.c:1646 */
{ _p->onReturn((yyval), &(yyvsp[-1])); }
#line 8232 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 201:
#line 1166 "hphp.y" /* yacc.c:1646 */
{ _p->onExpStatement((yyval), (yyvsp[-1]));}
#line 8238 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 202:
#line 1167 "hphp.y" /* yacc.c:1646 */
{ _p->onLabel((yyval), (yyvsp[-1]));
_p->addLabel((yyvsp[-1]).text(),
_p->getRange(),
&(yyval));
_p->onScopeLabel((yyval), (yyvsp[-1]));}
#line 8248 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 203:
#line 1189 "hphp.y" /* yacc.c:1646 */
{ _p->pushLabelScope(LS::Using);
_p->onNewLabelScope(false);
(yyval) = (yyvsp[-1]); }
#line 8256 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 204:
#line 1195 "hphp.y" /* yacc.c:1646 */
{ (yyval) = 1; }
#line 8262 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 205:
#line 1196 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset(); }
#line 8268 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 206:
#line 1205 "hphp.y" /* yacc.c:1646 */
{ _p->onExprListElem((yyval), nullptr, (yyvsp[-2]));
_p->onExprListElem((yyval), &(yyval), (yyvsp[0])); }
#line 8275 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 207:
#line 1207 "hphp.y" /* yacc.c:1646 */
{ _p->onExprListElem((yyval), &(yyvsp[-2]), (yyvsp[0])); }
#line 8281 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 211:
#line 1217 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
#line 8287 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 212:
#line 1218 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset(); }
#line 8293 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 213:
#line 1222 "hphp.y" /* yacc.c:1646 */
{ _p->onNewLabelScope(false); }
#line 8299 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 214:
#line 1223 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
#line 8305 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 215:
#line 1232 "hphp.y" /* yacc.c:1646 */
{ _p->onCatch((yyval), (yyvsp[-8]), (yyvsp[-5]), (yyvsp[-4]), (yyvsp[-1]));}
#line 8311 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 216:
#line 1233 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 8317 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 217:
#line 1237 "hphp.y" /* yacc.c:1646 */
{ _p->onNewLabelScope(false);
_p->pushLabelScope(LS::Finally);}
#line 8324 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 218:
#line 1239 "hphp.y" /* yacc.c:1646 */
{ _p->onFinally((yyval), (yyvsp[-1]));
_p->popLabelScope();
_p->onCompleteLabelScope(false);}
#line 8332 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 219:
#line 1245 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 8338 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 220:
#line 1246 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 8344 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 221:
#line 1250 "hphp.y" /* yacc.c:1646 */
{ (yyval) = 1;}
#line 8350 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 222:
#line 1251 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 8356 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 223:
#line 1255 "hphp.y" /* yacc.c:1646 */
{ _p->pushFuncLocation(); }
#line 8362 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 224:
#line 1261 "hphp.y" /* yacc.c:1646 */
{ (yyvsp[0]).setText(_p->nsDecl((yyvsp[0]).text()));
_p->onNewLabelScope(true);
_p->onFunctionStart((yyvsp[0]));
_p->pushLabelInfo();}
#line 8371 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 225:
#line 1268 "hphp.y" /* yacc.c:1646 */
{ _p->onFunction((yyval),nullptr,(yyvsp[-2]),(yyvsp[-8]),(yyvsp[-7]),(yyvsp[-4]),(yyvsp[0]),nullptr);
_p->closeActiveUsings();
_p->popLabelInfo();
_p->popTypeScope();
_p->onCompleteLabelScope(true);}
#line 8381 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 226:
#line 1276 "hphp.y" /* yacc.c:1646 */
{ (yyvsp[0]).setText(_p->nsDecl((yyvsp[0]).text()));
_p->onNewLabelScope(true);
_p->onFunctionStart((yyvsp[0]));
_p->pushLabelInfo();}
#line 8390 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 227:
#line 1283 "hphp.y" /* yacc.c:1646 */
{ _p->onFunction((yyval),&(yyvsp[-10]),(yyvsp[-2]),(yyvsp[-8]),(yyvsp[-7]),(yyvsp[-4]),(yyvsp[0]),nullptr);
_p->closeActiveUsings();
_p->popLabelInfo();
_p->popTypeScope();
_p->onCompleteLabelScope(true);}
#line 8400 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 228:
#line 1291 "hphp.y" /* yacc.c:1646 */
{ (yyvsp[0]).setText(_p->nsDecl((yyvsp[0]).text()));
_p->onNewLabelScope(true);
_p->onFunctionStart((yyvsp[0]));
_p->pushLabelInfo();}
#line 8409 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 229:
#line 1297 "hphp.y" /* yacc.c:1646 */
{ _p->onFunction((yyval),&(yyvsp[-9]),(yyvsp[-1]),(yyvsp[-7]),(yyvsp[-6]),(yyvsp[-3]),(yyvsp[0]),&(yyvsp[-10]));
_p->closeActiveUsings();
_p->popLabelInfo();
_p->popTypeScope();
_p->onCompleteLabelScope(true);}
#line 8419 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 230:
#line 1306 "hphp.y" /* yacc.c:1646 */
{ (yyvsp[0]).setText(_p->nsClassDecl((yyvsp[0]).text()));
_p->onClassStart(T_ENUM,(yyvsp[0]));}
#line 8426 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 231:
#line 1310 "hphp.y" /* yacc.c:1646 */
{ _p->onEnum((yyval),(yyvsp[-7]),(yyvsp[-4]),(yyvsp[-1]),0); }
#line 8432 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 232:
#line 1314 "hphp.y" /* yacc.c:1646 */
{ (yyvsp[0]).setText(_p->nsClassDecl((yyvsp[0]).text()));
_p->onClassStart(T_ENUM,(yyvsp[0]));}
#line 8439 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 233:
#line 1318 "hphp.y" /* yacc.c:1646 */
{ _p->onEnum((yyval),(yyvsp[-7]),(yyvsp[-4]),(yyvsp[-1]),&(yyvsp[-9])); }
#line 8445 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 234:
#line 1324 "hphp.y" /* yacc.c:1646 */
{ (yyvsp[0]).setText(_p->nsClassDecl((yyvsp[0]).text()));
_p->onClassStart((yyvsp[-1]).num(),(yyvsp[0]));}
#line 8452 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 235:
#line 1327 "hphp.y" /* yacc.c:1646 */
{ Token stmts;
if (_p->peekClass()) {
xhp_collect_attributes(_p,stmts,(yyvsp[-1]));
} else {
stmts = (yyvsp[-1]);
}
_p->onClass((yyval),(yyvsp[-7]).num(),(yyvsp[-6]),(yyvsp[-4]),(yyvsp[-3]),
stmts,0,nullptr);
if (_p->peekClass()) {
_p->xhpResetAttributes();
}
_p->popClass();
_p->popTypeScope();}
#line 8470 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 236:
#line 1342 "hphp.y" /* yacc.c:1646 */
{ (yyvsp[0]).setText(_p->nsClassDecl((yyvsp[0]).text()));
_p->onClassStart((yyvsp[-1]).num(),(yyvsp[0]));}
#line 8477 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 237:
#line 1345 "hphp.y" /* yacc.c:1646 */
{ Token stmts;
if (_p->peekClass()) {
xhp_collect_attributes(_p,stmts,(yyvsp[-1]));
} else {
stmts = (yyvsp[-1]);
}
_p->onClass((yyval),(yyvsp[-7]).num(),(yyvsp[-6]),(yyvsp[-4]),(yyvsp[-3]),
stmts,&(yyvsp[-8]),nullptr);
if (_p->peekClass()) {
_p->xhpResetAttributes();
}
_p->popClass();
_p->popTypeScope();}
#line 8495 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 238:
#line 1359 "hphp.y" /* yacc.c:1646 */
{ (yyvsp[0]).setText(_p->nsClassDecl((yyvsp[0]).text()));
_p->onClassStart(T_INTERFACE,(yyvsp[0]));}
#line 8502 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 239:
#line 1362 "hphp.y" /* yacc.c:1646 */
{ _p->onInterface((yyval),(yyvsp[-5]),(yyvsp[-3]),(yyvsp[-1]),0);
_p->popClass();
_p->popTypeScope();}
#line 8510 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 240:
#line 1367 "hphp.y" /* yacc.c:1646 */
{ (yyvsp[0]).setText(_p->nsClassDecl((yyvsp[0]).text()));
_p->onClassStart(T_INTERFACE,(yyvsp[0]));}
#line 8517 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 241:
#line 1370 "hphp.y" /* yacc.c:1646 */
{ _p->onInterface((yyval),(yyvsp[-5]),(yyvsp[-3]),(yyvsp[-1]),&(yyvsp[-7]));
_p->popClass();
_p->popTypeScope();}
#line 8525 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 242:
#line 1376 "hphp.y" /* yacc.c:1646 */
{ _p->onClassExpressionStart(); }
#line 8531 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 243:
#line 1379 "hphp.y" /* yacc.c:1646 */
{ _p->onClassExpression((yyval), (yyvsp[-5]), (yyvsp[-4]), (yyvsp[-3]), (yyvsp[-1])); }
#line 8537 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 244:
#line 1383 "hphp.y" /* yacc.c:1646 */
{ (yyvsp[0]).setText(_p->nsClassDecl((yyvsp[0]).text()));
_p->onClassStart(T_TRAIT, (yyvsp[0]));}
#line 8544 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 245:
#line 1386 "hphp.y" /* yacc.c:1646 */
{ Token t_ext;
t_ext.reset();
_p->onClass((yyval),T_TRAIT,(yyvsp[-5]),t_ext,(yyvsp[-3]),
(yyvsp[-1]), 0, nullptr);
_p->popClass();
_p->popTypeScope();}
#line 8555 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 246:
#line 1394 "hphp.y" /* yacc.c:1646 */
{ (yyvsp[0]).setText(_p->nsClassDecl((yyvsp[0]).text()));
_p->onClassStart(T_TRAIT, (yyvsp[0]));}
#line 8562 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 247:
#line 1397 "hphp.y" /* yacc.c:1646 */
{ Token t_ext;
t_ext.reset();
_p->onClass((yyval),T_TRAIT,(yyvsp[-5]),t_ext,(yyvsp[-3]),
(yyvsp[-1]), &(yyvsp[-7]), nullptr);
_p->popClass();
_p->popTypeScope();}
#line 8573 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 248:
#line 1405 "hphp.y" /* yacc.c:1646 */
{ _p->pushClass(false); (yyval) = (yyvsp[0]);}
#line 8579 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 249:
#line 1406 "hphp.y" /* yacc.c:1646 */
{ (yyvsp[0]).xhpLabel(); _p->pushTypeScope();
_p->pushClass(true); (yyval) = (yyvsp[0]);}
#line 8586 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 250:
#line 1410 "hphp.y" /* yacc.c:1646 */
{ _p->pushClass(false); (yyval) = (yyvsp[0]);}
#line 8592 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 251:
#line 1413 "hphp.y" /* yacc.c:1646 */
{ _p->pushClass(false); (yyval) = (yyvsp[0]);}
#line 8598 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 252:
#line 1416 "hphp.y" /* yacc.c:1646 */
{ (yyval) = T_CLASS;}
#line 8604 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 253:
#line 1417 "hphp.y" /* yacc.c:1646 */
{ (yyval) = T_ABSTRACT; }
#line 8610 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 254:
#line 1418 "hphp.y" /* yacc.c:1646 */
{ only_in_hh_syntax(_p);
/* hacky, but transforming to a single token is quite convenient */
(yyval) = T_STATIC; }
#line 8618 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 255:
#line 1421 "hphp.y" /* yacc.c:1646 */
{ only_in_hh_syntax(_p); (yyval) = T_STATIC; }
#line 8624 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 256:
#line 1422 "hphp.y" /* yacc.c:1646 */
{ (yyval) = T_FINAL;}
#line 8630 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 257:
#line 1426 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 8636 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 258:
#line 1427 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 8642 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 259:
#line 1430 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 8648 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 260:
#line 1431 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 8654 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 261:
#line 1434 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 8660 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 262:
#line 1435 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 8666 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 263:
#line 1438 "hphp.y" /* yacc.c:1646 */
{ _p->onInterfaceName((yyval), NULL, (yyvsp[0]));}
#line 8672 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 264:
#line 1440 "hphp.y" /* yacc.c:1646 */
{ _p->onInterfaceName((yyval), &(yyvsp[-2]), (yyvsp[0]));}
#line 8678 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 265:
#line 1443 "hphp.y" /* yacc.c:1646 */
{ _p->onTraitName((yyval), NULL, (yyvsp[0]));}
#line 8684 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 266:
#line 1445 "hphp.y" /* yacc.c:1646 */
{ _p->onTraitName((yyval), &(yyvsp[-2]), (yyvsp[0]));}
#line 8690 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 267:
#line 1449 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 8696 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 268:
#line 1450 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 8702 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 269:
#line 1453 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); (yyval) = 0;}
#line 8708 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 270:
#line 1454 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); (yyval) = 1;}
#line 8714 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 271:
#line 1455 "hphp.y" /* yacc.c:1646 */
{ _p->onListAssignment((yyval), (yyvsp[-1]), NULL);}
#line 8720 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 272:
#line 1459 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 8726 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 273:
#line 1461 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-2]);}
#line 8732 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 274:
#line 1464 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 8738 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 275:
#line 1466 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-2]);}
#line 8744 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 276:
#line 1469 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 8750 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 277:
#line 1471 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-2]);}
#line 8756 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 278:
#line 1474 "hphp.y" /* yacc.c:1646 */
{ _p->onBlock((yyval), (yyvsp[0]));}
#line 8762 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 279:
#line 1476 "hphp.y" /* yacc.c:1646 */
{ _p->onBlock((yyval), (yyvsp[-2]));}
#line 8768 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 280:
#line 1480 "hphp.y" /* yacc.c:1646 */
{_p->onDeclareList((yyval), (yyvsp[-2]), (yyvsp[0]));}
#line 8774 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 281:
#line 1482 "hphp.y" /* yacc.c:1646 */
{_p->onDeclareList((yyvsp[-4]), (yyvsp[-2]), (yyvsp[0]));
(yyval) = (yyvsp[-4]);}
#line 8781 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 282:
#line 1487 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 8787 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 283:
#line 1488 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 8793 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 284:
#line 1489 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-2]);}
#line 8799 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 285:
#line 1490 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-2]);}
#line 8805 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 286:
#line 1495 "hphp.y" /* yacc.c:1646 */
{ _p->onCase((yyval),(yyvsp[-4]),&(yyvsp[-2]),(yyvsp[0]));}
#line 8811 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 287:
#line 1497 "hphp.y" /* yacc.c:1646 */
{ _p->onCase((yyval),(yyvsp[-3]),NULL,(yyvsp[0]));}
#line 8817 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 288:
#line 1498 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 8823 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 289:
#line 1501 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 8829 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 290:
#line 1502 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 8835 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 291:
#line 1507 "hphp.y" /* yacc.c:1646 */
{ _p->onElseIf((yyval),(yyvsp[-3]),(yyvsp[-1]),(yyvsp[0]));}
#line 8841 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 292:
#line 1508 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 8847 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 293:
#line 1513 "hphp.y" /* yacc.c:1646 */
{ _p->onElseIf((yyval),(yyvsp[-4]),(yyvsp[-2]),(yyvsp[0]));}
#line 8853 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 294:
#line 1514 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 8859 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 295:
#line 1517 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 8865 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 296:
#line 1518 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 8871 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 297:
#line 1521 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 8877 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 298:
#line 1522 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 8883 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 299:
#line 1530 "hphp.y" /* yacc.c:1646 */
{ _p->onVariadicParam((yyval),&(yyvsp[-6]),(yyvsp[-2]),(yyvsp[0]),false,
&(yyvsp[-4]),&(yyvsp[-3])); }
#line 8890 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 300:
#line 1536 "hphp.y" /* yacc.c:1646 */
{ _p->onVariadicParam((yyval),&(yyvsp[-7]),(yyvsp[-3]),(yyvsp[0]),true,
&(yyvsp[-5]),&(yyvsp[-4])); }
#line 8897 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 301:
#line 1542 "hphp.y" /* yacc.c:1646 */
{ validate_hh_variadic_variant(
_p, (yyvsp[-3]), (yyvsp[-1]), &(yyvsp[-2]));
(yyval) = (yyvsp[-5]); }
#line 8905 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 302:
#line 1546 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 8911 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 303:
#line 1550 "hphp.y" /* yacc.c:1646 */
{ _p->onVariadicParam((yyval),NULL,(yyvsp[-2]),(yyvsp[0]),false,
&(yyvsp[-4]),&(yyvsp[-3])); }
#line 8918 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 304:
#line 1555 "hphp.y" /* yacc.c:1646 */
{ _p->onVariadicParam((yyval),NULL,(yyvsp[-3]),(yyvsp[0]),true,
&(yyvsp[-5]),&(yyvsp[-4])); }
#line 8925 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 305:
#line 1560 "hphp.y" /* yacc.c:1646 */
{ validate_hh_variadic_variant(
_p, (yyvsp[-3]), (yyvsp[-1]), &(yyvsp[-2]));
(yyval).reset(); }
#line 8933 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 306:
#line 1563 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset(); }
#line 8939 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 307:
#line 1569 "hphp.y" /* yacc.c:1646 */
{ _p->onParam((yyval),NULL,(yyvsp[-1]),(yyvsp[0]),
ParamMode::In,
NULL,&(yyvsp[-3]),&(yyvsp[-2]));}
#line 8947 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 308:
#line 1574 "hphp.y" /* yacc.c:1646 */
{ _p->onParam((yyval),NULL,(yyvsp[-1]),(yyvsp[0]),
ParamMode::InOut,
NULL,&(yyvsp[-3]),NULL);}
#line 8955 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 309:
#line 1579 "hphp.y" /* yacc.c:1646 */
{ _p->onParam((yyval),NULL,(yyvsp[-2]),(yyvsp[0]),
ParamMode::Ref,
NULL,&(yyvsp[-4]),&(yyvsp[-3]));}
#line 8963 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 310:
#line 1585 "hphp.y" /* yacc.c:1646 */
{ _p->onParam((yyval),NULL,(yyvsp[-4]),(yyvsp[-2]),
ParamMode::Ref,
&(yyvsp[0]),&(yyvsp[-6]),&(yyvsp[-5]));}
#line 8971 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 311:
#line 1591 "hphp.y" /* yacc.c:1646 */
{ _p->onParam((yyval),NULL,(yyvsp[-3]),(yyvsp[-2]),
ParamMode::In,
&(yyvsp[0]),&(yyvsp[-5]),&(yyvsp[-4]));}
#line 8979 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 312:
#line 1597 "hphp.y" /* yacc.c:1646 */
{ _p->onParam((yyval),&(yyvsp[-5]),(yyvsp[-1]),(yyvsp[0]),
ParamMode::In,
NULL,&(yyvsp[-3]),&(yyvsp[-2]));}
#line 8987 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 313:
#line 1603 "hphp.y" /* yacc.c:1646 */
{ _p->onParam((yyval),&(yyvsp[-5]),(yyvsp[-1]),(yyvsp[0]),
ParamMode::InOut,
NULL,&(yyvsp[-3]),NULL);}
#line 8995 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 314:
#line 1609 "hphp.y" /* yacc.c:1646 */
{ _p->onParam((yyval),&(yyvsp[-6]),(yyvsp[-2]),(yyvsp[0]),
ParamMode::Ref,
NULL,&(yyvsp[-4]),&(yyvsp[-3]));}
#line 9003 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 315:
#line 1616 "hphp.y" /* yacc.c:1646 */
{ _p->onParam((yyval),&(yyvsp[-8]),(yyvsp[-4]),(yyvsp[-2]),
ParamMode::Ref,
&(yyvsp[0]),&(yyvsp[-6]),&(yyvsp[-5]));}
#line 9011 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 316:
#line 1623 "hphp.y" /* yacc.c:1646 */
{ _p->onParam((yyval),&(yyvsp[-7]),(yyvsp[-3]),(yyvsp[-2]),
ParamMode::In,
&(yyvsp[0]),&(yyvsp[-5]),&(yyvsp[-4]));}
#line 9019 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 317:
#line 1632 "hphp.y" /* yacc.c:1646 */
{ _p->onVariadicParam((yyval),&(yyvsp[-5]),(yyvsp[-2]),(yyvsp[0]),
false,&(yyvsp[-3]),NULL); }
#line 9026 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 318:
#line 1637 "hphp.y" /* yacc.c:1646 */
{ _p->onVariadicParam((yyval),&(yyvsp[-6]),(yyvsp[-3]),(yyvsp[0]),
true,&(yyvsp[-4]),NULL); }
#line 9033 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 319:
#line 1642 "hphp.y" /* yacc.c:1646 */
{ validate_hh_variadic_variant(
_p, (yyvsp[-2]), (yyvsp[-1]), NULL);
(yyval) = (yyvsp[-4]); }
#line 9041 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 320:
#line 1646 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 9047 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 321:
#line 1649 "hphp.y" /* yacc.c:1646 */
{ _p->onVariadicParam((yyval),NULL,(yyvsp[-2]),(yyvsp[0]),
false,&(yyvsp[-3]),NULL); }
#line 9054 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 322:
#line 1653 "hphp.y" /* yacc.c:1646 */
{ _p->onVariadicParam((yyval),NULL,(yyvsp[-3]),(yyvsp[0]),
true,&(yyvsp[-4]),NULL); }
#line 9061 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 323:
#line 1657 "hphp.y" /* yacc.c:1646 */
{ validate_hh_variadic_variant(
_p, (yyvsp[-2]), (yyvsp[-1]), NULL);
(yyval).reset(); }
#line 9069 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 324:
#line 1660 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 9075 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 325:
#line 1665 "hphp.y" /* yacc.c:1646 */
{ _p->onParam((yyval),NULL,(yyvsp[-1]),(yyvsp[0]),
ParamMode::In,
NULL,&(yyvsp[-2]),NULL); }
#line 9083 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 326:
#line 1669 "hphp.y" /* yacc.c:1646 */
{ _p->onParam((yyval),NULL,(yyvsp[-1]),(yyvsp[0]),
ParamMode::InOut,
NULL,&(yyvsp[-3]),NULL); }
#line 9091 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 327:
#line 1673 "hphp.y" /* yacc.c:1646 */
{ _p->onParam((yyval),NULL,(yyvsp[-2]),(yyvsp[0]),
ParamMode::Ref,
NULL,&(yyvsp[-3]),NULL); }
#line 9099 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 328:
#line 1678 "hphp.y" /* yacc.c:1646 */
{ _p->onParam((yyval),NULL,(yyvsp[-4]),(yyvsp[-2]),
ParamMode::Ref,
&(yyvsp[0]),&(yyvsp[-5]),NULL); }
#line 9107 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 329:
#line 1683 "hphp.y" /* yacc.c:1646 */
{ _p->onParam((yyval),NULL,(yyvsp[-3]),(yyvsp[-2]),
ParamMode::In,
&(yyvsp[0]),&(yyvsp[-4]),NULL); }
#line 9115 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 330:
#line 1688 "hphp.y" /* yacc.c:1646 */
{ _p->onParam((yyval),&(yyvsp[-4]),(yyvsp[-1]),(yyvsp[0]),
ParamMode::In,
NULL,&(yyvsp[-2]),NULL); }
#line 9123 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 331:
#line 1693 "hphp.y" /* yacc.c:1646 */
{ _p->onParam((yyval),&(yyvsp[-5]),(yyvsp[-1]),(yyvsp[0]),
ParamMode::InOut,
NULL,&(yyvsp[-3]),NULL); }
#line 9131 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 332:
#line 1698 "hphp.y" /* yacc.c:1646 */
{ _p->onParam((yyval),&(yyvsp[-5]),(yyvsp[-2]),(yyvsp[0]),
ParamMode::Ref,
NULL,&(yyvsp[-3]),NULL); }
#line 9139 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 333:
#line 1704 "hphp.y" /* yacc.c:1646 */
{ _p->onParam((yyval),&(yyvsp[-7]),(yyvsp[-4]),(yyvsp[-2]),
ParamMode::Ref,
&(yyvsp[0]),&(yyvsp[-5]),NULL); }
#line 9147 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 334:
#line 1710 "hphp.y" /* yacc.c:1646 */
{ _p->onParam((yyval),&(yyvsp[-6]),(yyvsp[-3]),(yyvsp[-2]),
ParamMode::In,
&(yyvsp[0]),&(yyvsp[-4]),NULL); }
#line 9155 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 335:
#line 1716 "hphp.y" /* yacc.c:1646 */
{ _p->onRefDim((yyval), (yyvsp[-3]), (yyvsp[-1]));}
#line 9161 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 336:
#line 1717 "hphp.y" /* yacc.c:1646 */
{ _p->onSimpleVariable((yyval), (yyvsp[0]));}
#line 9167 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 337:
#line 1718 "hphp.y" /* yacc.c:1646 */
{ _p->onPipeVariable((yyval));}
#line 9173 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 338:
#line 1723 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 9179 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 339:
#line 1724 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 9185 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 340:
#line 1727 "hphp.y" /* yacc.c:1646 */
{ _p->onCallParam((yyval),NULL,(yyvsp[0]),
ParamMode::In,false);}
#line 9192 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 341:
#line 1729 "hphp.y" /* yacc.c:1646 */
{ _p->onCallParam((yyval),NULL,(yyvsp[0]),
ParamMode::InOut,false);}
#line 9199 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 342:
#line 1731 "hphp.y" /* yacc.c:1646 */
{ _p->onCallParam((yyval),NULL,(yyvsp[0]),
ParamMode::Ref,false);}
#line 9206 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 343:
#line 1733 "hphp.y" /* yacc.c:1646 */
{ _p->onCallParam((yyval),NULL,(yyvsp[0]),
ParamMode::In,true);}
#line 9213 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 344:
#line 1736 "hphp.y" /* yacc.c:1646 */
{ _p->onCallParam((yyval),&(yyvsp[-2]),(yyvsp[0]),
ParamMode::In,false);}
#line 9220 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 345:
#line 1739 "hphp.y" /* yacc.c:1646 */
{ _p->onCallParam((yyval),&(yyvsp[-3]),(yyvsp[0]),
ParamMode::In,true);}
#line 9227 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 346:
#line 1742 "hphp.y" /* yacc.c:1646 */
{ _p->onCallParam((yyval),&(yyvsp[-3]),(yyvsp[0]),
ParamMode::Ref,false);}
#line 9234 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 347:
#line 1745 "hphp.y" /* yacc.c:1646 */
{ _p->onCallParam((yyval),&(yyvsp[-3]),(yyvsp[0]),
ParamMode::InOut,false);}
#line 9241 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 348:
#line 1750 "hphp.y" /* yacc.c:1646 */
{ _p->onGlobalVar((yyval), &(yyvsp[-2]), (yyvsp[0]));}
#line 9247 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 349:
#line 1751 "hphp.y" /* yacc.c:1646 */
{ _p->onGlobalVar((yyval), NULL, (yyvsp[0]));}
#line 9253 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 350:
#line 1754 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 9259 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 351:
#line 1755 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); (yyval) = 1;}
#line 9265 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 352:
#line 1756 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); (yyval) = 1;}
#line 9271 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 353:
#line 1760 "hphp.y" /* yacc.c:1646 */
{ _p->onStaticVariable((yyval),&(yyvsp[-2]),(yyvsp[0]),0);}
#line 9277 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 354:
#line 1762 "hphp.y" /* yacc.c:1646 */
{ _p->onStaticVariable((yyval),&(yyvsp[-4]),(yyvsp[-2]),&(yyvsp[0]));}
#line 9283 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 355:
#line 1763 "hphp.y" /* yacc.c:1646 */
{ _p->onStaticVariable((yyval),0,(yyvsp[0]),0);}
#line 9289 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 356:
#line 1764 "hphp.y" /* yacc.c:1646 */
{ _p->onStaticVariable((yyval),0,(yyvsp[-2]),&(yyvsp[0]));}
#line 9295 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 357:
#line 1769 "hphp.y" /* yacc.c:1646 */
{ _p->onClassStatement((yyval), (yyvsp[-1]), (yyvsp[0]));}
#line 9301 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 358:
#line 1770 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 9307 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 359:
#line 1773 "hphp.y" /* yacc.c:1646 */
{ _p->onClassVariableStart
((yyval),NULL,(yyvsp[-1]),NULL,NULL);}
#line 9314 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 360:
#line 1778 "hphp.y" /* yacc.c:1646 */
{ _p->onClassConstant((yyval),0,(yyvsp[-2]),(yyvsp[0]));}
#line 9320 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 361:
#line 1784 "hphp.y" /* yacc.c:1646 */
{ _p->onClassStatement((yyval), (yyvsp[-1]), (yyvsp[0]));}
#line 9326 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 362:
#line 1785 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 9332 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 363:
#line 1789 "hphp.y" /* yacc.c:1646 */
{ _p->onClassVariableStart
((yyval),&(yyvsp[-2]),(yyvsp[-1]),NULL,NULL);}
#line 9339 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 364:
#line 1793 "hphp.y" /* yacc.c:1646 */
{ _p->onClassVariableStart
((yyval),&(yyvsp[-3]),(yyvsp[-1]),&(yyvsp[-2]),NULL);}
#line 9346 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 365:
#line 1797 "hphp.y" /* yacc.c:1646 */
{ _p->onClassVariableStart
((yyval),&(yyvsp[-2]),(yyvsp[-1]),NULL,&(yyvsp[-3]));}
#line 9353 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 366:
#line 1802 "hphp.y" /* yacc.c:1646 */
{ _p->onClassVariableStart
((yyval),&(yyvsp[-3]),(yyvsp[-1]),&(yyvsp[-2]),&(yyvsp[-4]));}
#line 9360 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 367:
#line 1804 "hphp.y" /* yacc.c:1646 */
{ _p->onClassVariableStart
((yyval),NULL,(yyvsp[-1]),NULL,NULL);}
#line 9367 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 368:
#line 1807 "hphp.y" /* yacc.c:1646 */
{ _p->onClassVariableStart
((yyval),NULL,(yyvsp[-1]),NULL,NULL,true);}
#line 9374 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 369:
#line 1809 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
#line 9380 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 370:
#line 1812 "hphp.y" /* yacc.c:1646 */
{ _p->onNewLabelScope(true);
_p->onMethodStart((yyvsp[-1]), (yyvsp[-4]));
_p->pushLabelInfo();}
#line 9388 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 371:
#line 1819 "hphp.y" /* yacc.c:1646 */
{ _p->onMethod((yyval),(yyvsp[-10]),(yyvsp[-2]),(yyvsp[-8]),(yyvsp[-7]),(yyvsp[-4]),(yyvsp[0]),nullptr);
_p->closeActiveUsings();
_p->popLabelInfo();
_p->popTypeScope();
_p->onCompleteLabelScope(true);}
#line 9398 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 372:
#line 1827 "hphp.y" /* yacc.c:1646 */
{ _p->onNewLabelScope(true);
_p->onMethodStart((yyvsp[-1]), (yyvsp[-4]));
_p->pushLabelInfo();}
#line 9406 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 373:
#line 1834 "hphp.y" /* yacc.c:1646 */
{ _p->onMethod((yyval),(yyvsp[-10]),(yyvsp[-2]),(yyvsp[-8]),(yyvsp[-7]),(yyvsp[-4]),(yyvsp[0]),&(yyvsp[-11]));
_p->closeActiveUsings();
_p->popLabelInfo();
_p->popTypeScope();
_p->onCompleteLabelScope(true);}
#line 9416 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 374:
#line 1840 "hphp.y" /* yacc.c:1646 */
{ _p->xhpSetAttributes((yyvsp[-1]));}
#line 9422 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 375:
#line 1842 "hphp.y" /* yacc.c:1646 */
{ xhp_category_stmt(_p,(yyval),(yyvsp[-1]));}
#line 9428 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 376:
#line 1844 "hphp.y" /* yacc.c:1646 */
{ xhp_children_stmt(_p,(yyval),(yyvsp[-1]));}
#line 9434 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 377:
#line 1846 "hphp.y" /* yacc.c:1646 */
{ _p->onClassRequire((yyval), (yyvsp[-1]), true); }
#line 9440 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 378:
#line 1848 "hphp.y" /* yacc.c:1646 */
{ _p->onClassRequire((yyval), (yyvsp[-1]), false); }
#line 9446 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 379:
#line 1849 "hphp.y" /* yacc.c:1646 */
{ Token t; t.reset();
_p->onTraitUse((yyval),(yyvsp[-1]),t); }
#line 9453 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 380:
#line 1852 "hphp.y" /* yacc.c:1646 */
{ _p->onTraitUse((yyval),(yyvsp[-3]),(yyvsp[-1])); }
#line 9459 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 381:
#line 1855 "hphp.y" /* yacc.c:1646 */
{ _p->onTraitRule((yyval),(yyvsp[-1]),(yyvsp[0])); }
#line 9465 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 382:
#line 1856 "hphp.y" /* yacc.c:1646 */
{ _p->onTraitRule((yyval),(yyvsp[-1]),(yyvsp[0])); }
#line 9471 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 383:
#line 1857 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset(); }
#line 9477 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 384:
#line 1863 "hphp.y" /* yacc.c:1646 */
{ _p->onTraitPrecRule((yyval),(yyvsp[-5]),(yyvsp[-3]),(yyvsp[-1]));}
#line 9483 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 385:
#line 1868 "hphp.y" /* yacc.c:1646 */
{ _p->onTraitAliasRuleModify((yyval),(yyvsp[-4]),(yyvsp[-2]),
(yyvsp[-1]));}
#line 9490 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 386:
#line 1871 "hphp.y" /* yacc.c:1646 */
{ Token t; t.reset();
_p->onTraitAliasRuleModify((yyval),(yyvsp[-3]),(yyvsp[-1]),
t);}
#line 9498 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 387:
#line 1878 "hphp.y" /* yacc.c:1646 */
{ _p->onTraitAliasRuleStart((yyval),(yyvsp[-2]),(yyvsp[0]));}
#line 9504 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 388:
#line 1879 "hphp.y" /* yacc.c:1646 */
{ Token t; t.reset();
_p->onTraitAliasRuleStart((yyval),t,(yyvsp[0]));}
#line 9511 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 389:
#line 1884 "hphp.y" /* yacc.c:1646 */
{ xhp_attribute_list(_p,(yyval),
_p->xhpGetAttributes(),(yyvsp[0]));}
#line 9518 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 390:
#line 1887 "hphp.y" /* yacc.c:1646 */
{ xhp_attribute_list(_p,(yyval), &(yyvsp[-2]),(yyvsp[0]));}
#line 9524 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 391:
#line 1894 "hphp.y" /* yacc.c:1646 */
{ xhp_attribute(_p,(yyval),(yyvsp[-3]),(yyvsp[-2]),(yyvsp[-1]),(yyvsp[0]));
(yyval) = 1;}
#line 9531 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 392:
#line 1896 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); (yyval) = 0;}
#line 9537 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 393:
#line 1900 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 9543 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 395:
#line 1905 "hphp.y" /* yacc.c:1646 */
{ (yyval) = 4;}
#line 9549 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 396:
#line 1907 "hphp.y" /* yacc.c:1646 */
{ (yyval) = 4;}
#line 9555 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 397:
#line 1909 "hphp.y" /* yacc.c:1646 */
{ (yyval) = 4;}
#line 9561 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 398:
#line 1910 "hphp.y" /* yacc.c:1646 */
{ /* This case handles all types other
than "array", "var" and "enum".
For now we just use type code 5;
later xhp_attribute() will fix up
the type code as appropriate. */
(yyval) = 5; (yyval).setText((yyvsp[0]));}
#line 9572 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 399:
#line 1916 "hphp.y" /* yacc.c:1646 */
{ (yyval) = 6;}
#line 9578 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 400:
#line 1918 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); (yyval) = 7;}
#line 9584 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 401:
#line 1919 "hphp.y" /* yacc.c:1646 */
{ (yyval) = 9; }
#line 9590 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 402:
#line 1923 "hphp.y" /* yacc.c:1646 */
{ _p->onExprListElem((yyval),nullptr,(yyvsp[0])); }
#line 9596 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 403:
#line 1925 "hphp.y" /* yacc.c:1646 */
{ _p->onExprListElem((yyval),&(yyvsp[-2]),(yyvsp[0])); }
#line 9602 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 404:
#line 1930 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 9608 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 405:
#line 1933 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 9614 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 406:
#line 1934 "hphp.y" /* yacc.c:1646 */
{ scalar_null(_p, (yyval));}
#line 9620 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 407:
#line 1938 "hphp.y" /* yacc.c:1646 */
{ scalar_num(_p, (yyval), "1");}
#line 9626 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 408:
#line 1939 "hphp.y" /* yacc.c:1646 */
{ scalar_num(_p, (yyval), "0");}
#line 9632 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 409:
#line 1943 "hphp.y" /* yacc.c:1646 */
{ Token t; scalar_num(_p, t, "1");
_p->onArrayPair((yyval),0,&(yyvsp[0]),t,0);}
#line 9639 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 410:
#line 1946 "hphp.y" /* yacc.c:1646 */
{ Token t; scalar_num(_p, t, "1");
_p->onArrayPair((yyval),&(yyvsp[-2]),&(yyvsp[0]),t,0);}
#line 9646 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 411:
#line 1951 "hphp.y" /* yacc.c:1646 */
{ _p->onScalar((yyval),
T_CONSTANT_ENCAPSED_STRING, (yyvsp[0]));}
#line 9653 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 412:
#line 1956 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); (yyval) = 2;}
#line 9659 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 413:
#line 1957 "hphp.y" /* yacc.c:1646 */
{ (yyval) = -1;
if ((yyvsp[0]).same("any")) (yyval) = 1;}
#line 9666 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 414:
#line 1959 "hphp.y" /* yacc.c:1646 */
{ (yyval) = 0;}
#line 9672 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 415:
#line 1963 "hphp.y" /* yacc.c:1646 */
{ xhp_children_paren(_p, (yyval), (yyvsp[-1]), 0);}
#line 9678 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 416:
#line 1964 "hphp.y" /* yacc.c:1646 */
{ xhp_children_paren(_p, (yyval), (yyvsp[-2]), 1);}
#line 9684 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 417:
#line 1965 "hphp.y" /* yacc.c:1646 */
{ xhp_children_paren(_p, (yyval), (yyvsp[-2]), 2);}
#line 9690 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 418:
#line 1966 "hphp.y" /* yacc.c:1646 */
{ xhp_children_paren(_p, (yyval), (yyvsp[-2]), 3);}
#line 9696 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 419:
#line 1970 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 9702 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 420:
#line 1971 "hphp.y" /* yacc.c:1646 */
{ xhp_children_decl(_p,(yyval),(yyvsp[0]),0, 0);}
#line 9708 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 421:
#line 1972 "hphp.y" /* yacc.c:1646 */
{ xhp_children_decl(_p,(yyval),(yyvsp[-1]),1, 0);}
#line 9714 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 422:
#line 1973 "hphp.y" /* yacc.c:1646 */
{ xhp_children_decl(_p,(yyval),(yyvsp[-1]),2, 0);}
#line 9720 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 423:
#line 1974 "hphp.y" /* yacc.c:1646 */
{ xhp_children_decl(_p,(yyval),(yyvsp[-1]),3, 0);}
#line 9726 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 424:
#line 1976 "hphp.y" /* yacc.c:1646 */
{ xhp_children_decl(_p,(yyval),(yyvsp[-2]),4,&(yyvsp[0]));}
#line 9732 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 425:
#line 1978 "hphp.y" /* yacc.c:1646 */
{ xhp_children_decl(_p,(yyval),(yyvsp[-2]),5,&(yyvsp[0]));}
#line 9738 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 426:
#line 1982 "hphp.y" /* yacc.c:1646 */
{ (yyval) = -1;
if ((yyvsp[0]).same("any")) (yyval) = 1; else
if ((yyvsp[0]).same("pcdata")) (yyval) = 2;}
#line 9746 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 427:
#line 1985 "hphp.y" /* yacc.c:1646 */
{ (yyvsp[0]).xhpLabel(); (yyval) = (yyvsp[0]); (yyval) = 3;}
#line 9752 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 428:
#line 1986 "hphp.y" /* yacc.c:1646 */
{ (yyvsp[0]).xhpLabel(0); (yyval) = (yyvsp[0]); (yyval) = 4;}
#line 9758 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 429:
#line 1990 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 9764 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 430:
#line 1991 "hphp.y" /* yacc.c:1646 */
{ _p->finishStatement((yyval), (yyvsp[-1])); (yyval) = 1;}
#line 9770 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 431:
#line 1995 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 9776 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 432:
#line 1996 "hphp.y" /* yacc.c:1646 */
{ _p->finishStatement((yyval), (yyvsp[-1])); (yyval) = 1;}
#line 9782 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 433:
#line 1999 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 9788 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 434:
#line 2000 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 9794 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 435:
#line 2003 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 9800 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 436:
#line 2004 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 9806 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 437:
#line 2007 "hphp.y" /* yacc.c:1646 */
{ _p->onMemberModifier((yyval),NULL,(yyvsp[0]));}
#line 9812 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 438:
#line 2009 "hphp.y" /* yacc.c:1646 */
{ _p->onMemberModifier((yyval),&(yyvsp[-1]),(yyvsp[0]));}
#line 9818 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 439:
#line 2012 "hphp.y" /* yacc.c:1646 */
{ (yyval) = T_PUBLIC;}
#line 9824 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 440:
#line 2013 "hphp.y" /* yacc.c:1646 */
{ (yyval) = T_PROTECTED;}
#line 9830 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 441:
#line 2014 "hphp.y" /* yacc.c:1646 */
{ (yyval) = T_PRIVATE;}
#line 9836 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 442:
#line 2015 "hphp.y" /* yacc.c:1646 */
{ (yyval) = T_STATIC;}
#line 9842 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 443:
#line 2016 "hphp.y" /* yacc.c:1646 */
{ (yyval) = T_ABSTRACT;}
#line 9848 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 444:
#line 2017 "hphp.y" /* yacc.c:1646 */
{ (yyval) = T_FINAL;}
#line 9854 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 445:
#line 2018 "hphp.y" /* yacc.c:1646 */
{ (yyval) = T_ASYNC;}
#line 9860 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 446:
#line 2022 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 9866 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 447:
#line 2023 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 9872 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 448:
#line 2026 "hphp.y" /* yacc.c:1646 */
{ (yyval) = T_PUBLIC;}
#line 9878 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 449:
#line 2027 "hphp.y" /* yacc.c:1646 */
{ (yyval) = T_PROTECTED;}
#line 9884 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 450:
#line 2028 "hphp.y" /* yacc.c:1646 */
{ (yyval) = T_PRIVATE;}
#line 9890 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 451:
#line 2032 "hphp.y" /* yacc.c:1646 */
{ _p->onClassVariable((yyval),&(yyvsp[-2]),(yyvsp[0]),0);}
#line 9896 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 452:
#line 2034 "hphp.y" /* yacc.c:1646 */
{ _p->onClassVariable((yyval),&(yyvsp[-4]),(yyvsp[-2]),&(yyvsp[0]));}
#line 9902 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 453:
#line 2035 "hphp.y" /* yacc.c:1646 */
{ _p->onClassVariable((yyval),0,(yyvsp[0]),0);}
#line 9908 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 454:
#line 2036 "hphp.y" /* yacc.c:1646 */
{ _p->onClassVariable((yyval),0,(yyvsp[-2]),&(yyvsp[0]));}
#line 9914 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 455:
#line 2040 "hphp.y" /* yacc.c:1646 */
{ _p->onClassConstant((yyval),&(yyvsp[-4]),(yyvsp[-2]),(yyvsp[0]));}
#line 9920 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 456:
#line 2042 "hphp.y" /* yacc.c:1646 */
{ _p->onClassConstant((yyval),0,(yyvsp[-2]),(yyvsp[0]));}
#line 9926 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 457:
#line 2045 "hphp.y" /* yacc.c:1646 */
{ _p->onClassConstant((yyval),0,(yyvsp[-2]),(yyvsp[0]));}
#line 9932 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 458:
#line 2051 "hphp.y" /* yacc.c:1646 */
{ _p->onClassAbstractConstant((yyval),&(yyvsp[-2]),(yyvsp[0]));}
#line 9938 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 459:
#line 2053 "hphp.y" /* yacc.c:1646 */
{ _p->onClassAbstractConstant((yyval),NULL,(yyvsp[0]));}
#line 9944 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 460:
#line 2057 "hphp.y" /* yacc.c:1646 */
{ Token t;
_p->onClassTypeConstant((yyval), (yyvsp[-1]), t);
_p->popTypeScope(); }
#line 9952 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 461:
#line 2061 "hphp.y" /* yacc.c:1646 */
{ _p->onClassTypeConstant((yyval), (yyvsp[-3]), (yyvsp[0]));
_p->popTypeScope(); }
#line 9959 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 462:
#line 2065 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
#line 9965 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 463:
#line 2069 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
#line 9971 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 464:
#line 2073 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 9977 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 465:
#line 2075 "hphp.y" /* yacc.c:1646 */
{ _p->onNewObject((yyval), (yyvsp[-1]), (yyvsp[0]));}
#line 9983 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 466:
#line 2076 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 9989 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 467:
#line 2077 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[0]),T_CLONE,1);}
#line 9995 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 468:
#line 2078 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 10001 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 469:
#line 2079 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 10007 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 470:
#line 2082 "hphp.y" /* yacc.c:1646 */
{ _p->onExprListElem((yyval), &(yyvsp[-2]), (yyvsp[0]));}
#line 10013 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 471:
#line 2083 "hphp.y" /* yacc.c:1646 */
{ _p->onExprListElem((yyval), NULL, (yyvsp[0]));}
#line 10019 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 472:
#line 2087 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 10025 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 473:
#line 2088 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 10031 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 474:
#line 2092 "hphp.y" /* yacc.c:1646 */
{ _p->onYield((yyval), NULL);}
#line 10037 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 475:
#line 2093 "hphp.y" /* yacc.c:1646 */
{ _p->onYield((yyval), &(yyvsp[0]));}
#line 10043 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 476:
#line 2094 "hphp.y" /* yacc.c:1646 */
{ _p->onYieldPair((yyval), &(yyvsp[-2]), &(yyvsp[0]));}
#line 10049 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 477:
#line 2095 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
#line 10055 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 478:
#line 2099 "hphp.y" /* yacc.c:1646 */
{ _p->onAssign((yyval), (yyvsp[-2]), (yyvsp[0]), 0, true);}
#line 10061 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 479:
#line 2104 "hphp.y" /* yacc.c:1646 */
{ _p->onListAssignment((yyval), (yyvsp[-3]), &(yyvsp[0]), true);}
#line 10067 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 480:
#line 2108 "hphp.y" /* yacc.c:1646 */
{ _p->onYieldFrom((yyval),&(yyvsp[0]));}
#line 10073 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 481:
#line 2112 "hphp.y" /* yacc.c:1646 */
{ _p->onAssign((yyval), (yyvsp[-2]), (yyvsp[0]), 0, true);}
#line 10079 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 482:
#line 2116 "hphp.y" /* yacc.c:1646 */
{ _p->onAwait((yyval), (yyvsp[0])); }
#line 10085 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 483:
#line 2120 "hphp.y" /* yacc.c:1646 */
{ _p->onAssign((yyval), (yyvsp[-2]), (yyvsp[0]), 0, true);}
#line 10091 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 484:
#line 2125 "hphp.y" /* yacc.c:1646 */
{ _p->onListAssignment((yyval), (yyvsp[-3]), &(yyvsp[0]), true);}
#line 10097 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 485:
#line 2129 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 10103 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 486:
#line 2133 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 10109 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 487:
#line 2134 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 10115 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 488:
#line 2135 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 10121 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 489:
#line 2136 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 10127 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 490:
#line 2137 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 10133 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 491:
#line 2141 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
#line 10139 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 492:
#line 2146 "hphp.y" /* yacc.c:1646 */
{ _p->onListAssignment((yyval), (yyvsp[-3]), &(yyvsp[0]));}
#line 10145 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 493:
#line 2147 "hphp.y" /* yacc.c:1646 */
{ _p->onAssign((yyval), (yyvsp[-2]), (yyvsp[0]), 0);}
#line 10151 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 494:
#line 2148 "hphp.y" /* yacc.c:1646 */
{ _p->onAssign((yyval), (yyvsp[-3]), (yyvsp[0]), 1);}
#line 10157 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 495:
#line 2151 "hphp.y" /* yacc.c:1646 */
{ _p->onAssignNew((yyval),(yyvsp[-5]),(yyvsp[-1]),(yyvsp[0]));}
#line 10163 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 496:
#line 2152 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_PLUS_EQUAL);}
#line 10169 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 497:
#line 2153 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_MINUS_EQUAL);}
#line 10175 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 498:
#line 2154 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_MUL_EQUAL);}
#line 10181 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 499:
#line 2155 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_DIV_EQUAL);}
#line 10187 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 500:
#line 2156 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_CONCAT_EQUAL);}
#line 10193 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 501:
#line 2157 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_MOD_EQUAL);}
#line 10199 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 502:
#line 2158 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_AND_EQUAL);}
#line 10205 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 503:
#line 2159 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_OR_EQUAL);}
#line 10211 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 504:
#line 2160 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_XOR_EQUAL);}
#line 10217 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 505:
#line 2161 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_SL_EQUAL);}
#line 10223 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 506:
#line 2162 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_SR_EQUAL);}
#line 10229 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 507:
#line 2163 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_POW_EQUAL);}
#line 10235 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 508:
#line 2164 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[-1]),T_INC,0);}
#line 10241 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 509:
#line 2165 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[0]),T_INC,1);}
#line 10247 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 510:
#line 2166 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[-1]),T_DEC,0);}
#line 10253 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 511:
#line 2167 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[0]),T_DEC,1);}
#line 10259 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 512:
#line 2168 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_BOOLEAN_OR);}
#line 10265 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 513:
#line 2169 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_BOOLEAN_AND);}
#line 10271 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 514:
#line 2170 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_LOGICAL_OR);}
#line 10277 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 515:
#line 2171 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_LOGICAL_AND);}
#line 10283 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 516:
#line 2172 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_LOGICAL_XOR);}
#line 10289 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 517:
#line 2173 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),'|');}
#line 10295 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 518:
#line 2174 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),'&');}
#line 10301 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 519:
#line 2175 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),'^');}
#line 10307 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 520:
#line 2176 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),'.');}
#line 10313 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 521:
#line 2177 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),'+');}
#line 10319 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 522:
#line 2178 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),'-');}
#line 10325 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 523:
#line 2179 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),'*');}
#line 10331 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 524:
#line 2180 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),'/');}
#line 10337 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 525:
#line 2181 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_POW);}
#line 10343 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 526:
#line 2182 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),'%');}
#line 10349 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 527:
#line 2183 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_PIPE);}
#line 10355 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 528:
#line 2184 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_SL);}
#line 10361 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 529:
#line 2185 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_SR);}
#line 10367 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 530:
#line 2186 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[0]),'+',1);}
#line 10373 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 531:
#line 2187 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[0]),'-',1);}
#line 10379 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 532:
#line 2188 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[0]),'!',1);}
#line 10385 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 533:
#line 2189 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[0]),'~',1);}
#line 10391 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 534:
#line 2190 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_IS_IDENTICAL);}
#line 10397 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 535:
#line 2191 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_IS_NOT_IDENTICAL);}
#line 10403 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 536:
#line 2192 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_IS_EQUAL);}
#line 10409 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 537:
#line 2193 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_IS_NOT_EQUAL);}
#line 10415 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 538:
#line 2194 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),'<');}
#line 10421 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 539:
#line 2195 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),
T_IS_SMALLER_OR_EQUAL);}
#line 10428 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 540:
#line 2197 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),'>');}
#line 10434 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 541:
#line 2198 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),
T_IS_GREATER_OR_EQUAL);}
#line 10441 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 542:
#line 2200 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_SPACESHIP);}
#line 10447 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 543:
#line 2202 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_INSTANCEOF);}
#line 10453 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 544:
#line 2203 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 10459 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 545:
#line 2204 "hphp.y" /* yacc.c:1646 */
{ _p->onQOp((yyval), (yyvsp[-4]), &(yyvsp[-2]), (yyvsp[0]));}
#line 10465 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 546:
#line 2205 "hphp.y" /* yacc.c:1646 */
{ _p->onQOp((yyval), (yyvsp[-3]), 0, (yyvsp[0]));}
#line 10471 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 547:
#line 2206 "hphp.y" /* yacc.c:1646 */
{ _p->onNullCoalesce((yyval), (yyvsp[-2]), (yyvsp[0]));}
#line 10477 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 548:
#line 2207 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 10483 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 549:
#line 2208 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[0]),T_INT_CAST,1);}
#line 10489 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 550:
#line 2209 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[0]),T_DOUBLE_CAST,1);}
#line 10495 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 551:
#line 2210 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[0]),T_STRING_CAST,1);}
#line 10501 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 552:
#line 2211 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[0]),T_ARRAY_CAST,1);}
#line 10507 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 553:
#line 2212 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[0]),T_OBJECT_CAST,1);}
#line 10513 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 554:
#line 2213 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[0]),T_BOOL_CAST,1);}
#line 10519 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 555:
#line 2214 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[0]),T_UNSET_CAST,1);}
#line 10525 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 556:
#line 2215 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[0]),T_EXIT,1);}
#line 10531 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 557:
#line 2216 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[0]),'@',1);}
#line 10537 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 558:
#line 2217 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
#line 10543 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 559:
#line 2218 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
#line 10549 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 560:
#line 2219 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
#line 10555 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 561:
#line 2220 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
#line 10561 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 562:
#line 2221 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
#line 10567 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 563:
#line 2222 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
#line 10573 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 564:
#line 2223 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
#line 10579 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 565:
#line 2224 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
#line 10585 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 566:
#line 2225 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
#line 10591 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 567:
#line 2226 "hphp.y" /* yacc.c:1646 */
{ _p->onEncapsList((yyval),'`',(yyvsp[-1]));}
#line 10597 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 568:
#line 2227 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[0]),T_PRINT,1);}
#line 10603 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 569:
#line 2228 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 10609 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 570:
#line 2235 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-2]);}
#line 10615 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 571:
#line 2236 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 10621 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 572:
#line 2241 "hphp.y" /* yacc.c:1646 */
{ Token t;
_p->onNewLabelScope(true);
_p->onClosureStart(t);
_p->pushLabelInfo(); }
#line 10630 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 573:
#line 2247 "hphp.y" /* yacc.c:1646 */
{ _p->finishStatement((yyvsp[-1]), (yyvsp[-1])); (yyvsp[-1]) = 1;
(yyval) = _p->onClosure(
ClosureType::Long, nullptr,
(yyvsp[-10]),(yyvsp[-7]),(yyvsp[-4]),(yyvsp[-1]),(yyvsp[-5]),&(yyvsp[-3]));
_p->closeActiveUsings();
_p->popLabelInfo();
_p->onCompleteLabelScope(true);}
#line 10642 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 574:
#line 2256 "hphp.y" /* yacc.c:1646 */
{ Token t;
_p->onNewLabelScope(true);
_p->onClosureStart(t);
_p->pushLabelInfo(); }
#line 10651 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 575:
#line 2262 "hphp.y" /* yacc.c:1646 */
{ _p->finishStatement((yyvsp[-1]), (yyvsp[-1])); (yyvsp[-1]) = 1;
(yyval) = _p->onClosure(
ClosureType::Long, &(yyvsp[-12]),
(yyvsp[-10]),(yyvsp[-7]),(yyvsp[-4]),(yyvsp[-1]),(yyvsp[-5]),&(yyvsp[-3]));
_p->closeActiveUsings();
_p->popLabelInfo();
_p->onCompleteLabelScope(true);}
#line 10663 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 576:
#line 2273 "hphp.y" /* yacc.c:1646 */
{ _p->pushFuncLocation();
Token t;
_p->onNewLabelScope(true);
_p->onClosureStart(t);
_p->pushLabelInfo();
Token u;
_p->onParam((yyvsp[0]),NULL,u,(yyvsp[0]),
ParamMode::In,
NULL,NULL,NULL);}
#line 10677 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 577:
#line 2282 "hphp.y" /* yacc.c:1646 */
{ Token v; Token w; Token x;
(yyvsp[-3]) = T_ASYNC;
_p->onMemberModifier((yyvsp[-3]), nullptr, (yyvsp[-3]));
_p->finishStatement((yyvsp[0]), (yyvsp[0])); (yyvsp[0]) = 1;
(yyval) = _p->onClosure(ClosureType::Short,
&(yyvsp[-3]),
v,(yyvsp[-2]),w,(yyvsp[0]),x);
_p->closeActiveUsings();
_p->popLabelInfo();
_p->onCompleteLabelScope(true);}
#line 10692 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 578:
#line 2293 "hphp.y" /* yacc.c:1646 */
{ _p->pushFuncLocation();
Token t;
_p->onNewLabelScope(true);
_p->onClosureStart(t);
_p->pushLabelInfo();}
#line 10702 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 579:
#line 2301 "hphp.y" /* yacc.c:1646 */
{ Token u; Token v;
(yyvsp[-6]) = T_ASYNC;
_p->onMemberModifier((yyvsp[-6]), nullptr, (yyvsp[-6]));
_p->finishStatement((yyvsp[0]), (yyvsp[0])); (yyvsp[0]) = 1;
(yyval) = _p->onClosure(ClosureType::Short,
&(yyvsp[-6]),
u,(yyvsp[-3]),v,(yyvsp[0]),(yyvsp[-1]));
_p->closeActiveUsings();
_p->popLabelInfo();
_p->onCompleteLabelScope(true);}
#line 10717 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 580:
#line 2312 "hphp.y" /* yacc.c:1646 */
{ _p->pushFuncLocation();
Token t;
_p->onNewLabelScope(true);
_p->onClosureStart(t);
_p->pushLabelInfo();}
#line 10727 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 581:
#line 2318 "hphp.y" /* yacc.c:1646 */
{ Token u; Token v; Token w; Token x;
Token y;
(yyvsp[-4]) = T_ASYNC;
_p->onMemberModifier((yyvsp[-4]), nullptr, (yyvsp[-4]));
_p->finishStatement((yyvsp[-1]), (yyvsp[-1])); (yyvsp[-1]) = 1;
(yyval) = _p->onClosure(ClosureType::Short,
&(yyvsp[-4]),
u,v,w,(yyvsp[-1]),x);
_p->closeActiveUsings();
_p->popLabelInfo();
_p->onCompleteLabelScope(true);
_p->onCall((yyval),1,(yyval),y,NULL);}
#line 10744 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 582:
#line 2330 "hphp.y" /* yacc.c:1646 */
{ _p->pushFuncLocation();
Token t;
_p->onNewLabelScope(true);
_p->onClosureStart(t);
_p->pushLabelInfo();
Token u;
_p->onParam((yyvsp[0]),NULL,u,(yyvsp[0]),
ParamMode::In,
NULL,NULL,NULL);}
#line 10758 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 583:
#line 2339 "hphp.y" /* yacc.c:1646 */
{ Token v; Token w; Token x;
_p->finishStatement((yyvsp[0]), (yyvsp[0])); (yyvsp[0]) = 1;
(yyval) = _p->onClosure(ClosureType::Short,
nullptr,
v,(yyvsp[-2]),w,(yyvsp[0]),x);
_p->closeActiveUsings();
_p->popLabelInfo();
_p->onCompleteLabelScope(true);}
#line 10771 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 584:
#line 2347 "hphp.y" /* yacc.c:1646 */
{ _p->pushFuncLocation();
Token t;
_p->onNewLabelScope(true);
_p->onClosureStart(t);
_p->pushLabelInfo();}
#line 10781 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 585:
#line 2355 "hphp.y" /* yacc.c:1646 */
{ Token u; Token v;
_p->finishStatement((yyvsp[0]), (yyvsp[0])); (yyvsp[0]) = 1;
(yyval) = _p->onClosure(ClosureType::Short,
nullptr,
u,(yyvsp[-3]),v,(yyvsp[0]),(yyvsp[-1]));
_p->closeActiveUsings();
_p->popLabelInfo();
_p->onCompleteLabelScope(true);}
#line 10794 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 586:
#line 2366 "hphp.y" /* yacc.c:1646 */
{ (yyval) = _p->onExprForLambda((yyvsp[0]));}
#line 10800 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 587:
#line 2367 "hphp.y" /* yacc.c:1646 */
{ (yyval) = _p->onExprForLambda((yyvsp[0]));}
#line 10806 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 588:
#line 2369 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
#line 10812 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 589:
#line 2373 "hphp.y" /* yacc.c:1646 */
{ validate_shape_keyname((yyvsp[0]), _p);
_p->onScalar((yyval), T_CONSTANT_ENCAPSED_STRING, (yyvsp[0])); }
#line 10819 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 590:
#line 2375 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
#line 10825 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 591:
#line 2382 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval),&(yyvsp[-4]),&(yyvsp[-2]),(yyvsp[0]),0); }
#line 10831 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 592:
#line 2385 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval), 0,&(yyvsp[-2]),(yyvsp[0]),0); }
#line 10837 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 593:
#line 2392 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval),&(yyvsp[-4]),&(yyvsp[-2]),(yyvsp[0]),0); }
#line 10843 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 594:
#line 2395 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval), 0,&(yyvsp[-2]),(yyvsp[0]),0); }
#line 10849 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 595:
#line 2400 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
#line 10855 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 596:
#line 2401 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset(); }
#line 10861 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 597:
#line 2406 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
#line 10867 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 598:
#line 2407 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset(); }
#line 10873 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 599:
#line 2411 "hphp.y" /* yacc.c:1646 */
{ _p->onDArray((yyval), (yyvsp[-1]));}
#line 10879 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 600:
#line 2415 "hphp.y" /* yacc.c:1646 */
{ _p->onArray((yyval),(yyvsp[-1]),T_ARRAY);}
#line 10885 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 601:
#line 2416 "hphp.y" /* yacc.c:1646 */
{ _p->onArray((yyval),(yyvsp[-1]),T_ARRAY);}
#line 10891 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 602:
#line 2421 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 10897 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 603:
#line 2422 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 10903 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 604:
#line 2427 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval),&(yyvsp[-4]),&(yyvsp[-2]),(yyvsp[0]),0);}
#line 10909 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 605:
#line 2428 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval), 0,&(yyvsp[-2]),(yyvsp[0]),0);}
#line 10915 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 606:
#line 2433 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 10921 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 607:
#line 2434 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 10927 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 608:
#line 2440 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval),&(yyvsp[-4]),&(yyvsp[-2]),(yyvsp[0]),0);}
#line 10933 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 609:
#line 2442 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval), 0,&(yyvsp[-2]),(yyvsp[0]),0);}
#line 10939 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 610:
#line 2447 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 10945 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 611:
#line 2448 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 10951 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 612:
#line 2454 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval),&(yyvsp[-4]),&(yyvsp[-2]),(yyvsp[0]),0);}
#line 10957 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 613:
#line 2456 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval), 0,&(yyvsp[-2]),(yyvsp[0]),0);}
#line 10963 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 614:
#line 2460 "hphp.y" /* yacc.c:1646 */
{ _p->onDict((yyval), (yyvsp[-1])); }
#line 10969 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 615:
#line 2464 "hphp.y" /* yacc.c:1646 */
{ _p->onDict((yyval), (yyvsp[-1])); }
#line 10975 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 616:
#line 2468 "hphp.y" /* yacc.c:1646 */
{ _p->onDict((yyval), (yyvsp[-1])); }
#line 10981 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 617:
#line 2472 "hphp.y" /* yacc.c:1646 */
{ _p->onVec((yyval), (yyvsp[-1])); }
#line 10987 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 618:
#line 2476 "hphp.y" /* yacc.c:1646 */
{ _p->onVec((yyval), (yyvsp[-1])); }
#line 10993 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 619:
#line 2480 "hphp.y" /* yacc.c:1646 */
{ _p->onVec((yyval), (yyvsp[-1])); }
#line 10999 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 620:
#line 2484 "hphp.y" /* yacc.c:1646 */
{ _p->onKeyset((yyval), (yyvsp[-1])); }
#line 11005 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 621:
#line 2488 "hphp.y" /* yacc.c:1646 */
{ _p->onKeyset((yyval), (yyvsp[-1])); }
#line 11011 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 622:
#line 2492 "hphp.y" /* yacc.c:1646 */
{ _p->onKeyset((yyval), (yyvsp[-1])); }
#line 11017 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 623:
#line 2496 "hphp.y" /* yacc.c:1646 */
{ _p->onVArray((yyval),(yyvsp[-1])); }
#line 11023 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 624:
#line 2500 "hphp.y" /* yacc.c:1646 */
{ _p->onVArray((yyval),(yyvsp[-1])); }
#line 11029 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 625:
#line 2504 "hphp.y" /* yacc.c:1646 */
{ _p->onVArray((yyval),(yyvsp[-1])); }
#line 11035 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 626:
#line 2508 "hphp.y" /* yacc.c:1646 */
{ _p->onVArray((yyval),(yyvsp[-1])); }
#line 11041 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 627:
#line 2512 "hphp.y" /* yacc.c:1646 */
{ _p->onVArray((yyval),(yyvsp[-1])); }
#line 11047 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 628:
#line 2516 "hphp.y" /* yacc.c:1646 */
{ _p->onVArray((yyval),(yyvsp[-1])); }
#line 11053 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 629:
#line 2520 "hphp.y" /* yacc.c:1646 */
{ _p->onDArray((yyval),(yyvsp[-1])); }
#line 11059 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 630:
#line 2524 "hphp.y" /* yacc.c:1646 */
{ _p->onDArray((yyval),(yyvsp[-1])); }
#line 11065 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 631:
#line 2528 "hphp.y" /* yacc.c:1646 */
{ _p->onDArray((yyval),(yyvsp[-1])); }
#line 11071 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 632:
#line 2533 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 11077 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 633:
#line 2534 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 11083 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 634:
#line 2539 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 11089 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 635:
#line 2540 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 11095 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 636:
#line 2545 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 11101 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 637:
#line 2546 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 11107 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 638:
#line 2551 "hphp.y" /* yacc.c:1646 */
{ Token t;
_p->onName(t,(yyvsp[-3]),Parser::StringName);
BEXP((yyval),t,(yyvsp[-1]),T_COLLECTION);}
#line 11115 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 639:
#line 2558 "hphp.y" /* yacc.c:1646 */
{ Token t;
_p->onName(t,(yyvsp[-3]),Parser::StringName);
BEXP((yyval),t,(yyvsp[-1]),T_COLLECTION);}
#line 11123 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 640:
#line 2565 "hphp.y" /* yacc.c:1646 */
{ _p->onRefDim((yyval), (yyvsp[-3]), (yyvsp[-1]));}
#line 11129 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 641:
#line 2567 "hphp.y" /* yacc.c:1646 */
{ _p->onRefDim((yyval), (yyvsp[-3]), (yyvsp[-1]));}
#line 11135 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 642:
#line 2571 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11141 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 643:
#line 2572 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11147 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 644:
#line 2573 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11153 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 645:
#line 2574 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11159 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 646:
#line 2575 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11165 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 647:
#line 2576 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11171 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 648:
#line 2577 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11177 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 649:
#line 2578 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11183 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 650:
#line 2579 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11189 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 651:
#line 2580 "hphp.y" /* yacc.c:1646 */
{ _p->onScalar((yyval),
T_CONSTANT_ENCAPSED_STRING, (yyvsp[0])); }
#line 11196 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 652:
#line 2582 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 11202 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 653:
#line 2583 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11208 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 654:
#line 2587 "hphp.y" /* yacc.c:1646 */
{ _p->onClosureParam((yyval),&(yyvsp[-2]),(yyvsp[0]),0);}
#line 11214 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 655:
#line 2588 "hphp.y" /* yacc.c:1646 */
{ _p->onClosureParam((yyval),&(yyvsp[-3]),(yyvsp[0]),1);}
#line 11220 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 656:
#line 2589 "hphp.y" /* yacc.c:1646 */
{ _p->onClosureParam((yyval), 0,(yyvsp[0]),0);}
#line 11226 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 657:
#line 2590 "hphp.y" /* yacc.c:1646 */
{ _p->onClosureParam((yyval), 0,(yyvsp[0]),1);}
#line 11232 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 658:
#line 2597 "hphp.y" /* yacc.c:1646 */
{ xhp_tag(_p,(yyval),(yyvsp[-2]),(yyvsp[-1]));}
#line 11238 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 659:
#line 2600 "hphp.y" /* yacc.c:1646 */
{ Token t1; _p->onDArray(t1,(yyvsp[-1]));
Token t2; _p->onVArray(t2,(yyvsp[0]));
Token file; scalar_file(_p, file);
Token line; scalar_line(_p, line);
_p->onCallParam((yyvsp[-1]),NULL,t1,
ParamMode::In,0);
_p->onCallParam((yyval), &(yyvsp[-1]),t2,
ParamMode::In,0);
_p->onCallParam((yyvsp[-1]), &(yyvsp[-1]),file,
ParamMode::In,0);
_p->onCallParam((yyvsp[-1]), &(yyvsp[-1]),line,
ParamMode::In,0);
(yyval).setText("");}
#line 11256 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 660:
#line 2615 "hphp.y" /* yacc.c:1646 */
{ Token file; scalar_file(_p, file);
Token line; scalar_line(_p, line);
_p->onDArray((yyvsp[-2]),(yyvsp[-5]));
_p->onVArray((yyvsp[-1]),(yyvsp[-3]));
_p->onCallParam((yyvsp[-4]),NULL,(yyvsp[-2]),
ParamMode::In,0);
_p->onCallParam((yyval), &(yyvsp[-4]),(yyvsp[-1]),
ParamMode::In,0);
_p->onCallParam((yyvsp[-4]), &(yyvsp[-4]),file,
ParamMode::In,0);
_p->onCallParam((yyvsp[-4]), &(yyvsp[-4]),line,
ParamMode::In,0);
(yyval).setText((yyvsp[0]).text());}
#line 11274 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 661:
#line 2630 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset(); (yyval).setText("");}
#line 11280 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 662:
#line 2631 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset(); (yyval).setText((yyvsp[0]));}
#line 11286 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 663:
#line 2634 "hphp.y" /* yacc.c:1646 */
{ _p->onXhpAttributesStart(); (yyval).reset();}
#line 11292 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 664:
#line 2636 "hphp.y" /* yacc.c:1646 */
{ _p->onXhpAttributeSpread((yyval), &(yyvsp[-4]), (yyvsp[-1]));}
#line 11298 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 665:
#line 2639 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval),&(yyvsp[-3]),&(yyvsp[-2]),(yyvsp[0]),0);}
#line 11304 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 666:
#line 2642 "hphp.y" /* yacc.c:1646 */
{ _p->onOptExprListElem((yyval), &(yyvsp[-1]), (yyvsp[0])); }
#line 11310 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 667:
#line 2643 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 11316 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 668:
#line 2646 "hphp.y" /* yacc.c:1646 */
{ _p->onScalar((yyval),
T_CONSTANT_ENCAPSED_STRING, (yyvsp[0]));}
#line 11323 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 669:
#line 2650 "hphp.y" /* yacc.c:1646 */
{ (yyvsp[0]).xhpDecode();
_p->onScalar((yyval),
T_CONSTANT_ENCAPSED_STRING, (yyvsp[0]));}
#line 11331 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 670:
#line 2653 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 11337 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 671:
#line 2656 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();
if ((yyvsp[0]).htmlTrim()) {
(yyvsp[0]).xhpDecode();
_p->onScalar((yyval),
T_CONSTANT_ENCAPSED_STRING, (yyvsp[0]));
}
}
#line 11349 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 672:
#line 2663 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
#line 11355 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 673:
#line 2664 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
#line 11361 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 674:
#line 2668 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11367 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 675:
#line 2670 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-2]) + ":" + (yyvsp[0]);}
#line 11373 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 676:
#line 2672 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-2]) + "-" + (yyvsp[0]);}
#line 11379 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 677:
#line 2676 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11385 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 678:
#line 2677 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11391 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 679:
#line 2678 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11397 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 680:
#line 2679 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11403 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 681:
#line 2680 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11409 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 682:
#line 2681 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11415 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 683:
#line 2682 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11421 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 684:
#line 2683 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11427 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 685:
#line 2684 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11433 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 686:
#line 2685 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11439 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 687:
#line 2686 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11445 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 688:
#line 2687 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11451 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 689:
#line 2688 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11457 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 690:
#line 2689 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11463 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 691:
#line 2690 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11469 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 692:
#line 2691 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11475 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 693:
#line 2692 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11481 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 694:
#line 2693 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11487 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 695:
#line 2694 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11493 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 696:
#line 2695 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11499 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 697:
#line 2696 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11505 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 698:
#line 2697 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11511 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 699:
#line 2698 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11517 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 700:
#line 2699 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11523 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 701:
#line 2700 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11529 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 702:
#line 2701 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11535 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 703:
#line 2702 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11541 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 704:
#line 2703 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11547 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 705:
#line 2704 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11553 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 706:
#line 2705 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11559 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 707:
#line 2706 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11565 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 708:
#line 2707 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11571 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 709:
#line 2708 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11577 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 710:
#line 2709 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11583 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 711:
#line 2710 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11589 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 712:
#line 2711 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11595 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 713:
#line 2712 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11601 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 714:
#line 2713 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11607 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 715:
#line 2714 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11613 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 716:
#line 2715 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11619 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 717:
#line 2716 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11625 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 718:
#line 2717 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11631 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 719:
#line 2718 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11637 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 720:
#line 2719 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11643 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 721:
#line 2720 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11649 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 722:
#line 2721 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11655 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 723:
#line 2722 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11661 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 724:
#line 2723 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11667 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 725:
#line 2724 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11673 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 726:
#line 2725 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11679 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 727:
#line 2726 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11685 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 728:
#line 2727 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11691 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 729:
#line 2728 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11697 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 730:
#line 2729 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11703 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 731:
#line 2730 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11709 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 732:
#line 2731 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11715 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 733:
#line 2732 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11721 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 734:
#line 2733 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11727 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 735:
#line 2734 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11733 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 736:
#line 2735 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11739 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 737:
#line 2736 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11745 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 738:
#line 2737 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11751 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 739:
#line 2738 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11757 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 740:
#line 2739 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11763 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 741:
#line 2740 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11769 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 742:
#line 2741 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11775 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 743:
#line 2742 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11781 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 744:
#line 2743 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11787 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 745:
#line 2744 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11793 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 746:
#line 2745 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11799 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 747:
#line 2746 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11805 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 748:
#line 2747 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11811 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 749:
#line 2748 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11817 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 750:
#line 2749 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11823 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 751:
#line 2750 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11829 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 752:
#line 2751 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11835 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 753:
#line 2752 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11841 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 754:
#line 2753 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11847 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 755:
#line 2754 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11853 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 756:
#line 2755 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11859 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 757:
#line 2756 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11865 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 758:
#line 2757 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11871 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 759:
#line 2758 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11877 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 760:
#line 2763 "hphp.y" /* yacc.c:1646 */
{ _p->onCall((yyval),0,(yyvsp[-3]),(yyvsp[-1]),NULL);}
#line 11883 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 761:
#line 2767 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11889 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 762:
#line 2768 "hphp.y" /* yacc.c:1646 */
{ (yyvsp[0]).xhpLabel(); (yyval) = (yyvsp[0]);}
#line 11895 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 763:
#line 2772 "hphp.y" /* yacc.c:1646 */
{ _p->onName((yyval),(yyvsp[0]),Parser::StringName);}
#line 11901 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 764:
#line 2773 "hphp.y" /* yacc.c:1646 */
{ _p->onName((yyval),(yyvsp[0]),Parser::StringName);}
#line 11907 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 765:
#line 2774 "hphp.y" /* yacc.c:1646 */
{ _p->onName((yyval),(yyvsp[0]),Parser::StaticName);}
#line 11913 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 766:
#line 2775 "hphp.y" /* yacc.c:1646 */
{ _p->onName((yyval),(yyvsp[0]),
Parser::StaticClassExprName);}
#line 11920 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 767:
#line 2777 "hphp.y" /* yacc.c:1646 */
{ _p->onName((yyval),(yyvsp[-1]),
Parser::StaticClassExprName);}
#line 11927 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 768:
#line 2781 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
#line 11933 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 769:
#line 2790 "hphp.y" /* yacc.c:1646 */
{ _p->onStaticMember((yyval),(yyvsp[-2]),(yyvsp[0]));}
#line 11939 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 770:
#line 2793 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
#line 11945 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 771:
#line 2794 "hphp.y" /* yacc.c:1646 */
{ _p->onName((yyval),(yyvsp[0]),
Parser::StaticClassExprName);}
#line 11952 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 772:
#line 2796 "hphp.y" /* yacc.c:1646 */
{ _p->onName((yyval), (yyvsp[0]),
Parser::StaticClassExprName);}
#line 11959 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 773:
#line 2806 "hphp.y" /* yacc.c:1646 */
{ _p->onStaticMember((yyval),(yyvsp[-2]),(yyvsp[0]));}
#line 11965 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 774:
#line 2810 "hphp.y" /* yacc.c:1646 */
{ _p->onName((yyval),(yyvsp[0]),Parser::StringName);}
#line 11971 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 775:
#line 2811 "hphp.y" /* yacc.c:1646 */
{ _p->onName((yyval),(yyvsp[0]),Parser::StaticName);}
#line 11977 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 776:
#line 2812 "hphp.y" /* yacc.c:1646 */
{ _p->onName((yyval),(yyvsp[0]),Parser::ExprName);}
#line 11983 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 777:
#line 2816 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 11989 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 778:
#line 2817 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 11995 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 779:
#line 2818 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 12001 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 780:
#line 2822 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 12007 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 781:
#line 2823 "hphp.y" /* yacc.c:1646 */
{ _p->addEncap((yyval), NULL, (yyvsp[0]), 0);}
#line 12013 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 782:
#line 2824 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 12019 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 783:
#line 2828 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 12025 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 784:
#line 2829 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 12031 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 785:
#line 2833 "hphp.y" /* yacc.c:1646 */
{ _p->onScalar((yyval), T_LNUMBER, (yyvsp[0]));}
#line 12037 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 786:
#line 2834 "hphp.y" /* yacc.c:1646 */
{ _p->onScalar((yyval), T_DNUMBER, (yyvsp[0]));}
#line 12043 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 787:
#line 2835 "hphp.y" /* yacc.c:1646 */
{ _p->onScalar((yyval), T_ONUMBER, (yyvsp[0]));}
#line 12049 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 788:
#line 2836 "hphp.y" /* yacc.c:1646 */
{ _p->onScalar((yyval),
T_CONSTANT_ENCAPSED_STRING, (yyvsp[0]));}
#line 12056 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 789:
#line 2838 "hphp.y" /* yacc.c:1646 */
{ _p->onScalar((yyval), T_LINE, (yyvsp[0]));}
#line 12062 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 790:
#line 2839 "hphp.y" /* yacc.c:1646 */
{ _p->onScalar((yyval), T_FILE, (yyvsp[0]));}
#line 12068 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 791:
#line 2840 "hphp.y" /* yacc.c:1646 */
{ _p->onScalar((yyval), T_DIR, (yyvsp[0]));}
#line 12074 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 792:
#line 2841 "hphp.y" /* yacc.c:1646 */
{ _p->onScalar((yyval), T_CLASS_C, (yyvsp[0]));}
#line 12080 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 793:
#line 2842 "hphp.y" /* yacc.c:1646 */
{ _p->onScalar((yyval), T_TRAIT_C, (yyvsp[0]));}
#line 12086 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 794:
#line 2843 "hphp.y" /* yacc.c:1646 */
{ _p->onScalar((yyval), T_METHOD_C, (yyvsp[0]));}
#line 12092 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 795:
#line 2844 "hphp.y" /* yacc.c:1646 */
{ _p->onScalar((yyval), T_FUNC_C, (yyvsp[0]));}
#line 12098 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 796:
#line 2845 "hphp.y" /* yacc.c:1646 */
{ _p->onScalar((yyval), T_NS_C, (yyvsp[0]));}
#line 12104 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 797:
#line 2846 "hphp.y" /* yacc.c:1646 */
{ _p->onScalar((yyval), T_COMPILER_HALT_OFFSET, (yyvsp[0]));}
#line 12110 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 798:
#line 2849 "hphp.y" /* yacc.c:1646 */
{ _p->onScalar((yyval), T_CONSTANT_ENCAPSED_STRING, (yyvsp[-1]));}
#line 12116 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 799:
#line 2851 "hphp.y" /* yacc.c:1646 */
{ (yyval).setText(""); _p->onScalar((yyval), T_CONSTANT_ENCAPSED_STRING, (yyval));}
#line 12122 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 800:
#line 2855 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 12128 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 801:
#line 2856 "hphp.y" /* yacc.c:1646 */
{ _p->onConstantValue((yyval), (yyvsp[0]));}
#line 12134 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 802:
#line 2858 "hphp.y" /* yacc.c:1646 */
{ _p->onArray((yyval),(yyvsp[-1]),T_ARRAY); }
#line 12140 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 803:
#line 2859 "hphp.y" /* yacc.c:1646 */
{ _p->onArray((yyval),(yyvsp[-1]),T_ARRAY); }
#line 12146 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 804:
#line 2861 "hphp.y" /* yacc.c:1646 */
{ _p->onDArray((yyval),(yyvsp[-1]));}
#line 12152 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 805:
#line 2862 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 12158 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 806:
#line 2863 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 12164 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 807:
#line 2864 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 12170 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 808:
#line 2865 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 12176 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 809:
#line 2866 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 12182 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 810:
#line 2867 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 12188 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 811:
#line 2868 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 12194 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 812:
#line 2869 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 12200 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 813:
#line 2870 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 12206 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 814:
#line 2872 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_BOOLEAN_OR);}
#line 12212 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 815:
#line 2874 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_BOOLEAN_AND);}
#line 12218 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 816:
#line 2876 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_LOGICAL_OR);}
#line 12224 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 817:
#line 2878 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_LOGICAL_AND);}
#line 12230 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 818:
#line 2880 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_LOGICAL_XOR);}
#line 12236 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 819:
#line 2881 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),'|');}
#line 12242 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 820:
#line 2882 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),'&');}
#line 12248 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 821:
#line 2883 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),'^');}
#line 12254 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 822:
#line 2884 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),'.');}
#line 12260 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 823:
#line 2885 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),'+');}
#line 12266 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 824:
#line 2886 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),'-');}
#line 12272 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 825:
#line 2887 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),'*');}
#line 12278 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 826:
#line 2888 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),'/');}
#line 12284 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 827:
#line 2889 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),'%');}
#line 12290 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 828:
#line 2890 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_SL);}
#line 12296 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 829:
#line 2891 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_SR);}
#line 12302 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 830:
#line 2892 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_POW);}
#line 12308 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 831:
#line 2893 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[0]),'!',1);}
#line 12314 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 832:
#line 2894 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[0]),'~',1);}
#line 12320 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 833:
#line 2895 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[0]),'+',1);}
#line 12326 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 834:
#line 2896 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[0]),'-',1);}
#line 12332 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 835:
#line 2898 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_IS_IDENTICAL);}
#line 12338 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 836:
#line 2900 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_IS_NOT_IDENTICAL);}
#line 12344 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 837:
#line 2902 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_IS_EQUAL);}
#line 12350 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 838:
#line 2904 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_IS_NOT_EQUAL);}
#line 12356 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 839:
#line 2905 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),'<');}
#line 12362 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 840:
#line 2907 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),
T_IS_SMALLER_OR_EQUAL);}
#line 12369 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 841:
#line 2909 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),'>');}
#line 12375 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 842:
#line 2912 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),
T_IS_GREATER_OR_EQUAL);}
#line 12382 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 843:
#line 2916 "hphp.y" /* yacc.c:1646 */
{ BEXP((yyval),(yyvsp[-2]),(yyvsp[0]),T_SPACESHIP);}
#line 12388 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 844:
#line 2919 "hphp.y" /* yacc.c:1646 */
{ _p->onQOp((yyval), (yyvsp[-4]), &(yyvsp[-2]), (yyvsp[0]));}
#line 12394 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 845:
#line 2920 "hphp.y" /* yacc.c:1646 */
{ _p->onQOp((yyval), (yyvsp[-3]), 0, (yyvsp[0]));}
#line 12400 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 846:
#line 2924 "hphp.y" /* yacc.c:1646 */
{ _p->onExprListElem((yyval), &(yyvsp[-2]), (yyvsp[0]));}
#line 12406 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 847:
#line 2925 "hphp.y" /* yacc.c:1646 */
{ _p->onExprListElem((yyval), NULL, (yyvsp[0]));}
#line 12412 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 848:
#line 2931 "hphp.y" /* yacc.c:1646 */
{ _p->onClassClass((yyval), (yyvsp[-2]), (yyvsp[0]), 1);}
#line 12418 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 849:
#line 2937 "hphp.y" /* yacc.c:1646 */
{ _p->onClassConst((yyval), (yyvsp[-2]), (yyvsp[0]), 1);}
#line 12424 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 850:
#line 2938 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 12430 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 851:
#line 2942 "hphp.y" /* yacc.c:1646 */
{ _p->onConstantValue((yyval), (yyvsp[0]));}
#line 12436 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 852:
#line 2943 "hphp.y" /* yacc.c:1646 */
{ _p->onConstantValue((yyval), (yyvsp[0]));}
#line 12442 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 853:
#line 2944 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 12448 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 854:
#line 2945 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 12454 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 855:
#line 2946 "hphp.y" /* yacc.c:1646 */
{ _p->onEncapsList((yyval),'"',(yyvsp[-1]));}
#line 12460 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 856:
#line 2947 "hphp.y" /* yacc.c:1646 */
{ _p->onEncapsList((yyval),'\'',(yyvsp[-1]));}
#line 12466 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 857:
#line 2949 "hphp.y" /* yacc.c:1646 */
{ _p->onEncapsList((yyval),T_START_HEREDOC,
(yyvsp[-1]));}
#line 12473 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 858:
#line 2954 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 12479 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 859:
#line 2955 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 12485 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 860:
#line 2959 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 12491 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 861:
#line 2960 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 12497 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 862:
#line 2963 "hphp.y" /* yacc.c:1646 */
{ only_in_hh_syntax(_p); (yyval).reset();}
#line 12503 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 863:
#line 2964 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 12509 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 864:
#line 2970 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval),&(yyvsp[-4]),&(yyvsp[-2]),(yyvsp[0]),0);}
#line 12515 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 865:
#line 2972 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval),&(yyvsp[-2]), 0,(yyvsp[0]),0);}
#line 12521 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 866:
#line 2974 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval), 0,&(yyvsp[-2]),(yyvsp[0]),0);}
#line 12527 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 867:
#line 2975 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval), 0, 0,(yyvsp[0]),0);}
#line 12533 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 868:
#line 2979 "hphp.y" /* yacc.c:1646 */
{ _p->onScalar((yyval), T_LNUMBER, (yyvsp[0]));}
#line 12539 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 869:
#line 2980 "hphp.y" /* yacc.c:1646 */
{ _p->onScalar((yyval), T_DNUMBER, (yyvsp[0]));}
#line 12545 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 870:
#line 2981 "hphp.y" /* yacc.c:1646 */
{ _p->onScalar((yyval), T_ONUMBER, (yyvsp[0]));}
#line 12551 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 871:
#line 2984 "hphp.y" /* yacc.c:1646 */
{ _p->onScalar((yyval), T_CONSTANT_ENCAPSED_STRING, (yyvsp[-1]));}
#line 12557 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 872:
#line 2986 "hphp.y" /* yacc.c:1646 */
{ (yyval).setText(""); _p->onScalar((yyval), T_CONSTANT_ENCAPSED_STRING, (yyval));}
#line 12563 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 873:
#line 2989 "hphp.y" /* yacc.c:1646 */
{ _p->onScalar((yyval),T_LNUMBER,(yyvsp[0]));}
#line 12569 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 874:
#line 2990 "hphp.y" /* yacc.c:1646 */
{ _p->onScalar((yyval),T_DNUMBER,(yyvsp[0]));}
#line 12575 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 875:
#line 2991 "hphp.y" /* yacc.c:1646 */
{ _p->onScalar((yyval),T_ONUMBER,(yyvsp[0]));}
#line 12581 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 876:
#line 2992 "hphp.y" /* yacc.c:1646 */
{ constant_ae(_p,(yyval),(yyvsp[0]));}
#line 12587 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 877:
#line 2996 "hphp.y" /* yacc.c:1646 */
{ _p->onScalar((yyval),
T_CONSTANT_ENCAPSED_STRING,(yyvsp[0]));}
#line 12594 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 878:
#line 2999 "hphp.y" /* yacc.c:1646 */
{ _p->onScalar((yyval),
T_CONSTANT_ENCAPSED_STRING,
(yyvsp[-2]) + (yyvsp[0]));}
#line 12602 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 880:
#line 3006 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 12608 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 881:
#line 3007 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 12614 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 882:
#line 3010 "hphp.y" /* yacc.c:1646 */
{ HPHP_PARSER_ERROR("User-defined "
"constants are not allowed in "
"user attribute expressions", _p);}
#line 12622 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 883:
#line 3013 "hphp.y" /* yacc.c:1646 */
{ constant_ae(_p,(yyval),(yyvsp[0]));}
#line 12628 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 884:
#line 3014 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[0]),'+',1);}
#line 12634 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 885:
#line 3015 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[0]),'-',1);}
#line 12640 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 886:
#line 3017 "hphp.y" /* yacc.c:1646 */
{ _p->onArray((yyval),(yyvsp[-1]),T_ARRAY);}
#line 12646 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 887:
#line 3018 "hphp.y" /* yacc.c:1646 */
{ _p->onArray((yyval),(yyvsp[-1]),T_ARRAY);}
#line 12652 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 888:
#line 3020 "hphp.y" /* yacc.c:1646 */
{ _p->onDArray((yyval),(yyvsp[-1]));}
#line 12658 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 889:
#line 3021 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 12664 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 890:
#line 3022 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 12670 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 891:
#line 3023 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 12676 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 892:
#line 3024 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 12682 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 893:
#line 3025 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 12688 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 894:
#line 3026 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 12694 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 895:
#line 3031 "hphp.y" /* yacc.c:1646 */
{ _p->onExprListElem((yyval), &(yyvsp[-2]), (yyvsp[0]));}
#line 12700 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 896:
#line 3032 "hphp.y" /* yacc.c:1646 */
{ _p->onExprListElem((yyval), NULL, (yyvsp[0]));}
#line 12706 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 897:
#line 3037 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 12712 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 898:
#line 3038 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 12718 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 899:
#line 3043 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval),&(yyvsp[-4]),&(yyvsp[-2]),(yyvsp[0]),0);}
#line 12724 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 900:
#line 3045 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval),&(yyvsp[-2]), 0,(yyvsp[0]),0);}
#line 12730 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 901:
#line 3047 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval), 0,&(yyvsp[-2]),(yyvsp[0]),0);}
#line 12736 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 902:
#line 3048 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval), 0, 0,(yyvsp[0]),0);}
#line 12742 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 903:
#line 3052 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval),&(yyvsp[-2]), 0,(yyvsp[0]),0);}
#line 12748 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 904:
#line 3053 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval), 0, 0,(yyvsp[0]),0);}
#line 12754 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 905:
#line 3058 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
#line 12760 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 906:
#line 3059 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset(); }
#line 12766 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 907:
#line 3064 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval),&(yyvsp[-4]),&(yyvsp[-2]),(yyvsp[0]),0); }
#line 12772 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 908:
#line 3067 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval), 0,&(yyvsp[-2]),(yyvsp[0]),0); }
#line 12778 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 909:
#line 3072 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 12784 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 910:
#line 3073 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 12790 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 911:
#line 3076 "hphp.y" /* yacc.c:1646 */
{ _p->onArray((yyval),(yyvsp[-1]),T_ARRAY);}
#line 12796 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 912:
#line 3077 "hphp.y" /* yacc.c:1646 */
{ Token t; t.reset();
_p->onArray((yyval),t,T_ARRAY);}
#line 12803 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 913:
#line 3084 "hphp.y" /* yacc.c:1646 */
{ _p->onUserAttribute((yyval),&(yyvsp[-3]),(yyvsp[-1]),(yyvsp[0]));}
#line 12809 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 914:
#line 3086 "hphp.y" /* yacc.c:1646 */
{ _p->onUserAttribute((yyval), 0,(yyvsp[-1]),(yyvsp[0]));}
#line 12815 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 915:
#line 3089 "hphp.y" /* yacc.c:1646 */
{ only_in_hh_syntax(_p);}
#line 12821 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 916:
#line 3091 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 12827 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 917:
#line 3094 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 12833 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 918:
#line 3097 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 12839 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 919:
#line 3098 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 12845 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 920:
#line 3102 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); (yyval) = 0;}
#line 12851 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 921:
#line 3103 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); (yyval) = 1;}
#line 12857 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 922:
#line 3107 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); (yyval) = HPHP::ObjPropNormal;}
#line 12863 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 923:
#line 3108 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); (yyval) = HPHP::ObjPropXhpAttr;}
#line 12869 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 924:
#line 3109 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); (yyval) = HPHP::ObjPropNormal;}
#line 12875 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 925:
#line 3113 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 12881 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 926:
#line 3118 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); (yyval) = HPHP::ObjPropNormal;}
#line 12887 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 927:
#line 3123 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 12893 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 928:
#line 3124 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 12899 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 929:
#line 3128 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 12905 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 930:
#line 3133 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 12911 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 931:
#line 3138 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 12917 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 932:
#line 3139 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 12923 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 933:
#line 3144 "hphp.y" /* yacc.c:1646 */
{ _p->onRefDim((yyval), (yyvsp[-1]), (yyvsp[0]));}
#line 12929 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 934:
#line 3145 "hphp.y" /* yacc.c:1646 */
{ _p->onRefDim((yyval), (yyvsp[-1]), (yyvsp[0]));}
#line 12935 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 935:
#line 3147 "hphp.y" /* yacc.c:1646 */
{ _p->onRefDim((yyval), (yyvsp[-1]), (yyvsp[0]));}
#line 12941 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 936:
#line 3152 "hphp.y" /* yacc.c:1646 */
{ _p->onRefDim((yyval), (yyvsp[-1]), (yyvsp[0]));}
#line 12947 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 937:
#line 3154 "hphp.y" /* yacc.c:1646 */
{ _p->onRefDim((yyval), (yyvsp[-2]), (yyvsp[0]));}
#line 12953 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 938:
#line 3160 "hphp.y" /* yacc.c:1646 */
{ _p->onObjectProperty(
(yyval),
(yyvsp[-3]),
!(yyvsp[-1]).num()
? HPHP::PropAccessType::Normal
: HPHP::PropAccessType::NullSafe,
(yyvsp[0])
);
}
#line 12967 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 939:
#line 3171 "hphp.y" /* yacc.c:1646 */
{ _p->onObjectProperty(
(yyval),
(yyvsp[-3]),
!(yyvsp[-1]).num()
? HPHP::PropAccessType::Normal
: HPHP::PropAccessType::NullSafe,
(yyvsp[0])
);
}
#line 12981 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 940:
#line 3186 "hphp.y" /* yacc.c:1646 */
{ _p->onObjectProperty(
(yyval),
(yyvsp[-3]),
!(yyvsp[-1]).num()
? HPHP::PropAccessType::Normal
: HPHP::PropAccessType::NullSafe,
(yyvsp[0])
);
}
#line 12995 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 941:
#line 3198 "hphp.y" /* yacc.c:1646 */
{ _p->onObjectProperty(
(yyval),
(yyvsp[-3]),
!(yyvsp[-1]).num()
? HPHP::PropAccessType::Normal
: HPHP::PropAccessType::NullSafe,
(yyvsp[0])
);
}
#line 13009 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 942:
#line 3210 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 13015 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 943:
#line 3211 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 13021 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 944:
#line 3212 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 13027 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 945:
#line 3213 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 13033 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 946:
#line 3214 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 13039 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 947:
#line 3215 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 13045 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 948:
#line 3217 "hphp.y" /* yacc.c:1646 */
{ _p->onObjectProperty(
(yyval),
(yyvsp[-2]),
!(yyvsp[-1]).num()
? HPHP::PropAccessType::Normal
: HPHP::PropAccessType::NullSafe,
(yyvsp[0])
);
}
#line 13059 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 949:
#line 3234 "hphp.y" /* yacc.c:1646 */
{ _p->onStaticMember((yyval),(yyvsp[-2]),(yyvsp[0]));}
#line 13065 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 950:
#line 3236 "hphp.y" /* yacc.c:1646 */
{ _p->onCall((yyval),1,(yyvsp[-3]),(yyvsp[-1]),NULL);}
#line 13071 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 951:
#line 3238 "hphp.y" /* yacc.c:1646 */
{ _p->onCall((yyval),1,(yyvsp[-3]),(yyvsp[-1]),NULL);}
#line 13077 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 952:
#line 3239 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 13083 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 953:
#line 3243 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
#line 13089 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 954:
#line 3247 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 13095 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 955:
#line 3248 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 13101 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 956:
#line 3249 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 13107 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 957:
#line 3250 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 13113 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 958:
#line 3258 "hphp.y" /* yacc.c:1646 */
{ _p->onObjectProperty(
(yyval),
(yyvsp[-2]),
!(yyvsp[-1]).num()
? HPHP::PropAccessType::Normal
: HPHP::PropAccessType::NullSafe,
(yyvsp[0])
);
}
#line 13127 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 959:
#line 3267 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 13133 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 960:
#line 3269 "hphp.y" /* yacc.c:1646 */
{ _p->onCall((yyval),1,(yyvsp[-3]),(yyvsp[-1]),NULL);}
#line 13139 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 961:
#line 3273 "hphp.y" /* yacc.c:1646 */
{ _p->onStaticMember((yyval),(yyvsp[-2]),(yyvsp[0]));}
#line 13145 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 962:
#line 3278 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 13151 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 963:
#line 3279 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 13157 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 964:
#line 3280 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 13163 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 965:
#line 3281 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 13169 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 966:
#line 3282 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 13175 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 967:
#line 3283 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 13181 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 968:
#line 3284 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 13187 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 969:
#line 3286 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 13193 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 970:
#line 3287 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 13199 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 971:
#line 3290 "hphp.y" /* yacc.c:1646 */
{ _p->onCall((yyval),1,(yyvsp[-3]),(yyvsp[-1]),NULL);}
#line 13205 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 972:
#line 3292 "hphp.y" /* yacc.c:1646 */
{ _p->onCall((yyval),1,(yyvsp[-3]),(yyvsp[-1]),NULL);}
#line 13211 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 973:
#line 3296 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 13217 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 974:
#line 3300 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 13223 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 975:
#line 3301 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 13229 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 976:
#line 3307 "hphp.y" /* yacc.c:1646 */
{ _p->onObjectMethodCall((yyval),(yyvsp[-6]),(yyvsp[-5]).num(),(yyvsp[-4]),(yyvsp[-1]));}
#line 13235 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 977:
#line 3311 "hphp.y" /* yacc.c:1646 */
{ _p->onObjectMethodCall((yyval),(yyvsp[-7]),(yyvsp[-5]).num(),(yyvsp[-4]),(yyvsp[-1]));}
#line 13241 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 978:
#line 3315 "hphp.y" /* yacc.c:1646 */
{ _p->onObjectMethodCall((yyval),(yyvsp[-7]),(yyvsp[-5]).num(),(yyvsp[-4]),(yyvsp[-1]));}
#line 13247 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 979:
#line 3322 "hphp.y" /* yacc.c:1646 */
{ _p->onCall((yyval),0,(yyvsp[-4]),(yyvsp[-1]),&(yyvsp[-6]));}
#line 13253 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 980:
#line 3331 "hphp.y" /* yacc.c:1646 */
{ _p->onCall((yyval),1,(yyvsp[-3]),(yyvsp[-1]),&(yyvsp[-5]));}
#line 13259 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 981:
#line 3335 "hphp.y" /* yacc.c:1646 */
{ _p->onCall((yyval),1,(yyvsp[-4]),(yyvsp[-1]),&(yyvsp[-7]));}
#line 13265 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 982:
#line 3339 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 13271 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 983:
#line 3348 "hphp.y" /* yacc.c:1646 */
{ _p->onRefDim((yyval), (yyvsp[-3]), (yyvsp[-1]));}
#line 13277 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 984:
#line 3349 "hphp.y" /* yacc.c:1646 */
{ _p->onRefDim((yyval), (yyvsp[-3]), (yyvsp[-1]));}
#line 13283 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 985:
#line 3350 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 13289 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 986:
#line 3354 "hphp.y" /* yacc.c:1646 */
{ _p->onSimpleVariable((yyval), (yyvsp[0]));}
#line 13295 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 987:
#line 3355 "hphp.y" /* yacc.c:1646 */
{ _p->onPipeVariable((yyval));}
#line 13301 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 988:
#line 3356 "hphp.y" /* yacc.c:1646 */
{ _p->onDynamicVariable((yyval), (yyvsp[-1]), 0);}
#line 13307 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 989:
#line 3358 "hphp.y" /* yacc.c:1646 */
{ (yyvsp[-1]) = 1; _p->onIndirectRef((yyval), (yyvsp[-1]), (yyvsp[0]));}
#line 13313 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 990:
#line 3363 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 13319 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 991:
#line 3364 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 13325 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 992:
#line 3375 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 13331 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 993:
#line 3376 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 13337 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 994:
#line 3377 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 13343 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 995:
#line 3380 "hphp.y" /* yacc.c:1646 */
{ _p->onObjectProperty(
(yyval),
(yyvsp[-2]),
!(yyvsp[-1]).num()
? HPHP::PropAccessType::Normal
: HPHP::PropAccessType::NullSafe,
(yyvsp[0])
);
}
#line 13357 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 996:
#line 3391 "hphp.y" /* yacc.c:1646 */
{ _p->onStaticMember((yyval),(yyvsp[-2]),(yyvsp[0]));}
#line 13363 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 997:
#line 3392 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 13369 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 999:
#line 3396 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 13375 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1000:
#line 3397 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
#line 13381 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1001:
#line 3400 "hphp.y" /* yacc.c:1646 */
{ _p->onObjectProperty(
(yyval),
(yyvsp[-2]),
!(yyvsp[-1]).num()
? HPHP::PropAccessType::Normal
: HPHP::PropAccessType::NullSafe,
(yyvsp[0])
);
}
#line 13395 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1002:
#line 3409 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 13401 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1003:
#line 3413 "hphp.y" /* yacc.c:1646 */
{ _p->onAListVar((yyval),&(yyvsp[-1]),NULL);}
#line 13407 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1004:
#line 3414 "hphp.y" /* yacc.c:1646 */
{ _p->onAListVar((yyval),&(yyvsp[-2]),&(yyvsp[0]));}
#line 13413 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1005:
#line 3416 "hphp.y" /* yacc.c:1646 */
{ _p->onAListSub((yyval),&(yyvsp[-5]),(yyvsp[-1]));}
#line 13419 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1006:
#line 3417 "hphp.y" /* yacc.c:1646 */
{ _p->onAListVar((yyval),NULL,NULL);}
#line 13425 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1007:
#line 3418 "hphp.y" /* yacc.c:1646 */
{ _p->onAListVar((yyval),NULL,&(yyvsp[0]));}
#line 13431 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1008:
#line 3419 "hphp.y" /* yacc.c:1646 */
{ _p->onAListSub((yyval),NULL,(yyvsp[-1]));}
#line 13437 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1009:
#line 3424 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 13443 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1010:
#line 3425 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset();}
#line 13449 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1011:
#line 3429 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval),&(yyvsp[-4]),&(yyvsp[-2]),(yyvsp[0]),0);}
#line 13455 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1012:
#line 3430 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval),&(yyvsp[-2]), 0,(yyvsp[0]),0);}
#line 13461 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1013:
#line 3431 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval), 0,&(yyvsp[-2]),(yyvsp[0]),0);}
#line 13467 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1014:
#line 3432 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval), 0, 0,(yyvsp[0]),0);}
#line 13473 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1015:
#line 3435 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval),&(yyvsp[-5]),&(yyvsp[-3]),(yyvsp[0]),1);}
#line 13479 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1016:
#line 3437 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval),&(yyvsp[-3]), 0,(yyvsp[0]),1);}
#line 13485 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1017:
#line 3438 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval), 0,&(yyvsp[-3]),(yyvsp[0]),1);}
#line 13491 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1018:
#line 3439 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval), 0, 0,(yyvsp[0]),1);}
#line 13497 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1019:
#line 3444 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 13503 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1020:
#line 3445 "hphp.y" /* yacc.c:1646 */
{ _p->onEmptyCollection((yyval));}
#line 13509 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1021:
#line 3449 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval),&(yyvsp[-4]),&(yyvsp[-2]),(yyvsp[0]),0);}
#line 13515 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1022:
#line 3450 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval),&(yyvsp[-2]), 0,(yyvsp[0]),0);}
#line 13521 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1023:
#line 3451 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval), 0,&(yyvsp[-2]),(yyvsp[0]),0);}
#line 13527 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1024:
#line 3452 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval), 0, 0,(yyvsp[0]),0);}
#line 13533 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1025:
#line 3457 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 13539 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1026:
#line 3458 "hphp.y" /* yacc.c:1646 */
{ _p->onEmptyCollection((yyval));}
#line 13545 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1027:
#line 3463 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval),&(yyvsp[-4]),&(yyvsp[-2]),(yyvsp[0]),0);}
#line 13551 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1028:
#line 3465 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval),&(yyvsp[-2]), 0,(yyvsp[0]),0);}
#line 13557 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1029:
#line 3467 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval), 0,&(yyvsp[-2]),(yyvsp[0]),0);}
#line 13563 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1030:
#line 3468 "hphp.y" /* yacc.c:1646 */
{ _p->onArrayPair((yyval), 0, 0,(yyvsp[0]),0);}
#line 13569 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1031:
#line 3472 "hphp.y" /* yacc.c:1646 */
{ _p->addEncap((yyval), &(yyvsp[-1]), (yyvsp[0]), -1);}
#line 13575 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1032:
#line 3474 "hphp.y" /* yacc.c:1646 */
{ _p->addEncap((yyval), &(yyvsp[-1]), (yyvsp[0]), 0);}
#line 13581 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1033:
#line 3475 "hphp.y" /* yacc.c:1646 */
{ _p->addEncap((yyval), NULL, (yyvsp[0]), -1);}
#line 13587 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1034:
#line 3477 "hphp.y" /* yacc.c:1646 */
{ _p->addEncap((yyval), NULL, (yyvsp[-1]), 0);
_p->addEncap((yyval), &(yyval), (yyvsp[0]), -1); }
#line 13594 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1035:
#line 3482 "hphp.y" /* yacc.c:1646 */
{ _p->onSimpleVariable((yyval), (yyvsp[0]));}
#line 13600 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1036:
#line 3484 "hphp.y" /* yacc.c:1646 */
{ _p->encapRefDim((yyval), (yyvsp[-3]), (yyvsp[-1]));}
#line 13606 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1037:
#line 3486 "hphp.y" /* yacc.c:1646 */
{ _p->encapObjProp(
(yyval),
(yyvsp[-2]),
!(yyvsp[-1]).num()
? HPHP::PropAccessType::Normal
: HPHP::PropAccessType::NullSafe,
(yyvsp[0])
);
}
#line 13620 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1038:
#line 3496 "hphp.y" /* yacc.c:1646 */
{ _p->onDynamicVariable((yyval), (yyvsp[-1]), 1);}
#line 13626 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1039:
#line 3498 "hphp.y" /* yacc.c:1646 */
{ _p->encapArray((yyval), (yyvsp[-4]), (yyvsp[-2]));}
#line 13632 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1040:
#line 3499 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);}
#line 13638 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1041:
#line 3502 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); (yyval) = T_STRING;}
#line 13644 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1042:
#line 3503 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); (yyval) = T_NUM_STRING;}
#line 13650 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1043:
#line 3504 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); (yyval) = T_VARIABLE;}
#line 13656 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1044:
#line 3508 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[-1]),T_ISSET,1);}
#line 13662 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1045:
#line 3509 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[-1]),T_EMPTY,1);}
#line 13668 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1046:
#line 3510 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[-1]),'!',1);}
#line 13674 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1047:
#line 3511 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[-1]),'!',1);}
#line 13680 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1048:
#line 3512 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[-1]),'!',1);}
#line 13686 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1049:
#line 3513 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[-1]),'!',1);}
#line 13692 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1050:
#line 3514 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[0]),T_INCLUDE,1);}
#line 13698 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1051:
#line 3515 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[0]),T_INCLUDE_ONCE,1);}
#line 13704 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1052:
#line 3516 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[-1]),T_EVAL,1);}
#line 13710 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1053:
#line 3517 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[0]),T_REQUIRE,1);}
#line 13716 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1054:
#line 3518 "hphp.y" /* yacc.c:1646 */
{ UEXP((yyval),(yyvsp[0]),T_REQUIRE_ONCE,1);}
#line 13722 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1055:
#line 3522 "hphp.y" /* yacc.c:1646 */
{ _p->onExprListElem((yyval), NULL, (yyvsp[0]));}
#line 13728 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1056:
#line 3523 "hphp.y" /* yacc.c:1646 */
{ _p->onExprListElem((yyval), &(yyvsp[-2]), (yyvsp[0]));}
#line 13734 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1057:
#line 3528 "hphp.y" /* yacc.c:1646 */
{ _p->onClassConst((yyval), (yyvsp[-2]), (yyvsp[0]), 0);}
#line 13740 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1058:
#line 3530 "hphp.y" /* yacc.c:1646 */
{ _p->onClassClass((yyval), (yyvsp[-2]), (yyvsp[0]), 0);}
#line 13746 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1061:
#line 3544 "hphp.y" /* yacc.c:1646 */
{ (yyvsp[-3]).setText(_p->nsClassDecl((yyvsp[-3]).text()));
_p->onTypedef((yyval), (yyvsp[-3]), (yyvsp[-1]));
_p->popTypeScope(); }
#line 13754 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1062:
#line 3549 "hphp.y" /* yacc.c:1646 */
{ (yyvsp[-3]).setText(_p->nsClassDecl((yyvsp[-3]).text()));
_p->onTypedef((yyval), (yyvsp[-3]), (yyvsp[-1]), &(yyvsp[-5]));
_p->popTypeScope(); }
#line 13762 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1063:
#line 3553 "hphp.y" /* yacc.c:1646 */
{ (yyvsp[-4]).setText(_p->nsClassDecl((yyvsp[-4]).text()));
_p->onTypedef((yyval), (yyvsp[-4]), (yyvsp[-1]));
_p->popTypeScope(); }
#line 13770 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1064:
#line 3558 "hphp.y" /* yacc.c:1646 */
{ (yyvsp[-4]).setText(_p->nsClassDecl((yyvsp[-4]).text()));
_p->onTypedef((yyval), (yyvsp[-4]), (yyvsp[-1]), &(yyvsp[-6]));
_p->popTypeScope(); }
#line 13778 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1065:
#line 3564 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
#line 13784 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1066:
#line 3565 "hphp.y" /* yacc.c:1646 */
{ only_in_hh_syntax(_p); (yyval) = (yyvsp[0]); }
#line 13790 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1067:
#line 3569 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
#line 13796 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1068:
#line 3570 "hphp.y" /* yacc.c:1646 */
{ only_in_hh_syntax(_p); (yyval) = (yyvsp[0]); }
#line 13802 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1069:
#line 3576 "hphp.y" /* yacc.c:1646 */
{ _p->pushTypeScope(); (yyval) = (yyvsp[0]); }
#line 13808 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1070:
#line 3580 "hphp.y" /* yacc.c:1646 */
{ _p->pushTypeScope(); (yyval) = (yyvsp[-3]); }
#line 13814 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1071:
#line 3586 "hphp.y" /* yacc.c:1646 */
{ _p->pushTypeScope(); (yyval) = (yyvsp[0]); }
#line 13820 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1072:
#line 3590 "hphp.y" /* yacc.c:1646 */
{ Token t; _p->setTypeVars(t, (yyvsp[-3]));
_p->pushTypeScope(); (yyval) = t; }
#line 13827 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1073:
#line 3597 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
#line 13833 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1074:
#line 3598 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset(); }
#line 13839 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1075:
#line 3602 "hphp.y" /* yacc.c:1646 */
{ Token t; t.reset();
_p->onTypeList((yyvsp[0]), t);
(yyval) = (yyvsp[0]); }
#line 13847 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1076:
#line 3605 "hphp.y" /* yacc.c:1646 */
{ _p->onTypeList((yyvsp[-2]), (yyvsp[0]));
(yyval) = (yyvsp[-2]); }
#line 13854 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1077:
#line 3611 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
#line 13860 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1078:
#line 3615 "hphp.y" /* yacc.c:1646 */
{ Token t; t.reset();
_p->onTypeList((yyvsp[0]), t);
(yyval) = (yyvsp[0]); }
#line 13868 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1079:
#line 3618 "hphp.y" /* yacc.c:1646 */
{ Token t; t.reset();
_p->onTypeList((yyvsp[0]), t);
(yyval) = (yyvsp[0]); }
#line 13876 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1080:
#line 3621 "hphp.y" /* yacc.c:1646 */
{ _p->onTypeList((yyvsp[-3]), (yyvsp[0]));
(yyval) = (yyvsp[-3]); }
#line 13883 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1081:
#line 3623 "hphp.y" /* yacc.c:1646 */
{ _p->onTypeList((yyvsp[-2]), (yyvsp[0]));
(yyval) = (yyvsp[-2]); }
#line 13890 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1082:
#line 3625 "hphp.y" /* yacc.c:1646 */
{ _p->onTypeList((yyvsp[-2]), (yyvsp[0]));
(yyval) = (yyvsp[-2]); }
#line 13897 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1083:
#line 3627 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset(); }
#line 13903 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1084:
#line 3632 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-3]); }
#line 13909 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1085:
#line 3633 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
#line 13915 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1086:
#line 3634 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset(); }
#line 13921 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1087:
#line 3635 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset(); }
#line 13927 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1094:
#line 3656 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset(); }
#line 13933 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1095:
#line 3657 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); (yyval) = 1; }
#line 13939 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1098:
#line 3666 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
#line 13945 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1101:
#line 3677 "hphp.y" /* yacc.c:1646 */
{ _p->addTypeVar((yyvsp[0]).text()); }
#line 13951 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1102:
#line 3679 "hphp.y" /* yacc.c:1646 */
{ _p->addTypeVar((yyvsp[0]).text()); }
#line 13957 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1103:
#line 3683 "hphp.y" /* yacc.c:1646 */
{ _p->addTypeVar((yyvsp[-1]).text()); }
#line 13963 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1104:
#line 3686 "hphp.y" /* yacc.c:1646 */
{ _p->addTypeVar((yyvsp[-1]).text()); }
#line 13969 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1105:
#line 3690 "hphp.y" /* yacc.c:1646 */
{}
#line 13975 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1106:
#line 3691 "hphp.y" /* yacc.c:1646 */
{}
#line 13981 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1107:
#line 3692 "hphp.y" /* yacc.c:1646 */
{}
#line 13987 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1108:
#line 3698 "hphp.y" /* yacc.c:1646 */
{ validate_shape_keyname((yyvsp[-2]), _p);
_p->onTypeAnnotation((yyval), (yyvsp[-2]), (yyvsp[0])); }
#line 13994 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1109:
#line 3703 "hphp.y" /* yacc.c:1646 */
{
validate_shape_keyname((yyvsp[-2]), _p);
_p->onTypeAnnotation((yyval), (yyvsp[-2]), (yyvsp[0]));
_p->onShapeFieldSpecialization((yyval), '?');
}
#line 14004 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1110:
#line 3712 "hphp.y" /* yacc.c:1646 */
{ _p->onClsCnsShapeField((yyval), (yyvsp[-4]), (yyvsp[-2]), (yyvsp[0])); }
#line 14010 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1111:
#line 3718 "hphp.y" /* yacc.c:1646 */
{
_p->onClsCnsShapeField((yyval), (yyvsp[-4]), (yyvsp[-2]), (yyvsp[0]));
_p->onShapeFieldSpecialization((yyval), '?');
}
#line 14019 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1112:
#line 3726 "hphp.y" /* yacc.c:1646 */
{ _p->onTypeList((yyval), (yyvsp[0])); }
#line 14025 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1113:
#line 3727 "hphp.y" /* yacc.c:1646 */
{ }
#line 14031 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1114:
#line 3733 "hphp.y" /* yacc.c:1646 */
{ _p->onShape((yyval), (yyvsp[-2]), true); }
#line 14037 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1115:
#line 3735 "hphp.y" /* yacc.c:1646 */
{ _p->onShape((yyval), (yyvsp[-1]), false); }
#line 14043 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1116:
#line 3736 "hphp.y" /* yacc.c:1646 */
{
Token t;
t.reset();
_p->onShape((yyval), t, true);
}
#line 14053 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1117:
#line 3741 "hphp.y" /* yacc.c:1646 */
{ Token t; t.reset();
_p->onShape((yyval), t, false); }
#line 14060 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1118:
#line 3747 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]);
(yyval).setText("HH\\darray"); }
#line 14067 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1119:
#line 3752 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
#line 14073 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1120:
#line 3757 "hphp.y" /* yacc.c:1646 */
{ Token t; t.reset();
_p->onTypeAnnotation((yyval), (yyvsp[-2]), t);
_p->onTypeList((yyval), (yyvsp[0])); }
#line 14081 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1121:
#line 3761 "hphp.y" /* yacc.c:1646 */
{ _p->onTypeAnnotation((yyval), (yyvsp[-1]), (yyvsp[0])); }
#line 14087 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1122:
#line 3766 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-2]);}
#line 14093 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1123:
#line 3768 "hphp.y" /* yacc.c:1646 */
{ _p->onTypeList((yyvsp[-3]), (yyvsp[-1])); (yyval) = (yyvsp[-3]);}
#line 14099 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1124:
#line 3774 "hphp.y" /* yacc.c:1646 */
{ _p->onTypeSpecialization((yyvsp[0]), '?');
(yyval) = (yyvsp[0]); }
#line 14106 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1125:
#line 3776 "hphp.y" /* yacc.c:1646 */
{ only_in_hh_syntax(_p);
_p->onTypeSpecialization((yyvsp[0]), '@');
(yyval) = (yyvsp[0]); }
#line 14114 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1126:
#line 3779 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
#line 14120 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1127:
#line 3780 "hphp.y" /* yacc.c:1646 */
{ Token t; t.reset();
(yyvsp[0]).setText("array");
_p->onTypeAnnotation((yyval), (yyvsp[0]), t); }
#line 14128 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1128:
#line 3783 "hphp.y" /* yacc.c:1646 */
{ Token t; t.reset();
(yyvsp[0]).setText("callable");
_p->onTypeAnnotation((yyval), (yyvsp[0]), t); }
#line 14136 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1129:
#line 3786 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
#line 14142 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1130:
#line 3789 "hphp.y" /* yacc.c:1646 */
{ only_in_hh_syntax(_p);
_p->onTypeAnnotation((yyval), (yyvsp[-2]), (yyvsp[0]));
_p->onTypeSpecialization((yyval), 'a'); }
#line 14150 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1131:
#line 3792 "hphp.y" /* yacc.c:1646 */
{ (yyvsp[-1]).setText("array");
_p->onTypeAnnotation((yyval), (yyvsp[-1]), (yyvsp[0])); }
#line 14157 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1132:
#line 3794 "hphp.y" /* yacc.c:1646 */
{ (yyvsp[0]).xhpLabel();
Token t; t.reset();
_p->onTypeAnnotation((yyval), (yyvsp[0]), t);
_p->onTypeSpecialization((yyval), 'x'); }
#line 14166 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1133:
#line 3800 "hphp.y" /* yacc.c:1646 */
{ only_in_hh_syntax(_p);
_p->onTypeList((yyvsp[-1]), (yyvsp[-4]));
_p->onTypeAnnotation((yyval), (yyvsp[-6]), (yyvsp[-1]));
_p->onTypeSpecialization((yyval), 'f'); }
#line 14175 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1134:
#line 3806 "hphp.y" /* yacc.c:1646 */
{ only_in_hh_syntax(_p);
_p->onTypeList((yyvsp[-4]), (yyvsp[-2]));
Token t; t.reset(); t.setText("HH\\varray");
_p->onTypeAnnotation((yyval), t, (yyvsp[-4]));
_p->onTypeSpecialization((yyval), 't'); }
#line 14185 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1135:
#line 3814 "hphp.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
#line 14191 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
case 1136:
#line 3815 "hphp.y" /* yacc.c:1646 */
{ (yyval).reset(); }
#line 14197 "hphp.7.tab.cpp" /* yacc.c:1646 */
break;
#line 14201 "hphp.7.tab.cpp" /* yacc.c:1646 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
that yytoken be updated with the new translation. We take the
approach of translating immediately before every use of yytoken.
One alternative is translating here after every semantic action,
but that translation would be missed if the semantic action invokes
YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
incorrect destructor might then be invoked immediately. In the
case of YYERROR or YYBACKUP, subsequent parser actions might lead
to an incorrect destructor call or verbose syntax error message
before the lookahead is translated. */
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
YYPOPSTACK (yylen);
yylen = 0;
YY_STACK_PRINT (yyss, yyssp);
*++yyvsp = yyval;
*++yylsp = yyloc;
/* Now 'shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
yyn = yyr1[yyn];
yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
yystate = yytable[yystate];
else
yystate = yydefgoto[yyn - YYNTOKENS];
goto yynewstate;
/*--------------------------------------.
| yyerrlab -- here on detecting error. |
`--------------------------------------*/
yyerrlab:
/* Make sure we have latest lookahead translation. See comments at
user semantic actions for why this is necessary. */
yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
/* If not already recovering from an error, report this error. */
if (!yyerrstatus)
{
++yynerrs;
#if ! YYERROR_VERBOSE
yyerror (&yylloc, _p, YY_("syntax error"));
#else
# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
yyssp, yytoken)
{
char const *yymsgp = YY_("syntax error");
int yysyntax_error_status;
yysyntax_error_status = YYSYNTAX_ERROR;
if (yysyntax_error_status == 0)
yymsgp = yymsg;
else if (yysyntax_error_status == 1)
{
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
if (!yymsg)
{
yymsg = yymsgbuf;
yymsg_alloc = sizeof yymsgbuf;
yysyntax_error_status = 2;
}
else
{
yysyntax_error_status = YYSYNTAX_ERROR;
yymsgp = yymsg;
}
}
yyerror (&yylloc, _p, yymsgp);
if (yysyntax_error_status == 2)
goto yyexhaustedlab;
}
# undef YYSYNTAX_ERROR
#endif
}
yyerror_range[1] = yylloc;
if (yyerrstatus == 3)
{
/* If just tried and failed to reuse lookahead token after an
error, discard it. */
if (yychar <= YYEOF)
{
/* Return failure if at end of input. */
if (yychar == YYEOF)
YYABORT;
}
else
{
yydestruct ("Error: discarding",
yytoken, &yylval, &yylloc, _p);
yychar = YYEMPTY;
}
}
/* Else will try to reuse lookahead token after shifting the error
token. */
goto yyerrlab1;
/*---------------------------------------------------.
| yyerrorlab -- error raised explicitly by YYERROR. |
`---------------------------------------------------*/
yyerrorlab:
/* Pacify compilers like GCC when the user code never invokes
YYERROR and the label yyerrorlab therefore never appears in user
code. */
if (/*CONSTCOND*/ 0)
goto yyerrorlab;
yyerror_range[1] = yylsp[1-yylen];
/* Do not reclaim the symbols of the rule whose action triggered
this YYERROR. */
YYPOPSTACK (yylen);
yylen = 0;
YY_STACK_PRINT (yyss, yyssp);
yystate = *yyssp;
goto yyerrlab1;
/*-------------------------------------------------------------.
| yyerrlab1 -- common code for both syntax error and YYERROR. |
`-------------------------------------------------------------*/
yyerrlab1:
yyerrstatus = 3; /* Each real token shifted decrements this. */
for (;;)
{
yyn = yypact[yystate];
if (!yypact_value_is_default (yyn))
{
yyn += YYTERROR;
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
{
yyn = yytable[yyn];
if (0 < yyn)
break;
}
}
/* Pop the current state because it cannot handle the error token. */
if (yyssp == yyss)
YYABORT;
yyerror_range[1] = *yylsp;
yydestruct ("Error: popping",
yystos[yystate], yyvsp, yylsp, _p);
YYPOPSTACK (1);
yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp);
}
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
YY_IGNORE_MAYBE_UNINITIALIZED_END
yyerror_range[2] = yylloc;
/* Using YYLLOC is tempting, but would change the location of
the lookahead. YYLOC is available though. */
YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
*++yylsp = yyloc;
/* Shift the error token. */
YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
yystate = yyn;
goto yynewstate;
/*-------------------------------------.
| yyacceptlab -- YYACCEPT comes here. |
`-------------------------------------*/
yyacceptlab:
yyresult = 0;
goto yyreturn;
/*-----------------------------------.
| yyabortlab -- YYABORT comes here. |
`-----------------------------------*/
yyabortlab:
yyresult = 1;
goto yyreturn;
#if !defined yyoverflow || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. |
`-------------------------------------------------*/
yyexhaustedlab:
yyerror (&yylloc, _p, YY_("memory exhausted"));
yyresult = 2;
/* Fall through. */
#endif
yyreturn:
if (yychar != YYEMPTY)
{
/* Make sure we have latest lookahead translation. See comments at
user semantic actions for why this is necessary. */
yytoken = YYTRANSLATE (yychar);
yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval, &yylloc, _p);
}
/* Do not reclaim the symbols of the rule whose action triggered
this YYABORT or YYACCEPT. */
YYPOPSTACK (yylen);
YY_STACK_PRINT (yyss, yyssp);
while (yyssp != yyss)
{
yydestruct ("Cleanup: popping",
yystos[*yyssp], yyvsp, yylsp, _p);
YYPOPSTACK (1);
}
#ifndef yyoverflow
if (yyss != yyssa)
YYSTACK_FREE (yyss);
YYSTACK_CLEANUP;
#endif
#if YYERROR_VERBOSE
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
#endif
return yyresult;
}
#line 3818 "hphp.y" /* yacc.c:1906 */
/* !PHP5_ONLY*/
/* REMOVED */
/* !END */
/* !PHP7_ONLY*/
bool Parser::parseImpl7() {
/* !END */
return yyparse(this) == 0;
}
| 45.470723 | 151 | 0.386793 | fredemmott |
804cccfc8aac002dad67bc2c3bd5a1edc5e8ade7 | 5,350 | hpp | C++ | include/SSVBloodshed/GUI/Controls/TextBox.hpp | SuperV1234/SSVBloodshed | 63800034a0cfa9d61f9406001072b38f1268883a | [
"AFL-3.0"
] | 12 | 2015-09-09T13:31:42.000Z | 2021-07-10T17:20:06.000Z | include/SSVBloodshed/GUI/Controls/TextBox.hpp | vittorioromeo/SSVBloodshed | 63800034a0cfa9d61f9406001072b38f1268883a | [
"AFL-3.0"
] | 1 | 2015-12-13T10:13:34.000Z | 2015-12-18T13:16:02.000Z | include/SSVBloodshed/GUI/Controls/TextBox.hpp | vittorioromeo/SSVBloodshed | 63800034a0cfa9d61f9406001072b38f1268883a | [
"AFL-3.0"
] | 2 | 2015-12-18T08:06:14.000Z | 2017-04-22T16:40:26.000Z | // Copyright (c) 2013-2015 Vittorio Romeo
// License: Academic Free License ("AFL") v. 3.0
// AFL License page: http://opensource.org/licenses/AFL-3.0
#ifndef SSVOB_GUI_CONTROLS_TEXTBOX
#define SSVOB_GUI_CONTROLS_TEXTBOX
#include "SSVBloodshed/OBCommon.hpp"
#include "SSVBloodshed/GUI/Widget.hpp"
#include "SSVBloodshed/GUI/Controls/Label.hpp"
namespace ob
{
namespace GUI
{
class TextBox : public Widget
{
private:
Widget& tBox;
Label& lblText;
bool editing{false};
std::string editStr, str;
float green{0.f};
Impl::TextCursor cursor;
Impl::TextCursorShape cursorShape;
inline void update(FT mFT) override
{
if(editing)
{
green += mFT * 0.08f;
auto effect(std::abs(std::sin(green)));
cursorShape.refreshShape(cursor,
ssvs::getGlobalLeft(lblText.getText()), lblText.getY(),
getCursorSpacing());
lblText.getText().setColor(
sf::Color(255, effect * 255, 255, 255));
lblText.setString(editStr);
}
else
{
lblText.setString(str);
lblText.getText().setColor(sf::Color::White);
}
for(const auto& e : getEventsToPoll())
{
if(!editing) return;
auto modLShift(isKeyPressed(ssvs::KKey::LShift));
auto modLCtrl(isKeyPressed(ssvs::KKey::LControl));
if(e.type == sf::Event::TextEntered)
{
if(e.text.unicode == '\b' && !editStr.empty())
cursor.delStrBack(modLCtrl);
else if(e.text.unicode > 31 && e.text.unicode < 127)
cursor.insertStr(char(e.text.unicode));
}
else if(e.type == sf::Event::KeyPressed)
{
if(e.key.code == ssvs::KKey::Return)
finishEditing();
else if(e.key.code == ssvs::KKey::Escape)
finishEditing();
else if(e.key.code == ssvs::KKey::Left)
cursor.move(modLShift, modLCtrl, -1);
else if(e.key.code == ssvs::KKey::Right)
cursor.move(modLShift, modLCtrl, 1);
else if(e.key.code == ssvs::KKey::Home)
cursor.setBoth(0);
else if(e.key.code == ssvs::KKey::End)
cursor.setBoth(editStr.size());
else if(e.key.code == ssvs::KKey::Delete)
cursor.delStrFwd(modLCtrl);
}
}
if(editing && !isFocused()) finishEditing();
}
inline void finishEditing()
{
editing = false;
str = editStr;
onTextChanged();
}
inline float getCursorSpacing() const noexcept
{
return getStyle().getGlyphWidth() +
lblText.getText().getTracking();
}
inline int getCursorPos() const noexcept
{
return (getMousePos().x -
ssvs::getGlobalLeft(lblText.getText())) /
getCursorSpacing();
}
public:
ssvu::Delegate<void()> onTextChanged;
TextBox(Context& mContext, const Vec2f& mSize)
: Widget{mContext, mSize / 2.f}, tBox(create<Widget>()),
lblText(tBox.create<Label>("")), cursor(editStr),
cursorShape{float(getStyle().getGlyphHeight())}
{
setFillColor(sf::Color::Transparent);
lblText.onPostDraw += [this]
{
if(editing) render(cursorShape.getShape());
};
tBox.setOutlineColor(getStyle().colorOutline);
tBox.setOutlineThickness(getStyle().outlineThickness);
tBox.setFillColor(sf::Color::White);
tBox.setScaling(Scaling::FitToNeighbor);
lblText.setScaling(Scaling::FitToNeighbor);
tBox.attach(At::Center, *this, At::Center);
lblText.attach(At::Center, tBox, At::Center);
onLeftClick += [this]
{
if(!editing) editStr = str;
editing = true;
if(isKeyPressed(ssvs::KKey::LShift))
cursor.setEnd(getCursorPos());
else
cursor.setBoth(getCursorPos());
};
onLeftClickDown += [this]
{
cursor.setEnd(getCursorPos());
};
}
inline void setString(std::string mStr) { str = ssvu::mv(mStr); }
inline const std::string& getString() const noexcept { return str; }
};
}
}
#endif
| 35.666667 | 80 | 0.451963 | SuperV1234 |
8052159598068b8e0bbbb02a47268bb16136196d | 255 | cpp | C++ | Hashes/SHA2_Functions.cpp | r4yan2/OpenPGP | 0299d96ee3b60d1d29b2d59f43610603a1135a5e | [
"MIT"
] | 20 | 2016-01-10T13:53:41.000Z | 2022-01-28T02:09:07.000Z | Hashes/SHA2_Functions.cpp | m0n0ph1/Hashes | 4764d88bc71b4905141a208ab38f475cdc547f13 | [
"MIT"
] | 1 | 2020-07-13T17:48:10.000Z | 2020-07-18T21:03:41.000Z | Hashes/SHA2_Functions.cpp | m0n0ph1/Hashes | 4764d88bc71b4905141a208ab38f475cdc547f13 | [
"MIT"
] | 10 | 2017-05-15T16:25:59.000Z | 2022-02-03T15:31:11.000Z | #include "SHA2_Functions.h"
uint64_t Ch(const uint64_t & m, const uint64_t & n, const uint64_t & o){
return (m & n) ^ (~m & o);
}
uint64_t Maj(const uint64_t & m, const uint64_t & n, const uint64_t & o){
return (m & n) ^ (m & o) ^ (n & o);
}
| 23.181818 | 74 | 0.584314 | r4yan2 |
8052e3c343e8be15389d8d45b90a61afe637c4e2 | 7,785 | cpp | C++ | updated/catkin_ws/src/grasp_sampler/src/GraspSamplerClient.cpp | JisuHann/Point-Cloud--Grasp | 083244632412709dbc29ac7841b6a837e4ed3cb6 | [
"BSD-2-Clause"
] | null | null | null | updated/catkin_ws/src/grasp_sampler/src/GraspSamplerClient.cpp | JisuHann/Point-Cloud--Grasp | 083244632412709dbc29ac7841b6a837e4ed3cb6 | [
"BSD-2-Clause"
] | null | null | null | updated/catkin_ws/src/grasp_sampler/src/GraspSamplerClient.cpp | JisuHann/Point-Cloud--Grasp | 083244632412709dbc29ac7841b6a837e4ed3cb6 | [
"BSD-2-Clause"
] | 1 | 2021-03-31T06:27:31.000Z | 2021-03-31T06:27:31.000Z | #include <ros/ros.h>
#include <cstdlib>
// custom srv
#include "task_assembly/door_open_planner.h"
// msgs
#include <geometry_msgs/Pose.h>
const std::string Joint_name[7] =
{
"panda_joint1", "panda_joint2", "panda_joint3",
"panda_joint4", "panda_joint5", "panda_joint6",
"panda_joint7"};
int main(int argc, char **argv)
{
ros::init(argc, argv, "GraspSamplerClient");
ros::NodeHandle nh("~");
ros::ServiceClient ros_grasp_sampler_client = nh.serviceClient<task_assembly::door_open_planner>("/plane_door_grasp_motion");
task_assembly::door_open_planner grasp_sampler_srv;
if(ros::ok())
ros::spinOnce();
// Joint State ---> 7-DOF franka panda
sensor_msgs::JointState q_service;
q_service.name.resize(7);
q_service.position.resize(7);
q_service.velocity.resize(7);
q_service.effort.resize(7);
for (int i = 0; i < 7; i++)
{
q_service.name[i] = Joint_name[i];
q_service.position[i] = 0.1;
q_service.velocity[i] = 0.0;
q_service.effort[i] = 0.0;
}
q_service.position[0] = 0.0;
q_service.position[1] = 0.0;
q_service.position[2] = 0.0;
q_service.position[3] = 0.0;
q_service.position[4] = 0.0;
q_service.position[5] = 0.0;
q_service.position[6] = 0.0;
grasp_sampler_srv.request.current_arm_joint_state = q_service;
grasp_sampler_srv.request.interpolate_path.data = true;
if (ros_grasp_sampler_client.call(grasp_sampler_srv)) // call the service and return the response value
{
std::cout<<"service call success !!"<<std::endl;
//ROS_INFO("send srv, srv.Request.a and b : %1d, %1d", (long int)srv.request.a, (long int)srv.request.b);
//ROS_INFO("recieve srv, srv.Response.result : %1d", (long int)srv.response.result);
}
else
{
ROS_ERROR("Failed to call service");
return 1;
}
/// after processing
// geometry_msgs::Pose result_ = grasp_sampler_srv.response.grasp_pose;
// tf::TransformListener listener;
// tf::StampedTransform transform1;
// tf::StampedTransform transform2;
// tf::StampedTransform transform3;
// tf::TransformBroadcaster tf_broadcaster;
// geometry_msgs::TransformStamped tf_trans_1;
// geometry_msgs::TransformStamped tf_trans_2;
// geometry_msgs::TransformStamped tf_trans_3;
// geometry_msgs::TransformStamped tf_trans_4;
// Eigen::Vector3d door_pos;
// door_pos.setZero();
// ros::Time current_time;
// ros::Rate rate(100.0);
// double doorAngle = 0.0;
// double doorOri = 0.0;
// while (ros::ok())
// {
// // rb.BaseTransform();
// // rb.ReadQRCode();
// // rb.WriteAngle(doorangle);
// // rb.WriteDoorPosition(door_pos);
// ros::Time current_time;
// current_time = ros::Time::now();
// tf_trans_1.header.stamp = current_time;
// tf_trans_1.header.frame_id = "base";
// tf_trans_1.child_frame_id = "camera";
// tf_trans_1.transform.translation.x = -0.27+0.027;
// tf_trans_1.transform.translation.y = -0.205;
// tf_trans_1.transform.translation.z = 1.54+0.015;
// tf_trans_1.transform.rotation.w = 0.5;
// tf_trans_1.transform.rotation.x = -0.5;
// tf_trans_1.transform.rotation.y = 0.5;
// tf_trans_1.transform.rotation.z = -0.5;
// tf_trans_2.header.stamp = current_time;
// tf_trans_2.header.frame_id = "camera";
// tf_trans_2.child_frame_id = "kinect2_rgb_optical_frame";
// tf_trans_2.transform.translation.x = 0.0;
// tf_trans_2.transform.translation.y = 0.0;
// tf_trans_2.transform.translation.z = 0.0;
// tf_trans_2.transform.rotation.w = 0.991;
// tf_trans_2.transform.rotation.x = -0.131;
// tf_trans_2.transform.rotation.y = 0.0;
// tf_trans_2.transform.rotation.z = 0.0;
// /*
// tf_trans_3.header.stamp = current_time;
// tf_trans_3.header.frame_id = "kinect2/hd_fid_5";
// tf_trans_3.child_frame_id = "door_handle";
// tf_trans_3.transform.translation.x = -0.25;//-0.235+0.0382;
// tf_trans_3.transform.translation.y = 0;
// tf_trans_3.transform.translation.z = 0.153;//0.175-0.0118;
// tf_trans_3.transform.rotation.w = 1;
// tf_trans_3.transform.rotation.x = 0.0;
// tf_trans_3.transform.rotation.y = 0.0;
// tf_trans_3.transform.rotation.z = 0.0;
// */
// tf_trans_4.header.stamp = current_time;
// tf_trans_4.header.frame_id = "kinect2/hd_fid_8";
// tf_trans_4.child_frame_id = "origin";
// tf_trans_4.transform.translation.x = 1.5;
// tf_trans_4.transform.translation.y = -1.430;
// tf_trans_4.transform.translation.z = 2.1;
// tf_trans_4.transform.rotation.w = 0.5;
// tf_trans_4.transform.rotation.x = -0.5;
// tf_trans_4.transform.rotation.y = 0.5;
// tf_trans_4.transform.rotation.z = 0.5;
// tf_broadcaster.sendTransform(tf_trans_1);
// tf_broadcaster.sendTransform(tf_trans_2);
// // tf_broadcaster.sendTransform(tf_trans_3);
// tf_broadcaster.sendTransform(tf_trans_4);
// // try{
// // listener.lookupTransform("/origin", "/base", ros::Time(0), transform1);
// // }
// // catch (tf::TransformException ex){
// // ROS_ERROR("%s",ex.what());
// // ros::Duration(0.1).sleep();
// // }
// try{
// listener.lookupTransform("/kinect2/hd_fid_8", "/kinect2/hd_fid_5", ros::Time(0), transform2);
// }
// catch (tf::TransformException ex){
// ROS_ERROR("%s",ex.what());
// ros::Duration(0.1).sleep();
// }
// try{
// listener.lookupTransform("/base", "/kinect2/hd_fid_8", ros::Time(0), transform3);
// }
// catch (tf::TransformException ex){
// ROS_ERROR("%s",ex.what());
// ros::Duration(0.1).sleep();
// }
// Eigen::Quaterniond q1,q2;
// Eigen::Matrix3d R1, R2, R3;
// Eigen::Vector3d Euler;
// // q1.x() = transform2.getRotation().x();
// // q1.y() = transform2.getRotation().y();
// // q1.z() = transform2.getRotation().z();
// // q1.w() = transform2.getRotation().w();
// // R1 = q1.normalized().toRotationMatrix();
// // Euler = R1.eulerAngles(0, 1, 2);
// // // doorangle = Euler(1);
// // doorangle = normAngle(Euler(1), -M_PI/2.0);
// // doorangle = -doorangle + 38*M_PI/180 ;
// q1.x() = transform2.getRotation().x();
// q1.y() = transform2.getRotation().y();
// q1.z() = transform2.getRotation().z();
// q1.w() = transform2.getRotation().w();
// R1 = q1.normalized().toRotationMatrix();
// Euler = R1.eulerAngles(0, 1, 2);
// // doorangle = Euler(1);
// doorangle = asin(R1(0, 2));
// doorangle = doorangle + 45.0 * M_PI / 180.0;
// q2.x() = transform3.getRotation().x();
// q2.y() = transform3.getRotation().y();
// q2.z() = transform3.getRotation().z();
// q2.w() = transform3.getRotation().w();
// R2 = q2.normalized().toRotationMatrix();
// doorori = asin(R2(1, 2));
// door_pos(0) = transform3.getOrigin().x();
// door_pos(1) = transform3.getOrigin().y();
// door_pos(2) = doorori;
// //std::cout << R2 << "\n" << std::endl;
// //std::cout << transform1.getOrigin().x() << "\t" << transform1.getOrigin().y() << "\t" << transform1.getOrigin().z() <<"\n";
// // std::cout << doorangle*180/M_PI <<"\n";
// }
return 0;
} | 36.378505 | 136 | 0.579062 | JisuHann |
8053b00e6296f9ab891935053bf782d1f6e8d8f6 | 1,194 | cpp | C++ | src/bliss.cpp | yunseo-h68/bliss | 1eaafd7bbc117f3b39f0900956db7ab7b085d941 | [
"MIT"
] | 1 | 2020-07-27T06:20:32.000Z | 2020-07-27T06:20:32.000Z | src/bliss.cpp | yunseo-h68/bliss | 1eaafd7bbc117f3b39f0900956db7ab7b085d941 | [
"MIT"
] | null | null | null | src/bliss.cpp | yunseo-h68/bliss | 1eaafd7bbc117f3b39f0900956db7ab7b085d941 | [
"MIT"
] | null | null | null | #include <iostream>
#include <cstring>
#include <string>
#include "bliss.h"
static std::string parse_option_name(const char* str) {
int i = 0;
std::string name = "";
while (str[i] == '-') i++;
for (int j = 0; str[i+j] != '\0'; j++) {
name += str[i+j];
}
return name;
}
int bliss_run(BlissApp* app, int argc, char* argv[]) {
int check = 0;
if (argc == 1) {
app->Exec();
}
for (int i = 1; i < argc; i++) {
std::string name;
if (strlen(argv[i]) >= 2 && argv[i][0] == '-') {
name = parse_option_name(argv[i]);
BlissOption* option_tmp = NULL;
if (argv[i][1] != '-') {
option_tmp = app->GetOptionByNameShort(name);
} else if (argv[i][2] != '-') {
option_tmp = app->GetOptionByName(name);
}
if (option_tmp == NULL) {
std::cout << "NOT FOUND OPTION: " << argv[i] << "\n";
continue;
}
option_tmp->Exec();
check = 1;
continue;
}
BlissCommand* subcommand_tmp = app->GetSubcommandByName(argv[i]);
if (subcommand_tmp == NULL) {
std::cout << "NOT FOUND SUBCOMMAND: " << argv[i] << "\n";
if (!check && i == argc - 1) {
return -1;
}
continue;
}
check = 1;
subcommand_tmp -> Exec();
}
delete app;
return 0;
}
| 20.947368 | 67 | 0.552764 | yunseo-h68 |
8057815b4c971e0c90a11fafb826a004b8553bb9 | 16,115 | cpp | C++ | src/cui-1.0.4/PJADV/PJADV.cpp | MaiReo/crass | 11579527090faecab27f98b1e221172822928f57 | [
"BSD-3-Clause"
] | 1 | 2021-07-21T00:58:45.000Z | 2021-07-21T00:58:45.000Z | src/cui-1.0.4/PJADV/PJADV.cpp | MaiReo/crass | 11579527090faecab27f98b1e221172822928f57 | [
"BSD-3-Clause"
] | null | null | null | src/cui-1.0.4/PJADV/PJADV.cpp | MaiReo/crass | 11579527090faecab27f98b1e221172822928f57 | [
"BSD-3-Clause"
] | null | null | null | #include <windows.h>
#include <tchar.h>
#include <crass_types.h>
#include <acui.h>
#include <cui.h>
#include <package.h>
#include <resource.h>
#include <cui_error.h>
#include <stdio.h>
#include <utility.h>
/* 接口数据结构: 表示cui插件的一般信息 */
struct acui_information PJADV_cui_information = {
_T("ぼとむれす"), /* copyright */
_T("PajamasSoft Adventure Engine"), /* system */
_T(".dat .pak .epa .bin"), /* package */
_T("1.0.1"), /* revision */
_T("痴汉公贼"), /* author */
_T("2008-1-25 0:19"), /* date */
NULL, /* notion */
ACUI_ATTRIBUTE_LEVEL_DEVELOP
};
/* 所有的封包特定的数据结构都要放在这个#pragma段里 */
#pragma pack (1)
typedef struct {
s8 magic[12]; /* "GAMEDAT PACK" or "GAMEDAT PAC2" */
u32 index_entries;
} pack_header_t;
typedef struct {
u32 offset;
u32 length;
} pack_entry_t;
/*
archive.dat提取出来后有个graphic.def,里面详细定义了每个图像的用途。
*/
/* mode的用途是:
* 立绘图的人物,通常只有表情变化。因此让mode==2的图是表情图,在它的epa
* 中记录完整图的epa文件名,并记录下在原图中的位置 */
/* epa解压后最终都会转换为32位位图,没有α字段的图的Alpha填0xff */
typedef struct {
s8 magic[2]; /* "EP" */
u8 version; /* must be 0x01 */
u8 mode; /* 0x01, have no XY */
u8 color_type; /* 0 - 8bit without alpha; 1 - 24 bit; 2 - 32bit; 4 - 8bit width alpha */
u8 unknown0; /* only used in 8bit */ // ??(8bits模式下有用:0 - 默认256;非0 - 实际的颜色数)
u8 unknown1; /* only used in 8bit */ // ??(8bits模式下有用:0 - 默认256;非0 - 实际的??)
u8 reserved;
u32 width;
u32 height;
} epa1_header_t;
// 0 - with palette; 4 - without palette
typedef struct {
s8 magic[2]; /* "EP" */
u8 version; /* must be 0x01 */
u8 mode; /* 0x02, have XY */
u8 color_type; /* 0 - 8bit without alpha; 1 - 24 bit; 2 - 32bit; 3 - 16 BIT; 4 - 8bit width alpha */
u8 unknown0; /* only used in 8bit */ // ??(8bits模式下有用:0 - 默认256;非0 - 实际的颜色数)
u8 unknown1; /* only used in 8bit */ // ??(8bits模式下有用:0 - 默认256;非0 - 实际的??)
u8 reserved;
u32 width;
u32 height;
u32 X; /* 贴图坐标(左上角) */
u32 Y;
s8 name[32];
} epa2_header_t;
#pragma pack ()
typedef struct {
union {
epa1_header_t epa1;
epa2_header_t epa2;
};
} epa_header_t;
typedef struct {
s8 name[MAX_PATH];
u32 offset;
u32 length;
} my_pack_entry_t;
static void *my_malloc(DWORD len)
{
return malloc(len);
}
static int epa_decompress(BYTE *uncompr, DWORD *max_uncomprlen,
BYTE *compr, DWORD comprlen, u32 width)
{
unsigned int curbyte = 0;
unsigned int uncomprlen = *max_uncomprlen;
unsigned int act_uncomprlen = 0;
unsigned int step_table[16];
step_table[0] = 0;
step_table[1] = 1;
step_table[2] = width;
step_table[3] = width + 1;
step_table[4] = 2;
step_table[5] = width - 1;
step_table[6] = width * 2;
step_table[7] = 3;
step_table[8] = (width + 1) * 2;
step_table[9] = width + 2;
step_table[10] = width * 2 + 1;
step_table[11] = width * 2 - 1;
step_table[12] = (width - 1) * 2 ;
step_table[13] = width - 2;
step_table[14] = width * 3;
step_table[15] = 4;
/* 这里千万不要心血来潮的用memcpy(),原因是memecpy()会根据src和dst
* 的位置进行“正确”拷贝。但这个拷贝实际上在这里却是不正确的
*/
while (act_uncomprlen < uncomprlen) {
u8 flag;
unsigned int copy_bytes;
if (curbyte >= comprlen)
return -1;
flag = compr[curbyte++];
if (!(flag & 0xf0)) {
copy_bytes = flag;
if (curbyte + copy_bytes > comprlen)
return -1;
if (act_uncomprlen + copy_bytes > uncomprlen)
return -1;
for (unsigned int i = 0; i < copy_bytes; i++)
uncompr[act_uncomprlen++] = compr[curbyte++];
} else {
BYTE *src;
if (flag & 8) {
if (curbyte >= comprlen)
return -1;
copy_bytes = ((flag & 7) << 8) + compr[curbyte++];
} else
copy_bytes = flag & 7;
if (act_uncomprlen + copy_bytes > uncomprlen)
return -1;
src = &uncompr[act_uncomprlen] - step_table[flag >> 4];
for (unsigned int i = 0; i < copy_bytes; i++)
uncompr[act_uncomprlen++] = *src++;
}
}
*max_uncomprlen = act_uncomprlen;
return 0;
}
/********************* dat *********************/
/* 封包匹配回调函数 */
static int PJADV_dat_match(struct package *pkg)
{
s8 magic[12];
if (pkg->pio->open(pkg, IO_READONLY))
return -CUI_EOPEN;
if (pkg->pio->read(pkg, magic, sizeof(magic))) {
pkg->pio->close(pkg);
return -CUI_EREAD;
}
if (memcmp(magic, "GAMEDAT PACK", sizeof(magic)) && memcmp(magic, "GAMEDAT PAC2", sizeof(magic))) {
pkg->pio->close(pkg);
return -CUI_EMATCH;
}
return 0;
}
/* 封包索引目录提取函数 */
static int PJADV_dat_extract_directory(struct package *pkg,
struct package_directory *pkg_dir)
{
pack_header_t pack_header;
my_pack_entry_t *index_buffer;
BYTE *raw_index_buffer;
unsigned int raw_index_buffer_length, name_length, entry_size;
u32 offset;
unsigned int i;
if (pkg->pio->seek(pkg, 0, IO_SEEK_SET))
return -CUI_ESEEK;
if (pkg->pio->read(pkg, &pack_header, sizeof(pack_header)))
return -CUI_EREAD;
if (!strncmp(pack_header.magic, "GAMEDAT PACK", sizeof(pack_header.magic)))
name_length = 16;
else if (!strncmp(pack_header.magic, "GAMEDAT PAC2", sizeof(pack_header.magic)))
name_length = 32;
entry_size = name_length + sizeof(pack_entry_t);
raw_index_buffer_length = entry_size * pack_header.index_entries;
raw_index_buffer = (BYTE *)malloc(raw_index_buffer_length);
if (!raw_index_buffer)
return -CUI_EMEM;
if (pkg->pio->read(pkg, raw_index_buffer, raw_index_buffer_length)) {
free(raw_index_buffer);
return -CUI_EREAD;
}
index_buffer = (my_pack_entry_t *)malloc(sizeof(my_pack_entry_t) * pack_header.index_entries);
if (!index_buffer) {
free(raw_index_buffer);
return -CUI_EMEM;
}
offset = sizeof(pack_header) + raw_index_buffer_length;
for (i = 0; i < pack_header.index_entries; i++) {
my_pack_entry_t *my_entry = &index_buffer[i];
BYTE *name = raw_index_buffer + i * name_length;
pack_entry_t *entry = (pack_entry_t *)(raw_index_buffer
+ pack_header.index_entries * name_length + i * sizeof(pack_entry_t));
strncpy(my_entry->name, (char *)name, name_length);
my_entry->name[name_length] = 0;
my_entry->length = entry->length;
my_entry->offset = entry->offset + offset;
}
free(raw_index_buffer);
pkg_dir->index_entries = pack_header.index_entries;
pkg_dir->directory = index_buffer;
pkg_dir->directory_length = pack_header.index_entries * sizeof(my_pack_entry_t);
pkg_dir->index_entry_length = sizeof(my_pack_entry_t);
return 0;
}
/* 封包索引项解析函数 */
static int PJADV_dat_parse_resource_info(struct package *pkg,
struct package_resource *pkg_res)
{
my_pack_entry_t *my_pack_entry;
my_pack_entry = (my_pack_entry_t *)pkg_res->actual_index_entry;
strcpy(pkg_res->name, my_pack_entry->name);
pkg_res->name_length = -1; /* -1表示名称以NULL结尾 */
pkg_res->raw_data_length = my_pack_entry->length;
pkg_res->actual_data_length = 0; /* 数据都是明文 */
pkg_res->offset = my_pack_entry->offset;
return 0;
}
/* 封包资源提取函数 */
static int PJADV_dat_extract_resource(struct package *pkg,
struct package_resource *pkg_res)
{
pkg_res->raw_data = malloc(pkg_res->raw_data_length);
if (!pkg_res->raw_data)
return -CUI_EMEM;
if (pkg->pio->readvec(pkg, pkg_res->raw_data, pkg_res->raw_data_length,
pkg_res->offset, IO_SEEK_SET)) {
free(pkg_res->raw_data);
pkg_res->raw_data = NULL;
return -CUI_EREADVEC;
}
return 0;
}
/* 资源保存函数 */
static int PJADV_dat_save_resource(struct resource *res,
struct package_resource *pkg_res)
{
if (res->rio->create(res))
return -CUI_ECREATE;
if (pkg_res->raw_data && pkg_res->raw_data_length) {
if (res->rio->write(res, pkg_res->raw_data, pkg_res->raw_data_length)) {
res->rio->close(res);
return -CUI_EWRITE;
}
}
res->rio->close(res);
return 0;
}
/* 封包资源释放函数 */
static void PJADV_dat_release_resource(struct package *pkg,
struct package_resource *pkg_res)
{
if (pkg_res->raw_data) {
free(pkg_res->raw_data);
pkg_res->raw_data = NULL;
}
}
/* 封包卸载函数 */
static void PJADV_dat_release(struct package *pkg,
struct package_directory *pkg_dir)
{
if (pkg_dir->directory) {
free(pkg_dir->directory);
pkg_dir->directory = NULL;
}
pkg->pio->close(pkg);
}
/* 封包处理回调函数集合 */
static cui_ext_operation PJADV_dat_operation = {
PJADV_dat_match, /* match */
PJADV_dat_extract_directory, /* extract_directory */
PJADV_dat_parse_resource_info, /* parse_resource_info */
PJADV_dat_extract_resource, /* extract_resource */
PJADV_dat_save_resource, /* save_resource */
PJADV_dat_release_resource, /* release_resource */
PJADV_dat_release /* release */
};
/********************* epa *********************/
/* 封包匹配回调函数 */
static int PJADV_epa_match(struct package *pkg)
{
s8 magic[2];
u8 ver;
if (pkg->pio->open(pkg, IO_READONLY))
return -CUI_EOPEN;
if (pkg->pio->read(pkg, magic, sizeof(magic))) {
pkg->pio->close(pkg);
return -CUI_EREAD;
}
if (strncmp(magic, "EP", sizeof(magic))) {
pkg->pio->close(pkg);
return -CUI_EMATCH;
}
if (pkg->pio->read(pkg, &ver, 1)) {
pkg->pio->close(pkg);
return -CUI_EREAD;
}
if (ver != 1) {
pkg->pio->close(pkg);
return -CUI_EMATCH;
}
return 0;
}
/* 封包资源提取函数 */
static int PJADV_epa_extract_resource(struct package *pkg,
struct package_resource *pkg_res)
{
epa_header_t epa_header;
u8 mode;
u32 color_type, width, height;
unsigned int compr_offset;
BYTE *uncompr, *compr, *palette;
u32 raw_length;
DWORD uncomprlen, comprlen, act_uncomprlen, palette_length;
unsigned int pixel_bytes;
int have_alpha;
if (pkg->pio->read(pkg, &mode, 1))
return -CUI_EREAD;
if (mode != 1 && mode != 2)
return -CUI_EMATCH;
if (pkg->pio->length_of(pkg, &raw_length))
return -CUI_ELEN;
if (pkg->pio->seek(pkg, 0, IO_SEEK_SET))
return -CUI_ESEEK;
if (mode == 1) {
if (pkg->pio->read(pkg, &epa_header.epa1, sizeof(epa_header.epa1)))
return -CUI_EREAD;
width = epa_header.epa1.width;
height = epa_header.epa1.height;
color_type = epa_header.epa1.color_type;
compr_offset = sizeof(epa_header.epa1);
} else {
if (pkg->pio->read(pkg, &epa_header.epa2, sizeof(epa_header.epa2)))
return -CUI_EREAD;
width = epa_header.epa2.width;
height = epa_header.epa2.height;
color_type = epa_header.epa2.color_type;
compr_offset = sizeof(epa_header.epa2);
}
have_alpha = 0;
switch (color_type) {
case 0:
pixel_bytes = 1;
palette_length = 768;
break;
case 1:
pixel_bytes = 3;
palette_length = 0;
break;
case 2:
pixel_bytes = 4;
palette_length = 0;
break;
// case 3:
// pixel_bytes = 2;
// palette_length = 0;
// break;
case 4:
pixel_bytes = 1; // 实际解压时候,比case0的情况多出height * width的数据,这段数据就是α
palette_length = 768;
have_alpha = 1;
break;
default:
return -CUI_EMATCH;
}
if (palette_length) {
palette = (BYTE *)malloc(palette_length);
if (!palette)
return -CUI_EMEM;
if (pkg->pio->readvec(pkg, palette, palette_length, compr_offset, IO_SEEK_SET)) {
free(palette);
return -CUI_EREADVEC;
}
} else
palette = NULL;
uncomprlen = width * height * pixel_bytes;
uncompr = (BYTE *)malloc(uncomprlen);
if (!uncompr) {
free(palette);
return -CUI_EMEM;
}
comprlen = raw_length - compr_offset - palette_length;
compr = (BYTE *)malloc(comprlen);
if (!compr) {
free(uncompr);
free(palette);
return -CUI_EMEM;
}
if (pkg->pio->readvec(pkg, compr, comprlen, compr_offset + palette_length, IO_SEEK_SET)) {
free(compr);
free(uncompr);
free(palette);
return -CUI_EREADVEC;
}
act_uncomprlen = uncomprlen;
if (epa_decompress(uncompr, &act_uncomprlen, compr, comprlen, width)) {
free(compr);
free(uncompr);
free(palette);
return -CUI_EUNCOMPR;
}
free(compr);
if (act_uncomprlen != uncomprlen) {
free(uncompr);
free(palette);
return -CUI_EUNCOMPR;
}
/* 将RGBA数据重新整理 */
if (pixel_bytes > 1) {
BYTE *tmp = (BYTE *)malloc(uncomprlen);
if (!tmp) {
free(uncompr);
free(palette);
return -CUI_EMEM;
}
unsigned int line_len = width * pixel_bytes;
unsigned int i = 0;
for (unsigned int p = 0; p < pixel_bytes; p++) {
for (unsigned int y = 0; y < height; y++) {
BYTE *line = &tmp[y * line_len];
for (unsigned int x = 0; x < width; x++) {
BYTE *pixel = &line[x * pixel_bytes];
pixel[p] = uncompr[i++];
}
}
}
free(uncompr);
uncompr = tmp;
}
if (pixel_bytes == 2) {
if (MyBuildBMP16File(uncompr, uncomprlen, width, height, (BYTE **)&pkg_res->actual_data,
&pkg_res->actual_data_length, RGB555, NULL, my_malloc)) {
free(uncompr);
free(palette);
return -CUI_EMEM;
}
} else if (MyBuildBMPFile(uncompr, uncomprlen, palette, palette_length,
width, 0 - height, pixel_bytes * 8, (BYTE **)&pkg_res->actual_data,
&pkg_res->actual_data_length, my_malloc)) {
free(uncompr);
free(palette);
return -CUI_EMEM;
}
free(uncompr);
free(palette);
pkg_res->raw_data = NULL;
pkg_res->raw_data_length = raw_length;
return 0;
}
/* 资源保存函数 */
static int PJADV_epa_save_resource(struct resource *res,
struct package_resource *pkg_res)
{
if (res->rio->create(res))
return -CUI_ECREATE;
if (pkg_res->actual_data && pkg_res->actual_data_length) {
if (res->rio->write(res, pkg_res->actual_data, pkg_res->actual_data_length)) {
res->rio->close(res);
return -CUI_EWRITE;
}
}
res->rio->close(res);
return 0;
}
/* 封包资源释放函数 */
static void PJADV_epa_release_resource(struct package *pkg,
struct package_resource *pkg_res)
{
if (pkg_res->actual_data) {
free(pkg_res->actual_data);
pkg_res->actual_data = NULL;
}
}
/* 封包卸载函数 */
static void PJADV_epa_release(struct package *pkg,
struct package_directory *pkg_dir)
{
pkg->pio->close(pkg);
}
/* 封包处理回调函数集合 */
static cui_ext_operation PJADV_epa_operation = {
PJADV_epa_match, /* match */
NULL, /* extract_directory */
NULL, /* parse_resource_info */
PJADV_epa_extract_resource, /* extract_resource */
PJADV_epa_save_resource, /* save_resource */
PJADV_epa_release_resource, /* release_resource */
PJADV_epa_release /* release */
};
/********************* textdata.bin *********************/
/* 封包匹配回调函数 */
static int PJADV_bin_match(struct package *pkg)
{
s8 magic[12];
if (lstrcmp(pkg->name, _T("textdata.bin")))
return -CUI_EMATCH;
if (pkg->pio->open(pkg, IO_READONLY))
return -CUI_EOPEN;
if (pkg->pio->read(pkg, magic, sizeof(magic))) {
pkg->pio->close(pkg);
return -CUI_EREAD;
}
if (!strncmp(magic, "PJADV_TF0001", 12)) {
pkg->pio->close(pkg);
return -CUI_EMATCH;
}
return 0;
}
/* 封包资源提取函数 */
static int PJADV_bin_extract_resource(struct package *pkg,
struct package_resource *pkg_res)
{
u32 scenario_size;
BYTE *scenario;
if (pkg->pio->length_of(pkg, &scenario_size))
return -CUI_ELEN;
scenario = (BYTE *)malloc(scenario_size);
if (!scenario)
return -CUI_EMEM;
if (pkg->pio->readvec(pkg, scenario, scenario_size, 0, IO_SEEK_SET)) {
free(scenario);
return -CUI_EREAD;
}
BYTE xor = 0xc5;
for (DWORD i = 0; i < scenario_size; i++) {
scenario[i] ^= xor;
xor += 0x5c;
}
pkg_res->raw_data = NULL;
pkg_res->raw_data_length = scenario_size;
pkg_res->actual_data = scenario;
pkg_res->actual_data_length = scenario_size;
return 0;
}
/* 封包处理回调函数集合 */
static cui_ext_operation PJADV_bin_operation = {
PJADV_bin_match, /* match */
NULL, /* extract_directory */
NULL, /* parse_resource_info */
PJADV_bin_extract_resource, /* extract_resource */
PJADV_epa_save_resource, /* save_resource */
PJADV_epa_release_resource, /* release_resource */
PJADV_epa_release /* release */
};
/* 接口函数: 向cui_core注册支持的封包类型 */
int CALLBACK PJADV_register_cui(struct cui_register_callback *callback)
{
/* 注册cui插件支持的扩展名、资源放入扩展名、处理回调函数和封包属性 */
if (callback->add_extension(callback->cui, _T(".dat"), NULL,
NULL, &PJADV_dat_operation, CUI_EXT_FLAG_PKG | CUI_EXT_FLAG_DIR))
return -1;
if (callback->add_extension(callback->cui, _T(".pak"), NULL,
NULL, &PJADV_dat_operation, CUI_EXT_FLAG_PKG | CUI_EXT_FLAG_DIR))
return -1;
if (callback->add_extension(callback->cui, _T(".epa"), _T(".bmp"),
NULL, &PJADV_epa_operation, CUI_EXT_FLAG_PKG | CUI_EXT_FLAG_RES))
return -1;
if (callback->add_extension(callback->cui, _T(".bin"), _T(".bin.out"),
NULL, &PJADV_bin_operation, CUI_EXT_FLAG_PKG | CUI_EXT_FLAG_RES))
return -1;
return 0;
}
}
| 24.016393 | 102 | 0.670555 | MaiReo |
805a8feb74fbb10cdec4830e3f48c8f810f690ba | 11,466 | cpp | C++ | src/lib/operators/insert.cpp | cmfcmf/hyrise | d3465dfc83039876c1800bf245e73874947da114 | [
"MIT"
] | 2 | 2019-01-22T19:44:32.000Z | 2019-01-22T19:52:33.000Z | src/lib/operators/insert.cpp | tom-lichtenstein/hyrise | a11b5bdf6be726fd88b16c6e6284a238f5ec7873 | [
"MIT"
] | 33 | 2019-02-02T09:52:50.000Z | 2019-03-07T13:14:40.000Z | src/lib/operators/insert.cpp | tom-lichtenstein/hyrise | a11b5bdf6be726fd88b16c6e6284a238f5ec7873 | [
"MIT"
] | null | null | null | #include "insert.hpp"
#include <algorithm>
#include <memory>
#include <string>
#include <vector>
#include "concurrency/transaction_context.hpp"
#include "resolve_type.hpp"
#include "storage/base_encoded_segment.hpp"
#include "storage/storage_manager.hpp"
#include "storage/value_segment.hpp"
#include "type_cast.hpp"
#include "utils/assert.hpp"
namespace opossum {
// We need these classes to perform the dynamic cast into a templated ValueSegment
class AbstractTypedSegmentProcessor : public Noncopyable {
public:
AbstractTypedSegmentProcessor() = default;
AbstractTypedSegmentProcessor(const AbstractTypedSegmentProcessor&) = delete;
AbstractTypedSegmentProcessor& operator=(const AbstractTypedSegmentProcessor&) = delete;
AbstractTypedSegmentProcessor(AbstractTypedSegmentProcessor&&) = default;
AbstractTypedSegmentProcessor& operator=(AbstractTypedSegmentProcessor&&) = default;
virtual ~AbstractTypedSegmentProcessor() = default;
virtual void resize_vector(std::shared_ptr<BaseSegment> segment, size_t new_size) = 0;
virtual void copy_data(std::shared_ptr<const BaseSegment> source, ChunkOffset source_start_index,
std::shared_ptr<BaseSegment> target, ChunkOffset target_start_index, ChunkOffset length) = 0;
};
template <typename T>
class TypedSegmentProcessor : public AbstractTypedSegmentProcessor {
public:
void resize_vector(std::shared_ptr<BaseSegment> segment, size_t new_size) override {
auto value_segment = std::dynamic_pointer_cast<ValueSegment<T>>(segment);
DebugAssert(value_segment, "Cannot insert into non-ValueColumns");
auto& values = value_segment->values();
values.resize(new_size);
if (value_segment->is_nullable()) {
value_segment->null_values().resize(new_size);
}
}
// this copies
void copy_data(std::shared_ptr<const BaseSegment> source, ChunkOffset source_start_index,
std::shared_ptr<BaseSegment> target, ChunkOffset target_start_index, ChunkOffset length) override {
auto casted_target = std::dynamic_pointer_cast<ValueSegment<T>>(target);
DebugAssert(casted_target, "Cannot insert into non-ValueColumns");
auto& values = casted_target->values();
auto target_is_nullable = casted_target->is_nullable();
if (auto casted_source = std::dynamic_pointer_cast<const ValueSegment<T>>(source)) {
std::copy_n(casted_source->values().begin() + source_start_index, length, values.begin() + target_start_index);
if (casted_source->is_nullable()) {
const auto nulls_begin_iter = casted_source->null_values().begin() + source_start_index;
const auto nulls_end_iter = nulls_begin_iter + length;
Assert(
target_is_nullable || std::none_of(nulls_begin_iter, nulls_end_iter, [](const auto& null) { return null; }),
"Trying to insert NULL into non-NULL segment");
std::copy(nulls_begin_iter, nulls_end_iter, casted_target->null_values().begin() + target_start_index);
}
} else if (auto casted_dummy_source = std::dynamic_pointer_cast<const ValueSegment<int32_t>>(source)) {
// We use the segment type of the Dummy table used to insert a single null value.
// A few asserts are needed to guarantee correct behaviour.
// You may also end up here if the data types of the input and the target column mismatch. Usually, this gets
// caught way earlier, but if you build your own tests, this might happen.
Assert(length == 1, "Cannot insert multiple unknown null values at once.");
Assert(casted_dummy_source->size() == 1, "Source segment is of wrong type.");
Assert(casted_dummy_source->null_values().front() == true, "Only value in dummy table must be NULL!");
Assert(target_is_nullable, "Cannot insert NULL into NOT NULL target.");
// Ignore source value and only set null to true
casted_target->null_values()[target_start_index] = true;
} else {
// } else if(auto casted_source = std::dynamic_pointer_cast<ReferenceSegment>(source)){
// since we have no guarantee that a ReferenceSegment references only a single other segment,
// this would require us to find out the referenced segment's type for each single row.
// instead, we just use the slow path below.
for (auto i = 0u; i < length; i++) {
auto ref_value = (*source)[source_start_index + i];
if (variant_is_null(ref_value)) {
Assert(target_is_nullable, "Cannot insert NULL into NOT NULL target");
values[target_start_index + i] = T{};
casted_target->null_values()[target_start_index + i] = true;
} else {
values[target_start_index + i] = type_cast_variant<T>(ref_value);
}
}
}
}
};
Insert::Insert(const std::string& target_table_name, const std::shared_ptr<const AbstractOperator>& values_to_insert)
: AbstractReadWriteOperator(OperatorType::Insert, values_to_insert), _target_table_name(target_table_name) {}
const std::string Insert::name() const { return "Insert"; }
std::shared_ptr<const Table> Insert::_on_execute(std::shared_ptr<TransactionContext> context) {
context->register_read_write_operator(std::static_pointer_cast<AbstractReadWriteOperator>(shared_from_this()));
_target_table = StorageManager::get().get_table(_target_table_name);
// These TypedSegmentProcessors kind of retrieve the template parameter of the segments.
auto typed_segment_processors = std::vector<std::unique_ptr<AbstractTypedSegmentProcessor>>();
for (const auto& column_type : _target_table->column_data_types()) {
typed_segment_processors.emplace_back(
make_unique_by_data_type<AbstractTypedSegmentProcessor, TypedSegmentProcessor>(column_type));
}
auto total_rows_to_insert = static_cast<uint32_t>(input_table_left()->row_count());
// First, allocate space for all the rows to insert. Do so while locking the table to prevent multiple threads
// modifying the table's size simultaneously.
auto start_index = 0u;
auto start_chunk_id = ChunkID{0};
auto end_chunk_id = 0u;
{
auto scoped_lock = _target_table->acquire_append_mutex();
if (_target_table->chunk_count() == 0) {
_target_table->append_mutable_chunk();
}
start_chunk_id = _target_table->chunk_count() - 1;
end_chunk_id = start_chunk_id + 1;
auto last_chunk = _target_table->get_chunk(start_chunk_id);
start_index = last_chunk->size();
// If last chunk is compressed, add a new uncompressed chunk
if (!last_chunk->is_mutable()) {
_target_table->append_mutable_chunk();
end_chunk_id++;
}
auto remaining_rows = total_rows_to_insert;
while (remaining_rows > 0) {
auto current_chunk = _target_table->get_chunk(static_cast<ChunkID>(_target_table->chunk_count() - 1));
auto rows_to_insert_this_loop = std::min(_target_table->max_chunk_size() - current_chunk->size(), remaining_rows);
// Resize MVCC vectors.
current_chunk->get_scoped_mvcc_data_lock()->grow_by(rows_to_insert_this_loop, MvccData::MAX_COMMIT_ID);
// Resize current chunk to full size.
auto old_size = current_chunk->size();
for (ColumnID column_id{0}; column_id < current_chunk->column_count(); ++column_id) {
typed_segment_processors[column_id]->resize_vector(current_chunk->get_segment(column_id),
old_size + rows_to_insert_this_loop);
}
remaining_rows -= rows_to_insert_this_loop;
// Create new chunk if necessary.
if (remaining_rows > 0) {
_target_table->append_mutable_chunk();
end_chunk_id++;
}
}
}
// TODO(all): make compress chunk thread-safe; if it gets called here by another thread, things will likely break.
// Then, actually insert the data.
auto input_offset = 0u;
auto source_chunk_id = ChunkID{0};
auto source_chunk_start_index = 0u;
for (auto target_chunk_id = start_chunk_id; target_chunk_id < end_chunk_id; target_chunk_id++) {
auto target_chunk = _target_table->get_chunk(target_chunk_id);
const auto current_num_rows_to_insert =
std::min(target_chunk->size() - start_index, total_rows_to_insert - input_offset);
auto target_start_index = start_index;
auto still_to_insert = current_num_rows_to_insert;
// while target chunk is not full
while (target_start_index != target_chunk->size()) {
const auto source_chunk = input_table_left()->get_chunk(source_chunk_id);
auto num_to_insert = std::min(source_chunk->size() - source_chunk_start_index, still_to_insert);
for (ColumnID column_id{0}; column_id < target_chunk->column_count(); ++column_id) {
const auto& source_segment = source_chunk->get_segment(column_id);
typed_segment_processors[column_id]->copy_data(source_segment, source_chunk_start_index,
target_chunk->get_segment(column_id), target_start_index,
num_to_insert);
}
still_to_insert -= num_to_insert;
target_start_index += num_to_insert;
source_chunk_start_index += num_to_insert;
bool source_chunk_depleted = source_chunk_start_index == source_chunk->size();
if (source_chunk_depleted) {
source_chunk_id++;
source_chunk_start_index = 0u;
}
}
for (auto i = start_index; i < start_index + current_num_rows_to_insert; i++) {
// we do not need to check whether other operators have locked the rows, we have just created them
// and they are not visible for other operators.
// the transaction IDs are set here and not during the resize, because
// tbb::concurrent_vector::grow_to_at_least(n, t)" does not work with atomics, since their copy constructor is
// deleted.
target_chunk->get_scoped_mvcc_data_lock()->tids[i] = context->transaction_id();
_inserted_rows.emplace_back(RowID{target_chunk_id, i});
}
input_offset += current_num_rows_to_insert;
start_index = 0u;
}
return nullptr;
}
void Insert::_on_commit_records(const CommitID cid) {
for (auto row_id : _inserted_rows) {
auto chunk = _target_table->get_chunk(row_id.chunk_id);
auto mvcc_data = chunk->get_scoped_mvcc_data_lock();
mvcc_data->begin_cids[row_id.chunk_offset] = cid;
mvcc_data->tids[row_id.chunk_offset] = 0u;
}
}
void Insert::_on_rollback_records() {
for (auto row_id : _inserted_rows) {
auto chunk = _target_table->get_chunk(row_id.chunk_id);
// We set the begin and end cids to 0 (effectively making it invisible for everyone) so that the ChunkCompression
// does not think that this row is still incomplete. We need to make sure that the end is written before the begin.
chunk->get_scoped_mvcc_data_lock()->end_cids[row_id.chunk_offset] = 0u;
std::atomic_thread_fence(std::memory_order_release);
chunk->get_scoped_mvcc_data_lock()->begin_cids[row_id.chunk_offset] = 0u;
chunk->get_scoped_mvcc_data_lock()->tids[row_id.chunk_offset] = 0u;
}
}
std::shared_ptr<AbstractOperator> Insert::_on_deep_copy(
const std::shared_ptr<AbstractOperator>& copied_input_left,
const std::shared_ptr<AbstractOperator>& copied_input_right) const {
return std::make_shared<Insert>(_target_table_name, copied_input_left);
}
void Insert::_on_set_parameters(const std::unordered_map<ParameterID, AllTypeVariant>& parameters) {}
} // namespace opossum
| 45.5 | 120 | 0.720129 | cmfcmf |
805aaa5e61422543be05ee86f402d1bdd476e5da | 6,744 | cpp | C++ | src/cpp/bigInteger.cpp | Praggya17/HacktoberFestContribute | 098cb1012f1f2ed6ca6b3544a7b962b6c49e2643 | [
"MIT"
] | 98 | 2018-10-09T15:42:41.000Z | 2021-10-04T15:25:44.000Z | src/cpp/bigInteger.cpp | Praggya17/HacktoberFestContribute | 098cb1012f1f2ed6ca6b3544a7b962b6c49e2643 | [
"MIT"
] | 141 | 2018-10-06T16:55:20.000Z | 2021-10-31T18:25:35.000Z | src/cpp/bigInteger.cpp | Praggya17/HacktoberFestContribute | 098cb1012f1f2ed6ca6b3544a7b962b6c49e2643 | [
"MIT"
] | 885 | 2018-10-06T17:14:44.000Z | 2022-01-29T03:16:21.000Z | /*
@author: Priyendu Mori
Big Integer library that supports add, sub, mul, div and gcd of large numbers
*/
#include <bits/stdc++.h>
#include <string>
#define ll long long
using namespace std;
string add(string, string);
string sub(string, string);
bool isSmaller(string x, string y)
{
for (ll i=0; i<x.length(); i++){
if (x[i] < y[i]) return true;
else if (x[i] > y[i]) return false;
}
return false;
}
bool isGreater(string x, string y){
if(x.length() > y.length()) return true;
ll pad=llabs(x.length()-y.length());
if(x.length()<y.length()){
x=string(pad, '0').append(x);
}
else{
y=string(pad, '0').append(y);
}
for (ll i=0; i<x.length(); i++){
if (x[i] > y[i]) return true;
else if (x[i] < y[i]) return false;
}
return false;
}
bool isEqual(string x, string y){
ll pad=llabs(x.length()-y.length());
if(x.length()<y.length()){
x=string(pad, '0').append(x);
}
else{
y=string(pad, '0').append(y);
}
for (ll i=0; i<x.length(); i++){
if (x[i] != y[i]) return false;
}
return true;
}
bool isZero(string x){
for(ll i=0;i<x.length();i++){
if(x[i] != '0') return false;
}
return true;
}
string sub(string x, string y){
bool neg=false;
if(x[0]=='-' && y[0]=='-'){
string temp=x;
x=y;
y=temp;
y=y.substr(1,y.length()-1);
x=x.substr(1,x.length()-1);
}
else if(x[0]!='-' && y[0]=='-'){
y=y.substr(1,y.length()-1);
return add(x,y);
}
else if(x[0]=='-' && y[0]!='-'){
x=x.substr(1,x.length()-1);
string ans="-"+add(x,y);
return ans;
}
ll pad=llabs(x.length()-y.length());
if(x.length()<y.length()){
x=string(pad, '0').append(x);
}
else{
y=string(pad, '0').append(y);
}
if(isSmaller(x, y)){
string temp=x;
x=y;
y=temp;
neg=true;
}
string diff="";
int carry=0;
for(ll i=x.length()-1;i>=0;i--){
ll d = (x[i]-'0') - (y[i]-'0') - carry;
if(d < 0){
d=d+10;
carry=1;
diff.push_back(d+'0');
}
else{
carry=0;
diff.push_back(d+'0');
}
}
reverse(diff.begin(), diff.end());
diff.erase(0, min(diff.find_first_not_of('0'), diff.length()-1));
if(neg) diff.insert(diff.begin(),'-');
return diff;
}
string add(string x, string y){
bool neg=false;
if(x[0]=='-' && y[0]!='-'){
x=x.substr(1,x.length()-1);
return sub(y, x);
}
else if(x[0]!='-' && y[0]=='-'){
y=y.substr(1,y.length()-1);
return sub(x, y);
}
else if(x[0]=='-' && y[0]=='-'){
neg=true;
x=x.substr(1,x.length()-1);
y=y.substr(1,y.length()-1);
}
ll pad=llabs(x.length()-y.length());
if(x.length()<y.length()){
x=string(pad, '0').append(x);
}
else{
y=string(pad, '0').append(y);
}
string sum="";
int carry=0;
for(ll i=x.length()-1;i>=0;i--){
ll s = x[i]-'0' + y[i]-'0' + carry;
if(s <= 9){
sum.push_back(s+'0');
carry=0;
}
else{
sum.push_back(s%10 +'0');
carry=s/10;
}
}
if(carry!=0){
sum.push_back(carry+'0');
}
if(neg) sum.push_back('-');
reverse(sum.begin(), sum.end());
sum.erase(0, min(sum.find_first_not_of('0'), sum.length()-1));
return sum;
}
string mul(string x, string y){
bool neg=false;
if(x[0]=='-' && y[0]=='-'){
x=x.substr(1,x.length()-1);
y=y.substr(1,y.length()-1);
}
else if(x[0]=='-' && y[0]!='-'){
x=x.substr(1,x.length()-1);
neg=true;
}
else if(x[0]!='-' && y[0]=='-'){
y=y.substr(1,y.length()-1);
neg=true;
}
string finalproduct="";
for(ll i=0;i<y.length();i++){
ll multiplier=y[i]-'0';
string product="";
int carry=0;
//cout<<"multiplying "<<multiplier<<" and "<<x<<endl;
for(ll j=x.length()-1;j>=0;j--){
int p=(x[j]-'0')*multiplier + carry;
if(p<=9){
product.push_back(p+'0');
carry=0;
}
else{
product.push_back(p%10 + '0');
carry=p/10;
}
}
if(carry!=0) product+=carry+'0';
//cout<<"ans "<<product<<endl;
if(i==0){
reverse(product.begin(), product.end());
finalproduct=product;
}
else{
finalproduct+='0';
reverse(product.begin(), product.end());
//cout<<"adding "<<finalproduct<<" and "<<product<<endl;
finalproduct=add(finalproduct, product);
}
}
if(neg) finalproduct.insert(finalproduct.begin(), '-');
return finalproduct;
}
string div(string x, string y){
bool neg=false;
if(x[0]=='-' && y[0]=='-'){
x=x.substr(1,x.length()-1);
y=y.substr(1,y.length()-1);
}
else if(x[0]=='-' && y[0]!='-'){
x=x.substr(1,x.length()-1);
neg=true;
}
else if(x[0]!='-' && y[0]=='-'){
y=y.substr(1,y.length()-1);
neg=true;
}
ll pad=llabs(x.length()-y.length());
if(x.length()<y.length()){
x=string(pad, '0').append(x);
}
else{
y=string(pad, '0').append(y);
}
if(isSmaller(x,y)) return "0";
string count="0";
while(isGreater(x, y)){
//cout<<x<<" - "<<y<<" = ";
x=sub(x, y);
//cout<<x<<"\t";
count=add(count, "1");
//cout<<count<<endl;
// cout<<"isGreater("<<x<<","<<y<<") = "<<isGreater(x ,y)<< endl;
}
if(isEqual(x,y)) count=add(count, "1");
if(neg) return '-'+count;
return count;
}
string gcd(string x, string y){
while(!isZero(x) && !isZero(y)){
if(isGreater(x,y)){
x=sub(x,y);
}
else if(isGreater(y,x)){
y=sub(y,x);
}
else{
x=sub(x,y);
}
}
if(isZero(x)){
return y;
}
if(isZero(y)){
return x;
}
return "1";
}
int main(){
ios_base::sync_with_stdio(false);
ll t;
cin>>t;
while(t--){
string x,y;
ll k;
cin>>x>>y>>k;
string ans="";
switch(k){
case 1: ans=add(x,y); break;
case 2: ans=sub(x,y); break;
case 3: ans=mul(x,y); break;
case 4: ans=div(x,y); break;
case 5: ans=gcd(x,y); break;
}
cout<<ans<<endl;
}
return 0;
}
| 21.009346 | 81 | 0.440391 | Praggya17 |
805ea71dabf146f76d987af60fe31fc1d9cb9102 | 11,863 | hpp | C++ | src/game_api/state.hpp | iojon/overlunky | 096902bf8f0de28522ab140d900d64354ce536ac | [
"MIT"
] | null | null | null | src/game_api/state.hpp | iojon/overlunky | 096902bf8f0de28522ab140d900d64354ce536ac | [
"MIT"
] | null | null | null | src/game_api/state.hpp | iojon/overlunky | 096902bf8f0de28522ab140d900d64354ce536ac | [
"MIT"
] | 1 | 2020-11-14T14:45:16.000Z | 2020-11-14T14:45:16.000Z | #pragma once
#include "items.hpp"
#include "layer.hpp"
#include "memory.hpp"
#include "savedata.hpp"
#include "screen.hpp"
#include "screen_arena.hpp"
#include "state_structs.hpp"
#include "thread_utils.hpp"
const float ZF = 0.737f;
struct Layer;
struct LevelGenSystem;
struct StateMemory
{
size_t p00;
uint32_t screen_last;
uint32_t screen;
uint32_t screen_next;
uint32_t loading;
Illumination* illumination;
float fadevalue; // 0.0 = all visible; 1.0 = all black
uint32_t fadeout;
uint32_t fadein;
uint32_t loading_black_screen_timer; // if state.loading is 1, this timer counts down to 0 while the screen is black (used after Ouroboros, in
// credits, ...)
uint8_t ingame;
uint8_t playing;
uint8_t pause;
uint8_t b33;
int32_t i34;
uint32_t quest_flags;
uint8_t correct_ushabti; // correct_ushabti = anim_frame - (2 * floor(anim_frame/12))
uint8_t i3cb;
uint8_t i3cc;
uint8_t i3cd;
ENT_TYPE speedrun_character; // who administers the speedrun in base camp
uint8_t speedrun_activation_trigger; // must transition from true to false to activate it
uint8_t padding4;
uint8_t padding5;
uint8_t padding6;
uint32_t w;
uint32_t h;
int8_t kali_favor;
int8_t kali_status;
int8_t kali_altars_destroyed;
uint8_t b4f;
int32_t i50;
int32_t money_shop_total; // total $ spent at shops, persists between levels, number will be negative
uint8_t world_start;
uint8_t level_start;
uint8_t theme_start;
uint8_t b5f;
uint32_t seed;
uint32_t time_total;
uint8_t world;
uint8_t world_next;
uint8_t level;
uint8_t level_next;
int32_t i6c; // i6c and i70 are a pointer to ThemeInfo (todo)
int32_t i70;
uint8_t theme;
uint8_t theme_next;
uint8_t win_state; // 0 = no win 1 = tiamat win 2 = hundun win 3 = CO win; set this and next doorway leads to victory scene
uint8_t b73;
ENT_TYPE end_spaceship_character; // who pops out the spaceship for a tiamat/hundun win
uint8_t shoppie_aggro;
uint8_t shoppie_aggro_levels;
uint8_t merchant_aggro;
uint8_t saved_dogs;
uint8_t saved_cats;
uint8_t saved_hamsters;
uint8_t kills_npc;
uint8_t level_count;
uint8_t unknown1a;
uint8_t unknown1b;
bool world2_coffin_spawned;
bool world4_coffin_spawned;
bool world6_coffin_spawned;
uint8_t unknown2b;
uint8_t unknown2c;
uint8_t unknown2d;
ENT_TYPE waddler_storage[99];
int16_t waddler_storage_meta[99]; // to store mattock durability for example
uint16_t journal_progression_count;
JournalProgressionSlot journal_progression_slots[40];
uint8_t skip2[844];
ThemeProgression theme_progression;
uint8_t unknown3;
uint8_t unknown4;
uint8_t unknown5a;
uint8_t unknown5b;
uint8_t unknown5c;
uint8_t unknown5d;
ArenaState arena;
uint32_t journal_flags;
ENT_TYPE first_damage_cause; // entity type that caused first damage, for the journal
int8_t first_damage_world;
int8_t first_damage_level;
uint8_t i9f4c;
uint8_t i9f4d;
uint32_t time_last_level;
uint32_t time_level;
uint32_t time_speedrun;
uint32_t money_last_levels;
int32_t hud_flags;
uint32_t presence_flags;
ENT_TYPE coffin_contents; // entity type - the contents of the coffin that will be spawned (during levelgen)
uint8_t cause_of_death;
uint8_t padding10;
uint8_t padding11;
uint8_t padding12;
ENT_TYPE cause_of_death_entity_type;
int32_t waddler_floor_storage; // entity uid of the first floor_storage entity
size_t toast;
size_t speechbubble;
uint32_t speechbubble_timer;
uint32_t toast_timer;
int32_t speechbubble_owner;
Dialogue basecamp_dialogue;
// screen pointers below are most likely in an array and indexed through the screen ID (-10), hence the nullptrs for
// screens that are available in GameManager
ScreenTeamSelect* screen_team_select;
ScreenCamp* screen_camp;
ScreenLevel* screen_level;
ScreenTransition* screen_transition;
ScreenDeath* screen_death;
size_t unknown_screen_spaceship; // potentially ScreenSpaceship, but is nullptr (there is no UI rendering on spaceship anyway)
ScreenWin* screen_win;
ScreenCredits* screen_credits;
ScreenScores* screen_scores;
ScreenConstellation* screen_constellation;
ScreenRecap* screen_recap;
size_t unknown_screen_arena_menu; // potentially ScreenArenaMenu, available in GameManager
ScreenArenaStagesSelect* screen_arena_stages_select1;
size_t unknown_screen_arena_intro; // potentially ScreenArenaIntro, available in GameManager
ScreenArenaStagesSelect* screen_arena_stages_select2;
ScreenArenaIntro* screen_arena_intro;
ScreenArenaLevel* screen_arena_level;
ScreenArenaScore* screen_arena_score;
size_t unknown_screen_online_loading; // potentially ScreenOnlineLoading, available in GameManager
size_t unknown_screen_online_lobby; // potentially ScreenOnlineLobby, available in GameManager
uint32_t next_entity_uid;
uint16_t unknown20;
uint16_t screen_change_counter; // increments every time screen changes; used in online sync together with next_entity_uid and unknown20 as a 64bit number
PlayerInputs* player_inputs;
Items* items;
LevelGenSystem* level_gen;
Layer* layers[2];
Logic* logic;
QuestsInfo* quests;
std::unordered_map<uint32_t, int32_t>* ai_targets; // e.g. hired hand uid -> snake uid
LiquidPhysics* liquid_physics;
PointerList* particle_emitters; // list of ParticleEmitterInfo*
PointerList* lightsources; // list of Illumination*
size_t unknown27;
std::unordered_map<uint32_t, Entity*> instance_id_to_pointer;
size_t unknown28;
size_t unknown29;
size_t unknown30;
uint32_t layer_transition_effect_timer;
uint8_t camera_layer;
uint8_t unknowk31a;
uint8_t unknowk31b;
uint8_t unknowk31c;
size_t unknown32;
size_t unknown33;
size_t unknown34;
size_t unknown35;
size_t unknown36;
uint32_t time_startup;
uint32_t special_visibility_flags;
Camera* camera;
/// Returns animation_frame of the correct ushabti
uint16_t get_correct_ushabti();
void set_correct_ushabti(uint16_t animation_frame);
};
struct State
{
size_t location;
size_t addr_damage;
size_t addr_insta;
size_t addr_zoom;
size_t addr_zoom_shop;
size_t addr_dark;
static void set_write_load_opt(bool allow);
static State& get();
// Returns the main-thread version of StateMemory*
StateMemory* ptr() const;
// Returns the local-thread version of StateMemory*
StateMemory* ptr_local() const;
Layer* layer(uint8_t index)
{
return ptr()->layers[index];
}
Layer* layer_local(uint8_t index)
{
return ptr_local()->layers[index];
}
Items* items()
{
auto pointer = ptr()->items;
return (Items*)(pointer);
}
void godmode(bool g)
{
// log::debug!("God {:?}" mode; g);
if (g)
{
write_mem_prot(addr_damage, ("\xC3"s), true);
write_mem_prot(addr_insta, ("\xC3"s), true);
}
else
{
write_mem_prot(addr_damage, ("\x48"s), true);
write_mem_prot(addr_insta, ("\x40"s), true);
}
}
void darkmode(bool g)
{
// log::debug!("God {:?}" mode; g);
if (g)
{
write_mem_prot(addr_dark, ("\x90\x90"s), true);
}
else
{
write_mem_prot(addr_dark, ("\xEB\x2E"s), true);
}
}
void zoom(float level)
{
// This technically sets camp zoom but not interactively :(
// auto addr_zoom = find_inst(memory.exe(), &hex!("C7 80 E8 04 08 00"),
// memory.after_bundle); write_mem_prot(memory.at_exe(addr_zoom + 6),
// to_le_bytes(level), true); addr_zoom = memory.after_bundle;
auto roomx = ptr()->w;
if (level == 0.0)
{
switch (roomx)
{
case 1:
level = 9.50f;
break;
case 2:
level = 16.29f;
break;
case 3:
level = 23.08f;
break;
case 4:
level = 29.87f;
break;
case 5:
level = 36.66f;
break;
case 6:
level = 43.45f;
break;
case 7:
level = 50.24f;
break;
case 8:
level = 57.03f;
break;
default:
level = 13.5f;
}
}
static size_t offset[4] = {0}; // where the different hardcoded zoom levels are written
if (offset[0] == 0)
{
auto memory = Memory::get();
auto _addr_zoom = memory.after_bundle;
for (int i = 0; i < 4; i++)
{
_addr_zoom = find_inst(memory.exe(), "\x48\x8B\x48\x10\xC7\x81"s, _addr_zoom + 1);
offset[i] = memory.at_exe(_addr_zoom) + 10;
}
}
if (offset[0] != 0)
write_mem_prot(offset[0], to_le_bytes(level), true); // I dunno :D
if (offset[1] != 0)
write_mem_prot(offset[1], to_le_bytes(level), true); // shop
if (offset[2] != 0)
write_mem_prot(offset[2], to_le_bytes(level), true); // level
if (offset[3] != 0)
write_mem_prot(offset[3], to_le_bytes(level), true); // default (camp, transition)
static size_t real_offset = 0; // actual target zoom level
if (real_offset == 0)
{
auto memory = Memory::get();
auto _offset = memory.at_exe(0x22334A00); //TODO: patterns or something. Also this pointer is kinda slow, it doesn't work before intro cutscene.
_offset = read_u64(_offset);
if (_offset != 0)
{
_offset += 0x804f0;
real_offset = _offset;
}
}
if (real_offset != 0)
{
write_mem_prot(real_offset, to_le_bytes(level), true);
}
}
std::pair<float, float> click_position(float x, float y);
std::pair<float, float> screen_position(float x, float y);
float get_zoom_level();
uint32_t flags()
{
return ptr()->hud_flags;
}
void set_flags(uint32_t f)
{
ptr()->hud_flags = f;
}
void set_pause(uint8_t p)
{
ptr()->pause = p;
}
uint32_t get_frame_count()
{
return read_u32((size_t)ptr() - 0xd0);
}
std::vector<int64_t> read_prng()
{
std::vector<int64_t> prng;
for (int i = 0; i < 20; ++i)
{
prng.push_back(read_i64((size_t)ptr() - 0xb0 + 8 * static_cast<size_t>(i)));
}
return prng;
}
Entity* find(uint32_t unique_id)
{
auto& map = ptr()->instance_id_to_pointer;
auto it = map.find(unique_id);
if (it == map.end())
return nullptr;
return it->second;
}
std::pair<float, float> get_camera_position();
void set_camera_position(float cx, float cy);
void warp(uint8_t w, uint8_t l, uint8_t t);
void set_seed(uint32_t seed);
SaveData* savedata();
};
| 31.634667 | 159 | 0.610975 | iojon |
805f5b72a24bbc10381767291985701ab8bf2916 | 342 | cc | C++ | runtime/chxvm_op.cc | vermashresth/chainer-compiler | 5f5ad365d14398d6ae0214fa012eb10360db8e7e | [
"MIT"
] | 116 | 2019-01-25T03:54:44.000Z | 2022-03-08T00:11:14.000Z | runtime/chxvm_op.cc | vermashresth/chainer-compiler | 5f5ad365d14398d6ae0214fa012eb10360db8e7e | [
"MIT"
] | 431 | 2019-01-25T10:18:44.000Z | 2020-06-17T05:28:55.000Z | runtime/chxvm_op.cc | vermashresth/chainer-compiler | 5f5ad365d14398d6ae0214fa012eb10360db8e7e | [
"MIT"
] | 26 | 2019-01-25T07:21:09.000Z | 2021-11-26T04:24:35.000Z | #include "runtime/chxvm_op.h"
#include <common/strutil.h>
namespace chainer_compiler {
namespace runtime {
ChxVMOp::ChxVMOp(const ChxVMInstructionProto& inst)
: inst_(inst), id_(inst.id()), op_(inst.op()), name_(StrCat(ChxVMInstructionProto_Op_Name(inst.op()), inst.id())) {
}
} // namespace runtime
} // namespace chainer_compiler
| 24.428571 | 119 | 0.72807 | vermashresth |
80629117d2c79ecfb56e7211afef34ff974ecfd5 | 18,248 | cpp | C++ | tags/20090801_v0.2.0/src/singlePlayer/wh/CSelectTeamWindowHandler.cpp | dividio/projectfootball | 3c0b94937de2e3cd6e7daf9d3b4942fda974f20c | [
"Zlib"
] | null | null | null | tags/20090801_v0.2.0/src/singlePlayer/wh/CSelectTeamWindowHandler.cpp | dividio/projectfootball | 3c0b94937de2e3cd6e7daf9d3b4942fda974f20c | [
"Zlib"
] | null | null | null | tags/20090801_v0.2.0/src/singlePlayer/wh/CSelectTeamWindowHandler.cpp | dividio/projectfootball | 3c0b94937de2e3cd6e7daf9d3b4942fda974f20c | [
"Zlib"
] | null | null | null | /******************************************************************************
* Copyright (C) 2008 - Ikaro Games www.ikarogames.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 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. *
* *
* *
******************************************************************************/
#include <libintl.h>
#include "CSelectTeamWindowHandler.h"
#include "../db/bean/CPfTeams.h"
#include "../db/bean/CPfConfederations.h"
#include "../db/bean/CPfCountries.h"
#include "../db/bean/CPfCompetitions.h"
#include "../db/dao/factory/IDAOFactory.h"
#include "../option/CSinglePlayerOptionManager.h"
#include "../CSinglePlayerGame.h"
#include "../../engine/CGameEngine.h"
#include "../../exceptions/PFException.h"
#include "../../utils/CLog.h"
#include "../../utils/gui/CImageListboxItem.h"
CSelectTeamWindowHandler::CSelectTeamWindowHandler(CSinglePlayerGame &game)
: CWindowHandler("selectTeam.layout"), m_game(game)
{
LOG_DEBUG("CSelectTeamWindowHandler()");
m_confederationsList = NULL;
m_countriesList = NULL;
m_competitionsList = NULL;
m_teamsList = NULL;
m_lastSeason = NULL;
}
CSelectTeamWindowHandler::~CSelectTeamWindowHandler()
{
LOG_DEBUG("~CSelectTeamWindowHandler()");
}
void CSelectTeamWindowHandler::init()
{
CEGUI::WindowManager *windowMngr = CEGUI::WindowManager::getSingletonPtr();
m_selectButton = static_cast<CEGUI::PushButton*>(windowMngr->getWindow((CEGUI::utf8*)"SelectTeam/SelectButton"));
m_backButton = static_cast<CEGUI::PushButton*>(windowMngr->getWindow((CEGUI::utf8*)"SelectTeam/BackButton"));
m_guiTeamsList = static_cast<CEGUI::ItemListbox*>(windowMngr->getWindow((CEGUI::utf8*)"SelectTeam/TeamsList"));
m_guiTeamName = static_cast<CEGUI::Window*>(windowMngr->getWindow((CEGUI::utf8*)"SelectTeam/TeamName"));
m_guiTeamBudget = static_cast<CEGUI::Window*>(windowMngr->getWindow((CEGUI::utf8*)"SelectTeam/TeamBudget"));
m_guiTeamShield = static_cast<CEGUI::Window*>(windowMngr->getWindow((CEGUI::utf8*)"SelectTeam/TeamShield"));
m_guiConfederationImage = static_cast<CEGUI::Window*>(windowMngr->getWindow((CEGUI::utf8*)"SelectTeam/ConfederationImage"));
m_guiCountryImage = static_cast<CEGUI::Window*>(windowMngr->getWindow((CEGUI::utf8*)"SelectTeam/CountryImage"));
m_guiTeamAverage = static_cast<CEGUI::Window*>(windowMngr->getWindow((CEGUI::utf8*)"SelectTeam/TeamAverage"));
m_confederationsCombobox = static_cast<CEGUI::Combobox*>(windowMngr->getWindow((CEGUI::utf8*)"SelectTeam/Confederation"));
m_countriesCombobox = static_cast<CEGUI::Combobox*>(windowMngr->getWindow((CEGUI::utf8*)"SelectTeam/Country"));
m_competitionsCombobox = static_cast<CEGUI::Combobox*>(windowMngr->getWindow((CEGUI::utf8*)"SelectTeam/Competition"));
m_confederationsCombobox->getEditbox()->setEnabled(false);
m_countriesCombobox ->getEditbox()->setEnabled(false);
m_competitionsCombobox ->getEditbox()->setEnabled(false);
m_guiTeamsList->setWantsMultiClickEvents(true);
// i18n support
m_backButton ->setText((CEGUI::utf8*)gettext("Back"));
m_selectButton->setText((CEGUI::utf8*)gettext("Select Team"));
static_cast<CEGUI::Window*>(windowMngr->getWindow((CEGUI::utf8*)"SelectTeam/SelectTeamLabel"))->setText((CEGUI::utf8*)gettext("Please, select your team:"));
static_cast<CEGUI::Window*>(windowMngr->getWindow((CEGUI::utf8*)"SelectTeam/NameLabel"))->setText((CEGUI::utf8*)gettext("Name:"));
static_cast<CEGUI::Window*>(windowMngr->getWindow((CEGUI::utf8*)"SelectTeam/BudgetLabel"))->setText((CEGUI::utf8*)gettext("Budget:"));
static_cast<CEGUI::Window*>(windowMngr->getWindow((CEGUI::utf8*)"SelectTeam/AverageLabel"))->setText((CEGUI::utf8*)gettext("Average:"));
static_cast<CEGUI::Window*>(windowMngr->getWindow((CEGUI::utf8*)"SelectTeam/ConfederationLabel"))->setText((CEGUI::utf8*)gettext("Confederation:"));
static_cast<CEGUI::Window*>(windowMngr->getWindow((CEGUI::utf8*)"SelectTeam/CountryLabel"))->setText((CEGUI::utf8*)gettext("Country:"));
static_cast<CEGUI::Window*>(windowMngr->getWindow((CEGUI::utf8*)"SelectTeam/CompetitionLabel"))->setText((CEGUI::utf8*)gettext("Competition:"));
// Event handle
registerEventConnection(m_confederationsCombobox->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber(&CSelectTeamWindowHandler::confederationsComboboxListSelectionChanged, this)));
registerEventConnection(m_countriesCombobox ->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber(&CSelectTeamWindowHandler::countriesComboboxListSelectionChanged, this)));
registerEventConnection(m_competitionsCombobox ->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber(&CSelectTeamWindowHandler::competitionsComboboxListSelectionChanged, this)));
registerEventConnection(m_guiTeamsList ->subscribeEvent(CEGUI::ItemListbox::EventSelectionChanged, CEGUI::Event::Subscriber(&CSelectTeamWindowHandler::teamsListboxSelectionChanged, this)));
registerEventConnection(m_guiTeamsList ->subscribeEvent(CEGUI::ItemListbox::EventMouseDoubleClick, CEGUI::Event::Subscriber(&CSelectTeamWindowHandler::teamsListboxMouseDoubleClick, this)));
registerEventConnection(m_selectButton ->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&CSelectTeamWindowHandler::selectButtonClicked, this)));
registerEventConnection(m_backButton ->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&CSelectTeamWindowHandler::backButtonClicked, this)));
}
void CSelectTeamWindowHandler::enter()
{
loadLastSeason();
int confederation = loadConfederationsList();
int country = loadCountriesList(confederation);
int competition = loadCompetitionsList(country);
loadTeamList(competition);
m_selectButton->setEnabled(false);
}
void CSelectTeamWindowHandler::leave()
{
if(m_confederationsList!=NULL) {
m_game.getIDAOFactory()->getIPfConfederationsDAO()->freeVector(m_confederationsList);
m_confederationsList = NULL;
}
if(m_countriesList!=NULL) {
m_game.getIDAOFactory()->getIPfCountriesDAO()->freeVector(m_countriesList);
m_countriesList = NULL;
}
if(m_competitionsList!=NULL) {
m_game.getIDAOFactory()->getIPfCompetitionsDAO()->freeVector(m_competitionsList);
m_competitionsList = NULL;
}
if(m_teamsList!=NULL) {
m_game.getIDAOFactory()->getIPfTeamsDAO()->freeVector(m_teamsList);
m_teamsList = NULL;
}
if( m_lastSeason!=NULL ){
delete m_lastSeason;
m_lastSeason = NULL;
}
m_confederationsCombobox->resetList();
m_countriesCombobox ->resetList();
m_competitionsCombobox ->resetList();
m_guiTeamsList ->resetList();
clearTeamInfo();
}
void CSelectTeamWindowHandler::loadLastSeason()
{
if( m_lastSeason!=NULL ){
delete m_lastSeason;
m_lastSeason = NULL;
}
IPfSeasonsDAO *seasonsDAO = m_game.getIDAOFactory()->getIPfSeasonsDAO();
m_lastSeason = seasonsDAO->findLastSeason();
if( m_lastSeason==NULL || m_lastSeason->getXSeason_str()=="" ){
throw PFEXCEPTION("[CSelectTeamWindowHandler::loadLastSeason] Last season not found");
}
}
int CSelectTeamWindowHandler::loadConfederationsList()
{
IPfConfederationsDAO *confederationsDAO = m_game.getIDAOFactory()->getIPfConfederationsDAO();
if(m_confederationsList!=NULL) {
confederationsDAO->freeVector(m_confederationsList);
}
m_confederationsList = confederationsDAO->findByXFKSeasonWithLeague(m_lastSeason->getXSeason_str());
std::vector<CPfConfederations*>::iterator it;
for(it = m_confederationsList->begin(); it != m_confederationsList->end(); it++) {
CPfConfederations *confederation = (*it);
m_confederationsCombobox->addItem(new CEGUI::ListboxTextItem
((CEGUI::utf8*)confederation->getSConfederation().c_str(), confederation->getXConfederation()));
}
CPfConfederations *conf = m_confederationsList->front();
m_confederationsCombobox->setText((CEGUI::utf8*)conf->getSConfederation().c_str());
m_guiConfederationImage->setProperty("Image", "set:"+ conf->getSLogo() +" image:"+conf->getSLogo()+"_map");
return m_confederationsList->front()->getXConfederation();
}
int CSelectTeamWindowHandler::loadCountriesList(int XConfederation)
{
IPfCountriesDAO *countriesDAO = m_game.getIDAOFactory()->getIPfCountriesDAO();
if(m_countriesList!=NULL) {
countriesDAO->freeVector(m_countriesList);
}
m_countriesList = countriesDAO->findByXFkConfederationAndXFKSeasonWithLeague(XConfederation, m_lastSeason->getXSeason());
int selectedCountry = -1;
if(!m_countriesList->empty()) {
std::vector<CPfCountries*>::iterator it;
for(it = m_countriesList->begin(); it != m_countriesList->end(); it++) {
CPfCountries *country = (*it);
m_countriesCombobox->addItem(new CEGUI::ListboxTextItem
((CEGUI::utf8*)country->getSShortName().c_str(), country->getXCountry()));
}
CPfCountries *country = m_countriesList->front();
m_countriesCombobox->setText((CEGUI::utf8*)country->getSShortName().c_str());
m_guiCountryImage->setProperty("Image", "set:"+ country->getSFlag() +" image:"+country->getSFlag()+"_map");
selectedCountry = m_countriesList->front()->getXCountry();
} else {
m_countriesCombobox->setText((CEGUI::utf8*)gettext("No countries"));
}
return selectedCountry;
}
int CSelectTeamWindowHandler::loadCompetitionsList(int XCountry)
{
IPfCompetitionsDAO *competitionsDAO = m_game.getIDAOFactory()->getIPfCompetitionsDAO();
if(m_competitionsList!=NULL) {
competitionsDAO->freeVector(m_competitionsList);
}
m_competitionsList = competitionsDAO->findByXFkCountryAndXFKSeason(XCountry, m_lastSeason->getXSeason());
int selectedCompetition = -1;
if(!m_competitionsList->empty()) {
std::vector<CPfCompetitions*>::iterator it;
for(it = m_competitionsList->begin(); it != m_competitionsList->end(); it++) {
CPfCompetitions *competition = (*it);
m_competitionsCombobox->addItem(new CEGUI::ListboxTextItem
((CEGUI::utf8*)competition->getSCompetition().c_str(), competition->getXCompetition()));
}
m_competitionsCombobox->setText((CEGUI::utf8*)m_competitionsList->front()->getSCompetition().c_str());
selectedCompetition = m_competitionsList->front()->getXCompetition();
} else {
m_competitionsCombobox->setText((CEGUI::utf8*)gettext("No competitions"));
}
return selectedCompetition;
}
void CSelectTeamWindowHandler::loadTeamList(int XCompetition)
{
IPfTeamsDAO* teamsDAO = m_game.getIDAOFactory()->getIPfTeamsDAO();
if(m_teamsList!=NULL) {
teamsDAO->freeVector(m_teamsList);
}
m_teamsList = teamsDAO->findByXFKCompetitionAndXFKSeason(XCompetition, m_lastSeason->getXSeason());
if(!m_teamsList->empty()) {
CEGUI::WindowManager * m_WndMgr = CEGUI::WindowManager::getSingletonPtr();
std::vector<CPfTeams*>::iterator it;
for( it=m_teamsList->begin(); it!=m_teamsList->end(); it++ ){
CPfTeams *team = (*it);
CEGUI::CImageListboxItem *item = (CEGUI::CImageListboxItem*)m_WndMgr->createWindow("ArridiDesign/ImageListboxItem", (CEGUI::utf8*)team->getSTeam().c_str());
item->setID(team->getXTeam());
item->getChildAtIdx(0)->setProperty("Image", "set:"+ team->getSLogo() +" image:"+team->getSLogo()+"_s");
item->setText((CEGUI::utf8*)team->getSTeam().c_str());
m_guiTeamsList->addItem(item);
}
}
}
bool CSelectTeamWindowHandler::teamsListboxSelectionChanged(const CEGUI::EventArgs& e)
{
if(m_guiTeamsList->getFirstSelectedItem()!=0 && m_teamsList!=NULL) {
m_selectButton->setEnabled(true);
CEGUI::ItemEntry* item = m_guiTeamsList->getFirstSelectedItem();
int xTeam = item->getID();
std::vector<CPfTeams*>::iterator it;
bool found=false;
it=m_teamsList->begin();
while(it!=m_teamsList->end() && !found) {
CPfTeams *team = (*it);
if(team->getXTeam() == xTeam) {
loadTeamInfo(team);
found = true;
}
it++;
}
} else {
m_selectButton->setEnabled(false);
clearTeamInfo();
}
return true;
}
bool CSelectTeamWindowHandler::confederationsComboboxListSelectionChanged(const CEGUI::EventArgs& e)
{
CEGUI::ListboxItem *item = m_confederationsCombobox->getSelectedItem();
if(item != NULL) {
IPfConfederationsDAO *confederationsDAO = m_game.getIDAOFactory()->getIPfConfederationsDAO();
CPfConfederations *conf = confederationsDAO->findByXConfederation(item->getID());
m_confederationsCombobox->setText(item->getText());
m_guiConfederationImage->setProperty("Image", "set:"+ conf->getSLogo() +" image:"+conf->getSLogo()+"_map");
m_countriesCombobox->clearAllSelections();
m_countriesCombobox->resetList();
m_countriesCombobox->getEditbox()->setText("");
m_guiCountryImage->setProperty("Image", "set: image:full_image");
m_competitionsCombobox->clearAllSelections();
m_competitionsCombobox->resetList();
m_competitionsCombobox->getEditbox()->setText("");
m_guiTeamsList->resetList();
m_selectButton->setEnabled(false);
clearTeamInfo();
int country = loadCountriesList(item->getID());
int competition = loadCompetitionsList(country);
loadTeamList(competition);
}
return true;
}
bool CSelectTeamWindowHandler::countriesComboboxListSelectionChanged(const CEGUI::EventArgs& e)
{
CEGUI::ListboxItem *item = m_countriesCombobox->getSelectedItem();
if(item != NULL) {
IPfCountriesDAO *countriesDAO = m_game.getIDAOFactory()->getIPfCountriesDAO();
CPfCountries *country = countriesDAO->findByXCountry(item->getID());
m_countriesCombobox->setText(item->getText());
m_guiCountryImage->setProperty("Image", "set:"+ country->getSFlag() +" image:"+country->getSFlag()+"_map");
m_competitionsCombobox->clearAllSelections();
m_competitionsCombobox->resetList();
m_competitionsCombobox->getEditbox()->setText("");
m_guiTeamsList->resetList();
m_selectButton->setEnabled(false);
clearTeamInfo();
int competition = loadCompetitionsList(item->getID());
loadTeamList(competition);
}
return true;
}
bool CSelectTeamWindowHandler::competitionsComboboxListSelectionChanged(const CEGUI::EventArgs& e)
{
CEGUI::ListboxItem *item = m_competitionsCombobox->getSelectedItem();
if(item != NULL) {
m_competitionsCombobox->setText(item->getText());
m_guiTeamsList->resetList();
m_selectButton->setEnabled(false);
clearTeamInfo();
loadTeamList(item->getID());
}
return true;
}
bool CSelectTeamWindowHandler::teamsListboxMouseDoubleClick(const CEGUI::EventArgs& e)
{
if(m_guiTeamsList->getFirstSelectedItem()!=0) {
selectButtonClicked(e);
}
return true;
}
bool CSelectTeamWindowHandler::selectButtonClicked(const CEGUI::EventArgs& e)
{
CEGUI::ItemEntry* item = m_guiTeamsList->getFirstSelectedItem();
m_game.getOptionManager()->setGamePlayerTeam(item->getID());
m_game.getOptionManager()->setGameNew(false);
CGameEngine::getInstance()->getWindowManager()->nextScreen("Game");
CGameEngine::getInstance()->getWindowManager()->clearHistory();
return true;
}
bool CSelectTeamWindowHandler::backButtonClicked(const CEGUI::EventArgs& e)
{
CGameEngine::getInstance()->getWindowManager()->previousScreen();
return true;
}
void CSelectTeamWindowHandler::loadTeamInfo(CPfTeams *team)
{
// TODO Add more team information
m_guiTeamName->setText((CEGUI::utf8*)team->getSTeam().c_str());
std::ostringstream budget;
budget << team->getNBudget();
m_guiTeamBudget->setText((CEGUI::utf8*)budget.str().c_str());
IPfTeamAveragesDAO *teamAveragesDAO = m_game.getIDAOFactory()->getIPfTeamAveragesDAO();
CPfTeamAverages *teamAverage = teamAveragesDAO->findByXTeam(team->getXTeam_str());
std::ostringstream average;
average << teamAverage->getNTotal();
m_guiTeamAverage->setText((CEGUI::utf8*)average.str().c_str());
delete teamAverage;
//Loading Shield
m_guiTeamShield->setProperty("Image", "set:"+ team->getSLogo() +" image:"+team->getSLogo()+"_b");
}
void CSelectTeamWindowHandler::clearTeamInfo()
{
// TODO Clear all team information
m_guiTeamName ->setText("");
m_guiTeamBudget ->setText("");
m_guiTeamAverage->setText("");
m_guiTeamShield ->setProperty("Image", "set: image:full_image");
}
| 46.43257 | 218 | 0.678431 | dividio |
8063c264cbd2bfa952a1ee4fb10a3a7a290bac0b | 1,171 | cc | C++ | patches/process-kill_posix.cc | bolthole/solaris-chromium-patches | 5ed86010096ace6e50bfa97bb8ca0237b0f834ee | [
"Apache-2.0"
] | null | null | null | patches/process-kill_posix.cc | bolthole/solaris-chromium-patches | 5ed86010096ace6e50bfa97bb8ca0237b0f834ee | [
"Apache-2.0"
] | null | null | null | patches/process-kill_posix.cc | bolthole/solaris-chromium-patches | 5ed86010096ace6e50bfa97bb8ca0237b0f834ee | [
"Apache-2.0"
] | 1 | 2018-11-12T09:01:36.000Z | 2018-11-12T09:01:36.000Z | diff --git a/base/process/kill_posix.cc b/base/process/kill_posix.cc
index bff7be4..544b9a3 100644
--- a/base/process/kill_posix.cc
+++ b/base/process/kill_posix.cc
@@ -248,6 +248,17 @@ bool WaitForExitCodeWithTimeout(ProcessHandle handle,
bool WaitForProcessesToExit(const FilePath::StringType& executable_name,
base::TimeDelta wait,
const ProcessFilter* filter) {
+#if defined(OS_SOLARIS)
+ // Okay, yes this is an ugly hack. But filling out all the
+ // process_iterator_BLAHBLAHBLAH garbage is even uglier, and
+ // the only purpose is to wait around for a named process to die.
+ // We dont need things that fancy. Just fake it for now,
+ // presume it will die eventually :)
+
+ base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(400));
+ return 0;
+
+#else
bool result = false;
// TODO(port): This is inefficient, but works if there are multiple procs.
@@ -264,6 +275,7 @@ bool WaitForProcessesToExit(const FilePath::StringType& executable_name,
} while ((end_time - base::TimeTicks::Now()) > base::TimeDelta());
return result;
+#endif
}
#if defined(OS_MACOSX)
| 37.774194 | 92 | 0.687447 | bolthole |
8067adad0aa629091a19ffd2ada16175fbdd5d4b | 1,924 | inl | C++ | dependencies/2dmapping/UnitSquareToTriangle.inl | jaredhoberock/gotham | e3551cc355646530574d086d7cc2b82e41e8f798 | [
"Apache-2.0"
] | 6 | 2015-12-29T07:21:01.000Z | 2020-05-29T10:47:38.000Z | dependencies/2dmapping/UnitSquareToTriangle.inl | jaredhoberock/gotham | e3551cc355646530574d086d7cc2b82e41e8f798 | [
"Apache-2.0"
] | null | null | null | dependencies/2dmapping/UnitSquareToTriangle.inl | jaredhoberock/gotham | e3551cc355646530574d086d7cc2b82e41e8f798 | [
"Apache-2.0"
] | null | null | null | /*! \file UnitSquareToTriangle.inl
* \author Jared Hoberock
* \brief Inline file for UnitSquareToTriangle.h.
*/
#include "UnitSquareToTriangle.h"
#include "UnitSquareToIsoscelesRightTriangle.h"
template<typename Real, typename Point>
void UnitSquareToTriangle
::evaluate(const Real &u, const Real &v,
const Point &v0, const Point &v1, const Point &v2,
Point &p,
Real *pdf)
{
Real b[2];
UnitSquareToIsoscelesRightTriangle::evaluate(u,v,b);
p = b[0] * v0 + b[1] * v1 + (Real(1) - b[0] - b[1]) * v2;
if(pdf)
{
*pdf = evaluatePdf<Real,Point>(p,v0,v1,v2);
} // end if
} // end UnitSquareToTriangle::evaluate()
template<typename Real, typename Point, typename Point2>
void UnitSquareToTriangle
::evaluate(const Real &u, const Real &v,
const Point &v0, const Point &v1, const Point &v2,
Point &p, Point2 &b,
Real *pdf)
{
UnitSquareToIsoscelesRightTriangle::evaluate(u,v,b);
p = b[0] * v0 + b[1] * v1 + (Real(1) - b[0] - b[1]) * v2;
if(pdf)
{
*pdf = evaluatePdf<Real,Point>(p,v0,v1,v2);
} // end if
} // end UnitSquareToTriangle::evaluate()
template<typename Point, typename Real>
void UnitSquareToTriangle
::inverse(const Point &p,
const Point &v0,
const Point &v1,
const Point &v2,
Real &u, Real &v)
{
std::cerr << "UnitSquareToTriangle::inverse(): Unimplemented method called!" << std::endl;
} // end UnitSquareToTriangle::inverse()
template<typename Real, typename Point>
Real UnitSquareToTriangle
::evaluatePdf(const Point &p, const Point &v0, const Point &v1, const Point &v2)
{
// compute the area of (v0,v1,v2)
Real denom = Real(0.5) * (v1 - v0).cross(v2 - v0).norm();
return Real(1) / denom;
} // end UnitSquareToTriangle::evaluatePdf()
| 30.0625 | 93 | 0.601871 | jaredhoberock |
806898e6e74ed2387d1eec075d58469555b53dc6 | 817 | cpp | C++ | LD20 - Acid/imagemgr.cpp | milo-brandt/milos-ludum-dare-entries | 6b4907463395ee99720386bca48726a798af14d2 | [
"MIT"
] | null | null | null | LD20 - Acid/imagemgr.cpp | milo-brandt/milos-ludum-dare-entries | 6b4907463395ee99720386bca48726a798af14d2 | [
"MIT"
] | null | null | null | LD20 - Acid/imagemgr.cpp | milo-brandt/milos-ludum-dare-entries | 6b4907463395ee99720386bca48726a798af14d2 | [
"MIT"
] | null | null | null | /*
* imagemgr.cpp
* Acid
*
* Created by Milo Brandt on 4/30/11.
* Copyright 2011 Apple Inc. All rights reserved.
*
*/
#include "imagemgr.h"
imageManager::imageManager(){
x[plyr_sprite].LoadFromFile("player.png");
x[goal_sprite].LoadFromFile("Goal.png");
x[complete_sprite].LoadFromFile("complete.png");
x[title_sprite].LoadFromFile("Title.png");
x[help_sprite].LoadFromFile("instructions.png");
x[chat_sprite+1].LoadFromFile("Talk1.png");
x[chat_sprite+2].LoadFromFile("Talk2.png");
x[chat_sprite+3].LoadFromFile("Talk3.png");
x[chat_sprite+4].LoadFromFile("Talk4.png");
x[chat_sprite+5].LoadFromFile("Talk5.png");
x[chat_sprite+6].LoadFromFile("Talk6.png");
x[lvl1_sprite].LoadFromFile("instructionsA.png");
x[lvl2_sprite].LoadFromFile("lvl2.png");
x[win_sprite].LoadFromFile("win.png");
} | 30.259259 | 50 | 0.724602 | milo-brandt |
8068ab1c95f7f3b86016674e48db57c8b904aa89 | 109 | hpp | C++ | include/rua/sched.hpp | yulon/rua | acb14aa0e60b68f09e88c726965552f7f4f5ace0 | [
"MIT"
] | null | null | null | include/rua/sched.hpp | yulon/rua | acb14aa0e60b68f09e88c726965552f7f4f5ace0 | [
"MIT"
] | null | null | null | include/rua/sched.hpp | yulon/rua | acb14aa0e60b68f09e88c726965552f7f4f5ace0 | [
"MIT"
] | null | null | null | #ifndef _RUA_SCHED_HPP
#define _RUA_SCHED_HPP
#include "sched/await.hpp"
#include "sched/dozer.hpp"
#endif
| 13.625 | 26 | 0.779817 | yulon |
8069c0f0f5b6082614643f71af872753d87ad731 | 1,008 | cpp | C++ | atcoder-dp/lcs.cpp | rranjan14/cp-solutions | 9614508efbed1e4ee8b970b5eed535d782a5783f | [
"MIT"
] | null | null | null | atcoder-dp/lcs.cpp | rranjan14/cp-solutions | 9614508efbed1e4ee8b970b5eed535d782a5783f | [
"MIT"
] | null | null | null | atcoder-dp/lcs.cpp | rranjan14/cp-solutions | 9614508efbed1e4ee8b970b5eed535d782a5783f | [
"MIT"
] | null | null | null | #include <bits/stdc++.h>
using namespace std;
int main()
{
string X, Y;
cin >> X;
cin >> Y;
int m = X.length();
int n = Y.length();
vector<vector<int>> dp(m + 1, vector<int>(n + 1, 0));
for (int i = 0; i <= m; i++)
{
for (int j = 0; j <= n; j++)
{
if (i == 0 || j == 0)
dp[i][j] = 0;
else
{
if (X[i] == t[j])
dp[i][j] = dp[i - 1][j - 1] + 1;
else
dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
}
}
}
int i = m, j = n;
string st = "";
while (i > 0 && j > 0)
{
if (X[i - 1] == t[j - 1])
{
st.push_back(X[i-1]);
i--;
j--;
}
else
{
if (dp[i][j - 1] > dp[i - 1][j])
j--;
else
i--;
}
}
reverse(st.begin(), st.end());
cout << st << "\n";
return 0;
} | 21 | 63 | 0.284722 | rranjan14 |
806de58feef32412eb8bef584173bd323b5a0349 | 32,707 | cpp | C++ | 3rdparty/meshlab-master/src/meshlabplugins/filter_select/meshselect.cpp | HoEmpire/slambook2 | 96d360f32aa5d8b5c5dcbbf9ee7ba865e84409f4 | [
"MIT"
] | null | null | null | 3rdparty/meshlab-master/src/meshlabplugins/filter_select/meshselect.cpp | HoEmpire/slambook2 | 96d360f32aa5d8b5c5dcbbf9ee7ba865e84409f4 | [
"MIT"
] | null | null | null | 3rdparty/meshlab-master/src/meshlabplugins/filter_select/meshselect.cpp | HoEmpire/slambook2 | 96d360f32aa5d8b5c5dcbbf9ee7ba865e84409f4 | [
"MIT"
] | null | null | null | /****************************************************************************
* MeshLab o o *
* A versatile mesh processing toolbox o o *
* _ O _ *
* Copyright(C) 2005 \/)\/ *
* Visual Computing Lab /\/| *
* ISTI - Italian National Research Council | *
* \ *
* All rights reserved. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; 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 (http://www.gnu.org/licenses/gpl.txt) *
* for more details. *
* *
****************************************************************************/
#include <math.h>
#include <stdlib.h>
#include <vcg/space/colorspace.h>
#include "meshselect.h"
#include <vcg/complex/algorithms/clean.h>
#include <vcg/complex/algorithms/stat.h>
#include <vcg/complex/algorithms/point_outlier.h>
using namespace vcg;
// ERROR CHECKING UTILITY
#define CheckError(x,y); if ((x)) {this->errorMessage = (y); return false;}
///////////////////////////////////////////////////////
SelectionFilterPlugin::SelectionFilterPlugin()
{
typeList <<
FP_SELECT_ALL <<
FP_SELECT_NONE <<
FP_SELECTBYANGLE <<
FP_SELECT_UGLY <<
FP_SELECT_DELETE_VERT <<
FP_SELECT_DELETE_ALL_FACE <<
FP_SELECT_DELETE_FACE <<
FP_SELECT_DELETE_FACEVERT <<
FP_SELECT_FACE_FROM_VERT <<
FP_SELECT_VERT_FROM_FACE <<
FP_SELECT_ERODE <<
FP_SELECT_DILATE <<
FP_SELECT_BORDER <<
FP_SELECT_INVERT <<
FP_SELECT_CONNECTED <<
FP_SELECT_BY_VERT_QUALITY <<
FP_SELECT_BY_FACE_QUALITY <<
CP_SELFINTERSECT_SELECT <<
CP_SELECT_TEXBORDER <<
CP_SELECT_NON_MANIFOLD_FACE <<
CP_SELECT_NON_MANIFOLD_VERTEX <<
FP_SELECT_FACES_BY_EDGE <<
FP_SELECT_BY_COLOR <<
FP_SELECT_FOLD_FACE <<
FP_SELECT_OUTLIER;
FilterIDType tt;
foreach(tt , types())
{
actionList << new QAction(filterName(tt), this);
if(tt==FP_SELECT_DELETE_VERT){
actionList.last()->setShortcut(QKeySequence ("Ctrl+Del"));
actionList.last()->setIcon(QIcon(":/images/delete_vert.png"));
actionList.last()->setPriority(QAction::HighPriority);
}
if(tt==FP_SELECT_DELETE_FACE){
actionList.last()->setShortcut(QKeySequence (Qt::Key_Delete));
actionList.last()->setIcon(QIcon(":/images/delete_face.png"));
actionList.last()->setPriority(QAction::HighPriority);
}
if(tt==FP_SELECT_DELETE_FACEVERT){
actionList.last()->setShortcut(QKeySequence ("Shift+Del"));
actionList.last()->setIcon(QIcon(":/images/delete_facevert.png"));
actionList.last()->setPriority(QAction::HighPriority);
}
if (tt == FP_SELECT_ALL){
actionList.last()->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_A);
actionList.last()->setIcon(QIcon(":/images/sel_all.png"));
actionList.last()->setPriority(QAction::LowPriority);
}
if (tt == FP_SELECT_NONE){
actionList.last()->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_D);
actionList.last()->setIcon(QIcon(":/images/sel_none.png"));
actionList.last()->setPriority(QAction::LowPriority);
}
if (tt == FP_SELECT_INVERT){
actionList.last()->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_I);
actionList.last()->setIcon(QIcon(":/images/sel_inv.png"));
actionList.last()->setPriority(QAction::LowPriority);
}
if (tt == FP_SELECT_DILATE){
actionList.last()->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_Plus);
actionList.last()->setIcon(QIcon(":/images/sel_plus.png"));
actionList.last()->setPriority(QAction::LowPriority);
}
if (tt == FP_SELECT_ERODE){
actionList.last()->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_Minus);
actionList.last()->setIcon(QIcon(":/images/sel_minus.png"));
actionList.last()->setPriority(QAction::LowPriority);
}
}
}
QString SelectionFilterPlugin::filterName(FilterIDType filter) const
{
switch(filter)
{
case FP_SELECT_ALL : return tr("Select All");
case FP_SELECT_NONE : return tr("Select None");
case FP_SELECT_INVERT : return tr("Invert Selection");
case FP_SELECT_CONNECTED : return tr("Select Connected Faces");
case FP_SELECT_DELETE_VERT : return tr("Delete Selected Vertices");
case FP_SELECT_DELETE_ALL_FACE : return tr("Delete ALL Faces");
case FP_SELECT_DELETE_FACE : return tr("Delete Selected Faces");
case FP_SELECT_DELETE_FACEVERT : return tr("Delete Selected Faces and Vertices");
case FP_SELECTBYANGLE : return tr("Select Faces by view angle");
case FP_SELECT_UGLY : return tr("Select 'problematic' faces");
case FP_SELECT_FACE_FROM_VERT : return tr("Select Faces from Vertices");
case FP_SELECT_VERT_FROM_FACE : return tr("Select Vertices from Faces");
case FP_SELECT_ERODE : return tr("Erode Selection");
case FP_SELECT_DILATE : return tr("Dilate Selection");
case FP_SELECT_BORDER : return tr("Select Border");
case FP_SELECT_BY_VERT_QUALITY : return tr("Select by Vertex Quality");
case FP_SELECT_BY_FACE_QUALITY : return tr("Select by Face Quality");
case FP_SELECT_BY_COLOR : return tr("Select Faces by Color");
case CP_SELFINTERSECT_SELECT : return tr("Select Self Intersecting Faces");
case CP_SELECT_TEXBORDER : return tr("Select Vertex Texture Seams");
case CP_SELECT_NON_MANIFOLD_FACE : return tr("Select non Manifold Edges ");
case CP_SELECT_NON_MANIFOLD_VERTEX : return tr("Select non Manifold Vertices");
case FP_SELECT_FACES_BY_EDGE: return tr("Select Faces with edges longer than...");
case FP_SELECT_FOLD_FACE : return tr("Select Folded Faces");
case FP_SELECT_OUTLIER: return tr("Select Outliers");
}
assert(0);
return QString("Unknown filter");
}
QString SelectionFilterPlugin::filterInfo(FilterIDType filterId) const
{
switch(filterId)
{
case FP_SELECT_DILATE : return tr("Dilate (expand) the current set of selected faces.");
case FP_SELECT_ERODE : return tr("Erode (reduce) the current set of selected faces.");
case FP_SELECT_INVERT : return tr("Invert the current set of selected faces/vertices.");
case FP_SELECT_CONNECTED: return tr("Expand the current face selection so that it includes all the faces in the connected components where there is at least a selected face.");
case FP_SELECT_NONE : return tr("Clear the current set of selected faces/vertices.");
case FP_SELECT_ALL : return tr("Select all the faces/vertices of the current mesh.");
case FP_SELECT_DELETE_VERT : return tr("Delete the current set of selected vertices; faces that share one of the deleted vertexes are deleted too.");
case FP_SELECT_DELETE_ALL_FACE: return tr("Delete ALL faces, turning the mesh into a pointcloud. May be applied also to all visible layers.");
case FP_SELECT_DELETE_FACE : return tr("Delete the current set of selected faces, vertices that remains unreferenced are not deleted.");
case FP_SELECT_DELETE_FACEVERT : return tr("Delete the current set of selected faces and all the vertices surrounded by that faces.");
case FP_SELECTBYANGLE : return tr("Select faces according to the angle between their normal and the view direction. It is used in range map processing to select and delete steep faces parallel to viewdirection.");
case FP_SELECT_UGLY : return tr("Select faces with 'problems', like normal inverted w.r.t the surrounding areas, or extremely elongated");
case CP_SELFINTERSECT_SELECT : return tr("Select only self intersecting faces.");
case FP_SELECT_FACE_FROM_VERT : return tr("Select faces from selected vertices.");
case FP_SELECT_VERT_FROM_FACE : return tr("Select vertices from selected faces.");
case FP_SELECT_FACES_BY_EDGE : return tr("Select all triangles having an edge with lenght greater or equal than a given threshold.");
case FP_SELECT_BORDER : return tr("Select vertices and faces on the boundary.");
case FP_SELECT_BY_VERT_QUALITY : return tr("Select all the faces/vertexes within the specified vertex quality range.");
case FP_SELECT_BY_FACE_QUALITY : return tr("Select all the faces/vertexes with within the specified face quality range.");
case FP_SELECT_BY_COLOR : return tr("Select part of the mesh based on its color.");
case CP_SELECT_TEXBORDER : return tr("Colorize only border edges.");
case CP_SELECT_NON_MANIFOLD_FACE: return tr("Select the faces and the vertices incident on non manifold edges (e.g. edges where more than two faces are incident); note that this function select the components that are related to non manifold edges. The case of non manifold vertices is specifically managed by the pertinent filter.");
case CP_SELECT_NON_MANIFOLD_VERTEX: return tr("Select the non manifold vertices that do not belong to non manifold edges. For example two cones connected by their apex. Vertices incident on non manifold edges are ignored.");
case FP_SELECT_FOLD_FACE: return tr("Select the folded faces created by the Quadric Edge Collapse decimation. The face is selected if the angle between the face normal and the normal of the best fitting plane of the neighbor vertices is above the selected threshold.");
case FP_SELECT_OUTLIER: return tr("Select the vertex classified as outlier using Local Outlier Propabilty measure described in:<br> <b>'LoOP: Local Outlier Probabilities'</b> Kriegel et al.<br>CIKM 2009");
}
assert(0);
return QString("Unknown filter");
}
void SelectionFilterPlugin::initParameterSet(QAction *action, MeshModel &m, RichParameterSet &parlst)
{
switch(ID(action))
{
case FP_SELECT_FACES_BY_EDGE:
{
float maxVal = m.cm.bbox.Diag()/2.0f;
parlst.addParam(new RichDynamicFloat("Threshold",maxVal*0.01,0,maxVal,"Edge Threshold", "All the faces with an edge <b>longer</b> than this threshold will be deleted. Useful for removing long skinny faces obtained by bad triangulation of range maps."));
} break;
case FP_SELECT_BORDER:
//parlst.addParam(new RichInt("Iteration", true, "Inclusive Sel.", "If true only the faces with <b>all</b> selected vertices are selected. Otherwise any face with at least one selected vertex will be selected."));
break;
case FP_SELECTBYANGLE :
{
parlst.addParam(new RichDynamicFloat("anglelimit", 75.0f, 0.0f, 180.0f, "angle threshold (deg)", "faces with normal at higher angle w.r.t. the view direction are selected"));
parlst.addParam(new RichBool ("usecamera", false, "Use ViewPoint from Mesh Camera", "Uses the ViewPoint from the camera associated to the current mesh\n if there is no camera, an error occurs"));
parlst.addParam(new RichPoint3f("viewpoint", Point3f(0.0f, 0.0f, 0.0f), "ViewPoint", "if UseCamera is true, this value is ignored"));
} break;
case FP_SELECT_UGLY :
parlst.addParam(new RichBool("useAR", true, "select by Aspect Ratio", "if true, faces with aspect ratio below the limit will be selected"));
parlst.addParam(new RichDynamicFloat("ARatio", 0.02, 0.0, 1.0, tr("Aspect Ratio"), tr("Triangle face aspect ratio [1 (equilateral) - 0 (line)]: face will be selected if BELOW this threshold")));
parlst.addParam(new RichBool("useNF", false, "select by Normal Angle", "if true, adjacent faces with normals forming an angle above the limit will be selected"));
parlst.addParam(new RichDynamicFloat("NFRatio", 60, 0.0, 180.0, tr("Angle flip"), tr("angle between the adjacent faces: face will be selected if ABOVE this threshold")));
break;
case FP_SELECT_FACE_FROM_VERT:
parlst.addParam(new RichBool("Inclusive", true, "Strict Selection", "If true only the faces with <b>all</b> selected vertices are selected. Otherwise any face with at least one selected vertex will be selected."));
break;
case FP_SELECT_VERT_FROM_FACE:
parlst.addParam(new RichBool("Inclusive", true, "Strict Selection", "If true only the vertices with <b>all</b> the incident face selected are selected. Otherwise any vertex with at least one incident selected face will be selected."));
break;
case FP_SELECT_BY_VERT_QUALITY:
{
std::pair<float,float> minmax = tri::Stat<CMeshO>::ComputePerVertexQualityMinMax(m.cm);
float minq=minmax.first;
float maxq=minmax.second;
parlst.addParam(new RichDynamicFloat("minQ", minq*0.75+maxq*.25, minq, maxq, tr("Min Quality"), tr("Minimum acceptable quality value") ));
parlst.addParam(new RichDynamicFloat("maxQ", minq*0.25+maxq*.75, minq, maxq, tr("Max Quality"), tr("Maximum acceptable quality value") ));
parlst.addParam(new RichBool("Inclusive", true, "Inclusive Sel.", "If true only the faces with <b>all</b> the vertices within the specified range are selected. Otherwise any face with at least one vertex within the range is selected."));
} break;
case FP_SELECT_BY_FACE_QUALITY:
{
std::pair<float,float> minmax = tri::Stat<CMeshO>::ComputePerFaceQualityMinMax(m.cm);
float minq=minmax.first;
float maxq=minmax.second;
parlst.addParam(new RichDynamicFloat("minQ", minq*0.75+maxq*.25, minq, maxq, tr("Min Quality"), tr("Minimum acceptable quality value") ));
parlst.addParam(new RichDynamicFloat("maxQ", minq*0.25+maxq*.75, minq, maxq, tr("Max Quality"), tr("Maximum acceptable quality value") ));
parlst.addParam(new RichBool("Inclusive", true, "Inclusive Sel.", "If true only the vertices with <b>all</b> the adjacent faces within the specified range are selected. Otherwise any vertex with at least one face within the range is selected."));
} break;
case FP_SELECT_BY_COLOR:
{
parlst.addParam(new RichColor("Color",Color4b::Black, tr("Color To Select"), tr("Color that you want to be selected.") ));
QStringList colorspace;
colorspace << "HSV" << "RGB";
parlst.addParam(new RichEnum("ColorSpace", 0, colorspace, tr("Pick Color Space"), tr("The color space that the sliders will manipulate.") ));
parlst.addParam(new RichBool("Inclusive", true, "Inclusive Sel.", "If true only the faces with <b>all</b> the vertices within the specified range are selected. Otherwise any face with at least one vertex within the range is selected."));
parlst.addParam(new RichDynamicFloat("PercentRH", 0.2f, 0.0f, 1.0f, tr("Variation from Red or Hue"), tr("A float between 0 and 1 that represents the percent variation from this color that will be selected. For example if the R was 200 and you put 0.1 then any color with R 200+-25.5 will be selected.") ));
parlst.addParam(new RichDynamicFloat("PercentGS", 0.2f, 0.0f, 1.0f, tr("Variation from Green or Saturation"), tr("A float between 0 and 1 that represents the percent variation from this color that will be selected. For example if the R was 200 and you put 0.1 then any color with R 200+-25.5 will be selected.") ));
parlst.addParam(new RichDynamicFloat("PercentBV", 0.2f, 0.0f, 1.0f, tr("Variation from Blue or Value"), tr("A float between 0 and 1 that represents the percent variation from this color that will be selected. For example if the R was 200 and you put 0.1 then any color with R 200+-25.5 will be selected.") ));
} break;
case FP_SELECT_ALL:
{
parlst.addParam(new RichBool("allFaces", true, "Select all Faces", "If true the filter will select all the faces."));
parlst.addParam(new RichBool("allVerts", true, "Select all Vertices", "If true the filter will select all the vertices."));
} break;
case FP_SELECT_NONE:
{
parlst.addParam(new RichBool("allFaces", true, "De-select all Faces", "If true the filter will de-select all the faces."));
parlst.addParam(new RichBool("allVerts", true, "De-select all Vertices", "If true the filter will de-select all the vertices."));
} break;
case FP_SELECT_INVERT:
{
bool defF = (m.cm.sfn > 0) ? true : false;
bool defV = (m.cm.svn > 0) ? true : false;
parlst.addParam(new RichBool("InvFaces", defF, "Invert Faces", "If true the filter will invert the set of selected faces."));
parlst.addParam(new RichBool("InvVerts", defV, "Invert Vertices", "If true the filter will invert the set of selected vertices."));
} break;
case FP_SELECT_FOLD_FACE:
{
parlst.addParam(new RichDynamicFloat("AngleThreshold", 160.0f, 90.0f, 180.0f, tr("Angle Threshold"), tr("Angle between the face and the best fitting plane of the neighbours vertices. If it is above the threshold the face is selected.")));
} break;
case FP_SELECT_OUTLIER:
{
parlst.addParam(new RichDynamicFloat("PropThreshold", 0.8, 0.0, 1.0, tr("Probability"), tr("Threshold to select the vertex. The vertex is selected if the LoOP value is above the threshold.")));
parlst.addParam(new RichInt("KNearest", 32, tr("Number of neighbors"), tr("Number of neighbours used to compute the LoOP")));
} break;
case FP_SELECT_DELETE_ALL_FACE:
{
parlst.addParam(new RichBool("allLayers", false, "Apply to all visible Layers", "If selected, the filter will be applied to all visible mesh Layers."));
} break;
}
}
bool SelectionFilterPlugin::applyFilter(QAction *action, MeshDocument &md, RichParameterSet & par, vcg::CallBackPos * /*cb*/)
{
if (md.mm() == NULL)
return false;
MeshModel &m=*(md.mm());
CMeshO::FaceIterator fi;
CMeshO::VertexIterator vi;
switch(ID(action))
{
case FP_SELECT_DELETE_VERT:
{
if (m.cm.svn == 0) { Log("Nothing done: no vertex selected"); break; }
tri::UpdateSelection<CMeshO>::FaceClear(m.cm);
tri::UpdateSelection<CMeshO>::FaceFromVertexLoose(m.cm);
int vvn = m.cm.vn;
int ffn = m.cm.fn;
for (fi = m.cm.face.begin(); fi != m.cm.face.end(); ++fi)
if (!(*fi).IsD() && (*fi).IsS())
tri::Allocator<CMeshO>::DeleteFace(m.cm, *fi);
for (vi = m.cm.vert.begin(); vi != m.cm.vert.end(); ++vi)
if (!(*vi).IsD() && (*vi).IsS())
tri::Allocator<CMeshO>::DeleteVertex(m.cm, *vi);
m.clearDataMask(MeshModel::MM_FACEFACETOPO);
m.UpdateBoxAndNormals();
Log("Deleted %i vertices, %i faces.", vvn - m.cm.vn, ffn - m.cm.fn);
} break;
case FP_SELECT_DELETE_ALL_FACE:
{
if (par.getBool("allLayers"))
{
MeshModel *ml = NULL;
while (ml = md.nextVisibleMesh(ml))
{
int ffn = ml->cm.fn;
for (fi = ml->cm.face.begin(); fi != ml->cm.face.end(); ++fi)
if (!(*fi).IsD())
tri::Allocator<CMeshO>::DeleteFace(ml->cm, *fi);
ml->clearDataMask(MeshModel::MM_FACEFACETOPO);
ml->UpdateBoxAndNormals();
Log("Layer %i: deleted all %i faces.", ml->id(), ffn - ml->cm.fn);
}
}
else
{
int ffn = m.cm.fn;
for (fi = m.cm.face.begin(); fi != m.cm.face.end(); ++fi)
if (!(*fi).IsD())
tri::Allocator<CMeshO>::DeleteFace(m.cm, *fi);
m.clearDataMask(MeshModel::MM_FACEFACETOPO);
m.UpdateBoxAndNormals();
Log("Deleted all %i faces.", ffn - m.cm.fn);
}
} break;
case FP_SELECT_DELETE_FACE:
{
if (m.cm.sfn == 0) { Log("Nothing done: no faces selected"); break; }
int ffn = m.cm.fn;
for (fi = m.cm.face.begin(); fi != m.cm.face.end(); ++fi)
if (!(*fi).IsD() && (*fi).IsS())
tri::Allocator<CMeshO>::DeleteFace(m.cm, *fi);
m.clearDataMask(MeshModel::MM_FACEFACETOPO);
m.UpdateBoxAndNormals();
Log("Deleted %i faces.", ffn - m.cm.fn);
} break;
case FP_SELECT_DELETE_FACEVERT:
{
if (m.cm.sfn == 0) { Log("Nothing done: no faces selected"); break; }
tri::UpdateSelection<CMeshO>::VertexClear(m.cm);
tri::UpdateSelection<CMeshO>::VertexFromFaceStrict(m.cm);
int vvn = m.cm.vn;
int ffn = m.cm.fn;
for (fi = m.cm.face.begin(); fi != m.cm.face.end(); ++fi)
if (!(*fi).IsD() && (*fi).IsS())
tri::Allocator<CMeshO>::DeleteFace(m.cm, *fi);
for (vi = m.cm.vert.begin(); vi != m.cm.vert.end(); ++vi)
if (!(*vi).IsD() && (*vi).IsS())
tri::Allocator<CMeshO>::DeleteVertex(m.cm, *vi);
m.clearDataMask(MeshModel::MM_FACEFACETOPO);
m.UpdateBoxAndNormals();
Log("Deleted %i faces, %i vertices.", ffn - m.cm.fn, vvn - m.cm.vn);
} break;
case FP_SELECT_CONNECTED:
tri::UpdateSelection<CMeshO>::FaceConnectedFF(m.cm);
break;
case FP_SELECTBYANGLE :
{
CMeshO::FaceIterator fi;
bool usecam = par.getBool("usecamera");
Point3m viewpoint = par.getPoint3m("viewpoint");
// if usecamera but mesh does not have one
if( usecam && !m.hasDataMask(MeshModel::MM_CAMERA) )
{
errorMessage = "Mesh has not a camera that can be used to compute view direction. Please set a view direction."; // text
return false;
}
if(usecam)
{
viewpoint = m.cm.shot.GetViewPoint();
}
// angle threshold in radians
float limit = cos( math::ToRad(par.getDynamicFloat("anglelimit")) );
Point3m viewray;
for(fi=m.cm.face.begin();fi!=m.cm.face.end();++fi)
if(!(*fi).IsD())
{
viewray = Barycenter(*fi) - viewpoint;
viewray.Normalize();
if((viewray.dot((*fi).N().Normalize())) < limit)
fi->SetS();
}
} break;
case FP_SELECT_UGLY :
{
// elongated
if (par.getBool("useAR"))
for (fi = m.cm.face.begin(); fi != m.cm.face.end(); ++fi)
if (!(*fi).IsD())
{
float QQ = QualityRadii((*fi).V(0)->P(), (*fi).V(1)->P(), (*fi).V(2)->P());
if (QQ<par.getFloat("ARatio"))
fi->SetS();
}
// flipped normal
if (par.getBool("useNF"))
{
md.mm()->updateDataMask(MeshModel::MM_FACEFACETOPO);
for (fi = m.cm.face.begin(); fi != m.cm.face.end(); ++fi)
if (!(*fi).IsD())
{
float QQ = 0;
for (int ei = 0; ei < 3; ei++)
{
CMeshO::FacePointer adjf = (*fi).FFp(ei);
float nangle = (*adjf).N().Normalize() * (*fi).N().Normalize();
nangle = math::ToDeg(fabsf(acos(nangle)));
if (nangle > QQ) QQ = nangle;
}
if (QQ > par.getFloat("NFRatio"))
fi->SetS();
}
m.clearDataMask(MeshModel::MM_FACEFACETOPO);
}
} break;
case FP_SELECT_ALL :
if (par.getBool("allVerts"))
tri::UpdateSelection<CMeshO>::VertexAll(m.cm);
if (par.getBool("allFaces"))
tri::UpdateSelection<CMeshO>::FaceAll(m.cm);
break;
case FP_SELECT_NONE :
if (par.getBool("allVerts"))
tri::UpdateSelection<CMeshO>::VertexClear(m.cm);
if (par.getBool("allFaces"))
tri::UpdateSelection<CMeshO>::FaceClear(m.cm);
break;
case FP_SELECT_INVERT :
if (par.getBool("InvVerts"))
tri::UpdateSelection<CMeshO>::VertexInvert(m.cm);
if (par.getBool("InvFaces"))
tri::UpdateSelection<CMeshO>::FaceInvert(m.cm);
break;
case FP_SELECT_VERT_FROM_FACE:
if (par.getBool("Inclusive"))
tri::UpdateSelection<CMeshO>::VertexFromFaceStrict(m.cm);
else
tri::UpdateSelection<CMeshO>::VertexFromFaceLoose(m.cm);
break;
case FP_SELECT_FACE_FROM_VERT:
if (par.getBool("Inclusive"))
tri::UpdateSelection<CMeshO>::FaceFromVertexStrict(m.cm);
else
tri::UpdateSelection<CMeshO>::FaceFromVertexLoose(m.cm);
break;
case FP_SELECT_ERODE:
tri::UpdateSelection<CMeshO>::VertexFromFaceStrict(m.cm);
tri::UpdateSelection<CMeshO>::FaceFromVertexStrict(m.cm);
break;
case FP_SELECT_DILATE:
tri::UpdateSelection<CMeshO>::VertexFromFaceLoose(m.cm);
tri::UpdateSelection<CMeshO>::FaceFromVertexLoose(m.cm);
break;
case FP_SELECT_BORDER:
tri::UpdateFlags<CMeshO>::FaceBorderFromNone(m.cm);
tri::UpdateFlags<CMeshO>::VertexBorderFromFaceBorder(m.cm);
tri::UpdateSelection<CMeshO>::FaceFromBorderFlag(m.cm);
tri::UpdateSelection<CMeshO>::VertexFromBorderFlag(m.cm);
break;
case FP_SELECT_BY_VERT_QUALITY:
{
float minQ = par.getDynamicFloat("minQ");
float maxQ = par.getDynamicFloat("maxQ");
bool inclusiveFlag = par.getBool("Inclusive");
tri::UpdateSelection<CMeshO>::VertexFromQualityRange(m.cm, minQ, maxQ);
if (inclusiveFlag)
tri::UpdateSelection<CMeshO>::FaceFromVertexStrict(m.cm);
else
tri::UpdateSelection<CMeshO>::FaceFromVertexLoose(m.cm);
} break;
case FP_SELECT_BY_FACE_QUALITY:
{
float minQ = par.getDynamicFloat("minQ");
float maxQ = par.getDynamicFloat("maxQ");
bool inclusiveFlag = par.getBool("Inclusive");
tri::UpdateSelection<CMeshO>::FaceFromQualityRange(m.cm, minQ, maxQ);
if (inclusiveFlag)
tri::UpdateSelection<CMeshO>::VertexFromFaceStrict(m.cm);
else
tri::UpdateSelection<CMeshO>::VertexFromFaceLoose(m.cm);
} break;
case FP_SELECT_BY_COLOR:
{
int colorSpace = par.getEnum("ColorSpace");
QColor targetColor = par.getColor("Color");
float red = targetColor.redF();
float green = targetColor.greenF();
float blue = targetColor.blueF();
float hue = targetColor.hue()/360.0f;// Normalized into [0..1) range
float saturation = targetColor.saturationF();
float value = targetColor.valueF();
//like fuzz factor in photoshop
float valueRH = par.getDynamicFloat("PercentRH");
float valueGS = par.getDynamicFloat("PercentGS");
float valueBV = par.getDynamicFloat("PercentBV");
tri::UpdateSelection<CMeshO>::FaceClear(m.cm);
tri::UpdateSelection<CMeshO>::VertexClear(m.cm);
//now loop through all the faces
for(vi = m.cm.vert.begin(); vi != m.cm.vert.end(); ++vi)
{
if(!(*vi).IsD())
{
Color4f colorv = Color4f::Construct((*vi).C());
if(colorSpace == 0){
colorv = ColorSpace<float>::RGBtoHSV(colorv);
if( fabsf(colorv[0] - hue) <= valueRH &&
fabsf(colorv[1] - saturation) <= valueGS &&
fabsf(colorv[2] - value) <= valueBV )
(*vi).SetS();
}
else {
if( fabsf(colorv[0] - red) <= valueRH &&
fabsf(colorv[1] - green) <= valueGS &&
fabsf(colorv[2] - blue) <= valueBV )
(*vi).SetS();
}
}
}
if(par.getBool("Inclusive"))
tri::UpdateSelection<CMeshO>::FaceFromVertexStrict(m.cm);
else
tri::UpdateSelection<CMeshO>::FaceFromVertexLoose(m.cm);
} break;
case CP_SELECT_TEXBORDER:
tri::UpdateTopology<CMeshO>::FaceFaceFromTexCoord(m.cm);
tri::UpdateFlags<CMeshO>::FaceBorderFromFF(m.cm);
tri::UpdateFlags<CMeshO>::VertexBorderFromFaceBorder(m.cm);
tri::UpdateSelection<CMeshO>::VertexFromBorderFlag(m.cm);
// Just to be sure restore standard topology and border flags
tri::UpdateTopology<CMeshO>::FaceFace(m.cm);
tri::UpdateFlags<CMeshO>::FaceBorderFromFF(m.cm);
tri::UpdateFlags<CMeshO>::VertexBorderFromFaceBorder(m.cm);
break;
case CP_SELECT_NON_MANIFOLD_FACE:
tri::Clean<CMeshO>::CountNonManifoldEdgeFF(m.cm,true);
break;
case CP_SELECT_NON_MANIFOLD_VERTEX:
tri::Clean<CMeshO>::CountNonManifoldVertexFF(m.cm,true);
break;
case CP_SELFINTERSECT_SELECT:
{
std::vector<CFaceO *> IntersFace;
tri::Clean<CMeshO>::SelfIntersections(m.cm, IntersFace);
tri::UpdateSelection<CMeshO>::FaceClear(m.cm);
std::vector<CFaceO *>::iterator fpi;
for (fpi = IntersFace.begin(); fpi != IntersFace.end(); ++fpi)
(*fpi)->SetS();
} break;
case FP_SELECT_FACES_BY_EDGE:
{
float threshold = par.getDynamicFloat("Threshold");
int selFaceNum = tri::UpdateSelection<CMeshO>::FaceOutOfRangeEdge(m.cm,0,threshold );
Log( "Selected %d faces with and edge longer than %f",selFaceNum,threshold);
} break;
case FP_SELECT_FOLD_FACE:
{
float angle = math::ToRad(par.getDynamicFloat("AngleThreshold"));
m.updateDataMask(MeshModel::MM_VERTFACETOPO);
tri::Clean<CMeshO>::SelectFoldedFaceFromOneRingFaces(m.cm, cos(angle));
m.clearDataMask(MeshModel::MM_VERTFACETOPO);
} break;
case FP_SELECT_OUTLIER:
{
float threshold = par.getDynamicFloat("PropThreshold");
int kNearest = par.getInt("KNearest");
VertexConstDataWrapper<CMeshO> wrapper(m.cm);
KdTree<typename CMeshO::ScalarType> kdTree(wrapper);
int selVertexNum = tri::OutlierRemoval<CMeshO>::SelectLoOPOutliers(m.cm, kdTree, kNearest, threshold);
Log("Selected %d outlier vertices", selVertexNum);
} break;
default: assert(0);
}
return true;
}
MeshFilterInterface::FilterClass SelectionFilterPlugin::getClass(QAction *action)
{
switch(ID(action))
{
case CP_SELFINTERSECT_SELECT: return FilterClass(MeshFilterInterface::Selection + MeshFilterInterface::Cleaning);
case CP_SELECT_TEXBORDER : return FilterClass(MeshFilterInterface::Selection + MeshFilterInterface::Texture);
case FP_SELECT_BY_FACE_QUALITY :
case FP_SELECT_BY_VERT_QUALITY : return FilterClass(MeshFilterInterface::Selection + MeshFilterInterface::Quality);
case FP_SELECTBYANGLE : return MeshFilterInterface::FilterClass(MeshFilterInterface::RangeMap + MeshFilterInterface::Selection);
case FP_SELECT_ALL :
case FP_SELECT_NONE :
case FP_SELECT_CONNECTED:
case FP_SELECT_UGLY:
case FP_SELECT_DELETE_VERT:
case FP_SELECT_DELETE_ALL_FACE:
case FP_SELECT_DELETE_FACE:
case FP_SELECT_DELETE_FACEVERT:
case FP_SELECT_FACE_FROM_VERT:
case FP_SELECT_VERT_FROM_FACE:
case FP_SELECT_ERODE:
case FP_SELECT_DILATE:
case FP_SELECT_BORDER:
case FP_SELECT_INVERT:
case FP_SELECT_FACES_BY_EDGE:
case FP_SELECT_FOLD_FACE:
case FP_SELECT_OUTLIER:
case FP_SELECT_BY_COLOR:
case CP_SELECT_NON_MANIFOLD_VERTEX:
case CP_SELECT_NON_MANIFOLD_FACE: return FilterClass(MeshFilterInterface::Selection);
}
return MeshFilterInterface::Selection;
}
int SelectionFilterPlugin::getRequirements(QAction *action)
{
switch(ID(action))
{
case CP_SELECT_NON_MANIFOLD_FACE:
case CP_SELECT_NON_MANIFOLD_VERTEX:
case FP_SELECT_CONNECTED: return MeshModel::MM_FACEFACETOPO;
case CP_SELECT_TEXBORDER: return MeshModel::MM_FACEFACETOPO;
case CP_SELFINTERSECT_SELECT: return MeshModel::MM_FACEMARK | MeshModel::MM_FACEFACETOPO;
case FP_SELECT_FOLD_FACE: return MeshModel::MM_VERTFACETOPO;
default: return MeshModel::MM_NONE;
}
}
int SelectionFilterPlugin::postCondition(QAction *action) const
{
switch(ID(action))
{
case FP_SELECT_ALL :
case FP_SELECT_FACE_FROM_VERT :
case FP_SELECT_VERT_FROM_FACE :
case FP_SELECT_NONE :
case FP_SELECT_INVERT :
case FP_SELECT_ERODE :
case FP_SELECT_CONNECTED :
case FP_SELECT_DILATE :
case FP_SELECT_BORDER :
case FP_SELECT_BY_VERT_QUALITY :
case FP_SELECT_BY_FACE_QUALITY :
case FP_SELECT_BY_COLOR :
case CP_SELFINTERSECT_SELECT :
case CP_SELECT_TEXBORDER :
case CP_SELECT_NON_MANIFOLD_FACE :
case CP_SELECT_NON_MANIFOLD_VERTEX :
case FP_SELECT_FACES_BY_EDGE :
case FP_SELECT_UGLY :
case FP_SELECT_FOLD_FACE :
case FP_SELECT_OUTLIER : return MeshModel::MM_VERTFLAGSELECT | MeshModel::MM_FACEFLAGSELECT;
case FP_SELECT_DELETE_VERT :
case FP_SELECT_DELETE_ALL_FACE :
case FP_SELECT_DELETE_FACE :
case FP_SELECT_DELETE_FACEVERT : return MeshModel::MM_GEOMETRY_AND_TOPOLOGY_CHANGE;
}
return MeshModel::MM_ALL;
}
int SelectionFilterPlugin::getPreConditions( QAction * action) const
{
switch(ID(action))
{
case CP_SELECT_NON_MANIFOLD_VERTEX:
case CP_SELECT_NON_MANIFOLD_FACE:
case CP_SELFINTERSECT_SELECT:
case FP_SELECT_FACES_BY_EDGE:
case FP_SELECT_FACE_FROM_VERT:
case FP_SELECT_BORDER:
case FP_SELECT_ERODE:
case FP_SELECT_DILATE:
case FP_SELECT_FOLD_FACE:
case FP_SELECT_CONNECTED: return MeshModel::MM_FACENUMBER;
case FP_SELECT_BY_COLOR: return MeshModel::MM_VERTCOLOR;
case FP_SELECT_BY_VERT_QUALITY: return MeshModel::MM_VERTQUALITY;
case FP_SELECT_BY_FACE_QUALITY: return MeshModel::MM_FACEQUALITY;
case CP_SELECT_TEXBORDER: return MeshModel::MM_WEDGTEXCOORD;
}
return 0;
}
MESHLAB_PLUGIN_NAME_EXPORTER(SelectionFilterPlugin)
| 43.843164 | 337 | 0.676614 | HoEmpire |
80715f67f775881f9ab4b28a5ffd43db8f167f49 | 839 | cpp | C++ | main/PISupervisor/src/PIDiskSize.cpp | sim1st/endpointdlp | f5203f23e93b00c8242c45fa85c26d9b7419e50c | [
"Apache-2.0"
] | null | null | null | main/PISupervisor/src/PIDiskSize.cpp | sim1st/endpointdlp | f5203f23e93b00c8242c45fa85c26d9b7419e50c | [
"Apache-2.0"
] | null | null | null | main/PISupervisor/src/PIDiskSize.cpp | sim1st/endpointdlp | f5203f23e93b00c8242c45fa85c26d9b7419e50c | [
"Apache-2.0"
] | null | null | null | #ifndef _PIDISKSIZE_CPP
#define _PIDISKSIZE_CPP
#include "PIDiskSize.h"
#include "include_system.h"
#include <sys/statvfs.h>
////////////////////////////////////////
// CPIDiskSize
CPIDiskSize::CPIDiskSize() {
clear();
}
CPIDiskSize::~CPIDiskSize() {
}
void CPIDiskSize::clear(void) {
totalBytes = 0.0;
freeBytes = 0.0;
usedBytes = 0.0;
}
bool CPIDiskSize::getSystemDiskSize(void) {
clear();
struct statvfs sv;
memset( &sv, 0, sizeof(sv) );
int result = statvfs( "/", &sv );
if(result != 0) {
return false;
}
totalBytes = (double)(sv.f_blocks * sv.f_frsize);
freeBytes = (double)(sv.f_bfree * sv.f_frsize);
usedBytes = totalBytes - freeBytes;
return true;
}
void CPIDiskSize::getUsedBytes(void) {
usedBytes = totalBytes - freeBytes;
}
#endif // #ifndef _PIDISKSIZE_CPP
| 19.511628 | 51 | 0.622169 | sim1st |
807aa7f5dd3ef3255444c00cf2901498e3b89131 | 1,496 | cc | C++ | src/triangle.cc | interval1066/quetest | 68958adaae845ce1132a21da3955af56f74228bb | [
"BSD-2-Clause"
] | null | null | null | src/triangle.cc | interval1066/quetest | 68958adaae845ce1132a21da3955af56f74228bb | [
"BSD-2-Clause"
] | null | null | null | src/triangle.cc | interval1066/quetest | 68958adaae845ce1132a21da3955af56f74228bb | [
"BSD-2-Clause"
] | null | null | null | #include <triangle.h>
#include <segment.h>
#include <algorithm>
#include <iostream>
using namespace std;
using namespace slicer;
Triangle::Triangle(Vertex v1, Vertex v2, Vertex v3) : v1(v1), v2(v2), v3(v3) {}
float
Triangle::x_min() const
{
return min(v1.x, min(v2.x, v3.x));
}
float
Triangle::x_max() const
{
return max(v1.x, max(v2.x, v3.x));
}
float
Triangle::y_min() const
{
return min(v1.y, min(v2.y, v3.y));
}
float
Triangle::y_max() const
{
return max(v1.y, max(v2.y, v3.y));
}
float
Triangle::z_min() const
{
return min(v1.z, min(v2.z, v3.z));
}
float
Triangle::z_max() const
{
return max(v1.z, max(v2.z, v3.z));
}
bool
Triangle::belong_to_plane_z() const
{
return (v1.z == v2.z) && (v2.z == v3.z);
}
Triangle&
Triangle::operator+=(Vertex shift)
{
v1 += shift;
v2 += shift;
v3 += shift;
return *this;
}
std::vector<Vertex>
Triangle::intersect(float z) const
{
Segment l1(v1, v2), l2(v2, v3), l3(v3, v1);
Vertex p1 = l1.intersect_with_plane(z);
Vertex p2 = l2.intersect_with_plane(z);
Vertex p3 = l3.intersect_with_plane(z);
vector<Vertex> res;
if (p1.between_with_e(v1, v2))
res.push_back(p1);
if (p2.between_with_e(v2, v3) && find(res.begin(), res.end(), p2) == res.end())
res.push_back(p2);
if (p3.between_with_e(v3, v1) && find(res.begin(), res.end(), p3) == res.end())
res.push_back(p3);
return res;
}
std::ostream& operator << (std::ostream& stream, const Triangle& t)
{
stream << t.v1 << " " << t.v2 << " " << t.v3;
return stream;
}
| 16.622222 | 80 | 0.637032 | interval1066 |
807e040eab83840fa93d4f8ddbc74e2ba0089fae | 1,574 | hh | C++ | StRoot/StMcEvent/StMcFtpcHitCollection.hh | xiaohaijin/RHIC-STAR | a305cb0a6ac15c8165bd8f0d074d7075d5e58752 | [
"MIT"
] | 2 | 2018-12-24T19:37:00.000Z | 2022-02-28T06:57:20.000Z | StRoot/StMcEvent/StMcFtpcHitCollection.hh | xiaohaijin/RHIC-STAR | a305cb0a6ac15c8165bd8f0d074d7075d5e58752 | [
"MIT"
] | null | null | null | StRoot/StMcEvent/StMcFtpcHitCollection.hh | xiaohaijin/RHIC-STAR | a305cb0a6ac15c8165bd8f0d074d7075d5e58752 | [
"MIT"
] | null | null | null | /***************************************************************************
*
* $Id: StMcFtpcHitCollection.hh,v 2.5 2012/03/22 00:41:15 perev Exp $
* $Log: StMcFtpcHitCollection.hh,v $
* Revision 2.5 2012/03/22 00:41:15 perev
* private => protected
*
* Revision 2.4 2009/07/24 19:08:07 perev
* Cleanup + Btof added (Geurts)
*
* Revision 2.3 2005/01/27 23:40:47 calderon
* Adding persistency to StMcEvent as a step for Virtual MonteCarlo.
*
* Revision 2.2 2000/04/17 23:01:15 calderon
* Added local momentum to hits as per Lee's request
*
* Revision 2.1 1999/11/19 19:06:32 calderon
* Recommit after redoing the files.
*
* Revision 2.0 1999/11/17 02:12:16 calderon
* Completely revised for new StEvent
*
* Revision 1.2 1999/09/23 21:25:51 calderon
* Added Log & Id
* Modified includes according to Yuri
*
*
**************************************************************************/
#ifndef StMcFtpcHitCollection_hh
#define StMcFtpcHitCollection_hh
#include "StMcFtpcPlaneHitCollection.hh"
class StMcFtpcHit;
class StMcFtpcHitCollection : public StObject {
public:
StMcFtpcHitCollection();
virtual ~StMcFtpcHitCollection();
bool addHit(StMcFtpcHit*);
unsigned long numberOfHits() const;
unsigned int numberOfPlanes() const;
StMcFtpcPlaneHitCollection* plane(unsigned int);
const StMcFtpcPlaneHitCollection* plane(unsigned int) const;
protected:
enum { mNumberOfPlanes = 20 };
StMcFtpcPlaneHitCollection mPlanes[mNumberOfPlanes];
ClassDef(StMcFtpcHitCollection,1)
};
#endif
| 29.698113 | 76 | 0.64803 | xiaohaijin |
807f4d7636b2fb2cd56284bca43557e3f1599d65 | 12,874 | cpp | C++ | alljoyn/alljoyn_core/samples/simple/android/client/jni/Client_jni.cpp | WigWagCo/alljoyn | 1b148edd934882ca32fd319af86a5a927f9d35a7 | [
"0BSD"
] | 37 | 2015-01-18T21:27:23.000Z | 2018-01-12T00:33:43.000Z | alljoyn/alljoyn_core/samples/simple/android/client/jni/Client_jni.cpp | WigWagCo/alljoyn | 1b148edd934882ca32fd319af86a5a927f9d35a7 | [
"0BSD"
] | 14 | 2015-02-24T11:44:01.000Z | 2020-07-20T18:48:44.000Z | alljoyn/alljoyn_core/samples/simple/android/client/jni/Client_jni.cpp | WigWagCo/alljoyn | 1b148edd934882ca32fd319af86a5a927f9d35a7 | [
"0BSD"
] | 29 | 2015-01-23T16:40:52.000Z | 2019-10-21T12:22:30.000Z | /*
* Copyright (c) 2010-2011, AllSeen Alliance. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "org_alljoyn_bus_samples_simpleclient_Client.h"
#include <alljoyn/BusAttachment.h>
#include <alljoyn/ProxyBusObject.h>
#include <alljoyn/AllJoynStd.h>
#include <alljoyn/BusListener.h>
#include <qcc/Log.h>
#include <qcc/String.h>
#include <new>
#include <android/log.h>
#include <assert.h>
#define LOG_TAG "SimpleClient"
/* Missing (from NDK) log macros (cutils/log.h) */
#ifndef LOGD
#define LOGD(...) (__android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__))
#endif
#ifndef LOGI
#define LOGI(...) (__android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__))
#endif
#ifndef LOGE
#define LOGE(...) (__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__))
#endif
using namespace ajn;
/* constants */
static const char* SIMPLE_SERVICE_INTERFACE_NAME = "org.alljoyn.bus.samples.simple";
static const char* SIMPLE_SERVICE_WELL_KNOWN_NAME_PREFIX = "org.alljoyn.bus.samples.simple.";
static const char* SIMPLE_SERVICE_OBJECT_PATH = "/simpleService";
static const int SESSION_PORT = 33;
/* forward decl */
class MyBusListener;
/* Static data */
static BusAttachment* s_bus = NULL;
static MyBusListener* s_busListener = NULL;
/* Local types */
class MyBusListener : public BusListener, public SessionPortListener, public SessionListener {
public:
MyBusListener(JavaVM* vm, jobject& jobj) : vm(vm), jobj(jobj) { }
void FoundAdvertisedName(const char* name, TransportMask transport, const char* namePrefix)
{
LOGD("\n\nENTERED FoundName with name=%s ", name);
size_t prefixLen = strlen(SIMPLE_SERVICE_WELL_KNOWN_NAME_PREFIX);
if (0 == strncmp(SIMPLE_SERVICE_WELL_KNOWN_NAME_PREFIX, name, prefixLen)) {
/* Found a name that matches service prefix. Inform Java GUI of this name */
JNIEnv* env;
jint jret = vm->GetEnv((void**)&env, JNI_VERSION_1_2);
if (JNI_EDETACHED == jret) {
vm->AttachCurrentThread(&env, NULL);
}
jclass jcls = env->GetObjectClass(jobj);
jmethodID mid = env->GetMethodID(jcls, "FoundNameCallback", "(Ljava/lang/String;)V");
if (mid == 0) {
LOGE("Failed to get Java FoundNameCallback");
} else {
jstring jName = env->NewStringUTF(name + prefixLen);
LOGE("Calling FoundNameCallback");
env->CallVoidMethod(jobj, mid, jName);
env->DeleteLocalRef(jName);
}
if (JNI_EDETACHED == jret) {
vm->DetachCurrentThread();
}
}
}
void LostAdvertisedName(const char* name, TransportMask transport, const char* namePrefix)
{
LOGD("\n\nENTERED LostAdvertisedName with name=%s ", name);
size_t prefixLen = strlen(SIMPLE_SERVICE_WELL_KNOWN_NAME_PREFIX);
if (0 == strncmp(SIMPLE_SERVICE_WELL_KNOWN_NAME_PREFIX, name, prefixLen)) {
/* Lost a name that matches service prefix. Inform Java GUI of this name */
JNIEnv* env;
jint jret = vm->GetEnv((void**)&env, JNI_VERSION_1_2);
if (JNI_EDETACHED == jret) {
vm->AttachCurrentThread(&env, NULL);
}
jclass jcls = env->GetObjectClass(jobj);
jmethodID mid = env->GetMethodID(jcls, "LostNameCallback", "(Ljava/lang/String;)V");
if (mid == 0) {
LOGE("Failed to get Java LostNameCallback");
} else {
jstring jName = env->NewStringUTF(name + prefixLen);
LOGE("Calling LostNameCallback");
env->CallVoidMethod(jobj, mid, jName);
env->DeleteLocalRef(jName);
}
if (JNI_EDETACHED == jret) {
vm->DetachCurrentThread();
}
}
}
void NameOwnerChanged(const char* busName, const char* previousOwner, const char* newOwner)
{
LOGD("\n NameOwnerchaged received ... busName = %s .... previousOwner = %s, newOwner = %s", busName, previousOwner, newOwner);
}
void SessionLost(SessionId sessionId, SessionLostReason reason)
{
LOGD("SessionLost(%u) received. Reason = %u.", sessionId, reason);
/* Inform Java GUI of this disconnect */
JNIEnv* env;
jint jret = vm->GetEnv((void**)&env, JNI_VERSION_1_2);
if (JNI_EDETACHED == jret) {
vm->AttachCurrentThread(&env, NULL);
}
jclass jcls = env->GetObjectClass(jobj);
jmethodID mid = env->GetMethodID(jcls, "DisconnectCallback", "(II)V");
if (mid == 0) {
LOGE("Failed to get Java DisconnectCallback");
} else {
env->CallVoidMethod(jobj, mid, jint(sessionId), jint(reason));
}
if (JNI_EDETACHED == jret) {
vm->DetachCurrentThread();
}
}
private:
JavaVM* vm;
jobject jobj;
};
#ifdef __cplusplus
extern "C" {
#endif
/**
* Initialize AllJoyn and connect to local daemon.
*/
JNIEXPORT jint JNICALL Java_org_alljoyn_bus_samples_simpleclient_Client_simpleOnCreate(JNIEnv* env,
jobject jobj,
jstring packageNameStrObj)
{
QStatus status = ER_OK;
/* Set AllJoyn logging */
// QCC_SetLogLevels("ALLJOYN=7;ALL=1");
QCC_UseOSLogging(true);
jobject gjobj = env->NewGlobalRef(jobj);
jboolean iscopy;
const char* packageNameStr = env->GetStringUTFChars(packageNameStrObj, &iscopy);
/* Create message bus */
s_bus = new BusAttachment(packageNameStr, true);
/* Add org.alljoyn.bus.samples.simple interface */
InterfaceDescription* testIntf = NULL;
status = s_bus->CreateInterface(SIMPLE_SERVICE_INTERFACE_NAME, testIntf);
if (ER_OK == status) {
testIntf->AddMethod("Ping", "s", "s", "outStr, inStr", 0);
testIntf->Activate();
} else {
LOGE("Failed to create interface \"%s\" (%s)", SIMPLE_SERVICE_INTERFACE_NAME, QCC_StatusText(status));
}
/* Start the msg bus */
if (ER_OK == status) {
status = s_bus->Start();
if (ER_OK != status) {
LOGE("BusAttachment::Start failed (%s)", QCC_StatusText(status));
}
}
LOGD("\n Registering BUS Listener\n");
/* Install discovery and name changed callbacks */
if (ER_OK == status) {
JavaVM* vm;
env->GetJavaVM(&vm);
s_busListener = new MyBusListener(vm, gjobj);
s_bus->RegisterBusListener(*s_busListener);
}
LOGD("\n Connecting to Daemon \n");
/* Connect to the daemon */
if (ER_OK == status) {
status = s_bus->Connect();
if (ER_OK != status) {
LOGE("BusAttachment::Connect(\"%s\") failed (%s)", s_bus->GetConnectSpec().c_str(), QCC_StatusText(status));
}
}
LOGD("\n Looking for ADVERTISED name \n");
/* Find an advertised name with the Prefix */
status = s_bus->FindAdvertisedName(SIMPLE_SERVICE_WELL_KNOWN_NAME_PREFIX);
if (ER_OK != status) {
LOGE("Error while calling FindAdvertisedName \n");
}
env->ReleaseStringUTFChars(packageNameStrObj, packageNameStr);
return jint(status);
}
/**
* Request the local AllJoyn daemon to connect to a remote daemon.
*/
JNIEXPORT jint JNICALL Java_org_alljoyn_bus_samples_simpleclient_Client_joinSession(JNIEnv* env,
jobject jobj,
jstring jBusName)
{
SessionId sessionId = 0;
jboolean iscopy;
if (NULL == s_bus) {
return jboolean(false);
}
/* Join the conversation */
const char* busName = env->GetStringUTFChars(jBusName, &iscopy);
qcc::String nameStr(SIMPLE_SERVICE_WELL_KNOWN_NAME_PREFIX);
nameStr.append(busName);
LOGD("\n Joining session with name : %s\n\n", nameStr.c_str());
SessionOpts opts(SessionOpts::TRAFFIC_MESSAGES, true, SessionOpts::PROXIMITY_ANY, TRANSPORT_ANY);
QStatus status = s_bus->JoinSession(nameStr.c_str(), SESSION_PORT, s_busListener, sessionId, opts);
if ((ER_OK == status)) {
LOGD("Joined conversation : %s \n \n Session ID : %u", nameStr.c_str(), sessionId);
} else {
LOGD("JoinSession failed .. status=%s\n", QCC_StatusText(status));
}
return jint(sessionId);
}
/**
* Request the local daemon to disconnect from the remote daemon.
*/
JNIEXPORT jboolean JNICALL Java_org_alljoyn_bus_samples_simpleclient_Client_leaveSession(JNIEnv* env,
jobject jobj,
jint jSessionId)
{
if (NULL == s_bus) {
return jboolean(false);
}
/* Leave the session */
SessionId sessionId = (SessionId) jSessionId;
QStatus status = s_bus->LeaveSession(sessionId);
if (ER_OK != status) {
LOGE("LeaveSession(%u) failed (%s)", sessionId, QCC_StatusText(status));
}
return jboolean(ER_OK == status);
}
/**
* Called when SimpleClient Java application exits. Performs AllJoyn cleanup.
*/
JNIEXPORT void JNICALL Java_org_alljoyn_bus_samples_simpleclient_Client_simpleOnDestroy(JNIEnv* env, jobject jobj)
{
/* Deallocate bus */
if (NULL != s_bus) {
delete s_bus;
s_bus = NULL;
}
if (NULL != s_busListener) {
delete s_busListener;
s_busListener = NULL;
}
}
/**
* Invoke the remote method org.alljoyn.bus.samples.simple.Ping on the /simpleService object
* located within the bus attachment named org.alljoyn.bus.samples.simple.
*/
JNIEXPORT jstring JNICALL Java_org_alljoyn_bus_samples_simpleclient_Client_simplePing(JNIEnv* env,
jobject jobj,
jint jSessionId,
jstring jNamePrefix,
jstring jPingStr)
{
LOGD("\n Calling ping now ..... \n");
/* Call the remote method */
jboolean iscopy;
const char* pingStr = env->GetStringUTFChars(jPingStr, &iscopy);
const char* namePrefix = env->GetStringUTFChars(jNamePrefix, &iscopy);
SessionId sessionId = (SessionId) jSessionId;
Message reply(*s_bus);
MsgArg pingStrArg("s", pingStr);
qcc::String nameStr(SIMPLE_SERVICE_WELL_KNOWN_NAME_PREFIX);
nameStr.append(namePrefix);
LOGD("\n Service Name : %s \n Object Path : %s \n Session ID : %u ", nameStr.c_str(), SIMPLE_SERVICE_OBJECT_PATH, sessionId);
ProxyBusObject remoteObj = ProxyBusObject(*s_bus, nameStr.c_str(), SIMPLE_SERVICE_OBJECT_PATH, sessionId);
QStatus status = remoteObj.AddInterface(SIMPLE_SERVICE_INTERFACE_NAME);
if (ER_OK == status) {
status = remoteObj.MethodCall(SIMPLE_SERVICE_INTERFACE_NAME, "Ping", &pingStrArg, 1, reply, 5000);
if (ER_OK == status) {
LOGI("%s.%s (path=%s) returned \"%s\"", nameStr.c_str(), "Ping", SIMPLE_SERVICE_OBJECT_PATH, reply->GetArg(0)->v_string.str);
} else {
LOGE("MethodCall on %s.%s failed (%s)", nameStr.c_str(), "Ping", QCC_StatusText(status));
}
} else {
LOGE("Failed to add interface %s to remote bus obj", SIMPLE_SERVICE_INTERFACE_NAME);
}
if (ER_OK == status) {
LOGI("Ping reply is: \"%s\"", reply->GetArg(0)->v_string.str);
}
env->ReleaseStringUTFChars(jPingStr, pingStr);
return env->NewStringUTF((ER_OK == status) ? reply->GetArg(0)->v_string.str : "");
}
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm,
void* reserved)
{
QCC_UseOSLogging(true);
return JNI_VERSION_1_2;
}
#ifdef __cplusplus
}
#endif
| 36.782857 | 137 | 0.609135 | WigWagCo |
8080f9d759f4ec143184b51efb217efd278f91bf | 1,636 | cc | C++ | iioservice/libiioservice_ipc/sensor_server_dbus.cc | Toromino/chromiumos-platform2 | 97e6ba18f0e5ab6723f3448a66f82c1a07538d87 | [
"BSD-3-Clause"
] | null | null | null | iioservice/libiioservice_ipc/sensor_server_dbus.cc | Toromino/chromiumos-platform2 | 97e6ba18f0e5ab6723f3448a66f82c1a07538d87 | [
"BSD-3-Clause"
] | null | null | null | iioservice/libiioservice_ipc/sensor_server_dbus.cc | Toromino/chromiumos-platform2 | 97e6ba18f0e5ab6723f3448a66f82c1a07538d87 | [
"BSD-3-Clause"
] | null | null | null | // Copyright 2020 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "iioservice/libiioservice_ipc/sensor_server_dbus.h"
#include <memory>
#include <base/bind.h>
#include <base/check.h>
#include <chromeos/dbus/service_constants.h>
#include "iioservice/include/common.h"
namespace iioservice {
void SensorServerDbus::BootstrapMojoConnection() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sensor_sequence_checker_);
DCHECK(sensor_bus_);
proxy_ = sensor_bus_->GetObjectProxy(
::mojo_connection_service::kMojoConnectionServiceServiceName,
dbus::ObjectPath(
::mojo_connection_service::kMojoConnectionServiceServicePath));
if (!proxy_) {
LOGF(ERROR) << "Failed to get proxy for "
<< ::mojo_connection_service::kMojoConnectionServiceServiceName;
return;
}
method_call_ = std::make_unique<dbus::MethodCall>(
::mojo_connection_service::kMojoConnectionServiceInterface,
::mojo_connection_service::kBootstrapMojoConnectionForIioServiceMethod);
proxy_->WaitForServiceToBeAvailable(
base::BindOnce(&SensorServerDbus::OnServiceAvailabilityChange,
weak_factory_.GetWeakPtr()));
}
void SensorServerDbus::OnInvitationReceived(
mojo::IncomingInvitation invitation) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sensor_sequence_checker_);
// Bind primordial message pipe to a SensorHalServer implementation.
OnServerReceived(mojo::PendingReceiver<cros::mojom::SensorHalServer>(
invitation.ExtractMessagePipe(0)));
}
} // namespace iioservice
| 32.72 | 80 | 0.761002 | Toromino |
80828e098e1da2831b8968f319cfd94c80c1d5f0 | 4,679 | cpp | C++ | source/drivers/event/chimera_event.cpp | brandonbraun653/Loki | 65c9472a81f66c13b729d7c2047013d1198f0c3c | [
"MIT"
] | 1 | 2020-02-23T09:55:46.000Z | 2020-02-23T09:55:46.000Z | source/drivers/event/chimera_event.cpp | brandonbraun653/Loki | 65c9472a81f66c13b729d7c2047013d1198f0c3c | [
"MIT"
] | 28 | 2019-04-02T17:12:19.000Z | 2020-12-13T15:12:23.000Z | source/drivers/event/chimera_event.cpp | brandonbraun653/Loki | 65c9472a81f66c13b729d7c2047013d1198f0c3c | [
"MIT"
] | null | null | null | /********************************************************************************
* File Name:
* chimera_event.cpp
*
* Description:
* Implements the event functionality for Chimera
*
* 2020 | Brandon Braun | brandonbraun653@gmail.com
********************************************************************************/
/* STL Includes */
/* Chimera Includes */
#include <Chimera/event>
#include <Chimera/thread>
namespace Chimera::Event
{
static bool processListener_Atomic( const Trigger event, Actionable &listener, uint32_t value );
static bool processListener_UserCallback( const Trigger event, Actionable &listener, uint32_t value );
static bool processListener_ISRCallback( const Trigger event, Actionable &listener, uint32_t value );
static bool processListener_Semaphore( const Trigger event, Actionable &listener, uint32_t value );
bool notifyListener( const Trigger event, Actionable &listener, uint32_t value )
{
switch ( listener.type )
{
case ListenerType::LISTENER_ATOMIC:
return processListener_Atomic( event, listener, value );
break;
case ListenerType::LISTENER_SEMAPHORE:
return processListener_Semaphore( event, listener, value );
break;
case ListenerType::LISTENER_FUNCTION:
return processListener_UserCallback( event, listener, value );
break;
case ListenerType::LISTENER_ISR_CALLBACK:
return processListener_ISRCallback( event, listener, value );
break;
case ListenerType::LISTENER_INVALID:
default:
return false;
break;
}
}
bool notifyListenerList( const Trigger event, ActionableList &list, uint32_t value )
{
bool accumulatedResult = true;
for ( Actionable &item : list )
{
accumulatedResult |= notifyListener( event, item, value );
}
return accumulatedResult;
}
bool processListener_Atomic( const Trigger event, Actionable &listener, uint32_t value )
{
/*------------------------------------------------
Only listen if we actually care about the event
------------------------------------------------*/
if ( listener.trigger != event )
{
return false;
}
/*------------------------------------------------
Make sure we don't perform a nullptr dereference
------------------------------------------------*/
if ( listener.object.atomic_listener )
{
*( listener.object.atomic_listener ) = value;
return true;
}
else
{
return false;
}
}
bool processListener_Semaphore( const Trigger event, Actionable &listener, uint32_t value )
{
/*------------------------------------------------
Only listen if we actually care about the event
------------------------------------------------*/
if ( listener.trigger != event )
{
return false;
}
/*------------------------------------------------
Make sure we don't perform a nullptr dereference
------------------------------------------------*/
if ( listener.object.semaphore_listener )
{
listener.object.semaphore_listener->releaseFromISR();
return true;
}
else
{
return false;
}
}
bool processListener_ISRCallback( const Trigger event, Actionable &listener, uint32_t value )
{
/*------------------------------------------------
Only listen if we actually care about the event
------------------------------------------------*/
if ( listener.trigger != event )
{
return false;
}
/*------------------------------------------------
Make sure we don't perform a nullptr dereference
------------------------------------------------*/
if ( listener.object.isr_callback_listener )
{
listener.object.isr_callback_listener( &value, sizeof( value ) );
return true;
}
else
{
return false;
}
}
bool processListener_UserCallback( const Trigger event, Actionable &listener, uint32_t value )
{
/*------------------------------------------------
Only listen if we actually care about the event
------------------------------------------------*/
if ( listener.trigger != event )
{
return false;
}
/*------------------------------------------------
Make sure we don't perform a nullptr dereference
------------------------------------------------*/
if ( listener.object.event_callback_listener )
{
listener.object.event_callback_listener( static_cast<size_t>( event ), &value, sizeof( value ) );
return true;
}
else
{
return false;
}
}
} // namespace Chimera::Event
| 29.062112 | 104 | 0.520838 | brandonbraun653 |
8083cad615a5b2f6f6e9acb88dea393cd65e70fd | 495 | cpp | C++ | Array/liuchang/day45/day45.cpp | JessonYue/LeetCodeLearning | 3c22a4fcdfe8b47f9f64b939c8b27742c4e30b79 | [
"MIT"
] | 39 | 2020-05-31T06:14:39.000Z | 2021-01-09T11:06:39.000Z | Array/liuchang/day45/day45.cpp | JessonYue/LeetCodeLearning | 3c22a4fcdfe8b47f9f64b939c8b27742c4e30b79 | [
"MIT"
] | 7 | 2020-06-02T11:04:14.000Z | 2020-06-11T14:11:58.000Z | Array/liuchang/day45/day45.cpp | JessonYue/LeetCodeLearning | 3c22a4fcdfe8b47f9f64b939c8b27742c4e30b79 | [
"MIT"
] | 20 | 2020-05-31T06:21:57.000Z | 2020-10-01T04:48:38.000Z | //
// Created by 刘畅 on 2020/7/15.
//
#include "day45.h"
#include "iostream"
char *toHex(int num) {
if (num == 0) return "0";
char *ret, s[] = "0123456789abcdef", c;
ret = (char *) malloc(sizeof(char) * 9);
int i, j = 0;
for (i = 0; i < 8 && num; i++) {
ret[i] = s[num & 0xf];
num >>= 4;
}
ret[i] = '\0';
i--;
while (j < i) {
c = ret[i];
ret[i] = ret[j];
ret[j] = c;
i--;
j++;
}
return ret;
}
| 17.068966 | 44 | 0.40202 | JessonYue |
80842a0a5b8365f8e37d3b4c3514392abc363945 | 1,612 | hpp | C++ | code/jalog/Scope.hpp | iboB/jalog | d89a5bb4ef8b0ea701a7cd3ea0229de3fbb3ecd9 | [
"MIT"
] | 3 | 2021-12-07T06:16:31.000Z | 2021-12-22T14:12:36.000Z | code/jalog/Scope.hpp | iboB/jalog | d89a5bb4ef8b0ea701a7cd3ea0229de3fbb3ecd9 | [
"MIT"
] | null | null | null | code/jalog/Scope.hpp | iboB/jalog | d89a5bb4ef8b0ea701a7cd3ea0229de3fbb3ecd9 | [
"MIT"
] | null | null | null | // jalog
// Copyright (c) 2021-2022 Borislav Stanimirov
//
// Distributed under the MIT Software License
// See accompanying file LICENSE.txt or copy at
// https://opensource.org/licenses/MIT
//
#pragma once
#include "API.h"
#include "Level.hpp"
#include "ScopeDesc.hpp"
#include <atomic>
#include <vector>
#include <string_view>
namespace jalog
{
class Logger;
class Sink;
class JALOG_API Scope
{
public:
// creates a default logger scope
explicit Scope(std::string_view label, uintptr_t id = 0, intptr_t userData = -1);
// creates a scope for a given logger
Scope(Logger& logger, std::string_view label, uintptr_t id = 0, intptr_t userData = -1);
~Scope();
Scope(const Scope&) = delete;
Scope& operator=(const Scope&) = delete;
Scope(Scope&&) = delete;
Scope& operator=(Scope&&) = delete;
const ScopeDesc& desc() const { return m_desc; }
void setLevel(Level lvl) { m_level.store(lvl, std::memory_order_relaxed); }
Level level() const { return m_level.load(std::memory_order_relaxed); }
bool enabled(Level lvl) const { return lvl >= level(); }
// add an entry but don't perform the enabled check
// assume it's performed from the outside
void addEntryUnchecked(Level lvl, std::string_view text);
// add entry if the level is >= than our min level
void addEntry(Level lvl, std::string_view text) { if (enabled(lvl)) addEntryUnchecked(lvl, text); }
private:
friend class Logger;
std::atomic<Level> m_level = Level::Debug;
protected:
Logger& m_logger;
ScopeDesc m_desc;
std::vector<Sink*> m_sinks;
};
}
| 23.705882 | 103 | 0.684243 | iboB |
808bc2b68f3917e36970e82b72836aa2f5d18f30 | 1,672 | cpp | C++ | RealityCore/Source/GUI/Login.cpp | Intro-Ventors/Re-Co-Desktop | 8547cca9230069a36973ec836426d4610f30f8bb | [
"MIT"
] | null | null | null | RealityCore/Source/GUI/Login.cpp | Intro-Ventors/Re-Co-Desktop | 8547cca9230069a36973ec836426d4610f30f8bb | [
"MIT"
] | null | null | null | RealityCore/Source/GUI/Login.cpp | Intro-Ventors/Re-Co-Desktop | 8547cca9230069a36973ec836426d4610f30f8bb | [
"MIT"
] | null | null | null | // Copyright (c) 2022 Intro-Ventors
#include "Login.hpp"
#include "../../ui_Login.h"
#include <QMovie>
#include <QCryptographicHash>
namespace GUI
{
Login::Login(QWidget* pParent)
: QDialog(pParent, Qt::FramelessWindowHint)
, m_pLogin(new Ui::Login())
{
// Setup the UI.
m_pLogin->setupUi(this);
// Create and assign the movie to the label.
auto pMovie = new QMovie(":/Assets/2D/SplashScreen.gif");
m_pLogin->movie->setMovie(pMovie);
// Set the size of the movie and start playing.
pMovie->setScaledSize(QSize(480, 270));
pMovie->start();
//setAttribute(Qt::WA_TranslucentBackground);
setStyleSheet("background-color: black;");
// Setup connections.
connect(m_pLogin->signIn, &QPushButton::pressed, this, &Login::onSignIn);
connect(m_pLogin->signUp, &QPushButton::pressed, this, &Login::onSignUp);
}
Login::~Login()
{
// Delete the allocated memory.
delete m_pLogin;
}
QString Login::getUsername() const
{
return m_pLogin->username->text();
}
QByteArray Login::getPassword() const
{
// Hash and return the hashed bytes.
return QCryptographicHash::hash(m_pLogin->password->text().toLocal8Bit(), QCryptographicHash::Sha3_512);
}
void Login::clearInput()
{
m_pLogin->username->clear();
m_pLogin->password->clear();
}
void Login::onSignIn()
{
const auto username = getUsername();
const auto password = getPassword();
// Clear the user inputs.
clearInput();
// Whatever the log in logic.
// Say that we accept the login.
accept();
}
void Login::onSignUp()
{
// Clear the user inputs.
clearInput();
// Whatever the sign up logic.
// Say that we rejected it.
reject();
}
} | 20.641975 | 106 | 0.68122 | Intro-Ventors |
80926846273cfea668bdebae73a235d443533e22 | 1,150 | cpp | C++ | src/largest-divisible-subset.cpp | amoudgl/leetcode-solutions | dc6570bb06b82c2c70d6f387b3486897035cc995 | [
"MIT"
] | null | null | null | src/largest-divisible-subset.cpp | amoudgl/leetcode-solutions | dc6570bb06b82c2c70d6f387b3486897035cc995 | [
"MIT"
] | null | null | null | src/largest-divisible-subset.cpp | amoudgl/leetcode-solutions | dc6570bb06b82c2c70d6f387b3486897035cc995 | [
"MIT"
] | null | null | null | // Author: Abhinav Moudgil [ https://leetcode.com/amoudgl/ ]
class Solution {
public:
vector<int> largestDivisibleSubset(vector<int>& nums) {
int i, j, n = nums.size(), prev, max = 0, ind, maxind, ans = 0;
vector<int> largestSet;
if (n == 0) return largestSet;
sort(nums.begin(), nums.end());
vector<pair<int, int>> dp(n, pair<int, int> (0, -1));
for (i = 0; i < n; i++)
{
int temp = 0;
ind = -1;
for (j = 0; j < i; j++)
{
if (nums[i] % nums[j] == 0 && dp[j].first > temp)
{
temp = dp[j].first;
ind = j;
}
}
dp[i].first = temp + 1;
dp[i].second = ind;
if (dp[i].first > ans)
{
ans = dp[i].first;
maxind = i;
}
}
i = maxind;
while (i != -1)
{
largestSet.push_back(nums[i]);
i = dp[i].second;
}
reverse(largestSet.begin(), largestSet.end());
return largestSet;
}
};
| 28.75 | 73 | 0.395652 | amoudgl |
80991cf5210708c7a5d74dd5a5151ee8912e20ed | 7,394 | cpp | C++ | tools/binlog/binlog.cpp | chronoxor/CppLogging | 13743b54086ad80af121c7bb77f5e9a71473753b | [
"MIT"
] | 97 | 2016-10-09T04:10:25.000Z | 2022-03-30T21:23:25.000Z | tools/binlog/binlog.cpp | chronoxor/CppLogging | 13743b54086ad80af121c7bb77f5e9a71473753b | [
"MIT"
] | 4 | 2019-10-25T01:45:13.000Z | 2021-12-15T04:09:58.000Z | tools/binlog/binlog.cpp | chronoxor/CppLogging | 13743b54086ad80af121c7bb77f5e9a71473753b | [
"MIT"
] | 34 | 2018-12-28T14:01:46.000Z | 2021-11-24T17:22:09.000Z | /*!
\file binlog.cpp
\brief Binary logs reader definition
\author Ivan Shynkarenka
\date 16.09.2015
\copyright MIT License
*/
#include "logging/record.h"
#include "logging/layouts/text_layout.h"
#include "logging/version.h"
#include "../source/logging/appenders/minizip/unzip.h"
#if defined(_WIN32) || defined(_WIN64)
#include "../source/logging/appenders/minizip/iowin32.h"
#endif
#include "errors/fatal.h"
#include "filesystem/file.h"
#include "system/stream.h"
#include "utility/countof.h"
#include "utility/resource.h"
#include <cstdio>
#include <cstring>
#include <iostream>
#include <memory>
#include <vector>
#include <OptionParser.h>
using namespace CppCommon;
using namespace CppLogging;
Path UnzipFile(const Path& path)
{
// Open a zip archive
unzFile unzf;
#if defined(_WIN32) || defined(_WIN64)
zlib_filefunc64_def ffunc;
fill_win32_filefunc64W(&ffunc);
unzf = unzOpen2_64(path.wstring().c_str(), &ffunc);
#else
unzf = unzOpen64(path.string().c_str());
#endif
if (unzf == nullptr)
throwex FileSystemException("Cannot open a zip archive!").Attach(path);
// Smart resource cleaner pattern
auto unzip = resource(unzf, [](unzFile handle) { unzClose(handle); });
File destination(path + ".tmp");
// Open the destination file for writing
destination.Create(false, true);
// Get info about the zip archive
unz_global_info global_info;
int result = unzGetGlobalInfo(unzf, &global_info);
if (result != UNZ_OK)
throwex FileSystemException("Cannot read a zip archive global info!").Attach(path);
// Loop to extract all files from the zip archive
uLong i;
for (i = 0; i < global_info.number_entry; ++i)
{
unz_file_info file_info;
char filename[1024];
// Get info about the current file in the zip archive
result = unzGetCurrentFileInfo(unzf, &file_info, filename, (unsigned)countof(filename), NULL, 0, NULL, 0);
if (result != UNZ_OK)
throwex FileSystemException("Cannot read a zip archive file info!").Attach(path);
// Check if this entry is a file
const size_t filename_length = strlen(filename);
if (filename[filename_length - 1] != '/')
{
// Open the current file in the zip archive
result = unzOpenCurrentFile(unzf);
if (result != UNZ_OK)
throwex FileSystemException("Cannot open a current file in the zip archive!").Attach(path);
// Smart resource cleaner pattern
auto unzip_file = resource(unzf, [](unzFile handle) { unzCloseCurrentFile(handle); });
// Read data from the current file in the zip archive
do
{
uint8_t buffer[16384];
result = unzReadCurrentFile(unzf, buffer, (unsigned)countof(buffer));
if (result > 0)
destination.Write(buffer, (size_t)result);
else if (result < 0)
throwex FileSystemException("Cannot read the current file from the zip archive!").Attach(path);
} while (result != UNZ_EOF);
// Close the current file in the zip archive
result = unzCloseCurrentFile(unzf);
if (result != UNZ_OK)
throwex FileSystemException("Cannot close the current file in the zip archive!").Attach(path);
unzip_file.release();
}
}
// Close the destination file
destination.Close();
// Close the zip archive
result = unzClose(unzf);
if (result != UNZ_OK)
throwex FileSystemException("Cannot close the zip archive!").Attach(path);
unzip.release();
return std::move(destination);
}
bool InputRecord(Reader& input, Record& record)
{
// Clear the logging record
record.Clear();
// Read the logging record size
uint32_t size;
if (input.Read(&size, sizeof(uint32_t)) != sizeof(uint32_t))
return false;
record.raw.resize(size);
// Read the logging record raw data
if (input.Read(record.raw.data(), size) != size)
{
std::cerr << "Failed to read from the input source!" << std::endl;
return false;
}
// Get the buffer start position
const uint8_t* buffer = record.raw.data();
// Deserialize logging record
std::memcpy(&record.timestamp, buffer, sizeof(uint64_t));
buffer += sizeof(uint64_t);
std::memcpy(&record.thread, buffer, sizeof(uint64_t));
buffer += sizeof(uint64_t);
std::memcpy(&record.level, buffer, sizeof(Level));
buffer += sizeof(Level);
// Deserialize the logger name
uint8_t logger_size;
std::memcpy(&logger_size, buffer, sizeof(uint8_t));
buffer += sizeof(uint8_t);
record.logger.insert(record.logger.begin(), buffer, buffer + logger_size);
buffer += logger_size;
// Deserialize the logging message
uint16_t message_size;
std::memcpy(&message_size, buffer, sizeof(uint16_t));
buffer += sizeof(uint16_t);
record.message.insert(record.message.begin(), buffer, buffer + message_size);
buffer += message_size;
// Deserialize the logging buffer
uint32_t buffer_size;
std::memcpy(&buffer_size, buffer, sizeof(uint32_t));
buffer += sizeof(uint32_t);
record.buffer.insert(record.buffer.begin(), buffer, buffer + buffer_size);
buffer += buffer_size;
// Skip the last zero byte
++buffer;
return true;
}
bool OutputRecord(Writer& output, Record& record)
{
TextLayout layout;
layout.LayoutRecord(record);
size_t size = record.raw.size() - 1;
if (output.Write(record.raw.data(), size) != size)
{
std::cerr << "Failed to write into the output source!" << std::endl;
return false;
}
return true;
}
int main(int argc, char** argv)
{
auto parser = optparse::OptionParser().version(version);
parser.add_option("-i", "--input").dest("input").help("Input file name");
parser.add_option("-o", "--output").dest("output").help("Output file name");
optparse::Values options = parser.parse_args(argc, argv);
// Print help
if (options.get("help"))
{
parser.print_help();
return 0;
}
try
{
Path temp_file;
// Open the input file or stdin
std::unique_ptr<Reader> input(new StdInput());
if (options.is_set("input"))
{
Path path(options.get("input"));
if (path.IsRegularFile() && (path.extension() == ".zip"))
temp_file = path = UnzipFile(path);
File* file = new File(path);
file->Open(true, false);
input.reset(file);
}
// Open the output file or stdout
std::unique_ptr<Writer> output(new StdOutput());
if (options.is_set("output"))
{
File* file = new File(Path(options.get("output")));
file->Open(false, true);
output.reset(file);
}
// Process all logging records
Record record;
while (InputRecord(*input, record))
if (!OutputRecord(*output, record))
break;
// Delete temporary file
if (temp_file)
Path::Remove(temp_file);
return 0;
}
catch (const std::exception& ex)
{
std::cerr << ex.what() << std::endl;
return -1;
}
}
| 29.694779 | 115 | 0.617933 | chronoxor |
809a93ee2b6e537001737479389c09c46d51dc92 | 3,244 | cpp | C++ | main/controller.cpp | lucasnunes/tcc_source | 695610ec134d946694080fd2efae3f1dc41c2fa2 | [
"Apache-2.0"
] | 2 | 2019-01-08T12:51:04.000Z | 2019-01-08T12:51:04.000Z | main/controller.cpp | lucasnunes/tcc_source | 695610ec134d946694080fd2efae3f1dc41c2fa2 | [
"Apache-2.0"
] | null | null | null | main/controller.cpp | lucasnunes/tcc_source | 695610ec134d946694080fd2efae3f1dc41c2fa2 | [
"Apache-2.0"
] | null | null | null | /**
* Copyright 2014 Lucas Nunes de Lima
*
* 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.
**/
#include "controller.hpp"
#include "http/server.hpp"
#include "logger.hpp"
#include "settings.hpp"
#include "manager.hpp"
#include "modbus/handler.hpp"
#include <memory>
namespace controller
{
namespace Controller
{
using http::Server;
Server* http_server = nullptr;
Manager* manager = nullptr;
void http_thread()
{
try
{
logger.write("Iniciando servidor HTTP.");
Server sv("0.0.0.0", "80", ".");
http_server = &sv;
sv.run();
http_server = nullptr;
}
catch(std::exception e)
{
logger.write("Erro ao executar servidor HTTP: {}.", e.what());
}
catch(...)
{
logger.write("Erro ao executar servidor HTTP.");
}
}
void free_thread()
{
do
{
if(http_server != nullptr)
{
http_server->freeConnections();
}
std::this_thread::sleep_for(std::chrono::milliseconds(250));
}
while(true);
}
void manager_thread()
{
Manager mn;
manager = &mn;
mn.run();
manager = nullptr;
mn.kickDog();
logger.write("Erro ao executar programa principal.");
}
void modbus_thread()
{
using namespace modbus;
try
{
logger.write("Iniciando servidor modbus.");
Modbus sv;
sv.run();
}
catch (std::exception& e)
{
logger.write("Erro ao executar servidor Modbus: {}.", e.what());
}
catch(...)
{
logger.write("Erro ao executar servidor Modbus.");
}
}
void kick()
{
if(manager != nullptr) manager->kickDog();
}
void start()
{
system("cpufreq-set -f 1000MHz");
std::thread t1(http_thread);
std::thread t2(manager_thread);
std::thread t3(modbus_thread);
std::thread t4(free_thread);
t1.join(); kick();
t2.join(); kick();
t3.join(); kick();
t4.join(); kick();
}
}
} | 25.543307 | 80 | 0.460543 | lucasnunes |
809c004dab8f2e13b058b94afeb1ddfa6c95b8e1 | 1,601 | cpp | C++ | fw/src/util.cpp | cednik/one-wire_sniffer | bfa8e38e6310c8a20ac48eaa711be53b3454806b | [
"MIT"
] | null | null | null | fw/src/util.cpp | cednik/one-wire_sniffer | bfa8e38e6310c8a20ac48eaa711be53b3454806b | [
"MIT"
] | null | null | null | fw/src/util.cpp | cednik/one-wire_sniffer | bfa8e38e6310c8a20ac48eaa711be53b3454806b | [
"MIT"
] | null | null | null | #include "util.hpp"
#include "print.hpp"
#include "esp_system.h"
#include "FreeRTOS.h"
void checkReset() {
esp_reset_reason_t resetReason = esp_reset_reason();
switch (resetReason) {
case ESP_RST_UNKNOWN:
print("\tUnknown reset - strange\n");
break;
case ESP_RST_POWERON:
print("\tPoweron reset\n");
break;
case ESP_RST_EXT:
print("\tExternal reset\n");
break;
case ESP_RST_SW:
print("\tSoftware reset\n");
break;
case ESP_RST_PANIC:
print("\tReset due to core panic - stop program\n");
vTaskSuspend(nullptr);
break;
case ESP_RST_INT_WDT:
print("\tReset due to interrupt watchdog - stop program\n");
vTaskSuspend(nullptr);
break;
case ESP_RST_TASK_WDT:
print("\tReset due to task watchdog - stop program\n");
vTaskSuspend(nullptr);
break;
case ESP_RST_WDT:
print("\tReset due to some watchdog - stop program\n");
vTaskSuspend(nullptr);
break;
case ESP_RST_DEEPSLEEP:
print("\tWaked from deep sleep\n");
break;
case ESP_RST_BROWNOUT:
print("\tBrownout reset - please check power\n");
break;
case ESP_RST_SDIO:
print("\tSDIO reset - strange\n");
break;
}
}
void notifyTaskFromISR(Callback::callback_arg_t args) {
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
vTaskNotifyGiveFromISR( reinterpret_cast<TaskHandle_t>(args), &xHigherPriorityTaskWoken);
if (xHigherPriorityTaskWoken == pdTRUE)
portYIELD_FROM_ISR();
}
| 27.603448 | 93 | 0.632105 | cednik |