blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 3 264 | content_id stringlengths 40 40 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | repo_name stringlengths 5 140 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 905
values | visit_date timestamp[us]date 2015-08-09 11:21:18 2023-09-06 10:45:07 | revision_date timestamp[us]date 1997-09-14 05:04:47 2023-09-17 19:19:19 | committer_date timestamp[us]date 1997-09-14 05:04:47 2023-09-06 06:22:19 | github_id int64 3.89k 681M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us]date 2012-06-07 00:51:45 2023-09-14 21:58:39 ⌀ | gha_created_at timestamp[us]date 2008-03-27 23:40:48 2023-08-21 23:17:38 ⌀ | gha_language stringclasses 141
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 10.4M | extension stringclasses 115
values | content stringlengths 3 10.4M | authors listlengths 1 1 | author_id stringlengths 0 158 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b55d3c28234b1b8ac7c1a53e9866d862757e7a58 | 45ff5276cb24a272de7b1cfc135b2a4d24f77c42 | /Object.cpp | 692e1e34a204165a426e5898947a2977e203c51f | [] | no_license | jdixie/JPCPractice | 5240bfba3d524b0e989897c3c24ebd62d1eb73c3 | ab0216c5eca0a1032a2e82a1d2670597c97caf2e | refs/heads/master | 2021-05-30T16:01:07.882667 | 2016-01-21T22:18:14 | 2016-01-21T22:18:14 | 42,977,863 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 16,998 | cpp | #include "object.h"
//extern GridContents collisionGrid[GRID_HASH_SIZE];
Object::Object()
{
collisionType = ObjectNS::AABB;
gridCell.x = -1;
gridCell.y = -1;
gridCell.z = -1;
gridCell.next = NULL;
gridLoc[0] = -1;
}
Object::~Object()
{
//delete gridCell.next;
}
void Object::update(float frameTime)
{
// tempX = getX() + velocity.x; //* gameScale;
// tempY = getY() + velocity.y; //* gameScale;
// tempZ = getZ() + velocity.z; //* gameScale;
imageInfo.x = imageInfo.x + velocity.x; //* gameScale;
imageInfo.y = imageInfo.y + velocity.y; //* gameScale;
imageInfo.z = imageInfo.z + velocity.z; //* gameScale;
moveVector.x = velocity.x;
moveVector.y = velocity.y;
moveVector.z = velocity.z;
//for now, only update grid for this object if there was a change in velocity
if (velocity.x != 0 || velocity.y != 0 || velocity.z != 0)
setGridCells();
// setGridLoc();
}
void Object::setGridCells()
{
return;
GridCell cell[8];
bool xSplit = false;
bool ySplit = false;
bool zSplit = false;
//remove old entries from grid collision table
//moved operation to game.cpp updateCollisionGrid, maybe - nope nvm, do it here
for (int index = 0; index <= 7; index++)
{
if (gridLoc[index] == -1)
{
break;
}
GridCell *tempCell = &gridCell;
while (collisionGrid[gridLoc[index]].gridCell.x != tempCell->x ||
collisionGrid[gridLoc[index]].gridCell.y != tempCell->y ||
collisionGrid[gridLoc[index]].gridCell.z != tempCell->z)
{
if (collisionGrid[gridLoc[index]].next != NULL)
tempCell = tempCell->next;
else
throw(GameError(gameErrorNS::FATAL_ERROR, L"Error with grid collision system - error removing object during GridCell search."));
if (tempCell == NULL)
throw(GameError(gameErrorNS::FATAL_ERROR, L"Error with grid collision system - error removing object GridCell not matched."));
}
//remove from object list
ObjectPtrList *tempObject = collisionGrid[gridLoc[index]].object;
if (tempObject != NULL)
{
if (tempObject->next != NULL)
{
while (tempObject->next->objectPtr != this)
{
tempObject = tempObject->next;
if (tempObject == NULL)
throw(GameError(gameErrorNS::FATAL_ERROR, L"Error with grid collision system - error removing object, not in list."));
}
tempObject->next = tempObject->next->next;
}
}
}
//remove all gridCell entries
if (gridCell.next != NULL)
{
if (gridCell.next != NULL)
delete gridCell.next;
}
//compute cells of the objects 8 corners
cell[0].x = (imageInfo.x - imageInfo.rx) / GRID_UNIT;
cell[0].y = (imageInfo.y + imageInfo.ry) / GRID_UNIT;
cell[0].z = (imageInfo.z - imageInfo.rz) / GRID_UNIT;
cell[1].x = (imageInfo.x - imageInfo.rx) / GRID_UNIT;
cell[1].y = (imageInfo.y + imageInfo.ry) / GRID_UNIT;
cell[1].z = (imageInfo.z + imageInfo.rz) / GRID_UNIT;
cell[2].x = (imageInfo.x + imageInfo.rx) / GRID_UNIT;
cell[2].y = (imageInfo.y + imageInfo.ry) / GRID_UNIT;
cell[2].z = (imageInfo.z + imageInfo.rz) / GRID_UNIT;
cell[3].x = (imageInfo.x + imageInfo.rx) / GRID_UNIT;
cell[3].y = (imageInfo.y + imageInfo.ry) / GRID_UNIT;
cell[3].z = (imageInfo.z - imageInfo.rz) / GRID_UNIT;
cell[4].x = (imageInfo.x - imageInfo.rx) / GRID_UNIT;
cell[4].y = (imageInfo.y - imageInfo.ry) / GRID_UNIT;
cell[4].z = (imageInfo.z - imageInfo.rz) / GRID_UNIT;
cell[5].x = (imageInfo.x - imageInfo.rx) / GRID_UNIT;
cell[5].y = (imageInfo.y - imageInfo.ry) / GRID_UNIT;
cell[5].z = (imageInfo.z + imageInfo.rz) / GRID_UNIT;
cell[6].x = (imageInfo.x + imageInfo.rx) / GRID_UNIT;
cell[6].y = (imageInfo.y - imageInfo.ry) / GRID_UNIT;
cell[6].z = (imageInfo.z + imageInfo.rz) / GRID_UNIT;
cell[7].x = (imageInfo.x + imageInfo.rx) / GRID_UNIT;
cell[7].y = (imageInfo.y - imageInfo.ry) / GRID_UNIT;
cell[7].z = (imageInfo.z - imageInfo.rz) / GRID_UNIT;
//determine if the object is split between cells
if (cell[0].x != cell[6].x)
xSplit = true;
if (cell[0].y != cell[6].y)
ySplit = true;
if (cell[0].z != cell[6].z)
zSplit = true;
//add cell 0 as first gridCell
gridCell.x = cell[0].x;
gridCell.y = cell[0].y;
gridCell.z = cell[0].z;
//based on split create our cell list
if (xSplit && ySplit && zSplit)
{
GridCell *tempCell = &gridCell;
for (int i = 1; i <= 7; i++)
{
tempCell->next = new GridCell();
tempCell->next->x = cell[i].x;
tempCell->next->y = cell[i].y;
tempCell->next->z = cell[i].z;
tempCell = tempCell->next;
}
}
else if (xSplit && ySplit)
{
GridCell *tempCell = &gridCell;
tempCell->next = new GridCell();
tempCell->next->x = cell[3].x;
tempCell->next->y = cell[3].y;
tempCell->next->z = cell[3].z;
tempCell = tempCell->next;
tempCell->next = new GridCell();
tempCell->next->x = cell[4].x;
tempCell->next->y = cell[4].y;
tempCell->next->z = cell[4].z;
tempCell = tempCell->next;
tempCell->next = new GridCell();
tempCell->next->x = cell[7].x;
tempCell->next->y = cell[7].y;
tempCell->next->z = cell[7].z;
tempCell = tempCell->next;
}
else if (xSplit && zSplit)
{
GridCell *tempCell = &gridCell;
tempCell->next = new GridCell();
tempCell->next->x = cell[1].x;
tempCell->next->y = cell[1].y;
tempCell->next->z = cell[1].z;
tempCell = tempCell->next;
tempCell->next = new GridCell();
tempCell->next->x = cell[2].x;
tempCell->next->y = cell[2].y;
tempCell->next->z = cell[2].z;
tempCell = tempCell->next;
tempCell->next = new GridCell();
tempCell->next->x = cell[3].x;
tempCell->next->y = cell[3].y;
tempCell->next->z = cell[3].z;
tempCell = tempCell->next;
}
else if (ySplit && zSplit)
{
GridCell *tempCell = &gridCell;
tempCell->next = new GridCell();
tempCell->next->x = cell[2].x;
tempCell->next->y = cell[2].y;
tempCell->next->z = cell[2].z;
tempCell = tempCell->next;
tempCell->next = new GridCell();
tempCell->next->x = cell[6].x;
tempCell->next->y = cell[6].y;
tempCell->next->z = cell[6].z;
tempCell = tempCell->next;
tempCell->next = new GridCell();
tempCell->next->x = cell[7].x;
tempCell->next->y = cell[7].y;
tempCell->next->z = cell[7].z;
tempCell = tempCell->next;
}
else if (xSplit || ySplit || zSplit)
{
gridCell.next = new GridCell();
gridCell.next->x = cell[6].x;
gridCell.next->y = cell[6].y;
gridCell.next->z = cell[6].z;
}
//add new entries to grid collision table
setGridLoc();
GridCell *tempCell = &gridCell;
for (int index = 0; index <= 7; index++)
{
if (gridLoc[index] == -1)
break;
GridContents *tempCollisionContents = &collisionGrid[gridLoc[index]];
while (tempCollisionContents->gridCell.x != tempCell->x ||
tempCollisionContents->gridCell.y != tempCell->y ||
tempCollisionContents->gridCell.z != tempCell->z)
{
if (tempCollisionContents->next != NULL)
tempCollisionContents = tempCollisionContents->next;
else
throw(GameError(gameErrorNS::FATAL_ERROR, L"Error with grid collision system - error adding object contents mismatch."));
}
//add to object list
if (collisionGrid[gridLoc[index]].object == NULL)
{//no objects
collisionGrid[gridLoc[index]].object = new ObjectPtrList(this);
}
else
{//already objects
ObjectPtrList *tempObject = tempCollisionContents->object;
while (tempObject->next != NULL)
tempObject = tempObject->next;
tempObject->next = new ObjectPtrList(this);
}
if (tempCell->next != NULL)
tempCell = tempCell->next;
}
}
//set collision grid array index
void Object::setGridLoc()
{
return;
int index = 0;
GridCell *tempCell = &gridCell;
while (tempCell != NULL)
{
gridLoc[index] = (HASH_XM * tempCell->x + HASH_YM * tempCell->y + HASH_ZM * tempCell->z) % GRID_HASH_SIZE;
if (gridLoc[index] < 0) //make it so this doesn't happen
gridLoc[index] = -gridLoc[index];//GRID_HASH_SIZE;
index++;
tempCell = tempCell->next;
}
for (index; index <= 7; index++)
{
gridLoc[index] = -1;
}
}
void Object::setInitialGridCells()
{
return;
GridCell cell[8];
bool xSplit = false;
bool ySplit = false;
bool zSplit = false;
//compute cells of the objects 8 corners
cell[0].x = (imageInfo.x - imageInfo.rx) / GRID_UNIT;
cell[0].y = (imageInfo.y + imageInfo.ry) / GRID_UNIT;
cell[0].z = (imageInfo.z - imageInfo.rz) / GRID_UNIT;
cell[1].x = (imageInfo.x - imageInfo.rx) / GRID_UNIT;
cell[1].y = (imageInfo.y + imageInfo.ry) / GRID_UNIT;
cell[1].z = (imageInfo.z + imageInfo.rz) / GRID_UNIT;
cell[2].x = (imageInfo.x + imageInfo.rx) / GRID_UNIT;
cell[2].y = (imageInfo.y + imageInfo.ry) / GRID_UNIT;
cell[2].z = (imageInfo.z + imageInfo.rz) / GRID_UNIT;
cell[3].x = (imageInfo.x + imageInfo.rx) / GRID_UNIT;
cell[3].y = (imageInfo.y + imageInfo.ry) / GRID_UNIT;
cell[3].z = (imageInfo.z - imageInfo.rz) / GRID_UNIT;
cell[4].x = (imageInfo.x - imageInfo.rx) / GRID_UNIT;
cell[4].y = (imageInfo.y - imageInfo.ry) / GRID_UNIT;
cell[4].z = (imageInfo.z - imageInfo.rz) / GRID_UNIT;
cell[5].x = (imageInfo.x - imageInfo.rx) / GRID_UNIT;
cell[5].y = (imageInfo.y - imageInfo.ry) / GRID_UNIT;
cell[5].z = (imageInfo.z + imageInfo.rz) / GRID_UNIT;
cell[6].x = (imageInfo.x + imageInfo.rx) / GRID_UNIT;
cell[6].y = (imageInfo.y - imageInfo.ry) / GRID_UNIT;
cell[6].z = (imageInfo.z + imageInfo.rz) / GRID_UNIT;
cell[7].x = (imageInfo.x + imageInfo.rx) / GRID_UNIT;
cell[7].y = (imageInfo.y - imageInfo.ry) / GRID_UNIT;
cell[7].z = (imageInfo.z - imageInfo.rz) / GRID_UNIT;
//determine if the object is split between cells
if (cell[0].x != cell[6].x)
xSplit = true;
if (cell[0].y != cell[6].y)
ySplit = true;
if (cell[0].z != cell[6].z)
zSplit = true;
//add cell 0 as first gridCell
gridCell.x = cell[0].x;
gridCell.y = cell[0].y;
gridCell.z = cell[0].z;
//based on split create our cell list
if (xSplit && ySplit && zSplit)
{
GridCell *tempCell = &gridCell;
for (int i = 1; i <= 7; i++)
{
tempCell->next = new GridCell();
tempCell->next->x = cell[i].x;
tempCell->next->y = cell[i].y;
tempCell->next->z = cell[i].z;
tempCell = tempCell->next;
}
}
else if (xSplit && ySplit)
{
GridCell *tempCell = &gridCell;
tempCell->next = new GridCell();
tempCell->next->x = cell[3].x;
tempCell->next->y = cell[3].y;
tempCell->next->z = cell[3].z;
tempCell = tempCell->next;
tempCell->next = new GridCell();
tempCell->next->x = cell[4].x;
tempCell->next->y = cell[4].y;
tempCell->next->z = cell[4].z;
tempCell = tempCell->next;
tempCell->next = new GridCell();
tempCell->next->x = cell[7].x;
tempCell->next->y = cell[7].y;
tempCell->next->z = cell[7].z;
tempCell = tempCell->next;
}
else if (xSplit && zSplit)
{
GridCell *tempCell = &gridCell;
tempCell->next = new GridCell();
tempCell->next->x = cell[1].x;
tempCell->next->y = cell[1].y;
tempCell->next->z = cell[1].z;
tempCell = tempCell->next;
tempCell->next = new GridCell();
tempCell->next->x = cell[2].x;
tempCell->next->y = cell[2].y;
tempCell->next->z = cell[2].z;
tempCell = tempCell->next;
tempCell->next = new GridCell();
tempCell->next->x = cell[3].x;
tempCell->next->y = cell[3].y;
tempCell->next->z = cell[3].z;
tempCell = tempCell->next;
}
else if (ySplit && zSplit)
{
GridCell *tempCell = &gridCell;
tempCell->next = new GridCell();
tempCell->next->x = cell[2].x;
tempCell->next->y = cell[2].y;
tempCell->next->z = cell[2].z;
tempCell = tempCell->next;
tempCell->next = new GridCell();
tempCell->next->x = cell[6].x;
tempCell->next->y = cell[6].y;
tempCell->next->z = cell[6].z;
tempCell = tempCell->next;
tempCell->next = new GridCell();
tempCell->next->x = cell[7].x;
tempCell->next->y = cell[7].y;
tempCell->next->z = cell[7].z;
tempCell = tempCell->next;
}
else if (xSplit || ySplit || zSplit)
{
gridCell.next = new GridCell();
gridCell.next->x = cell[6].x;
gridCell.next->y = cell[6].y;
gridCell.next->z = cell[6].z;
}
//add new entries to grid collision table
setGridLoc();
GridCell *tempCell = &gridCell;
for (int index = 0; index <= 7; index++)
{
if (gridLoc[index] == -1)
break;
GridContents *tempCollisionContents = &collisionGrid[gridLoc[index]];
while (tempCollisionContents->gridCell.x != tempCell->x ||
tempCollisionContents->gridCell.y != tempCell->y ||
tempCollisionContents->gridCell.z != tempCell->z)
{
if (tempCollisionContents->next != NULL)
tempCollisionContents = tempCollisionContents->next;
else
throw(GameError(gameErrorNS::FATAL_ERROR, L"Error with grid collision system - error adding initial object contents mismatch."));
}
//add to object list
if (collisionGrid[gridLoc[index]].object == NULL)
{//no objects
collisionGrid[gridLoc[index]].object = new ObjectPtrList(this);
}
else
{//already objects
ObjectPtrList *tempObject = tempCollisionContents->object;
while (tempObject->next != NULL)
tempObject = tempObject->next;
tempObject->next = new ObjectPtrList(this);
}
if (tempCell->next != NULL)
tempCell = tempCell->next;
}
}
bool Object::collidesWith(Object *obj, DirectX::XMFLOAT3 *collisionVector)
{
if (collisionType == ObjectNS::AABB && obj->collisionType == ObjectNS::AABB)
return collideAABoundingBox(obj, collisionVector);
else
//base coverage in case of a problem
return collideAABoundingBox(obj, collisionVector);
}
//switch check to check temporary movement values
/*bool Object::collideAABoundingBox(Object *obj, DirectX::XMFLOAT3 *collisionVector)
{
if (imageInfo.x + imageInfo.rx < obj->imageInfo.x - obj->imageInfo.rx || imageInfo.x - imageInfo.rx > obj->imageInfo.x + obj->imageInfo.rx)
return false;
if (imageInfo.y + imageInfo.ry < obj->imageInfo.y - obj->imageInfo.ry || imageInfo.y - imageInfo.ry > obj->imageInfo.y + obj->imageInfo.ry)
return false;
if (imageInfo.z + imageInfo.rz < obj->imageInfo.z - obj->imageInfo.rz || imageInfo.z - imageInfo.rz > obj->imageInfo.z + obj->imageInfo.rz)
return false;
collisionVector->x = obj->imageInfo.x - imageInfo.x;
collisionVector->y = obj->imageInfo.y - imageInfo.y;
collisionVector->z = obj->imageInfo.z - imageInfo.z;
return true;
}*/
bool Object::collideAABoundingBox(Object *obj, DirectX::XMFLOAT3 *collisionVector)
{
/* if (tempX + imageInfo.rx < obj->tempX - obj->imageInfo.rx || tempX - imageInfo.rx > obj->tempX + obj->imageInfo.rx)
return false;
if (tempY + imageInfo.ry < obj->tempY - obj->imageInfo.ry || tempY - imageInfo.ry > obj->tempY + obj->imageInfo.ry)
return false;
if (tempZ + imageInfo.rz < obj->tempZ - obj->imageInfo.rz || tempZ - imageInfo.rz > obj->tempZ + obj->imageInfo.rz)
return false;
collisionVector->x = obj->tempX - tempX;
collisionVector->y = obj->tempY - tempY;
collisionVector->z = obj->tempZ - tempZ;*/
if (imageInfo.x + imageInfo.rx < obj->imageInfo.x - obj->imageInfo.rx ||
imageInfo.x - imageInfo.rx > obj->imageInfo.x + obj->imageInfo.rx)
return false;
else
{//set collision vector x, positive x collision gives a negative value
if (imageInfo.x + imageInfo.rx > obj->imageInfo.x - obj->imageInfo.rx)
collisionVector->x = 0 - (imageInfo.x + imageInfo.rx - obj->imageInfo.x - obj->imageInfo.rx);
else
collisionVector->x = 0 + (obj->imageInfo.x + obj->imageInfo.rx - imageInfo.x - imageInfo.rx);
}
if (imageInfo.y + imageInfo.ry < obj->imageInfo.y - obj->imageInfo.ry ||
imageInfo.y - imageInfo.ry > obj->imageInfo.y + obj->imageInfo.ry)
return false;
else
{//set collision vector y, positive y collision gives a negative value
if (imageInfo.y + imageInfo.ry > obj->imageInfo.y - obj->imageInfo.ry)
collisionVector->y = 0 - (imageInfo.y + imageInfo.ry - obj->imageInfo.y - obj->imageInfo.ry);
else
collisionVector->y = 0 + (obj->imageInfo.y + obj->imageInfo.ry - imageInfo.y - imageInfo.ry);
}
if (imageInfo.z + imageInfo.rz < obj->imageInfo.z - obj->imageInfo.rz ||
imageInfo.z - imageInfo.rz > obj->imageInfo.z + obj->imageInfo.rz)
return false;
else
{//set collision vector z, positive z collision gives a negative value
if (imageInfo.z + imageInfo.rz > obj->imageInfo.z - obj->imageInfo.rz)
collisionVector->z = 0 - (imageInfo.z + imageInfo.rz - obj->imageInfo.z - obj->imageInfo.rz);
else
collisionVector->z = 0 + (obj->imageInfo.z + obj->imageInfo.rz - imageInfo.z - imageInfo.rz);
}
return true;
}
bool Object::collideOBoundingBox(Object *obj, DirectX::XMFLOAT3 *collisionVector)
{
computeRotatedBox();
obj->computeRotatedBox();
return true;
}
void Object::computeRotatedBox()
{
DirectX::XMFLOAT3 rotatedX();
DirectX::XMFLOAT3 rotatedY();
DirectX::XMFLOAT3 rotatedZ();
}
void Object::createPrimaryBoundingBox()
{
if (collisionType == ObjectNS::AABB)
{
aabb.min.x = imageInfo.x - imageInfo.rx;
aabb.min.y = imageInfo.y - imageInfo.ry;
aabb.min.z = imageInfo.z - imageInfo.rz;
aabb.max.x = imageInfo.x + imageInfo.rx;
aabb.max.y = imageInfo.y + imageInfo.ry;
aabb.max.z = imageInfo.z + imageInfo.rz;
}
else if (collisionType == ObjectNS::OBB)
{
return;
}
else if (collisionType == ObjectNS::SPHERE)
{
bs.radius = imageInfo.rx;
}
} | [
"joshua.dixie@yahoo.com"
] | joshua.dixie@yahoo.com |
1e91825552abb9102c0d5178432b8f09b0c63e83 | 4bea57e631734f8cb1c230f521fd523a63c1ff23 | /projects/openfoam/rarefied-flows/impingment/sims/test/nozzle1/1.14/grad(rho) | ec91b0f4af1999353a3c9da3759227b46f834dc4 | [] | no_license | andytorrestb/cfal | 76217f77dd43474f6b0a7eb430887e8775b78d7f | 730fb66a3070ccb3e0c52c03417e3b09140f3605 | refs/heads/master | 2023-07-04T01:22:01.990628 | 2021-08-01T15:36:17 | 2021-08-01T15:36:17 | 294,183,829 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 47,333 | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1912 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "1.14";
object grad(rho);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -4 0 0 0 0 0];
internalField nonuniform List<vector>
1900
(
(-0.026655 2.52116e-05 0)
(-0.00413501 3.47591e-05 0)
(0.296168 1.24046e-05 0)
(18.0708 -0.000432619 0)
(235.165 -0.110767 0)
(997.798 -2.10907 0)
(1917.62 -7.45977 0)
(1890.74 -3.6529 0)
(1451.82 121.292 0)
(366.182 -3.15069 0)
(-0.026595 4.31439e-05 0)
(-0.00414782 5.44854e-05 0)
(0.295701 9.76515e-06 0)
(17.96 0.00191036 0)
(233.057 -0.00894654 0)
(990.449 -1.22937 0)
(1916.07 -4.824 0)
(2019.49 -3.31956 0)
(1452.32 123.619 0)
(639.952 -71.56 0)
(-0.0265573 3.92575e-09 0)
(-0.00416839 3.10862e-09 0)
(0.298024 1.06937e-08 0)
(18.0619 1.72307e-09 0)
(233.934 -1.19904e-08 0)
(992.983 -2.20268e-08 0)
(1915.53 -2.16716e-09 0)
(2019.18 6.37712e-09 0)
(1383.57 9.66338e-09 0)
(505.734 4.42313e-09 0)
(-0.026595 -4.31337e-05 0)
(-0.00414781 -5.4482e-05 0)
(0.295701 -9.75538e-06 0)
(17.96 -0.00191037 0)
(233.057 0.00894653 0)
(990.449 1.22937 0)
(1916.07 4.824 0)
(2019.49 3.31956 0)
(1452.32 -123.619 0)
(639.952 71.56 0)
(-0.0266549 -2.52053e-05 0)
(-0.00413501 -3.47588e-05 0)
(0.296168 -1.24055e-05 0)
(18.0708 0.000432615 0)
(235.165 0.110767 0)
(997.798 2.10907 0)
(1917.62 7.45977 0)
(1890.74 3.6529 0)
(1451.82 -121.292 0)
(366.182 3.15069 0)
(-270.152 339.083 1.43748e-11)
(-20.1038 365.863 -1.75039e-11)
(-983.177 247.165 -2.2129e-11)
(-5363.27 785.102 0)
(-565.824 6363.47 -9.04837e-11)
(114.09 210.124 1.44361e-11)
(-257.745 185.65 1.75039e-11)
(-890.205 33.93 2.2129e-11)
(-2816 293.311 0)
(-101.517 5728.64 0)
(171.143 2.57443e-09 0)
(-106.043 1.55821e-09 0)
(-881.07 -3.6514e-09 0)
(-2544.51 -5.3829e-10 0)
(2753.32 -4.86383e-09 0)
(114.09 -210.124 1.44361e-11)
(-257.745 -185.65 1.75039e-11)
(-890.205 -33.93 2.2129e-11)
(-2816 -293.311 0)
(-101.517 -5728.64 0)
(-270.152 -339.083 -4.32469e-11)
(-20.1038 -365.863 -1.75039e-11)
(-983.177 -247.165 -2.2129e-11)
(-5363.27 -785.102 -5.98884e-11)
(-565.824 -6363.47 9.04837e-11)
(8479.67 -3197.23 4.24622e-11)
(1075.59 -384.005 -3.58759e-11)
(2326.38 42.2805 0)
(4263.02 314.149 2.81979e-11)
(-1469.82 -6684.24 -1.30583e-11)
(6249.73 -3321.29 -2.1183e-11)
(1846.17 -258.663 1.79322e-11)
(2553.35 -35.7578 0)
(1291.65 -399.147 -1.76266e-11)
(-6624.03 -11504.6 3.12762e-12)
(6708.56 -6.99777e-09 0)
(1872.3 -2.27738e-09 0)
(2235.09 2.43427e-09 0)
(-813.989 -3.36695e-09 7.04584e-12)
(-9077.01 -3.37612e-09 -6.25524e-12)
(6249.73 3321.29 -2.1183e-11)
(1846.17 258.663 1.79322e-11)
(2553.35 35.7578 0)
(1291.65 399.147 -1.76266e-11)
(-6624.03 11504.6 3.12762e-12)
(8479.67 3197.23 2.1183e-11)
(1075.59 384.005 1.1565e-14)
(2326.38 -42.2805 0)
(4263.02 -314.149 9.46114e-15)
(-1469.82 6684.24 1.30583e-11)
(-24328.5 -49808.2 0)
(-19586.1 2017.19 0)
(988.802 2560.96 0)
(1232.25 1339.86 0)
(2778.97 426.076 0)
(4054.37 219.366 0)
(4934.88 67.1326 0)
(5130.59 58.4964 0)
(4557.68 58.4306 0)
(3087.64 36.6033 0)
(1340.71 11.7472 0)
(295 1.29717 0)
(23.3738 0.0316311 0)
(0.440785 0.000114576 0)
(0.001335 4.27618e-08 0)
(4.6245e-07 0 0)
(0 0 0)
(0 0 0)
(0 -6.45948e-11 0)
(0 0 0)
(0 -6.45948e-11 0)
(0 0 0)
(0 0 0)
(0 -6.45948e-11 0)
(-6.06303e-07 0 0)
(-0.00169327 1.16271e-09 0)
(-0.540946 1.10457e-08 0)
(-27.8168 -3.94028e-09 0)
(-342.07 -1.09811e-09 0)
(-1525 -1.67946e-09 0)
(-3471.5 -5.55515e-09 0)
(-5121.6 5.81353e-10 0)
(-5905.41 8.39732e-10 0)
(-6079.11 2.4869e-09 0)
(-5966.25 -3.87569e-09 0)
(-5596.09 2.90677e-10 0)
(-4286.94 -4.52164e-09 0)
(-1083.97 -2.71298e-09 0)
(78157.9 -7.81597e-09 0)
(-125468 -2.2479e-08 0)
(-22717.7 -19931.6 0)
(-15637.3 6197.07 0)
(997.397 1624.57 0)
(896.857 745.81 0)
(2649.21 86.1157 0)
(4048.93 104.923 0)
(4916.75 30.1907 0)
(5130.25 25.0251 0)
(4555.43 25.1714 0)
(3083.28 15.4489 0)
(1337.63 5.17054 0)
(293.947 0.607622 0)
(23.2503 0.0155229 0)
(0.437647 5.73276e-05 0)
(0.00132348 2.13163e-08 0)
(4.5943e-07 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-1.61487e-11 0 0)
(0 0 0)
(1.61487e-11 0 0)
(-6.06287e-07 0 0)
(-0.00169327 -3.87569e-10 0)
(-0.540946 1.28544e-08 0)
(-27.8168 -4.39245e-09 0)
(-342.07 -5.29677e-09 0)
(-1525 -8.39732e-10 0)
(-3471.5 -3.55271e-09 0)
(-5121.6 9.68922e-10 0)
(-5905.41 2.19622e-09 0)
(-6079.11 1.74406e-09 0)
(-5966.25 -2.22852e-09 0)
(-5596.09 2.00244e-09 0)
(-4286.94 -8.07435e-10 0)
(-1083.97 -1.61487e-09 0)
(78157.9 -1.35649e-09 0)
(-125468 1.55028e-09 0)
(-19915.2 -2.71298e-09 0)
(-13315.2 -7.75138e-10 0)
(-597.018 1.45338e-09 0)
(784.7 5.78123e-09 0)
(2592.53 1.80865e-09 0)
(4038.1 -7.75138e-10 0)
(4911.64 2.06703e-09 0)
(5129.13 3.22974e-10 0)
(4554.9 -3.10055e-09 0)
(3081.83 -8.00975e-09 0)
(1336.4 -3.16514e-09 0)
(293.501 3.61731e-09 0)
(23.1971 3.22974e-10 0)
(0.436269 -3.42352e-09 0)
(0.00131832 2.77758e-09 0)
(4.56249e-07 0 0)
(0 0 0)
(-1.61487e-11 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-6.06416e-07 0 0)
(-0.00169327 -2.19622e-09 0)
(-0.540946 7.62219e-09 0)
(-27.8168 -1.27252e-08 0)
(-342.07 -3.03596e-09 0)
(-1525 9.04327e-09 0)
(-3471.5 -7.10543e-10 0)
(-5121.6 -1.35649e-09 0)
(-5905.41 -3.87569e-10 0)
(-6079.11 6.00732e-09 0)
(-5966.25 5.39367e-09 0)
(-5596.09 1.55028e-09 0)
(-4286.94 -2.26082e-10 0)
(-1083.97 -3.22974e-11 0)
(78157.9 1.13041e-09 0)
(-125468 3.10055e-08 0)
(-22717.7 19931.6 0)
(-15637.3 -6197.07 0)
(997.397 -1624.57 0)
(896.857 -745.81 0)
(2649.21 -86.1157 0)
(4048.93 -104.923 0)
(4916.75 -30.1907 0)
(5130.25 -25.0251 0)
(4555.43 -25.1714 0)
(3083.28 -15.4489 0)
(1337.63 -5.17054 0)
(293.947 -0.607622 0)
(23.2503 -0.0155229 0)
(0.437647 -5.73306e-05 0)
(0.00132348 -3.17806e-08 0)
(4.58639e-07 0 0)
(0 0 0)
(0 0 0)
(-1.61487e-11 0 0)
(1.61487e-11 0 0)
(-1.61487e-11 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-6.06949e-07 0 0)
(-0.00169327 -6.52407e-09 0)
(-0.540946 6.39488e-09 0)
(-27.8168 -1.2596e-08 0)
(-342.07 4.00488e-09 0)
(-1525 8.6557e-09 0)
(-3471.5 -2.58379e-10 0)
(-5121.6 2.84217e-09 0)
(-5905.41 7.10543e-10 0)
(-6079.11 1.11749e-08 0)
(-5966.25 8.6557e-09 0)
(-5596.09 -2.90677e-10 0)
(-4286.94 -4.48934e-09 0)
(-1083.97 2.4869e-09 0)
(78157.9 4.36015e-09 0)
(-125468 1.98952e-08 0)
(-24328.5 49808.2 0)
(-19586.1 -2017.19 0)
(988.802 -2560.96 0)
(1232.25 -1339.86 0)
(2778.97 -426.076 0)
(4054.37 -219.366 0)
(4934.88 -67.1326 0)
(5130.59 -58.4964 0)
(4557.68 -58.4306 0)
(3087.64 -36.6033 0)
(1340.71 -11.7472 0)
(295 -1.29717 0)
(23.3738 -0.0316311 0)
(0.440785 -0.000114575 0)
(0.001335 -5.12883e-08 0)
(4.6547e-07 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-6.08305e-07 0 0)
(-0.00169326 -4.26326e-09 0)
(-0.540946 3.61731e-09 0)
(-27.8168 -2.90677e-09 0)
(-342.07 3.6819e-09 0)
(-1525 5.55515e-09 0)
(-3471.5 -2.58379e-09 0)
(-5121.6 1.80865e-09 0)
(-5905.41 4.78001e-09 0)
(-6079.11 5.68434e-09 0)
(-5966.25 3.55271e-09 0)
(-5596.09 -2.58379e-10 0)
(-4286.94 1.77636e-09 0)
(-1083.97 2.64839e-09 0)
(78157.9 7.68678e-09 0)
(-125468 1.12395e-08 0)
(101995 58206.7 0)
(-43921.2 -3687.08 0)
(1432.2 -3030.73 0)
(1848.21 -1861.07 0)
(3202.04 -989.462 0)
(4267.8 -425.991 0)
(4996.7 -203.196 0)
(5135.31 -140.319 0)
(4566.55 -108.591 0)
(3107.52 -61.5151 0)
(1356.21 -18.391 0)
(300.079 -1.92787 0)
(23.921 -0.0457601 0)
(0.45386 -0.000165479 0)
(0.00138204 -6.23815e-08 0)
(4.82886e-07 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-6.0802e-07 0 0)
(-0.00169326 4.68008e-10 0)
(-0.540946 -2.14503e-10 0)
(-27.8168 1.77453e-09 0)
(-342.07 1.13102e-09 0)
(-1525 -4.54357e-09 0)
(-3471.5 -2.34004e-09 0)
(-5121.6 -4.95308e-09 0)
(-5905.41 3.95856e-09 0)
(-6079.11 2.65204e-09 0)
(-5966.25 -3.45156e-09 0)
(-5596.09 -5.36259e-10 0)
(-4286.94 1.79403e-09 0)
(-1083.97 2.73004e-10 0)
(78157.9 -8.48264e-10 0)
(-125468 3.23705e-09 0)
(118188 31830.1 0)
(-65547.4 -2468.94 0)
(2510.65 -2621.52 0)
(2868.99 -1867.42 0)
(3935 -1148.49 0)
(4697.6 -613.131 0)
(5177.01 -383.516 0)
(5219.22 -251.832 0)
(4628.86 -161.369 0)
(3163.9 -79.1453 0)
(1389.82 -21.7104 0)
(309.955 -2.18946 0)
(24.938 -0.0516638 0)
(0.47787 -0.000190043 0)
(0.00146924 -7.88203e-08 0)
(5.16232e-07 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-6.0802e-07 0 0)
(-0.00169326 1.09202e-09 0)
(-0.540946 -4.03657e-09 0)
(-27.8168 5.83059e-09 0)
(-342.07 4.46557e-09 0)
(-1525 -8.15113e-09 0)
(-3471.5 8.61914e-09 0)
(-5121.6 -4.58257e-09 0)
(-5905.41 5.71359e-09 0)
(-6079.11 2.78855e-09 0)
(-5966.25 -1.46252e-10 0)
(-5596.09 -1.31627e-09 0)
(-4286.94 -1.74528e-09 0)
(-1083.97 -4.97258e-10 0)
(78157.9 -5.9476e-10 0)
(-125468 -6.4351e-09 0)
(128669 13996.4 0)
(-77120 -480.523 0)
(2011.85 -1703.09 0)
(3267.68 -1540.02 0)
(4410.72 -1072.29 0)
(5004.95 -679.538 0)
(5344.86 -476.066 0)
(5349.38 -313.859 0)
(4732.96 -186.522 0)
(3242.1 -84.1429 0)
(1430.37 -21.6444 0)
(320.95 -2.10615 0)
(26.0307 -0.0492019 0)
(0.503645 -0.000182677 0)
(0.00156517 -7.70262e-08 0)
(5.5886e-07 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-6.06947e-07 0 0)
(-0.00169327 -1.56003e-09 0)
(-0.540946 -6.53261e-09 0)
(-27.8168 2.74954e-09 0)
(-342.07 9.47715e-09 0)
(-1525 -1.01792e-08 0)
(-3471.5 1.62438e-08 0)
(-5121.6 -2.14503e-09 0)
(-5905.41 2.82755e-09 0)
(-6079.11 5.26509e-10 0)
(-5966.25 2.63254e-10 0)
(-5596.09 -5.75259e-10 0)
(-4286.94 -2.50579e-09 0)
(-1083.97 -2.33029e-09 0)
(78157.9 1.36502e-10 0)
(-125468 -1.41182e-08 0)
(131489 2538.09 0)
(-80676.1 -368.532 0)
(1489.68 -1436.53 0)
(3476.85 -1340.83 0)
(4764.18 -988.198 0)
(5272.14 -689.291 0)
(5529.4 -480.957 0)
(5498.23 -309.166 0)
(4850.23 -172.773 0)
(3322.79 -72.323 0)
(1468.88 -17.2815 0)
(330.765 -1.58129 0)
(26.9674 -0.0352272 0)
(0.525282 -0.000127581 0)
(0.00164528 -5.08373e-08 0)
(5.90489e-07 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 -2.73004e-10 0)
(0 -3.90006e-11 0)
(0 -3.90006e-11 0)
(0 -3.90006e-11 0)
(-6.09541e-07 0 0)
(-0.00169327 -5.47959e-09 0)
(-0.540946 -1.95003e-10 0)
(-27.8168 -8.17063e-09 0)
(-342.07 8.07313e-09 0)
(-1525 -2.04948e-08 0)
(-3471.5 9.59416e-09 0)
(-5121.6 -7.00061e-09 0)
(-5905.41 -2.59354e-09 0)
(-6079.11 -1.34552e-09 0)
(-5966.25 1.31627e-09 0)
(-5596.09 6.4351e-10 0)
(-4286.94 -1.44302e-09 0)
(-1083.97 -6.72761e-10 0)
(78157.9 -1.69653e-09 0)
(-125468 -4.68008e-10 0)
(130941 -1397.01 0)
(-80950.1 -480.28 0)
(1074.91 -1324.62 0)
(3699.71 -1134.64 0)
(5038.56 -852.463 0)
(5493.75 -614.78 0)
(5711.16 -416.514 0)
(5646.36 -254.243 0)
(4961.19 -131.411 0)
(3391.94 -49.8092 0)
(1498.54 -10.5778 0)
(337.569 -0.852643 0)
(27.5543 -0.0168854 0)
(0.537591 -6.59146e-05 0)
(0.00168811 -1.12633e-05 0)
(6.07825e-07 -1.12404e-05 0)
(0 -1.12405e-05 0)
(-1.95003e-11 -1.12412e-05 0)
(1.95003e-11 -1.12417e-05 0)
(-2.73004e-10 -1.12393e-05 0)
(-5.85009e-11 -1.12415e-05 0)
(2.34004e-10 -1.12383e-05 0)
(0 -1.12369e-05 0)
(3.90006e-11 -1.12405e-05 0)
(-6.12193e-07 -1.12383e-05 0)
(-0.00169327 -1.12435e-05 0)
(-0.540946 -1.12445e-05 0)
(-27.8168 -1.12404e-05 0)
(-342.07 -1.12365e-05 0)
(-1525 -1.11033e-05 0)
(-3471.5 -1.04656e-05 0)
(-5121.6 -9.08709e-06 0)
(-5905.41 -7.09141e-06 0)
(-6079.11 -4.9559e-06 0)
(-5966.25 -3.12257e-06 0)
(-5596.09 -1.81225e-06 0)
(-4286.94 -9.44313e-07 0)
(-1083.97 -4.35871e-07 0)
(78157.9 -1.05341e-07 0)
(-125468 -1.15832e-08 0)
(129706 -2472.66 0)
(-80606.3 -697.946 0)
(859.117 -1108.37 0)
(3931.84 -889.604 0)
(5265.14 -666.942 0)
(5692.24 -467.361 0)
(5876.82 -298.529 0)
(5772.97 -168.759 0)
(5047.23 -78.8932 0)
(3439.23 -26.193 0)
(1516.05 -4.614 0)
(340.942 -0.29678 0)
(27.7889 -0.0185422 0)
(0.541543 -0.0145668 0)
(0.00169796 -0.0145591 0)
(6.12446e-07 -0.0145591 0)
(-7.21512e-10 -0.0145591 0)
(-1.18952e-09 -0.0145591 0)
(1.83303e-09 -0.0145591 0)
(2.53504e-10 -0.0145591 0)
(9.36015e-10 -0.0145591 0)
(4.40707e-09 -0.0145591 0)
(-2.12553e-09 -0.0145591 0)
(-1.38452e-09 -0.0145591 0)
(-6.12388e-07 -0.0145591 0)
(-0.00169328 -0.0145591 0)
(-0.540946 -0.0145591 0)
(-27.8168 -0.0145588 0)
(-342.07 -0.0145459 0)
(-1525 -0.0143857 0)
(-3471.5 -0.0136927 0)
(-5121.6 -0.0121848 0)
(-5905.41 -0.0100017 0)
(-6079.11 -0.00755454 0)
(-5966.25 -0.00527953 0)
(-5596.09 -0.00346544 0)
(-4286.94 -0.00209179 0)
(-1083.97 -0.00117637 0)
(78157.9 -0.000357511 0)
(-125468 -0.000141496 0)
(127829 -2730.25 0)
(-79635.5 -735.589 0)
(890.217 -746.448 0)
(4125.09 -583.658 0)
(5445.45 -426.016 0)
(5848.77 -281.231 0)
(5998.91 -165.833 0)
(5858.01 -85.1096 0)
(5098.57 -35.5413 0)
(3463.52 -11.2869 0)
(1523.49 -3.54971 0)
(341.997 -2.44766 0)
(27.8263 -2.41808 0)
(0.541429 -2.41857 0)
(0.00169557 -2.41857 0)
(6.20188e-07 -2.41857 0)
(7.37112e-09 -2.41857 0)
(1.96953e-09 -2.41857 0)
(1.77453e-09 -2.41857 0)
(1.95003e-10 -2.41857 0)
(-8.19013e-10 -2.41857 0)
(-2.55454e-09 -2.41857 0)
(2.10603e-09 -2.41857 0)
(1.11152e-09 -2.41857 0)
(-6.08195e-07 -2.41857 0)
(-0.00169329 -2.41857 0)
(-0.540946 -2.41857 0)
(-27.8167 -2.41853 0)
(-342.07 -2.41652 0)
(-1525 -2.3927 0)
(-3471.49 -2.29391 0)
(-5121.6 -2.08567 0)
(-5905.41 -1.78631 0)
(-6079.1 -1.44193 0)
(-5966.25 -1.10173 0)
(-5596.08 -0.80433 0)
(-4286.94 -0.551065 0)
(-1083.97 -0.366353 0)
(78157.9 -0.143705 0)
(-125468 -0.128233 0)
(126248 -1820.39 0)
(-78694.6 -460.914 0)
(1005.52 -355.397 0)
(4240.62 -278.533 0)
(5556.57 -201.014 0)
(5942.96 -142.189 0)
(6065.81 -103.359 0)
(5898.52 -81.7491 0)
(5118.36 -73.024 0)
(3470.05 -71.8278 0)
(1524.57 -72.9739 0)
(342.032 -73.5122 0)
(27.817 -73.5761 0)
(0.541069 -73.5778 0)
(0.001694 -73.5778 0)
(6.05056e-07 -73.5778 0)
(-1.73553e-09 -73.5778 0)
(-1.19342e-08 -73.5778 0)
(-1.14272e-08 -73.5778 0)
(-4.44607e-09 -73.5778 0)
(3.54906e-09 -73.5778 0)
(1.19927e-08 -73.5778 0)
(1.14272e-08 -73.5778 0)
(-2.45704e-09 -73.5778 0)
(-6.26857e-07 -73.5778 0)
(-0.00169314 -73.5778 0)
(-0.540907 -73.5778 0)
(-27.8148 -73.5766 0)
(-342.045 -73.5178 0)
(-1524.88 -72.854 0)
(-3471.2 -70.2374 0)
(-5121.11 -64.9612 0)
(-5904.79 -57.5607 0)
(-6078.45 -49.0024 0)
(-5965.64 -40.2128 0)
(-5595.56 -31.9747 0)
(-4286.52 -24.3121 0)
(-1083.58 -18.5186 0)
(78158.1 -9.38951 0)
(-125468 -15.0856 0)
(125535 -967.577 0)
(-78223.7 -280.857 0)
(1065.97 -303.126 0)
(4273.86 -324.54 0)
(5576.84 -358.052 0)
(5942.87 -402.652 0)
(6057.15 -454.66 0)
(5887.24 -507.753 0)
(5108.13 -556.072 0)
(3463.57 -592.482 0)
(1521.87 -611.756 0)
(341.417 -617.007 0)
(27.7631 -617.501 0)
(0.539822 -617.512 0)
(0.00168931 -617.512 0)
(6.17497e-07 -617.512 0)
(9.45765e-09 -617.512 0)
(8.50214e-09 -617.512 0)
(9.59416e-09 -617.512 0)
(7.56612e-09 -617.512 0)
(-3.64656e-09 -617.512 0)
(-1.19927e-08 -617.512 0)
(-8.87264e-09 -617.512 0)
(-4.29007e-10 -617.512 0)
(-5.91503e-07 -617.512 0)
(-0.00168925 -617.512 0)
(-0.539759 -617.512 0)
(-27.759 -617.502 0)
(-341.374 -617.009 0)
(-1521.84 -611.724 0)
(-3463.89 -591.999 0)
(-5109.38 -554.256 0)
(-5890.03 -503.355 0)
(-6062.39 -445.377 0)
(-5949.84 -384.93 0)
(-5580.76 -325.763 0)
(-4273.97 -267.928 0)
(-1069.59 -225.396 0)
(78161.2 -145.208 0)
(-125444 -350.657 0)
(124994 -2525.61 0)
(-78054.4 -806.223 0)
(963.429 -1014.16 0)
(4187.69 -1127.57 0)
(5481.3 -1294.66 0)
(5849.87 -1460.52 0)
(5964.53 -1627.27 0)
(5800.8 -1789.53 0)
(5036.72 -1936.93 0)
(3416.4 -2051.91 0)
(1500.94 -2115.62 0)
(336.496 -2133.71 0)
(27.33 -2135.48 0)
(0.530463 -2135.52 0)
(0.00165631 -2135.52 0)
(5.96515e-07 -2135.52 0)
(-5.40159e-09 -2135.52 0)
(-1.21097e-08 -2135.52 0)
(-1.10762e-08 -2135.52 0)
(-4.44607e-09 -2135.52 0)
(4.36807e-09 -2135.52 0)
(1.02767e-08 -2135.52 0)
(1.07837e-08 -2135.52 0)
(2.10603e-09 -2135.52 0)
(-6.05173e-07 -2135.52 0)
(-0.00165649 -2135.52 0)
(-0.530491 -2135.52 0)
(-27.3299 -2135.48 0)
(-336.477 -2133.72 0)
(-1500.78 -2115.66 0)
(-3415.82 -2051.9 0)
(-5035.69 -1936.41 0)
(-5799.87 -1787.72 0)
(-5964.33 -1623.09 0)
(-5850.37 -1452.07 0)
(-5482.81 -1281.36 0)
(-4189.8 -1112.94 0)
(-965.319 -999.264 0)
(78037.4 -787.451 0)
(-124973 -2447.92 0)
(122201 -7555 0)
(-76767.3 -2098.46 0)
(756.304 -2270.39 0)
(4003.56 -2425.31 0)
(5256 -2688.38 0)
(5622.35 -2962.93 0)
(5740.1 -3237.52 0)
(5588.85 -3506.63 0)
(4855.29 -3758.32 0)
(3291.37 -3963.49 0)
(1443.05 -4083.2 0)
(322.274 -4119 0)
(26.0153 -4122.67 0)
(0.500699 -4122.76 0)
(0.00154707 -4122.76 0)
(5.51001e-07 -4122.76 0)
(6.98111e-09 -4122.76 0)
(5.85009e-09 -4122.76 0)
(3.04205e-09 -4122.76 0)
(1.11152e-09 -4122.76 0)
(-6.2401e-10 -4122.76 0)
(-2.20354e-09 -4122.76 0)
(-3.82206e-09 -4122.76 0)
(-4.60207e-09 -4122.76 0)
(-5.50201e-07 -4122.76 0)
(-0.00154713 -4122.76 0)
(-0.500715 -4122.76 0)
(-26.0157 -4122.67 0)
(-322.272 -4119 0)
(-1443 -4083.22 0)
(-3291.16 -3963.65 0)
(-4854.81 -3758.89 0)
(-5588.1 -3507.73 0)
(-5738.94 -3238.8 0)
(-5620.54 -2963.75 0)
(-5253.97 -2688.47 0)
(-4002.13 -2423.89 0)
(-755.931 -2267.84 0)
(76765.2 -2095.2 0)
(-122208 -7534.88 0)
(115319 -13474 0)
(-72961.9 -3460.44 0)
(648.466 -3336.26 0)
(3784.9 -3479.81 0)
(4963.23 -3771.65 0)
(5320.7 -4088.06 0)
(5440.61 -4408.82 0)
(5298.94 -4728.27 0)
(4596.47 -5035.91 0)
(3103.33 -5297.89 0)
(1351.08 -5459.2 0)
(298.453 -5509.97 0)
(23.7039 -5515.39 0)
(0.446372 -5515.52 0)
(0.00134292 -5515.52 0)
(4.67169e-07 -5515.52 0)
(4.29007e-10 -5515.52 0)
(-6.2596e-09 -5515.52 0)
(-6.94211e-09 -5515.52 0)
(-5.26509e-09 -5515.52 0)
(-9.36015e-10 -5515.52 0)
(4.54357e-09 -5515.52 0)
(7.27362e-09 -5515.52 0)
(1.83303e-09 -5515.52 0)
(-4.65863e-07 -5515.52 0)
(-0.00134293 -5515.52 0)
(-0.446375 -5515.52 0)
(-23.7041 -5515.39 0)
(-298.454 -5509.97 0)
(-1351.08 -5459.2 0)
(-3103.29 -5297.94 0)
(-4596.36 -5036.14 0)
(-5298.69 -4728.82 0)
(-5440.13 -4409.79 0)
(-5320.05 -4089.73 0)
(-4962.58 -3774.4 0)
(-3784.47 -3483.48 0)
(-648.582 -3340.42 0)
(72961.9 -3464.58 0)
(-115322 -13475.9 0)
(105192 -17399.4 0)
(-66998.2 -4249.08 0)
(737.637 -3839.74 0)
(3584 -3962.79 0)
(4669.87 -4238.35 0)
(5008.36 -4556.44 0)
(5123.17 -4878.33 0)
(4984.56 -5208.32 0)
(4306.39 -5532.5 0)
(2883.47 -5818.04 0)
(1238.67 -6001.47 0)
(268.13 -6061.31 0)
(20.6715 -6067.8 0)
(0.374151 -6067.95 0)
(0.00107269 -6067.95 0)
(3.55715e-07 -6067.95 0)
(-1.21877e-09 -6067.95 0)
(-3.74406e-09 -6067.95 0)
(-2.70079e-09 -6067.95 0)
(-1.26752e-10 -6067.95 0)
(2.53504e-09 -6067.95 0)
(5.9671e-09 -6067.95 0)
(5.17733e-09 -6067.95 0)
(-9.45765e-10 -6067.95 0)
(-3.51045e-07 -6067.95 0)
(-0.00107268 -6067.95 0)
(-0.37415 -6067.95 0)
(-20.6715 -6067.8 0)
(-268.13 -6061.31 0)
(-1238.67 -6001.47 0)
(-2883.48 -5818.04 0)
(-4306.39 -5532.54 0)
(-4984.53 -5208.45 0)
(-5123.09 -4878.64 0)
(-5008.25 -4557.07 0)
(-4669.77 -4239.34 0)
(-3583.93 -3964.13 0)
(-737.71 -3841.2 0)
(66998.3 -4250.29 0)
(-105192 -17400.8 0)
(93513.6 -18330 0)
(-59895.4 -4423.77 0)
(924.339 -3942.74 0)
(3400.79 -4047.68 0)
(4391.17 -4315.17 0)
(4703.99 -4606.57 0)
(4812.43 -4920.9 0)
(4668.56 -5242.86 0)
(4008.93 -5567.31 0)
(2651.41 -5859.92 0)
(1116.65 -6052.87 0)
(234.543 -6116.53 0)
(17.2995 -6123.35 0)
(0.295215 -6123.51 0)
(0.000787891 -6123.51 0)
(2.34784e-07 -6123.51 0)
(-2.74954e-09 -6123.51 0)
(1.46252e-10 -6123.51 0)
(3.99756e-10 -6123.51 0)
(-1.99878e-09 -6123.51 0)
(4.58257e-10 -6123.51 0)
(8.87264e-10 -6123.51 0)
(2.06703e-09 -6123.51 0)
(1.55028e-09 -6123.51 0)
(-2.36841e-07 -6123.51 0)
(-0.000787884 -6123.51 0)
(-0.295214 -6123.51 0)
(-17.2995 -6123.35 0)
(-234.543 -6116.53 0)
(-1116.66 -6052.87 0)
(-2651.41 -5859.91 0)
(-4008.93 -5567.3 0)
(-4668.57 -5242.85 0)
(-4812.44 -4920.93 0)
(-4704.01 -4606.67 0)
(-4391.19 -4315.32 0)
(-3400.81 -4047.9 0)
(-924.337 -3942.97 0)
(59895.4 -4423.9 0)
(-93513.6 -18330.4 0)
(82225.9 -18583.8 0)
(-53134.1 -4241.62 0)
(1100.05 -3808.96 0)
(3225.11 -3929.34 0)
(4131.3 -4176.22 0)
(4424.66 -4472.31 0)
(4510.02 -4764.09 0)
(4361.66 -5078.07 0)
(3711.76 -5396.06 0)
(2415.56 -5688.61 0)
(991.393 -5883.11 0)
(200.212 -5946.32 0)
(13.9398 -5952.83 0)
(0.220325 -5952.98 0)
(0.000535654 -5952.98 0)
(1.44341e-07 -5952.98 0)
(-8.48264e-10 -5952.98 0)
(9.26265e-10 -5952.98 0)
(1.29677e-09 -5952.98 0)
(1.07252e-10 -5952.98 0)
(0 -5952.98 0)
(-5.07008e-10 -5952.98 0)
(1.38452e-09 -5952.98 0)
(2.69104e-09 -5952.98 0)
(-1.4321e-07 -5952.98 0)
(-0.000535646 -5952.98 0)
(-0.220325 -5952.98 0)
(-13.9398 -5952.83 0)
(-200.212 -5946.32 0)
(-991.393 -5883.1 0)
(-2415.57 -5688.61 0)
(-3711.77 -5396.06 0)
(-4361.66 -5078.06 0)
(-4510.04 -4764.08 0)
(-4424.67 -4472.28 0)
(-4131.32 -4176.19 0)
(-3225.12 -3929.3 0)
(-1100.04 -3808.91 0)
(53134.1 -4241.58 0)
(-82225.9 -18583.9 0)
(70441.9 -17190.3 0)
(-45657.8 -3813.07 0)
(1225.26 -3539.5 0)
(3046.88 -3667.72 0)
(3867.95 -3884.71 0)
(4137.5 -4161.91 0)
(4228.69 -4434.6 0)
(4059.56 -4723.24 0)
(3420.59 -5021.89 0)
(2182.08 -5305.75 0)
(868.318 -5497.68 0)
(167.349 -5558.67 0)
(10.8849 -5564.6 0)
(0.15724 -5564.72 0)
(0.000342746 -5564.72 0)
(8.30226e-08 -5564.72 0)
(-8.97015e-10 -5564.72 0)
(-8.97015e-10 -5564.72 0)
(2.34004e-10 -5564.72 0)
(8.09263e-10 -5564.72 0)
(-6.1426e-10 -5564.72 0)
(-1.07252e-09 -5564.72 0)
(2.14503e-10 -5564.72 0)
(8.77514e-10 -5564.72 0)
(-8.04778e-08 -5564.72 0)
(-0.000342744 -5564.72 0)
(-0.15724 -5564.72 0)
(-10.8849 -5564.6 0)
(-167.349 -5558.67 0)
(-868.318 -5497.68 0)
(-2182.08 -5305.75 0)
(-3420.59 -5021.89 0)
(-4059.56 -4723.24 0)
(-4228.69 -4434.59 0)
(-4137.5 -4161.89 0)
(-3867.95 -3884.69 0)
(-3046.88 -3667.69 0)
(-1225.26 -3539.47 0)
(45657.8 -3813.06 0)
(-70441.9 -17190.3 0)
(61119.3 -13858.6 0)
(-39979.7 -2907.74 0)
(1240.12 -2884.04 0)
(2892.45 -2906.28 0)
(3655.09 -3068.01 0)
(3894.76 -3258.48 0)
(3969.1 -3443.33 0)
(3795.73 -3636.1 0)
(3150.44 -3847.16 0)
(1957.07 -4065.12 0)
(747.665 -4223.45 0)
(135.73 -4274.97 0)
(8.11403 -4279.83 0)
(0.105177 -4279.93 0)
(0.000201605 -4279.93 0)
(4.58647e-08 -4279.93 0)
(-1.58928e-09 -4279.93 0)
(-3.12005e-10 -4279.93 0)
(7.31262e-10 -4279.93 0)
(-9.75016e-11 -4279.93 0)
(-5.07008e-10 -4279.93 0)
(-1.45277e-09 -4279.93 0)
(9.75016e-11 -4279.93 0)
(-3.60756e-10 -4279.93 0)
(-4.18184e-08 -4279.93 0)
(-0.000201599 -4279.93 0)
(-0.105177 -4279.93 0)
(-8.11403 -4279.83 0)
(-135.73 -4274.97 0)
(-747.665 -4223.45 0)
(-1957.07 -4065.12 0)
(-3150.44 -3847.16 0)
(-3795.73 -3636.1 0)
(-3969.1 -3443.33 0)
(-3894.76 -3258.48 0)
(-3655.09 -3068.01 0)
(-2892.45 -2906.28 0)
(-1240.12 -2884.04 0)
(39979.7 -2907.74 0)
(-61119.3 -13858.6 0)
(53376.7 -6713.03 0)
(-35082.3 -1369.2 0)
(1226.66 -1253.31 0)
(2869.6 -1255.56 0)
(3528.56 -1227.32 0)
(3775.83 -1066.92 0)
(3864.81 -853.708 0)
(3670.41 -657.981 0)
(3007.16 -611.169 0)
(1819.48 -773.894 0)
(666.105 -969.357 0)
(113.015 -1034.08 0)
(6.10582 -1039.41 0)
(0.069172 -1039.5 0)
(0.000112707 -1039.5 0)
(2.57307e-08 -1039.5 0)
(-1.08227e-09 -1039.5 0)
(0 -1039.5 0)
(-7.70262e-10 -1039.5 0)
(2.63254e-10 -1039.5 0)
(-3.31505e-10 -1039.5 0)
(-1.63803e-09 -1039.5 0)
(6.72761e-10 -1039.5 0)
(-7.60512e-10 -1039.5 0)
(-1.78233e-08 -1039.5 0)
(-0.000112704 -1039.5 0)
(-0.069172 -1039.5 0)
(-6.10582 -1039.41 0)
(-113.015 -1034.08 0)
(-666.105 -969.357 0)
(-1819.47 -773.894 0)
(-3007.16 -611.169 0)
(-3670.41 -657.981 0)
(-3864.81 -853.708 0)
(-3775.83 -1066.92 0)
(-3528.56 -1227.32 0)
(-2869.6 -1255.56 0)
(-1226.66 -1253.31 0)
(35082.3 -1369.2 0)
(-53376.7 -6713.03 0)
(50240.9 165216 0)
(-34718.5 37470.9 0)
(1349.63 37989.3 0)
(2917.5 43651.7 0)
(3836.87 49989.7 0)
(4254.79 58316.4 0)
(4363.17 65870.4 0)
(4029.45 73514.4 0)
(3038.74 79570 0)
(1611.91 82888.7 0)
(496.936 83722.8 0)
(68.221 83768.2 0)
(2.89983 83766.3 0)
(0.0257044 83766.2 0)
(3.30248e-05 83766.2 0)
(2.53504e-09 83766.2 0)
(1.73553e-09 83766.2 0)
(8.19013e-10 83766.2 0)
(3.41256e-10 83766.2 0)
(1.29677e-09 83766.2 0)
(-4.29007e-10 83766.2 0)
(-1.52102e-09 83766.2 0)
(-1.15052e-09 83766.2 0)
(8.77514e-10 83766.2 0)
(-3.65631e-09 83766.2 0)
(-3.3026e-05 83766.2 0)
(-0.0257044 83766.2 0)
(-2.89983 83766.3 0)
(-68.221 83768.2 0)
(-496.936 83722.8 0)
(-1611.91 82888.7 0)
(-3038.74 79570 0)
(-4029.45 73514.4 0)
(-4363.17 65870.4 0)
(-4254.79 58316.4 0)
(-3836.87 49989.7 0)
(-2917.5 43651.7 0)
(-1349.63 37989.3 0)
(34718.5 37470.9 0)
(-50240.9 165216 0)
(246158 -253992 0)
(-157683 -53483.1 0)
(7182.74 -56838.5 0)
(14433.7 -65573.6 0)
(17660 -75848.8 0)
(19079 -88819.2 0)
(18510.1 -101217 0)
(16871.9 -113650 0)
(12040.6 -123860 0)
(5821.23 -129944 0)
(1513.71 -131875 0)
(154.97 -132108 0)
(4.17607 -132115 0)
(0.019661 -132115 0)
(1.07043e-05 -132115 0)
(2.05923e-08 -132115 0)
(1.54052e-08 -132115 0)
(6.94211e-09 -132115 0)
(5.77209e-09 -132115 0)
(1.24802e-09 -132115 0)
(-6.63011e-10 -132115 0)
(-8.34613e-09 -132115 0)
(1.17002e-10 -132115 0)
(7.48812e-09 -132115 0)
(-1.31432e-08 -132115 0)
(-1.06969e-05 -132115 0)
(-0.0196611 -132115 0)
(-4.17607 -132115 0)
(-154.97 -132108 0)
(-1513.71 -131875 0)
(-5821.23 -129944 0)
(-12040.6 -123860 0)
(-16871.9 -113650 0)
(-18510.1 -101217 0)
(-19079 -88819.2 0)
(-17660 -75848.8 0)
(-14433.7 -65573.6 0)
(-7182.74 -56838.5 0)
(157683 -53483.1 0)
(-246158 -253992 0)
(246158 253992 0)
(-157683 53483.1 0)
(7182.74 56838.5 0)
(14433.7 65573.6 0)
(17660 75848.8 0)
(19079 88819.2 0)
(18510.1 101217 0)
(16871.9 113650 0)
(12040.6 123860 0)
(5821.23 129944 0)
(1513.71 131875 0)
(154.97 132108 0)
(4.17607 132115 0)
(0.0196611 132115 0)
(1.07003e-05 132115 0)
(1.11152e-08 132115 0)
(-1.68483e-08 132115 0)
(-1.32992e-08 132115 0)
(-1.29092e-08 132115 0)
(-6.1621e-09 132115 0)
(-3.15905e-09 132115 0)
(-3.23705e-09 132115 0)
(1.79403e-09 132115 0)
(7.80013e-11 132115 0)
(3.78306e-09 132115 0)
(-1.06999e-05 132115 0)
(-0.019661 132115 0)
(-4.17607 132115 0)
(-154.97 132108 0)
(-1513.71 131875 0)
(-5821.23 129944 0)
(-12040.6 123860 0)
(-16871.9 113650 0)
(-18510.1 101217 0)
(-19079 88819.2 0)
(-17660 75848.8 0)
(-14433.7 65573.6 0)
(-7182.74 56838.5 0)
(157683 53483.1 0)
(-246158 253992 0)
(50240.9 -165216 0)
(-34718.5 -37470.9 0)
(1349.63 -37989.3 0)
(2917.5 -43651.7 0)
(3836.87 -49989.7 0)
(4254.79 -58316.4 0)
(4363.17 -65870.4 0)
(4029.45 -73514.4 0)
(3038.74 -79570 0)
(1611.91 -82888.7 0)
(496.936 -83722.8 0)
(68.221 -83768.2 0)
(2.89983 -83766.3 0)
(0.0257044 -83766.2 0)
(3.30215e-05 -83766.2 0)
(5.26509e-10 -83766.2 0)
(3.99756e-10 -83766.2 0)
(1.89153e-09 -83766.2 0)
(1.26752e-10 -83766.2 0)
(8.58014e-10 -83766.2 0)
(-9.84766e-10 -83766.2 0)
(-2.44729e-09 -83766.2 0)
(-3.31505e-10 -83766.2 0)
(1.07252e-09 -83766.2 0)
(-2.24254e-09 -83766.2 0)
(-3.30274e-05 -83766.2 0)
(-0.0257044 -83766.2 0)
(-2.89983 -83766.3 0)
(-68.221 -83768.2 0)
(-496.936 -83722.8 0)
(-1611.91 -82888.7 0)
(-3038.74 -79570 0)
(-4029.45 -73514.4 0)
(-4363.17 -65870.4 0)
(-4254.79 -58316.4 0)
(-3836.87 -49989.7 0)
(-2917.5 -43651.7 0)
(-1349.63 -37989.3 0)
(34718.5 -37470.9 0)
(-50240.9 -165216 0)
(53376.7 6713.03 0)
(-35082.3 1369.2 0)
(1226.66 1253.31 0)
(2869.6 1255.56 0)
(3528.56 1227.32 0)
(3775.83 1066.92 0)
(3864.81 853.708 0)
(3670.41 657.981 0)
(3007.16 611.169 0)
(1819.48 773.894 0)
(666.105 969.357 0)
(113.015 1034.08 0)
(6.10582 1039.41 0)
(0.069172 1039.5 0)
(0.000112701 1039.5 0)
(2.17136e-08 1039.5 0)
(-2.63254e-09 1039.5 0)
(4.97258e-10 1039.5 0)
(-1.41377e-09 1039.5 0)
(-2.92505e-10 1039.5 0)
(0 1039.5 0)
(-4.97258e-10 1039.5 0)
(2.27179e-09 1039.5 0)
(-9.94516e-10 1039.5 0)
(-2.04851e-08 1039.5 0)
(-0.000112702 1039.5 0)
(-0.069172 1039.5 0)
(-6.10582 1039.41 0)
(-113.015 1034.08 0)
(-666.105 969.357 0)
(-1819.47 773.894 0)
(-3007.16 611.169 0)
(-3670.41 657.981 0)
(-3864.81 853.708 0)
(-3775.83 1066.92 0)
(-3528.56 1227.32 0)
(-2869.6 1255.56 0)
(-1226.66 1253.31 0)
(35082.3 1369.2 0)
(-53376.7 6713.03 0)
(61119.3 13858.6 0)
(-39979.7 2907.74 0)
(1240.12 2884.04 0)
(2892.45 2906.28 0)
(3655.09 3068.01 0)
(3894.76 3258.48 0)
(3969.1 3443.33 0)
(3795.73 3636.1 0)
(3150.44 3847.16 0)
(1957.07 4065.12 0)
(747.665 4223.45 0)
(135.73 4274.97 0)
(8.11403 4279.83 0)
(0.105177 4279.93 0)
(0.000201598 4279.93 0)
(4.4646e-08 4279.93 0)
(-2.51554e-09 4279.93 0)
(-5.26509e-10 4279.93 0)
(-6.92261e-10 4279.93 0)
(1.75503e-10 4279.93 0)
(-1.17002e-10 4279.93 0)
(-1.06277e-09 4279.93 0)
(1.40402e-09 4279.93 0)
(-1.46252e-10 4279.93 0)
(-4.06192e-08 4279.93 0)
(-0.000201602 4279.93 0)
(-0.105177 4279.93 0)
(-8.11403 4279.83 0)
(-135.73 4274.97 0)
(-747.665 4223.45 0)
(-1957.07 4065.12 0)
(-3150.44 3847.16 0)
(-3795.73 3636.1 0)
(-3969.1 3443.33 0)
(-3894.76 3258.48 0)
(-3655.09 3068.01 0)
(-2892.45 2906.28 0)
(-1240.12 2884.04 0)
(39979.7 2907.74 0)
(-61119.3 13858.6 0)
(70441.9 17190.3 0)
(-45657.8 3813.07 0)
(1225.26 3539.5 0)
(3046.88 3667.72 0)
(3867.95 3884.71 0)
(4137.5 4161.91 0)
(4228.69 4434.6 0)
(4059.56 4723.24 0)
(3420.59 5021.89 0)
(2182.08 5305.75 0)
(868.318 5497.68 0)
(167.349 5558.67 0)
(10.8849 5564.6 0)
(0.15724 5564.72 0)
(0.000342741 5564.72 0)
(8.35199e-08 5564.72 0)
(-2.51554e-09 5564.72 0)
(-1.92078e-09 5564.72 0)
(-8.77514e-11 5564.72 0)
(5.65509e-10 5564.72 0)
(7.80013e-11 5564.72 0)
(5.46009e-10 5564.72 0)
(-3.99756e-10 5564.72 0)
(4.29007e-10 5564.72 0)
(-8.20866e-08 5564.72 0)
(-0.000342744 5564.72 0)
(-0.15724 5564.72 0)
(-10.8849 5564.6 0)
(-167.349 5558.67 0)
(-868.318 5497.68 0)
(-2182.08 5305.75 0)
(-3420.59 5021.89 0)
(-4059.56 4723.24 0)
(-4228.69 4434.59 0)
(-4137.5 4161.89 0)
(-3867.95 3884.69 0)
(-3046.88 3667.69 0)
(-1225.26 3539.47 0)
(45657.8 3813.06 0)
(-70441.9 17190.3 0)
(82225.9 18583.8 0)
(-53134.1 4241.62 0)
(1100.05 3808.96 0)
(3225.11 3929.34 0)
(4131.3 4176.22 0)
(4424.66 4472.31 0)
(4510.02 4764.09 0)
(4361.66 5078.07 0)
(3711.76 5396.06 0)
(2415.56 5688.61 0)
(991.393 5883.11 0)
(200.212 5946.32 0)
(13.9398 5952.83 0)
(0.220325 5952.98 0)
(0.000535647 5952.98 0)
(1.47188e-07 5952.98 0)
(-1.65753e-10 5952.98 0)
(3.70506e-10 5952.98 0)
(1.42352e-09 5952.98 0)
(9.55515e-10 5952.98 0)
(-6.72761e-10 5952.98 0)
(-1.61853e-09 5952.98 0)
(-2.34004e-10 5952.98 0)
(1.17002e-09 5952.98 0)
(-1.47578e-07 5952.98 0)
(-0.000535649 5952.98 0)
(-0.220325 5952.98 0)
(-13.9398 5952.83 0)
(-200.212 5946.32 0)
(-991.393 5883.1 0)
(-2415.57 5688.61 0)
(-3711.77 5396.06 0)
(-4361.66 5078.06 0)
(-4510.04 4764.08 0)
(-4424.67 4472.28 0)
(-4131.32 4176.19 0)
(-3225.12 3929.3 0)
(-1100.04 3808.91 0)
(53134.1 4241.58 0)
(-82225.9 18583.9 0)
(93513.6 18330 0)
(-59895.4 4423.77 0)
(924.339 3942.74 0)
(3400.79 4047.68 0)
(4391.17 4315.17 0)
(4703.99 4606.57 0)
(4812.43 4920.9 0)
(4668.56 5242.86 0)
(4008.93 5567.31 0)
(2651.41 5859.92 0)
(1116.65 6052.87 0)
(234.543 6116.53 0)
(17.2995 6123.35 0)
(0.295215 6123.51 0)
(0.000787884 6123.51 0)
(2.37104e-07 6123.51 0)
(2.63254e-10 6123.51 0)
(6.63011e-10 6123.51 0)
(6.82511e-11 6123.51 0)
(-6.82511e-11 6123.51 0)
(-1.12127e-09 6123.51 0)
(-1.90128e-09 6123.51 0)
(9.26265e-10 6123.51 0)
(1.80378e-09 6123.51 0)
(-2.36714e-07 6123.51 0)
(-0.000787894 6123.51 0)
(-0.295214 6123.51 0)
(-17.2995 6123.35 0)
(-234.543 6116.53 0)
(-1116.66 6052.87 0)
(-2651.41 5859.91 0)
(-4008.93 5567.3 0)
(-4668.57 5242.85 0)
(-4812.44 4920.93 0)
(-4704.01 4606.67 0)
(-4391.19 4315.32 0)
(-3400.81 4047.9 0)
(-924.337 3942.97 0)
(59895.4 4423.9 0)
(-93513.6 18330.4 0)
(105192 17399.4 0)
(-66998.2 4249.08 0)
(737.637 3839.74 0)
(3584 3962.79 0)
(4669.87 4238.35 0)
(5008.36 4556.44 0)
(5123.17 4878.33 0)
(4984.56 5208.32 0)
(4306.39 5532.5 0)
(2883.47 5818.04 0)
(1238.67 6001.47 0)
(268.13 6061.31 0)
(20.6715 6067.8 0)
(0.374151 6067.95 0)
(0.00107268 6067.95 0)
(3.56359e-07 6067.95 0)
(2.59354e-09 6067.95 0)
(-1.03352e-09 6067.95 0)
(-2.22304e-09 6067.95 0)
(5.16758e-10 6067.95 0)
(-1.56003e-10 6067.95 0)
(-1.85253e-10 6067.95 0)
(1.26752e-10 6067.95 0)
(-2.07678e-09 6067.95 0)
(-3.51903e-07 6067.95 0)
(-0.00107269 6067.95 0)
(-0.37415 6067.95 0)
(-20.6715 6067.8 0)
(-268.13 6061.31 0)
(-1238.67 6001.47 0)
(-2883.48 5818.04 0)
(-4306.39 5532.54 0)
(-4984.53 5208.45 0)
(-5123.09 4878.64 0)
(-5008.25 4557.07 0)
(-4669.77 4239.34 0)
(-3583.93 3964.13 0)
(-737.71 3841.2 0)
(66998.3 4250.29 0)
(-105192 17400.8 0)
(115319 13474 0)
(-72961.9 3460.44 0)
(648.466 3336.26 0)
(3784.9 3479.81 0)
(4963.23 3771.65 0)
(5320.7 4088.06 0)
(5440.61 4408.82 0)
(5298.94 4728.27 0)
(4596.47 5035.91 0)
(3103.33 5297.89 0)
(1351.08 5459.2 0)
(298.453 5509.97 0)
(23.7039 5515.39 0)
(0.446372 5515.52 0)
(0.00134291 5515.52 0)
(4.68027e-07 5515.52 0)
(4.48507e-10 5515.52 0)
(1.34552e-09 5515.52 0)
(-1.22852e-09 5515.52 0)
(-1.98903e-09 5515.52 0)
(-1.34552e-09 5515.52 0)
(-2.34004e-10 5515.52 0)
(4.03657e-09 5515.52 0)
(1.17002e-10 5515.52 0)
(-4.64264e-07 5515.52 0)
(-0.00134293 5515.52 0)
(-0.446375 5515.52 0)
(-23.7041 5515.39 0)
(-298.454 5509.97 0)
(-1351.08 5459.2 0)
(-3103.29 5297.94 0)
(-4596.36 5036.14 0)
(-5298.69 4728.82 0)
(-5440.13 4409.79 0)
(-5320.05 4089.73 0)
(-4962.58 3774.4 0)
(-3784.47 3483.48 0)
(-648.582 3340.42 0)
(72961.9 3464.58 0)
(-115322 13475.9 0)
(122201 7555 0)
(-76767.3 2098.46 0)
(756.304 2270.39 0)
(4003.56 2425.31 0)
(5256 2688.38 0)
(5622.35 2962.93 0)
(5740.1 3237.52 0)
(5588.85 3506.63 0)
(4855.29 3758.32 0)
(3291.37 3963.49 0)
(1443.05 4083.2 0)
(322.274 4119 0)
(26.0153 4122.67 0)
(0.5007 4122.76 0)
(0.00154705 4122.76 0)
(5.51742e-07 4122.76 0)
(-3.35405e-09 4122.76 0)
(-8.58014e-10 4122.76 0)
(2.00853e-09 4122.76 0)
(2.71054e-09 4122.76 0)
(1.11152e-09 4122.76 0)
(-4.68008e-10 4122.76 0)
(1.20902e-09 4122.76 0)
(1.42352e-09 4122.76 0)
(-5.48797e-07 4122.76 0)
(-0.00154714 4122.76 0)
(-0.500715 4122.76 0)
(-26.0157 4122.67 0)
(-322.272 4119 0)
(-1443 4083.22 0)
(-3291.16 3963.65 0)
(-4854.81 3758.89 0)
(-5588.1 3507.73 0)
(-5738.94 3238.8 0)
(-5620.54 2963.75 0)
(-5253.97 2688.47 0)
(-4002.13 2423.89 0)
(-755.931 2267.84 0)
(76765.2 2095.2 0)
(-122208 7534.88 0)
(124994 2525.61 0)
(-78054.4 806.223 0)
(963.429 1014.16 0)
(4187.69 1127.57 0)
(5481.3 1294.66 0)
(5849.87 1460.52 0)
(5964.53 1627.27 0)
(5800.8 1789.53 0)
(5036.72 1936.93 0)
(3416.4 2051.91 0)
(1500.94 2115.62 0)
(336.496 2133.71 0)
(27.33 2135.48 0)
(0.530463 2135.52 0)
(0.00165631 2135.52 0)
(6.0139e-07 2135.52 0)
(2.78855e-09 2135.52 0)
(-5.57709e-09 2135.52 0)
(-9.59416e-09 2135.52 0)
(-6.4936e-09 2135.52 0)
(9.75016e-10 2135.52 0)
(7.13712e-09 2135.52 0)
(9.34065e-09 2135.52 0)
(4.48507e-10 2135.52 0)
(-6.11374e-07 2135.52 0)
(-0.0016565 2135.52 0)
(-0.530491 2135.52 0)
(-27.3299 2135.48 0)
(-336.477 2133.72 0)
(-1500.78 2115.66 0)
(-3415.82 2051.9 0)
(-5035.69 1936.41 0)
(-5799.87 1787.72 0)
(-5964.33 1623.09 0)
(-5850.37 1452.07 0)
(-5482.81 1281.36 0)
(-4189.8 1112.94 0)
(-965.319 999.264 0)
(78037.4 787.451 0)
(-124973 2447.92 0)
(125535 967.577 0)
(-78223.7 280.857 0)
(1065.97 303.126 0)
(4273.86 324.54 0)
(5576.84 358.052 0)
(5942.87 402.652 0)
(6057.15 454.66 0)
(5887.24 507.753 0)
(5108.13 556.072 0)
(3463.57 592.482 0)
(1521.87 611.756 0)
(341.417 617.007 0)
(27.7631 617.501 0)
(0.539822 617.512 0)
(0.00168931 617.512 0)
(6.24927e-07 617.512 0)
(-6.72761e-09 617.512 0)
(2.22304e-09 617.512 0)
(1.16807e-08 617.512 0)
(8.98965e-09 617.512 0)
(-2.00853e-09 617.512 0)
(-1.03937e-08 617.512 0)
(-9.16515e-09 617.512 0)
(-1.61853e-09 617.512 0)
(-5.93024e-07 617.512 0)
(-0.00168923 617.512 0)
(-0.539759 617.512 0)
(-27.759 617.502 0)
(-341.374 617.009 0)
(-1521.84 611.724 0)
(-3463.89 591.999 0)
(-5109.38 554.256 0)
(-5890.03 503.355 0)
(-6062.39 445.377 0)
(-5949.84 384.93 0)
(-5580.76 325.763 0)
(-4273.97 267.928 0)
(-1069.59 225.396 0)
(78161.2 145.208 0)
(-125444 350.657 0)
(126248 1820.39 0)
(-78694.6 460.914 0)
(1005.52 355.397 0)
(4240.62 278.533 0)
(5556.57 201.014 0)
(5942.96 142.189 0)
(6065.81 103.359 0)
(5898.52 81.7491 0)
(5118.36 73.024 0)
(3470.05 71.8278 0)
(1524.57 72.9739 0)
(342.032 73.5122 0)
(27.817 73.5761 0)
(0.541069 73.5778 0)
(0.00169399 73.5778 0)
(6.049e-07 73.5778 0)
(1.73553e-09 73.5778 0)
(-1.06667e-08 73.5778 0)
(-1.00037e-08 73.5778 0)
(-2.90555e-09 73.5778 0)
(3.86106e-09 73.5778 0)
(1.18367e-08 73.5778 0)
(1.24997e-08 73.5778 0)
(-2.45704e-09 73.5778 0)
(-6.28437e-07 73.5778 0)
(-0.00169315 73.5778 0)
(-0.540907 73.5778 0)
(-27.8148 73.5766 0)
(-342.045 73.5178 0)
(-1524.88 72.854 0)
(-3471.2 70.2374 0)
(-5121.11 64.9612 0)
(-5904.79 57.5607 0)
(-6078.45 49.0024 0)
(-5965.64 40.2128 0)
(-5595.56 31.9747 0)
(-4286.52 24.3121 0)
(-1083.58 18.5186 0)
(78158.1 9.38951 0)
(-125468 15.0856 0)
(127829 2730.25 0)
(-79635.5 735.589 0)
(890.217 746.448 0)
(4125.09 583.658 0)
(5445.45 426.016 0)
(5848.77 281.231 0)
(5998.91 165.833 0)
(5858.01 85.1096 0)
(5098.57 35.5413 0)
(3463.52 11.2869 0)
(1523.49 3.54971 0)
(341.997 2.44766 0)
(27.8263 2.41808 0)
(0.541429 2.41857 0)
(0.00169558 2.41857 0)
(6.25161e-07 2.41857 0)
(-1.89153e-09 2.41857 0)
(-2.28154e-09 2.41857 0)
(-6.82511e-10 2.41857 0)
(-3.12005e-10 2.41857 0)
(-4.48507e-10 2.41857 0)
(-1.15052e-09 2.41857 0)
(6.63011e-10 2.41857 0)
(1.65753e-09 2.41857 0)
(-6.05602e-07 2.41857 0)
(-0.00169327 2.41857 0)
(-0.540946 2.41857 0)
(-27.8167 2.41853 0)
(-342.07 2.41652 0)
(-1525 2.3927 0)
(-3471.49 2.29391 0)
(-5121.6 2.08567 0)
(-5905.41 1.78631 0)
(-6079.1 1.44193 0)
(-5966.25 1.10173 0)
(-5596.08 0.80433 0)
(-4286.94 0.551065 0)
(-1083.97 0.366353 0)
(78157.9 0.143705 0)
(-125468 0.128233 0)
(129706 2472.66 0)
(-80606.3 697.946 0)
(859.117 1108.37 0)
(3931.84 889.604 0)
(5265.14 666.942 0)
(5692.24 467.361 0)
(5876.82 298.529 0)
(5772.97 168.759 0)
(5047.23 78.8932 0)
(3439.23 26.193 0)
(1516.05 4.614 0)
(340.942 0.29678 0)
(27.7889 0.0185422 0)
(0.541543 0.0145668 0)
(0.00169796 0.0145591 0)
(6.16346e-07 0.0145591 0)
(4.56307e-09 0.0145591 0)
(-4.34857e-09 0.0145591 0)
(-2.45704e-09 0.0145591 0)
(-5.07008e-10 0.0145591 0)
(7.02011e-10 0.0145591 0)
(4.25107e-09 0.0145591 0)
(-2.10603e-09 0.0145591 0)
(-1.38452e-09 0.0145591 0)
(-6.12739e-07 0.0145591 0)
(-0.00169327 0.0145591 0)
(-0.540946 0.0145591 0)
(-27.8168 0.0145588 0)
(-342.07 0.0145459 0)
(-1525 0.0143858 0)
(-3471.5 0.0136927 0)
(-5121.6 0.0121848 0)
(-5905.41 0.0100017 0)
(-6079.11 0.00755454 0)
(-5966.25 0.00527953 0)
(-5596.09 0.00346545 0)
(-4286.94 0.00209179 0)
(-1083.97 0.00117637 0)
(78157.9 0.000357512 0)
(-125468 0.000141496 0)
(130941 1397.01 0)
(-80950.1 480.28 0)
(1074.91 1324.62 0)
(3699.71 1134.64 0)
(5038.56 852.463 0)
(5493.75 614.78 0)
(5711.16 416.514 0)
(5646.36 254.243 0)
(4961.19 131.411 0)
(3391.94 49.8092 0)
(1498.54 10.5778 0)
(337.569 0.852643 0)
(27.5543 0.0168854 0)
(0.537591 6.59086e-05 0)
(0.00168811 1.12628e-05 0)
(6.08351e-07 1.12412e-05 0)
(0 1.12363e-05 0)
(3.90006e-11 1.12365e-05 0)
(0 1.12408e-05 0)
(0 1.1239e-05 0)
(0 1.12413e-05 0)
(0 1.12383e-05 0)
(0 1.12369e-05 0)
(-3.90006e-11 1.12405e-05 0)
(-6.07747e-07 1.12383e-05 0)
(-0.00169328 1.12434e-05 0)
(-0.540946 1.12451e-05 0)
(-27.8168 1.12294e-05 0)
(-342.07 1.12483e-05 0)
(-1525 1.1082e-05 0)
(-3471.5 1.0469e-05 0)
(-5121.6 9.07929e-06 0)
(-5905.41 7.09511e-06 0)
(-6079.11 4.95678e-06 0)
(-5966.25 3.12289e-06 0)
(-5596.09 1.81069e-06 0)
(-4286.94 9.45463e-07 0)
(-1083.97 4.36398e-07 0)
(78157.9 1.05526e-07 0)
(-125468 7.80013e-09 0)
(131489 -2538.09 0)
(-80676.1 368.532 0)
(1489.68 1436.53 0)
(3476.85 1340.83 0)
(4764.18 988.198 0)
(5272.14 689.291 0)
(5529.4 480.957 0)
(5498.23 309.166 0)
(4850.23 172.773 0)
(3322.79 72.323 0)
(1468.88 17.2815 0)
(330.765 1.58129 0)
(26.9674 0.0352272 0)
(0.525282 0.000127578 0)
(0.00164528 5.23583e-08 0)
(5.90762e-07 0 0)
(0 3.90006e-11 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-6.0995e-07 3.90006e-11 0)
(-0.00169327 -6.2401e-10 0)
(-0.540946 1.01792e-08 0)
(-27.8168 -2.28154e-09 0)
(-342.07 1.09202e-08 0)
(-1525 -2.53504e-09 0)
(-3471.5 8.46314e-09 0)
(-5121.6 -7.80013e-11 0)
(-5905.41 3.62706e-09 0)
(-6079.11 2.92505e-11 0)
(-5966.25 -1.56978e-09 0)
(-5596.09 -1.19927e-09 0)
(-4286.94 1.17977e-09 0)
(-1083.97 9.06765e-10 0)
(78157.9 3.88056e-09 0)
(-125468 3.90006e-10 0)
(128669 -13996.4 0)
(-77120 480.523 0)
(2011.85 1703.09 0)
(3267.68 1540.02 0)
(4410.72 1072.29 0)
(5004.95 679.538 0)
(5344.86 476.066 0)
(5349.38 313.859 0)
(4732.96 186.522 0)
(3242.1 84.1429 0)
(1430.37 21.6444 0)
(320.95 2.10615 0)
(26.0307 0.0492019 0)
(0.503645 0.000182679 0)
(0.00156517 7.56807e-08 0)
(5.57963e-07 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-6.08351e-07 0 0)
(-0.00169327 1.98903e-09 0)
(-0.540946 -2.69104e-09 0)
(-27.8168 -2.69104e-09 0)
(-342.07 -2.61304e-09 0)
(-1525 -2.20354e-09 0)
(-3471.5 -6.2401e-10 0)
(-5121.6 -3.37355e-09 0)
(-5905.41 -7.41012e-10 0)
(-6079.11 -2.32054e-09 0)
(-5966.25 -4.00731e-09 0)
(-5596.09 -2.82755e-09 0)
(-4286.94 -1.17977e-09 0)
(-1083.97 1.95003e-11 0)
(78157.9 9.75016e-12 0)
(-125468 8.34613e-09 0)
(118188 -31830.1 0)
(-65547.4 2468.94 0)
(2510.65 2621.52 0)
(2868.99 1867.42 0)
(3935 1148.49 0)
(4697.6 613.131 0)
(5177.01 383.516 0)
(5219.22 251.832 0)
(4628.86 161.369 0)
(3163.9 79.1453 0)
(1389.82 21.7104 0)
(309.955 2.18946 0)
(24.938 0.0516638 0)
(0.47787 0.000190042 0)
(0.00146924 7.80793e-08 0)
(5.17831e-07 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(-6.0802e-07 0 0)
(-0.00169327 1.38452e-09 0)
(-0.540946 -5.81109e-09 0)
(-27.8168 4.01706e-09 0)
(-342.07 -9.43815e-09 0)
(-1525 3.99756e-09 0)
(-3471.5 -8.58014e-10 0)
(-5121.6 1.56003e-10 0)
(-5905.41 -1.05302e-09 0)
(-6079.11 -4.89458e-09 0)
(-5966.25 -2.41804e-09 0)
(-5596.09 -9.26265e-10 0)
(-4286.94 -1.56003e-10 0)
(-1083.97 -4.38757e-10 0)
(78157.9 -4.09507e-10 0)
(-125468 2.49604e-09 0)
(101995 -58206.7 0)
(-43921.2 3687.08 0)
(1432.2 3030.73 0)
(1848.21 1861.07 0)
(3202.04 989.462 0)
(4267.8 425.991 0)
(4996.7 203.196 0)
(5135.31 140.319 0)
(4566.55 108.591 0)
(3107.52 61.5151 0)
(1356.21 18.391 0)
(300.079 1.92787 0)
(23.921 0.0457601 0)
(0.45386 0.00016548 0)
(0.00138204 6.87191e-08 0)
(4.82691e-07 0 0)
(0 0 0)
(0 0 0)
(0 1.95003e-11 0)
(0 0 0)
(0 1.95003e-11 0)
(0 0 0)
(0 0 0)
(0 1.95003e-11 0)
(-6.07025e-07 0 0)
(-0.00169327 2.20354e-09 0)
(-0.540946 -6.63011e-10 0)
(-27.8168 -2.16453e-09 0)
(-342.07 -3.41256e-09 0)
(-1525 7.58562e-09 0)
(-3471.5 -2.24254e-09 0)
(-5121.6 -5.85009e-10 0)
(-5905.41 -1.57953e-09 0)
(-6079.11 -3.59781e-09 0)
(-5966.25 7.89763e-10 0)
(-5596.09 -1.00427e-09 0)
(-4286.94 -3.51006e-10 0)
(-1083.97 -1.15052e-09 0)
(78157.9 -1.84278e-09 0)
(-125468 -3.90006e-09 0)
)
;
boundaryField
{
inlet
{
type extrapolatedCalculated;
value nonuniform List<vector> 5((-0.0472417 2.52116e-05 0) (-0.0471408 4.31439e-05 0) (-0.0470691 3.92575e-09 0) (-0.0471408 -4.31337e-05 0) (-0.0472416 -2.52053e-05 0));
}
outlet
{
type extrapolatedCalculated;
value nonuniform List<vector>
165
(
(293670 58206.7 0)
(370284 31830.1 0)
(413121 13996.4 0)
(424786 2538.09 0)
(423265 -1397.01 0)
(419453 -2472.66 0)
(413622 -2730.25 0)
(408693 -1820.39 0)
(406413 -967.577 0)
(404862 -2525.61 0)
(396433 -7555 0)
(374996 -13474 0)
(343115 -17399.4 0)
(306040 -18330 0)
(270382 -18583.8 0)
(232256 -17190.3 0)
(202387 -13858.6 0)
(177020 -6713.03 0)
(170331 165216 0)
(808783 -253992 0)
(246158 -839303 0)
(-157683 -182363 0)
(7182.74 -189788 0)
(14433.7 -218650 0)
(17660 -251710 0)
(19079 -293831 0)
(18510.1 -333213 0)
(16871.9 -372854 0)
(12040.6 -405155 0)
(5821.23 -424125 0)
(1513.71 -429921 0)
(154.97 -430563 0)
(4.17607 -430580 0)
(0.019661 -430580 0)
(1.07043e-05 -430580 0)
(2.05923e-08 -430580 0)
(1.54052e-08 -430580 0)
(6.94211e-09 -430580 0)
(5.77209e-09 -430580 0)
(1.24802e-09 -430580 0)
(-6.63011e-10 -430580 0)
(-8.34613e-09 -430580 0)
(1.17002e-10 -430580 0)
(7.48812e-09 -430580 0)
(-1.31432e-08 -430580 0)
(-1.06969e-05 -430580 0)
(-0.0196611 -430580 0)
(-4.17607 -430580 0)
(-154.97 -430563 0)
(-1513.71 -429921 0)
(-5821.23 -424125 0)
(-12040.6 -405155 0)
(-16871.9 -372854 0)
(-18510.1 -333213 0)
(-19079 -293831 0)
(-17660 -251710 0)
(-14433.7 -218650 0)
(-7182.74 -189788 0)
(157683 -182363 0)
(-246158 -839303 0)
(-406174 3.23705e-09 0)
(-406174 -6.4351e-09 0)
(-406174 -1.41182e-08 0)
(-406174 -4.68008e-10 0)
(-406174 -1.15832e-08 0)
(-406174 -0.000141496 0)
(-406174 -0.128233 0)
(-406173 -15.0856 0)
(-406114 -350.657 0)
(-404788 -2447.92 0)
(-396442 -7534.88 0)
(-375001 -13475.9 0)
(-343116 -17400.8 0)
(-306040 -18330.4 0)
(-270382 -18583.9 0)
(-232256 -17190.3 0)
(-202387 -13858.6 0)
(-177020 -6713.03 0)
(-170331 165216 0)
(-808783 -253992 0)
(-406174 -2.2479e-08 0)
(-406174 1.55028e-09 0)
(-406174 3.10055e-08 0)
(-406174 1.98952e-08 0)
(-406174 1.12395e-08 0)
(-808783 253992 0)
(-170331 -165216 0)
(-177020 6713.03 0)
(-202387 13858.6 0)
(-232256 17190.3 0)
(-270382 18583.9 0)
(-306040 18330.4 0)
(-343116 17400.8 0)
(-375001 13475.9 0)
(-396442 7534.88 0)
(-404788 2447.92 0)
(-406114 350.657 0)
(-406173 15.0856 0)
(-406174 0.128233 0)
(-406174 0.000141496 0)
(-406174 7.80013e-09 0)
(-406174 3.90006e-10 0)
(-406174 8.34613e-09 0)
(-406174 2.49604e-09 0)
(-406174 -3.90006e-09 0)
(246158 839303 0)
(-157683 182363 0)
(7182.74 189788 0)
(14433.7 218650 0)
(17660 251710 0)
(19079 293831 0)
(18510.1 333213 0)
(16871.9 372854 0)
(12040.6 405155 0)
(5821.23 424125 0)
(1513.71 429921 0)
(154.97 430563 0)
(4.17607 430580 0)
(0.0196611 430580 0)
(1.07003e-05 430580 0)
(1.11152e-08 430580 0)
(-1.68483e-08 430580 0)
(-1.32992e-08 430580 0)
(-1.29092e-08 430580 0)
(-6.1621e-09 430580 0)
(-3.15905e-09 430580 0)
(-3.23705e-09 430580 0)
(1.79403e-09 430580 0)
(7.80013e-11 430580 0)
(3.78306e-09 430580 0)
(-1.06999e-05 430580 0)
(-0.019661 430580 0)
(-4.17607 430580 0)
(-154.97 430563 0)
(-1513.71 429921 0)
(-5821.23 424125 0)
(-12040.6 405155 0)
(-16871.9 372854 0)
(-18510.1 333213 0)
(-19079 293831 0)
(-17660 251710 0)
(-14433.7 218650 0)
(-7182.74 189788 0)
(157683 182363 0)
(-246158 839303 0)
(808783 253992 0)
(170331 -165216 0)
(177020 6713.03 0)
(202387 13858.6 0)
(232256 17190.3 0)
(270382 18583.8 0)
(306040 18330 0)
(343115 17399.4 0)
(374996 13474 0)
(396433 7555 0)
(404862 2525.61 0)
(406413 967.577 0)
(408693 1820.39 0)
(413622 2730.25 0)
(419453 2472.66 0)
(423265 1397.01 0)
(424786 -2538.09 0)
(413121 -13996.4 0)
(370284 -31830.1 0)
(293670 -58206.7 0)
)
;
}
obstacle
{
type extrapolatedCalculated;
value nonuniform List<vector>
40
(
(-0.0266549 0 0)
(-0.00413501 0 0)
(0.296168 0 0)
(18.0708 -3.63798e-11 0)
(235.165 0 0)
(997.798 0 0)
(1917.62 0 0)
(1890.74 0 0)
(1451.82 0 0)
(366.182 0 0)
(-0.026655 0 0)
(-0.00413501 0 0)
(0.296168 3.63798e-11 0)
(18.0708 0 0)
(235.165 0 0)
(997.798 0 0)
(1917.62 0 0)
(1890.74 0 0)
(1451.82 0 0)
(366.182 0 0)
(-30.5286 -20.3524 1.44397e-11)
(154.942 103.295 -1.75039e-11)
(-566.585 -377.723 -2.2129e-11)
(-3350.68 -2233.78 0)
(2545.26 1696.84 -9.1327e-11)
(-30.5286 20.3524 -4.33118e-11)
(154.942 -103.295 -1.75039e-11)
(-566.585 377.723 -2.2129e-11)
(-3350.68 2233.78 -6.04339e-11)
(2545.26 -1696.84 9.1327e-11)
(8727.18 969.686 2.1183e-11)
(1104.62 122.735 3.69639e-15)
(2293.37 254.818 0)
(4176.55 464.061 -1.3976e-14)
(-718.256 -79.8063 1.28546e-11)
(8727.18 -969.686 4.23952e-11)
(1104.62 -122.735 -3.58681e-11)
(2293.37 -254.818 0)
(4176.55 -464.061 2.82214e-11)
(-718.256 79.8063 -1.28546e-11)
)
;
}
empty
{
type empty;
}
}
// ************************************************************************* //
| [
"andytorrestb@gmail.com"
] | andytorrestb@gmail.com | |
37e25719094719b5d3d50bf1fb53cab65d8c8551 | efd7cfc63230d70c91018f909137635a9ee204ea | /ProgrammingPrinciplesAndPracticeUsingCPP/Chapter04/Exercise19-21.cpp | fb3d3804ea53a6175dfcce382b7a24378dd97668 | [] | no_license | Mendeir/ProgrammingPrinciplesAndPracticeUsingCPP | 6a742f8c22b9fd7712d7495d6976c2bf64aa4055 | b90787e1a15c144c77b88be33438ac1f5df038af | refs/heads/master | 2023-02-17T19:46:36.490914 | 2021-01-18T08:11:23 | 2021-01-18T08:11:23 | 281,862,120 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,043 | cpp | #include "std_lib_facilities.h"
void get_name_score_input (vector<string> &names, vector<int> &scores);
void search_name (const vector<string> names, const vector<int> scores);
void search_score (const vector<string> names, const vector<int> scores);
void display_name_score (const vector<string> names, const vector<int> scores);
bool check_name_duplicate (const vector<string> names, const string name_input);
int main ()
{
vector<string> names;
vector<int> scores;
while (true)
{
cout << "NAME AND SCORE RECORDS\n";
cout << "\n\t1. Input names and scores\n"
<< "\t2. Search for name\n"
<< "\t3. Search for score\n"
<< "\t4. Display all names and scores\n"
<< "\t5. Exit\n";
cout << "Enter your choice: ";
char choice { ' ' };
cin >> choice;
switch (choice)
{
case '1':
get_name_score_input (names, scores);
cout << '\n';
break;
case '2':
search_name (names, scores);
cout << '\n';
break;
case '3':
search_score (names, scores);
cout << '\n';
break;
case '4':
display_name_score (names, scores);
cout << '\n';
break;
case '5':
exit (1);
break;
default:
cout << "Invalid input! Please try again.\n\n";
}
}
return 0;
}
void get_name_score_input (vector<string> &names, vector<int> &scores)
{
cout << "\nEnter unique name and score which is separated by a space:\n";
cout << "Type NoName 0 to exit\n";
const string loop_name_terminate { "NoName" };
constexpr int loop_score_terminate { 0 };
string name_input { " " };
int score_input { 0 };
while (name_input != loop_name_terminate || score_input != loop_score_terminate)
{
cin >> name_input >> score_input;
if (cin.fail ())
{
cout << "Error: Invalid output! Please try again.\n";
cin.clear ();
}
else
{
if (check_name_duplicate(names, name_input))
{
names.push_back (name_input);
scores.push_back (score_input);
}
else
cout << "Error: The name " << name_input << " has already been stored.\n";
}
}
}
void search_name (const vector<string> names, const vector<int> scores)
{
string name { " " };
char choice { ' ' };
int score_index { 0 };
bool flag { false };
const char loop_terminate { 'n' };
constexpr int lower_boundary { 0 };
while (choice != loop_terminate)
{
cout << "\nWhat name do you want to search? ";
cin >> name;
for (size_t counter = lower_boundary; counter < names.size (); ++counter)
{
if (names [counter] == name)
{
score_index = counter;
flag = true;
break;
}
}
if (flag)
{
cout << "The name " << name << " has a score of " << scores [score_index] << '\n';
flag = false;
}
else
cout << "The name " << name << " is not found.\n";
cout << "Input n to exit, type anything to continue: ";
cin >> choice;
}
}
void search_score (const vector<string> names, const vector<int> scores)
{
int score { 0 };
char choice { ' ' };
bool flag { false };
const char loop_terminate { 'n' };
constexpr int lower_boundary { 0 };
while (choice != loop_terminate)
{
cout << "\nWhat score do you want to search? ";
cin >> score;
for (size_t counter = lower_boundary; counter < names.size (); ++counter)
{
if (scores [counter] == score)
{
cout << names [counter] << " ";
flag = true;
}
}
if (flag)
{
cout << "are the names with a score of " << score << '\n';
flag = false;
}
else
cout << "The score of " << score << " is not found.\n";
cout << "Input n to exit, type anything to continue: ";
cin >> choice;
}
}
void display_name_score (const vector<string> names, const vector<int> scores)
{
cout << "\nThe names and scores that has been accepted are:\n";
for (size_t counter = 0; counter < names.size () - 1; ++counter)
{
cout << names [counter] << " " << scores [counter] << '\n';
}
}
bool check_name_duplicate (const vector<string> names, const string name_input)
{
for (string counter : names)
{
if (counter == name_input)
return false;
}
return true;
} | [
"adriannemagracia.git@gmail.com"
] | adriannemagracia.git@gmail.com |
985679e31ef0997fcc2b5d5d0d527eb4debe4b88 | ffcc850625b8590866a36d0a607e3a73cf37598d | /exhaustive/function/simd/cot.cpp | 9ca11df8c12cca8bcfce10508fdc2164b7e9d424 | [
"BSL-1.0"
] | permissive | remymuller/boost.simd | af7e596f17294d35ddcd8f859c4a12cb3276254d | c6614f67be94be2608342bf5d753917b6968e821 | refs/heads/develop | 2021-01-02T09:00:18.137281 | 2017-07-06T14:23:04 | 2017-07-06T14:23:04 | 99,120,027 | 6 | 7 | null | 2017-08-02T13:34:55 | 2017-08-02T13:34:55 | null | UTF-8 | C++ | false | false | 1,122 | cpp | //==============================================================================
// Copyright 2016 NumScale SAS
//
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//==============================================================================
#include <boost/simd/function/cot.hpp>
#include <boost/simd/constant/zero.hpp>
#include <boost/simd/constant/valmax.hpp>
#include <boost/simd/pack.hpp>
#include <exhaustive.hpp>
#include <cmath>
#include <cstdlib>
struct raw_cot
{
float operator()(float x) const
{
return bs::cot(double(x));
}
};
int main(int argc, char* argv[])
{
float mini = bs::Zero<float>();
float maxi = bs::Valmax<float>();
if(argc >= 2) mini = std::atof(argv[1]);
if(argc >= 3) maxi = std::atof(argv[2]);
bs::exhaustive_test<bs::pack<float>> ( mini
, maxi
, bs::cot
, raw_cot()
);
return 0;
}
| [
"joel.falcou@lri.fr"
] | joel.falcou@lri.fr |
6d7c1ecb3224928e51240d6ee4e82e89917c87ce | bfd7d41883014a1c2ade1ac93c7f11008b101214 | /BigSmashGateCrash/Handgun.h | 6f8f3a57ae7de32ba5da4a62bcaa47944c63ca55 | [] | no_license | Jonkellino/Game | 6cfd57416ed23ecba0c409c766fb76740f8b130b | 3bebbab3948ca5a67922bcc23304560cae9783f1 | refs/heads/master | 2021-01-10T16:39:55.282278 | 2013-04-01T17:03:59 | 2013-04-01T17:03:59 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 132 | h | #pragma once
#include "Inventable.h"
class Handgun : public Inventable
{
public:
Handgun(void);
~Handgun(void);
void Use();
}; | [
"adam.westinger@hotmail.com"
] | adam.westinger@hotmail.com |
39555f4056165a2ca060b2e5a04cf05cc01a47e6 | e38bf09d4e809bb7f51dcd39c004dcba35903bf6 | /stdafx.h | 3e66d551f985bf313c440650ec6ce15c384d4e62 | [] | no_license | KoicsD/Ising | 0688918c084496b030ea9ca95ec34f43277da5d2 | 859ad8733aa3c77c5422c668af1ca7150e4dd6be | refs/heads/master | 2021-01-10T16:46:43.598340 | 2016-01-17T16:54:51 | 2016-01-17T16:54:51 | 49,823,294 | 0 | 0 | null | null | null | null | ISO-8859-2 | C++ | false | false | 650 | h | // stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include "targetver.h"
#include <stdio.h>
#include <tchar.h>
#include <iostream>//cin és cout használatához
#include <string>//sztringobjektumok használatához (különben csak char* és wchar* létezne)
#include <time.h>//véletlen számgenerátor inicializálásához
#include <fstream>//fájlba ostream objektummal történő íráshoz
using namespace std;//hogy std::cout helyett elég legyen cout
// TODO: reference additional headers your program requires here
| [
"koics.dani@gmail.com"
] | koics.dani@gmail.com |
4920f2c76e75a21df34ce20697332420b0b3b8fe | fb61b5a0264d42d976ee383b7302779621aab327 | /02_OF_cylinder/ppWallGrad/2.1/U | e9944ded7be5a88e64919831d2865ebe396a6ae5 | [] | no_license | Ccaccia73/Aerodinamica | 31062b24a6893262000df2f3d53dde304969182a | 49485cde03a6a4fd569722c9ca4b3558825221ad | refs/heads/master | 2021-01-23T03:16:31.037716 | 2018-01-21T14:55:05 | 2018-01-21T14:55:05 | 86,064,538 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 11,153 | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "2.1";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField nonuniform List<vector>
400
(
(-0.383281 -6.86196e-11 0)
(-0.383281 3.91202e-10 0)
(-0.383281 8.25331e-10 0)
(-0.383281 8.25861e-10 0)
(-0.383281 1.30721e-09 0)
(-0.383281 1.25186e-09 0)
(-0.383281 1.68987e-09 0)
(-0.383281 1.51007e-09 0)
(-0.383281 1.8826e-09 0)
(-0.383281 1.6177e-09 0)
(-0.383281 1.8874e-09 0)
(-0.383281 1.56031e-09 0)
(-0.383281 1.72611e-09 0)
(-0.383281 1.38022e-09 0)
(-0.383281 1.41122e-09 0)
(-0.383281 1.07989e-09 0)
(-0.383281 1.05259e-09 0)
(-0.383281 6.93031e-10 0)
(-0.383281 5.26335e-10 0)
(-0.383281 3.60882e-10 0)
(-1.02319 4.13982e-10 0)
(-1.02319 1.47562e-09 0)
(-1.02319 3.3033e-09 0)
(-1.02319 2.84366e-09 0)
(-1.02319 5.00934e-09 0)
(-1.02319 4.07651e-09 0)
(-1.02319 6.37245e-09 0)
(-1.02319 4.83951e-09 0)
(-1.02319 7.03827e-09 0)
(-1.02319 5.12522e-09 0)
(-1.02319 7.0109e-09 0)
(-1.02319 4.9242e-09 0)
(-1.02319 6.35609e-09 0)
(-1.02319 4.32845e-09 0)
(-1.02319 5.1719e-09 0)
(-1.02319 3.41794e-09 0)
(-1.02319 3.64747e-09 0)
(-1.02319 2.2601e-09 0)
(-1.02319 1.90845e-09 0)
(-1.02319 9.72886e-10 0)
(-1.53643 6.92708e-10 0)
(-1.53643 3.57309e-09 0)
(-1.53643 5.88219e-09 0)
(-1.53643 6.07863e-09 0)
(-1.53643 8.56791e-09 0)
(-1.53643 8.53734e-09 0)
(-1.53643 1.09207e-08 0)
(-1.53643 9.97538e-09 0)
(-1.53643 1.2123e-08 0)
(-1.53643 1.04468e-08 0)
(-1.53643 1.21322e-08 0)
(-1.53643 9.93003e-09 0)
(-1.53643 1.10656e-08 0)
(-1.53643 8.63183e-09 0)
(-1.53643 9.07728e-09 0)
(-1.53643 6.64526e-09 0)
(-1.53643 6.57087e-09 0)
(-1.53643 4.18784e-09 0)
(-1.53643 3.60022e-09 0)
(-1.53643 1.88018e-09 0)
(-1.92303 1.47321e-09 0)
(-1.92303 5.97717e-09 0)
(-1.92303 8.67329e-09 0)
(-1.92303 9.38464e-09 0)
(-1.92303 1.21992e-08 0)
(-1.92303 1.28425e-08 0)
(-1.92303 1.54606e-08 0)
(-1.92303 1.48088e-08 0)
(-1.92303 1.71197e-08 0)
(-1.92303 1.53672e-08 0)
(-1.92303 1.70993e-08 0)
(-1.92303 1.44901e-08 0)
(-1.92303 1.55655e-08 0)
(-1.92303 1.24667e-08 0)
(-1.92303 1.27715e-08 0)
(-1.92303 9.45963e-09 0)
(-1.92303 9.17471e-09 0)
(-1.92303 5.83567e-09 0)
(-1.92303 5.21406e-09 0)
(-1.92303 2.41135e-09 0)
(-2.18296 2.37946e-09 0)
(-2.18296 8.58833e-09 0)
(-2.18296 1.17867e-08 0)
(-2.18296 1.29125e-08 0)
(-2.18296 1.62355e-08 0)
(-2.18296 1.75021e-08 0)
(-2.18296 2.04977e-08 0)
(-2.18296 2.00741e-08 0)
(-2.18296 2.26523e-08 0)
(-2.18296 2.07601e-08 0)
(-2.18296 2.25885e-08 0)
(-2.18296 1.95135e-08 0)
(-2.18296 2.0522e-08 0)
(-2.18296 1.67225e-08 0)
(-2.18296 1.68245e-08 0)
(-2.18296 1.25984e-08 0)
(-2.18296 1.20373e-08 0)
(-2.18296 7.72245e-09 0)
(-2.18296 6.99642e-09 0)
(-2.18296 3.19968e-09 0)
(-2.31624 3.39193e-09 0)
(-2.31624 1.12316e-08 0)
(-2.31624 1.46508e-08 0)
(-2.31624 1.62986e-08 0)
(-2.31624 1.98671e-08 0)
(-2.31624 2.18922e-08 0)
(-2.31624 2.50075e-08 0)
(-2.31624 2.49941e-08 0)
(-2.31624 2.75906e-08 0)
(-2.31624 2.57681e-08 0)
(-2.31624 2.74792e-08 0)
(-2.31624 2.41538e-08 0)
(-2.31624 2.49257e-08 0)
(-2.31624 2.06221e-08 0)
(-2.31624 2.04289e-08 0)
(-2.31624 1.54431e-08 0)
(-2.31624 1.45505e-08 0)
(-2.31624 9.41392e-09 0)
(-2.31624 8.67823e-09 0)
(-2.31624 3.91175e-09 0)
(-2.32287 4.38324e-09 0)
(-2.32287 1.36715e-08 0)
(-2.32287 1.70753e-08 0)
(-2.32287 1.92943e-08 0)
(-2.32287 2.28769e-08 0)
(-2.32287 2.57131e-08 0)
(-2.32287 2.87318e-08 0)
(-2.32287 2.92475e-08 0)
(-2.32287 3.16574e-08 0)
(-2.32287 3.00755e-08 0)
(-2.32287 3.14982e-08 0)
(-2.32287 2.81264e-08 0)
(-2.32287 2.85369e-08 0)
(-2.32287 2.39362e-08 0)
(-2.32287 2.33895e-08 0)
(-2.32287 1.78345e-08 0)
(-2.32287 1.65923e-08 0)
(-2.32287 1.08236e-08 0)
(-2.32287 1.01646e-08 0)
(-2.32287 4.5436e-09 0)
(-2.20284 5.28824e-09 0)
(-2.20284 1.58017e-08 0)
(-2.20284 1.89617e-08 0)
(-2.20284 2.18381e-08 0)
(-2.20284 2.51681e-08 0)
(-2.20284 2.88899e-08 0)
(-2.20284 3.15529e-08 0)
(-2.20284 3.27528e-08 0)
(-2.20284 3.47238e-08 0)
(-2.20284 3.35985e-08 0)
(-2.20284 3.45195e-08 0)
(-2.20284 3.13526e-08 0)
(-2.20284 3.12427e-08 0)
(-2.20284 2.65968e-08 0)
(-2.20284 2.5614e-08 0)
(-2.20284 1.97237e-08 0)
(-2.20284 1.81021e-08 0)
(-2.20284 1.1914e-08 0)
(-2.20284 1.13924e-08 0)
(-2.20284 5.06073e-09 0)
(-1.95615 6.0414e-09 0)
(-1.95615 1.74957e-08 0)
(-1.95615 2.02253e-08 0)
(-1.95615 2.37987e-08 0)
(-1.95615 2.66431e-08 0)
(-1.95615 3.12556e-08 0)
(-1.95615 3.3346e-08 0)
(-1.95615 3.5324e-08 0)
(-1.95615 3.66494e-08 0)
(-1.95615 3.61478e-08 0)
(-1.95615 3.64013e-08 0)
(-1.95615 3.36565e-08 0)
(-1.95615 3.29127e-08 0)
(-1.95615 2.84569e-08 0)
(-1.95615 2.69895e-08 0)
(-1.95615 2.10048e-08 0)
(-1.95615 1.90029e-08 0)
(-1.95615 1.26175e-08 0)
(-1.95615 1.22796e-08 0)
(-1.95615 5.41715e-09 0)
(-1.5828 6.59786e-09 0)
(-1.5828 1.86676e-08 0)
(-1.5828 2.08452e-08 0)
(-1.5828 2.51173e-08 0)
(-1.5828 2.73016e-08 0)
(-1.5828 3.27462e-08 0)
(-1.5828 3.41099e-08 0)
(-1.5828 3.68945e-08 0)
(-1.5828 3.74321e-08 0)
(-1.5828 3.76583e-08 0)
(-1.5828 3.71409e-08 0)
(-1.5828 3.498e-08 0)
(-1.5828 3.35439e-08 0)
(-1.5828 2.94716e-08 0)
(-1.5828 2.75086e-08 0)
(-1.5828 2.165e-08 0)
(-1.5828 1.92922e-08 0)
(-1.5828 1.29158e-08 0)
(-1.5828 1.27743e-08 0)
(-1.5828 5.58262e-09 0)
(-1.0828 6.91935e-09 0)
(-1.0828 1.92415e-08 0)
(-1.0828 2.08169e-08 0)
(-1.0828 2.57312e-08 0)
(-1.0828 2.71617e-08 0)
(-1.0828 3.32984e-08 0)
(-1.0828 3.3868e-08 0)
(-1.0828 3.74003e-08 0)
(-1.0828 3.70992e-08 0)
(-1.0828 3.80704e-08 0)
(-1.0828 3.67657e-08 0)
(-1.0828 3.52726e-08 0)
(-1.0828 3.31621e-08 0)
(-1.0828 2.96057e-08 0)
(-1.0828 2.71887e-08 0)
(-1.0828 2.16406e-08 0)
(-1.0828 1.89869e-08 0)
(-1.0828 1.28018e-08 0)
(-1.0828 1.28323e-08 0)
(-1.0828 5.53533e-09 0)
(-0.456148 6.97762e-09 0)
(-0.456148 1.91638e-08 0)
(-0.456148 2.01516e-08 0)
(-0.456148 2.55877e-08 0)
(-0.456148 2.62573e-08 0)
(-0.456148 3.2867e-08 0)
(-0.456148 3.2666e-08 0)
(-0.456148 3.68002e-08 0)
(-0.456148 3.57063e-08 0)
(-0.456148 3.735e-08 0)
(-0.456148 3.5334e-08 0)
(-0.456148 3.45102e-08 0)
(-0.456148 3.18228e-08 0)
(-0.456148 2.88487e-08 0)
(-0.456148 2.60736e-08 0)
(-0.456148 2.09779e-08 0)
(-0.456148 1.81244e-08 0)
(-0.456148 1.22866e-08 0)
(-0.456148 1.244e-08 0)
(-0.456148 5.26642e-09 0)
(0.297164 6.75931e-09 0)
(0.297164 1.8407e-08 0)
(0.297164 1.88772e-08 0)
(0.297164 2.46498e-08 0)
(0.297164 2.4633e-08 0)
(0.297164 3.14309e-08 0)
(0.297164 3.05653e-08 0)
(0.297164 3.50812e-08 0)
(0.297164 3.33283e-08 0)
(0.297164 3.54941e-08 0)
(0.297164 3.29245e-08 0)
(0.297164 3.26991e-08 0)
(0.297164 2.96012e-08 0)
(0.297164 2.72182e-08 0)
(0.297164 2.42263e-08 0)
(0.297164 1.96848e-08 0)
(0.297164 1.67559e-08 0)
(0.297164 1.13993e-08 0)
(0.297164 1.16091e-08 0)
(0.297164 4.78307e-09 0)
(1.17713 6.2701e-09 0)
(1.17713 1.69728e-08 0)
(1.17713 1.70327e-08 0)
(1.17713 2.28939e-08 0)
(1.17713 2.23295e-08 0)
(1.17713 2.89854e-08 0)
(1.17713 2.76232e-08 0)
(1.17713 3.22484e-08 0)
(1.17713 3.00365e-08 0)
(1.17713 3.25189e-08 0)
(1.17713 2.96135e-08 0)
(1.17713 2.98645e-08 0)
(1.17713 2.65706e-08 0)
(1.17713 2.47473e-08 0)
(1.17713 2.17101e-08 0)
(1.17713 1.77968e-08 0)
(1.17713 1.49323e-08 0)
(1.17713 1.01786e-08 0)
(1.17713 1.0371e-08 0)
(1.17713 4.10825e-09 0)
(2.18376 5.55521e-09 0)
(2.18376 1.4941e-08 0)
(2.18376 1.473e-08 0)
(2.18376 2.03888e-08 0)
(2.18376 1.94762e-08 0)
(2.18376 2.56442e-08 0)
(2.18376 2.40065e-08 0)
(2.18376 2.84406e-08 0)
(2.18376 2.60212e-08 0)
(2.18376 2.85788e-08 0)
(2.18376 2.55935e-08 0)
(2.18376 2.61603e-08 0)
(2.18376 2.29087e-08 0)
(2.18376 2.15768e-08 0)
(2.18376 1.86729e-08 0)
(2.18376 1.54277e-08 0)
(2.18376 1.27623e-08 0)
(2.18376 8.70693e-09 0)
(2.18376 8.80813e-09 0)
(2.18376 3.29578e-09 0)
(3.31704 4.66961e-09 0)
(3.31704 1.23847e-08 0)
(3.31704 1.20337e-08 0)
(3.31704 1.71614e-08 0)
(3.31704 1.61017e-08 0)
(3.31704 2.14533e-08 0)
(3.31704 1.97563e-08 0)
(3.31704 2.37162e-08 0)
(3.31704 2.13334e-08 0)
(3.31704 2.37436e-08 0)
(3.31704 2.09197e-08 0)
(3.31704 2.16595e-08 0)
(3.31704 1.86694e-08 0)
(3.31704 1.77759e-08 0)
(3.31704 1.51644e-08 0)
(3.31704 1.26372e-08 0)
(3.31704 1.02863e-08 0)
(3.31704 7.02944e-09 0)
(3.31704 6.99249e-09 0)
(3.31704 2.39844e-09 0)
(4.57697 3.60779e-09 0)
(4.57697 9.40587e-09 0)
(4.57697 9.0765e-09 0)
(4.57697 1.33027e-08 0)
(4.57697 1.2339e-08 0)
(4.57697 1.65677e-08 0)
(4.57697 1.50529e-08 0)
(4.57697 1.8273e-08 0)
(4.57697 1.61848e-08 0)
(4.57697 1.82413e-08 0)
(4.57697 1.5813e-08 0)
(4.57697 1.65929e-08 0)
(4.57697 1.40627e-08 0)
(4.57697 1.35607e-08 0)
(4.57697 1.13675e-08 0)
(4.57697 9.59809e-09 0)
(4.57697 7.65206e-09 0)
(4.57697 5.26508e-09 0)
(4.57697 5.06674e-09 0)
(4.57697 1.55235e-09 0)
(5.96357 3.01599e-09 0)
(5.96357 6.67325e-09 0)
(5.96357 6.57968e-09 0)
(5.96357 9.78262e-09 0)
(5.96357 9.0936e-09 0)
(5.96357 1.2126e-08 0)
(5.96357 1.09533e-08 0)
(5.96357 1.33378e-08 0)
(5.96357 1.16617e-08 0)
(5.96357 1.32649e-08 0)
(5.96357 1.12956e-08 0)
(5.96357 1.20286e-08 0)
(5.96357 9.95562e-09 0)
(5.96357 9.78452e-09 0)
(5.96357 7.94747e-09 0)
(5.96357 6.8982e-09 0)
(5.96357 5.22557e-09 0)
(5.96357 3.73272e-09 0)
(5.96357 3.26069e-09 0)
(5.96357 7.51609e-10 0)
(7.47681 1.5965e-09 0)
(7.47681 3.39634e-09 0)
(7.47681 3.64638e-09 0)
(7.47681 5.25668e-09 0)
(7.47681 5.06135e-09 0)
(7.47681 6.71851e-09 0)
(7.47681 5.9584e-09 0)
(7.47681 7.49711e-09 0)
(7.47681 6.25736e-09 0)
(7.47681 7.53477e-09 0)
(7.47681 5.98433e-09 0)
(7.47681 6.90088e-09 0)
(7.47681 5.20966e-09 0)
(7.47681 5.69516e-09 0)
(7.47681 4.06026e-09 0)
(7.47681 4.10366e-09 0)
(7.47681 2.60989e-09 0)
(7.47681 2.2756e-09 0)
(7.47681 1.44584e-09 0)
(7.47681 4.63467e-10 0)
(9.11672 7.0832e-10 0)
(9.11672 1.01476e-09 0)
(9.11672 1.12232e-09 0)
(9.11672 1.63025e-09 0)
(9.11672 1.55113e-09 0)
(9.11672 2.01342e-09 0)
(9.11672 1.79682e-09 0)
(9.11672 2.21469e-09 0)
(9.11672 1.85272e-09 0)
(9.11672 2.19469e-09 0)
(9.11672 1.74416e-09 0)
(9.11672 1.98828e-09 0)
(9.11672 1.4881e-09 0)
(9.11672 1.61305e-09 0)
(9.11672 1.12949e-09 0)
(9.11672 1.13992e-09 0)
(9.11672 6.59904e-10 0)
(9.11672 6.18629e-10 0)
(9.11672 3.32926e-10 0)
(9.11672 -3.68879e-11 0)
)
;
boundaryField
{
top
{
type fixedValue;
value uniform (10 0 0);
}
bottom
{
type fixedValue;
value uniform (0 0 0);
}
inlet
{
type zeroGradient;
}
outlet
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //
| [
"c.caccia@libero.it"
] | c.caccia@libero.it | |
45886a4c89af2561b7c0596b2a24e2de61e6bccd | 784ac5118d95d7706bdbf317b639cf3ecb89d93e | /Searching Algorithms/LinearSearchRecursion.cpp | d9f420e771eda5630b77aae5b3ad70ccb75e9026 | [] | no_license | AbdullahSaad5/DataStructures | 49816b64893409c93132297a997d146b34eb2cdf | fedda32b99ddcbdccd6798bdd16a2f38d74b476f | refs/heads/main | 2023-02-03T19:53:03.845320 | 2020-12-21T19:52:15 | 2020-12-21T19:52:15 | 323,433,698 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 579 | cpp | #include <iostream>
using namespace std;
int length;
void findValue(int value, int array[], int index)
{
if (value == array[index])
{
cout << "Value Found at Index " << index << endl;
}
else if (index == length - 1)
{
cout << "Value Not Found" << endl;
}
else
{
findValue(value, array, ++index);
}
}
int main()
{
int array[10];
length = 10;
for (int i = 0; i < 10; i++)
{
array[i] = i * 2;
}
int value;
cout << "Enter Number:";
cin >> value;
findValue(value, array, 0);
} | [
"syedabdullahsaad1@gmail.com"
] | syedabdullahsaad1@gmail.com |
902c9bd544f6231927cdd35053a68423b1d6ea38 | 0e9d135183451c443649dd15f15ad6651285a154 | /src/Nubuck/camera/arcball_camera.cpp | f6c115878988726484a164374d4d1d2aa5026a32 | [] | no_license | plainoldcj/nubuck | d16186759f6b7532a04c49f1ba922b4c96b772c5 | 0fa6c7cc31795f248d9d46abd525c80ec0b3bc27 | refs/heads/master | 2021-01-18T14:45:01.782140 | 2015-07-01T10:34:43 | 2015-07-01T10:34:43 | 9,876,234 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 9,144 | cpp | #include "arcball_camera.h"
namespace {
const float zoomStep = 2.0f;
const float minZoom = 0.1f;
M::Vector3 Transform(const M::Quaternion& q, const M::Vector3& v) {
// TODO: use q*vq instead
M::Matrix4 m = M::Mat4::RotateQuaternion(q);
return M::Transform(m, v);
}
M::Vector3 VectorOnSphereFromMousePos(float halfWidth, float halfHeight, float radius, int mouseX, int mouseY) {
float x = mouseX - halfWidth;
float y = -mouseY + halfHeight;
const float r2 = radius * radius;
const float len2 = x * x + y * y;
M::Vector3 ret;
if(len2 > r2) {
ret = M::Normalize(M::Vector3(x, y, 0.0f));
} else {
const float z = sqrt(r2 - len2);
ret = M::Normalize(M::Vector3(x, y, z));
}
return ret;
}
M::Vector3 VectorInPlaneFromMousePos(float halfWidth, float halfHeight, int mouseX, int mouseY) {
const float f = 0.5f;
float x = (mouseX - halfWidth) / (f * halfWidth);
float y = (-mouseY + halfHeight) / (f * halfHeight);
return M::Vector3(x, y, 0.0f);
}
/*
====================
VectorInXYPlaneFromMousePos
shoot a ray originating in camera through projection plane onto plane that
is parallel to the proj. plane and passes through the origin of the world
coordinate system. intersection point is used as translation vector.
====================
*/
M::Vector3 VectorInXYPlaneFromMousePos(
float halfWidth, float halfHeight,
int mouseX, int mouseY, float dist)
{
// hardcoded values
const float fovy = M::Deg2Rad(45.0f); // hardcoded in renderer.cpp
const float aspect = halfWidth / halfHeight;
// size of projection plane.
// assuming z = 1.0f, hardcoded in renderer.cpp
const float h = 2.0f * tanf(0.5f * fovy);
const float w = h * aspect;
const float l1 = (float)mouseX / (2.0f * halfWidth);
const float l2 = -1.0f * mouseY / (2.0f * halfHeight);
const float x = (l1 - 0.5f) * w;
const float y = (l2 - 0.5f) * h;
// ray = (origin, direction) = (0, (x, y, 1))
// intersects XY plane at l
const float l = -dist;
// intersection point
return M::Vector3(x * l, y * l, 0.0f);
}
M::Matrix3 LookAt(const M::Vector3& eye, const M::Vector3& ref, const M::Vector3& up) {
const M::Vector3 Z = M::Normalize(eye - ref);
const M::Vector3 X = M::Normalize(M::Cross(up, Z));
const M::Vector3 Y = M::Normalize(M::Cross(Z, X));
return M::Mat3::FromColumns(X, Y, Z);
}
} // unnamed namespace
/*
====================
ArcballCamera::Position
returns the position of the camera in world space
====================
*/
M::Vector3 ArcballCamera::Position() const {
return _target + Transform(_orient, _zoom * M::Vector3(0.0f, 0.0f, 1.0f));
}
ArcballCamera::ArcballCamera(int width, int height)
: _dragging(false)
, _panning(false)
, _zooming(false)
, _target(M::Vector3::Zero)
, _orient(M::Quat::Identity())
, _zoom(0.0f)
, _projWeight(0.0f)
, _proj(Projection::PERSPECTIVE)
{
SetScreenSize(width, height);
Reset();
}
float ArcballCamera::GetZoom() const { return _zoom; }
float ArcballCamera::GetProjectionWeight() const { return _projWeight; }
void ArcballCamera::Reset() {
_panning = false;
_dragging = false;
_zooming = false;
_target = M::Vector3::Zero;
_orient = M::Quat::FromMatrix(LookAt(M::Vector3::Zero, M::Vector3(-1.0f, -1.0f, -1.0f), M::Vector3(0.0f, 1.0f, 0.0f)));
_zoom = 15.0f;
}
void ArcballCamera::ResetRotation() {
_panning = false;
_dragging = false;
_orient = M::Quat::Identity();
}
void ArcballCamera::ZoomIn() {
_zoom = M::Max(minZoom, _zoom - zoomStep);
}
void ArcballCamera::ZoomOut() {
_zoom = M::Max(minZoom, _zoom + zoomStep);
}
void ArcballCamera::SetScreenSize(int width, int height) {
_halfWidth = width / 2.0f;
_halfHeight = height / 2.0f;
_radius = M::Min(_halfWidth, _halfHeight);
}
void ArcballCamera::StartDragging(int mouseX, int mouseY) {
if(!_dragging) {
_v0 = VectorOnSphereFromMousePos(_halfWidth, _halfHeight, _radius, mouseX, mouseY);
_dragging = true;
}
}
bool ArcballCamera::Drag(int mouseX, int mouseY) {
if(_dragging) {
const M::Vector3 v1 = VectorOnSphereFromMousePos(_halfWidth, _halfHeight, _radius, mouseX, mouseY);
if(M::LinearlyDependent(_v0, v1)) return _dragging;
const M::Vector3 axis = M::Normalize(M::Cross(_v0, v1));
float angle = acosf(M::Clamp(-1.0f, M::Dot(_v0, v1), 1.0f));
const M::Quaternion rot = M::Quat::RotateAxis(axis, M::Rad2Deg(-angle));
_orient = rot * _orient;
_v0 = v1;
}
return _dragging;
}
void ArcballCamera::StopDragging() {
_dragging = false;
}
void ArcballCamera::StartPanning(int mouseX, int mouseY) {
if(!_panning) {
_v0 = VectorInXYPlaneFromMousePos(_halfWidth, _halfHeight, mouseX, mouseY, _zoom);
_lastTarget = _target;
_panning = true;
}
}
bool ArcballCamera::Pan(int mouseX, int mouseY) {
if(_panning) {
const M::Vector3 v1 = VectorInXYPlaneFromMousePos(_halfWidth, _halfHeight, mouseX, mouseY, _zoom);
_target = _lastTarget + Transform(_orient, v1 - _v0);
}
return _panning;
}
void ArcballCamera::StopPanning() {
_panning = false;
}
void ArcballCamera::StartZooming(int mouseX, int mouseY) {
if(!_zooming) {
_y0 = static_cast<float>(mouseY);
_lastZoom = _zoom;
_zooming = true;
}
}
bool ArcballCamera::Zoom(int mouseX, int mouseY) {
const float scale = 0.8f;
if(_zooming) {
float zoom = scale * (_y0 - mouseY);
_zoom = M::Max(minZoom, _lastZoom - zoom);
}
return _zooming;
}
void ArcballCamera::StopZooming() {
_zooming = false;
}
void ArcballCamera::RotateTo(const M::Quaternion& orient, float dur) {
OrientAnim& anim = _orientAnim;
// don't reset duration when target doesn't change
if(!anim.active || !M::AlmostEqual(1.0f, M::Dot(orient, anim.v1))) {
anim.dur = dur;
anim.t = 0.0f;
anim.v0 = _orient;
anim.v1 = orient;
anim.active = true;
}
}
void ArcballCamera::TranslateTo(const M::Vector3& pos, float dur) {
TransAnim& anim = _transAnim;
// don't reset duration when target doesn't change
if(!anim.active || !M::AlmostEqual(0.0f, M::SquaredDistance(pos, anim.v1))) {
anim.dur = dur;
anim.t = 0.0f;
anim.v0 = _target;
anim.v1 = pos;
anim.active = true;
}
}
void ArcballCamera::SetProjection(Projection::Enum proj, float dur) {
ProjWeightAnim& anim = _projWeightAnim;
static const float weights[Projection::NUM_PROJECTIONS] = {
0.0f, // perspective
1.0f // orthographic
};
// don't reset duration when target doesn't change
if(!anim.active || proj != _proj) {
anim.dur = dur;
anim.t = 0.0f;
anim.v0 = _projWeight;
anim.v1 = weights[proj];
anim.active = true;
_proj = proj;
}
}
void ArcballCamera::ToggleProjection(float dur) {
SetProjection(Projection::Enum(1 - _proj), dur);
}
bool ArcballCamera::FrameUpdate(float secsPassed) {
bool cameraChanged = false;
bool ease = true;
if(_orientAnim.active) {
OrientAnim& anim = _orientAnim;
float l = anim.t / anim.dur;
_orient = M::Slerp(anim.v0, anim.v1, l);
anim.t += secsPassed;
if(anim.dur <= anim.t) {
_orient = anim.v1;
anim.active = false;
}
cameraChanged = true;
}
if(_transAnim.active) {
TransAnim& anim = _transAnim;
float l = anim.t / anim.dur;
_target = M::Lerp(anim.v0, anim.v1, l);
anim.t += secsPassed;
if(anim.dur <= anim.t) {
_target = anim.v1;
anim.active = false;
}
cameraChanged = true;
}
if(_projWeightAnim.active) {
ProjWeightAnim& anim = _projWeightAnim;
float u, t = anim.t / anim.dur;
// uses x^4 easing function
if(anim.v0 < anim.v1) { // transitioning from persp to orth
const float m = t - 1.0f;
u = - m * m * m * m + 1.0f;
} else {
u = t * t * t * t;
}
if(!ease) u = t;
_projWeight = (1.0f - u) * anim.v0 + u * anim.v1;
anim.t += secsPassed;
if(anim.dur <= anim.t) {
_projWeight = anim.v1;
anim.active = false;
}
}
return cameraChanged;
}
M::Matrix4 ArcballCamera::GetWorldToEyeMatrix() const {
const M::Quaternion q = M::Quaternion(_orient.w, -_orient.v);
const M::Vector3 p = Position();
M::Matrix4 T = M::Mat4::Translate(-p);
M::Matrix4 R = M::Mat4::RotateQuaternion(q);
return R * T;
}
| [
"johndoe.foobar@googlemail.com"
] | johndoe.foobar@googlemail.com |
9f2a57fafd306a91b87ade2ae8b33d6a522307c6 | 0eff74b05b60098333ad66cf801bdd93becc9ea4 | /second/download/git/gumtree/git_new_hunk_983.cpp | 5d19feb8917eab9fb3ceaedb054152fea7d97fbb | [] | no_license | niuxu18/logTracker-old | 97543445ea7e414ed40bdc681239365d33418975 | f2b060f13a0295387fe02187543db124916eb446 | refs/heads/master | 2021-09-13T21:39:37.686481 | 2017-12-11T03:36:34 | 2017-12-11T03:36:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 748 | cpp | ret = list_tags(&filter, sorting, format);
if (column_active(colopts))
stop_column_filter();
return ret;
}
if (filter.lines != -1)
die(_("-n option is only allowed in list mode"));
if (filter.with_commit)
die(_("--contains option is only allowed in list mode"));
if (filter.no_commit)
die(_("--no-contains option is only allowed in list mode"));
if (filter.points_at.nr)
die(_("--points-at option is only allowed in list mode"));
if (filter.merge_commit)
die(_("--merged and --no-merged options are only allowed in list mode"));
if (cmdmode == 'd')
return for_each_tag_name(argv, delete_tag, NULL);
if (cmdmode == 'v') {
if (format)
verify_ref_format(format);
return for_each_tag_name(argv, verify_tag, format);
| [
"993273596@qq.com"
] | 993273596@qq.com |
88972a63fbf7618f28f8222c5b2582c4252c837f | 9ac084b847374e4752aa468a1eb87f7a293730cf | /main/main/Gyps.h | 7a0433f4bf3c96450d5f1a46bc7b398afa958c6b | [] | no_license | Bainbetova/Birds_OOP | bebf0697cb1d6108b00fd3c5e9bb5cf09944d122 | 7e49ad64d892d7183239510d9f3bf72e4d547ed3 | refs/heads/master | 2022-09-04T19:39:31.183623 | 2020-05-09T16:31:29 | 2020-05-09T16:31:29 | 262,611,627 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 112 | h | #ifndef Gyps_h
#define Gyps_h
#include "Accipitrinae.h"
class Gyps : public Accipitrinae {};
#endif // Gyps_h
| [
"38616325+Bainbetova@users.noreply.github.com"
] | 38616325+Bainbetova@users.noreply.github.com |
5f7db9d0b79e58ebfe4bce3a879efa43f5782beb | c0146da9ca538b1ea8b2508e76cf9dc71eda1063 | /include/G4SBSROGeometry.hh | e28ae2837e54d40bbd843cb8e7ddcdb7677b98ca | [] | no_license | yezhihong/g4sbsDDVCS | f0964b5994e908b8a66662181bc2acc4133ff1ae | 414532440a6736c479d9580515c121f8850f53ff | refs/heads/master | 2020-04-05T23:33:40.359435 | 2015-03-07T23:28:14 | 2015-03-07T23:28:14 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 401 | hh | #ifndef G4SBSCalHit_h
#define G4SBSCalHit_h 1
#include "G4VHit.hh"
#include "G4THitsCollection.hh"
#include "G4Allocator.hh"
#include "G4ThreeVector.hh"
#include "G4LogicalVolume.hh"
#include "G4Transform3D.hh"
#include "G4RotationMatrix.hh"
class G4SBSROGeometry : public G4VReadoutGeometry
{
public:
G4SBSROGeometry();
~G4SBSROGeometry();
G4VPhysicalVolume* build()
{
}
}
| [
"camsonne@halla120.jlab.org"
] | camsonne@halla120.jlab.org |
154439db6326f8d9739fee894c66dfa5979ab99d | 92fe47dd34714208c9114bae25b0a17475963342 | /Hacks/CSGO/CSGOInternal/csgoInternalMaster-Structured/Valve/IClientEntity.h | 0bb9dcc3283a570408bedab244ba8bb21941fb8c | [] | no_license | AbhishekGola/Gaming | bed16a3a4d02dc76f230a75a662d19184db51f6f | a055d7178d9d80a1258b1d0814f2a8cd52dad16b | refs/heads/master | 2023-08-15T01:14:30.077234 | 2019-12-01T17:24:41 | 2019-12-01T17:24:41 | 186,141,146 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 19,749 | h | /*
___ ___ ___ ___
/\ \ |\__\ /\ \ /\__\
/::\ \ |:| | /::\ \ /::| |
/:/\:\ \ |:| | /:/\:\ \ /:|:| |
/:/ \:\ \ |:|__|__ /::\~\:\ \ /:/|:| |__
/:/__/ \:\__\ /::::\__\ /:/\:\ \:\__\ /:/ |:| /\__\
\:\ \ \/__/ /:/~~/~~ \/__\:\/:/ / \/__|:|/:/ /
\:\ \ /:/ / \::/ / |:/:/ /
\:\ \ \/__/ /:/ / |::/ /
\:\__\ /:/ / /:/ /
\/__/ \/__/ \/__/
revolt (4/2017)
credit: AimTux (https://github.com/AimTuxOfficial/AimTux)
*/
#pragma once
#include "vector.h"
#include "netvar.h"
#include "IVModelRender.h"
#include "utilities.h"
#define MAX_SHOOT_SOUNDS 16
#define MAX_WEAPON_STRING 80
#define MAX_WEAPON_PREFIX 16
#define MAX_WEAPON_AMMO_NAME 32
enum WeaponSound_t
{
EMPTY,
SINGLE,
SINGLE_NPC,
WPN_DOUBLE, // Can't be "DOUBLE" because windows.h uses it.
DOUBLE_NPC,
BURST,
RELOAD,
RELOAD_NPC,
MELEE_MISS,
MELEE_HIT,
MELEE_HIT_WORLD,
SPECIAL1,
SPECIAL2,
SPECIAL3,
TAUNT,
FAST_RELOAD,
// Add new shoot sound types here
REVERSE_THE_NEW_SOUND,
NUM_SHOOT_SOUND_TYPES,
};
enum MoveType_t
{
MOVETYPE_NONE = 0,
MOVETYPE_ISOMETRIC,
MOVETYPE_WALK,
MOVETYPE_STEP,
MOVETYPE_FLY,
MOVETYPE_FLYGRAVITY,
MOVETYPE_VPHYSICS,
MOVETYPE_PUSH,
MOVETYPE_NOCLIP,
MOVETYPE_LADDER,
MOVETYPE_OBSERVER,
MOVETYPE_CUSTOM,
MOVETYPE_LAST = MOVETYPE_CUSTOM,
MOVETYPE_MAX_BITS = 4
};
enum DataUpdateType_t
{
DATA_UPDATE_CREATED = 0,
DATA_UPDATE_DATATABLE_CHANGED,
};
enum WeaponType_t : int
{
INVALID = -1,
RIFLE,
SNIPER,
PISTOL,
SMG
};
WeaponType_t GetWeaponTypeFromClassID(EClassIds id);
class ICollideable
{
public:
virtual void pad0();
virtual const Vector& OBBMins() const;
virtual const Vector& OBBMaxs() const;
};
class IHandleEntity
{
public:
virtual ~IHandleEntity() {};
};
class IClientUnknown : public IHandleEntity {};
class IClientRenderable
{
public:
virtual ~IClientRenderable() {};
model_t* GetModel()
{
typedef model_t* (__thiscall* oGetModel)(void*);
return getvfunc<oGetModel>(this, 8)(this);
}
bool SetupBones(matrix3x4_t* pBoneMatrix, int nMaxBones, int nBoneMask, float flCurTime = 0)
{
typedef bool (__thiscall* oSetupBones)(void*, matrix3x4_t*, int, int, float);
return getvfunc<oSetupBones>(this, 13)(this, pBoneMatrix, nMaxBones, nBoneMask, flCurTime);
}
};
class IClientNetworkable
{
public:
virtual ~IClientNetworkable() {};
void Release()
{
typedef void (__thiscall* oRelease)(void*);
return getvfunc<oRelease>(this, 1)(this);
}
ClientClass* GetClientClass()
{
typedef ClientClass* (__thiscall* oGetClientClass)(void*);
return getvfunc<oGetClientClass>(this, 2)(this);
}
void PreDataUpdate(DataUpdateType_t updateType)
{
typedef void (__thiscall* oPreDataUpdate)(void*, DataUpdateType_t);
return getvfunc<oPreDataUpdate>(this, 6)(this, updateType);
}
bool GetDormant()
{
typedef bool (__thiscall* oGetDormant)(void*);
return getvfunc<oGetDormant>(this, 9)(this);
}
int GetIndex()
{
typedef int (__thiscall* oGetIndex)(void*);
return getvfunc<oGetIndex>(this, 10)(this);
}
void SetDestroyedOnRecreateEntities()
{
typedef void (__thiscall* oSetDestroyedOnRecreateEntities)(void*);
return getvfunc<oSetDestroyedOnRecreateEntities>(this, 13)(this);
}
};
class IClientThinkable
{
public:
virtual ~IClientThinkable() {};
};
class IClientEntity : public IClientUnknown, public IClientRenderable, public IClientNetworkable, public IClientThinkable
{
public:
virtual ~IClientEntity() {};
};
class C_BaseEntity : public IClientEntity
{
public:
IClientNetworkable* GetNetworkable()
{
return (IClientNetworkable*)((uintptr_t)this + 0x08);
}
void SetModelIndex(int index)
{
typedef void (__thiscall* oSetModelIndex)(void*, int);
return getvfunc<oSetModelIndex>(this, 111)(this, index);
}
void SetModelIndex2(int index)
{
typedef void(__thiscall* oSetModelIndex)(void*, int);
return getvfunc<oSetModelIndex>(this, 75)(this, index);
}
int* GetModelIndex()
{
return (int*)((uintptr_t)this + NetVars::DT_BaseViewModel::m_nModelIndex);
}
float GetAnimTime()
{
return *(float*)((uintptr_t)this + NetVars::DT_BaseEntity::m_flAnimTime);
}
float GetSimulationTime()
{
return *(float*)((uintptr_t)this + NetVars::DT_BaseEntity::m_flSimulationTime);
}
TeamID GetTeam()
{
return *(TeamID*)((uintptr_t)this + NetVars::DT_BaseEntity::m_iTeamNum);
}
Vector GetVecOrigin()
{
return *(Vector*)((uintptr_t)this + NetVars::DT_BaseEntity::m_vecOrigin);
}
MoveType_t GetMoveType()
{
return *(MoveType_t*)((uintptr_t)this + NetVars::DT_BaseEntity::m_MoveType);
}
ICollideable* GetCollideable()
{
return (ICollideable*)((uintptr_t)this + NetVars::DT_BaseEntity::m_Collision);
}
bool* GetSpotted()
{
return (bool*)((uintptr_t)this + NetVars::DT_BaseEntity::m_bSpotted);
}
};
/* generic game classes */
class C_BasePlayer : public C_BaseEntity
{
public:
QAngle* GetViewPunchAngle()
{
return (QAngle*)((uintptr_t)this + NetVars::DT_BasePlayer::m_viewPunchAngle);
}
QAngle* GetAimPunchAngle()
{
return (QAngle*)((uintptr_t)this + NetVars::DT_BasePlayer::m_aimPunchAngle);
}
Vector GetVecViewOffset()
{
return *(Vector*)((uintptr_t)this + NetVars::DT_BasePlayer::m_vecViewOffset);
}
unsigned int GetTickBase()
{
return *(unsigned int*)((uintptr_t)this + NetVars::DT_BasePlayer::m_nTickBase);
}
Vector GetVelocity()
{
return *(Vector*)((uintptr_t)this + NetVars::DT_BasePlayer::m_vecVelocity);
}
int GetHealth()
{
return *(int*)((uintptr_t)this + NetVars::DT_BasePlayer::m_iHealth);
}
unsigned char GetLifeState()
{
return *(unsigned char*)((uintptr_t)this + NetVars::DT_BasePlayer::m_lifeState);
}
int GetFlags()
{
return *(int*)((uintptr_t)this + NetVars::DT_BasePlayer::m_fFlags);
}
void SetFlags(int iFlags)
{
*(int*)((uintptr_t)this + NetVars::DT_BasePlayer::m_fFlags) = iFlags;
}
ObserverMode_t* GetObserverMode()
{
return (ObserverMode_t*)((uintptr_t)this + NetVars::DT_BasePlayer::m_iObserverMode);
}
HANDLE GetObserverTarget()
{
return *(HANDLE*)((uintptr_t)this + NetVars::DT_BasePlayer::m_hObserverTarget);
}
HANDLE* GetViewModel()
{
return (HANDLE*)((uintptr_t)this + NetVars::DT_BasePlayer::m_hViewModel);
}
const char* GetLastPlaceName()
{
return (const char*)((uintptr_t)this + NetVars::DT_BasePlayer::m_szLastPlaceName);
}
int GetShotsFired()
{
return *(int*)((uintptr_t)this + NetVars::DT_CSPlayer::m_iShotsFired);
}
QAngle* GetEyeAngles()
{
return (QAngle*)((uintptr_t)this + NetVars::DT_CSPlayer::m_angEyeAngles[0]);
}
int GetMoney()
{
return *(int*)((uintptr_t)this + NetVars::DT_CSPlayer::m_iAccount);
}
int GetHits()
{
return *(int*)((uintptr_t)this + NetVars::DT_CSPlayer::m_totalHitsOnServer);
}
int GetArmor()
{
return *(int*)((uintptr_t)this + NetVars::DT_CSPlayer::m_ArmorValue);
}
int HasDefuser()
{
return *(int*)((uintptr_t)this + NetVars::DT_CSPlayer::m_bHasDefuser);
}
bool IsDefusing()
{
return *(bool*)((uintptr_t)this + NetVars::DT_CSPlayer::m_bIsDefusing);
}
bool IsGrabbingHostage()
{
return *(bool*)((uintptr_t)this + NetVars::DT_CSPlayer::m_bIsGrabbingHostage);
}
bool IsScoped()
{
return *(bool*)((uintptr_t)this + NetVars::DT_CSPlayer::m_bIsScoped);
}
bool GetImmune()
{
return *(bool*)((uintptr_t)this + NetVars::DT_CSPlayer::m_bGunGameImmunity);
}
bool IsRescuing()
{
return *(bool*)((uintptr_t)this + NetVars::DT_CSPlayer::m_bIsRescuing);
}
int HasHelmet()
{
return *(int*)((uintptr_t)this + NetVars::DT_CSPlayer::m_bHasHelmet);
}
float GetFlashBangTime()
{
return *(float*)((uintptr_t)this + 0xABE4);
}
float GetFlashDuration()
{
return *(float*)((uintptr_t)this + NetVars::DT_CSPlayer::m_flFlashDuration);
}
float* GetFlashMaxAlpha()
{
return (float*)((uintptr_t)this + NetVars::DT_CSPlayer::m_flFlashMaxAlpha);
}
float* GetLowerBodyYawTarget()
{
return (float*)((uintptr_t)this + NetVars::DT_CSPlayer::m_flLowerBodyYawTarget);
}
HANDLE GetActiveWeapon()
{
return *(HANDLE*)((uintptr_t)this + NetVars::DT_BaseCombatCharacter::m_hActiveWeapon);
}
HANDLE* GetWeapons()
{
return (HANDLE*)((uintptr_t)this + NetVars::DT_BaseCombatCharacter::m_hMyWeapons);
}
int* GetWearables()
{
return (int*)((uintptr_t)this + NetVars::DT_BaseCombatCharacter::m_hMyWearables);
}
bool GetAlive()
{
return this->GetHealth() > 0 && this->GetLifeState() == LIFE_ALIVE;
}
Vector GetEyePosition()
{
return this->GetVecOrigin() + this->GetVecViewOffset();
}
inline Vector GetBonePosition(int boneIndex)
{
matrix3x4_t BoneMatrix[MAXSTUDIOBONES];
if (!this->SetupBones(BoneMatrix, MAXSTUDIOBONES, BONE_USED_BY_HITBOX, 0))
return this->GetVecOrigin();
return Vector(BoneMatrix[boneIndex][0][3], BoneMatrix[boneIndex][1][3], BoneMatrix[boneIndex][2][3]);
}
QAngle* GetVAngles()
{
return (QAngle*)((uintptr_t)this + NetVars::DT_BasePlayer::deadflag + 0x4);
}
};
class C_PlantedC4 : public C_BaseEntity
{
public:
bool IsBombTicking()
{
return (bool)((uintptr_t)this + NetVars::DT_PlantedC4::m_bBombTicking);
}
float GetBombTime()
{
return *(float*)((uintptr_t)this + NetVars::DT_PlantedC4::m_flC4Blow);
}
bool IsBombDefused()
{
return *(bool*)((uintptr_t)this + NetVars::DT_PlantedC4::m_bBombDefused);
}
int GetBombDefuser()
{
return *(int*)((uintptr_t)this + NetVars::DT_PlantedC4::m_hBombDefuser);
}
};
class C_BaseAttributableItem : public C_BaseEntity
{
public:
ItemDefinitionIndex* GetItemDefinitionIndex()
{
return (ItemDefinitionIndex*)((uintptr_t)this + NetVars::DT_BaseAttributableItem::m_iItemDefinitionIndex);
}
int* GetItemIDHigh()
{
return (int*)((uintptr_t)this + NetVars::DT_BaseAttributableItem::m_iItemIDHigh);
}
int* GetEntityQuality()
{
return (int*)((uintptr_t)this + NetVars::DT_BaseAttributableItem::m_iEntityQuality);
}
char* GetCustomName()
{
return (char*)((uintptr_t)this + NetVars::DT_BaseAttributableItem::m_szCustomName);
}
int* GetFallbackPaintKit()
{
return (int*)((uintptr_t)this + NetVars::DT_BaseAttributableItem::m_nFallbackPaintKit);
}
int* GetFallbackSeed()
{
return (int*)((uintptr_t)this + NetVars::DT_BaseAttributableItem::m_nFallbackSeed);
}
float* GetFallbackWear()
{
return (float*)((uintptr_t)this + NetVars::DT_BaseAttributableItem::m_flFallbackWear);
}
int* GetFallbackStatTrak()
{
return (int*)((uintptr_t)this + NetVars::DT_BaseAttributableItem::m_nFallbackStatTrak);
}
int* GetAccountID()
{
return (int*)((uintptr_t)this + NetVars::DT_BaseAttributableItem::m_iAccountID);
}
};
class C_BaseViewModel: public C_BaseEntity
{
public:
int GetWeapon()
{
return *(int*)((uintptr_t)this + NetVars::DT_BaseViewModel::m_hWeapon);
}
HANDLE GetOwner()
{
return *(HANDLE*)((uintptr_t)this + NetVars::DT_BaseViewModel::m_hOwner);
}
};
class CHudTexture;
class FileWeaponInfo_t
{
public:
FileWeaponInfo_t();
// Each game can override this to get whatever values it wants from the script.
virtual void Parse(KeyValues *pKeyValuesData, const char *szWeaponName);
bool bParsedScript;
bool bLoadedHudElements;
char szClassName[MAX_WEAPON_STRING];
char szPrintName[MAX_WEAPON_STRING];
char szViewModel[MAX_WEAPON_STRING];
char szWorldModel[MAX_WEAPON_STRING];
char szAmmo1[MAX_WEAPON_AMMO_NAME];
char szWorldDroppedModel[MAX_WEAPON_STRING];
char szAnimationPrefix[MAX_WEAPON_PREFIX];
int iSlot;
int iPosition;
int iMaxClip1;
int iMaxClip2;
int iDefaultClip1;
int iDefaultClip2;
int iWeight;
int iRumbleEffect;
bool bAutoSwitchTo;
bool bAutoSwitchFrom;
int iFlags;
char szAmmo2[MAX_WEAPON_AMMO_NAME];
char szAIAddOn[MAX_WEAPON_STRING];
// Sound blocks
char aShootSounds[NUM_SHOOT_SOUND_TYPES][MAX_WEAPON_STRING];
int iAmmoType;
int iAmmo2Type;
bool m_bMeleeWeapon;
// This tells if the weapon was built right-handed (defaults to true).
// This helps cl_righthand make the decision about whether to flip the model or not.
bool m_bBuiltRightHanded;
bool m_bAllowFlipping;
// Sprite data, read from the data file
int iSpriteCount;
CHudTexture* iconActive;
CHudTexture* iconInactive;
CHudTexture* iconAmmo;
CHudTexture* iconAmmo2;
CHudTexture* iconCrosshair;
CHudTexture* iconAutoaim;
CHudTexture* iconZoomedCrosshair;
CHudTexture* iconZoomedAutoaim;
CHudTexture* iconSmall;
};
struct CCSWeaponInfo
{
float GetRangeModifier()
{
return flRangeModifier;
}
float GetPenetration()
{
return flPenetration;
}
int GetDamage()
{
return iDamage;
}
float GetRange()
{
return flRange;
}
float GetWeaponArmorRatio()
{
return flArmorRatio;
}
CSWeaponType GetWeaponType()
{
return (CSWeaponType)iWeaponType;
}
virtual ~CCSWeaponInfo() {};
/*Parse(KeyValues *, char const*)
RefreshDynamicParameters(void)
GetPrimaryClipSize(C_EconItemView const*, int, float)const
GetSecondaryClipSize(C_EconItemView const*, int, float)const
GetDefaultPrimaryClipSize(C_EconItemView const*, int, float)const
GetDefaultSecondaryClipSize(C_EconItemView const*, int, float)const
GetPrimaryReserveAmmoMax(C_EconItemView const*, int, float)const
GetSecondaryReserveAmmoMax(C_EconItemView const*, int, float)const*/
char* consoleName; // 0x0004
char pad_0008[12]; // 0x0008
int iMaxClip1; // 0x0014
int iMaxClip2; // 0x0018
int iDefaultClip1; // 0x001C
int iDefaultClip2; // 0x0020
char pad_0024[8]; // 0x0024
char* szWorldModel; // 0x002C
char* szViewModel; // 0x0030
char* szDroppedModel; // 0x0034
char pad_0038[4]; // 0x0038
char* N0000023E; // 0x003C
char pad_0040[56]; // 0x0040
char* szEmptySound; // 0x0078
char pad_007C[4]; // 0x007C
char* szBulletType; // 0x0080
char pad_0084[4]; // 0x0084
char* szHudName; // 0x0088
char* szWeaponName; // 0x008C
char pad_0090[56]; // 0x0090
int iWeaponType; // 0x00C8
int iWeaponPrice; // 0x00CC
int iKillAward; // 0x00D0
char* szAnimationPrefix; // 0x00D4
float flCycleTime; // 0x00D8
float flCycleTimeAlt; // 0x00DC
float flTimeToIdle; // 0x00E0
float flIdleInterval; // 0x00E4
bool bFullAuto; // 0x00E8
char pad_0x00E5[3]; // 0x00E9
int iDamage; // 0x00EC
float flArmorRatio; // 0x00F0
int iBullets; // 0x00F4
float flPenetration; // 0x00F8
float flFlinchVelocityModifierLarge; // 0x00FC
float flFlinchVelocityModifierSmall; // 0x0100
float flRange; // 0x0104
float flRangeModifier; // 0x0108
float flThrowVelocity; // 0x010C
char pad_0x010C[12]; // 0x0110
bool bHasSilencer; // 0x011C
char pad_0x0119[3]; // 0x011D
char* pSilencerModel; // 0x0120
int iCrosshairMinDistance; // 0x0124
int iCrosshairDeltaDistance;// 0x0128 - iTeam?
float flMaxPlayerSpeed; // 0x012C
float flMaxPlayerSpeedAlt; // 0x0130
float flSpread; // 0x0134
float flSpreadAlt; // 0x0138
float flInaccuracyCrouch; // 0x013C
float flInaccuracyCrouchAlt; // 0x0140
float flInaccuracyStand; // 0x0144
float flInaccuracyStandAlt; // 0x0148
float flInaccuracyJumpInitial;// 0x014C
float flInaccuracyJump; // 0x0150
float flInaccuracyJumpAlt; // 0x0154
float flInaccuracyLand; // 0x0158
float flInaccuracyLandAlt; // 0x015C
float flInaccuracyLadder; // 0x0160
float flInaccuracyLadderAlt; // 0x0164
float flInaccuracyFire; // 0x0168
float flInaccuracyFireAlt; // 0x016C
float flInaccuracyMove; // 0x0170
float flInaccuracyMoveAlt; // 0x0174
float flInaccuracyReload; // 0x0178
int iRecoilSeed; // 0x017C
float flRecoilAngle; // 0x0180
float flRecoilAngleAlt; // 0x0184
float flRecoilAngleVariance; // 0x0188
float flRecoilAngleVarianceAlt; // 0x018C
float flRecoilMagnitude; // 0x0190
float flRecoilMagnitudeAlt; // 0x0194
float flRecoilMagnitudeVariance; // 0x0198
float flRecoilMagnitudeVarianceAlt; // 0x019C
float flRecoveryTimeCrouch; // 0x01A0
float flRecoveryTimeStand; // 0x01A4
float flRecoveryTimeCrouchFinal; // 0x01A8
float flRecoveryTimeStandFinal; // 0x01AC
int iRecoveryTransitionStartBullet;// 0x01B0
int iRecoveryTransitionEndBullet; // 0x01B4
bool bUnzoomAfterShot; // 0x01B8
bool bHideViewModelZoomed; // 0x01B9
char pad_0x01B5[2]; // 0x01BA
char iZoomLevels[3]; // 0x01BC
int iZoomFOV[2]; // 0x01C0
float fZoomTime[3]; // 0x01C4
char* szWeaponClass; // 0x01D4
float flAddonScale; // 0x01D8
char pad_0x01DC[4]; // 0x01DC
char* szEjectBrassEffect; // 0x01E0
char* szTracerEffect; // 0x01E4
int iTracerFrequency; // 0x01E8
int iTracerFrequencyAlt; // 0x01EC
char* szMuzzleFlashEffect_1stPerson; // 0x01F0
char pad_0x01F4[4]; // 0x01F4
char* szMuzzleFlashEffect_3rdPerson; // 0x01F8
char pad_0x01FC[4]; // 0x01FC
char* szMuzzleSmokeEffect; // 0x0200
float flHeatPerShot; // 0x0204
char* szZoomInSound; // 0x0208
char* szZoomOutSound; // 0x020C
float flInaccuracyPitchShift; // 0x0210
float flInaccuracySoundThreshold; // 0x0214
float flBotAudibleRange; // 0x0218
char pad_0x0218[8]; // 0x0220
char* pWrongTeamMsg; // 0x0224
bool bHasBurstMode; // 0x0228
char pad_0x0225[3]; // 0x0229
bool bIsRevolver; // 0x022C
bool bCannotShootUnderwater; // 0x0230
};
class C_BaseCombatWeapon: public C_BaseAttributableItem
{
public:
HANDLE GetOwner()
{
return *(HANDLE*)((uintptr_t)this + NetVars::DT_BaseCombatWeapon::m_hOwner);
}
int GetAmmo()
{
return *(int*)((uintptr_t)this + NetVars::DT_BaseCombatWeapon::m_iClip1);
}
float GetNextPrimaryAttack()
{
return *(float*)((uintptr_t)this + NetVars::DT_BaseCombatWeapon::m_flNextPrimaryAttack);
}
bool GetInReload()
{
return *(bool*)((uintptr_t)this + NetVars::DT_BaseCombatWeapon::m_bInReload);
}
int GetReserveAmmo()
{
return *(int*)((uintptr_t)this + NetVars::DT_BaseCombatWeapon::m_iPrimaryReserveAmmoCount);
}
float GetAccuracyPenalty()
{
return *(float*)((uintptr_t)this + NetVars::DT_WeaponCSBase::m_fAccuracyPenalty);
}
CCSWeaponInfo* GetCSWpnData()
{
// crashes in wrong thread. update 9/1/2017
typedef CCSWeaponInfo*(__thiscall* ogFN)(void*);
return getvfunc<ogFN>(this, 446)(this);
}
CCSWeaponInfo* GetCSWpnData2()
{
typedef CCSWeaponInfo*(__thiscall* ogFN)(void*);
return getvfunc<ogFN>(this, 446)(this);
}
float GetInaccuracy()
{
typedef float (__thiscall* oGetInaccuracy)(void*);
return getvfunc<oGetInaccuracy>(this, 469)(this); // 552
}
float GetSpread()
{
typedef float (__thiscall* oGetSpread)(void*);
return getvfunc<oGetSpread>(this, 439)(this); // 553
}
void UpdateAccuracyPenalty()
{
typedef void (__thiscall* oUpdateAccuracyPenalty)(void*);
return getvfunc<oUpdateAccuracyPenalty>(this, 470)(this); // 554
}
};
class C_WeaponC4 : public C_BaseCombatWeapon
{
public:
bool GetStartedArming()
{
return *(bool*)((uintptr_t)this + NetVars::DT_WeaponC4::m_bStartedArming);
}
};
class C_Chicken : public C_BaseEntity
{
public:
bool* GetShouldGlow()
{
return (bool*)((uintptr_t)this + NetVars::DT_DynamicProp::m_bShouldGlow);
}
};
class C_BaseCSGrenade : public C_BaseCombatWeapon
{
public:
bool IsHeldByPlayer()
{
return *(bool*)((uintptr_t)this + NetVars::DT_BaseCSGrenade::m_bIsHeldByPlayer);
}
bool GetPinPulled()
{
return *(bool*)((uintptr_t)this + NetVars::DT_BaseCSGrenade::m_bPinPulled);
}
float GetThrowTime()
{
return *(float*)((uintptr_t)this + NetVars::DT_BaseCSGrenade::m_fThrowTime);
}
float GetThrowStrength()
{
return *(float*)((uintptr_t)this + NetVars::DT_BaseCSGrenade::m_flThrowStrength);
}
};
| [
"abhishekgola@hotmail.com"
] | abhishekgola@hotmail.com |
366ed55c1bcfb13453f530e712dd6b6ed66b3eac | 5a1b53b7a9158e53b8c4bcb21bc560d0ae6d6584 | /MinesweeperBot.cpp | 1daf61b6dca99c96785c9e1634ed03ab4b4a6ed5 | [
"MIT"
] | permissive | DanielDantasL/MinesweeperSatisfiabilityChecker | f3948cd624f492c151d55824be276f3a737d844e | 65504014d6d046905fbf0b722626cc882d2339d7 | refs/heads/master | 2021-07-13T08:03:45.175097 | 2020-09-12T21:06:47 | 2020-09-12T21:06:47 | 204,786,126 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,573 | cpp | #include <iostream>
#include "MinesweeperBot.h"
int MinesweeperBot::ChooseCellToReveal(MinesweeperInstance instance) {
// iterate through all grid cells
int unrevealed = 0;
for (int i = 0; i < instance.Columns; ++i) {
for (int j = 0; j < instance.Rows; ++j) {
int current = instance.RevealedGrid[i][j];
if (current == MinesweeperInstance::UNREVEALED_CELL) {
unrevealed++;
continue;
} else if (current >= 1 && current <= 8) {
int neighboringBombs = instance.RevealedNeighboringBombs(i, j);
int unrevealedNeighbors = instance.UnrevealedNeighbors(i, j);
if (neighboringBombs == current && unrevealedNeighbors > 0) {
for (int k = i - 1; k <= i + 1; k++) {
for (int l = j - 1; l <= j + 1; l++) {
if (!instance.IndexesAreValid(k, l) ||
instance.RevealedGrid[k][l] != MinesweeperInstance::UNREVEALED_CELL)
continue;
// choose unrevealed space
return l * instance.Rows + k;
}
}
}
if (neighboringBombs + unrevealedNeighbors == current) {
for (int k = i - 1; k <= i + 1; k++) {
for (int l = j - 1; l <= j + 1; l++) {
if (!instance.IndexesAreValid(k, l) ||
instance.RevealedGrid[k][l] != MinesweeperInstance::UNREVEALED_CELL)
continue;
// choose unrevealed space (negative to signalize that it is marking a bomb)
return -(l * instance.Rows + k);
}
}
}
}
}
}
// Grid is completely unrevealed
if (unrevealed == instance.Rows * instance.Columns) {
// choose blindly
return 0;
}
// heuristic
int maxScore = INT32_MIN, maxScore_i = 0, maxScore_j = 0;
for (int i = 0; i < instance.Columns; ++i) {
for (int j = 0; j < instance.Rows; ++j) {
int current = instance.RevealedGrid[i][j];
if (current != MinesweeperInstance::UNREVEALED_CELL) continue;
MinesweeperInstance dummy = instance.CopyFromRevealedGrid();
dummy.RevealAt(i, j, true);
int score = CalculateInstanceScore(dummy);
if (score > maxScore) {
maxScore = score;
maxScore_i = i;
maxScore_j = j;
}
}
}
return -(maxScore_j * instance.Rows + maxScore_i);
}
int MinesweeperBot::CalculateInstanceScore(MinesweeperInstance instance) {
int minInstanceScore = INT32_MAX;
int roundScore = INT32_MAX - 1;
while (roundScore < minInstanceScore) {
minInstanceScore = roundScore;
roundScore = 0;
for (int i = 0; i < instance.Columns; ++i) {
for (int j = 0; j < instance.Rows; ++j) {
int current = instance.RevealedGrid[i][j];
if (current < 0 || current > 8) continue;
int cellScore = instance.RevealedNeighboringBombs(i, j) - current;
for (int k = i - 1; k <= i + 1; k++) {
for (int l = j - 1; l <= j + 1; l++) {
if (!instance.IndexesAreValid(k, l) || instance.RevealedGrid[k][l] <= 8) continue;
instance.RevealedGrid[k][l] -= cellScore;
}
}
roundScore += cellScore;
}
}
// reset unrevealed scores
int maxUnrevealedScore = INT32_MIN;
int maxUnrevealedScore_i = -1;
int maxUnrevealedScore_j = -1;
for (int i = 0; i < instance.Columns; ++i) {
for (int j = 0; j < instance.Rows; ++j) {
int current = instance.RevealedGrid[i][j];
if (current <= 8) continue;
if (instance.RevealedGrid[i][j] > maxUnrevealedScore){
maxUnrevealedScore = instance.RevealedGrid[i][j];
maxUnrevealedScore_i = i;
maxUnrevealedScore_j = j;
}
instance.RevealedGrid[i][j] = MinesweeperInstance::UNREVEALED_CELL;
}
}
instance.AddBombAt(maxUnrevealedScore_i, maxUnrevealedScore_j);
}
return minInstanceScore;
}
| [
"daniel.leite.dantas@gmail.com"
] | daniel.leite.dantas@gmail.com |
480e919272e8f8f8c53ef926b73b73cec04c2a81 | ad9c73a5434aa79fd7806b90934bc88e1a3d0699 | /src/Foundational/iwcrex/_iwgrep25regex.cc | 4a311e5ec5a98c8a9568811bfdee35d64ea15d6a | [
"Apache-2.0"
] | permissive | michaelweiss092/LillyMol | 8daa229a2b12e39e388c6170e480698fe0929c1f | a2b7d1d8a07ef338c754a0a2e3b2624aac694cc9 | refs/heads/master | 2022-11-30T16:47:03.692415 | 2020-08-12T21:18:33 | 2020-08-12T21:18:33 | 287,117,357 | 0 | 0 | Apache-2.0 | 2020-08-12T21:18:34 | 2020-08-12T21:18:06 | null | UTF-8 | C++ | false | false | 202 | cc | #include <stdlib.h>
#include <iostream>
using namespace std;
#define IWCREX_IMPLEMENTATION
#include "iwcrex.h"
#include "iwgrep-2.5.h"
template class IW_Regular_Expression_Template<IW_grep_25_regex>;
| [
"huang_zhen@network.lilly.com"
] | huang_zhen@network.lilly.com |
be52dfd303832b3a83d91e90e2cb909e49369c9d | a5f35d0dfaddb561d3595c534b6b47f304dbb63d | /Source/BansheeD3D11RenderAPI/BsD3D11TimerQuery.cpp | f2e06744c095eb5f3e38a0b950a86baaa2a79477 | [] | no_license | danielkrupinski/BansheeEngine | 3ff835e59c909853684d4985bd21bcfa2ac86f75 | ae820eb3c37b75f2998ddeaf7b35837ceb1bbc5e | refs/heads/master | 2021-05-12T08:30:30.564763 | 2018-01-27T12:55:25 | 2018-01-27T12:55:25 | 117,285,819 | 1 | 0 | null | 2018-01-12T20:38:41 | 2018-01-12T20:38:41 | null | UTF-8 | C++ | false | false | 3,712 | cpp | //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
//**************** Copyright (c) 2016 Marko Pintera (marko.pintera@gmail.com). All rights reserved. **********************//
#include "BsD3D11TimerQuery.h"
#include "BsD3D11RenderAPI.h"
#include "BsD3D11Device.h"
#include "BsD3D11CommandBuffer.h"
#include "Profiling/BsRenderStats.h"
#include "Debug/BsDebug.h"
namespace bs { namespace ct
{
D3D11TimerQuery::D3D11TimerQuery(UINT32 deviceIdx)
:mFinalized(false), mContext(nullptr), mBeginQuery(nullptr),
mEndQuery(nullptr), mDisjointQuery(nullptr), mTimeDelta(0.0f), mQueryEndCalled(false)
{
assert(deviceIdx == 0 && "Multiple GPUs not supported natively on DirectX 11.");
D3D11RenderAPI* rs = static_cast<D3D11RenderAPI*>(RenderAPI::instancePtr());
D3D11Device& device = rs->getPrimaryDevice();
D3D11_QUERY_DESC queryDesc;
queryDesc.Query = D3D11_QUERY_TIMESTAMP_DISJOINT;
queryDesc.MiscFlags = 0;
HRESULT hr = device.getD3D11Device()->CreateQuery(&queryDesc, &mDisjointQuery);
if(hr != S_OK)
{
BS_EXCEPT(RenderingAPIException, "Failed to create a timer query.");
}
queryDesc.Query = D3D11_QUERY_TIMESTAMP;
hr = device.getD3D11Device()->CreateQuery(&queryDesc, &mBeginQuery);
if(hr != S_OK)
{
BS_EXCEPT(RenderingAPIException, "Failed to create a timer query.");
}
hr = device.getD3D11Device()->CreateQuery(&queryDesc, &mEndQuery);
if(hr != S_OK)
{
BS_EXCEPT(RenderingAPIException, "Failed to create a timer query.");
}
mContext = device.getImmediateContext();
BS_INC_RENDER_STAT_CAT(ResCreated, RenderStatObject_Query);
}
D3D11TimerQuery::~D3D11TimerQuery()
{
if(mBeginQuery != nullptr)
mBeginQuery->Release();
if(mEndQuery != nullptr)
mEndQuery->Release();
if(mDisjointQuery != nullptr)
mDisjointQuery->Release();
BS_INC_RENDER_STAT_CAT(ResDestroyed, RenderStatObject_Query);
}
void D3D11TimerQuery::begin(const SPtr<CommandBuffer>& cb)
{
auto execute = [&]()
{
mContext->Begin(mDisjointQuery);
mContext->End(mBeginQuery);
mQueryEndCalled = false;
setActive(true);
};
if (cb == nullptr)
execute();
else
{
SPtr<D3D11CommandBuffer> d3d11cb = std::static_pointer_cast<D3D11CommandBuffer>(cb);
d3d11cb->queueCommand(execute);
}
}
void D3D11TimerQuery::end(const SPtr<CommandBuffer>& cb)
{
auto execute = [&]()
{
mContext->End(mEndQuery);
mContext->End(mDisjointQuery);
mQueryEndCalled = true;
mFinalized = false;
};
if (cb == nullptr)
execute();
else
{
SPtr<D3D11CommandBuffer> d3d11cb = std::static_pointer_cast<D3D11CommandBuffer>(cb);
d3d11cb->queueCommand(execute);
}
}
bool D3D11TimerQuery::isReady() const
{
if (!mQueryEndCalled)
return false;
D3D11_QUERY_DATA_TIMESTAMP_DISJOINT disjointData;
return mContext->GetData(mDisjointQuery, &disjointData, sizeof(disjointData), 0) == S_OK;
}
float D3D11TimerQuery::getTimeMs()
{
if(!mFinalized && isReady())
{
finalize();
}
return mTimeDelta;
}
void D3D11TimerQuery::finalize()
{
UINT64 timeStart, timeEnd;
mContext->GetData(mBeginQuery, &timeStart, sizeof(timeStart), 0);
mContext->GetData(mEndQuery, &timeEnd, sizeof(timeEnd), 0);
D3D11_QUERY_DATA_TIMESTAMP_DISJOINT disjointData;
mContext->GetData(mDisjointQuery, &disjointData, sizeof(disjointData), 0);
float time = 0.0f;
if(disjointData.Disjoint == FALSE)
{
float frequency = static_cast<float>(disjointData.Frequency);
UINT64 delta = timeEnd - timeStart;
mTimeDelta = (delta / (float)frequency) * 1000.0f;
}
else
{
LOGWRN_VERBOSE("Unrealiable GPU timer query detected.");
}
}
}} | [
"bearishsun@gmail.com"
] | bearishsun@gmail.com |
d8f4fde977695299bd66b2c19e1937d5206dd78d | 86352d0205649ed3997b8d0ff44d330d874e0919 | /motionplanner/rai/rai/LGP/LGP_tree.h | edc76ae968ef2d4ccdf0caa8edb6c729e306b1dc | [
"MIT"
] | permissive | hageldave/2020-VINCI-VisNLP | 2bed137ad71f392d4a57c5b8724353f0d81d2312 | 1f6b1a92b674dc3858a6a0a5aee5b158e9a72650 | refs/heads/main | 2023-04-17T22:01:23.107454 | 2021-05-05T13:34:06 | 2021-05-05T13:34:06 | 302,632,434 | 0 | 0 | null | 2020-10-14T13:22:55 | 2020-10-09T12:18:31 | C++ | UTF-8 | C++ | false | false | 4,942 | h | /* ------------------------------------------------------------------
Copyright (c) 2017 Marc Toussaint
email: marc.toussaint@informatik.uni-stuttgart.de
This code is distributed under the MIT License.
Please see <root-path>/LICENSE for details.
-------------------------------------------------------------- */
#pragma once
#include "LGP_node.h"
#include <Core/thread.h>
struct KinPathViewer;
struct LGP_Tree;
typedef rai::Array<rai::Transformation> TransformationA;
void initFolStateFromKin(FOL_World& L, const rai::KinematicWorld& K);
struct LGP_Tree_SolutionData : GLDrawer {
LGP_Tree& tree;
LGP_Node *node; ///< contains costs, constraints, and solutions for each level
rai::String decisions;
rai::Array<ptr<rai::Mesh>> geoms; ///< for display
rai::Array<TransformationA> paths; ///< for display
uint displayStep=0;
LGP_Tree_SolutionData(LGP_Tree& _tree, LGP_Node *_node);
void write(ostream &os) const;
void glDraw(struct OpenGL&gl);
};
struct LGP_Tree : GLDrawer {
int verbose;
uint numSteps;
ofstream fil;
bool displayTree=true;
BoundType displayBound=BD_seqPath;
bool collisions=false;
bool useSwitches=true;
struct DisplayThread *dth=NULL;
rai::String dataPath;
arr cameraFocus;
bool firstTimeDisplayTree=true;
LGP_Node *root=0, *focusNode=0;
FOL_World fol;
rai::KinematicWorld kin;
KOMO finalGeometryObjectives;
rai::Array<std::shared_ptr<KinPathViewer>> views; //displays for the 3 different levels
//-- these are lists or queues; I don't maintain them sorted because their evaluation (e.g. f(n)=g(n)+h(n)) changes continuously
// while new bounds are computed. Therefore, whenever I pop from these lists, I find the minimum w.r.t. a heuristic. The
// heuristics are defined in main.cpp currently
LGP_NodeL fringe_expand;//list of nodes to be expanded next
LGP_NodeL terminals; //list of found terminals
LGP_NodeL fringe_pose; //list of nodes that can be pose tested (parent has been tested)
LGP_NodeL fringe_poseToGoal; //list of nodes towards a terminal -> scheduled for pose testing
LGP_NodeL fringe_seq; //list of terminal nodes that have been pose tested
LGP_NodeL fringe_path; //list of terminal nodes that have been seq tested
LGP_NodeL fringe_solved; //list of terminal nodes that have been path tested
Var<rai::Array<LGP_Tree_SolutionData*>> solutions;
//high-level
LGP_Tree();
LGP_Tree(const rai::KinematicWorld& _kin, const char *folFileName="fol.g");
LGP_Tree(const rai::KinematicWorld& _kin, const FOL_World& _fol);
~LGP_Tree();
//-- methods called in the run loop
private:
LGP_Node* getBest(LGP_NodeL& fringe, uint level);
LGP_Node* popBest(LGP_NodeL& fringe, uint level);
LGP_Node* getBest() { return getBest(fringe_solved, 3); }
LGP_Node *expandNext(int stopOnLevel=-1, LGP_NodeL* addIfTerminal=NULL);
void optBestOnLevel(BoundType bound, LGP_NodeL& drawFringe, BoundType drawBound, LGP_NodeL* addIfTerminal, LGP_NodeL* addChildren);
void optFirstOnLevel(BoundType bound, LGP_NodeL& fringe, LGP_NodeL* addIfTerminal);
void clearFromInfeasibles(LGP_NodeL& fringe);
public:
void run(uint steps=10000);
void init();
void step();
void buildTree(uint depth);
void getSymbolicSolutions(uint depth);
void optFixedSequence(const rai::String& seq, BoundType specificBound=BD_all, bool collisions=false);
void optMultiple(const StringA& seqs);
//-- work directly on the tree
LGP_Node* walkToNode(const rai::String& seq);
// output
uint numFoundSolutions();
rai::String report(bool detailed=false);
void reportEffectiveJoints();
void displayTreeUsingDot();
void initDisplay();
void updateDisplay();
void renderToVideo(int specificBound=-1, const char* filePrefix="vid/");
void writeNodeList(ostream& os=cout);
void glDraw(struct OpenGL&gl);
//-- kind of a gui:
void printChoices();
rai::String queryForChoice();
bool execChoice(rai::String cmd);
bool execRandomChoice();
//-- inspection and debugging
void inspectSequence(const rai::String& seq);
void player(StringA cmds={});
};
struct LGP_Tree_Thread : LGP_Tree, Thread{
LGP_Tree_Thread(const rai::KinematicWorld& _kin, const char *folFileName="fol.g")
: LGP_Tree(_kin, folFileName), Thread("LGP_Tree", -1){}
void open(){ LGP_Tree::init(); }
void step(){ LGP_Tree::step(); }
void close(){}
//convenience to retrieve solution data
uint numSolutions(){ return solutions.get()->N; }
const std::shared_ptr<KOMO>& getKOMO(uint i, BoundType bound){
const auto &komo = solutions.get()->elem(i)->node->komoProblem(bound);
CHECK(komo, "solution " <<i <<" has not evaluated the bound " <<bound <<" -- returning KOMO reference to nil");
return komo;
}
Graph getReport(uint i, BoundType bound){
const auto &komo = getKOMO(i, bound);
if(!komo) return Graph();
return komo->getProblemGraph(true);
}
};
| [
"haegeldd@kwela.visus.uni-stuttgart.de"
] | haegeldd@kwela.visus.uni-stuttgart.de |
2a8f2ba7b0a0bc7321ce21546200855d9dcc60de | 6d23de84c23b8d81a9ede03f1825e69c8b4fa646 | /Classes/MyActionScene3.h | a701ecc1fed0a43cab03b37dd494be9f5c967572 | [
"MIT"
] | permissive | zhaogaoxing/demo2 | b81cd4071433296bbc4e69829d9a8c18034f434c | 8f9c6f2fdc208c65e7d829eb321bd14f2821008e | refs/heads/master | 2021-01-19T02:52:52.694625 | 2016-08-15T07:34:39 | 2016-08-15T07:34:39 | 65,266,907 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 614 | h | #ifndef __MyActionScene3_SCENE_H__
#define __MyActionScene3_SCENE_H__
#include "cocos2d.h"
#include "PlayScene3.h"
class MyAction3 : public cocos2d::Layer
{
cocos2d::Sprite * sprite;
public:
static cocos2d::Scene* createScene();
virtual bool init();
void goMenu(cocos2d::Ref * pSender);
void backMenu(cocos2d::Ref * pSender);
void OnSequence(cocos2d::Ref * pSender);
void OnSpawn(cocos2d::Ref * pSender);
void OnRepeat(cocos2d::Ref * pSender);
void OnReverse(cocos2d::Ref * pSender);
void OnRepeatForever(cocos2d::Ref * pSender);
CREATE_FUNC(MyAction3);
};
#endif // __MyActionScene3_SCENE_H__ | [
"865072432@qq.com"
] | 865072432@qq.com |
4a106fa7fd4ec362cad6a826bcc6d0a17bb6a781 | 1e8413ac67187691e8e4731542889b78547adbca | /raytracing/Writer.cpp | ed7e389da931b61e887ed3c1a59cc7e561d7741b | [
"MIT"
] | permissive | arthurflor23/ray-tracing | 99f3aefd1f15af7ef2b81e91e891e39cbf71cb4a | 8deedf33446bed259d8f7e2895024fd1300eb439 | refs/heads/master | 2021-10-27T13:55:02.605236 | 2019-04-17T15:32:51 | 2019-04-17T15:32:51 | 37,202,311 | 4 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,563 | cpp |
#include "headers/Writer.hpp"
#include "headers/NoArvore.hpp"
#include "headers/Object.hpp"
#include "headers/Triangle.hpp"
using namespace arma;
using namespace std;
Writer::Writer(const char *txt, const vector<Light> luz, const mat keye, const Ambient ambiente, NoArvore * No){
int resolucao[2];
vector<Pixels *> pixel;
vec origem;
origem << 0 << 0 << 0;
resolucao[0] = keye(0,2)*2;
resolucao[1] = keye(1,2)*2;
for (int w=0;w<resolucao[1];w++){
for (int z=0;z<resolucao[0];z++){
pixel.push_back(new Pixels(z, w));
}
}
#pragma omp parallel for
for (int j=0; j<resolucao[0]*resolucao[1]; j++){
double Tmin=numeric_limits<double>::max(), T=numeric_limits<double>::min();
int indice=0;
vec d, vetor;
bool colide=false;
NoArvore * NoAtual;
vetor << (int)pixel[j]->getXY()(0) << (int)pixel[j]->getXY()(1) << 1;
d = keye.i() * vetor;
Ray r = Ray(origem, d);
NoAtual = NoArvore::percorrerArvore(No, r, colide, Tmin, T, indice);
if (colide && luz.size()!=0){
pixel[j]->color(NoAtual->getObjetos()[indice]->cor(d*Tmin, luz, NoAtual->getObjetos(), ambiente, vetor, indice));
}
else{
pixel[j]->color(ambiente.GetKa());
}
}
ofstream arq (txt, ios_base::out);
arq << "P3" << endl << resolucao[0] << " " << resolucao[1] << endl << 255 << endl;
for (unsigned int i=0;i<pixel.size();i++){
arq << pixel[i]->getR() << " " << pixel[i]->getG() << " " << pixel[i]->getB() << endl;
}
arq.close();
}
| [
"arthurflor23@gmail.com"
] | arthurflor23@gmail.com |
f992a5d8642d04164fc06302827ffe3eaca14ab5 | 07daa3f8bfc9dbd19e6fb6b53a7b8fc8572907e2 | /log.cpp | 829e09f7e0090884ce1d5e354a9cc7e2503f3447 | [] | no_license | ycqiu/snake | 7280ef4d3c6e49526eb7f3aaea0d1583f422e10a | 2b0a18ec42fcac3d6f9cf8d419f9b3d730a633b8 | refs/heads/master | 2021-01-01T04:11:54.491388 | 2016-05-04T10:42:16 | 2016-05-04T10:42:16 | 57,045,783 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,287 | cpp | #include "log.h"
#include <string.h>
using namespace std;
Log& Log::create(const std::string& n, const std::string& p, int mult_thread, int l)
{
static Log log(n, p, mult_thread, l);
return log;
}
Log::Log(const std::string& n, const std::string& p,
int mult_thread, int l):
name(n), path(p), level(l), file(NULL), using_mult_thread(mult_thread)
{
next_time = time(NULL);
next_time = (next_time / DAY_SECONDS + 1) * DAY_SECONDS;
if(using_mult_thread)
{
pthread_mutex_init(&mutex, NULL);
}
open_new_file();
}
bool Log::need_open_new_file()
{
time_t now_time = time(NULL);
return now_time >= next_time;
}
int Log::open_new_file()
{
std::string full_path = path + "/" + name;
std::string day;
get_year_month_day(day);
full_path += "_" + day + ".log";
file = fopen(full_path.c_str(), "a+");
if(file == NULL)
{
return -1;
}
return 0;
}
void Log::release_file()
{
if(file)
{
fclose(file);
file = NULL;
}
}
Log::~Log()
{
release_file();
if(using_mult_thread)
{
pthread_mutex_destroy(&mutex);
using_mult_thread = false;
}
}
void Log::update_next_time()
{
next_time += DAY_SECONDS;
}
int Log::print(int l, const char* file_name, int line,
const char* func, const char* fmt, ...)
{
if(level != Log::ALL && level < l)
{
return -1;
}
lock();
if(need_open_new_file())
{
release_file();
if(open_new_file())
{
unlock();
return -2;
}
update_next_time();
}
if(file == NULL)
{
unlock();
return -3;
}
std::string msg;
switch(l)
{
case DEBUG:
msg = "debug";
break;
case INFO:
msg = "info";
break;
case ERROR:
msg = "error";
break;
default:
unlock();
return -4;
}
fprintf(file, "[%s]", msg.c_str());
std::string day, hour, tm;
get_year_month_day(day);
get_hour_min_sec(hour);
tm = day + " " + hour;
fprintf(file, "[%s]", tm.c_str());
fprintf(file, "[%s:%d]", file_name, line);
fprintf(file, "[%s]: ", func);
va_list ap;
va_start(ap, fmt);
vfprintf(file, fmt, ap);
va_end(ap);
fprintf(file, "\n");
fflush(file);
unlock();
return 0;
}
void Log::lock()
{
if(using_mult_thread)
{
pthread_mutex_lock(&mutex);
}
}
void Log::unlock()
{
if(using_mult_thread)
{
pthread_mutex_unlock(&mutex);
}
}
void Log::get_year_month_day(std::string& res)
{
time_t cur_time = time(NULL);
struct tm * timeinfo = localtime(&cur_time);
char buffer[] = {"yyyy-mm-dd"};
strftime(buffer, sizeof(buffer), "%F", timeinfo);
res = std::string(buffer);
}
void Log::get_hour_min_sec(std::string& res)
{
time_t cur_time = time(NULL);
struct tm * timeinfo = localtime(&cur_time);
char buffer[] = {"hh:mm:ss"};
strftime(buffer, sizeof(buffer), "%T", timeinfo);
res = std::string(buffer);
}
Log* LogContainer::log = NULL;
Log* LogContainer::get()
{
return log;
}
Log* LogContainer::create(const char* name, const char* conf)
{
string log_path = ".";
int using_mult_thread = 1;
int level = Log::ALL;
FILE* file = fopen(conf, "r");
if(file)
{
char path[256] = {0};
fscanf(file, "log_path=%s\n", path);
if(strlen(path))
{
log_path = path;
}
fscanf(file, "using_mult_thread=%d\n", &using_mult_thread);
fscanf(file, "level=%d\n", &level);
fclose(file);
}
return log = &Log::create(name, log_path, using_mult_thread, level);
}
| [
"429148848@qq.com"
] | 429148848@qq.com |
3b399866a1dd730b885c1ce6f530b37ca4ba557a | 578aa20177519a89f99e12b71ec1df94241fc7e8 | /US3DTouch/US3DTouch.cpp | cb2c96d92f905fd62f27fe203a1ba8677e3c1102 | [
"MIT"
] | permissive | berardino/haptic | 157244337b4819cb73eaa602b624eef0e7c2b282 | 8cb2bec3566e25baed903cb6159503c20663fb30 | refs/heads/master | 2021-01-22T21:58:45.036080 | 2017-03-20T18:58:02 | 2017-03-20T18:58:02 | 85,495,491 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,228 | cpp | // US3D.cpp: implementation of the US3D class.
//
//////////////////////////////////////////////////////////////////////
#include "US3DTouch.h"
#include <FL/fl_file_chooser.H>
#include "vtkInteractorStyleTrackballCamera.h"
struct ProgressArguments
{
US3DTouch *This;
vtkProcessObject *Process;
char *Label;
Fl_Progress *progress;
};
US3DTouch::US3DTouch()
{
this->m_TransformFilter=vtkTransformFilter::New();
this->m_Transform=vtkTransform::New();
this->m_Transform->GlobalWarningDisplayOff();
this->m_TransformFilter->SetTransform(this->m_Transform);
this->m_CumulateTransform=vtkTransform::New();
this->tmpString=new char[200];
this->init=false;
this->m_DataSetReader=vtkPolyDataReader::New();
this->SetProgress(this->m_DataSetReader,"Loading...",this->m_CProgress);
this->m_CRender->SetInteractorStyle(vtkInteractorStyleTrackballCamera::New());
XMIN = -215;
XMAX = 206;
YMIN = -105;
YMAX = 161;
ZMIN = -105;
ZMAX = 128;
this->m_Rotate=false;
//Init Phantom
this->m_rootSeparator=new gstSeparator;
this->m_ForceControl=new CControlForce;
this->m_Scene=new gstScene;
this->m_Phantom=new gstPHANToM("Default PHANToM");
this->m_Center=new gstPoint;
this->m_AxisX=new gstVector(1,0,0);
this->m_AxisY=new gstVector(0,1,0);
this->m_AxisZ=new gstVector(0,0,1);
this->m_Scene->setRoot(this->m_rootSeparator);
if (!(this->m_Phantom) || !(this->m_Phantom->getValidConstruction())) {
fl_alert("Unable to initialize PHANToM device");
//exit(-1);
}
this->m_Center->init(0,0,0);
this->m_ForceControl->boundByBox(this->m_Center,800,800,800);
this->m_ForceControl->setAttenuationDistance(4);
this->m_rootSeparator->addChild(this->m_Phantom);
this->m_rootSeparator->addChild(this->m_ForceControl);
this->m_ForceControl->SetOBBTree(this->m_CRender->m_OBBTree);
}
US3DTouch::~US3DTouch()
{
delete this->tmpString;
this->m_DataSetReader->Delete();
delete this->m_rootSeparator;
delete this->m_ForceControl;
delete this->m_Scene;
delete this->m_Phantom;
delete this->m_Center;
}
void US3DTouch::Load() {
char * filename = fl_file_chooser("VTK 3D filename","*.vtk","");
if( !filename )
{
return;
}
this->m_Scene->stopServoLoop();
if (!(this->init))
{
this->m_CRender->show();
this->init=true;
Fl::add_timeout(0.03,this->updateGraphicsCallBack,this);
}
this->m_DataSetReader->SetFileName(filename);
this->m_DataSetReader->Update();
this->m_TransformFilter->SetInput(this->m_DataSetReader->GetOutput());
this->m_TransformFilter->Update();
this->m_CRender->m_OBBTree->FreeSearchStructure();
this->m_CRender->SetInput(this->m_TransformFilter->GetOutput());
float f[6];
this->m_CRender->m_Actor->GetBounds(f);
this->m_CRender->m_Renderer->GetActiveCamera()->SetFocalPoint(0,0,0);
this->m_CRender->m_Renderer->GetActiveCamera()->SetPosition(0,0,5*f[5]);
this->m_CRender->m_Renderer->GetActiveCamera()->SetViewUp(0,1,0);
//this->m_CRender->m_Renderer->ResetCamera();
this->m_CRender->m_Renderer->ResetCameraClippingRange(f);
this->m_CRender->draw();
sprintf(this->tmpString,"%d",this->m_DataSetReader->GetOutput()->GetNumberOfCells());
this->m_CNCells->value(this->tmpString);
this->m_ForceControl->Dati=this->m_TransformFilter->GetOutput();
this->m_ForceControl->dx=(5*f[1])/(this->XMAX-this->XMIN);
this->m_ForceControl->dy=(5*f[3])/(this->YMAX-this->YMIN);
this->m_ForceControl->dz=(5*f[5])/(this->ZMAX-this->ZMIN);
/* this->m_ForceControl->dx=1;
this->m_ForceControl->dy=1;
this->m_ForceControl->dz=1;*/
this->m_CServoLoop->value(1);
this->m_CServoLoop->label("Stop servo loop");
this->m_Scene->startServoLoop();
}
void US3DTouch::SetServoLoop()
{
if (this->m_CServoLoop->value()==1)
{
this->m_Scene->startServoLoop();
this->m_CServoLoop->label("Stop servo loop");
}
else
{
this->m_Scene->stopServoLoop();
this->m_CServoLoop->label("Start servo loop");
}
Fl::flush();
}
void US3DTouch::Progress(void *arg)
{
US3DTouch *This=((ProgressArguments*)arg)->This;
This->ProgressCall(arg);
}
void US3DTouch::ProgressCall(void *arg)
{
vtkProcessObject *Process=((ProgressArguments*)arg)->Process;
Fl_Progress *progress=((ProgressArguments*)arg)->progress;
char *Label=((ProgressArguments*)arg)->Label;
float value=Process->GetProgress()*100;
progress->value(value);
if (value==100)
sprintf(this->tmpString,"[%s]","Ready");
else
sprintf(this->tmpString,"%s [%.2f%%]",Label,value);
progress->label(this->tmpString);
Fl::flush();
}
void US3DTouch::SetProgress(vtkProcessObject *process, char *label, Fl_Progress *progress)
{
ProgressArguments *arg=new ProgressArguments;
arg->This=this;
arg->Process=process;
arg->Label=label;
arg->progress=progress;
process->SetProgressMethod(this->Progress,arg);
}
void US3DTouch::SetOpacity() {
this->m_CRender->m_Actor->GetProperty()->SetOpacity(this->m_COpacity->value());
}
void US3DTouch::SetProxyRadius() {
this->m_CRender->SetProxyRadius(this->m_CProxyRadius->value());
}
void US3DTouch::SetOBBTreeView() {
this->m_CRender->m_OBBTreeActor[this->m_CRender->m_Level]->SetVisibility(this->m_COBBTreeView->value());
if (this->m_COBBTreeView->value()==0)
this->m_COBBTreeLevel->deactivate();
else
this->m_COBBTreeLevel->activate();
}
void US3DTouch::SetOBBTreeSurfaceType() {
int t=this->m_COBBTreeSurfaceType->value();
for (int i=0;i<this->m_CRender->m_MaxLevel;i++)
if (t==1) this->m_CRender->m_OBBTreeActor[i]->GetProperty()->SetRepresentationToSurface();
else this->m_CRender->m_OBBTreeActor[i]->GetProperty()->SetRepresentationToWireframe();
}
void US3DTouch::SetOBBTreeOpacity() {
for (int i=0;i<this->m_CRender->m_MaxLevel;i++)
this->m_CRender->m_OBBTreeActor[i]->GetProperty()->SetOpacity(this->m_COBBTreeOpacity->value());
}
void US3DTouch::SetOBBTreeLevel() {
this->m_CRender->SetViewOBBTreeLevel(this->m_COBBTreeLevel->value());
}
void US3DTouch::SetDamping()
{
this->m_ForceControl->D=this->m_CDamping->value();
}
void US3DTouch::SetElastic()
{
this->m_ForceControl->K=this->m_CElastic->value();
}
void US3DTouch::updateGraphicsCallBack(void* Object)
{
US3DTouch *This=(US3DTouch*)Object;
This->updateGraphics();
Fl::add_timeout(0.03,This->updateGraphicsCallBack,This);
}
void US3DTouch::updateGraphics()
{
float *pos=this->m_ForceControl->GetPhantomProxy();
float *scp=this->m_ForceControl->GetSCP();
sprintf(this->tmpString,"%.2f",pos[0]);
this->m_CPhantomProxy_X->value(this->tmpString);
sprintf(this->tmpString,"%.2f",pos[1]);
this->m_CPhantomProxy_Y->value(this->tmpString);
sprintf(this->tmpString,"%.2f",pos[2]);
this->m_CPhantomProxy_Z->value(this->tmpString);
sprintf(this->tmpString,"%.2f",scp[0]);
this->m_CPhantomSCP_X->value(this->tmpString);
sprintf(this->tmpString,"%.2f",scp[1]);
this->m_CPhantomSCP_Y->value(this->tmpString);
sprintf(this->tmpString,"%.2f",scp[2]);
this->m_CPhantomSCP_Z->value(this->tmpString);
sprintf(this->tmpString,"%.0f",this->m_ForceControl->m_Velocity[0]);
this->m_CPhantomVelocity_X->value(this->tmpString);
sprintf(this->tmpString,"%.0f",this->m_ForceControl->m_Velocity[1]);
this->m_CPhantomVelocity_Y->value(this->tmpString);
sprintf(this->tmpString,"%.0f",this->m_ForceControl->m_Velocity[2]);
this->m_CPhantomVelocity_Z->value(this->tmpString);
sprintf(this->tmpString,"%.3f",this->m_ForceControl->m_Force[0]);
this->m_CPhantomForce_X->value(this->tmpString);
sprintf(this->tmpString,"%.3f",this->m_ForceControl->m_Force[1]);
this->m_CPhantomForce_Y->value(this->tmpString);
sprintf(this->tmpString,"%.3f",this->m_ForceControl->m_Force[2]);
this->m_CPhantomForce_Z->value(this->tmpString);
sprintf(this->tmpString,"%.3f",this->m_ForceControl->m_Delta-this->m_ForceControl->m_PenetrationOffset);
this->m_CPhantomDelta->value(this->tmpString);
sprintf(this->tmpString,"%.3f",this->m_ForceControl->m_ForceSize);
this->m_CPhantomForceSize->value(this->tmpString);
sprintf(this->tmpString,"%.2f Hz",this->m_Phantom->getAverageUpdateRate());
this->m_CUpdateRate->value(this->tmpString);
if (this->m_ForceControl->GetPhantomState())
this->m_CInOut->value("CONTACT");
else
this->m_CInOut->value("");
if (this->m_Phantom->getStylusSwitch()==TRUE)
{
//this->m_CRender->m_OBBTreeActor[this->m_CRender->m_Level]->SetPosition(pos);
this->m_ForceControl->m_Wait=true;
if (this->m_Rotate)
{
rx=this->m_ForceControl->GetPhantomAngleX()-this->m_Begin_RX;
ry=this->m_ForceControl->GetPhantomAngleY()-this->m_Begin_RY;
rz=this->m_ForceControl->GetPhantomAngleZ()-this->m_Begin_RZ;
tx=pos[0]-this->m_Begin_TX;
ty=pos[1]-this->m_Begin_TY;
tz=pos[2]-this->m_Begin_TZ;
//this->m_Transform->Translate(tx,ty,tz);
if (rx>2)
this->m_Transform->RotateWXYZ(fabs(rx),1,0,0);
else
if (rx<-2)
this->m_Transform->RotateWXYZ(-fabs(rx),1,0,0);
if (ry>2)
this->m_Transform->RotateWXYZ(fabs(ry),0,1,0);
else
if (ry<-2)
this->m_Transform->RotateWXYZ(-fabs(ry),0,1,0);
if (rz>2)
this->m_Transform->RotateWXYZ(-fabs(rz),0,0,1);
else
if (rz<-2)
this->m_Transform->RotateWXYZ(fabs(rz),0,0,1);
/*float *g=this->m_CRender->m_Actor->GetOrigin();
this->m_CRender->m_Actor->SetOrigin(g[0]+tx,g[1]+ty,g[2]+tz);*/
sprintf(this->tmpString,"%.2f",rx);
this->m_CPhantomAngle_X->value(this->tmpString);
sprintf(this->tmpString,"%.2f",ry);
this->m_CPhantomAngle_Y->value(this->tmpString);
sprintf(this->tmpString,"%.2f",rz);
this->m_CPhantomAngle_Z->value(this->tmpString);
this->m_Begin_RX=this->m_ForceControl->GetPhantomAngleX();
this->m_Begin_RY=this->m_ForceControl->GetPhantomAngleY();
this->m_Begin_RZ=this->m_ForceControl->GetPhantomAngleZ();
//float *g=this->m_ForceControl->GetPhantomProxy();
float *g=this->m_CRender->m_Actor->GetOrigin();
//this->m_DataSetReader->GetOutput()->GetCenter();
//this->m_CRender->m_Actor->SetOrigin(g[0]+tx,g[1]+ty,g[2]+tz);
this->m_Begin_TX=pos[0];
this->m_Begin_TY=pos[1];
this->m_Begin_TZ=pos[2];
}
else
{
this->m_Begin_RX=this->m_ForceControl->GetPhantomAngleX();
this->m_Begin_RY=this->m_ForceControl->GetPhantomAngleY();
this->m_Begin_RZ=this->m_ForceControl->GetPhantomAngleZ();
this->m_Begin_TX=pos[0];
this->m_Begin_TY=pos[1];
this->m_Begin_TZ=pos[2];
this->m_Rotate=true;
}
}
else
if (this->m_Rotate)
{
this->m_Rotate=false;
this->m_CRender->m_OBBTree->FreeSearchStructure();
this->m_CRender->m_OBBTree->BuildLocator();
this->m_ForceControl->m_Wait=false;
}
this->m_CRender->m_Proxy->SetPosition(pos);
this->m_CRender->m_SCP->SetPosition(scp);
this->m_CRender->m_LineActor->SetPosition(0,0,0);
this->m_CRender->m_LineSource->SetPoint1(scp);
this->m_CRender->m_LineSource->SetPoint2(pos);
this->m_CRender->draw();
}
| [
"bto@tradeshift.com"
] | bto@tradeshift.com |
8c5c28ed661bd6bc3085d2c2bb0749610a271189 | 3d85b8daed0d406e6f1aa748589ef75bfbd6a075 | /src/libzerocoin/Coin.cpp | 3bb39b4b91a47b4737493d343e4260162548c40d | [
"MIT"
] | permissive | peersend/peersend_ | 531b0a6b0405d14170c11e3be65afe4a04b064c9 | 195c2e9e46e0299b0a21eaf5aafa74176b5b604b | refs/heads/master | 2020-06-22T09:09:12.364434 | 2019-07-19T02:31:39 | 2019-07-19T02:31:39 | 197,688,055 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 10,391 | cpp | /**
* @file Coin.cpp
*
* @brief PublicCoin and PrivateCoin classes for the Zerocoin library.
*
* @author Ian Miers, Christina Garman and Matthew Green
* @date June 2013
*
* @copyright Copyright 2013 Ian Miers, Christina Garman and Matthew Green
* @license This project is released under the MIT license.
**/
// Copyright (c) 2017-2019 The peersend developers
#include <stdexcept>
#include <iostream>
#include "bignum.h"
#include "Coin.h"
#include "Commitment.h"
#include "pubkey.h"
namespace libzerocoin {
//PublicCoin class
PublicCoin::PublicCoin(const ZerocoinParams* p):
params(p) {
if (this->params->initialized == false) {
throw std::runtime_error("Params are not initialized");
}
// Assume this will get set by another method later
denomination = ZQ_ERROR;
};
PublicCoin::PublicCoin(const ZerocoinParams* p, const CBigNum& coin, const CoinDenomination d):
params(p), value(coin) {
if (this->params->initialized == false) {
throw std::runtime_error("Params are not initialized");
}
denomination = d;
for(const CoinDenomination denom : zerocoinDenomList) {
if(denom == d)
denomination = d;
}
if (denomination == 0) {
std::cout << "denom does not exist\n";
throw std::runtime_error("Denomination does not exist");
}
};
bool PublicCoin::validate() const
{
if (this->params->accumulatorParams.minCoinValue >= value) {
return error("%s: ERROR: PublicCoin::validate value is too low: %s", __func__, value.GetDec());
}
if (value > this->params->accumulatorParams.maxCoinValue) {
return error("%s: ERROR: PublicCoin::validate value is too high, max: %s, received: %s",
__func__, this->params->accumulatorParams.maxCoinValue, value.GetDec());
}
if (!value.isPrime(params->zkp_iterations)) {
return error("%s: ERROR: PublicCoin::validate value is not prime. Value: %s, Iterations: %d",
__func__, value.GetDec(), params->zkp_iterations);
}
return true;
}
//PrivateCoin class
PrivateCoin::PrivateCoin(const ZerocoinParams* p, const CoinDenomination denomination, bool fMintNew): params(p), publicCoin(p) {
// Verify that the parameters are valid
if(this->params->initialized == false) {
throw std::runtime_error("Params are not initialized");
}
if (fMintNew) {
#ifdef ZEROCOIN_FAST_MINT
// Mint a new coin with a random serial number using the fast process.
// This is more vulnerable to timing attacks so don't mint coins when
// somebody could be timing you.
this->mintCoinFast(denomination);
#else
// Mint a new coin with a random serial number using the standard process.
this->mintCoin(denomination);
#endif
}
this->version = CURRENT_VERSION;
}
PrivateCoin::PrivateCoin(const ZerocoinParams* p, const CoinDenomination denomination, const CBigNum& bnSerial,
const CBigNum& bnRandomness): params(p), publicCoin(p)
{
// Verify that the parameters are valid
if(!this->params->initialized)
throw std::runtime_error("Params are not initialized");
this->serialNumber = bnSerial;
this->randomness = bnRandomness;
Commitment commitment(&p->coinCommitmentGroup, bnSerial, bnRandomness);
this->publicCoin = PublicCoin(p, commitment.getCommitmentValue(), denomination);
}
bool PrivateCoin::IsValid()
{
if (!IsValidSerial(params, serialNumber)) {
cout << "Serial not valid\n";
return false;
}
return getPublicCoin().validate();
}
bool GenerateKeyPair(const CBigNum& bnGroupOrder, const uint256& nPrivkey, CKey& key, CBigNum& bnSerial)
{
// Generate a new key pair, which also has a 256-bit pubkey hash that qualifies as a serial #
// This builds off of Tim Ruffing's work on libzerocoin, but has a different implementation
CKey keyPair;
if (nPrivkey == 0)
keyPair.MakeNewKey(true);
else
keyPair.Set(nPrivkey.begin(), nPrivkey.end(), true);
CPubKey pubKey = keyPair.GetPubKey();
uint256 hashPubKey = Hash(pubKey.begin(), pubKey.end());
// Make the first half byte 0 which will distinctly mark v2 serials
hashPubKey >>= libzerocoin::PrivateCoin::V2_BITSHIFT;
CBigNum s(hashPubKey);
uint256 nBits = hashPubKey >> 248; // must be less than 0x0D to be valid serial range
if (nBits > 12)
return false;
//Mark this as v2 by starting with 0xF
uint256 nMark = 0xF;
nMark <<= 252;
hashPubKey |= nMark;
s = CBigNum(hashPubKey);
key = keyPair;
bnSerial = s;
return true;
}
const CPubKey PrivateCoin::getPubKey() const
{
CKey key;
key.SetPrivKey(privkey, true);
return key.GetPubKey();
}
bool PrivateCoin::sign(const uint256& hash, vector<unsigned char>& vchSig) const
{
CKey key;
key.SetPrivKey(privkey, true);
return key.Sign(hash, vchSig);
}
void PrivateCoin::mintCoin(const CoinDenomination denomination) {
// Repeat this process up to MAX_COINMINT_ATTEMPTS times until
// we obtain a prime number
for(uint32_t attempt = 0; attempt < MAX_COINMINT_ATTEMPTS; attempt++) {
// Generate a random serial number in the range 0...{q-1} where
// "q" is the order of the commitment group.
// And where the serial also doubles as a public key
CKey key;
CBigNum s;
bool isValid = false;
while (!isValid) {
isValid = GenerateKeyPair(this->params->coinCommitmentGroup.groupOrder, uint256(0), key, s);
}
// Generate a Pedersen commitment to the serial number "s"
Commitment coin(¶ms->coinCommitmentGroup, s);
// Now verify that the commitment is a prime number
// in the appropriate range. If not, we'll throw this coin
// away and generate a new one.
if (coin.getCommitmentValue().isPrime(ZEROCOIN_MINT_PRIME_PARAM) &&
coin.getCommitmentValue() >= params->accumulatorParams.minCoinValue &&
coin.getCommitmentValue() <= params->accumulatorParams.maxCoinValue) {
// Found a valid coin. Store it.
this->serialNumber = s;
this->randomness = coin.getRandomness();
this->publicCoin = PublicCoin(params,coin.getCommitmentValue(), denomination);
this->privkey = key.GetPrivKey();
this->version = 2;
// Success! We're done.
return;
}
}
// We only get here if we did not find a coin within
// MAX_COINMINT_ATTEMPTS. Throw an exception.
throw std::runtime_error("Unable to mint a new Zerocoin (too many attempts)");
}
void PrivateCoin::mintCoinFast(const CoinDenomination denomination) {
// Generate a random serial number in the range 0...{q-1} where
// "q" is the order of the commitment group.
// And where the serial also doubles as a public key
CKey key;
CBigNum s;
bool isValid = false;
while (!isValid) {
isValid = GenerateKeyPair(this->params->coinCommitmentGroup.groupOrder, uint256(0), key, s);
}
// Generate a random number "r" in the range 0...{q-1}
CBigNum r = CBigNum::randBignum(this->params->coinCommitmentGroup.groupOrder);
// Manually compute a Pedersen commitment to the serial number "s" under randomness "r"
// C = g^s * h^r mod p
CBigNum commitmentValue = this->params->coinCommitmentGroup.g.pow_mod(s, this->params->coinCommitmentGroup.modulus).mul_mod(this->params->coinCommitmentGroup.h.pow_mod(r, this->params->coinCommitmentGroup.modulus), this->params->coinCommitmentGroup.modulus);
// Repeat this process up to MAX_COINMINT_ATTEMPTS times until
// we obtain a prime number
for (uint32_t attempt = 0; attempt < MAX_COINMINT_ATTEMPTS; attempt++) {
// First verify that the commitment is a prime number
// in the appropriate range. If not, we'll throw this coin
// away and generate a new one.
if (commitmentValue.isPrime(ZEROCOIN_MINT_PRIME_PARAM) &&
commitmentValue >= params->accumulatorParams.minCoinValue &&
commitmentValue <= params->accumulatorParams.maxCoinValue) {
// Found a valid coin. Store it.
this->serialNumber = s;
this->randomness = r;
this->publicCoin = PublicCoin(params, commitmentValue, denomination);
this->privkey = key.GetPrivKey();
this->version = 2;
// Success! We're done.
return;
}
// Generate a new random "r_delta" in 0...{q-1}
CBigNum r_delta = CBigNum::randBignum(this->params->coinCommitmentGroup.groupOrder);
// The commitment was not prime. Increment "r" and recalculate "C":
// r = r + r_delta mod q
// C = C * h mod p
r = (r + r_delta) % this->params->coinCommitmentGroup.groupOrder;
commitmentValue = commitmentValue.mul_mod(this->params->coinCommitmentGroup.h.pow_mod(r_delta, this->params->coinCommitmentGroup.modulus), this->params->coinCommitmentGroup.modulus);
}
// We only get here if we did not find a coin within
// MAX_COINMINT_ATTEMPTS. Throw an exception.
throw std::runtime_error("Unable to mint a new Zerocoin (too many attempts)");
}
int ExtractVersionFromSerial(const CBigNum& bnSerial)
{
try {
//Serial is marked as v2 only if the first byte is 0xF
uint256 nMark = bnSerial.getuint256() >> (256 - PrivateCoin::V2_BITSHIFT);
if (nMark == 0xf)
return PrivateCoin::PUBKEY_VERSION;
} catch (std::range_error &e) {
//std::cout << "ExtractVersionFromSerial(): " << e.what() << std::endl;
// Only serial version 2 appeared with this range error..
return 2;
}
return 1;
}
//Remove the first four bits for V2 serials
CBigNum GetAdjustedSerial(const CBigNum& bnSerial)
{
uint256 serial = bnSerial.getuint256();
serial &= ~uint256(0) >> PrivateCoin::V2_BITSHIFT;
CBigNum bnSerialAdjusted;
bnSerialAdjusted.setuint256(serial);
return bnSerialAdjusted;
}
bool IsValidSerial(const ZerocoinParams* params, const CBigNum& bnSerial)
{
if (bnSerial <= 0)
return false;
if (ExtractVersionFromSerial(bnSerial) < PrivateCoin::PUBKEY_VERSION)
return bnSerial < params->coinCommitmentGroup.groupOrder;
// If V2, the serial is marked with 0xF in the first 4 bits. So It's always > groupOrder.
// This is removed for the adjusted serial - so it's always < groupOrder.
// So we check only the bitsize here.
return bnSerial.bitSize() <= 256;
}
bool IsValidCommitmentToCoinRange(const ZerocoinParams* params, const CBigNum& bnCommitment)
{
return bnCommitment > CBigNum(0) && bnCommitment < params->serialNumberSoKCommitmentGroup.modulus;
}
} /* namespace libzerocoin */
| [
"admin@peersendcoin.com"
] | admin@peersendcoin.com |
6bd364e65be4c21289830307dcda3a5f0e53cf45 | a33aac97878b2cb15677be26e308cbc46e2862d2 | /program_data/PKU_raw/69/921.c | 745a161c23a30bdebc6fe70aa8b8fe942bbb35c8 | [] | no_license | GabeOchieng/ggnn.tensorflow | f5d7d0bca52258336fc12c9de6ae38223f28f786 | 7c62c0e8427bea6c8bec2cebf157b6f1ea70a213 | refs/heads/master | 2022-05-30T11:17:42.278048 | 2020-05-02T11:33:31 | 2020-05-02T11:33:31 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 663 | c | const int LEN=301;
int main()
{
char ch1[LEN]={0},ch2[LEN]={0};
int an1[LEN]={0},an2[LEN]={0};
memset(an1,0,sizeof(an1));
memset(an2,0,sizeof(an2));
cin.getline(ch1,LEN,'\n');
cin.getline(ch2,LEN,'\n');
int i,j=0;
for(i=strlen(ch1)-1;i>=0;i--)
an1[j++]=ch1[i]-'0';
j=0;
for(i=strlen(ch2)-1;i>=0;i--)
an2[j++]=ch2[i]-'0';
for(i=0;i<LEN;i++)
{
an1[i]+=an2[i];
if(an1[i]>=10)
{
an1[i]-=10;
an2[i+1]+=1;
}
}
int judge=0;
for(i=LEN-1;i>=0;i--)
{
if(an1[i]!=0)
{
for(;i>=0;i--)
cout<<an1[i];
cout<<endl;
judge=1;
break;
}
}
if(judge==0)
cout<<"0"<<endl;
return 0;
} | [
"bdqnghi@gmail.com"
] | bdqnghi@gmail.com |
f7d28134f76a6c7e80a29098a975f58264a9fd0c | 3530f7c91b1df5cc346a0cb52062cda4a85fd95a | /vscap20s/Producer/swfsource/actioncompiler/lex.swf4.cpp | 6204a6366a8ab8d7131fb7f1cea34c260648873b | [] | no_license | CREVIOS/camstudio-mousedown-highlight | cce9a7fac1ce270569e56eef020a079c6c36f72f | 06e2b96a252010ec12c19f878e0f0abb86e67c19 | refs/heads/master | 2021-05-28T07:21:41.427706 | 2011-07-22T08:40:24 | 2011-07-22T08:40:24 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 65,553 | cpp | #include <stdlib.h>
#include "common.h"
#define input yyinput
#define yy_create_buffer swf4_create_buffer
#define yy_delete_buffer swf4_delete_buffer
#define yy_scan_buffer swf4_scan_buffer
#define yy_scan_string swf4_scan_string
#define yy_scan_sbytes swf4_scan_sbytes
#define yy_flex_debug swf4_flex_debug
#define yy_init_buffer swf4_init_buffer
#define yy_flush_buffer swf4_flush_buffer
#define yy_load_buffer_state swf4_load_buffer_state
#define yy_switch_to_buffer swf4_switch_to_buffer
#define yyin swf4in
#define yyleng swf4leng
#define yylex swf4lex
#define yyout swf4out
#define yyrestart swf4restart
#define yytext swf4text
#define yywrap swf4wrap
/* A lexical scanner generated by flex */
/* Scanner skeleton version:
* $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $
*/
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
#include <stdio.h>
/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
#ifdef c_plusplus
#ifndef __cplusplus
#define __cplusplus
#endif
#endif
#ifdef __cplusplus
#include <stdlib.h>
//#include <unistd.h>
/* Use prototypes in function declarations. */
#define YY_USE_PROTOS
/* The "const" storage-class-modifier is valid. */
#define YY_USE_CONST
#else /* ! __cplusplus */
#if __STDC__
#define YY_USE_PROTOS
#define YY_USE_CONST
#endif /* __STDC__ */
#endif /* ! __cplusplus */
#ifdef __TURBOC__
#pragma warn -rch
#pragma warn -use
#include <io.h>
#include <stdlib.h>
#define YY_USE_CONST
#define YY_USE_PROTOS
#endif
#ifdef YY_USE_CONST
#define yyconst const
#else
#define yyconst
#endif
#ifdef YY_USE_PROTOS
#define YY_PROTO(proto) proto
#else
#define YY_PROTO(proto) ()
#endif
/* Returned upon end-of-file. */
#define YY_NULL 0
/* Promotes a possibly negative, possibly signed char to an unsigned
* integer for use as an array index. If the signed char is negative,
* we want to instead treat it as an 8-bit unsigned char, hence the
* double cast.
*/
#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
/* Enter a start condition. This macro really ought to take a parameter,
* but we do it the disgusting crufty way forced on us by the ()-less
* definition of BEGIN.
*/
#define BEGIN yy_start = 1 + 2 *
/* Translate the current start state into a value that can be later handed
* to BEGIN to return to the state. The YYSTATE alias is for lex
* compatibility.
*/
#define YY_START ((yy_start - 1) / 2)
#define YYSTATE YY_START
/* Action number for EOF rule of a given start state. */
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
/* Special action meaning "start processing a new file". */
#define YY_NEW_FILE yyrestart( yyin )
#define YY_END_OF_BUFFER_CHAR 0
/* Size of default input buffer. */
#define YY_BUF_SIZE 16384
typedef struct yy_buffer_state *YY_BUFFER_STATE;
extern int yyleng;
extern FILE *yyin, *yyout;
#define EOB_ACT_CONTINUE_SCAN 0
#define EOB_ACT_END_OF_FILE 1
#define EOB_ACT_LAST_MATCH 2
/* The funky do-while in the following #define is used to turn the definition
* int a single C statement (which needs a semi-colon terminator). This
* avoids problems with code like:
*
* if ( condition_holds )
* yyless( 5 );
* else
* do_something_else();
*
* Prior to using the do-while the compiler would get upset at the
* "else" because it interpreted the "if" statement as being all
* done when it reached the ';' after the yyless() call.
*/
/* Return all but the first 'n' matched characters back to the input stream. */
#define yyless(n) \
do \
{ \
/* Undo effects of setting up yytext. */ \
*yy_cp = yy_hold_char; \
YY_RESTORE_YY_MORE_OFFSET \
yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
YY_DO_BEFORE_ACTION; /* set up yytext again */ \
} \
while ( 0 )
#define unput(c) yyunput( c, yytext_ptr )
/* The following is because we cannot portably get our hands on size_t
* (without autoconf's help, which isn't available because we want
* flex-generated scanners to compile on their own).
*/
typedef unsigned int yy_size_t;
struct yy_buffer_state
{
FILE *yy_input_file;
char *yy_ch_buf; /* input buffer */
char *yy_buf_pos; /* current position in input buffer */
/* Size of input buffer in sbytes, not including room for EOB
* characters.
*/
yy_size_t yy_buf_size;
/* Number of characters read into yy_ch_buf, not including EOB
* characters.
*/
int yy_n_chars;
/* Whether we "own" the buffer - i.e., we know we created it,
* and can realloc() it to grow it, and should free() it to
* delete it.
*/
int yy_is_our_buffer;
/* Whether this is an "interactive" input source; if so, and
* if we're using stdio for input, then we want to use getc()
* instead of fread(), to make sure we stop fetching input after
* each newline.
*/
int yy_is_interactive;
/* Whether we're considered to be at the beginning of a line.
* If so, '^' rules will be active on the next match, otherwise
* not.
*/
int yy_at_bol;
/* Whether to try to fill the input buffer when we reach the
* end of it.
*/
int yy_fill_buffer;
int yy_buffer_status;
#define YY_BUFFER_NEW 0
#define YY_BUFFER_NORMAL 1
/* When an EOF's been seen but there's still some text to process
* then we mark the buffer as YY_EOF_PENDING, to indicate that we
* shouldn't try reading from the input source any more. We might
* still have a bunch of tokens to match, though, because of
* possible backing-up.
*
* When we actually see the EOF, we change the status to "new"
* (via yyrestart()), so that the user can continue scanning by
* just pointing yyin at a new input file.
*/
#define YY_BUFFER_EOF_PENDING 2
};
static YY_BUFFER_STATE yy_current_buffer = 0;
/* We provide macros for accessing buffer states in case in the
* future we want to put the buffer states in a more general
* "scanner state".
*/
#define YY_CURRENT_BUFFER yy_current_buffer
/* yy_hold_char holds the character lost when yytext is formed. */
static char yy_hold_char;
static int yy_n_chars; /* number of characters read into yy_ch_buf */
int yyleng;
/* Points to current character in buffer. */
static char *yy_c_buf_p = (char *) 0;
static int yy_init = 1; /* whether we need to initialize */
static int yy_start = 0; /* start state number */
/* Flag which is used to allow yywrap()'s to do buffer switches
* instead of setting up a fresh yyin. A bit of a hack ...
*/
static int yy_did_buffer_switch_on_eof;
void yyrestart YY_PROTO(( FILE *input_file ));
void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
void yy_load_buffer_state YY_PROTO(( void ));
YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
YY_BUFFER_STATE yy_scan_sbytes YY_PROTO(( yyconst char *sbytes, int len ));
static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
static void yy_flex_free YY_PROTO(( void * ));
#define yy_new_buffer yy_create_buffer
#define yy_set_interactive(is_interactive) \
{ \
if ( ! yy_current_buffer ) \
yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
yy_current_buffer->yy_is_interactive = is_interactive; \
}
#define yy_set_bol(at_bol) \
{ \
if ( ! yy_current_buffer ) \
yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
yy_current_buffer->yy_at_bol = at_bol; \
}
#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
typedef unsigned char YY_CHAR;
FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
typedef int yy_state_type;
extern char *yytext;
#define yytext_ptr yytext
static yy_state_type yy_get_previous_state YY_PROTO(( void ));
static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
static int yy_get_next_buffer YY_PROTO(( void ));
static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
/* Done after the current pattern has been matched and before the
* corresponding action - sets up yytext.
*/
#define YY_DO_BEFORE_ACTION \
yytext_ptr = yy_bp; \
yyleng = (int) (yy_cp - yy_bp); \
yy_hold_char = *yy_cp; \
*yy_cp = '\0'; \
yy_c_buf_p = yy_cp;
#define YY_NUM_RULES 95
#define YY_END_OF_BUFFER 96
static yyconst short int yy_accept[318] =
{ 0,
0, 0, 96, 94, 56, 93, 82, 94, 79, 94,
83, 84, 80, 77, 89, 78, 90, 81, 1, 92,
75, 59, 76, 60, 91, 85, 86, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 87, 94, 88, 64, 0, 52,
50, 0, 65, 0, 53, 51, 0, 67, 57, 69,
58, 70, 74, 0, 54, 48, 55, 68, 48, 2,
1, 61, 63, 62, 0, 47, 47, 47, 47, 47,
11, 47, 47, 47, 47, 47, 47, 47, 9, 47,
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
66, 72, 48, 48, 2, 73, 71, 49, 49, 47,
47, 24, 47, 47, 47, 47, 8, 47, 33, 47,
16, 47, 47, 47, 47, 23, 47, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 49, 49, 47, 47, 47, 47, 47,
7, 47, 47, 47, 47, 47, 47, 47, 47, 47,
37, 32, 47, 47, 47, 47, 47, 38, 47, 47,
46, 14, 47, 47, 3, 47, 47, 5, 47, 47,
47, 47, 4, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 20, 47, 10, 47, 17, 47, 47,
47, 47, 26, 47, 47, 15, 47, 47, 47, 34,
47, 13, 47, 47, 47, 47, 47, 30, 47, 47,
47, 47, 47, 47, 47, 47, 27, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
12, 47, 6, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 22, 47, 47, 47, 25,
47, 47, 47, 47, 41, 28, 47, 35, 36, 47,
44, 21, 47, 47, 47, 47, 47, 47, 47, 47,
19, 40, 45, 47, 47, 43, 31, 42, 47, 47,
47, 47, 47, 18, 29, 39, 0
} ;
static yyconst int yy_ec[256] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
2, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 2, 4, 5, 1, 1, 1, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16, 17, 16,
16, 16, 16, 16, 16, 16, 16, 18, 19, 20,
21, 22, 23, 1, 28, 29, 30, 31, 32, 33,
34, 35, 36, 27, 37, 38, 39, 40, 41, 42,
43, 44, 45, 46, 47, 48, 49, 50, 51, 27,
24, 25, 26, 1, 27, 1, 28, 29, 30, 31,
32, 33, 34, 35, 36, 27, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
51, 27, 52, 53, 54, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1
} ;
static yyconst int yy_meta[55] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
1, 1, 1, 3, 4, 5, 5, 1, 1, 1,
2, 1, 1, 1, 1, 1, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 1, 1, 1
} ;
static yyconst short int yy_base[325] =
{ 0,
0, 0, 624, 625, 625, 625, 602, 52, 616, 53,
625, 625, 600, 47, 625, 46, 47, 55, 57, 625,
625, 599, 598, 597, 625, 625, 625, 602, 48, 60,
49, 51, 65, 66, 64, 67, 70, 68, 72, 90,
85, 104, 99, 88, 625, 563, 625, 594, 121, 125,
625, 611, 625, 118, 126, 625, 610, 625, 625, 625,
625, 625, 597, 139, 625, 120, 625, 625, 596, 121,
141, 588, 588, 625, 594, 592, 127, 126, 71, 129,
591, 105, 137, 141, 146, 147, 148, 150, 590, 151,
152, 153, 155, 156, 157, 158, 159, 161, 162, 168,
163, 170, 174, 172, 176, 169, 57, 185, 180, 184,
625, 625, 589, 588, 198, 625, 625, 202, 587, 191,
206, 586, 207, 208, 209, 210, 585, 211, 212, 215,
584, 213, 214, 216, 219, 583, 218, 220, 223, 221,
224, 227, 228, 225, 233, 242, 234, 243, 248, 246,
245, 249, 253, 582, 581, 255, 266, 259, 268, 269,
580, 270, 271, 273, 274, 278, 275, 280, 279, 282,
579, 578, 283, 285, 286, 292, 293, 298, 294, 295,
577, 576, 299, 300, 575, 310, 312, 574, 308, 309,
316, 315, 573, 320, 318, 323, 331, 321, 332, 333,
334, 335, 338, 336, 339, 345, 342, 351, 348, 349,
353, 355, 357, 572, 358, 571, 360, 570, 361, 366,
369, 370, 376, 372, 381, 569, 380, 383, 385, 564,
386, 563, 387, 389, 390, 391, 392, 554, 396, 400,
403, 405, 401, 406, 407, 409, 537, 411, 410, 414,
415, 416, 417, 422, 427, 430, 423, 431, 432, 433,
536, 446, 535, 447, 439, 448, 449, 450, 452, 453,
454, 457, 458, 459, 461, 533, 460, 468, 462, 528,
473, 470, 478, 481, 527, 526, 482, 525, 524, 483,
523, 522, 484, 486, 489, 492, 491, 493, 495, 497,
518, 513, 511, 498, 500, 508, 506, 505, 499, 501,
503, 504, 502, 165, 79, 69, 625, 553, 559, 564,
567, 570, 574, 577
} ;
static yyconst short int yy_def[325] =
{ 0,
317, 1, 317, 317, 317, 317, 317, 318, 317, 319,
317, 317, 317, 317, 317, 317, 317, 320, 317, 317,
317, 317, 317, 317, 317, 317, 317, 321, 321, 321,
321, 321, 321, 321, 321, 321, 321, 321, 321, 321,
321, 321, 321, 321, 317, 317, 317, 317, 318, 318,
317, 318, 317, 319, 319, 317, 319, 317, 317, 317,
317, 317, 317, 320, 317, 317, 317, 317, 322, 317,
317, 317, 317, 317, 323, 321, 321, 321, 321, 321,
321, 321, 321, 321, 321, 321, 321, 321, 321, 321,
321, 321, 321, 321, 321, 321, 321, 321, 321, 321,
321, 321, 321, 321, 321, 321, 321, 321, 321, 321,
317, 317, 317, 322, 317, 317, 317, 317, 324, 321,
321, 321, 321, 321, 321, 321, 321, 321, 321, 321,
321, 321, 321, 321, 321, 321, 321, 321, 321, 321,
321, 321, 321, 321, 321, 321, 321, 321, 321, 321,
321, 321, 321, 317, 324, 321, 321, 321, 321, 321,
321, 321, 321, 321, 321, 321, 321, 321, 321, 321,
321, 321, 321, 321, 321, 321, 321, 321, 321, 321,
321, 321, 321, 321, 321, 321, 321, 321, 321, 321,
321, 321, 321, 321, 321, 321, 321, 321, 321, 321,
321, 321, 321, 321, 321, 321, 321, 321, 321, 321,
321, 321, 321, 321, 321, 321, 321, 321, 321, 321,
321, 321, 321, 321, 321, 321, 321, 321, 321, 321,
321, 321, 321, 321, 321, 321, 321, 321, 321, 321,
321, 321, 321, 321, 321, 321, 321, 321, 321, 321,
321, 321, 321, 321, 321, 321, 321, 321, 321, 321,
321, 321, 321, 321, 321, 321, 321, 321, 321, 321,
321, 321, 321, 321, 321, 321, 321, 321, 321, 321,
321, 321, 321, 321, 321, 321, 321, 321, 321, 321,
321, 321, 321, 321, 321, 321, 321, 321, 321, 321,
321, 321, 321, 321, 321, 321, 321, 321, 321, 321,
321, 321, 321, 321, 321, 321, 0, 317, 317, 317,
317, 317, 317, 317
} ;
static yyconst short int yy_nxt[680] =
{ 0,
4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16, 17, 18, 19, 19, 20, 21, 22,
23, 24, 25, 26, 4, 27, 28, 28, 29, 30,
31, 32, 33, 34, 28, 35, 28, 36, 28, 37,
38, 39, 28, 40, 41, 42, 28, 43, 44, 28,
28, 45, 46, 47, 50, 55, 51, 59, 61, 56,
63, 64, 75, 75, 65, 75, 62, 60, 66, 67,
70, 75, 71, 71, 75, 68, 52, 57, 75, 75,
75, 75, 75, 75, 75, 75, 75, 78, 83, 81,
149, 77, 84, 75, 79, 82, 89, 87, 91, 75,
80, 93, 75, 90, 75, 85, 88, 92, 86, 96,
94, 95, 97, 75, 122, 98, 101, 99, 75, 75,
55, 100, 110, 50, 56, 51, 109, 50, 55, 51,
102, 103, 56, 113, 64, 104, 115, 115, 105, 106,
75, 75, 57, 75, 107, 52, 124, 108, 317, 52,
57, 75, 66, 317, 70, 75, 71, 71, 120, 317,
75, 75, 75, 121, 75, 75, 75, 75, 123, 75,
75, 75, 75, 75, 128, 75, 75, 75, 126, 75,
133, 125, 75, 75, 75, 137, 75, 136, 75, 127,
75, 132, 139, 129, 75, 130, 131, 143, 75, 75,
135, 140, 145, 138, 134, 75, 141, 148, 142, 146,
144, 147, 150, 115, 115, 154, 75, 152, 156, 153,
75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
75, 151, 75, 75, 75, 75, 158, 75, 75, 75,
161, 75, 75, 157, 168, 160, 167, 75, 75, 163,
170, 174, 159, 164, 162, 166, 75, 75, 165, 75,
75, 169, 75, 75, 175, 172, 178, 75, 171, 75,
173, 177, 176, 75, 182, 184, 185, 179, 181, 180,
75, 183, 75, 75, 75, 75, 190, 75, 75, 75,
187, 188, 75, 75, 75, 186, 75, 75, 189, 75,
75, 193, 194, 191, 192, 197, 75, 75, 75, 75,
198, 202, 75, 75, 75, 204, 195, 196, 200, 207,
199, 203, 75, 75, 75, 205, 75, 201, 209, 75,
75, 214, 75, 206, 75, 75, 213, 75, 208, 211,
212, 215, 210, 216, 220, 75, 75, 75, 75, 75,
75, 217, 75, 75, 218, 219, 75, 221, 222, 75,
223, 228, 75, 75, 225, 75, 226, 75, 230, 75,
224, 75, 75, 227, 75, 75, 233, 232, 229, 231,
75, 235, 239, 75, 75, 234, 75, 242, 240, 237,
75, 236, 247, 244, 75, 75, 238, 75, 241, 75,
75, 75, 248, 75, 75, 75, 75, 243, 249, 245,
75, 246, 252, 253, 75, 75, 254, 75, 257, 75,
75, 75, 255, 75, 75, 75, 251, 250, 75, 75,
75, 75, 263, 256, 265, 261, 75, 75, 258, 259,
266, 75, 260, 262, 75, 75, 75, 75, 268, 269,
270, 264, 267, 75, 271, 272, 276, 275, 274, 273,
75, 75, 75, 75, 75, 278, 75, 75, 75, 282,
277, 75, 75, 75, 75, 75, 75, 280, 281, 279,
287, 285, 75, 286, 75, 288, 284, 75, 289, 295,
293, 283, 75, 290, 292, 75, 75, 75, 75, 294,
75, 297, 296, 75, 291, 75, 75, 75, 299, 75,
300, 75, 75, 75, 75, 75, 75, 75, 75, 75,
75, 306, 75, 298, 301, 75, 304, 75, 302, 305,
312, 303, 75, 310, 309, 311, 75, 75, 75, 75,
75, 75, 75, 307, 314, 308, 313, 75, 315, 75,
75, 75, 316, 49, 49, 49, 49, 49, 49, 54,
54, 54, 54, 54, 54, 69, 69, 69, 75, 69,
76, 76, 76, 114, 114, 114, 119, 75, 75, 119,
155, 155, 155, 75, 75, 75, 75, 75, 75, 75,
75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
75, 75, 64, 64, 75, 75, 75, 118, 117, 116,
64, 64, 317, 317, 112, 111, 75, 74, 73, 72,
58, 53, 48, 317, 3, 317, 317, 317, 317, 317,
317, 317, 317, 317, 317, 317, 317, 317, 317, 317,
317, 317, 317, 317, 317, 317, 317, 317, 317, 317,
317, 317, 317, 317, 317, 317, 317, 317, 317, 317,
317, 317, 317, 317, 317, 317, 317, 317, 317, 317,
317, 317, 317, 317, 317, 317, 317, 317, 317
} ;
static yyconst short int yy_chk[680] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 8, 10, 8, 14, 16, 10,
17, 17, 29, 31, 18, 32, 16, 14, 18, 18,
19, 107, 19, 19, 30, 18, 8, 10, 35, 33,
34, 36, 38, 316, 37, 79, 39, 30, 32, 31,
107, 29, 33, 315, 30, 31, 35, 34, 36, 41,
30, 37, 44, 35, 40, 33, 34, 36, 33, 39,
37, 38, 39, 43, 79, 39, 41, 40, 42, 82,
54, 40, 44, 49, 54, 49, 43, 50, 55, 50,
41, 41, 55, 66, 66, 42, 70, 70, 42, 42,
78, 77, 54, 80, 42, 49, 82, 42, 64, 50,
55, 83, 64, 64, 71, 84, 71, 71, 77, 64,
85, 86, 87, 78, 88, 90, 91, 92, 80, 93,
94, 95, 96, 97, 86, 98, 99, 101, 84, 314,
92, 83, 100, 106, 102, 96, 104, 95, 103, 85,
105, 91, 98, 87, 109, 88, 90, 102, 110, 108,
94, 99, 103, 97, 93, 120, 100, 106, 101, 104,
102, 105, 108, 115, 115, 118, 118, 109, 120, 110,
121, 123, 124, 125, 126, 128, 129, 132, 133, 130,
134, 108, 137, 135, 138, 140, 123, 139, 141, 144,
125, 142, 143, 121, 133, 124, 132, 145, 147, 128,
135, 140, 123, 129, 126, 130, 146, 148, 129, 151,
150, 134, 149, 152, 141, 138, 144, 153, 137, 156,
139, 143, 142, 158, 148, 150, 151, 145, 147, 146,
157, 149, 159, 160, 162, 163, 158, 164, 165, 167,
153, 156, 166, 169, 168, 152, 170, 173, 157, 174,
175, 162, 163, 159, 160, 166, 176, 177, 179, 180,
166, 169, 178, 183, 184, 173, 164, 165, 168, 176,
167, 170, 189, 190, 186, 174, 187, 168, 178, 192,
191, 184, 195, 175, 194, 198, 183, 196, 177, 179,
180, 186, 178, 187, 192, 197, 199, 200, 201, 202,
204, 189, 203, 205, 190, 191, 207, 194, 195, 206,
196, 201, 209, 210, 198, 208, 199, 211, 203, 212,
197, 213, 215, 200, 217, 219, 206, 205, 202, 204,
220, 208, 212, 221, 222, 207, 224, 217, 213, 210,
223, 209, 223, 220, 227, 225, 211, 228, 215, 229,
231, 233, 224, 234, 235, 236, 237, 219, 225, 221,
239, 222, 229, 231, 240, 243, 233, 241, 236, 242,
244, 245, 234, 246, 249, 248, 228, 227, 250, 251,
252, 253, 243, 235, 245, 241, 254, 257, 237, 239,
246, 255, 240, 242, 256, 258, 259, 260, 249, 250,
251, 244, 248, 265, 252, 253, 257, 256, 255, 254,
262, 264, 266, 267, 268, 259, 269, 270, 271, 265,
258, 272, 273, 274, 277, 275, 279, 262, 264, 260,
270, 268, 278, 269, 282, 271, 267, 281, 272, 279,
277, 266, 283, 273, 275, 284, 287, 290, 293, 278,
294, 282, 281, 295, 274, 297, 296, 298, 284, 299,
287, 300, 304, 309, 305, 310, 313, 311, 312, 308,
307, 297, 306, 283, 290, 303, 295, 302, 293, 296,
309, 294, 301, 304, 300, 305, 292, 291, 289, 288,
286, 285, 280, 298, 311, 299, 310, 276, 312, 263,
261, 247, 313, 318, 318, 318, 318, 318, 318, 319,
319, 319, 319, 319, 319, 320, 320, 320, 238, 320,
321, 321, 321, 322, 322, 322, 323, 232, 230, 323,
324, 324, 324, 226, 218, 216, 214, 193, 188, 185,
182, 181, 172, 171, 161, 155, 154, 136, 131, 127,
122, 119, 114, 113, 89, 81, 76, 75, 73, 72,
69, 63, 57, 52, 48, 46, 28, 24, 23, 22,
13, 9, 7, 3, 317, 317, 317, 317, 317, 317,
317, 317, 317, 317, 317, 317, 317, 317, 317, 317,
317, 317, 317, 317, 317, 317, 317, 317, 317, 317,
317, 317, 317, 317, 317, 317, 317, 317, 317, 317,
317, 317, 317, 317, 317, 317, 317, 317, 317, 317,
317, 317, 317, 317, 317, 317, 317, 317, 317
} ;
static yy_state_type yy_last_accepting_state;
static char *yy_last_accepting_cpos;
/* The intent behind this definition is that it'll catch
* any uses of REJECT which flex missed.
*/
#define REJECT reject_used_but_not_detected
#define yymore() yymore_used_but_not_detected
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
char *yytext;
#line 1 "swf4compiler.flex"
#define INITIAL 0
#line 2 "swf4compiler.flex"
#include <math.h>
#include <string.h>
#include "compile.h"
#include "action.h"
#include "swf4compiler.tab.h" /* defines token types */
int swf4debug;
static char *lexBuffer = NULL;
static int lexBufferLen = 0;
static int sLineNumber = 0;
static char szLine[1024];
static char msgbufs[2][1024] = { {0}, {0} }, *msgline = {0};
static int column = 0;
static void comment();
static void comment1();
static void count();
static void warning(char *msg);
#define YY_INPUT(buf,result,max_size) result=lexBufferInput(buf, max_size)
/* thanks to the prolific and brilliant Raff: */
static int lexBufferInput(char *buf, int max_size)
{
int l = lexBufferLen > max_size ? max_size : lexBufferLen;
if (lexBufferLen <= 0)
return YY_NULL;
memcpy(buf, lexBuffer, l);
lexBuffer += l;
lexBufferLen -= l;
return l;
}
/* very inefficient method of unescaping strings */
static void unescape(char *buf)
{
char *p, *p1;
for (p1=buf; (p=strchr(p1, '\\')) != 0; p1 = p+1) {
switch(p[1])
{
case 'b' : p[1] = '\b'; break;
case 'f' : p[1] = '\f'; break;
case 'n' : p[1] = '\n'; break;
case 'r' : p[1] = '\r'; break;
case 't' : p[1] = '\t'; break;
case 'x' :
case 'u' : warning("unsupported escape sequence");
}
strcpy(p, p+1);
}
}
void swf4ParseInit(char *script, int debug)
{
checksbyteOrder();
yyrestart(NULL);
swf4debug = debug;
lexBuffer = script;
lexBufferLen = strlen(script);
sLineNumber = 0;
column = 0;
msgline = msgbufs[0];
}
#line 710 "lex.swf4.c"
/* Macros after this point can all be overridden by user definitions in
* section 1.
*/
#ifndef YY_SKIP_YYWRAP
#ifdef __cplusplus
extern "C" int yywrap YY_PROTO(( void ));
#else
extern int yywrap YY_PROTO(( void ));
#endif
#endif
#ifndef YY_NO_UNPUT
static void yyunput YY_PROTO(( int c, char *buf_ptr ));
#endif
#ifndef yytext_ptr
static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
#endif
#ifdef YY_NEED_STRLEN
static int yy_flex_strlen YY_PROTO(( yyconst char * ));
#endif
#ifndef YY_NO_INPUT
#ifdef __cplusplus
static int yyinput YY_PROTO(( void ));
#else
static int input YY_PROTO(( void ));
#endif
#endif
#if YY_STACK_USED
static int yy_start_stack_ptr = 0;
static int yy_start_stack_depth = 0;
static int *yy_start_stack = 0;
#ifndef YY_NO_PUSH_STATE
static void yy_push_state YY_PROTO(( int new_state ));
#endif
#ifndef YY_NO_POP_STATE
static void yy_pop_state YY_PROTO(( void ));
#endif
#ifndef YY_NO_TOP_STATE
static int yy_top_state YY_PROTO(( void ));
#endif
#else
#define YY_NO_PUSH_STATE 1
#define YY_NO_POP_STATE 1
#define YY_NO_TOP_STATE 1
#endif
#ifdef YY_MALLOC_DECL
YY_MALLOC_DECL
#else
#if __STDC__
#ifndef __cplusplus
#include <stdlib.h>
#endif
#else
/* Just try to get by without declaring the routines. This will fail
* miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
* or sizeof(void*) != sizeof(int).
*/
#endif
#endif
/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
#define YY_READ_BUF_SIZE 8192
#endif
/* Copy whatever the last rule matched to the standard output. */
#ifndef ECHO
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
#endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
* is returned in "result".
*/
#ifndef YY_INPUT
#define YY_INPUT(buf,result,max_size) \
if ( yy_current_buffer->yy_is_interactive ) \
{ \
int c = '*', n; \
for ( n = 0; n < max_size && \
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \
if ( c == '\n' ) \
buf[n++] = (char) c; \
if ( c == EOF && ferror( yyin ) ) \
YY_FATAL_ERROR( "input in flex scanner failed" ); \
result = n; \
} \
else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
&& ferror( yyin ) ) \
YY_FATAL_ERROR( "input in flex scanner failed" );
#endif
/* No semi-colon after return; correct usage is to write "yyterminate();" -
* we don't want an extra ';' after the "return" because that will cause
* some compilers to complain about unreachable statements.
*/
#ifndef yyterminate
#define yyterminate() return YY_NULL
#endif
/* Number of entries by which start-condition stack grows. */
#ifndef YY_START_STACK_INCR
#define YY_START_STACK_INCR 25
#endif
/* Report a fatal error. */
#ifndef YY_FATAL_ERROR
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
#endif
/* Default declaration of generated scanner - a define so the user can
* easily add parameters.
*/
#ifndef YY_DECL
#define YY_DECL int yylex YY_PROTO(( void ))
#endif
/* Code executed at the beginning of each rule, after yytext and yyleng
* have been set up.
*/
#ifndef YY_USER_ACTION
#define YY_USER_ACTION
#endif
/* Code executed at the end of each rule. */
#ifndef YY_BREAK
#define YY_BREAK break;
#endif
#define YY_RULE_SETUP \
YY_USER_ACTION
YY_DECL
{
register yy_state_type yy_current_state;
register char *yy_cp, *yy_bp;
register int yy_act;
#line 81 "swf4compiler.flex"
#line 864 "lex.swf4.c"
if ( yy_init )
{
yy_init = 0;
#ifdef YY_USER_INIT
YY_USER_INIT;
#endif
if ( ! yy_start )
yy_start = 1; /* first start state */
if ( ! yyin )
yyin = stdin;
if ( ! yyout )
yyout = stdout;
if ( ! yy_current_buffer )
yy_current_buffer =
yy_create_buffer( yyin, YY_BUF_SIZE );
yy_load_buffer_state();
}
while ( 1 ) /* loops until end-of-file is reached */
{
yy_cp = yy_c_buf_p;
/* Support of yytext. */
*yy_cp = yy_hold_char;
/* yy_bp points to the position in yy_ch_buf of the start of
* the current run.
*/
yy_bp = yy_cp;
yy_current_state = yy_start;
yy_match:
do
{
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
if ( yy_accept[yy_current_state] )
{
yy_last_accepting_state = yy_current_state;
yy_last_accepting_cpos = yy_cp;
}
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 318 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
while ( yy_base[yy_current_state] != 625 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
if ( yy_act == 0 )
{ /* have to back up */
yy_cp = yy_last_accepting_cpos;
yy_current_state = yy_last_accepting_state;
yy_act = yy_accept[yy_current_state];
}
YY_DO_BEFORE_ACTION;
do_action: /* This label is used only to access EOF actions. */
switch ( yy_act )
{ /* beginning of action switch */
case 0: /* must back up */
/* undo the effects of YY_DO_BEFORE_ACTION */
*yy_cp = yy_hold_char;
yy_cp = yy_last_accepting_cpos;
yy_current_state = yy_last_accepting_state;
goto yy_find_action;
case 1:
YY_RULE_SETUP
#line 83 "swf4compiler.flex"
{ count(); swf4lval.str = strdup(yytext);
return NUMBER; }
YY_BREAK
case 2:
YY_RULE_SETUP
#line 85 "swf4compiler.flex"
{ count(); swf4lval.str = strdup(yytext);
return NUMBER; }
YY_BREAK
case 3:
YY_RULE_SETUP
#line 87 "swf4compiler.flex"
{ count(); swf4lval.str = strdup("1");
return NUMBER; }
YY_BREAK
case 4:
YY_RULE_SETUP
#line 89 "swf4compiler.flex"
{ count(); swf4lval.str = strdup("0");
return NUMBER; }
YY_BREAK
case 5:
YY_RULE_SETUP
#line 91 "swf4compiler.flex"
{ count(); return BREAK; }
YY_BREAK
case 6:
YY_RULE_SETUP
#line 92 "swf4compiler.flex"
{ count(); return CONTINUE; }
YY_BREAK
case 7:
YY_RULE_SETUP
#line 93 "swf4compiler.flex"
{ count(); return ELSE; }
YY_BREAK
case 8:
YY_RULE_SETUP
#line 94 "swf4compiler.flex"
{ count(); return FOR; }
YY_BREAK
case 9:
YY_RULE_SETUP
#line 95 "swf4compiler.flex"
{ count(); return IF; }
YY_BREAK
case 10:
YY_RULE_SETUP
#line 96 "swf4compiler.flex"
{ count(); return WHILE; }
YY_BREAK
case 11:
YY_RULE_SETUP
#line 97 "swf4compiler.flex"
{ count(); return DO; }
YY_BREAK
case 12:
YY_RULE_SETUP
#line 98 "swf4compiler.flex"
{ count(); return EVAL; }
YY_BREAK
/* functions */
case 13:
YY_RULE_SETUP
#line 101 "swf4compiler.flex"
{ count(); return RANDOM; }
YY_BREAK
case 14:
YY_RULE_SETUP
#line 102 "swf4compiler.flex"
{ count(); return TIME; }
YY_BREAK
case 15:
YY_RULE_SETUP
#line 103 "swf4compiler.flex"
{ count(); return LENGTH; }
YY_BREAK
case 16:
YY_RULE_SETUP
#line 104 "swf4compiler.flex"
{ count(); return INT; }
YY_BREAK
case 17:
YY_RULE_SETUP
#line 105 "swf4compiler.flex"
{ count(); return CONCAT; }
YY_BREAK
case 18:
YY_RULE_SETUP
#line 106 "swf4compiler.flex"
{ count(); return DUPLICATECLIP; }
YY_BREAK
case 19:
YY_RULE_SETUP
#line 107 "swf4compiler.flex"
{ count(); return REMOVECLIP; }
YY_BREAK
case 20:
YY_RULE_SETUP
#line 108 "swf4compiler.flex"
{ count(); return TRACE; }
YY_BREAK
case 21:
YY_RULE_SETUP
#line 109 "swf4compiler.flex"
{ count(); return STARTDRAG; }
YY_BREAK
case 22:
YY_RULE_SETUP
#line 110 "swf4compiler.flex"
{ count(); return STOPDRAG; }
YY_BREAK
case 23:
YY_RULE_SETUP
#line 111 "swf4compiler.flex"
{ count(); return ORD; }
YY_BREAK
case 24:
YY_RULE_SETUP
#line 112 "swf4compiler.flex"
{ count(); return CHR; }
YY_BREAK
case 25:
YY_RULE_SETUP
#line 113 "swf4compiler.flex"
{ count(); return CALLFRAME; }
YY_BREAK
case 26:
YY_RULE_SETUP
#line 114 "swf4compiler.flex"
{ count(); return GETURL; }
YY_BREAK
case 27:
YY_RULE_SETUP
#line 115 "swf4compiler.flex"
{ count(); return GETURL1; }
YY_BREAK
case 28:
YY_RULE_SETUP
#line 116 "swf4compiler.flex"
{ count(); return LOADMOVIE; }
YY_BREAK
case 29:
YY_RULE_SETUP
#line 117 "swf4compiler.flex"
{ count(); return LOADVARIABLES; }
YY_BREAK
case 30:
YY_RULE_SETUP
#line 118 "swf4compiler.flex"
{ count(); return SUBSTR; }
YY_BREAK
case 31:
YY_RULE_SETUP
#line 120 "swf4compiler.flex"
{ count(); return GETPROPERTY; }
YY_BREAK
/* getURL2 methods */
case 32:
YY_RULE_SETUP
#line 123 "swf4compiler.flex"
{ count(); swf4lval.getURLMethod = GETURL_METHOD_POST;
return GETURL_METHOD; }
YY_BREAK
case 33:
YY_RULE_SETUP
#line 125 "swf4compiler.flex"
{ count(); swf4lval.getURLMethod = GETURL_METHOD_GET;
return GETURL_METHOD; }
YY_BREAK
case 34:
YY_RULE_SETUP
#line 127 "swf4compiler.flex"
{ count(); swf4lval.getURLMethod = GETURL_METHOD_NOSEND;
return GETURL_METHOD; }
YY_BREAK
/* v3 functions */
case 35:
YY_RULE_SETUP
#line 132 "swf4compiler.flex"
{ count(); return NEXTFRAME; }
YY_BREAK
case 36:
YY_RULE_SETUP
#line 133 "swf4compiler.flex"
{ count(); return PREVFRAME; }
YY_BREAK
case 37:
YY_RULE_SETUP
#line 134 "swf4compiler.flex"
{ count(); return PLAY; }
YY_BREAK
case 38:
YY_RULE_SETUP
#line 135 "swf4compiler.flex"
{ count(); return STOP; }
YY_BREAK
case 39:
YY_RULE_SETUP
#line 136 "swf4compiler.flex"
{ count(); return TOGGLEQUALITY; }
YY_BREAK
case 40:
YY_RULE_SETUP
#line 137 "swf4compiler.flex"
{ count(); return STOPSOUNDS; }
YY_BREAK
case 41:
YY_RULE_SETUP
#line 138 "swf4compiler.flex"
{ count(); return GOTOFRAME; }
YY_BREAK
case 42:
YY_RULE_SETUP
#line 139 "swf4compiler.flex"
{ count(); return GOTOANDPLAY; }
YY_BREAK
case 43:
YY_RULE_SETUP
#line 140 "swf4compiler.flex"
{ count(); return FRAMELOADED; }
YY_BREAK
case 44:
YY_RULE_SETUP
#line 141 "swf4compiler.flex"
{ count(); return SETTARGET; }
YY_BREAK
/* high level functions */
case 45:
YY_RULE_SETUP
#line 144 "swf4compiler.flex"
{ count(); return TELLTARGET; }
YY_BREAK
case 46:
YY_RULE_SETUP
#line 147 "swf4compiler.flex"
{ count(); return THIS; }
YY_BREAK
case 47:
YY_RULE_SETUP
#line 149 "swf4compiler.flex"
{ count(); swf4lval.str = strdup(yytext);
return IDENTIFIER; }
YY_BREAK
case 48:
YY_RULE_SETUP
#line 152 "swf4compiler.flex"
{ count(); swf4lval.str = strdup(yytext);
return PATH; }
YY_BREAK
case 49:
YY_RULE_SETUP
#line 155 "swf4compiler.flex"
{ count(); swf4lval.str = strdup(yytext);
return PATH; }
YY_BREAK
case 50:
YY_RULE_SETUP
#line 158 "swf4compiler.flex"
{ count(); swf4lval.str = strdup(yytext+1);
swf4lval.str[strlen(swf4lval.str)-1]=0;
unescape(swf4lval.str);
return STRING; }
YY_BREAK
case 51:
YY_RULE_SETUP
#line 163 "swf4compiler.flex"
{ count(); swf4lval.str = strdup(yytext+1);
swf4lval.str[strlen(swf4lval.str)-1]=0;
unescape(swf4lval.str);
return STRING; }
YY_BREAK
case 52:
*yy_cp = yy_hold_char; /* undo effects of setting up yytext */
yy_c_buf_p = yy_cp -= 1;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
#line 168 "swf4compiler.flex"
{ count(); swf4lval.str = strdup("");
warning("Unterminated string!");
return STRING; }
YY_BREAK
case 53:
*yy_cp = yy_hold_char; /* undo effects of setting up yytext */
yy_c_buf_p = yy_cp -= 1;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
#line 172 "swf4compiler.flex"
{ count(); swf4lval.str = strdup("");
warning("Unterminated string!");
return STRING; }
YY_BREAK
case 54:
YY_RULE_SETUP
#line 176 "swf4compiler.flex"
{ count(); comment(); }
YY_BREAK
case 55:
YY_RULE_SETUP
#line 177 "swf4compiler.flex"
{ count(); comment1(); }
YY_BREAK
case 56:
YY_RULE_SETUP
#line 178 "swf4compiler.flex"
{ count(); }
YY_BREAK
case 57:
YY_RULE_SETUP
#line 180 "swf4compiler.flex"
{ count(); return INC; }
YY_BREAK
case 58:
YY_RULE_SETUP
#line 181 "swf4compiler.flex"
{ count(); return DEC; }
YY_BREAK
case 59:
YY_RULE_SETUP
#line 182 "swf4compiler.flex"
{ count(); return '<'; }
YY_BREAK
case 60:
YY_RULE_SETUP
#line 183 "swf4compiler.flex"
{ count(); return '>'; }
YY_BREAK
case 61:
YY_RULE_SETUP
#line 184 "swf4compiler.flex"
{ count(); return LE; }
YY_BREAK
case 62:
YY_RULE_SETUP
#line 185 "swf4compiler.flex"
{ count(); return GE; }
YY_BREAK
case 63:
YY_RULE_SETUP
#line 186 "swf4compiler.flex"
{ count(); return EQ; }
YY_BREAK
case 64:
YY_RULE_SETUP
#line 187 "swf4compiler.flex"
{ count(); return NE; }
YY_BREAK
case 65:
YY_RULE_SETUP
#line 188 "swf4compiler.flex"
{ count(); return LAN; }
YY_BREAK
case 66:
YY_RULE_SETUP
#line 189 "swf4compiler.flex"
{ count(); return LOR; }
YY_BREAK
case 67:
YY_RULE_SETUP
#line 190 "swf4compiler.flex"
{ count(); return MEQ; }
YY_BREAK
case 68:
YY_RULE_SETUP
#line 191 "swf4compiler.flex"
{ count(); return DEQ; }
YY_BREAK
case 69:
YY_RULE_SETUP
#line 192 "swf4compiler.flex"
{ count(); return IEQ; }
YY_BREAK
case 70:
YY_RULE_SETUP
#line 193 "swf4compiler.flex"
{ count(); return SEQ; }
YY_BREAK
case 71:
YY_RULE_SETUP
#line 194 "swf4compiler.flex"
{ count(); return STREQ; }
YY_BREAK
case 72:
YY_RULE_SETUP
#line 195 "swf4compiler.flex"
{ count(); return STRNE; }
YY_BREAK
case 73:
YY_RULE_SETUP
#line 196 "swf4compiler.flex"
{ count(); return STRCMP; }
YY_BREAK
case 74:
YY_RULE_SETUP
#line 197 "swf4compiler.flex"
{ count(); return PARENT; }
YY_BREAK
case 75:
YY_RULE_SETUP
#line 199 "swf4compiler.flex"
{ count(); return ';'; }
YY_BREAK
case 76:
YY_RULE_SETUP
#line 200 "swf4compiler.flex"
{ count(); return '='; }
YY_BREAK
case 77:
YY_RULE_SETUP
#line 201 "swf4compiler.flex"
{ count(); return '+'; }
YY_BREAK
case 78:
YY_RULE_SETUP
#line 202 "swf4compiler.flex"
{ count(); return '-'; }
YY_BREAK
case 79:
YY_RULE_SETUP
#line 203 "swf4compiler.flex"
{ count(); return '&'; }
YY_BREAK
case 80:
YY_RULE_SETUP
#line 204 "swf4compiler.flex"
{ count(); return '*'; }
YY_BREAK
case 81:
YY_RULE_SETUP
#line 205 "swf4compiler.flex"
{ count(); return '/'; }
YY_BREAK
case 82:
YY_RULE_SETUP
#line 206 "swf4compiler.flex"
{ count(); return '!'; }
YY_BREAK
case 83:
YY_RULE_SETUP
#line 207 "swf4compiler.flex"
{ count(); return '('; }
YY_BREAK
case 84:
YY_RULE_SETUP
#line 208 "swf4compiler.flex"
{ count(); return ')'; }
YY_BREAK
case 85:
YY_RULE_SETUP
#line 209 "swf4compiler.flex"
{ count(); return '['; }
YY_BREAK
case 86:
YY_RULE_SETUP
#line 210 "swf4compiler.flex"
{ count(); return ']'; }
YY_BREAK
case 87:
YY_RULE_SETUP
#line 211 "swf4compiler.flex"
{ count(); return '{'; }
YY_BREAK
case 88:
YY_RULE_SETUP
#line 212 "swf4compiler.flex"
{ count(); return '}'; }
YY_BREAK
case 89:
YY_RULE_SETUP
#line 213 "swf4compiler.flex"
{ count(); return ','; }
YY_BREAK
case 90:
YY_RULE_SETUP
#line 214 "swf4compiler.flex"
{ count(); return '.'; }
YY_BREAK
case 91:
YY_RULE_SETUP
#line 215 "swf4compiler.flex"
{ count(); return '?'; }
YY_BREAK
case 92:
YY_RULE_SETUP
#line 216 "swf4compiler.flex"
{ count(); return ':'; }
YY_BREAK
case 93:
YY_RULE_SETUP
#line 218 "swf4compiler.flex"
{ count(); column = 0;
strcpy(szLine, yytext + 1);
++sLineNumber; yyless(1); }
YY_BREAK
case 94:
YY_RULE_SETUP
#line 222 "swf4compiler.flex"
printf( "Unrecognized character: %s\n", yytext );
YY_BREAK
case 95:
YY_RULE_SETUP
#line 224 "swf4compiler.flex"
ECHO;
YY_BREAK
#line 1454 "lex.swf4.c"
case YY_STATE_EOF(INITIAL):
yyterminate();
case YY_END_OF_BUFFER:
{
/* Amount of text matched not including the EOB char. */
int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
/* Undo the effects of YY_DO_BEFORE_ACTION. */
*yy_cp = yy_hold_char;
YY_RESTORE_YY_MORE_OFFSET
if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
{
/* We're scanning a new file or input source. It's
* possible that this happened because the user
* just pointed yyin at a new source and called
* yylex(). If so, then we have to assure
* consistency between yy_current_buffer and our
* globals. Here is the right place to do so, because
* this is the first action (other than possibly a
* back-up) that will match for the new input source.
*/
yy_n_chars = yy_current_buffer->yy_n_chars;
yy_current_buffer->yy_input_file = yyin;
yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
}
/* Note that here we test for yy_c_buf_p "<=" to the position
* of the first EOB in the buffer, since yy_c_buf_p will
* already have been incremented past the NUL character
* (since all states make transitions on EOB to the
* end-of-buffer state). Contrast this with the test
* in input().
*/
if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
{ /* This was really a NUL. */
yy_state_type yy_next_state;
yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
yy_current_state = yy_get_previous_state();
/* Okay, we're now positioned to make the NUL
* transition. We couldn't have
* yy_get_previous_state() go ahead and do it
* for us because it doesn't know how to deal
* with the possibility of jamming (and we don't
* want to build jamming into it because then it
* will run more slowly).
*/
yy_next_state = yy_try_NUL_trans( yy_current_state );
yy_bp = yytext_ptr + YY_MORE_ADJ;
if ( yy_next_state )
{
/* Consume the NUL. */
yy_cp = ++yy_c_buf_p;
yy_current_state = yy_next_state;
goto yy_match;
}
else
{
yy_cp = yy_c_buf_p;
goto yy_find_action;
}
}
else switch ( yy_get_next_buffer() )
{
case EOB_ACT_END_OF_FILE:
{
yy_did_buffer_switch_on_eof = 0;
if ( yywrap() )
{
/* Note: because we've taken care in
* yy_get_next_buffer() to have set up
* yytext, we can now set up
* yy_c_buf_p so that if some total
* hoser (like flex itself) wants to
* call the scanner after we return the
* YY_NULL, it'll still work - another
* YY_NULL will get returned.
*/
yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
yy_act = YY_STATE_EOF(YY_START);
goto do_action;
}
else
{
if ( ! yy_did_buffer_switch_on_eof )
YY_NEW_FILE;
}
break;
}
case EOB_ACT_CONTINUE_SCAN:
yy_c_buf_p =
yytext_ptr + yy_amount_of_matched_text;
yy_current_state = yy_get_previous_state();
yy_cp = yy_c_buf_p;
yy_bp = yytext_ptr + YY_MORE_ADJ;
goto yy_match;
case EOB_ACT_LAST_MATCH:
yy_c_buf_p =
&yy_current_buffer->yy_ch_buf[yy_n_chars];
yy_current_state = yy_get_previous_state();
yy_cp = yy_c_buf_p;
yy_bp = yytext_ptr + YY_MORE_ADJ;
goto yy_find_action;
}
break;
}
default:
YY_FATAL_ERROR(
"fatal flex scanner internal error--no action found" );
} /* end of action switch */
} /* end of scanning one token */
} /* end of yylex */
/* yy_get_next_buffer - try to read in a new buffer
*
* Returns a code representing an action:
* EOB_ACT_LAST_MATCH -
* EOB_ACT_CONTINUE_SCAN - continue scanning from current position
* EOB_ACT_END_OF_FILE - end of file
*/
static int yy_get_next_buffer()
{
register char *dest = yy_current_buffer->yy_ch_buf;
register char *source = yytext_ptr;
register int number_to_move, i;
int ret_val;
if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
YY_FATAL_ERROR(
"fatal flex scanner internal error--end of buffer missed" );
if ( yy_current_buffer->yy_fill_buffer == 0 )
{ /* Don't try to fill the buffer, so this is an EOF. */
if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
{
/* We matched a single character, the EOB, so
* treat this as a final EOF.
*/
return EOB_ACT_END_OF_FILE;
}
else
{
/* We matched some text prior to the EOB, first
* process it.
*/
return EOB_ACT_LAST_MATCH;
}
}
/* Try to read more data. */
/* First move last chars to start of buffer. */
number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
for ( i = 0; i < number_to_move; ++i )
*(dest++) = *(source++);
if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
/* don't do the read, it's not guaranteed to return an EOF,
* just force an EOF
*/
yy_current_buffer->yy_n_chars = yy_n_chars = 0;
else
{
int num_to_read =
yy_current_buffer->yy_buf_size - number_to_move - 1;
while ( num_to_read <= 0 )
{ /* Not enough room in the buffer - grow it. */
#ifdef YY_USES_REJECT
YY_FATAL_ERROR(
"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
#else
/* just a shorter name for the current buffer */
YY_BUFFER_STATE b = yy_current_buffer;
int yy_c_buf_p_offset =
(int) (yy_c_buf_p - b->yy_ch_buf);
if ( b->yy_is_our_buffer )
{
int new_size = b->yy_buf_size * 2;
if ( new_size <= 0 )
b->yy_buf_size += b->yy_buf_size / 8;
else
b->yy_buf_size *= 2;
b->yy_ch_buf = (char *)
/* Include room in for 2 EOB chars. */
yy_flex_realloc( (void *) b->yy_ch_buf,
b->yy_buf_size + 2 );
}
else
/* Can't grow it, we don't own it. */
b->yy_ch_buf = 0;
if ( ! b->yy_ch_buf )
YY_FATAL_ERROR(
"fatal error - scanner input buffer overflow" );
yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
num_to_read = yy_current_buffer->yy_buf_size -
number_to_move - 1;
#endif
}
if ( num_to_read > YY_READ_BUF_SIZE )
num_to_read = YY_READ_BUF_SIZE;
/* Read in more data. */
YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
yy_n_chars, num_to_read );
yy_current_buffer->yy_n_chars = yy_n_chars;
}
if ( yy_n_chars == 0 )
{
if ( number_to_move == YY_MORE_ADJ )
{
ret_val = EOB_ACT_END_OF_FILE;
yyrestart( yyin );
}
else
{
ret_val = EOB_ACT_LAST_MATCH;
yy_current_buffer->yy_buffer_status =
YY_BUFFER_EOF_PENDING;
}
}
else
ret_val = EOB_ACT_CONTINUE_SCAN;
yy_n_chars += number_to_move;
yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
return ret_val;
}
/* yy_get_previous_state - get the state just before the EOB char was reached */
static yy_state_type yy_get_previous_state()
{
register yy_state_type yy_current_state;
register char *yy_cp;
yy_current_state = yy_start;
for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
{
register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
if ( yy_accept[yy_current_state] )
{
yy_last_accepting_state = yy_current_state;
yy_last_accepting_cpos = yy_cp;
}
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 318 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
}
return yy_current_state;
}
/* yy_try_NUL_trans - try to make a transition on the NUL character
*
* synopsis
* next_state = yy_try_NUL_trans( current_state );
*/
#ifdef YY_USE_PROTOS
static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
#else
static yy_state_type yy_try_NUL_trans( yy_current_state )
yy_state_type yy_current_state;
#endif
{
register int yy_is_jam;
register char *yy_cp = yy_c_buf_p;
register YY_CHAR yy_c = 1;
if ( yy_accept[yy_current_state] )
{
yy_last_accepting_state = yy_current_state;
yy_last_accepting_cpos = yy_cp;
}
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 318 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
yy_is_jam = (yy_current_state == 317);
return yy_is_jam ? 0 : yy_current_state;
}
#ifndef YY_NO_UNPUT
#ifdef YY_USE_PROTOS
static void yyunput( int c, register char *yy_bp )
#else
static void yyunput( c, yy_bp )
int c;
register char *yy_bp;
#endif
{
register char *yy_cp = yy_c_buf_p;
/* undo effects of setting up yytext */
*yy_cp = yy_hold_char;
if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
{ /* need to shift things up to make room */
/* +2 for EOB chars. */
register int number_to_move = yy_n_chars + 2;
register char *dest = &yy_current_buffer->yy_ch_buf[
yy_current_buffer->yy_buf_size + 2];
register char *source =
&yy_current_buffer->yy_ch_buf[number_to_move];
while ( source > yy_current_buffer->yy_ch_buf )
*--dest = *--source;
yy_cp += (int) (dest - source);
yy_bp += (int) (dest - source);
yy_current_buffer->yy_n_chars =
yy_n_chars = yy_current_buffer->yy_buf_size;
if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
YY_FATAL_ERROR( "flex scanner push-back overflow" );
}
*--yy_cp = (char) c;
yytext_ptr = yy_bp;
yy_hold_char = *yy_cp;
yy_c_buf_p = yy_cp;
}
#endif /* ifndef YY_NO_UNPUT */
#ifdef __cplusplus
static int input()
#else
static int input()
#endif
{
int c;
*yy_c_buf_p = yy_hold_char;
if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
{
/* yy_c_buf_p now points to the character we want to return.
* If this occurs *before* the EOB characters, then it's a
* valid NUL; if not, then we've hit the end of the buffer.
*/
if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
/* This was really a NUL. */
*yy_c_buf_p = '\0';
else
{ /* need more input */
int offset = yy_c_buf_p - yytext_ptr;
++yy_c_buf_p;
switch ( yy_get_next_buffer() )
{
case EOB_ACT_LAST_MATCH:
/* This happens because yy_g_n_b()
* sees that we've accumulated a
* token and flags that we need to
* try matching the token before
* proceeding. But for input(),
* there's no matching to consider.
* So convert the EOB_ACT_LAST_MATCH
* to EOB_ACT_END_OF_FILE.
*/
/* Reset buffer status. */
yyrestart( yyin );
/* fall through */
case EOB_ACT_END_OF_FILE:
{
if ( yywrap() )
return EOF;
if ( ! yy_did_buffer_switch_on_eof )
YY_NEW_FILE;
#ifdef __cplusplus
return yyinput();
#else
return input();
#endif
}
case EOB_ACT_CONTINUE_SCAN:
yy_c_buf_p = yytext_ptr + offset;
break;
}
}
}
c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
*yy_c_buf_p = '\0'; /* preserve yytext */
yy_hold_char = *++yy_c_buf_p;
return c;
}
#ifdef YY_USE_PROTOS
void yyrestart( FILE *input_file )
#else
void yyrestart( input_file )
FILE *input_file;
#endif
{
if ( ! yy_current_buffer )
yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
yy_init_buffer( yy_current_buffer, input_file );
yy_load_buffer_state();
}
#ifdef YY_USE_PROTOS
void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
#else
void yy_switch_to_buffer( new_buffer )
YY_BUFFER_STATE new_buffer;
#endif
{
if ( yy_current_buffer == new_buffer )
return;
if ( yy_current_buffer )
{
/* Flush out information for old buffer. */
*yy_c_buf_p = yy_hold_char;
yy_current_buffer->yy_buf_pos = yy_c_buf_p;
yy_current_buffer->yy_n_chars = yy_n_chars;
}
yy_current_buffer = new_buffer;
yy_load_buffer_state();
/* We don't actually know whether we did this switch during
* EOF (yywrap()) processing, but the only time this flag
* is looked at is after yywrap() is called, so it's safe
* to go ahead and always set it.
*/
yy_did_buffer_switch_on_eof = 1;
}
#ifdef YY_USE_PROTOS
void yy_load_buffer_state( void )
#else
void yy_load_buffer_state()
#endif
{
yy_n_chars = yy_current_buffer->yy_n_chars;
yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
yyin = yy_current_buffer->yy_input_file;
yy_hold_char = *yy_c_buf_p;
}
#ifdef YY_USE_PROTOS
YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
#else
YY_BUFFER_STATE yy_create_buffer( file, size )
FILE *file;
int size;
#endif
{
YY_BUFFER_STATE b;
b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
b->yy_buf_size = size;
/* yy_ch_buf has to be 2 characters longer than the size given because
* we need to put in 2 end-of-buffer characters.
*/
b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
if ( ! b->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
b->yy_is_our_buffer = 1;
yy_init_buffer( b, file );
return b;
}
#ifdef YY_USE_PROTOS
void yy_delete_buffer( YY_BUFFER_STATE b )
#else
void yy_delete_buffer( b )
YY_BUFFER_STATE b;
#endif
{
if ( ! b )
return;
if ( b == yy_current_buffer )
yy_current_buffer = (YY_BUFFER_STATE) 0;
if ( b->yy_is_our_buffer )
yy_flex_free( (void *) b->yy_ch_buf );
yy_flex_free( (void *) b );
}
#ifndef YY_ALWAYS_INTERACTIVE
#ifndef YY_NEVER_INTERACTIVE
extern int isatty YY_PROTO(( int ));
#endif
#endif
#ifdef YY_USE_PROTOS
void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
#else
void yy_init_buffer( b, file )
YY_BUFFER_STATE b;
FILE *file;
#endif
{
yy_flush_buffer( b );
b->yy_input_file = file;
b->yy_fill_buffer = 1;
#if YY_ALWAYS_INTERACTIVE
b->yy_is_interactive = 1;
#else
#if YY_NEVER_INTERACTIVE
b->yy_is_interactive = 0;
#else
b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
#endif
#endif
}
#ifdef YY_USE_PROTOS
void yy_flush_buffer( YY_BUFFER_STATE b )
#else
void yy_flush_buffer( b )
YY_BUFFER_STATE b;
#endif
{
if ( ! b )
return;
b->yy_n_chars = 0;
/* We always need two end-of-buffer characters. The first causes
* a transition to the end-of-buffer state. The second causes
* a jam in that state.
*/
b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
b->yy_buf_pos = &b->yy_ch_buf[0];
b->yy_at_bol = 1;
b->yy_buffer_status = YY_BUFFER_NEW;
if ( b == yy_current_buffer )
yy_load_buffer_state();
}
#ifndef YY_NO_SCAN_BUFFER
#ifdef YY_USE_PROTOS
YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
#else
YY_BUFFER_STATE yy_scan_buffer( base, size )
char *base;
yy_size_t size;
#endif
{
YY_BUFFER_STATE b;
if ( size < 2 ||
base[size-2] != YY_END_OF_BUFFER_CHAR ||
base[size-1] != YY_END_OF_BUFFER_CHAR )
/* They forgot to leave room for the EOB's. */
return 0;
b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
b->yy_buf_pos = b->yy_ch_buf = base;
b->yy_is_our_buffer = 0;
b->yy_input_file = 0;
b->yy_n_chars = b->yy_buf_size;
b->yy_is_interactive = 0;
b->yy_at_bol = 1;
b->yy_fill_buffer = 0;
b->yy_buffer_status = YY_BUFFER_NEW;
yy_switch_to_buffer( b );
return b;
}
#endif
#ifndef YY_NO_SCAN_STRING
#ifdef YY_USE_PROTOS
YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
#else
YY_BUFFER_STATE yy_scan_string( yy_str )
yyconst char *yy_str;
#endif
{
int len;
for ( len = 0; yy_str[len]; ++len )
;
return yy_scan_sbytes( yy_str, len );
}
#endif
#ifndef YY_NO_SCAN_sbyteS
#ifdef YY_USE_PROTOS
YY_BUFFER_STATE yy_scan_sbytes( yyconst char *sbytes, int len )
#else
YY_BUFFER_STATE yy_scan_sbytes( sbytes, len )
yyconst char *sbytes;
int len;
#endif
{
YY_BUFFER_STATE b;
char *buf;
yy_size_t n;
int i;
/* Get memory for full buffer, including space for trailing EOB's. */
n = len + 2;
buf = (char *) yy_flex_alloc( n );
if ( ! buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_sbytes()" );
for ( i = 0; i < len; ++i )
buf[i] = sbytes[i];
buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
b = yy_scan_buffer( buf, n );
if ( ! b )
YY_FATAL_ERROR( "bad buffer in yy_scan_sbytes()" );
/* It's okay to grow etc. this buffer, and we should throw it
* away when we're done.
*/
b->yy_is_our_buffer = 1;
return b;
}
#endif
#ifndef YY_NO_PUSH_STATE
#ifdef YY_USE_PROTOS
static void yy_push_state( int new_state )
#else
static void yy_push_state( new_state )
int new_state;
#endif
{
if ( yy_start_stack_ptr >= yy_start_stack_depth )
{
yy_size_t new_size;
yy_start_stack_depth += YY_START_STACK_INCR;
new_size = yy_start_stack_depth * sizeof( int );
if ( ! yy_start_stack )
yy_start_stack = (int *) yy_flex_alloc( new_size );
else
yy_start_stack = (int *) yy_flex_realloc(
(void *) yy_start_stack, new_size );
if ( ! yy_start_stack )
YY_FATAL_ERROR(
"out of memory expanding start-condition stack" );
}
yy_start_stack[yy_start_stack_ptr++] = YY_START;
BEGIN(new_state);
}
#endif
#ifndef YY_NO_POP_STATE
static void yy_pop_state()
{
if ( --yy_start_stack_ptr < 0 )
YY_FATAL_ERROR( "start-condition stack underflow" );
BEGIN(yy_start_stack[yy_start_stack_ptr]);
}
#endif
#ifndef YY_NO_TOP_STATE
static int yy_top_state()
{
return yy_start_stack[yy_start_stack_ptr - 1];
}
#endif
#ifndef YY_EXIT_FAILURE
#define YY_EXIT_FAILURE 2
#endif
#ifdef YY_USE_PROTOS
static void yy_fatal_error( yyconst char msg[] )
#else
static void yy_fatal_error( msg )
char msg[];
#endif
{
(void) fprintf( stderr, "%s\n", msg );
exit( YY_EXIT_FAILURE );
}
/* Redefine yyless() so it works in section 3 code. */
#undef yyless
#define yyless(n) \
do \
{ \
/* Undo effects of setting up yytext. */ \
yytext[yyleng] = yy_hold_char; \
yy_c_buf_p = yytext + n; \
yy_hold_char = *yy_c_buf_p; \
*yy_c_buf_p = '\0'; \
yyleng = n; \
} \
while ( 0 )
/* Internal utility routines. */
#ifndef yytext_ptr
#ifdef YY_USE_PROTOS
static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
#else
static void yy_flex_strncpy( s1, s2, n )
char *s1;
yyconst char *s2;
int n;
#endif
{
register int i;
for ( i = 0; i < n; ++i )
s1[i] = s2[i];
}
#endif
#ifdef YY_NEED_STRLEN
#ifdef YY_USE_PROTOS
static int yy_flex_strlen( yyconst char *s )
#else
static int yy_flex_strlen( s )
yyconst char *s;
#endif
{
register int n;
for ( n = 0; s[n]; ++n )
;
return n;
}
#endif
#ifdef YY_USE_PROTOS
static void *yy_flex_alloc( yy_size_t size )
#else
static void *yy_flex_alloc( size )
yy_size_t size;
#endif
{
return (void *) malloc( size );
}
#ifdef YY_USE_PROTOS
static void *yy_flex_realloc( void *ptr, yy_size_t size )
#else
static void *yy_flex_realloc( ptr, size )
void *ptr;
yy_size_t size;
#endif
{
/* The cast to (char *) in the following accommodates both
* implementations that use char* generic pointers, and those
* that use void* generic pointers. It works with the latter
* because both ANSI C and C++ allow castless assignment from
* any pointer type to void*, and deal with argument conversions
* as though doing an assignment.
*/
return (void *) realloc( (char *) ptr, size );
}
#ifdef YY_USE_PROTOS
static void yy_flex_free( void *ptr )
#else
static void yy_flex_free( ptr )
void *ptr;
#endif
{
free( ptr );
}
#if YY_MAIN
int main()
{
yylex();
return 0;
}
#endif
#line 224 "swf4compiler.flex"
int swf4wrap()
{
return 1;
}
static void countline()
{
if(sLineNumber != 0)
msgline[column] = 0;
++sLineNumber;
column = 0;
msgline = msgbufs[sLineNumber & 1];
}
static int LineNumber(void)
{
return (sLineNumber + 1);
}
static int ColumnNumber(void)
{
return column;
}
static char *LineText(void)
{
msgline[column] = 0;
return msgline;
}
static void comment(void)
{
// Handle block comments
char c, c1;
loop:
// We have the start of a comment so look skip everything up to the
// end of the comment character
while ((c = input()) != '*' && c != 0)
{
if(column < 1023)
msgline[column] = c;
++column;
// keep the line number in synch
if (c == '\n')
{
// start the output (matches the algorithim in the lexx above)
countline();
}
if (swf4debug) putchar(c);
}
// is this the end of comment character
if ((c1 = input()) != '/' && c != 0)
{
// false start as this was no end of comment
unput(c1);
goto loop;
}
// write out the start of the end of comment
if (c != 0)
if (swf4debug) putchar(c);
// write out the end of the end of comment
if (c1 != 0)
if (swf4debug) putchar(c1);
}
static void comment1(void)
{
// Handle comment of type 1 (ie '//')
char c;
// this is a line comment
while ((c = input()) != '\n' && c != 0)
{
if (swf4debug) putchar(c);
if(column < 1023)
msgline[column] = c;
++column;
};
// keep the line number in synch
if (c == '\n')
{
if (swf4debug) putchar(c);
countline();
}
}
static void count(void)
{
int n;
// Count the characters to maintain the current column position
if (yytext[0] == '\n')
{
if (swf4debug) printf("\n");
}
else
{
if (swf4debug) printf("%s", yytext);
for(n=0; n<yyleng; ++n, ++column)
{
if(column < 1023)
msgline[column] = yytext[n];
}
//-- keep writing the stuff to standard output
//column += yyleng;
}
}
static void printprog()
{
if(sLineNumber)
SWF_warn("\n%s", msgbufs[(sLineNumber-1)&1]);
if(column < 1023)
msgline[column] = 0;
SWF_warn("\n%s", msgline);
}
static void warning(char *msg)
{
// print a warning message
printprog();
SWF_warn("\n%*s", ColumnNumber(), "^");
SWF_warn("\nLine %4.4d: Reason: '%s' \n", LineNumber(), msg);
}
void swf4error(char *msg)
{
// report a error
if(strlen(yytext))
{
SWF_error(error_fp,"\n%s\n%*s\nLine %i: Reason: '%s'\n",
LineText(), ColumnNumber(), "^", LineNumber(), msg);
}
else
{
SWF_error(error_fp,"\nLine %d: Reason: 'Unexpected EOF found while looking for input.'\n", LineNumber());
}
}
| [
"alexandre.jasmin@gmail.com"
] | alexandre.jasmin@gmail.com |
70b2a874f1c0c89a7e7e7bcd229e7d2b65f732c0 | 66a12a710a7bd7cb4483fb9a073fcfcf92e3a4f6 | /random/bitsManupulation.cpp | 07a03d65b1a52928f7116e3650edae12d55cafcc | [] | no_license | faizan346/Ds-Algo-Cplusplus | b44c8c43a30643c30ad8f8ab15fff9c7f0d0bb4b | 41bf24ef365d0f35cff0786f2e85d5523ee1c7b1 | refs/heads/master | 2023-06-21T17:52:30.346070 | 2021-07-25T19:54:46 | 2021-07-25T19:54:46 | 361,234,839 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,585 | cpp | #include<bits/stdc++.h>
using namespace std;
//normal way to find whether number is power of 2.
bool isPowerTwo(int x) {
if(x == 0)
return false;
else {
while(x%2 == 0) x /= 2;
return (x == 1);
}
}
//using bits
bool isPowerTwoBits(int x) {
//(x&(x-1)) in x-1 chagne rightmost set bit to end bit into opposite bits.
// and with & opp with x give zero for all those right bits starting with righmost set bit.
return (x && !(x&(x-1))); // also handles zero
}
//counting number of ones in bits representation of a number.
// logN in general if we divide by 2 to find nubmer of ones.
// using bits logic can find in k time where k is length of bits of number
int numberOfOnes(int x) {
int count = 0;
while(x) {
x = x&(x-1);
count++;
}
return count;
}
// checking whether ith bit set in a number.
bool isBitSet(int x, int i) {
return x&(1<<i);
}
void generateSubsets(char a[], int n) {
for(int i = 0; i < (1<<n); i++) {
for(int j = 0; j < n; j++) {
if(i & (1<<j)) cout << a[j] << " ";
}
cout << endl;
}
}
//using recursion
// void subsets(char a[], int n, char b[]) {
// if(n == 0) {
// for(int i = 4; i >= 0; i--) {
// if(b[i] != '0') cout << b[i] << " ";
// }
// cout << endl;
// return;
// }
// b[n-1] = a[n-1];
// subsets(a, n-1, b);
// b[n-1] = '0';
// subsets(a, n-1, b);
// }
//above one is unnecessary.
void printSubSet(char *a, int n, string s) {
if(n == 0) {
cout << s << endl;
return;
}
printSubSet(a, n-1, s);
printSubSet(a, n-1, s+a[n-1]);
}
//largest power of 2 for given number n
int largestPowerOftwo(int n) {
//making all bits to the right of msb to 1.
//for 16 bit , we can do more
n = n | n>>1;
n = n | n>>2;
n = n | n>>4;
n = n | n>>8;
// n = x + (x-1) = 2*x - 1; wher x is of power of 2
return (n+1)>>1;
}
int main() {
int n = 5;
char a[] = {'a','b','c','d','e'};
char b[n];
//cout << isPowerTwoBits(4) << isPowerTwoBits(6);
//cout << numberOfOnes(6);
//cout << isBitSet(5,0) << isBitSet(5,1)<<isBitSet(5,2);
//generateSubsets(a, n);
//subsets(a, n, b);
//cout << largestPowerOftwo(7);
cout << endl;
}
// 1 << n = 2^n
// 4 >> 1 = 4/2^1
// 6 >> 1 = 3
// 5 >> 1 = 2
// x ^ ( x & (x-1)) : Returns the rightmost 1 in binary representation of x.
// x & (-x) : Returns the rightmost 1 in binary representation of x
// x | (1 << n) : Returns the number x with the nth bit set.
| [
"faizansagheer346c@gmail.com"
] | faizansagheer346c@gmail.com |
7cbf04e79dbc8132a89dd84ce3fe3c8592f969e3 | b0eeea6bed88fd71731caf4406e2e422d85e477c | /ExternalBeamPlanning/SubjectHierarchyPlugins/qSlicerSubjectHierarchyRTBeamPlugin.cxx | 3e0da2dac6abe15fab1aaad2b3c52c67ecd48e20 | [] | no_license | vovythevov/SlicerRT | 04e86d88427cfd5b91b4e13273753cdde4e934c1 | 59b0e6e27c9bbf8d1e983c13a586158b8057999a | refs/heads/master | 2021-01-21T04:05:02.682242 | 2015-10-15T18:52:28 | 2015-10-15T18:52:28 | 45,185,925 | 0 | 0 | null | 2015-10-29T13:47:22 | 2015-10-29T13:47:20 | null | UTF-8 | C++ | false | false | 5,172 | cxx | /*==============================================================================
Copyright (c) Laboratory for Percutaneous Surgery (PerkLab)
Queen's University, Kingston, ON, Canada. All Rights Reserved.
See COPYRIGHT.txt
or http://www.slicer.org/copyright/copyright.txt for details.
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.
This file was originally developed by Csaba Pinter, PerkLab, Queen's University
and was supported through the Applied Cancer Research Unit program of Cancer Care
Ontario with funds provided by the Ontario Ministry of Health and Long-Term Care
==============================================================================*/
// ExternalBeamPlanning includes
#include "qSlicerSubjectHierarchyRTBeamPlugin.h"
// SubjectHierarchy MRML includes
#include "vtkMRMLSubjectHierarchyConstants.h"
#include "vtkMRMLSubjectHierarchyNode.h"
// SubjectHierarchy Plugins includes
#include "qSlicerSubjectHierarchyPluginHandler.h"
#include "qSlicerSubjectHierarchyDefaultPlugin.h"
// MRML includes
#include <vtkMRMLNode.h>
#include <vtkMRMLScene.h>
#include <vtkMRMLModelNode.h>
// MRML Widgets includes
#include <qMRMLNodeComboBox.h>
// VTK includes
#include <vtkObjectFactory.h>
#include <vtkSmartPointer.h>
// Qt includes
#include <QDebug>
#include <QIcon>
#include <QStandardItem>
#include <QAction>
// SlicerQt includes
#include "qSlicerAbstractModuleWidget.h"
//-----------------------------------------------------------------------------
/// \ingroup SlicerRt_QtModules_RtHierarchy
class qSlicerSubjectHierarchyRTBeamPluginPrivate: public QObject
{
Q_DECLARE_PUBLIC(qSlicerSubjectHierarchyRTBeamPlugin);
protected:
qSlicerSubjectHierarchyRTBeamPlugin* const q_ptr;
public:
qSlicerSubjectHierarchyRTBeamPluginPrivate(qSlicerSubjectHierarchyRTBeamPlugin& object);
~qSlicerSubjectHierarchyRTBeamPluginPrivate();
public:
QIcon BeamIcon;
};
//-----------------------------------------------------------------------------
// qSlicerSubjectHierarchyRTBeamPluginPrivate methods
//-----------------------------------------------------------------------------
qSlicerSubjectHierarchyRTBeamPluginPrivate::qSlicerSubjectHierarchyRTBeamPluginPrivate(qSlicerSubjectHierarchyRTBeamPlugin& object)
: q_ptr(&object)
{
this->BeamIcon = QIcon(":Icons/Beam.png");
}
//-----------------------------------------------------------------------------
qSlicerSubjectHierarchyRTBeamPluginPrivate::~qSlicerSubjectHierarchyRTBeamPluginPrivate()
{
}
//-----------------------------------------------------------------------------
qSlicerSubjectHierarchyRTBeamPlugin::qSlicerSubjectHierarchyRTBeamPlugin(QObject* parent)
: Superclass(parent)
, d_ptr( new qSlicerSubjectHierarchyRTBeamPluginPrivate(*this) )
{
this->m_Name = QString("RTBeam");
}
//-----------------------------------------------------------------------------
qSlicerSubjectHierarchyRTBeamPlugin::~qSlicerSubjectHierarchyRTBeamPlugin()
{
}
//---------------------------------------------------------------------------
double qSlicerSubjectHierarchyRTBeamPlugin::canOwnSubjectHierarchyNode(vtkMRMLSubjectHierarchyNode* node)const
{
if (!node)
{
qCritical() << "qSlicerSubjectHierarchyRTBeamPlugin::canOwnSubjectHierarchyNode: Input node is NULL!";
return 0.0;
}
vtkMRMLNode* associatedNode = node->GetAssociatedNode();
// RT beam
if ( associatedNode && associatedNode->IsA("vtkMRMLRTBeamNode") )
{
return 1.0;
}
return 0.0;
}
//---------------------------------------------------------------------------
const QString qSlicerSubjectHierarchyRTBeamPlugin::roleForPlugin()const
{
return "RT beam";
}
//---------------------------------------------------------------------------
QIcon qSlicerSubjectHierarchyRTBeamPlugin::icon(vtkMRMLSubjectHierarchyNode* node)
{
if (!node)
{
qCritical() << "qSlicerSubjectHierarchyRTBeamPlugin::icon: NULL node given!";
return QIcon();
}
Q_D(qSlicerSubjectHierarchyRTBeamPlugin);
if (this->canOwnSubjectHierarchyNode(node))
{
return d->BeamIcon;
}
// Node unknown by plugin
return QIcon();
}
//---------------------------------------------------------------------------
QIcon qSlicerSubjectHierarchyRTBeamPlugin::visibilityIcon(int visible)
{
// Have the default plugin (which is not registered) take care of this
return qSlicerSubjectHierarchyPluginHandler::instance()->defaultPlugin()->visibilityIcon(visible);
}
//---------------------------------------------------------------------------
void qSlicerSubjectHierarchyRTBeamPlugin::editProperties(vtkMRMLSubjectHierarchyNode* node)
{
Q_UNUSED(node);
// Switch to External Beam Planning module
qSlicerSubjectHierarchyAbstractPlugin::switchToModule("ExternalBeamPlanning");
}
| [
"pinter@25a7314f-c4c8-4314-9936-a25f8480a772"
] | pinter@25a7314f-c4c8-4314-9936-a25f8480a772 |
0c0001d9c49924372a47cfd47f7e982385bc8c2c | 0b2c6a6393c2f14961edbbaff0604cf32a204397 | /Regular/HW4/Task 1/Subscriber.cpp | 1646c373b2c5b96f50484ba15d164264815353f4 | [] | no_license | MomchilZanev/FMI-OOP-Course | 6e4006a11dd567b7a2b6c1a9de168352516dcab0 | e32c8ff954347b6d0354e037b2b6ceacc3aaadb4 | refs/heads/main | 2023-07-15T04:51:06.672769 | 2021-09-01T07:50:47 | 2021-09-01T08:01:51 | 401,980,198 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 175 | cpp | #include "Subscriber.hpp"
Subscriber::Subscriber(const std::string& id)
: id(id)
{ }
void Subscriber::signal(const Message& message)
{
this->messages.push_back(message);
} | [
"40828721+MomchilZanev@users.noreply.github.com"
] | 40828721+MomchilZanev@users.noreply.github.com |
4e3b575d6376142dca91156b67001ed35b2ecfb0 | a8e4f6444d54edcfa9f37f742eb67c9f3b65d3da | /src/ns2/greencloud/dcscheduler/randdens.h | 0c41de4f5be1b8fa04d3755c8fded4b0d23fc608 | [] | no_license | smirzaei/greencloud-ns2 | 9e6e508736050841907f6c4cf89570731be16f9e | 04f3c15d2a4f2c22472d766d7b788f16fd67f648 | refs/heads/master | 2022-04-27T09:33:53.822757 | 2020-05-01T14:28:11 | 2020-05-01T14:28:11 | 260,478,090 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 706 | h | /*
* multidens.h
*
* @date Jan 8, 2014
* @author Guzek:Mateusz
*/
#ifndef MULTIDENS_H_
#define MULTIDENS_H_
#include <algorithm>
#include <math.h>
#include "probabilisticscheduler.h"
/**
* RandDENS scheduler.
* To meaningfully use it, enableDVFS on the resource providers used by this scheduler.
*/
class RandDENS : public ProbabilisticScheduler {
public:
RandDENS();
virtual ~RandDENS();
virtual TskComAgent* scheduleTask(CloudTask* task, std::vector<ResourceProvider* > providers);
private:
double epsilon;
virtual double calculateScore(ResourceProvider* rp);
double densLoadFactor(double load,double epsilon);
double linkLoadFactor(double load);
};
#endif /* MULTIDENS_H_ */
| [
"greencloud@greencloud.(none)"
] | greencloud@greencloud.(none) |
74c9e942bfb358e51d30861b872633e6bb4f30fb | 73ee941896043f9b3e2ab40028d24ddd202f695f | /external/skia/tests/FontHostTest.cpp | 7358b1089a62b5047a7f2f48d596502ec59a8c57 | [
"BSD-3-Clause",
"SGI-B-2.0"
] | permissive | CyFI-Lab-Public/RetroScope | d441ea28b33aceeb9888c330a54b033cd7d48b05 | 276b5b03d63f49235db74f2c501057abb9e79d89 | refs/heads/master | 2022-04-08T23:11:44.482107 | 2016-09-22T20:15:43 | 2016-09-22T20:15:43 | 58,890,600 | 5 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 9,166 | cpp | /*
* 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 "Test.h"
#include "SkPaint.h"
#include "SkFontStream.h"
#include "SkStream.h"
#include "SkTypeface.h"
#include "SkEndian.h"
//#define DUMP_TABLES
//#define DUMP_TTC_TABLES
#define kFontTableTag_head SkSetFourByteTag('h', 'e', 'a', 'd')
#define kFontTableTag_hhea SkSetFourByteTag('h', 'h', 'e', 'a')
#define kFontTableTag_maxp SkSetFourByteTag('m', 'a', 'x', 'p')
static const struct TagSize {
SkFontTableTag fTag;
size_t fSize;
} gKnownTableSizes[] = {
{ kFontTableTag_head, 54 },
{ kFontTableTag_hhea, 36 },
{ kFontTableTag_maxp, 32 },
};
// Test that getUnitsPerEm() agrees with a direct lookup in the 'head' table
// (if that table is available).
static void test_unitsPerEm(skiatest::Reporter* reporter, SkTypeface* face) {
int nativeUPEM = face->getUnitsPerEm();
int tableUPEM = -1;
size_t size = face->getTableSize(kFontTableTag_head);
if (size) {
// unitsPerEm is at offset 18 into the 'head' table.
uint16_t rawUPEM;
face->getTableData(kFontTableTag_head, 18, sizeof(rawUPEM), &rawUPEM);
tableUPEM = SkEndian_SwapBE16(rawUPEM);
}
if (tableUPEM >= 0) {
REPORTER_ASSERT(reporter, tableUPEM == nativeUPEM);
} else {
// not sure this is a bug, but lets report it for now as info.
SkDebugf("--- typeface returned 0 upem [%X]\n", face->uniqueID());
}
}
// Test that countGlyphs() agrees with a direct lookup in the 'maxp' table
// (if that table is available).
static void test_countGlyphs(skiatest::Reporter* reporter, SkTypeface* face) {
int nativeGlyphs = face->countGlyphs();
int tableGlyphs = -1;
size_t size = face->getTableSize(kFontTableTag_maxp);
if (size) {
// glyphs is at offset 4 into the 'maxp' table.
uint16_t rawGlyphs;
face->getTableData(kFontTableTag_maxp, 4, sizeof(rawGlyphs), &rawGlyphs);
tableGlyphs = SkEndian_SwapBE16(rawGlyphs);
}
if (tableGlyphs >= 0) {
REPORTER_ASSERT(reporter, tableGlyphs == nativeGlyphs);
} else {
// not sure this is a bug, but lets report it for now as info.
SkDebugf("--- typeface returned 0 glyphs [%X]\n", face->uniqueID());
}
}
static void test_fontstream(skiatest::Reporter* reporter,
SkStream* stream, int ttcIndex) {
int n = SkFontStream::GetTableTags(stream, ttcIndex, NULL);
SkAutoTArray<SkFontTableTag> array(n);
int n2 = SkFontStream::GetTableTags(stream, ttcIndex, array.get());
REPORTER_ASSERT(reporter, n == n2);
for (int i = 0; i < n; ++i) {
#ifdef DUMP_TTC_TABLES
SkString str;
SkFontTableTag t = array[i];
str.appendUnichar((t >> 24) & 0xFF);
str.appendUnichar((t >> 16) & 0xFF);
str.appendUnichar((t >> 8) & 0xFF);
str.appendUnichar((t >> 0) & 0xFF);
SkDebugf("[%d:%d] '%s'\n", ttcIndex, i, str.c_str());
#endif
size_t size = SkFontStream::GetTableSize(stream, ttcIndex, array[i]);
for (size_t j = 0; j < SK_ARRAY_COUNT(gKnownTableSizes); ++j) {
if (gKnownTableSizes[j].fTag == array[i]) {
REPORTER_ASSERT(reporter, gKnownTableSizes[j].fSize == size);
}
}
}
}
static void test_fontstream(skiatest::Reporter* reporter, SkStream* stream) {
int count = SkFontStream::CountTTCEntries(stream);
#ifdef DUMP_TTC_TABLES
SkDebugf("CountTTCEntries %d\n", count);
#endif
for (int i = 0; i < count; ++i) {
test_fontstream(reporter, stream, i);
}
}
static void test_fontstream(skiatest::Reporter* reporter) {
// TODO: replace when we get a tools/resources/fonts/test.ttc
const char* name = "/AmericanTypewriter.ttc";
SkFILEStream stream(name);
if (stream.isValid()) {
test_fontstream(reporter, &stream);
}
}
static void test_tables(skiatest::Reporter* reporter, SkTypeface* face) {
if (false) { // avoid bit rot, suppress warning
SkFontID fontID = face->uniqueID();
REPORTER_ASSERT(reporter, fontID);
}
int count = face->countTables();
SkAutoTMalloc<SkFontTableTag> storage(count);
SkFontTableTag* tags = storage.get();
int count2 = face->getTableTags(tags);
REPORTER_ASSERT(reporter, count2 == count);
for (int i = 0; i < count; ++i) {
size_t size = face->getTableSize(tags[i]);
REPORTER_ASSERT(reporter, size > 0);
#ifdef DUMP_TABLES
char name[5];
name[0] = (tags[i] >> 24) & 0xFF;
name[1] = (tags[i] >> 16) & 0xFF;
name[2] = (tags[i] >> 8) & 0xFF;
name[3] = (tags[i] >> 0) & 0xFF;
name[4] = 0;
SkDebugf("%s %d\n", name, size);
#endif
for (size_t j = 0; j < SK_ARRAY_COUNT(gKnownTableSizes); ++j) {
if (gKnownTableSizes[j].fTag == tags[i]) {
REPORTER_ASSERT(reporter, gKnownTableSizes[j].fSize == size);
}
}
// do we get the same size from GetTableData and GetTableSize
{
SkAutoMalloc data(size);
size_t size2 = face->getTableData(tags[i], 0, size, data.get());
REPORTER_ASSERT(reporter, size2 == size);
}
}
}
static void test_tables(skiatest::Reporter* reporter) {
static const char* const gNames[] = {
NULL, // default font
"Arial", "Times", "Times New Roman", "Helvetica", "Courier",
"Courier New", "Terminal", "MS Sans Serif",
};
for (size_t i = 0; i < SK_ARRAY_COUNT(gNames); ++i) {
SkTypeface* face = SkTypeface::CreateFromName(gNames[i],
SkTypeface::kNormal);
if (face) {
#ifdef DUMP_TABLES
SkDebugf("%s\n", gNames[i]);
#endif
test_tables(reporter, face);
test_unitsPerEm(reporter, face);
test_countGlyphs(reporter, face);
face->unref();
}
}
}
/*
* Verifies that the advance values returned by generateAdvance and
* generateMetrics match.
*/
static void test_advances(skiatest::Reporter* reporter) {
static const char* const faces[] = {
NULL, // default font
"Arial", "Times", "Times New Roman", "Helvetica", "Courier",
"Courier New", "Verdana", "monospace",
};
static const struct {
SkPaint::Hinting hinting;
unsigned flags;
} settings[] = {
{ SkPaint::kNo_Hinting, 0 },
{ SkPaint::kNo_Hinting, SkPaint::kLinearText_Flag },
{ SkPaint::kNo_Hinting, SkPaint::kSubpixelText_Flag },
{ SkPaint::kSlight_Hinting, 0 },
{ SkPaint::kSlight_Hinting, SkPaint::kLinearText_Flag },
{ SkPaint::kSlight_Hinting, SkPaint::kSubpixelText_Flag },
{ SkPaint::kNormal_Hinting, 0 },
{ SkPaint::kNormal_Hinting, SkPaint::kLinearText_Flag },
{ SkPaint::kNormal_Hinting, SkPaint::kSubpixelText_Flag },
};
static const struct {
SkScalar fScaleX;
SkScalar fSkewX;
} gScaleRec[] = {
{ SK_Scalar1, 0 },
{ SK_Scalar1/2, 0 },
// these two exercise obliquing (skew)
{ SK_Scalar1, -SK_Scalar1/4 },
{ SK_Scalar1/2, -SK_Scalar1/4 },
};
SkPaint paint;
char txt[] = "long.text.with.lots.of.dots.";
for (size_t i = 0; i < SK_ARRAY_COUNT(faces); i++) {
SkAutoTUnref<SkTypeface> face(SkTypeface::CreateFromName(faces[i], SkTypeface::kNormal));
paint.setTypeface(face);
for (size_t j = 0; j < SK_ARRAY_COUNT(settings); j++) {
paint.setHinting(settings[j].hinting);
paint.setLinearText((settings[j].flags & SkPaint::kLinearText_Flag) != 0);
paint.setSubpixelText((settings[j].flags & SkPaint::kSubpixelText_Flag) != 0);
for (size_t k = 0; k < SK_ARRAY_COUNT(gScaleRec); ++k) {
paint.setTextScaleX(gScaleRec[k].fScaleX);
paint.setTextSkewX(gScaleRec[k].fSkewX);
SkRect bounds;
// For no hinting and light hinting this should take the
// optimized generateAdvance path.
SkScalar width1 = paint.measureText(txt, strlen(txt));
// Requesting the bounds forces a generateMetrics call.
SkScalar width2 = paint.measureText(txt, strlen(txt), &bounds);
// SkDebugf("Font: %s, generateAdvance: %f, generateMetrics: %f\n",
// faces[i], SkScalarToFloat(width1), SkScalarToFloat(width2));
REPORTER_ASSERT(reporter, width1 == width2);
}
}
}
}
static void TestFontHost(skiatest::Reporter* reporter) {
test_tables(reporter);
test_fontstream(reporter);
test_advances(reporter);
}
// need tests for SkStrSearch
#include "TestClassDef.h"
DEFINE_TESTCLASS("FontHost", FontHostTestClass, TestFontHost)
| [
"ProjectRetroScope@gmail.com"
] | ProjectRetroScope@gmail.com |
e1b690384bcd94c98307ad0455d2320956df9bdf | 951d7c74608bc306986d373c87aa6b98dba5ce05 | /DatosR/Satelite.h | e9180dc3f5b6f98303b974bf05357e29cf0f6ce1 | [] | no_license | enricmacias/SpaceshipBattle | 389abaa95365b3fe661bb31e404900370ade5cb5 | 068860e5c126555070b5af0454531e7ce4439e33 | refs/heads/master | 2021-01-10T12:37:29.965486 | 2015-12-16T07:24:14 | 2015-12-16T07:24:14 | 48,083,857 | 0 | 0 | null | null | null | null | ISO-8859-1 | C++ | false | false | 1,703 | h | /*! \file Satelite.h
* \brief Objeto enemigo IA
* \version 1.0
* \author Enric Macías López <tm18164@salle.url.edu> Manel Tso Torres <tm17801>
* \date 18 de Juny de 2009
*/
#ifndef SATELITE_H
#define SATELITE_H
#include "Nave.h"
//#include "Math.h"
/*! \class Enemigo IA
* \brief Guarda la información de un enemigo.
*/
class Satelite : public Nave
{
private:
float mTra; /*!< Ángulo de trayectoria */
Vector2D mPeligro; /*!< Ávector peligro */
public:
/*! \fn Satelite::Satelite( void )
* \brief Constructor. Inicializa todas las variables.
* \param None.
* \return None.
*/
Satelite();
/*! \fn Satelite::~Satelite( void )
* \brief Destructor.
* \param None.
* \return None.
*/
~Satelite();
/*! \fn void Satelite::setTra( void )
* \brief Establece la trayectoria.
* \param None.
* \return None
*/
void setTra();
/*! \fn void Satelite::Reduce( int mult )
* \brief Reduce la velocidad a mult
* \param int mult
* \return None
*/
void Reduce( int mult );
/*! \fn Vector2D Satelite::getPeligro( )
* \brief devuelve el vector peligro
* \param none
* \return Vector2D
*/
Vector2D getPeligro( void ){ return mPeligro;};
/*! \fn void Satelite::getPeligro( float xPeligro, float yPeligro )
* \brief establece el vector peligro
* \param float xPeligro, float yPeligro
* \return none
*/
void setPeligro( float xPeligro, float yPeligro );
/*! \fn void Satelite::getPeligro( )
* \brief defvuelve la trayectoria
* \param None
* \return float
*/
float getTra( void );
};
#endif | [
"enric_maciaslopez@cyberagent.co.jp"
] | enric_maciaslopez@cyberagent.co.jp |
8fd117c322bbc277f086ee591deb36525c8a6420 | cf58ce8affc97c3963fb9dfa783591c6d13cdfc0 | /chromeos/components/diagnostics_ui/backend/telemetry_log_unittest.cc | e75a5f5699b5d6f0bd5b57fa80b0caa2f144dd97 | [
"BSD-3-Clause"
] | permissive | muttleyxd/chromium | a8f67d8c3df66f960cfdce539435954b996c8d01 | 083214ab1f0013f8aa00c39406610251486ec797 | refs/heads/master | 2022-07-26T14:11:45.555038 | 2021-03-17T19:31:11 | 2021-03-17T19:31:11 | 264,492,154 | 0 | 0 | BSD-3-Clause | 2020-05-16T22:26:50 | 2020-05-16T17:41:35 | null | UTF-8 | C++ | false | false | 6,245 | cc | // Copyright 2021 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 "chromeos/components/diagnostics_ui/backend/telemetry_log.h"
#include "base/strings/string_number_conversions.h"
#include "chromeos/components/diagnostics_ui/backend/log_test_helpers.h"
#include "chromeos/components/diagnostics_ui/mojom/system_data_provider.mojom.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace chromeos {
namespace diagnostics {
namespace {
mojom::SystemInfoPtr CreateSystemInfoPtr(const std::string& board_name,
const std::string& marketing_name,
const std::string& cpu_model,
uint32_t total_memory_kib,
uint16_t cpu_threads_count,
uint32_t cpu_max_clock_speed_khz,
bool has_battery,
const std::string& milestone_version) {
auto version_info = mojom::VersionInfo::New(milestone_version);
auto device_capabilities = mojom::DeviceCapabilities::New(has_battery);
auto system_info = mojom::SystemInfo::New(
board_name, marketing_name, cpu_model, total_memory_kib,
cpu_threads_count, cpu_max_clock_speed_khz, std::move(version_info),
std::move(device_capabilities));
return system_info;
}
} // namespace
class TelemetryLogTest : public testing::Test {
public:
TelemetryLogTest() = default;
~TelemetryLogTest() override = default;
};
TEST_F(TelemetryLogTest, DetailedLogContents) {
const std::string expected_board_name = "board_name";
const std::string expected_marketing_name = "marketing_name";
const std::string expected_cpu_model = "cpu_model";
const uint32_t expected_total_memory_kib = 1234;
const uint16_t expected_cpu_threads_count = 5678;
const uint32_t expected_cpu_max_clock_speed_khz = 91011;
const bool expected_has_battery = true;
const std::string expected_milestone_version = "M99";
mojom::SystemInfoPtr test_info = CreateSystemInfoPtr(
expected_board_name, expected_marketing_name, expected_cpu_model,
expected_total_memory_kib, expected_cpu_threads_count,
expected_cpu_max_clock_speed_khz, expected_has_battery,
expected_milestone_version);
TelemetryLog log;
log.UpdateSystemInfo(test_info.Clone());
const std::string log_as_string = log.GetContents();
const std::vector<std::string> log_lines = GetLogLines(log_as_string);
// Expect one title line and 8 content lines.
EXPECT_EQ(9u, log_lines.size());
EXPECT_EQ("Board Name: " + expected_board_name, log_lines[1]);
EXPECT_EQ("Marketing Name: " + expected_marketing_name, log_lines[2]);
EXPECT_EQ("CpuModel Name: " + expected_cpu_model, log_lines[3]);
EXPECT_EQ(
"Total Memory (kib): " + base::NumberToString(expected_total_memory_kib),
log_lines[4]);
EXPECT_EQ(
"Thread Count: " + base::NumberToString(expected_cpu_threads_count),
log_lines[5]);
EXPECT_EQ("Cpu Max Clock Speed (kHz): " +
base::NumberToString(expected_cpu_max_clock_speed_khz),
log_lines[6]);
EXPECT_EQ("Milestone Version: " + expected_milestone_version, log_lines[7]);
EXPECT_EQ("Has Battery: true", log_lines[8]);
}
TEST_F(TelemetryLogTest, ChangeContents) {
const std::string expected_board_name = "board_name";
const std::string expected_marketing_name = "marketing_name";
const std::string expected_cpu_model = "cpu_model";
const uint32_t expected_total_memory_kib = 1234;
const uint16_t expected_cpu_threads_count = 5678;
const uint32_t expected_cpu_max_clock_speed_khz = 91011;
const bool expected_has_battery = true;
const std::string expected_milestone_version = "M99";
mojom::SystemInfoPtr test_info = CreateSystemInfoPtr(
expected_board_name, expected_marketing_name, expected_cpu_model,
expected_total_memory_kib, expected_cpu_threads_count,
expected_cpu_max_clock_speed_khz, expected_has_battery,
expected_milestone_version);
TelemetryLog log;
log.UpdateSystemInfo(test_info.Clone());
test_info->board_name = "new board_name";
log.UpdateSystemInfo(test_info.Clone());
const std::string log_as_string = log.GetContents();
const std::vector<std::string> log_lines = GetLogLines(log_as_string);
}
TEST_F(TelemetryLogTest, CpuUsageUint8) {
const std::string expected_board_name = "board_name";
const std::string expected_marketing_name = "marketing_name";
const std::string expected_cpu_model = "cpu_model";
const uint32_t expected_total_memory_kib = 1234;
const uint16_t expected_cpu_threads_count = 5678;
const uint32_t expected_cpu_max_clock_speed_khz = 91011;
const bool expected_has_battery = true;
const std::string expected_milestone_version = "M99";
const uint8_t percent_usage_user = 10;
const uint8_t percent_usage_system = 20;
const uint8_t percent_usage_free = 80;
const uint16_t average_cpu_temp_celsius = 31;
const uint32_t scaling_current_frequency_khz = 500;
mojom::SystemInfoPtr test_info = CreateSystemInfoPtr(
expected_board_name, expected_marketing_name, expected_cpu_model,
expected_total_memory_kib, expected_cpu_threads_count,
expected_cpu_max_clock_speed_khz, expected_has_battery,
expected_milestone_version);
mojom::CpuUsagePtr cpu_usage = mojom::CpuUsage::New(
percent_usage_user, percent_usage_system, percent_usage_free,
average_cpu_temp_celsius, scaling_current_frequency_khz);
TelemetryLog log;
log.UpdateSystemInfo(test_info.Clone());
log.UpdateCpuUsage(cpu_usage.Clone());
const std::string log_as_string = log.GetContents();
const std::vector<std::string> log_lines = GetLogLines(log_as_string);
EXPECT_EQ("Usage User (%): " + base::NumberToString(percent_usage_user),
log_lines[10]);
EXPECT_EQ("Usage System (%): " + base::NumberToString(percent_usage_system),
log_lines[11]);
EXPECT_EQ("Usage Free (%): " + base::NumberToString(percent_usage_free),
log_lines[12]);
}
} // namespace diagnostics
} // namespace chromeos
| [
"chromium-scoped@luci-project-accounts.iam.gserviceaccount.com"
] | chromium-scoped@luci-project-accounts.iam.gserviceaccount.com |
56907afd7068e875b5a753c4d6e0b61115f9af81 | e36e49d2cd31a28097fa1f066b5e65915c19e858 | /lib/Util/Hash.cpp | 2ccad70ea66c5c12f835e163b2decf96e8ffdfe4 | [
"Zlib",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | axia-sw/Doll | 9074e8a4b3dfcc6c02ea9abd78c2ae5f33f0da75 | a5846a6553d9809e9a0ea50db2dc18b95eb21921 | refs/heads/master | 2021-06-28T13:22:16.857790 | 2020-12-18T12:35:14 | 2020-12-18T12:35:14 | 74,479,497 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,880 | cpp | #include "../BuildSettings.hpp"
#include "doll/Util/Hash.hpp"
namespace doll
{
U32 hashCRC32( const Str &s )
{
static const U32 table[] =
{
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F,
0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2,
0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9,
0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,
0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C,
0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423,
0xCFBA9599, 0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,
0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, 0x76DC4190, 0x01DB7106,
0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D,
0x91646C97, 0xE6635C01, 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E,
0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950,
0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7,
0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0,
0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA,
0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81,
0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A,
0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, 0xE3630B12, 0x94643B84,
0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB,
0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC,
0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8, 0xA1D1937E,
0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55,
0x316E8EEF, 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,
0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28,
0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F,
0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38,
0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242,
0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69,
0x616BFFD3, 0x166CCF45, 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2,
0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC,
0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693,
0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
};
/*register*/ U32 uHash = 0xFFFFFFFF;
/*register*/ const U8 *p = reinterpret_cast< const U8 * >( s.get() );
/*register*/ const U8 *const e = p + s.num();
while( p < e ) {
uHash = table[ ( uHash ^ *p++ ) & 0xFF ] ^ ( uHash >> 8 );
}
return ~uHash;
}
static Void simpleHashCycle( U32 &uHash, const U8 p0, const U8 p1 )
{
const U8 a = p0 - p1;
const U8 b = p0 + p1;
const U8 c = p1 - p0;
const U8 d = p1 * p0;
const U16 w = U16( S8( a - d )* 5^S8( d - a ) )*65521;
const U16 x = U16( S8( b - c )* 7^S8( c - b ) )*5552;
const U16 y = U16( S8( c - b )* 3^S8( b - c ) )*17843;
const U16 z = U16( S8( d - a )*11^S8( a - d ) )*8253;
const U32 k = ( U32( S16( w/3 - z )^S16( y/3 - x ) )<<1 ) | 1;
const U32 l = ( U32( S16( y/5 - x )^S16( x/5 - w ) )<<1 ) | 1;
const U32 m = ( U32( S16( x/7 - w )^S16( z/7 - y ) )<<1 ) | 1;
const U32 n = ( U32( S16( z/11 - y )^S16( w/11 - z ) )<<1 ) | 1;
uHash -= U16( p1 )*p0;
uHash = ( ( uHash>>16 ) & 0xFFFF ) | ( ( uHash & 0xFFFF )<<16 );
uHash ^= k*l*m*n;
uHash ^= c&1;
}
U32 hashSimple( const Str &s )
{
/*register*/ U32 uHash = 0;
/*register*/ const U8 *p = reinterpret_cast< const U8 * >( s.get() );
/*register*/ const U8 *const e = p + s.num();
while( p + 1 < e ) {
simpleHashCycle( uHash, p[ 0 ], p[ 1 ] );
p += 2;
}
if( p < e ) {
simpleHashCycle( uHash, *p, ~*p );
}
return uHash;
}
}
| [
"nocannedmeat@gmail.com"
] | nocannedmeat@gmail.com |
98e49df1adfaf32c3a6b14c9f0adf020432d05dd | 42a03c9c60cedd544ab5e0a531c2b841468a54db | /include/Parser/ParserFactory.h | 61fd7ef4305acf43f7d92dfa889205ef4af18a51 | [] | no_license | pierre1326/decision-tree | dda12bedeac1766c1b56c5ed7663a2ee04571b14 | 890636c099faf722adfaab01abe6346d20506dbe | refs/heads/main | 2023-07-14T10:57:07.811378 | 2021-08-12T23:25:35 | 2021-08-12T23:25:35 | 379,476,507 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 503 | h | #ifndef PARSERFACTORY_H
#define PARSERFACTORY_H
#include <streambuf>
#include <fstream>
#include <string>
#include "Parser/Parser.h"
#include "Parser/ParserModbus.h"
using namespace std;
class ParserFactory {
public:
enum Protocol {
MODBUS
};
static Parser * getInstance(Protocol protocol) {
if(protocol == MODBUS) {
Parser * ptr = new ParserModbus;
return ptr;
}
else {
throw "The protocol does not exist";
}
}
};
#endif | [
"pierre1326@hotmail.com"
] | pierre1326@hotmail.com |
20b53caab5deea8fdc9db948a832cb61b0f6ba6e | 2516c2a11f3616fcfcd77da99cb0e66ce56853b8 | /HOMEWORK 03 OPERATOR OVERLOADING/fraction.h | 5c80979a6936ff7ce881c0c47518e47a470bae71 | [] | no_license | aberry5621/HOMEWORK-03-OPERATOR-OVERLOADING | 0756586f71f38a22e3f4e01436d84ce783bee041 | 1e05ed6681d1edf745739658ea38625c4307c509 | refs/heads/master | 2021-01-21T11:15:18.232623 | 2017-05-18T20:51:42 | 2017-05-18T20:51:42 | 91,731,078 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,867 | h | //
// implementation.hpp
// HOMEWORK 03 OPERATOR OVERLOADING
//
// Created by ax on 2/17/17.
// Copyright © 2017 COMP235. All rights reserved.
//
#ifndef fraction_h
#define fraction_h
#include <iostream>
class Fraction {
public:
// constructor
Fraction();
Fraction(int p_w, int p_n, int p_d);
// convert int to fraction?
operator int();
// friends: streams
friend std::ostream& operator << (std::ostream& out, const Fraction& printMe);
friend std::istream& operator >> (std::istream& in, Fraction& readMe);
// friends: multipliers
friend Fraction operator+(const Fraction &left, const Fraction &right);
friend Fraction operator-(const Fraction &left, const Fraction &right);
friend Fraction operator*(const Fraction &left, const Fraction &right);
friend Fraction operator/(const Fraction &left, const Fraction &right);
// family: pre / post increment decrement
// prefix increment
Fraction& operator++();
// postfix increment
Fraction operator++(int);
// prefix decrement
Fraction& operator--();
// prefix decrement
Fraction operator--(int);
// augment assignment
Fraction operator+=(const int &right);
Fraction operator-=(const int &right);
Fraction operator-=(const Fraction &right);
Fraction operator*=(const int &right);
Fraction operator/=(const int &right);
// relational operators
friend bool operator == (const Fraction& lhs, const Fraction& rhs);
friend bool operator > (const Fraction& lhs, const Fraction& rhs);
friend bool operator < (const Fraction& lhs, const Fraction& rhs);
friend bool operator <= (const Fraction& lhs, const Fraction& rhs);
friend bool operator != (const Fraction& lhs, const Fraction& rhs);
private:
int m_numerator;
int m_denominator;
};
#endif
| [
"aberry5621@gmail.com"
] | aberry5621@gmail.com |
3f4ca9070f34f987d3a05e75d91ebd2e517c7186 | 7bafa318ce6c00362288f1b6819bd9926ec4b5fc | /Knapsack_CDL-MH/calculate/dswf.h | d2ba91baf394cc089d09dd6b18373bb08f63987e | [] | no_license | mh554697703/Knapsack_CDL | e47cd2afdde1dc62335b3c6eef52c0cb6b4b6c85 | dff080e107d36f811ebfc836dbace32a206a6e31 | refs/heads/master | 2020-04-08T18:34:48.738547 | 2019-03-14T12:12:13 | 2019-03-14T12:12:13 | 159,614,806 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 579 | h | #ifndef DSWF_H
#define DSWF_H
#include <eigen/Eigen>
#include <Eigen/Dense>
#include <math.h>
#include <iostream>
#include <QDebug>
const double PI = 3.1415926;
using namespace Eigen;
using namespace std;
class DSWF
{
public:
DSWF(double elevationAngle, VectorXd azimuthAngle, int losNum,uint heightNum, MatrixXd losVelocity);
double *getHVelocity();
double *getHAngle();
double *getVVelocity();
private:
MatrixXd vectorVelocity;
uint heightNum;
double *HVelocity = NULL;
double *HAngle = NULL;
double *VVelocity = NULL;
};
#endif // DSWF_H
| [
"554697703@qq.com"
] | 554697703@qq.com |
67ee00b8fb7027ea283cd958396ca491bd25d9b0 | e6a6ce66b7e6adee1043c92bf6089ca562c6e4e8 | /src_inoue/EventAnalysisReadBeam.cpp | 017eab6610c8e34f901535fbb4b0b6f4db123b0b | [] | no_license | HidemitsuAsano/E31ana | 267c4f7a8717234e0fd67f03844e46ad61ed7da9 | 4c179ab966e9f791e1f113b6618491dede44e088 | refs/heads/master | 2023-04-04T23:18:25.517277 | 2023-03-17T00:46:31 | 2023-03-17T00:46:31 | 121,988,232 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,075 | cpp | #include "EventAnalysisReadBeam.h"
using namespace std;
bool EventAnalysisReadBeam::UAna()
{
if( anaInfo->nBeam()!=1 ) return false;
fillHistT0BVC(blMan, anaInfo);
fillHistT0DEF(blMan, anaInfo);
MyHistTools::fillTH("EventReduction", 0);
if( header->IsTrig(Trig_Kf) ) MyHistTools::fillTH("Kf_Reduction", 0);
// cout<<" Reduction : "<<0<<endl;
fillReadBeam_T0(header, blMan);
if( MyTools::getHodo(blMan, CID_T0).size()==1 ){
MyHistTools::fillTH("EventReduction", 1);
if( header->IsTrig(Trig_Kf) ) MyHistTools::fillTH("Kf_Reduction", 1);
// cout<<" Reduction : "<<1<<endl;
}
fillReadBeam_BHDT0(header, anaInfo);
if( !MyAnaTools::isTOFKaon(anaInfo->beam(0)->tof()) ) return true;
MyHistTools::fillTH("EventReduction", 2);
if( header->IsTrig(Trig_Kf) ) MyHistTools::fillTH("Kf_Reduction", 2);
// cout<<" Reduction : "<<2<<endl;
fillReadBeam_BLC1(header, confMan, anaInfo);
if( !MyAnaTools::anaBLC1(anaInfo) ) return true;
MyHistTools::fillTH("EventReduction", 3);
if( header->IsTrig(Trig_Kf) ) MyHistTools::fillTH("Kf_Reduction", 3);
// cout<<" Reduction : "<<3<<endl;
fillReadBeam_BLC2(header, confMan, anaInfo);
if( !MyAnaTools::anaBLC2(anaInfo) ) return true;
MyHistTools::fillTH("EventReduction", 4);
if( header->IsTrig(Trig_Kf) ) MyHistTools::fillTH("Kf_Reduction", 4);
// cout<<" Reduction : "<<4<<endl;
fillReadBeam_D5(header, anaInfo);
if( !MyAnaTools::anaD5(anaInfo) ) return true;
MyHistTools::fillTH("EventReduction", 5);
if( header->IsTrig(Trig_Kf) ) MyHistTools::fillTH("Kf_Reduction", 5);
// cout<<" Reduction : "<<5<<endl;
fillReadBeam_D5BHD(header, anaInfo);
if( confMan->GetOutFileName().find("Run49c")==string::npos ){
if( !MyAnaTools::connectD5BHD(anaInfo) ) return true;
}
MyHistTools::fillTH("EventReduction", 6);
if( header->IsTrig(Trig_Kf) ) MyHistTools::fillTH("Kf_Reduction", 6);
// cout<<" Reduction : "<<6<<endl;
fillReadBeam_BPC(header, confMan, anaInfo, blMan);
if( !MyAnaTools::anaBPC(anaInfo) ) return true;
MyHistTools::fillTH("EventReduction", 7);
if( header->IsTrig(Trig_Kf) ) MyHistTools::fillTH("Kf_Reduction", 7);
// cout<<" Reduction : "<<7<<endl;
fillReadBeam_BLC2BPC(header, anaInfo);
if( !MyAnaTools::connectBLC2BPC(anaInfo) ) return true;
MyHistTools::fillTH("EventReduction", 8);
if( header->IsTrig(Trig_Kf) ) MyHistTools::fillTH("Kf_Reduction", 8);
// cout<<" Reduction : "<<8<<endl;
fillReadBeam_Profile(confMan, header, anaInfo);
if( MyAnaTools::beamFiducial(anaInfo, confMan) ){
MyHistTools::fillTH("EventReduction", 9);
if( header->IsTrig(Trig_Kf) ) MyHistTools::fillTH("Kf_Reduction", 9);
// cout<<" Reduction : "<<9<<endl;
}
fillReadBeam_FDC1(header, confMan, anaInfo, blMan);
if( cdsFileMatching() ){
}
return true;
}
void EventAnalysisReadBeam::InitializeHistogram()
{
initHistT0BVC();
initHistT0DEF();
initHistReadBeam();
}
EventTemp *EventAlloc::EventAllocator()
{
EventAnalysisReadBeam *event = new EventAnalysisReadBeam();
return (EventTemp*)event;
}
| [
"hasano@scphys.kyoto-u.ac.jp"
] | hasano@scphys.kyoto-u.ac.jp |
3c1a775d07ee81161bc5b19f2bce8e8c5fce18b6 | 7c7cde96c57f3610a453a09cadd6aad82321fedd | /AoSong_AGS02MA.h | 2e5b64994e1803d2e909d73493d867af55eb595a | [
"MIT"
] | permissive | mosajon/AoSong_AGS02MA | 38e157ffe58682d9b6b95b7c23a42a19942ec746 | f882d36a683d435a7e1d1f9d4ed809ce9fa74889 | refs/heads/master | 2023-06-05T23:47:54.450398 | 2021-06-30T02:06:39 | 2021-06-30T02:06:39 | 335,266,100 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,915 | h | /*!
* @file AoSong_AGS02MA.h
* @author Mosajon
* @version V1.0
* @date 2021-01-31
* @file DFRobot_AGS01DB.h
* @brief Define the basic structure of class DFRobot_AGS01DB
* @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
* @licence The MIT License (MIT)
* @author [fengli](li.feng@dfrobot.com)
* @version V1.0
* @date 2019-07-13
* @get from https://www.dfrobot.com
* @https://github.com/DFRobot/DFRobot_AGS01DB
*/
#ifndef AoSong_AGS02MA_H
#define AoSong_AGS02MA_H
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include <Wire.h>
//#define ENABLE_DBG
#ifdef ENABLE_DBG
#define DBG(...) {Serial.print("["); Serial.print(__FUNCTION__); Serial.print("(): "); Serial.print(__LINE__); Serial.print(" ] "); Serial.println(__VA_ARGS__);}
#else
#define DBG(...)
#endif
#define AGS02MA_IIC_ADDR (0x1A) /*sensor IIC address*/
//#define ERR_OK 0 //ok
//#define ERR_DATA_BUS -1 //error in data bus
//#define ERR_IC_VERSION -2 //chip version mismatch
class AoSong_AGS02MA
{
public:
#define CMD_DATA_COLLECTION 0x00 /*Get the high byte of command voc*/
#define CMD_GET_VERSION 0x11 /*Get the high byte of command Version*/
/*!
* @brief Constructor
*/
AoSong_AGS02MA(TwoWire * pWire = &Wire);
/**
* @brief init function
* @return Return 0 if initialization succeeds, otherwise return non-zero and error code.
*/
int begin(void);
/**
* @brief Read the concentration of the harmful gas in air
* @return Return the read VOC value, unit: ppb.
*/
float readVocPPB();
/**
* @brief Read the concentration of the harmful gas in air
* @return Return the read VOC value, unit: ug/m3.
*/
float readVocUGM3();
/**
* @brief Read chip version
* @return Return the read version, such as 0x0B.
*/
int readSensorVersion();
/**
* @brief set Measure Mode
* @param Mode:0 - ppb;1 - ug/m3
*/
void setMeasureMode(uint8_t Mode);
private:
/**
* @brief Detect if the returned CRC is equal to the CRC8 caculated through the two data in data byte.
* @param data Data in data byte
* @param Num The number of the data to be checked
* @return Return 0 if the check is correct, otherwise return non-zero.
*/
bool checkCRC8(uint8_t *data, uint8_t Num);
/**
* @brief Write command into sensor chip
* @param pBuf Data included in command
* @param size The number of the byte of command
*/
void writeCommand(const void *pBuf,size_t size);
/**
* @brief Write command into sensor chip
* @param pBuf Data included in command
* @param size The number of the byte of command
* @return Return 0 if the reading is done, otherwise return non-zero.
*/
uint8_t readData(void *pBuf,size_t size);
TwoWire *_pWire;
};
#endif
| [
"mosajon@sina.com"
] | mosajon@sina.com |
08dfa7581b01b403e3ef7fac75df95e758fd7ae6 | c3c848ae6c90313fed11be129187234e487c5f96 | /VC6PLATSDK/samples/netds/RRas/rqs/common/rumem.cpp | 1ac03732914e5db4ca5f72dabd7d14d69b7b71c0 | [] | no_license | timxx/VC6-Platform-SDK | 247e117cfe77109cd1b1effcd68e8a428ebe40f0 | 9fd59ed5e8e25a1a72652b44cbefb433c62b1c0f | refs/heads/master | 2023-07-04T06:48:32.683084 | 2021-08-10T12:52:47 | 2021-08-10T12:52:47 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,448 | cpp | //+--------------------------------------------------------------------------
//
// File: RuMem.cpp
//
// Synopsis: Memory allocation api's
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//+--------------------------------------------------------------------------
#include "RuMem.h"
// Generic Memory Free function
//
BOOL
RuFree(
IN PVOID pvMem // The pointer to the memory block to free
)
{
BOOL fSuccess = FALSE;
do
{
if ( NULL == pvMem )
{
fSuccess = FALSE;
break;
}
HANDLE hHeap = GetProcessHeap();
fSuccess = HeapFree(hHeap,
0,
pvMem);
}
while(FALSE);
return fSuccess;
}
// Generic memroy allocation function. If succeded, returns the allocated memory pointer, if
// failed, returns NULL pointer
//
PVOID
RuAlloc(
IN DWORD dwSize, // how many bytes of memory to allocate
IN BOOL fZero // If the allocated memory should be Initialized to 0
)
{
PVOID pvMem = NULL;
HANDLE hHeap = GetProcessHeap();
if ( NULL == hHeap )
{
return NULL;
}
pvMem = HeapAlloc( hHeap,
fZero ? HEAP_ZERO_MEMORY: 0,
dwSize);
return pvMem;
}
| [
"radiowebmasters@gmail.com"
] | radiowebmasters@gmail.com |
f42591fe149baab9e52bbd9ee3ef623c481260f2 | 95626140b639c93a5bc7d86c5ed7cead4d27372a | /algorithm And Data Structure/Graph/Tropological sort/TOPOSORT - Topological Sorting(spoj).cpp | 4350ae90b77dc0283ffdf77c4417e04bcc3af994 | [] | no_license | asad-shuvo/ACM | 059bed7f91261af385d1be189e544fe240da2ff2 | 2dea0ef7378d831097efdf4cae25fbc6f34b8064 | refs/heads/master | 2022-06-08T13:03:04.294916 | 2022-05-13T12:22:50 | 2022-05-13T12:22:50 | 211,629,208 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,042 | cpp | #include<bits/stdc++.h>
using namespace std;
vector<int>G[10005];
map<int,int>indegree;
int color[10005];
int f=0;
void dfs(int source){
color[source]=2;
for(int i=0;i<G[source].size();i++){
int v=G[source][i];
if(color[v]==2){
f=1;
break;
}
if(color[v]==3)continue;
if(color[v]==1){
dfs(v);
}
}
color[source]=3;
}
int main()
{
int n,m;
scanf("%d%d",&n,&m);
while(m--){
int x,y;
scanf("%d%d",&x,&y);
G[x].push_back(y);
indegree[y]++;
}
for(int i=1;i<=n;i++){
color[i]=1;
}
for(int i=1;i<=n;i++){
if(color[i]==1)
dfs(i);
}
if(f==1)printf("Sandro fails.\n");
else{
queue<int>q;
for(int i=1;i<=n;i++){
if(indegree[i]==0){
q.push(i);
}
}
vector<int>ans;
while(!q.empty()){
int u=q.front();
ans.push_back(u);
q.pop();
for(int i=0;i<G[u].size();i++){
int v=G[u][i];
indegree[v]--;
if(indegree[v]==0)q.push(v);
}
}
printf("%d",ans[0]);
for(int i=1;i<ans.size();i++){
// if(i!=0)printf(" ");
printf(" %d",ans[i]);
}
printf("\n");
}
}
| [
"asad.shuvo.cse@gmail.com"
] | asad.shuvo.cse@gmail.com |
49b0a9c49503c49bf991b90178f8e9f424d3c70a | 42bef847fc07f61de11ae6cdbdeebb5edb8a9d32 | /src/compiler/translator/OutputSPIRV.cpp | 432c0d715b138d073344f00ff6766e0bb155bec4 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | GavinNL/angle | bcfbaeed7513bee48e3021ede5f75a76f7f654ad | 9aca4285f84cd7b25ca27881e2e850e7fddd0c86 | refs/heads/main | 2023-08-22T04:04:33.402982 | 2021-12-30T14:18:32 | 2021-12-30T21:33:08 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 248,858 | cpp | //
// Copyright 2021 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// OutputSPIRV: Generate SPIR-V from the AST.
//
#include "compiler/translator/OutputSPIRV.h"
#include "angle_gl.h"
#include "common/debug.h"
#include "common/mathutil.h"
#include "common/spirv/spirv_instruction_builder_autogen.h"
#include "compiler/translator/BuildSPIRV.h"
#include "compiler/translator/Compiler.h"
#include "compiler/translator/StaticType.h"
#include "compiler/translator/tree_util/FindPreciseNodes.h"
#include "compiler/translator/tree_util/IntermTraverse.h"
#include <cfloat>
// Extended instructions
namespace spv
{
#include <spirv/unified1/GLSL.std.450.h>
}
// SPIR-V tools include for disassembly
#include <spirv-tools/libspirv.hpp>
// Enable this for debug logging of pre-transform SPIR-V:
#if !defined(ANGLE_DEBUG_SPIRV_GENERATION)
# define ANGLE_DEBUG_SPIRV_GENERATION 0
#endif // !defined(ANGLE_DEBUG_SPIRV_GENERATION)
namespace sh
{
namespace
{
// A struct to hold either SPIR-V ids or literal constants. If id is not valid, a literal is
// assumed.
struct SpirvIdOrLiteral
{
SpirvIdOrLiteral() = default;
SpirvIdOrLiteral(const spirv::IdRef idIn) : id(idIn) {}
SpirvIdOrLiteral(const spirv::LiteralInteger literalIn) : literal(literalIn) {}
spirv::IdRef id;
spirv::LiteralInteger literal;
};
// A data structure to facilitate generating array indexing, block field selection, swizzle and
// such. Used in conjunction with NodeData which includes the access chain's baseId and idList.
//
// - rvalue[literal].field[literal] generates OpCompositeExtract
// - rvalue.x generates OpCompositeExtract
// - rvalue.xyz generates OpVectorShuffle
// - rvalue.xyz[i] generates OpVectorExtractDynamic (xyz[i] itself generates an
// OpVectorExtractDynamic as well)
// - rvalue[i].field[j] generates a temp variable OpStore'ing rvalue and then generating an
// OpAccessChain and OpLoad
//
// - lvalue[i].field[j].x generates OpAccessChain and OpStore
// - lvalue.xyz generates an OpLoad followed by OpVectorShuffle and OpStore
// - lvalue.xyz[i] generates OpAccessChain and OpStore (xyz[i] itself generates an
// OpVectorExtractDynamic as well)
//
// storageClass == Max implies an rvalue.
//
struct AccessChain
{
// The storage class for lvalues. If Max, it's an rvalue.
spv::StorageClass storageClass = spv::StorageClassMax;
// If the access chain ends in swizzle, the swizzle components are specified here. Swizzles
// select multiple components so need special treatment when used as lvalue.
std::vector<uint32_t> swizzles;
// If a vector component is selected dynamically (i.e. indexed with a non-literal index),
// dynamicComponent will contain the id of the index.
spirv::IdRef dynamicComponent;
// Type of base expression, before swizzle is applied, after swizzle is applied and after
// dynamic component is applied.
spirv::IdRef baseTypeId;
spirv::IdRef preSwizzleTypeId;
spirv::IdRef postSwizzleTypeId;
spirv::IdRef postDynamicComponentTypeId;
// If the OpAccessChain is already generated (done by accessChainCollapse()), this caches the
// id.
spirv::IdRef accessChainId;
// Whether all indices are literal. Avoids looping through indices to determine this
// information.
bool areAllIndicesLiteral = true;
// The number of components in the vector, if vector and swizzle is used. This is cached to
// avoid a type look up when handling swizzles.
uint8_t swizzledVectorComponentCount = 0;
// SPIR-V type specialization due to the base type. Used to correctly select the SPIR-V type
// id when visiting EOpIndex* binary nodes (i.e. reading from or writing to an access chain).
// This always corresponds to the specialization specific to the end result of the access chain,
// not the base or any intermediary types. For example, a struct nested in a column-major
// interface block, with a parent block qualified as row-major would specify row-major here.
SpirvTypeSpec typeSpec;
};
// As each node is traversed, it produces data. When visiting back the parent, this data is used to
// complete the data of the parent. For example, the children of a function call (i.e. the
// arguments) each produce a SPIR-V id corresponding to the result of their expression. The
// function call node itself in PostVisit uses those ids to generate the function call instruction.
struct NodeData
{
// An id whose meaning depends on the node. It could be a temporary id holding the result of an
// expression, a reference to a variable etc.
spirv::IdRef baseId;
// List of relevant SPIR-V ids accumulated while traversing the children. Meaning depends on
// the node, for example a list of parameters to be passed to a function, a set of ids used to
// construct an access chain etc.
std::vector<SpirvIdOrLiteral> idList;
// For constructing access chains.
AccessChain accessChain;
};
struct FunctionIds
{
// Id of the function type, return type and parameter types.
spirv::IdRef functionTypeId;
spirv::IdRef returnTypeId;
spirv::IdRefList parameterTypeIds;
// Id of the function itself.
spirv::IdRef functionId;
};
struct BuiltInResultStruct
{
// Some builtins require a struct result. The struct always has two fields of a scalar or
// vector type.
TBasicType lsbType;
TBasicType msbType;
uint32_t lsbPrimarySize;
uint32_t msbPrimarySize;
};
struct BuiltInResultStructHash
{
size_t operator()(const BuiltInResultStruct &key) const
{
static_assert(sh::EbtLast < 256, "Basic type doesn't fit in uint8_t");
ASSERT(key.lsbPrimarySize > 0 && key.lsbPrimarySize <= 4);
ASSERT(key.msbPrimarySize > 0 && key.msbPrimarySize <= 4);
const uint8_t properties[4] = {
static_cast<uint8_t>(key.lsbType),
static_cast<uint8_t>(key.msbType),
static_cast<uint8_t>(key.lsbPrimarySize),
static_cast<uint8_t>(key.msbPrimarySize),
};
return angle::ComputeGenericHash(properties, sizeof(properties));
}
};
bool operator==(const BuiltInResultStruct &a, const BuiltInResultStruct &b)
{
return a.lsbType == b.lsbType && a.msbType == b.msbType &&
a.lsbPrimarySize == b.lsbPrimarySize && a.msbPrimarySize == b.msbPrimarySize;
}
bool IsAccessChainRValue(const AccessChain &accessChain)
{
return accessChain.storageClass == spv::StorageClassMax;
}
bool IsAccessChainUnindexedLValue(const NodeData &data)
{
return !IsAccessChainRValue(data.accessChain) && data.idList.empty() &&
data.accessChain.swizzles.empty() && !data.accessChain.dynamicComponent.valid();
}
// A traverser that generates SPIR-V as it walks the AST.
class OutputSPIRVTraverser : public TIntermTraverser
{
public:
OutputSPIRVTraverser(TCompiler *compiler, ShCompileOptions compileOptions);
~OutputSPIRVTraverser() override;
spirv::Blob getSpirv();
protected:
void visitSymbol(TIntermSymbol *node) override;
void visitConstantUnion(TIntermConstantUnion *node) override;
bool visitSwizzle(Visit visit, TIntermSwizzle *node) override;
bool visitBinary(Visit visit, TIntermBinary *node) override;
bool visitUnary(Visit visit, TIntermUnary *node) override;
bool visitTernary(Visit visit, TIntermTernary *node) override;
bool visitIfElse(Visit visit, TIntermIfElse *node) override;
bool visitSwitch(Visit visit, TIntermSwitch *node) override;
bool visitCase(Visit visit, TIntermCase *node) override;
void visitFunctionPrototype(TIntermFunctionPrototype *node) override;
bool visitFunctionDefinition(Visit visit, TIntermFunctionDefinition *node) override;
bool visitAggregate(Visit visit, TIntermAggregate *node) override;
bool visitBlock(Visit visit, TIntermBlock *node) override;
bool visitGlobalQualifierDeclaration(Visit visit,
TIntermGlobalQualifierDeclaration *node) override;
bool visitDeclaration(Visit visit, TIntermDeclaration *node) override;
bool visitLoop(Visit visit, TIntermLoop *node) override;
bool visitBranch(Visit visit, TIntermBranch *node) override;
void visitPreprocessorDirective(TIntermPreprocessorDirective *node) override;
private:
spirv::IdRef getSymbolIdAndStorageClass(const TSymbol *symbol,
const TType &type,
spv::StorageClass *storageClass);
// Access chain handling.
// Called before pushing indices to access chain to adjust |typeSpec| (which is then used to
// determine the typeId passed to |accessChainPush*|).
void accessChainOnPush(NodeData *data, const TType &parentType, size_t index);
void accessChainPush(NodeData *data, spirv::IdRef index, spirv::IdRef typeId) const;
void accessChainPushLiteral(NodeData *data,
spirv::LiteralInteger index,
spirv::IdRef typeId) const;
void accessChainPushSwizzle(NodeData *data,
const TVector<int> &swizzle,
spirv::IdRef typeId,
uint8_t componentCount) const;
void accessChainPushDynamicComponent(NodeData *data, spirv::IdRef index, spirv::IdRef typeId);
spirv::IdRef accessChainCollapse(NodeData *data);
spirv::IdRef accessChainLoad(NodeData *data,
const TType &valueType,
spirv::IdRef *resultTypeIdOut);
void accessChainStore(NodeData *data, spirv::IdRef value, const TType &valueType);
// Access chain helpers.
void makeAccessChainIdList(NodeData *data, spirv::IdRefList *idsOut);
void makeAccessChainLiteralList(NodeData *data, spirv::LiteralIntegerList *literalsOut);
spirv::IdRef getAccessChainTypeId(NodeData *data);
// Node data handling.
void nodeDataInitLValue(NodeData *data,
spirv::IdRef baseId,
spirv::IdRef typeId,
spv::StorageClass storageClass,
const SpirvTypeSpec &typeSpec) const;
void nodeDataInitRValue(NodeData *data, spirv::IdRef baseId, spirv::IdRef typeId) const;
void declareConst(TIntermDeclaration *decl);
void declareSpecConst(TIntermDeclaration *decl);
spirv::IdRef createConstant(const TType &type,
TBasicType expectedBasicType,
const TConstantUnion *constUnion,
bool isConstantNullValue);
spirv::IdRef createComplexConstant(const TType &type,
spirv::IdRef typeId,
const spirv::IdRefList ¶meters);
spirv::IdRef createConstructor(TIntermAggregate *node, spirv::IdRef typeId);
spirv::IdRef createArrayOrStructConstructor(TIntermAggregate *node,
spirv::IdRef typeId,
const spirv::IdRefList ¶meters);
spirv::IdRef createConstructorScalarFromNonScalar(TIntermAggregate *node,
spirv::IdRef typeId,
const spirv::IdRefList ¶meters);
spirv::IdRef createConstructorVectorFromScalar(const TType ¶meterType,
const TType &expectedType,
spirv::IdRef typeId,
const spirv::IdRefList ¶meters);
spirv::IdRef createConstructorVectorFromMatrix(TIntermAggregate *node,
spirv::IdRef typeId,
const spirv::IdRefList ¶meters);
spirv::IdRef createConstructorVectorFromMultiple(TIntermAggregate *node,
spirv::IdRef typeId,
const spirv::IdRefList ¶meters);
spirv::IdRef createConstructorMatrixFromScalar(TIntermAggregate *node,
spirv::IdRef typeId,
const spirv::IdRefList ¶meters);
spirv::IdRef createConstructorMatrixFromVectors(TIntermAggregate *node,
spirv::IdRef typeId,
const spirv::IdRefList ¶meters);
spirv::IdRef createConstructorMatrixFromMatrix(TIntermAggregate *node,
spirv::IdRef typeId,
const spirv::IdRefList ¶meters);
// Load N values where N is the number of node's children. In some cases, the last M values are
// lvalues which should be skipped.
spirv::IdRefList loadAllParams(TIntermOperator *node,
size_t skipCount,
spirv::IdRefList *paramTypeIds);
void extractComponents(TIntermAggregate *node,
size_t componentCount,
const spirv::IdRefList ¶meters,
spirv::IdRefList *extractedComponentsOut);
void startShortCircuit(TIntermBinary *node);
spirv::IdRef endShortCircuit(TIntermBinary *node, spirv::IdRef *typeId);
spirv::IdRef visitOperator(TIntermOperator *node, spirv::IdRef resultTypeId);
spirv::IdRef createCompare(TIntermOperator *node, spirv::IdRef resultTypeId);
spirv::IdRef createAtomicBuiltIn(TIntermOperator *node, spirv::IdRef resultTypeId);
spirv::IdRef createImageTextureBuiltIn(TIntermOperator *node, spirv::IdRef resultTypeId);
spirv::IdRef createSubpassLoadBuiltIn(TIntermOperator *node, spirv::IdRef resultTypeId);
spirv::IdRef createInterpolate(TIntermOperator *node, spirv::IdRef resultTypeId);
spirv::IdRef createFunctionCall(TIntermAggregate *node, spirv::IdRef resultTypeId);
void visitArrayLength(TIntermUnary *node);
// Cast between types. There are two kinds of casts:
//
// - A constructor can cast between basic types, for example vec4(someInt).
// - Assignments, constructors, function calls etc may copy an array or struct between different
// block storages, invariance etc (which due to their decorations generate different SPIR-V
// types). For example:
//
// layout(std140) uniform U { invariant Struct s; } u; ... Struct s2 = u.s;
//
spirv::IdRef castBasicType(spirv::IdRef value,
const TType &valueType,
const TType &expectedType,
spirv::IdRef *resultTypeIdOut);
spirv::IdRef cast(spirv::IdRef value,
const TType &valueType,
const SpirvTypeSpec &valueTypeSpec,
const SpirvTypeSpec &expectedTypeSpec,
spirv::IdRef *resultTypeIdOut);
// Given a list of parameters to an operator, extend the scalars to match the vectors. GLSL
// frequently has operators that mix vectors and scalars, while SPIR-V usually applies the
// operations per component (requiring the scalars to turn into a vector).
void extendScalarParamsToVector(TIntermOperator *node,
spirv::IdRef resultTypeId,
spirv::IdRefList *parameters);
// Helper to reduce vector == and != with OpAll and OpAny respectively. If multiple ids are
// given, either OpLogicalAnd or OpLogicalOr is used (if two operands) or a bool vector is
// constructed and OpAll and OpAny used.
spirv::IdRef reduceBoolVector(TOperator op,
const spirv::IdRefList &valueIds,
spirv::IdRef typeId,
const SpirvDecorations &decorations);
// Helper to implement == and !=, supporting vectors, matrices, structs and arrays.
void createCompareImpl(TOperator op,
const TType &operandType,
spirv::IdRef resultTypeId,
spirv::IdRef leftId,
spirv::IdRef rightId,
const SpirvDecorations &operandDecorations,
const SpirvDecorations &resultDecorations,
spirv::LiteralIntegerList *currentAccessChain,
spirv::IdRefList *intermediateResultsOut);
// For some builtins, SPIR-V outputs two values in a struct. This function defines such a
// struct if not already defined.
spirv::IdRef makeBuiltInOutputStructType(TIntermOperator *node, size_t lvalueCount);
// Once the builtin instruction is generated, the two return values are extracted from the
// struct. These are written to the return value (if any) and the out parameters.
void storeBuiltInStructOutputInParamsAndReturnValue(TIntermOperator *node,
size_t lvalueCount,
spirv::IdRef structValue,
spirv::IdRef returnValue,
spirv::IdRef returnValueType);
void storeBuiltInStructOutputInParamHelper(NodeData *data,
TIntermTyped *param,
spirv::IdRef structValue,
uint32_t fieldIndex);
TCompiler *mCompiler;
ANGLE_MAYBE_UNUSED ShCompileOptions mCompileOptions;
SPIRVBuilder mBuilder;
// Traversal state. Nodes generally push() once to this stack on PreVisit. On InVisit and
// PostVisit, they pop() once (data corresponding to the result of the child) and accumulate it
// in back() (data corresponding to the node itself). On PostVisit, code is generated.
std::vector<NodeData> mNodeData;
// A map of TSymbol to its SPIR-V id. This could be a:
//
// - TVariable, or
// - TInterfaceBlock: because TIntermSymbols referencing a field of an unnamed interface block
// don't reference the TVariable that defines the struct, but the TInterfaceBlock itself.
angle::HashMap<const TSymbol *, spirv::IdRef> mSymbolIdMap;
// A map of TFunction to its various SPIR-V ids.
angle::HashMap<const TFunction *, FunctionIds> mFunctionIdMap;
// A map of internally defined structs used to capture result of some SPIR-V instructions.
angle::HashMap<BuiltInResultStruct, spirv::IdRef, BuiltInResultStructHash>
mBuiltInResultStructMap;
// Whether the current symbol being visited is being declared.
bool mIsSymbolBeingDeclared = false;
};
spv::StorageClass GetStorageClass(const TType &type, GLenum shaderType)
{
// Opaque uniforms (samplers, images and subpass inputs) have the UniformConstant storage class
if (IsOpaqueType(type.getBasicType()))
{
return spv::StorageClassUniformConstant;
}
const TQualifier qualifier = type.getQualifier();
// Input varying and IO blocks have the Input storage class
if (IsShaderIn(qualifier))
{
return spv::StorageClassInput;
}
// Output varying and IO blocks have the Input storage class
if (IsShaderOut(qualifier))
{
return spv::StorageClassOutput;
}
switch (qualifier)
{
case EvqShared:
// Compute shader shared memory has the Workgroup storage class
return spv::StorageClassWorkgroup;
case EvqGlobal:
case EvqConst:
// Global variables have the Private class. Complex constant variables that are not
// folded are also defined globally.
return spv::StorageClassPrivate;
case EvqTemporary:
case EvqParamIn:
case EvqParamOut:
case EvqParamInOut:
// Function-local variables have the Function class
return spv::StorageClassFunction;
case EvqVertexID:
case EvqInstanceID:
case EvqFragCoord:
case EvqFrontFacing:
case EvqPointCoord:
case EvqSampleID:
case EvqSamplePosition:
case EvqSampleMaskIn:
case EvqPatchVerticesIn:
case EvqTessCoord:
case EvqPrimitiveIDIn:
case EvqInvocationID:
case EvqHelperInvocation:
case EvqNumWorkGroups:
case EvqWorkGroupID:
case EvqLocalInvocationID:
case EvqGlobalInvocationID:
case EvqLocalInvocationIndex:
case EvqViewIDOVR:
return spv::StorageClassInput;
case EvqPosition:
case EvqPointSize:
case EvqFragDepth:
case EvqSampleMask:
return spv::StorageClassOutput;
case EvqClipDistance:
case EvqCullDistance:
// gl_Clip/CullDistance (not accessed through gl_in/gl_out) are inputs in FS and outputs
// otherwise.
return shaderType == GL_FRAGMENT_SHADER ? spv::StorageClassInput
: spv::StorageClassOutput;
case EvqTessLevelOuter:
case EvqTessLevelInner:
// gl_TessLevelOuter/Inner are outputs in TCS and inputs in TES.
return shaderType == GL_TESS_CONTROL_SHADER_EXT ? spv::StorageClassOutput
: spv::StorageClassInput;
case EvqLayer:
case EvqPrimitiveID:
// gl_Layer is output in GS and input in FS.
// gl_PrimitiveID is output in GS and input in TCS, TES and FS.
return shaderType == GL_GEOMETRY_SHADER ? spv::StorageClassOutput
: spv::StorageClassInput;
default:
// Uniform and storage buffers have the Uniform storage class. Default uniforms are
// gathered in a uniform block as well.
ASSERT(type.getInterfaceBlock() != nullptr || qualifier == EvqUniform);
// I/O blocks must have already been classified as input or output above.
ASSERT(!IsShaderIoBlock(qualifier));
return spv::StorageClassUniform;
}
}
OutputSPIRVTraverser::OutputSPIRVTraverser(TCompiler *compiler, ShCompileOptions compileOptions)
: TIntermTraverser(true, true, true, &compiler->getSymbolTable()),
mCompiler(compiler),
mCompileOptions(compileOptions),
mBuilder(compiler, compileOptions, compiler->getHashFunction(), compiler->getNameMap())
{}
OutputSPIRVTraverser::~OutputSPIRVTraverser()
{
ASSERT(mNodeData.empty());
}
spirv::IdRef OutputSPIRVTraverser::getSymbolIdAndStorageClass(const TSymbol *symbol,
const TType &type,
spv::StorageClass *storageClass)
{
*storageClass = GetStorageClass(type, mCompiler->getShaderType());
auto iter = mSymbolIdMap.find(symbol);
if (iter != mSymbolIdMap.end())
{
return iter->second;
}
// This must be an implicitly defined variable, define it now.
const char *name = nullptr;
spv::BuiltIn builtInDecoration = spv::BuiltInMax;
switch (type.getQualifier())
{
// Vertex shader built-ins
case EvqVertexID:
name = "gl_VertexIndex";
builtInDecoration = spv::BuiltInVertexIndex;
break;
case EvqInstanceID:
name = "gl_InstanceIndex";
builtInDecoration = spv::BuiltInInstanceIndex;
break;
// Fragment shader built-ins
case EvqFragCoord:
name = "gl_FragCoord";
builtInDecoration = spv::BuiltInFragCoord;
break;
case EvqFrontFacing:
name = "gl_FrontFacing";
builtInDecoration = spv::BuiltInFrontFacing;
break;
case EvqPointCoord:
name = "gl_PointCoord";
builtInDecoration = spv::BuiltInPointCoord;
break;
case EvqFragDepth:
name = "gl_FragDepth";
builtInDecoration = spv::BuiltInFragDepth;
mBuilder.addExecutionMode(spv::ExecutionModeDepthReplacing);
break;
case EvqSampleMask:
name = "gl_SampleMask";
builtInDecoration = spv::BuiltInSampleMask;
break;
case EvqSampleMaskIn:
name = "gl_SampleMaskIn";
builtInDecoration = spv::BuiltInSampleMask;
break;
case EvqSampleID:
name = "gl_SampleID";
builtInDecoration = spv::BuiltInSampleId;
mBuilder.addCapability(spv::CapabilitySampleRateShading);
break;
case EvqSamplePosition:
name = "gl_SamplePosition";
builtInDecoration = spv::BuiltInSamplePosition;
mBuilder.addCapability(spv::CapabilitySampleRateShading);
break;
case EvqClipDistance:
name = "gl_ClipDistance";
builtInDecoration = spv::BuiltInClipDistance;
mBuilder.addCapability(spv::CapabilityClipDistance);
break;
case EvqCullDistance:
name = "gl_CullDistance";
builtInDecoration = spv::BuiltInCullDistance;
mBuilder.addCapability(spv::CapabilityCullDistance);
break;
case EvqHelperInvocation:
name = "gl_HelperInvocation";
builtInDecoration = spv::BuiltInHelperInvocation;
break;
// Tessellation built-ins
case EvqPatchVerticesIn:
name = "gl_PatchVerticesIn";
builtInDecoration = spv::BuiltInPatchVertices;
break;
case EvqTessLevelOuter:
name = "gl_TessLevelOuter";
builtInDecoration = spv::BuiltInTessLevelOuter;
break;
case EvqTessLevelInner:
name = "gl_TessLevelInner";
builtInDecoration = spv::BuiltInTessLevelInner;
break;
case EvqTessCoord:
name = "gl_TessCoord";
builtInDecoration = spv::BuiltInTessCoord;
break;
// Shared geometry and tessellation built-ins
case EvqInvocationID:
name = "gl_InvocationID";
builtInDecoration = spv::BuiltInInvocationId;
break;
case EvqPrimitiveID:
name = "gl_PrimitiveID";
builtInDecoration = spv::BuiltInPrimitiveId;
// In fragment shader, add the Geometry capability.
if (mCompiler->getShaderType() == GL_FRAGMENT_SHADER)
{
mBuilder.addCapability(spv::CapabilityGeometry);
}
break;
// Geometry shader built-ins
case EvqPrimitiveIDIn:
name = "gl_PrimitiveIDIn";
builtInDecoration = spv::BuiltInPrimitiveId;
break;
case EvqLayer:
name = "gl_Layer";
builtInDecoration = spv::BuiltInLayer;
// gl_Layer requires the Geometry capability, even in fragment shaders.
mBuilder.addCapability(spv::CapabilityGeometry);
break;
// Compute shader built-ins
case EvqNumWorkGroups:
name = "gl_NumWorkGroups";
builtInDecoration = spv::BuiltInNumWorkgroups;
break;
case EvqWorkGroupID:
name = "gl_WorkGroupID";
builtInDecoration = spv::BuiltInWorkgroupId;
break;
case EvqLocalInvocationID:
name = "gl_LocalInvocationID";
builtInDecoration = spv::BuiltInLocalInvocationId;
break;
case EvqGlobalInvocationID:
name = "gl_GlobalInvocationID";
builtInDecoration = spv::BuiltInGlobalInvocationId;
break;
case EvqLocalInvocationIndex:
name = "gl_LocalInvocationIndex";
builtInDecoration = spv::BuiltInLocalInvocationIndex;
break;
// Extensions
case EvqViewIDOVR:
name = "gl_ViewID_OVR";
builtInDecoration = spv::BuiltInViewIndex;
mBuilder.addCapability(spv::CapabilityMultiView);
mBuilder.addExtension(SPIRVExtensions::MultiviewOVR);
break;
default:
UNREACHABLE();
}
const spirv::IdRef typeId = mBuilder.getTypeData(type, {}).id;
const spirv::IdRef varId = mBuilder.declareVariable(
typeId, *storageClass, mBuilder.getDecorations(type), nullptr, name);
mBuilder.addEntryPointInterfaceVariableId(varId);
spirv::WriteDecorate(mBuilder.getSpirvDecorations(), varId, spv::DecorationBuiltIn,
{spirv::LiteralInteger(builtInDecoration)});
// Additionally, decorate gl_TessLevel* with Patch.
if (type.getQualifier() == EvqTessLevelInner || type.getQualifier() == EvqTessLevelOuter)
{
spirv::WriteDecorate(mBuilder.getSpirvDecorations(), varId, spv::DecorationPatch, {});
}
mSymbolIdMap.insert({symbol, varId});
return varId;
}
void OutputSPIRVTraverser::nodeDataInitLValue(NodeData *data,
spirv::IdRef baseId,
spirv::IdRef typeId,
spv::StorageClass storageClass,
const SpirvTypeSpec &typeSpec) const
{
*data = {};
// Initialize the access chain as an lvalue. Useful when an access chain is resolved, but needs
// to be replaced by a reference to a temporary variable holding the result.
data->baseId = baseId;
data->accessChain.baseTypeId = typeId;
data->accessChain.preSwizzleTypeId = typeId;
data->accessChain.storageClass = storageClass;
data->accessChain.typeSpec = typeSpec;
}
void OutputSPIRVTraverser::nodeDataInitRValue(NodeData *data,
spirv::IdRef baseId,
spirv::IdRef typeId) const
{
*data = {};
// Initialize the access chain as an rvalue. Useful when an access chain is resolved, and needs
// to be replaced by a reference to it.
data->baseId = baseId;
data->accessChain.baseTypeId = typeId;
data->accessChain.preSwizzleTypeId = typeId;
}
void OutputSPIRVTraverser::accessChainOnPush(NodeData *data, const TType &parentType, size_t index)
{
AccessChain &accessChain = data->accessChain;
// Adjust |typeSpec| based on the type (which implies what the index does; select an array
// element, a block field etc). Index is only meaningful for selecting block fields.
if (parentType.isArray())
{
accessChain.typeSpec.onArrayElementSelection(
(parentType.getStruct() != nullptr || parentType.isInterfaceBlock()),
parentType.isArrayOfArrays());
}
else if (parentType.isInterfaceBlock() || parentType.getStruct() != nullptr)
{
const TFieldListCollection *block = parentType.getInterfaceBlock();
if (!parentType.isInterfaceBlock())
{
block = parentType.getStruct();
}
const TType &fieldType = *block->fields()[index]->type();
accessChain.typeSpec.onBlockFieldSelection(fieldType);
}
else if (parentType.isMatrix())
{
accessChain.typeSpec.onMatrixColumnSelection();
}
else
{
ASSERT(parentType.isVector());
accessChain.typeSpec.onVectorComponentSelection();
}
}
void OutputSPIRVTraverser::accessChainPush(NodeData *data,
spirv::IdRef index,
spirv::IdRef typeId) const
{
// Simply add the index to the chain of indices.
data->idList.emplace_back(index);
data->accessChain.areAllIndicesLiteral = false;
data->accessChain.preSwizzleTypeId = typeId;
}
void OutputSPIRVTraverser::accessChainPushLiteral(NodeData *data,
spirv::LiteralInteger index,
spirv::IdRef typeId) const
{
// Add the literal integer in the chain of indices. Since this is an id list, fake it as an id.
data->idList.emplace_back(index);
data->accessChain.preSwizzleTypeId = typeId;
}
void OutputSPIRVTraverser::accessChainPushSwizzle(NodeData *data,
const TVector<int> &swizzle,
spirv::IdRef typeId,
uint8_t componentCount) const
{
AccessChain &accessChain = data->accessChain;
// Record the swizzle as multi-component swizzles require special handling. When loading
// through the access chain, the swizzle is applied after loading the vector first (see
// |accessChainLoad()|). When storing through the access chain, the whole vector is loaded,
// swizzled components overwritten and the whoel vector written back (see |accessChainStore()|).
ASSERT(accessChain.swizzles.empty());
if (swizzle.size() == 1)
{
// If this swizzle is selecting a single component, fold it into the access chain.
accessChainPushLiteral(data, spirv::LiteralInteger(swizzle[0]), typeId);
}
else
{
// Otherwise keep them separate.
accessChain.swizzles.insert(accessChain.swizzles.end(), swizzle.begin(), swizzle.end());
accessChain.postSwizzleTypeId = typeId;
accessChain.swizzledVectorComponentCount = componentCount;
}
}
void OutputSPIRVTraverser::accessChainPushDynamicComponent(NodeData *data,
spirv::IdRef index,
spirv::IdRef typeId)
{
AccessChain &accessChain = data->accessChain;
// Record the index used to dynamically select a component of a vector.
ASSERT(!accessChain.dynamicComponent.valid());
if (IsAccessChainRValue(accessChain) && accessChain.areAllIndicesLiteral)
{
// If the access chain is an rvalue with all-literal indices, keep this index separate so
// that OpCompositeExtract can be used for the access chain up to this index.
accessChain.dynamicComponent = index;
accessChain.postDynamicComponentTypeId = typeId;
return;
}
if (!accessChain.swizzles.empty())
{
// Otherwise if there's a swizzle, fold the swizzle and dynamic component selection into a
// single dynamic component selection.
ASSERT(accessChain.swizzles.size() > 1);
// Create a vector constant from the swizzles.
spirv::IdRefList swizzleIds;
for (uint32_t component : accessChain.swizzles)
{
swizzleIds.push_back(mBuilder.getUintConstant(component));
}
const spirv::IdRef uintTypeId = mBuilder.getBasicTypeId(EbtUInt, 1);
const spirv::IdRef uvecTypeId = mBuilder.getBasicTypeId(EbtUInt, swizzleIds.size());
const spirv::IdRef swizzlesId = mBuilder.getNewId({});
spirv::WriteConstantComposite(mBuilder.getSpirvTypeAndConstantDecls(), uvecTypeId,
swizzlesId, swizzleIds);
// Index that vector constant with the dynamic index. For example, vec.ywxz[i] becomes the
// constant {1, 3, 0, 2} indexed with i, and that index used on vec.
const spirv::IdRef newIndex = mBuilder.getNewId({});
spirv::WriteVectorExtractDynamic(mBuilder.getSpirvCurrentFunctionBlock(), uintTypeId,
newIndex, swizzlesId, index);
index = newIndex;
accessChain.swizzles.clear();
}
// Fold it into the access chain.
accessChainPush(data, index, typeId);
}
spirv::IdRef OutputSPIRVTraverser::accessChainCollapse(NodeData *data)
{
AccessChain &accessChain = data->accessChain;
ASSERT(accessChain.storageClass != spv::StorageClassMax);
if (accessChain.accessChainId.valid())
{
return accessChain.accessChainId;
}
// If there are no indices, the baseId is where access is done to/from.
if (data->idList.empty())
{
accessChain.accessChainId = data->baseId;
return accessChain.accessChainId;
}
// Otherwise create an OpAccessChain instruction. Swizzle handling is special as it selects
// multiple components, and is done differently for load and store.
spirv::IdRefList indexIds;
makeAccessChainIdList(data, &indexIds);
const spirv::IdRef typePointerId =
mBuilder.getTypePointerId(accessChain.preSwizzleTypeId, accessChain.storageClass);
accessChain.accessChainId = mBuilder.getNewId({});
spirv::WriteAccessChain(mBuilder.getSpirvCurrentFunctionBlock(), typePointerId,
accessChain.accessChainId, data->baseId, indexIds);
return accessChain.accessChainId;
}
spirv::IdRef OutputSPIRVTraverser::accessChainLoad(NodeData *data,
const TType &valueType,
spirv::IdRef *resultTypeIdOut)
{
const SpirvDecorations &decorations = mBuilder.getDecorations(valueType);
// Loading through the access chain can generate different instructions based on whether it's an
// rvalue, the indices are literal, there's a swizzle etc.
//
// - If rvalue:
// * With indices:
// + All literal: OpCompositeExtract which uses literal integers to access the rvalue.
// + Otherwise: Can't use OpAccessChain on an rvalue, so create a temporary variable, OpStore
// the rvalue into it, then use OpAccessChain and OpLoad to load from it.
// * Without indices: Take the base id.
// - If lvalue:
// * With indices: Use OpAccessChain and OpLoad
// * Without indices: Use OpLoad
// - With swizzle: Use OpVectorShuffle on the result of the previous step
// - With dynamic component: Use OpVectorExtractDynamic on the result of the previous step
AccessChain &accessChain = data->accessChain;
if (resultTypeIdOut)
{
*resultTypeIdOut = getAccessChainTypeId(data);
}
spirv::IdRef loadResult = data->baseId;
if (IsAccessChainRValue(accessChain))
{
if (data->idList.size() > 0)
{
if (accessChain.areAllIndicesLiteral)
{
// Use OpCompositeExtract on an rvalue with all literal indices.
spirv::LiteralIntegerList indexList;
makeAccessChainLiteralList(data, &indexList);
const spirv::IdRef result = mBuilder.getNewId(decorations);
spirv::WriteCompositeExtract(mBuilder.getSpirvCurrentFunctionBlock(),
accessChain.preSwizzleTypeId, result, loadResult,
indexList);
loadResult = result;
}
else
{
// Create a temp variable to hold the rvalue so an access chain can be made on it.
const spirv::IdRef tempVar =
mBuilder.declareVariable(accessChain.baseTypeId, spv::StorageClassFunction,
decorations, nullptr, "indexable");
// Write the rvalue into the temp variable
spirv::WriteStore(mBuilder.getSpirvCurrentFunctionBlock(), tempVar, loadResult,
nullptr);
// Make the temp variable the source of the access chain.
data->baseId = tempVar;
data->accessChain.storageClass = spv::StorageClassFunction;
// Load from the temp variable.
const spirv::IdRef accessChainId = accessChainCollapse(data);
loadResult = mBuilder.getNewId(decorations);
spirv::WriteLoad(mBuilder.getSpirvCurrentFunctionBlock(),
accessChain.preSwizzleTypeId, loadResult, accessChainId, nullptr);
}
}
}
else
{
// Load from the access chain.
const spirv::IdRef accessChainId = accessChainCollapse(data);
loadResult = mBuilder.getNewId(decorations);
spirv::WriteLoad(mBuilder.getSpirvCurrentFunctionBlock(), accessChain.preSwizzleTypeId,
loadResult, accessChainId, nullptr);
}
if (!accessChain.swizzles.empty())
{
// Single-component swizzles are already folded into the index list.
ASSERT(accessChain.swizzles.size() > 1);
// Take the loaded value and use OpVectorShuffle to create the swizzle.
spirv::LiteralIntegerList swizzleList;
for (uint32_t component : accessChain.swizzles)
{
swizzleList.push_back(spirv::LiteralInteger(component));
}
const spirv::IdRef result = mBuilder.getNewId(decorations);
spirv::WriteVectorShuffle(mBuilder.getSpirvCurrentFunctionBlock(),
accessChain.postSwizzleTypeId, result, loadResult, loadResult,
swizzleList);
loadResult = result;
}
if (accessChain.dynamicComponent.valid())
{
// Dynamic component in combination with swizzle is already folded.
ASSERT(accessChain.swizzles.empty());
// Use OpVectorExtractDynamic to select the component.
const spirv::IdRef result = mBuilder.getNewId(decorations);
spirv::WriteVectorExtractDynamic(mBuilder.getSpirvCurrentFunctionBlock(),
accessChain.postDynamicComponentTypeId, result, loadResult,
accessChain.dynamicComponent);
loadResult = result;
}
// Upon loading values, cast them to the default SPIR-V variant.
const spirv::IdRef castResult =
cast(loadResult, valueType, accessChain.typeSpec, {}, resultTypeIdOut);
return castResult;
}
void OutputSPIRVTraverser::accessChainStore(NodeData *data,
spirv::IdRef value,
const TType &valueType)
{
// Storing through the access chain can generate different instructions based on whether the
// there's a swizzle.
//
// - Without swizzle: Use OpAccessChain and OpStore
// - With swizzle: Use OpAccessChain and OpLoad to load the vector, then use OpVectorShuffle to
// replace the components being overwritten. Finally, use OpStore to write the result back.
AccessChain &accessChain = data->accessChain;
// Single-component swizzles are already folded into the indices.
ASSERT(accessChain.swizzles.size() != 1);
// Since store can only happen through lvalues, it's impossible to have a dynamic component as
// that always gets folded into the indices except for rvalues.
ASSERT(!accessChain.dynamicComponent.valid());
const spirv::IdRef accessChainId = accessChainCollapse(data);
// Store through the access chain. The values are always cast to the default SPIR-V type
// variant when loaded from memory and operated on as such. When storing, we need to cast the
// result to the variant specified by the access chain.
value = cast(value, valueType, {}, accessChain.typeSpec, nullptr);
if (!accessChain.swizzles.empty())
{
// Load the vector before the swizzle.
const spirv::IdRef loadResult = mBuilder.getNewId({});
spirv::WriteLoad(mBuilder.getSpirvCurrentFunctionBlock(), accessChain.preSwizzleTypeId,
loadResult, accessChainId, nullptr);
// Overwrite the components being written. This is done by first creating an identity
// swizzle, then replacing the components being written with a swizzle from the value. For
// example, take the following:
//
// vec4 v;
// v.zx = u;
//
// The OpVectorShuffle instruction takes two vectors (v and u) and selects components from
// each (in this example, swizzles [0, 3] select from v and [4, 7] select from u). This
// algorithm first creates the identity swizzles {0, 1, 2, 3}, then replaces z and x (the
// 0th and 2nd element) with swizzles from u (4 + {0, 1}) to get the result
// {4+1, 1, 4+0, 3}.
spirv::LiteralIntegerList swizzleList;
for (uint32_t component = 0; component < accessChain.swizzledVectorComponentCount;
++component)
{
swizzleList.push_back(spirv::LiteralInteger(component));
}
uint32_t srcComponent = 0;
for (uint32_t dstComponent : accessChain.swizzles)
{
swizzleList[dstComponent] =
spirv::LiteralInteger(accessChain.swizzledVectorComponentCount + srcComponent);
++srcComponent;
}
// Use the generated swizzle to select components from the loaded vector and the value to be
// written. Use the final result as the value to be written to the vector.
const spirv::IdRef result = mBuilder.getNewId({});
spirv::WriteVectorShuffle(mBuilder.getSpirvCurrentFunctionBlock(),
accessChain.preSwizzleTypeId, result, loadResult, value,
swizzleList);
value = result;
}
spirv::WriteStore(mBuilder.getSpirvCurrentFunctionBlock(), accessChainId, value, nullptr);
}
void OutputSPIRVTraverser::makeAccessChainIdList(NodeData *data, spirv::IdRefList *idsOut)
{
for (size_t index = 0; index < data->idList.size(); ++index)
{
spirv::IdRef indexId = data->idList[index].id;
if (!indexId.valid())
{
// The index is a literal integer, so replace it with an OpConstant id.
indexId = mBuilder.getUintConstant(data->idList[index].literal);
}
idsOut->push_back(indexId);
}
}
void OutputSPIRVTraverser::makeAccessChainLiteralList(NodeData *data,
spirv::LiteralIntegerList *literalsOut)
{
for (size_t index = 0; index < data->idList.size(); ++index)
{
ASSERT(!data->idList[index].id.valid());
literalsOut->push_back(data->idList[index].literal);
}
}
spirv::IdRef OutputSPIRVTraverser::getAccessChainTypeId(NodeData *data)
{
// Load and store through the access chain may be done in multiple steps. These steps produce
// the following types:
//
// - preSwizzleTypeId
// - postSwizzleTypeId
// - postDynamicComponentTypeId
//
// The last of these types is the final type of the expression this access chain corresponds to.
const AccessChain &accessChain = data->accessChain;
if (accessChain.postDynamicComponentTypeId.valid())
{
return accessChain.postDynamicComponentTypeId;
}
if (accessChain.postSwizzleTypeId.valid())
{
return accessChain.postSwizzleTypeId;
}
ASSERT(accessChain.preSwizzleTypeId.valid());
return accessChain.preSwizzleTypeId;
}
void OutputSPIRVTraverser::declareConst(TIntermDeclaration *decl)
{
const TIntermSequence &sequence = *decl->getSequence();
ASSERT(sequence.size() == 1);
TIntermBinary *assign = sequence.front()->getAsBinaryNode();
ASSERT(assign != nullptr && assign->getOp() == EOpInitialize);
TIntermSymbol *symbol = assign->getLeft()->getAsSymbolNode();
ASSERT(symbol != nullptr && symbol->getType().getQualifier() == EvqConst);
TIntermTyped *initializer = assign->getRight();
ASSERT(initializer->getAsConstantUnion() != nullptr || initializer->hasConstantValue());
const TType &type = symbol->getType();
const TVariable *variable = &symbol->variable();
const spirv::IdRef typeId = mBuilder.getTypeData(type, {}).id;
const spirv::IdRef constId =
createConstant(type, type.getBasicType(), initializer->getConstantValue(),
initializer->isConstantNullValue());
// Remember the id of the variable for future look up.
ASSERT(mSymbolIdMap.count(variable) == 0);
mSymbolIdMap[variable] = constId;
if (!mInGlobalScope)
{
mNodeData.emplace_back();
nodeDataInitRValue(&mNodeData.back(), constId, typeId);
}
}
void OutputSPIRVTraverser::declareSpecConst(TIntermDeclaration *decl)
{
const TIntermSequence &sequence = *decl->getSequence();
ASSERT(sequence.size() == 1);
TIntermBinary *assign = sequence.front()->getAsBinaryNode();
ASSERT(assign != nullptr && assign->getOp() == EOpInitialize);
TIntermSymbol *symbol = assign->getLeft()->getAsSymbolNode();
ASSERT(symbol != nullptr && symbol->getType().getQualifier() == EvqSpecConst);
TIntermConstantUnion *initializer = assign->getRight()->getAsConstantUnion();
ASSERT(initializer != nullptr);
const TType &type = symbol->getType();
const TVariable *variable = &symbol->variable();
// All spec consts in ANGLE are initialized to 0.
ASSERT(initializer->isZero(0));
const spirv::IdRef specConstId =
mBuilder.declareSpecConst(type.getBasicType(), type.getLayoutQualifier().location,
mBuilder.hashName(variable).data());
// Remember the id of the variable for future look up.
ASSERT(mSymbolIdMap.count(variable) == 0);
mSymbolIdMap[variable] = specConstId;
}
spirv::IdRef OutputSPIRVTraverser::createConstant(const TType &type,
TBasicType expectedBasicType,
const TConstantUnion *constUnion,
bool isConstantNullValue)
{
const spirv::IdRef typeId = mBuilder.getTypeData(type, {}).id;
spirv::IdRefList componentIds;
// If the object is all zeros, use OpConstantNull to avoid creating a bunch of constants. This
// is not done for basic scalar types as some instructions require an OpConstant and validation
// doesn't accept OpConstantNull (likely a spec bug).
const size_t size = type.getObjectSize();
const TBasicType basicType = type.getBasicType();
const bool isBasicScalar = size == 1 && (basicType == EbtFloat || basicType == EbtInt ||
basicType == EbtUInt || basicType == EbtBool);
const bool useOpConstantNull = isConstantNullValue && !isBasicScalar;
if (useOpConstantNull)
{
return mBuilder.getNullConstant(typeId);
}
if (type.isArray())
{
TType elementType(type);
elementType.toArrayElementType();
// If it's an array constant, get the constant id of each element.
for (unsigned int elementIndex = 0; elementIndex < type.getOutermostArraySize();
++elementIndex)
{
componentIds.push_back(
createConstant(elementType, expectedBasicType, constUnion, false));
constUnion += elementType.getObjectSize();
}
}
else if (type.getBasicType() == EbtStruct)
{
// If it's a struct constant, get the constant id for each field.
for (const TField *field : type.getStruct()->fields())
{
const TType *fieldType = field->type();
componentIds.push_back(
createConstant(*fieldType, fieldType->getBasicType(), constUnion, false));
constUnion += fieldType->getObjectSize();
}
}
else
{
// Otherwise get the constant id for each component.
ASSERT(expectedBasicType == EbtFloat || expectedBasicType == EbtInt ||
expectedBasicType == EbtUInt || expectedBasicType == EbtBool);
for (size_t component = 0; component < size; ++component, ++constUnion)
{
spirv::IdRef componentId;
// If the constant has a different type than expected, cast it right away.
TConstantUnion castConstant;
bool valid = castConstant.cast(expectedBasicType, *constUnion);
ASSERT(valid);
switch (castConstant.getType())
{
case EbtFloat:
componentId = mBuilder.getFloatConstant(castConstant.getFConst());
break;
case EbtInt:
componentId = mBuilder.getIntConstant(castConstant.getIConst());
break;
case EbtUInt:
componentId = mBuilder.getUintConstant(castConstant.getUConst());
break;
case EbtBool:
componentId = mBuilder.getBoolConstant(castConstant.getBConst());
break;
default:
UNREACHABLE();
}
componentIds.push_back(componentId);
}
}
// If this is a composite, create a composite constant from the components.
if (type.isArray() || type.getBasicType() == EbtStruct || componentIds.size() > 1)
{
return createComplexConstant(type, typeId, componentIds);
}
// Otherwise return the sole component.
ASSERT(componentIds.size() == 1);
return componentIds[0];
}
spirv::IdRef OutputSPIRVTraverser::createComplexConstant(const TType &type,
spirv::IdRef typeId,
const spirv::IdRefList ¶meters)
{
ASSERT(!type.isScalar());
if (type.isMatrix() && !type.isArray())
{
// Matrices are constructed from their columns.
spirv::IdRefList columnIds;
const spirv::IdRef columnTypeId =
mBuilder.getBasicTypeId(type.getBasicType(), type.getRows());
for (int columnIndex = 0; columnIndex < type.getCols(); ++columnIndex)
{
auto columnParametersStart = parameters.begin() + columnIndex * type.getRows();
spirv::IdRefList columnParameters(columnParametersStart,
columnParametersStart + type.getRows());
columnIds.push_back(mBuilder.getCompositeConstant(columnTypeId, columnParameters));
}
return mBuilder.getCompositeConstant(typeId, columnIds);
}
return mBuilder.getCompositeConstant(typeId, parameters);
}
spirv::IdRef OutputSPIRVTraverser::createConstructor(TIntermAggregate *node, spirv::IdRef typeId)
{
const TType &type = node->getType();
const TIntermSequence &arguments = *node->getSequence();
const TType &arg0Type = arguments[0]->getAsTyped()->getType();
// In some cases, constructors-with-constant values are not folded. If the constructor is a
// null value, use OpConstantNull to avoid creating a bunch of instructions. Otherwise, the
// constant is created below.
if (node->isConstantNullValue())
{
return mBuilder.getNullConstant(typeId);
}
// Take each constructor argument that is visited and evaluate it as rvalue
spirv::IdRefList parameters = loadAllParams(node, 0, nullptr);
// Constructors in GLSL can take various shapes, resulting in different translations to SPIR-V
// (in each case, if the parameter doesn't match the type being constructed, it must be cast):
//
// - float(f): This should translate to just f
// - float(v): This should translate to OpCompositeExtract %scalar %v 0
// - float(m): This should translate to OpCompositeExtract %scalar %m 0 0
// - vecN(f): This should translate to OpCompositeConstruct %vecN %f %f .. %f
// - vecN(v1.zy, v2.x): This can technically translate to OpCompositeConstruct with two ids; the
// results of v1.zy and v2.x. However, for simplicity it's easier to generate that
// instruction with three ids; the results of v1.z, v1.y and v2.x (see below where a matrix is
// used as parameter).
// - vecN(m): This takes N components from m in column-major order (for example, vec4
// constructed out of a 4x3 matrix would select components (0,0), (0,1), (0,2) and (1,0)).
// This translates to OpCompositeConstruct with the id of the individual components extracted
// from m.
// - matNxM(f): This creates a diagonal matrix. It generates N OpCompositeConstruct
// instructions for each column (which are vecM), followed by an OpCompositeConstruct that
// constructs the final result.
// - matNxM(m):
// * With m larger than NxM, this extracts a submatrix out of m. It generates
// OpCompositeExtracts for N columns of m, followed by an OpVectorShuffle (swizzle) if the
// rows of m are more than M. OpCompositeConstruct is used to construct the final result.
// * If m is not larger than NxM, an identity matrix is created and superimposed with m.
// OpCompositeExtract is used to extract each component of m (that is necessary), and
// together with the zero or one constants necessary used to create the columns (with
// OpCompositeConstruct). OpCompositeConstruct is used to construct the final result.
// - matNxM(v1.zy, v2.x, ...): Similarly to constructing a vector, a list of single components
// are extracted from the parameters, which are divided up and used to construct each column,
// which is finally constructed into the final result.
//
// Additionally, array and structs are constructed by OpCompositeConstruct followed by ids of
// each parameter which must enumerate every individual element / field.
// In some cases, constructors-with-constant values are not folded such as for large constants.
// Some transformations may also produce constructors-with-constants instead of constants even
// for basic types. These are handled here.
if (node->hasConstantValue())
{
if (!type.isScalar())
{
return createComplexConstant(node->getType(), typeId, parameters);
}
// If a transformation creates scalar(constant), return the constant as-is.
// visitConstantUnion has already cast it to the right type.
if (arguments[0]->getAsConstantUnion() != nullptr)
{
return parameters[0];
}
}
if (type.isArray() || type.getStruct() != nullptr)
{
return createArrayOrStructConstructor(node, typeId, parameters);
}
// The following are simple casts:
//
// - basic(s) (where basic is int, uint, float or bool, and s is scalar).
// - gvecN(vN) (where the argument is a single vector with the same number of components).
// - matNxM(mNxM) (where the argument is a single matrix with the same dimensions). Note that
// matrices are always float, so there's no actual cast and this would be a no-op.
//
const bool isSingleScalarCast = arguments.size() == 1 && type.isScalar() && arg0Type.isScalar();
const bool isSingleVectorCast = arguments.size() == 1 && type.isVector() &&
arg0Type.isVector() &&
type.getNominalSize() == arg0Type.getNominalSize();
const bool isSingleMatrixCast = arguments.size() == 1 && type.isMatrix() &&
arg0Type.isMatrix() && type.getCols() == arg0Type.getCols() &&
type.getRows() == arg0Type.getRows();
if (isSingleScalarCast || isSingleVectorCast || isSingleMatrixCast)
{
return castBasicType(parameters[0], arg0Type, type, nullptr);
}
if (type.isScalar())
{
ASSERT(arguments.size() == 1);
return createConstructorScalarFromNonScalar(node, typeId, parameters);
}
if (type.isVector())
{
if (arguments.size() == 1 && arg0Type.isScalar())
{
return createConstructorVectorFromScalar(arg0Type, type, typeId, parameters);
}
if (arg0Type.isMatrix())
{
// If the first argument is a matrix, it will always have enough components to fill an
// entire vector, so it doesn't matter what's specified after it.
return createConstructorVectorFromMatrix(node, typeId, parameters);
}
return createConstructorVectorFromMultiple(node, typeId, parameters);
}
ASSERT(type.isMatrix());
if (arg0Type.isScalar() && arguments.size() == 1)
{
parameters[0] = castBasicType(parameters[0], arg0Type, type, nullptr);
return createConstructorMatrixFromScalar(node, typeId, parameters);
}
if (arg0Type.isMatrix())
{
return createConstructorMatrixFromMatrix(node, typeId, parameters);
}
return createConstructorMatrixFromVectors(node, typeId, parameters);
}
spirv::IdRef OutputSPIRVTraverser::createArrayOrStructConstructor(
TIntermAggregate *node,
spirv::IdRef typeId,
const spirv::IdRefList ¶meters)
{
const spirv::IdRef result = mBuilder.getNewId(mBuilder.getDecorations(node->getType()));
spirv::WriteCompositeConstruct(mBuilder.getSpirvCurrentFunctionBlock(), typeId, result,
parameters);
return result;
}
spirv::IdRef OutputSPIRVTraverser::createConstructorScalarFromNonScalar(
TIntermAggregate *node,
spirv::IdRef typeId,
const spirv::IdRefList ¶meters)
{
ASSERT(parameters.size() == 1);
const TType &type = node->getType();
const TType &arg0Type = node->getChildNode(0)->getAsTyped()->getType();
const spirv::IdRef result = mBuilder.getNewId(mBuilder.getDecorations(type));
spirv::LiteralIntegerList indices = {spirv::LiteralInteger(0)};
if (arg0Type.isMatrix())
{
indices.push_back(spirv::LiteralInteger(0));
}
spirv::WriteCompositeExtract(mBuilder.getSpirvCurrentFunctionBlock(),
mBuilder.getBasicTypeId(arg0Type.getBasicType(), 1), result,
parameters[0], indices);
TType arg0TypeAsScalar(arg0Type);
arg0TypeAsScalar.toComponentType();
return castBasicType(result, arg0TypeAsScalar, type, nullptr);
}
spirv::IdRef OutputSPIRVTraverser::createConstructorVectorFromScalar(
const TType ¶meterType,
const TType &expectedType,
spirv::IdRef typeId,
const spirv::IdRefList ¶meters)
{
// vecN(f) translates to OpCompositeConstruct %vecN %f ... %f
ASSERT(parameters.size() == 1);
const spirv::IdRef castParameter =
castBasicType(parameters[0], parameterType, expectedType, nullptr);
spirv::IdRefList replicatedParameter(expectedType.getNominalSize(), castParameter);
const spirv::IdRef result = mBuilder.getNewId(mBuilder.getDecorations(parameterType));
spirv::WriteCompositeConstruct(mBuilder.getSpirvCurrentFunctionBlock(), typeId, result,
replicatedParameter);
return result;
}
spirv::IdRef OutputSPIRVTraverser::createConstructorVectorFromMatrix(
TIntermAggregate *node,
spirv::IdRef typeId,
const spirv::IdRefList ¶meters)
{
// vecN(m) translates to OpCompositeConstruct %vecN %m[0][0] %m[0][1] ...
spirv::IdRefList extractedComponents;
extractComponents(node, node->getType().getNominalSize(), parameters, &extractedComponents);
// Construct the vector with the basic type of the argument, and cast it at end if needed.
ASSERT(parameters.size() == 1);
const TType &arg0Type = node->getChildNode(0)->getAsTyped()->getType();
const TType &expectedType = node->getType();
spirv::IdRef argumentTypeId = typeId;
TType arg0TypeAsVector(arg0Type);
arg0TypeAsVector.setPrimarySize(static_cast<unsigned char>(node->getType().getNominalSize()));
arg0TypeAsVector.setSecondarySize(1);
if (arg0Type.getBasicType() != expectedType.getBasicType())
{
argumentTypeId = mBuilder.getTypeData(arg0TypeAsVector, {}).id;
}
spirv::IdRef result = mBuilder.getNewId(mBuilder.getDecorations(node->getType()));
spirv::WriteCompositeConstruct(mBuilder.getSpirvCurrentFunctionBlock(), argumentTypeId, result,
extractedComponents);
if (arg0Type.getBasicType() != expectedType.getBasicType())
{
result = castBasicType(result, arg0TypeAsVector, expectedType, nullptr);
}
return result;
}
spirv::IdRef OutputSPIRVTraverser::createConstructorVectorFromMultiple(
TIntermAggregate *node,
spirv::IdRef typeId,
const spirv::IdRefList ¶meters)
{
const TType &type = node->getType();
// vecN(v1.zy, v2.x) translates to OpCompositeConstruct %vecN %v1.z %v1.y %v2.x
spirv::IdRefList extractedComponents;
extractComponents(node, type.getNominalSize(), parameters, &extractedComponents);
// Handle the case where a matrix is used in the constructor anywhere but the first place. In
// that case, the components extracted from the matrix might need casting to the right type.
const TIntermSequence &arguments = *node->getSequence();
for (size_t argumentIndex = 0, componentIndex = 0;
argumentIndex < arguments.size() && componentIndex < extractedComponents.size();
++argumentIndex)
{
TIntermNode *argument = arguments[argumentIndex];
const TType &argumentType = argument->getAsTyped()->getType();
if (argumentType.isScalar() || argumentType.isVector())
{
// extractComponents already casts scalar and vector components.
componentIndex += argumentType.getNominalSize();
continue;
}
TType componentType(argumentType);
componentType.toComponentType();
for (int columnIndex = 0;
columnIndex < argumentType.getCols() && componentIndex < extractedComponents.size();
++columnIndex)
{
for (int rowIndex = 0;
rowIndex < argumentType.getRows() && componentIndex < extractedComponents.size();
++rowIndex, ++componentIndex)
{
extractedComponents[componentIndex] = castBasicType(
extractedComponents[componentIndex], componentType, type, nullptr);
}
}
// Matrices all have enough components to fill a vector, so it's impossible to need to visit
// any other arguments that may come after.
ASSERT(componentIndex == extractedComponents.size());
}
const spirv::IdRef result = mBuilder.getNewId(mBuilder.getDecorations(node->getType()));
spirv::WriteCompositeConstruct(mBuilder.getSpirvCurrentFunctionBlock(), typeId, result,
extractedComponents);
return result;
}
spirv::IdRef OutputSPIRVTraverser::createConstructorMatrixFromScalar(
TIntermAggregate *node,
spirv::IdRef typeId,
const spirv::IdRefList ¶meters)
{
// matNxM(f) translates to
//
// %c0 = OpCompositeConstruct %vecM %f %zero %zero ..
// %c1 = OpCompositeConstruct %vecM %zero %f %zero ..
// %c2 = OpCompositeConstruct %vecM %zero %zero %f ..
// ...
// %m = OpCompositeConstruct %matNxM %c0 %c1 %c2 ...
const TType &type = node->getType();
const spirv::IdRef scalarId = parameters[0];
spirv::IdRef zeroId;
SpirvDecorations decorations = mBuilder.getDecorations(type);
switch (type.getBasicType())
{
case EbtFloat:
zeroId = mBuilder.getFloatConstant(0);
break;
case EbtInt:
zeroId = mBuilder.getIntConstant(0);
break;
case EbtUInt:
zeroId = mBuilder.getUintConstant(0);
break;
case EbtBool:
zeroId = mBuilder.getBoolConstant(0);
break;
default:
UNREACHABLE();
}
spirv::IdRefList componentIds(type.getRows(), zeroId);
spirv::IdRefList columnIds;
const spirv::IdRef columnTypeId = mBuilder.getBasicTypeId(type.getBasicType(), type.getRows());
for (int columnIndex = 0; columnIndex < type.getCols(); ++columnIndex)
{
columnIds.push_back(mBuilder.getNewId(decorations));
// Place the scalar at the correct index (diagonal of the matrix, i.e. row == col).
if (columnIndex < type.getRows())
{
componentIds[columnIndex] = scalarId;
}
if (columnIndex > 0 && columnIndex <= type.getRows())
{
componentIds[columnIndex - 1] = zeroId;
}
// Create the column.
spirv::WriteCompositeConstruct(mBuilder.getSpirvCurrentFunctionBlock(), columnTypeId,
columnIds.back(), componentIds);
}
// Create the matrix out of the columns.
const spirv::IdRef result = mBuilder.getNewId(decorations);
spirv::WriteCompositeConstruct(mBuilder.getSpirvCurrentFunctionBlock(), typeId, result,
columnIds);
return result;
}
spirv::IdRef OutputSPIRVTraverser::createConstructorMatrixFromVectors(
TIntermAggregate *node,
spirv::IdRef typeId,
const spirv::IdRefList ¶meters)
{
// matNxM(v1.zy, v2.x, ...) translates to:
//
// %c0 = OpCompositeConstruct %vecM %v1.z %v1.y %v2.x ..
// ...
// %m = OpCompositeConstruct %matNxM %c0 %c1 %c2 ...
const TType &type = node->getType();
SpirvDecorations decorations = mBuilder.getDecorations(type);
spirv::IdRefList extractedComponents;
extractComponents(node, type.getCols() * type.getRows(), parameters, &extractedComponents);
spirv::IdRefList columnIds;
const spirv::IdRef columnTypeId = mBuilder.getBasicTypeId(type.getBasicType(), type.getRows());
// Chunk up the extracted components by column and construct intermediary vectors.
for (int columnIndex = 0; columnIndex < type.getCols(); ++columnIndex)
{
columnIds.push_back(mBuilder.getNewId(decorations));
auto componentsStart = extractedComponents.begin() + columnIndex * type.getRows();
const spirv::IdRefList componentIds(componentsStart, componentsStart + type.getRows());
// Create the column.
spirv::WriteCompositeConstruct(mBuilder.getSpirvCurrentFunctionBlock(), columnTypeId,
columnIds.back(), componentIds);
}
const spirv::IdRef result = mBuilder.getNewId(decorations);
spirv::WriteCompositeConstruct(mBuilder.getSpirvCurrentFunctionBlock(), typeId, result,
columnIds);
return result;
}
spirv::IdRef OutputSPIRVTraverser::createConstructorMatrixFromMatrix(
TIntermAggregate *node,
spirv::IdRef typeId,
const spirv::IdRefList ¶meters)
{
// matNxM(m) translates to:
//
// - If m is SxR where S>=N and R>=M:
//
// %c0 = OpCompositeExtract %vecR %m 0
// %c1 = OpCompositeExtract %vecR %m 1
// ...
// // If R (column size of m) != M, OpVectorShuffle to extract M components out of %ci.
// ...
// %m = OpCompositeConstruct %matNxM %c0 %c1 %c2 ...
//
// - Otherwise, an identity matrix is created and super imposed by m:
//
// %c0 = OpCompositeConstruct %vecM %m[0][0] %m[0][1] %0 %0
// %c1 = OpCompositeConstruct %vecM %m[1][0] %m[1][1] %0 %0
// %c2 = OpCompositeConstruct %vecM %m[2][0] %m[2][1] %1 %0
// %c3 = OpCompositeConstruct %vecM %0 %0 %0 %1
// %m = OpCompositeConstruct %matNxM %c0 %c1 %c2 %c3
const TType &type = node->getType();
const TType ¶meterType = (*node->getSequence())[0]->getAsTyped()->getType();
SpirvDecorations decorations = mBuilder.getDecorations(type);
ASSERT(parameters.size() == 1);
spirv::IdRefList columnIds;
const spirv::IdRef columnTypeId = mBuilder.getBasicTypeId(type.getBasicType(), type.getRows());
if (parameterType.getCols() >= type.getCols() && parameterType.getRows() >= type.getRows())
{
// If the parameter is a larger matrix than the constructor type, extract the columns
// directly and potentially swizzle them.
TType paramColumnType(parameterType);
paramColumnType.toMatrixColumnType();
const spirv::IdRef paramColumnTypeId = mBuilder.getTypeData(paramColumnType, {}).id;
const bool needsSwizzle = parameterType.getRows() > type.getRows();
spirv::LiteralIntegerList swizzle = {spirv::LiteralInteger(0), spirv::LiteralInteger(1),
spirv::LiteralInteger(2), spirv::LiteralInteger(3)};
swizzle.resize(type.getRows());
for (int columnIndex = 0; columnIndex < type.getCols(); ++columnIndex)
{
// Extract the column.
const spirv::IdRef parameterColumnId = mBuilder.getNewId(decorations);
spirv::WriteCompositeExtract(mBuilder.getSpirvCurrentFunctionBlock(), paramColumnTypeId,
parameterColumnId, parameters[0],
{spirv::LiteralInteger(columnIndex)});
// If the column has too many components, select the appropriate number of components.
spirv::IdRef constructorColumnId = parameterColumnId;
if (needsSwizzle)
{
constructorColumnId = mBuilder.getNewId(decorations);
spirv::WriteVectorShuffle(mBuilder.getSpirvCurrentFunctionBlock(), columnTypeId,
constructorColumnId, parameterColumnId, parameterColumnId,
swizzle);
}
columnIds.push_back(constructorColumnId);
}
}
else
{
// Otherwise create an identity matrix and fill in the components that can be taken from the
// given parameter.
TType paramComponentType(parameterType);
paramComponentType.toComponentType();
const spirv::IdRef paramComponentTypeId = mBuilder.getTypeData(paramComponentType, {}).id;
for (int columnIndex = 0; columnIndex < type.getCols(); ++columnIndex)
{
spirv::IdRefList componentIds;
for (int componentIndex = 0; componentIndex < type.getRows(); ++componentIndex)
{
// Take the component from the constructor parameter if possible.
spirv::IdRef componentId;
if (componentIndex < parameterType.getRows() &&
columnIndex < parameterType.getCols())
{
componentId = mBuilder.getNewId(decorations);
spirv::WriteCompositeExtract(mBuilder.getSpirvCurrentFunctionBlock(),
paramComponentTypeId, componentId, parameters[0],
{spirv::LiteralInteger(columnIndex),
spirv::LiteralInteger(componentIndex)});
}
else
{
const bool isOnDiagonal = columnIndex == componentIndex;
switch (type.getBasicType())
{
case EbtFloat:
componentId = mBuilder.getFloatConstant(isOnDiagonal ? 1.0f : 0.0f);
break;
case EbtInt:
componentId = mBuilder.getIntConstant(isOnDiagonal ? 1 : 0);
break;
case EbtUInt:
componentId = mBuilder.getUintConstant(isOnDiagonal ? 1 : 0);
break;
case EbtBool:
componentId = mBuilder.getBoolConstant(isOnDiagonal);
break;
default:
UNREACHABLE();
}
}
componentIds.push_back(componentId);
}
// Create the column vector.
columnIds.push_back(mBuilder.getNewId(decorations));
spirv::WriteCompositeConstruct(mBuilder.getSpirvCurrentFunctionBlock(), columnTypeId,
columnIds.back(), componentIds);
}
}
const spirv::IdRef result = mBuilder.getNewId(decorations);
spirv::WriteCompositeConstruct(mBuilder.getSpirvCurrentFunctionBlock(), typeId, result,
columnIds);
return result;
}
spirv::IdRefList OutputSPIRVTraverser::loadAllParams(TIntermOperator *node,
size_t skipCount,
spirv::IdRefList *paramTypeIds)
{
const size_t parameterCount = node->getChildCount();
spirv::IdRefList parameters;
for (size_t paramIndex = 0; paramIndex + skipCount < parameterCount; ++paramIndex)
{
// Take each parameter that is visited and evaluate it as rvalue
NodeData ¶m = mNodeData[mNodeData.size() - parameterCount + paramIndex];
spirv::IdRef paramTypeId;
const spirv::IdRef paramValue = accessChainLoad(
¶m, node->getChildNode(paramIndex)->getAsTyped()->getType(), ¶mTypeId);
parameters.push_back(paramValue);
if (paramTypeIds)
{
paramTypeIds->push_back(paramTypeId);
}
}
return parameters;
}
void OutputSPIRVTraverser::extractComponents(TIntermAggregate *node,
size_t componentCount,
const spirv::IdRefList ¶meters,
spirv::IdRefList *extractedComponentsOut)
{
// A helper function that takes the list of parameters passed to a constructor (which may have
// more components than necessary) and extracts the first componentCount components.
const TIntermSequence &arguments = *node->getSequence();
const SpirvDecorations decorations = mBuilder.getDecorations(node->getType());
const TType &expectedType = node->getType();
ASSERT(arguments.size() == parameters.size());
for (size_t argumentIndex = 0;
argumentIndex < arguments.size() && extractedComponentsOut->size() < componentCount;
++argumentIndex)
{
TIntermNode *argument = arguments[argumentIndex];
const TType &argumentType = argument->getAsTyped()->getType();
const spirv::IdRef parameterId = parameters[argumentIndex];
if (argumentType.isScalar())
{
// For scalar parameters, there's nothing to do other than a potential cast.
const spirv::IdRef castParameterId =
argument->getAsConstantUnion()
? parameterId
: castBasicType(parameterId, argumentType, expectedType, nullptr);
extractedComponentsOut->push_back(castParameterId);
continue;
}
if (argumentType.isVector())
{
TType componentType(argumentType);
componentType.toComponentType();
componentType.setBasicType(expectedType.getBasicType());
const spirv::IdRef componentTypeId = mBuilder.getTypeData(componentType, {}).id;
// Cast the whole vector parameter in one go.
const spirv::IdRef castParameterId =
argument->getAsConstantUnion()
? parameterId
: castBasicType(parameterId, argumentType, expectedType, nullptr);
// For vector parameters, take components out of the vector one by one.
for (int componentIndex = 0; componentIndex < argumentType.getNominalSize() &&
extractedComponentsOut->size() < componentCount;
++componentIndex)
{
const spirv::IdRef componentId = mBuilder.getNewId(decorations);
spirv::WriteCompositeExtract(mBuilder.getSpirvCurrentFunctionBlock(),
componentTypeId, componentId, castParameterId,
{spirv::LiteralInteger(componentIndex)});
extractedComponentsOut->push_back(componentId);
}
continue;
}
ASSERT(argumentType.isMatrix());
TType componentType(argumentType);
componentType.toComponentType();
const spirv::IdRef componentTypeId = mBuilder.getTypeData(componentType, {}).id;
// For matrix parameters, take components out of the matrix one by one in column-major
// order. No cast is done here; it would only be required for vector constructors with
// matrix parameters, in which case the resulting vector is cast in the end.
for (int columnIndex = 0; columnIndex < argumentType.getCols() &&
extractedComponentsOut->size() < componentCount;
++columnIndex)
{
for (int componentIndex = 0; componentIndex < argumentType.getRows() &&
extractedComponentsOut->size() < componentCount;
++componentIndex)
{
const spirv::IdRef componentId = mBuilder.getNewId(decorations);
spirv::WriteCompositeExtract(
mBuilder.getSpirvCurrentFunctionBlock(), componentTypeId, componentId,
parameterId,
{spirv::LiteralInteger(columnIndex), spirv::LiteralInteger(componentIndex)});
extractedComponentsOut->push_back(componentId);
}
}
}
}
void OutputSPIRVTraverser::startShortCircuit(TIntermBinary *node)
{
// Emulate && and || as such:
//
// || => if (!left) result = right
// && => if ( left) result = right
//
// When this function is called, |left| has already been visited, so it creates the appropriate
// |if| construct in preparation for visiting |right|.
// Load |left| and replace the access chain with an rvalue that's the result.
spirv::IdRef typeId;
const spirv::IdRef left =
accessChainLoad(&mNodeData.back(), node->getLeft()->getType(), &typeId);
nodeDataInitRValue(&mNodeData.back(), left, typeId);
// Keep the id of the block |left| was evaluated in.
mNodeData.back().idList.push_back(mBuilder.getSpirvCurrentFunctionBlockId());
// Two blocks necessary, one for the |if| block, and one for the merge block.
mBuilder.startConditional(2, false, false);
// Generate the branch instructions.
const SpirvConditional *conditional = mBuilder.getCurrentConditional();
const spirv::IdRef mergeBlock = conditional->blockIds.back();
const spirv::IdRef ifBlock = conditional->blockIds.front();
const spirv::IdRef trueBlock = node->getOp() == EOpLogicalAnd ? ifBlock : mergeBlock;
const spirv::IdRef falseBlock = node->getOp() == EOpLogicalOr ? ifBlock : mergeBlock;
// Note that no logical not is necessary. For ||, the branch will target the merge block in the
// true case.
mBuilder.writeBranchConditional(left, trueBlock, falseBlock, mergeBlock);
}
spirv::IdRef OutputSPIRVTraverser::endShortCircuit(TIntermBinary *node, spirv::IdRef *typeId)
{
// Load the right hand side.
const spirv::IdRef right =
accessChainLoad(&mNodeData.back(), node->getRight()->getType(), nullptr);
mNodeData.pop_back();
// Get the id of the block |right| is evaluated in.
const spirv::IdRef rightBlockId = mBuilder.getSpirvCurrentFunctionBlockId();
// And the cached id of the block |left| is evaluated in.
ASSERT(mNodeData.back().idList.size() == 1);
const spirv::IdRef leftBlockId = mNodeData.back().idList[0].id;
mNodeData.back().idList.clear();
// Move on to the merge block.
mBuilder.writeBranchConditionalBlockEnd();
// Pop from the conditional stack.
mBuilder.endConditional();
// Get the previously loaded result of the left hand side.
*typeId = mNodeData.back().accessChain.baseTypeId;
const spirv::IdRef left = mNodeData.back().baseId;
// Create an OpPhi instruction that selects either the |left| or |right| based on which block
// was traversed.
const spirv::IdRef result = mBuilder.getNewId(mBuilder.getDecorations(node->getType()));
spirv::WritePhi(
mBuilder.getSpirvCurrentFunctionBlock(), *typeId, result,
{spirv::PairIdRefIdRef{left, leftBlockId}, spirv::PairIdRefIdRef{right, rightBlockId}});
return result;
}
spirv::IdRef OutputSPIRVTraverser::createFunctionCall(TIntermAggregate *node,
spirv::IdRef resultTypeId)
{
const TFunction *function = node->getFunction();
ASSERT(function);
ASSERT(mFunctionIdMap.count(function) > 0);
const spirv::IdRef functionId = mFunctionIdMap[function].functionId;
// Get the list of parameters passed to the function. The function parameters can only be
// memory variables, or if the function argument is |const|, an rvalue.
//
// For in variables:
//
// - If the parameter is const, pass it directly as rvalue, otherwise
// - If the parameter is an unindexed lvalue, pass it directly, otherwise
// - Write it to a temp variable first and pass that.
//
// For out variables:
//
// - If the parameter is an unindexed lvalue, pass it directly, otherwise
// - Pass a temporary variable. After the function call, copy that variable to the parameter.
//
// For inout variables:
//
// - If the parameter is an unindexed lvalue, pass it directly, otherwise
// - Write the parameter to a temp variable and pass that. After the function call, copy that
// variable back to the parameter.
//
// - For opaque uniforms, pass it directly as lvalue,
//
const size_t parameterCount = node->getChildCount();
spirv::IdRefList parameters;
spirv::IdRefList tempVarIds(parameterCount);
spirv::IdRefList tempVarTypeIds(parameterCount);
for (size_t paramIndex = 0; paramIndex < parameterCount; ++paramIndex)
{
const TType ¶mType = function->getParam(paramIndex)->getType();
const TType &argType = node->getChildNode(paramIndex)->getAsTyped()->getType();
const TQualifier ¶mQualifier = paramType.getQualifier();
NodeData ¶m = mNodeData[mNodeData.size() - parameterCount + paramIndex];
spirv::IdRef paramValue;
if (paramQualifier == EvqParamConst)
{
// |const| parameters are passed as rvalue.
paramValue = accessChainLoad(¶m, argType, nullptr);
}
else if (IsOpaqueType(paramType.getBasicType()))
{
// Opaque uniforms are passed by pointer.
paramValue = accessChainCollapse(¶m);
}
else if (IsAccessChainUnindexedLValue(param) && paramQualifier == EvqParamOut &&
param.accessChain.storageClass == spv::StorageClassFunction)
{
// Unindexed lvalues are passed directly, but only when they are an out/inout. In GLSL,
// in parameters are considered "copied" to the function. In SPIR-V, every parameter is
// implicitly inout. If a function takes an in parameter and modifies it, the caller
// has to ensure that it calls the function with a copy. Currently, the functions don't
// track whether an in parameter is modified, so we conservatively assume it is.
//
// This optimization is not applied on buggy drivers. http://anglebug.com/6110.
paramValue = param.baseId;
}
else
{
ASSERT(paramQualifier == EvqParamIn || paramQualifier == EvqParamOut ||
paramQualifier == EvqParamInOut);
// Need to create a temp variable and pass that.
tempVarTypeIds[paramIndex] = mBuilder.getTypeData(paramType, {}).id;
tempVarIds[paramIndex] =
mBuilder.declareVariable(tempVarTypeIds[paramIndex], spv::StorageClassFunction,
mBuilder.getDecorations(argType), nullptr, "param");
// If it's an in or inout parameter, the temp variable needs to be initialized with the
// value of the parameter first.
if (paramQualifier == EvqParamIn || paramQualifier == EvqParamInOut)
{
paramValue = accessChainLoad(¶m, argType, nullptr);
spirv::WriteStore(mBuilder.getSpirvCurrentFunctionBlock(), tempVarIds[paramIndex],
paramValue, nullptr);
}
paramValue = tempVarIds[paramIndex];
}
parameters.push_back(paramValue);
}
// Make the actual function call.
const spirv::IdRef result = mBuilder.getNewId(mBuilder.getDecorations(node->getType()));
spirv::WriteFunctionCall(mBuilder.getSpirvCurrentFunctionBlock(), resultTypeId, result,
functionId, parameters);
// Copy from the out and inout temp variables back to the original parameters.
for (size_t paramIndex = 0; paramIndex < parameterCount; ++paramIndex)
{
if (!tempVarIds[paramIndex].valid())
{
continue;
}
const TType ¶mType = function->getParam(paramIndex)->getType();
const TType &argType = node->getChildNode(paramIndex)->getAsTyped()->getType();
const TQualifier ¶mQualifier = paramType.getQualifier();
NodeData ¶m = mNodeData[mNodeData.size() - parameterCount + paramIndex];
if (paramQualifier == EvqParamIn)
{
continue;
}
// Copy from the temp variable to the parameter.
NodeData tempVarData;
nodeDataInitLValue(&tempVarData, tempVarIds[paramIndex], tempVarTypeIds[paramIndex],
spv::StorageClassFunction, {});
const spirv::IdRef tempVarValue = accessChainLoad(&tempVarData, argType, nullptr);
accessChainStore(¶m, tempVarValue, function->getParam(paramIndex)->getType());
}
return result;
}
void OutputSPIRVTraverser::visitArrayLength(TIntermUnary *node)
{
// .length() on sized arrays is already constant folded, so this operation only applies to
// ssbo[N].last_member.length(). OpArrayLength takes the ssbo block *pointer* and the field
// index of last_member, so those need to be extracted from the access chain. Additionally,
// OpArrayLength produces an unsigned int while GLSL produces an int, so a final cast is
// necessary.
// Inspect the children. There are two possibilities:
//
// - last_member.length(): In this case, the id of the nameless ssbo is used.
// - ssbo.last_member.length(): In this case, the id of the variable |ssbo| itself is used.
// - ssbo[N][M].last_member.length(): In this case, the access chain |ssbo N M| is used.
//
// We can't visit the child in its entirety as it will create the access chain |ssbo N M field|
// which is not useful.
spirv::IdRef accessChainId;
spirv::LiteralInteger fieldIndex;
if (node->getOperand()->getAsSymbolNode())
{
// If the operand is a symbol referencing the last member of a nameless interface block,
// visit the symbol to get the id of the interface block.
node->getOperand()->getAsSymbolNode()->traverse(this);
// The access chain must only include the base id + one literal field index.
ASSERT(mNodeData.back().idList.size() == 1 && !mNodeData.back().idList.back().id.valid());
accessChainId = mNodeData.back().baseId;
fieldIndex = mNodeData.back().idList.back().literal;
}
else
{
// Otherwise make sure not to traverse the field index selection node so that the access
// chain would not include it.
TIntermBinary *fieldSelectionNode = node->getOperand()->getAsBinaryNode();
ASSERT(fieldSelectionNode && fieldSelectionNode->getOp() == EOpIndexDirectInterfaceBlock);
TIntermTyped *interfaceBlockExpression = fieldSelectionNode->getLeft();
TIntermConstantUnion *indexNode = fieldSelectionNode->getRight()->getAsConstantUnion();
ASSERT(indexNode);
// Visit the expression.
interfaceBlockExpression->traverse(this);
accessChainId = accessChainCollapse(&mNodeData.back());
fieldIndex = spirv::LiteralInteger(indexNode->getIConst(0));
}
// Get the int and uint type ids.
const spirv::IdRef intTypeId = mBuilder.getBasicTypeId(EbtInt, 1);
const spirv::IdRef uintTypeId = mBuilder.getBasicTypeId(EbtUInt, 1);
// Generate the instruction.
const spirv::IdRef resultId = mBuilder.getNewId({});
spirv::WriteArrayLength(mBuilder.getSpirvCurrentFunctionBlock(), uintTypeId, resultId,
accessChainId, fieldIndex);
// Cast to int.
const spirv::IdRef castResultId = mBuilder.getNewId({});
spirv::WriteBitcast(mBuilder.getSpirvCurrentFunctionBlock(), intTypeId, castResultId, resultId);
// Replace the access chain with an rvalue that's the result.
nodeDataInitRValue(&mNodeData.back(), castResultId, intTypeId);
}
bool IsShortCircuitNeeded(TIntermOperator *node)
{
TOperator op = node->getOp();
// Short circuit is only necessary for && and ||.
if (op != EOpLogicalAnd && op != EOpLogicalOr)
{
return false;
}
ASSERT(node->getChildCount() == 2);
// If the right hand side does not have side effects, short-circuiting is unnecessary.
// TODO: experiment with the performance of OpLogicalAnd/Or vs short-circuit based on the
// complexity of the right hand side expression. We could potentially only allow
// OpLogicalAnd/Or if the right hand side is a constant or an access chain and have more complex
// expressions be placed inside an if block. http://anglebug.com/4889
return node->getChildNode(1)->getAsTyped()->hasSideEffects();
}
using WriteUnaryOp = void (*)(spirv::Blob *blob,
spirv::IdResultType idResultType,
spirv::IdResult idResult,
spirv::IdRef operand);
using WriteBinaryOp = void (*)(spirv::Blob *blob,
spirv::IdResultType idResultType,
spirv::IdResult idResult,
spirv::IdRef operand1,
spirv::IdRef operand2);
using WriteTernaryOp = void (*)(spirv::Blob *blob,
spirv::IdResultType idResultType,
spirv::IdResult idResult,
spirv::IdRef operand1,
spirv::IdRef operand2,
spirv::IdRef operand3);
using WriteQuaternaryOp = void (*)(spirv::Blob *blob,
spirv::IdResultType idResultType,
spirv::IdResult idResult,
spirv::IdRef operand1,
spirv::IdRef operand2,
spirv::IdRef operand3,
spirv::IdRef operand4);
using WriteAtomicOp = void (*)(spirv::Blob *blob,
spirv::IdResultType idResultType,
spirv::IdResult idResult,
spirv::IdRef pointer,
spirv::IdScope scope,
spirv::IdMemorySemantics semantics,
spirv::IdRef value);
spirv::IdRef OutputSPIRVTraverser::visitOperator(TIntermOperator *node, spirv::IdRef resultTypeId)
{
// Handle special groups.
const TOperator op = node->getOp();
if (op == EOpEqual || op == EOpNotEqual)
{
return createCompare(node, resultTypeId);
}
if (BuiltInGroup::IsAtomicMemory(op) || BuiltInGroup::IsImageAtomic(op))
{
return createAtomicBuiltIn(node, resultTypeId);
}
if (BuiltInGroup::IsImage(op) || BuiltInGroup::IsTexture(op))
{
return createImageTextureBuiltIn(node, resultTypeId);
}
if (op == EOpSubpassLoad)
{
return createSubpassLoadBuiltIn(node, resultTypeId);
}
if (BuiltInGroup::IsInterpolationFS(op))
{
return createInterpolate(node, resultTypeId);
}
const size_t childCount = node->getChildCount();
TIntermTyped *firstChild = node->getChildNode(0)->getAsTyped();
TIntermTyped *secondChild = childCount > 1 ? node->getChildNode(1)->getAsTyped() : nullptr;
const TType &firstOperandType = firstChild->getType();
const TBasicType basicType = firstOperandType.getBasicType();
const bool isFloat = basicType == EbtFloat || basicType == EbtDouble;
const bool isUnsigned = basicType == EbtUInt;
const bool isBool = basicType == EbtBool;
// Whether this is a pre/post increment/decrement operator.
bool isIncrementOrDecrement = false;
// Whether the operation needs to be applied column by column.
bool operateOnColumns =
childCount == 2 && (firstChild->getType().isMatrix() || secondChild->getType().isMatrix());
// Whether the operands need to be swapped in the (binary) instruction
bool binarySwapOperands = false;
// Whether the instruction is matrix/scalar. This is implemented with matrix*(1/scalar).
bool binaryInvertSecondParameter = false;
// Whether the scalar operand needs to be extended to match the other operand which is a vector
// (in a binary or extended operation).
bool extendScalarToVector = true;
// Some built-ins have out parameters at the end of the list of parameters.
size_t lvalueCount = 0;
WriteUnaryOp writeUnaryOp = nullptr;
WriteBinaryOp writeBinaryOp = nullptr;
WriteTernaryOp writeTernaryOp = nullptr;
WriteQuaternaryOp writeQuaternaryOp = nullptr;
// Some operators are implemented with an extended instruction.
spv::GLSLstd450 extendedInst = spv::GLSLstd450Bad;
switch (op)
{
case EOpNegative:
operateOnColumns = firstOperandType.isMatrix();
if (isFloat)
writeUnaryOp = spirv::WriteFNegate;
else
writeUnaryOp = spirv::WriteSNegate;
break;
case EOpPositive:
// This is a noop.
return accessChainLoad(&mNodeData.back(), firstOperandType, nullptr);
case EOpLogicalNot:
case EOpNotComponentWise:
writeUnaryOp = spirv::WriteLogicalNot;
break;
case EOpBitwiseNot:
writeUnaryOp = spirv::WriteNot;
break;
case EOpPostIncrement:
case EOpPreIncrement:
isIncrementOrDecrement = true;
operateOnColumns = firstOperandType.isMatrix();
if (isFloat)
writeBinaryOp = spirv::WriteFAdd;
else
writeBinaryOp = spirv::WriteIAdd;
break;
case EOpPostDecrement:
case EOpPreDecrement:
isIncrementOrDecrement = true;
operateOnColumns = firstOperandType.isMatrix();
if (isFloat)
writeBinaryOp = spirv::WriteFSub;
else
writeBinaryOp = spirv::WriteISub;
break;
case EOpAdd:
case EOpAddAssign:
if (isFloat)
writeBinaryOp = spirv::WriteFAdd;
else
writeBinaryOp = spirv::WriteIAdd;
break;
case EOpSub:
case EOpSubAssign:
if (isFloat)
writeBinaryOp = spirv::WriteFSub;
else
writeBinaryOp = spirv::WriteISub;
break;
case EOpMul:
case EOpMulAssign:
case EOpMatrixCompMult:
if (isFloat)
writeBinaryOp = spirv::WriteFMul;
else
writeBinaryOp = spirv::WriteIMul;
break;
case EOpDiv:
case EOpDivAssign:
if (isFloat)
{
if (firstOperandType.isMatrix() && secondChild->getType().isScalar())
{
writeBinaryOp = spirv::WriteMatrixTimesScalar;
binaryInvertSecondParameter = true;
operateOnColumns = false;
extendScalarToVector = false;
}
else
{
writeBinaryOp = spirv::WriteFDiv;
}
}
else if (isUnsigned)
writeBinaryOp = spirv::WriteUDiv;
else
writeBinaryOp = spirv::WriteSDiv;
break;
case EOpIMod:
case EOpIModAssign:
if (isFloat)
writeBinaryOp = spirv::WriteFMod;
else if (isUnsigned)
writeBinaryOp = spirv::WriteUMod;
else
writeBinaryOp = spirv::WriteSMod;
break;
case EOpEqualComponentWise:
if (isFloat)
writeBinaryOp = spirv::WriteFOrdEqual;
else if (isBool)
writeBinaryOp = spirv::WriteLogicalEqual;
else
writeBinaryOp = spirv::WriteIEqual;
break;
case EOpNotEqualComponentWise:
if (isFloat)
writeBinaryOp = spirv::WriteFUnordNotEqual;
else if (isBool)
writeBinaryOp = spirv::WriteLogicalNotEqual;
else
writeBinaryOp = spirv::WriteINotEqual;
break;
case EOpLessThan:
case EOpLessThanComponentWise:
if (isFloat)
writeBinaryOp = spirv::WriteFOrdLessThan;
else if (isUnsigned)
writeBinaryOp = spirv::WriteULessThan;
else
writeBinaryOp = spirv::WriteSLessThan;
break;
case EOpGreaterThan:
case EOpGreaterThanComponentWise:
if (isFloat)
writeBinaryOp = spirv::WriteFOrdGreaterThan;
else if (isUnsigned)
writeBinaryOp = spirv::WriteUGreaterThan;
else
writeBinaryOp = spirv::WriteSGreaterThan;
break;
case EOpLessThanEqual:
case EOpLessThanEqualComponentWise:
if (isFloat)
writeBinaryOp = spirv::WriteFOrdLessThanEqual;
else if (isUnsigned)
writeBinaryOp = spirv::WriteULessThanEqual;
else
writeBinaryOp = spirv::WriteSLessThanEqual;
break;
case EOpGreaterThanEqual:
case EOpGreaterThanEqualComponentWise:
if (isFloat)
writeBinaryOp = spirv::WriteFOrdGreaterThanEqual;
else if (isUnsigned)
writeBinaryOp = spirv::WriteUGreaterThanEqual;
else
writeBinaryOp = spirv::WriteSGreaterThanEqual;
break;
case EOpVectorTimesScalar:
case EOpVectorTimesScalarAssign:
if (isFloat)
{
writeBinaryOp = spirv::WriteVectorTimesScalar;
binarySwapOperands = node->getChildNode(1)->getAsTyped()->getType().isVector();
extendScalarToVector = false;
}
else
writeBinaryOp = spirv::WriteIMul;
break;
case EOpVectorTimesMatrix:
case EOpVectorTimesMatrixAssign:
writeBinaryOp = spirv::WriteVectorTimesMatrix;
operateOnColumns = false;
break;
case EOpMatrixTimesVector:
writeBinaryOp = spirv::WriteMatrixTimesVector;
operateOnColumns = false;
break;
case EOpMatrixTimesScalar:
case EOpMatrixTimesScalarAssign:
writeBinaryOp = spirv::WriteMatrixTimesScalar;
binarySwapOperands = secondChild->getType().isMatrix();
operateOnColumns = false;
extendScalarToVector = false;
break;
case EOpMatrixTimesMatrix:
case EOpMatrixTimesMatrixAssign:
writeBinaryOp = spirv::WriteMatrixTimesMatrix;
operateOnColumns = false;
break;
case EOpLogicalOr:
ASSERT(!IsShortCircuitNeeded(node));
extendScalarToVector = false;
writeBinaryOp = spirv::WriteLogicalOr;
break;
case EOpLogicalXor:
extendScalarToVector = false;
writeBinaryOp = spirv::WriteLogicalNotEqual;
break;
case EOpLogicalAnd:
ASSERT(!IsShortCircuitNeeded(node));
extendScalarToVector = false;
writeBinaryOp = spirv::WriteLogicalAnd;
break;
case EOpBitShiftLeft:
case EOpBitShiftLeftAssign:
writeBinaryOp = spirv::WriteShiftLeftLogical;
break;
case EOpBitShiftRight:
case EOpBitShiftRightAssign:
if (isUnsigned)
writeBinaryOp = spirv::WriteShiftRightLogical;
else
writeBinaryOp = spirv::WriteShiftRightArithmetic;
break;
case EOpBitwiseAnd:
case EOpBitwiseAndAssign:
writeBinaryOp = spirv::WriteBitwiseAnd;
break;
case EOpBitwiseXor:
case EOpBitwiseXorAssign:
writeBinaryOp = spirv::WriteBitwiseXor;
break;
case EOpBitwiseOr:
case EOpBitwiseOrAssign:
writeBinaryOp = spirv::WriteBitwiseOr;
break;
case EOpRadians:
extendedInst = spv::GLSLstd450Radians;
break;
case EOpDegrees:
extendedInst = spv::GLSLstd450Degrees;
break;
case EOpSin:
extendedInst = spv::GLSLstd450Sin;
break;
case EOpCos:
extendedInst = spv::GLSLstd450Cos;
break;
case EOpTan:
extendedInst = spv::GLSLstd450Tan;
break;
case EOpAsin:
extendedInst = spv::GLSLstd450Asin;
break;
case EOpAcos:
extendedInst = spv::GLSLstd450Acos;
break;
case EOpAtan:
extendedInst = childCount == 1 ? spv::GLSLstd450Atan : spv::GLSLstd450Atan2;
break;
case EOpSinh:
extendedInst = spv::GLSLstd450Sinh;
break;
case EOpCosh:
extendedInst = spv::GLSLstd450Cosh;
break;
case EOpTanh:
extendedInst = spv::GLSLstd450Tanh;
break;
case EOpAsinh:
extendedInst = spv::GLSLstd450Asinh;
break;
case EOpAcosh:
extendedInst = spv::GLSLstd450Acosh;
break;
case EOpAtanh:
extendedInst = spv::GLSLstd450Atanh;
break;
case EOpPow:
extendedInst = spv::GLSLstd450Pow;
break;
case EOpExp:
extendedInst = spv::GLSLstd450Exp;
break;
case EOpLog:
extendedInst = spv::GLSLstd450Log;
break;
case EOpExp2:
extendedInst = spv::GLSLstd450Exp2;
break;
case EOpLog2:
extendedInst = spv::GLSLstd450Log2;
break;
case EOpSqrt:
extendedInst = spv::GLSLstd450Sqrt;
break;
case EOpInversesqrt:
extendedInst = spv::GLSLstd450InverseSqrt;
break;
case EOpAbs:
if (isFloat)
extendedInst = spv::GLSLstd450FAbs;
else
extendedInst = spv::GLSLstd450SAbs;
break;
case EOpSign:
if (isFloat)
extendedInst = spv::GLSLstd450FSign;
else
extendedInst = spv::GLSLstd450SSign;
break;
case EOpFloor:
extendedInst = spv::GLSLstd450Floor;
break;
case EOpTrunc:
extendedInst = spv::GLSLstd450Trunc;
break;
case EOpRound:
extendedInst = spv::GLSLstd450Round;
break;
case EOpRoundEven:
extendedInst = spv::GLSLstd450RoundEven;
break;
case EOpCeil:
extendedInst = spv::GLSLstd450Ceil;
break;
case EOpFract:
extendedInst = spv::GLSLstd450Fract;
break;
case EOpMod:
if (isFloat)
writeBinaryOp = spirv::WriteFMod;
else if (isUnsigned)
writeBinaryOp = spirv::WriteUMod;
else
writeBinaryOp = spirv::WriteSMod;
break;
case EOpMin:
if (isFloat)
extendedInst = spv::GLSLstd450FMin;
else if (isUnsigned)
extendedInst = spv::GLSLstd450UMin;
else
extendedInst = spv::GLSLstd450SMin;
break;
case EOpMax:
if (isFloat)
extendedInst = spv::GLSLstd450FMax;
else if (isUnsigned)
extendedInst = spv::GLSLstd450UMax;
else
extendedInst = spv::GLSLstd450SMax;
break;
case EOpClamp:
if (isFloat)
extendedInst = spv::GLSLstd450FClamp;
else if (isUnsigned)
extendedInst = spv::GLSLstd450UClamp;
else
extendedInst = spv::GLSLstd450SClamp;
break;
case EOpMix:
if (node->getChildNode(childCount - 1)->getAsTyped()->getType().getBasicType() ==
EbtBool)
{
writeTernaryOp = spirv::WriteSelect;
}
else
{
ASSERT(isFloat);
extendedInst = spv::GLSLstd450FMix;
}
break;
case EOpStep:
extendedInst = spv::GLSLstd450Step;
break;
case EOpSmoothstep:
extendedInst = spv::GLSLstd450SmoothStep;
break;
case EOpModf:
extendedInst = spv::GLSLstd450ModfStruct;
lvalueCount = 1;
break;
case EOpIsnan:
writeUnaryOp = spirv::WriteIsNan;
break;
case EOpIsinf:
writeUnaryOp = spirv::WriteIsInf;
break;
case EOpFloatBitsToInt:
case EOpFloatBitsToUint:
case EOpIntBitsToFloat:
case EOpUintBitsToFloat:
writeUnaryOp = spirv::WriteBitcast;
break;
case EOpFma:
extendedInst = spv::GLSLstd450Fma;
break;
case EOpFrexp:
extendedInst = spv::GLSLstd450FrexpStruct;
lvalueCount = 1;
break;
case EOpLdexp:
extendedInst = spv::GLSLstd450Ldexp;
break;
case EOpPackSnorm2x16:
extendedInst = spv::GLSLstd450PackSnorm2x16;
break;
case EOpPackUnorm2x16:
extendedInst = spv::GLSLstd450PackUnorm2x16;
break;
case EOpPackHalf2x16:
extendedInst = spv::GLSLstd450PackHalf2x16;
break;
case EOpUnpackSnorm2x16:
extendedInst = spv::GLSLstd450UnpackSnorm2x16;
extendScalarToVector = false;
break;
case EOpUnpackUnorm2x16:
extendedInst = spv::GLSLstd450UnpackUnorm2x16;
extendScalarToVector = false;
break;
case EOpUnpackHalf2x16:
extendedInst = spv::GLSLstd450UnpackHalf2x16;
extendScalarToVector = false;
break;
case EOpPackUnorm4x8:
extendedInst = spv::GLSLstd450PackUnorm4x8;
break;
case EOpPackSnorm4x8:
extendedInst = spv::GLSLstd450PackSnorm4x8;
break;
case EOpUnpackUnorm4x8:
extendedInst = spv::GLSLstd450UnpackUnorm4x8;
extendScalarToVector = false;
break;
case EOpUnpackSnorm4x8:
extendedInst = spv::GLSLstd450UnpackSnorm4x8;
extendScalarToVector = false;
break;
case EOpPackDouble2x32:
// TODO: support desktop GLSL. http://anglebug.com/6197
UNIMPLEMENTED();
break;
case EOpUnpackDouble2x32:
// TODO: support desktop GLSL. http://anglebug.com/6197
UNIMPLEMENTED();
extendScalarToVector = false;
break;
case EOpLength:
extendedInst = spv::GLSLstd450Length;
break;
case EOpDistance:
extendedInst = spv::GLSLstd450Distance;
break;
case EOpDot:
// Use normal multiplication for scalars.
if (firstOperandType.isScalar())
{
if (isFloat)
writeBinaryOp = spirv::WriteFMul;
else
writeBinaryOp = spirv::WriteIMul;
}
else
{
writeBinaryOp = spirv::WriteDot;
}
break;
case EOpCross:
extendedInst = spv::GLSLstd450Cross;
break;
case EOpNormalize:
extendedInst = spv::GLSLstd450Normalize;
break;
case EOpFaceforward:
extendedInst = spv::GLSLstd450FaceForward;
break;
case EOpReflect:
extendedInst = spv::GLSLstd450Reflect;
break;
case EOpRefract:
extendedInst = spv::GLSLstd450Refract;
extendScalarToVector = false;
break;
case EOpFtransform:
// TODO: support desktop GLSL. http://anglebug.com/6197
UNIMPLEMENTED();
break;
case EOpOuterProduct:
writeBinaryOp = spirv::WriteOuterProduct;
break;
case EOpTranspose:
writeUnaryOp = spirv::WriteTranspose;
break;
case EOpDeterminant:
extendedInst = spv::GLSLstd450Determinant;
break;
case EOpInverse:
extendedInst = spv::GLSLstd450MatrixInverse;
break;
case EOpAny:
writeUnaryOp = spirv::WriteAny;
break;
case EOpAll:
writeUnaryOp = spirv::WriteAll;
break;
case EOpBitfieldExtract:
if (isUnsigned)
writeTernaryOp = spirv::WriteBitFieldUExtract;
else
writeTernaryOp = spirv::WriteBitFieldSExtract;
break;
case EOpBitfieldInsert:
writeQuaternaryOp = spirv::WriteBitFieldInsert;
break;
case EOpBitfieldReverse:
writeUnaryOp = spirv::WriteBitReverse;
break;
case EOpBitCount:
writeUnaryOp = spirv::WriteBitCount;
break;
case EOpFindLSB:
extendedInst = spv::GLSLstd450FindILsb;
break;
case EOpFindMSB:
if (isUnsigned)
extendedInst = spv::GLSLstd450FindUMsb;
else
extendedInst = spv::GLSLstd450FindSMsb;
break;
case EOpUaddCarry:
writeBinaryOp = spirv::WriteIAddCarry;
lvalueCount = 1;
break;
case EOpUsubBorrow:
writeBinaryOp = spirv::WriteISubBorrow;
lvalueCount = 1;
break;
case EOpUmulExtended:
writeBinaryOp = spirv::WriteUMulExtended;
lvalueCount = 2;
break;
case EOpImulExtended:
writeBinaryOp = spirv::WriteSMulExtended;
lvalueCount = 2;
break;
case EOpRgb_2_yuv:
case EOpYuv_2_rgb:
// TODO: There doesn't seem to be an equivalent in SPIR-V, and should likley be emulated
// as an AST transformation. Not supported by the Vulkan at the moment.
// http://anglebug.com/4889.
UNIMPLEMENTED();
break;
case EOpDFdx:
writeUnaryOp = spirv::WriteDPdx;
break;
case EOpDFdy:
writeUnaryOp = spirv::WriteDPdy;
break;
case EOpFwidth:
writeUnaryOp = spirv::WriteFwidth;
break;
case EOpDFdxFine:
writeUnaryOp = spirv::WriteDPdxFine;
break;
case EOpDFdyFine:
writeUnaryOp = spirv::WriteDPdyFine;
break;
case EOpDFdxCoarse:
writeUnaryOp = spirv::WriteDPdxCoarse;
break;
case EOpDFdyCoarse:
writeUnaryOp = spirv::WriteDPdyCoarse;
break;
case EOpFwidthFine:
writeUnaryOp = spirv::WriteFwidthFine;
break;
case EOpFwidthCoarse:
writeUnaryOp = spirv::WriteFwidthCoarse;
break;
case EOpNoise1:
case EOpNoise2:
case EOpNoise3:
case EOpNoise4:
// TODO: support desktop GLSL. http://anglebug.com/6197
UNIMPLEMENTED();
break;
case EOpAnyInvocation:
case EOpAllInvocations:
case EOpAllInvocationsEqual:
// TODO: support desktop GLSL. http://anglebug.com/6197
break;
default:
UNREACHABLE();
}
// Load the parameters.
spirv::IdRefList parameterTypeIds;
spirv::IdRefList parameters = loadAllParams(node, lvalueCount, ¶meterTypeIds);
if (isIncrementOrDecrement)
{
// ++ and -- are implemented with binary add and subtract, so add an implicit parameter with
// size vecN(1).
const int vecSize = firstOperandType.isMatrix() ? firstOperandType.getRows()
: firstOperandType.getNominalSize();
const spirv::IdRef one =
isFloat ? mBuilder.getVecConstant(1, vecSize) : mBuilder.getIvecConstant(1, vecSize);
parameters.push_back(one);
}
const SpirvDecorations decorations =
mBuilder.getArithmeticDecorations(node->getType(), node->isPrecise(), op);
spirv::IdRef result;
if (node->getType().getBasicType() != EbtVoid)
{
result = mBuilder.getNewId(decorations);
}
// In the case of modf, frexp, uaddCarry, usubBorrow, umulExtended and imulExtended, the SPIR-V
// result is expected to be a struct instead.
spirv::IdRef builtInResultTypeId = resultTypeId;
spirv::IdRef builtInResult;
if (lvalueCount > 0)
{
builtInResultTypeId = makeBuiltInOutputStructType(node, lvalueCount);
builtInResult = mBuilder.getNewId({});
}
else
{
builtInResult = result;
}
if (operateOnColumns)
{
// If negating a matrix, multiplying or comparing them, do that column by column.
// Matrix-scalar operations (add, sub, mod etc) turn the scalar into a vector before
// operating on the column.
spirv::IdRefList columnIds;
const SpirvDecorations operandDecorations = mBuilder.getDecorations(firstOperandType);
const TType &matrixType =
firstOperandType.isMatrix() ? firstOperandType : secondChild->getType();
const spirv::IdRef columnTypeId =
mBuilder.getBasicTypeId(matrixType.getBasicType(), matrixType.getRows());
if (binarySwapOperands)
{
std::swap(parameters[0], parameters[1]);
}
if (extendScalarToVector)
{
extendScalarParamsToVector(node, columnTypeId, ¶meters);
}
// Extract and apply the operator to each column.
for (int columnIndex = 0; columnIndex < matrixType.getCols(); ++columnIndex)
{
spirv::IdRef columnIdA = parameters[0];
if (firstOperandType.isMatrix())
{
columnIdA = mBuilder.getNewId(operandDecorations);
spirv::WriteCompositeExtract(mBuilder.getSpirvCurrentFunctionBlock(), columnTypeId,
columnIdA, parameters[0],
{spirv::LiteralInteger(columnIndex)});
}
columnIds.push_back(mBuilder.getNewId(decorations));
if (writeUnaryOp)
{
writeUnaryOp(mBuilder.getSpirvCurrentFunctionBlock(), columnTypeId,
columnIds.back(), columnIdA);
}
else
{
ASSERT(writeBinaryOp);
spirv::IdRef columnIdB = parameters[1];
if (secondChild != nullptr && secondChild->getType().isMatrix())
{
columnIdB = mBuilder.getNewId(operandDecorations);
spirv::WriteCompositeExtract(mBuilder.getSpirvCurrentFunctionBlock(),
columnTypeId, columnIdB, parameters[1],
{spirv::LiteralInteger(columnIndex)});
}
writeBinaryOp(mBuilder.getSpirvCurrentFunctionBlock(), columnTypeId,
columnIds.back(), columnIdA, columnIdB);
}
}
// Construct the result.
spirv::WriteCompositeConstruct(mBuilder.getSpirvCurrentFunctionBlock(), builtInResultTypeId,
builtInResult, columnIds);
}
else if (writeUnaryOp)
{
ASSERT(parameters.size() == 1);
writeUnaryOp(mBuilder.getSpirvCurrentFunctionBlock(), builtInResultTypeId, builtInResult,
parameters[0]);
}
else if (writeBinaryOp)
{
ASSERT(parameters.size() == 2);
if (extendScalarToVector)
{
extendScalarParamsToVector(node, builtInResultTypeId, ¶meters);
}
if (binarySwapOperands)
{
std::swap(parameters[0], parameters[1]);
}
if (binaryInvertSecondParameter)
{
const spirv::IdRef one = mBuilder.getFloatConstant(1);
const spirv::IdRef invertedParam = mBuilder.getNewId(
mBuilder.getArithmeticDecorations(secondChild->getType(), node->isPrecise(), op));
spirv::WriteFDiv(mBuilder.getSpirvCurrentFunctionBlock(), parameterTypeIds.back(),
invertedParam, one, parameters[1]);
parameters[1] = invertedParam;
}
// Write the operation that combines the left and right values.
writeBinaryOp(mBuilder.getSpirvCurrentFunctionBlock(), builtInResultTypeId, builtInResult,
parameters[0], parameters[1]);
}
else if (writeTernaryOp)
{
ASSERT(parameters.size() == 3);
// mix(a, b, bool) is the same as bool ? b : a;
if (op == EOpMix)
{
std::swap(parameters[0], parameters[2]);
}
writeTernaryOp(mBuilder.getSpirvCurrentFunctionBlock(), builtInResultTypeId, builtInResult,
parameters[0], parameters[1], parameters[2]);
}
else if (writeQuaternaryOp)
{
ASSERT(parameters.size() == 4);
writeQuaternaryOp(mBuilder.getSpirvCurrentFunctionBlock(), builtInResultTypeId,
builtInResult, parameters[0], parameters[1], parameters[2],
parameters[3]);
}
else
{
// It's an extended instruction.
ASSERT(extendedInst != spv::GLSLstd450Bad);
if (extendScalarToVector)
{
extendScalarParamsToVector(node, builtInResultTypeId, ¶meters);
}
spirv::WriteExtInst(mBuilder.getSpirvCurrentFunctionBlock(), builtInResultTypeId,
builtInResult, mBuilder.getExtInstImportIdStd(),
spirv::LiteralExtInstInteger(extendedInst), parameters);
}
// If it's an assignment, store the calculated value.
if (IsAssignment(node->getOp()))
{
accessChainStore(&mNodeData[mNodeData.size() - childCount], builtInResult,
firstOperandType);
}
// If the operation returns a struct, load the lsb and msb and store them in result/out
// parameters.
if (lvalueCount > 0)
{
storeBuiltInStructOutputInParamsAndReturnValue(node, lvalueCount, builtInResult, result,
resultTypeId);
}
// For post increment/decrement, return the value of the parameter itself as the result.
if (op == EOpPostIncrement || op == EOpPostDecrement)
{
result = parameters[0];
}
return result;
}
spirv::IdRef OutputSPIRVTraverser::createCompare(TIntermOperator *node, spirv::IdRef resultTypeId)
{
const TOperator op = node->getOp();
TIntermTyped *operand = node->getChildNode(0)->getAsTyped();
const TType &operandType = operand->getType();
const SpirvDecorations resultDecorations = mBuilder.getDecorations(node->getType());
const SpirvDecorations operandDecorations = mBuilder.getDecorations(operandType);
// Load the left and right values.
spirv::IdRefList parameters = loadAllParams(node, 0, nullptr);
ASSERT(parameters.size() == 2);
// In GLSL, operators == and != can operate on the following:
//
// - scalars: There's a SPIR-V instruction for this,
// - vectors: The same SPIR-V instruction as scalars is used here, but the result is reduced
// with OpAll/OpAny for == and != respectively,
// - matrices: Comparison must be done column by column and the result reduced,
// - arrays: Comparison must be done on every array element and the result reduced,
// - structs: Comparison must be done on each field and the result reduced.
//
// For the latter 3 cases, OpCompositeExtract is used to extract scalars and vectors out of the
// more complex type, which is recursively traversed. The results are accumulated in a list
// that is then reduced 4 by 4 elements until a single boolean is produced.
spirv::LiteralIntegerList currentAccessChain;
spirv::IdRefList intermediateResults;
createCompareImpl(op, operandType, resultTypeId, parameters[0], parameters[1],
operandDecorations, resultDecorations, ¤tAccessChain,
&intermediateResults);
// Make sure the function correctly pushes and pops access chain indices.
ASSERT(currentAccessChain.empty());
// Reduce the intermediate results.
ASSERT(!intermediateResults.empty());
// The following code implements this algorithm, assuming N bools are to be reduced:
//
// Reduced To Reduce
// {b1} {b2, b3, ..., bN} Initial state
// Loop
// {b1, b2, b3, b4} {b5, b6, ..., bN} Take up to 3 new bools
// {r1} {b5, b6, ..., bN} Reduce it
// Repeat
//
// In the end, a single value is left.
size_t reducedCount = 0;
spirv::IdRefList toReduce = {intermediateResults[reducedCount++]};
while (reducedCount < intermediateResults.size())
{
// Take up to 3 new bools.
size_t toTakeCount = std::min<size_t>(3, intermediateResults.size() - reducedCount);
for (size_t i = 0; i < toTakeCount; ++i)
{
toReduce.push_back(intermediateResults[reducedCount++]);
}
// Reduce them to one bool.
const spirv::IdRef result = reduceBoolVector(op, toReduce, resultTypeId, resultDecorations);
// Replace the list of bools to reduce with the reduced one.
toReduce.clear();
toReduce.push_back(result);
}
ASSERT(toReduce.size() == 1 && reducedCount == intermediateResults.size());
return toReduce[0];
}
spirv::IdRef OutputSPIRVTraverser::createAtomicBuiltIn(TIntermOperator *node,
spirv::IdRef resultTypeId)
{
const TType &operandType = node->getChildNode(0)->getAsTyped()->getType();
const TBasicType operandBasicType = operandType.getBasicType();
const bool isImage = IsImage(operandBasicType);
// Most atomic instructions are in the form of:
//
// %result = OpAtomicX %pointer Scope MemorySemantics %value
//
// OpAtomicCompareSwap is exceptionally different (note that compare and value are in different
// order from GLSL):
//
// %result = OpAtomicCompareExchange %pointer
// Scope MemorySemantics MemorySemantics
// %value %comparator
//
// In all cases, the first parameter is the pointer, and the rest are rvalues.
//
// For images, OpImageTexelPointer is used to form a pointer to the texel on which the atomic
// operation is being performed.
const size_t parameterCount = node->getChildCount();
size_t imagePointerParameterCount = 0;
spirv::IdRef pointerId;
spirv::IdRefList imagePointerParameters;
spirv::IdRefList parameters;
if (isImage)
{
// One parameter for coordinates.
++imagePointerParameterCount;
if (IsImageMS(operandBasicType))
{
// One parameter for samples.
++imagePointerParameterCount;
}
}
ASSERT(parameterCount >= 2 + imagePointerParameterCount);
pointerId = accessChainCollapse(&mNodeData[mNodeData.size() - parameterCount]);
for (size_t paramIndex = 1; paramIndex < parameterCount; ++paramIndex)
{
NodeData ¶m = mNodeData[mNodeData.size() - parameterCount + paramIndex];
const spirv::IdRef parameter = accessChainLoad(
¶m, node->getChildNode(paramIndex)->getAsTyped()->getType(), nullptr);
// imageAtomic* built-ins have a few additional parameters right after the image. These are
// kept separately for use with OpImageTexelPointer.
if (paramIndex <= imagePointerParameterCount)
{
imagePointerParameters.push_back(parameter);
}
else
{
parameters.push_back(parameter);
}
}
// The scope of the operation is always Device as we don't enable the Vulkan memory model
// extension.
const spirv::IdScope scopeId = mBuilder.getUintConstant(spv::ScopeDevice);
// The memory semantics is always relaxed as we don't enable the Vulkan memory model extension.
const spirv::IdMemorySemantics semanticsId =
mBuilder.getUintConstant(spv::MemorySemanticsMaskNone);
WriteAtomicOp writeAtomicOp = nullptr;
const spirv::IdRef result = mBuilder.getNewId(mBuilder.getDecorations(node->getType()));
// Determine whether the operation is on ints or uints.
const bool isUnsigned = isImage ? IsUIntImage(operandBasicType) : operandBasicType == EbtUInt;
// For images, convert the pointer to the image to a pointer to a texel in the image.
if (isImage)
{
const spirv::IdRef texelTypePointerId =
mBuilder.getTypePointerId(resultTypeId, spv::StorageClassImage);
const spirv::IdRef texelPointerId = mBuilder.getNewId({});
const spirv::IdRef coordinate = imagePointerParameters[0];
spirv::IdRef sample = imagePointerParameters.size() > 1 ? imagePointerParameters[1]
: mBuilder.getUintConstant(0);
spirv::WriteImageTexelPointer(mBuilder.getSpirvCurrentFunctionBlock(), texelTypePointerId,
texelPointerId, pointerId, coordinate, sample);
pointerId = texelPointerId;
}
switch (node->getOp())
{
case EOpAtomicAdd:
case EOpImageAtomicAdd:
writeAtomicOp = spirv::WriteAtomicIAdd;
break;
case EOpAtomicMin:
case EOpImageAtomicMin:
writeAtomicOp = isUnsigned ? spirv::WriteAtomicUMin : spirv::WriteAtomicSMin;
break;
case EOpAtomicMax:
case EOpImageAtomicMax:
writeAtomicOp = isUnsigned ? spirv::WriteAtomicUMax : spirv::WriteAtomicSMax;
break;
case EOpAtomicAnd:
case EOpImageAtomicAnd:
writeAtomicOp = spirv::WriteAtomicAnd;
break;
case EOpAtomicOr:
case EOpImageAtomicOr:
writeAtomicOp = spirv::WriteAtomicOr;
break;
case EOpAtomicXor:
case EOpImageAtomicXor:
writeAtomicOp = spirv::WriteAtomicXor;
break;
case EOpAtomicExchange:
case EOpImageAtomicExchange:
writeAtomicOp = spirv::WriteAtomicExchange;
break;
case EOpAtomicCompSwap:
case EOpImageAtomicCompSwap:
// Generate this special instruction right here and early out. Note again that the
// value and compare parameters of OpAtomicCompareExchange are in the opposite order
// from GLSL.
ASSERT(parameters.size() == 2);
spirv::WriteAtomicCompareExchange(mBuilder.getSpirvCurrentFunctionBlock(), resultTypeId,
result, pointerId, scopeId, semanticsId, semanticsId,
parameters[1], parameters[0]);
return result;
default:
UNREACHABLE();
}
// Write the instruction.
ASSERT(parameters.size() == 1);
writeAtomicOp(mBuilder.getSpirvCurrentFunctionBlock(), resultTypeId, result, pointerId, scopeId,
semanticsId, parameters[0]);
return result;
}
spirv::IdRef OutputSPIRVTraverser::createImageTextureBuiltIn(TIntermOperator *node,
spirv::IdRef resultTypeId)
{
const TOperator op = node->getOp();
const TFunction *function = node->getAsAggregate()->getFunction();
const TType &samplerType = function->getParam(0)->getType();
const TBasicType samplerBasicType = samplerType.getBasicType();
// Load the parameters.
spirv::IdRefList parameters = loadAllParams(node, 0, nullptr);
// GLSL texture* and image* built-ins map to the following SPIR-V instructions. Some of these
// instructions take a "sampled image" while the others take the image itself. In these
// functions, the image, coordinates and Dref (for shadow sampling) are specified as positional
// parameters while the rest are bundled in a list of image operands.
//
// Image operations that query:
//
// - OpImageQuerySizeLod
// - OpImageQuerySize
// - OpImageQueryLod <-- sampled image
// - OpImageQueryLevels
// - OpImageQuerySamples
//
// Image operations that read/write:
//
// - OpImageSampleImplicitLod <-- sampled image
// - OpImageSampleExplicitLod <-- sampled image
// - OpImageSampleDrefImplicitLod <-- sampled image
// - OpImageSampleDrefExplicitLod <-- sampled image
// - OpImageSampleProjImplicitLod <-- sampled image
// - OpImageSampleProjExplicitLod <-- sampled image
// - OpImageSampleProjDrefImplicitLod <-- sampled image
// - OpImageSampleProjDrefExplicitLod <-- sampled image
// - OpImageFetch
// - OpImageGather <-- sampled image
// - OpImageDrefGather <-- sampled image
// - OpImageRead
// - OpImageWrite
//
// The additional image parameters are:
//
// - Bias: Only used with ImplicitLod.
// - Lod: Only used with ExplicitLod.
// - Grad: 2x operands; dx and dy. Only used with ExplicitLod.
// - ConstOffset: Constant offset added to coordinates of OpImage*Gather.
// - Offset: Non-constant offset added to coordinates of OpImage*Gather.
// - ConstOffsets: Constant offsets added to coordinates of OpImage*Gather.
// - Sample: Only used with OpImageFetch, OpImageRead and OpImageWrite.
//
// Where GLSL's built-in takes a sampler but SPIR-V expects an image, OpImage can be used to get
// the SPIR-V image out of a SPIR-V sampled image.
// The first parameter, which is either a sampled image or an image. Some GLSL built-ins
// receive a sampled image but their SPIR-V equivalent expects an image. OpImage is used in
// that case.
spirv::IdRef image = parameters[0];
bool extractImageFromSampledImage = false;
// The argument index for different possible parameters. 0 indicates that the argument is
// unused. Coordinates are usually at index 1, so it's pre-initialized.
size_t coordinatesIndex = 1;
size_t biasIndex = 0;
size_t lodIndex = 0;
size_t compareIndex = 0;
size_t dPdxIndex = 0;
size_t dPdyIndex = 0;
size_t offsetIndex = 0;
size_t offsetsIndex = 0;
size_t gatherComponentIndex = 0;
size_t sampleIndex = 0;
size_t dataIndex = 0;
// Whether this is a Dref variant of a sample call.
bool isDref = IsShadowSampler(samplerBasicType);
// Whether this is a Proj variant of a sample call.
bool isProj = false;
// The SPIR-V op used to implement the built-in. For OpImageSample* instructions,
// OpImageSampleImplicitLod is initially specified, which is later corrected based on |isDref|
// and |isProj|.
spv::Op spirvOp = BuiltInGroup::IsTexture(op) ? spv::OpImageSampleImplicitLod : spv::OpNop;
// Organize the parameters and decide the SPIR-V Op to use.
switch (op)
{
case EOpTexture2D:
case EOpTextureCube:
case EOpTexture1D:
case EOpTexture3D:
case EOpShadow1D:
case EOpShadow2D:
case EOpShadow2DEXT:
case EOpTexture2DRect:
case EOpTextureVideoWEBGL:
case EOpTexture:
case EOpTexture2DBias:
case EOpTextureCubeBias:
case EOpTexture3DBias:
case EOpTexture1DBias:
case EOpShadow1DBias:
case EOpShadow2DBias:
case EOpTextureBias:
// For shadow cube arrays, the compare value is specified through an additional
// parameter, while for the rest is taken out of the coordinates.
if (function->getParamCount() == 3)
{
if (samplerBasicType == EbtSamplerCubeArrayShadow)
{
compareIndex = 2;
}
else
{
biasIndex = 2;
}
}
break;
case EOpTexture2DProj:
case EOpTexture1DProj:
case EOpTexture3DProj:
case EOpShadow1DProj:
case EOpShadow2DProj:
case EOpShadow2DProjEXT:
case EOpTexture2DRectProj:
case EOpTextureProj:
case EOpTexture2DProjBias:
case EOpTexture3DProjBias:
case EOpTexture1DProjBias:
case EOpShadow1DProjBias:
case EOpShadow2DProjBias:
case EOpTextureProjBias:
isProj = true;
if (function->getParamCount() == 3)
{
biasIndex = 2;
}
break;
case EOpTexture2DLod:
case EOpTextureCubeLod:
case EOpTexture1DLod:
case EOpShadow1DLod:
case EOpShadow2DLod:
case EOpTexture3DLod:
case EOpTexture2DLodVS:
case EOpTextureCubeLodVS:
case EOpTexture2DLodEXTFS:
case EOpTextureCubeLodEXTFS:
case EOpTextureLod:
ASSERT(function->getParamCount() == 3);
lodIndex = 2;
break;
case EOpTexture2DProjLod:
case EOpTexture1DProjLod:
case EOpShadow1DProjLod:
case EOpShadow2DProjLod:
case EOpTexture3DProjLod:
case EOpTexture2DProjLodVS:
case EOpTexture2DProjLodEXTFS:
case EOpTextureProjLod:
ASSERT(function->getParamCount() == 3);
isProj = true;
lodIndex = 2;
break;
case EOpTexelFetch:
case EOpTexelFetchOffset:
// texelFetch has the following forms:
//
// - texelFetch(sampler, P);
// - texelFetch(sampler, P, lod);
// - texelFetch(samplerMS, P, sample);
//
// texelFetchOffset has an additional offset parameter at the end.
//
// In SPIR-V, OpImageFetch is used which operates on the image itself.
spirvOp = spv::OpImageFetch;
extractImageFromSampledImage = true;
if (IsSamplerMS(samplerBasicType))
{
ASSERT(function->getParamCount() == 3);
sampleIndex = 2;
}
else if (function->getParamCount() >= 3)
{
lodIndex = 2;
}
if (op == EOpTexelFetchOffset)
{
offsetIndex = function->getParamCount() - 1;
}
break;
case EOpTexture2DGradEXT:
case EOpTextureCubeGradEXT:
case EOpTextureGrad:
ASSERT(function->getParamCount() == 4);
dPdxIndex = 2;
dPdyIndex = 3;
break;
case EOpTexture2DProjGradEXT:
case EOpTextureProjGrad:
ASSERT(function->getParamCount() == 4);
isProj = true;
dPdxIndex = 2;
dPdyIndex = 3;
break;
case EOpTextureOffset:
case EOpTextureOffsetBias:
ASSERT(function->getParamCount() >= 3);
offsetIndex = 2;
if (function->getParamCount() == 4)
{
biasIndex = 3;
}
break;
case EOpTextureProjOffset:
case EOpTextureProjOffsetBias:
ASSERT(function->getParamCount() >= 3);
isProj = true;
offsetIndex = 2;
if (function->getParamCount() == 4)
{
biasIndex = 3;
}
break;
case EOpTextureLodOffset:
ASSERT(function->getParamCount() == 4);
lodIndex = 2;
offsetIndex = 3;
break;
case EOpTextureProjLodOffset:
ASSERT(function->getParamCount() == 4);
isProj = true;
lodIndex = 2;
offsetIndex = 3;
break;
case EOpTextureGradOffset:
ASSERT(function->getParamCount() == 5);
dPdxIndex = 2;
dPdyIndex = 3;
offsetIndex = 4;
break;
case EOpTextureProjGradOffset:
ASSERT(function->getParamCount() == 5);
isProj = true;
dPdxIndex = 2;
dPdyIndex = 3;
offsetIndex = 4;
break;
case EOpTextureGather:
// For shadow textures, refZ (same as Dref) is specified as the last argument.
// Otherwise a component may be specified which defaults to 0 if not specified.
spirvOp = spv::OpImageGather;
if (isDref)
{
ASSERT(function->getParamCount() == 3);
compareIndex = 2;
}
else if (function->getParamCount() == 3)
{
gatherComponentIndex = 2;
}
break;
case EOpTextureGatherOffset:
case EOpTextureGatherOffsetComp:
case EOpTextureGatherOffsets:
case EOpTextureGatherOffsetsComp:
// textureGatherOffset and textureGatherOffsets have the following forms:
//
// - texelGatherOffset*(sampler, P, offset*);
// - texelGatherOffset*(sampler, P, offset*, component);
// - texelGatherOffset*(sampler, P, refZ, offset*);
//
spirvOp = spv::OpImageGather;
if (isDref)
{
ASSERT(function->getParamCount() == 4);
compareIndex = 2;
}
else if (function->getParamCount() == 4)
{
gatherComponentIndex = 3;
}
ASSERT(function->getParamCount() >= 3);
if (BuiltInGroup::IsTextureGatherOffset(op))
{
offsetIndex = isDref ? 3 : 2;
}
else
{
offsetsIndex = isDref ? 3 : 2;
}
break;
case EOpImageStore:
// imageStore has the following forms:
//
// - imageStore(image, P, data);
// - imageStore(imageMS, P, sample, data);
//
spirvOp = spv::OpImageWrite;
if (IsSamplerMS(samplerBasicType))
{
ASSERT(function->getParamCount() == 4);
sampleIndex = 2;
dataIndex = 3;
}
else
{
ASSERT(function->getParamCount() == 3);
dataIndex = 2;
}
break;
case EOpImageLoad:
// imageStore has the following forms:
//
// - imageLoad(image, P);
// - imageLoad(imageMS, P, sample);
//
spirvOp = spv::OpImageRead;
if (IsSamplerMS(samplerBasicType))
{
ASSERT(function->getParamCount() == 3);
sampleIndex = 2;
}
else
{
ASSERT(function->getParamCount() == 2);
}
break;
// Queries:
case EOpTextureSize:
case EOpImageSize:
// textureSize has the following forms:
//
// - textureSize(sampler);
// - textureSize(sampler, lod);
//
// while imageSize has only one form:
//
// - imageSize(image);
//
extractImageFromSampledImage = true;
if (function->getParamCount() == 2)
{
spirvOp = spv::OpImageQuerySizeLod;
lodIndex = 1;
}
else
{
spirvOp = spv::OpImageQuerySize;
}
// No coordinates parameter.
coordinatesIndex = 0;
// No dref parameter.
isDref = false;
break;
case EOpTextureSamples:
case EOpImageSamples:
extractImageFromSampledImage = true;
spirvOp = spv::OpImageQuerySamples;
// No coordinates parameter.
coordinatesIndex = 0;
// No dref parameter.
isDref = false;
break;
case EOpTextureQueryLevels:
extractImageFromSampledImage = true;
spirvOp = spv::OpImageQueryLevels;
// No coordinates parameter.
coordinatesIndex = 0;
// No dref parameter.
isDref = false;
break;
case EOpTextureQueryLod:
spirvOp = spv::OpImageQueryLod;
// No dref parameter.
isDref = false;
break;
default:
UNREACHABLE();
}
// If an implicit-lod instruction is used outside a fragment shader, change that to an explicit
// one as they are not allowed in SPIR-V outside fragment shaders.
const bool noLodSupport = IsSamplerBuffer(samplerBasicType) ||
IsImageBuffer(samplerBasicType) || IsSamplerMS(samplerBasicType) ||
IsImageMS(samplerBasicType);
const bool makeLodExplicit =
mCompiler->getShaderType() != GL_FRAGMENT_SHADER && lodIndex == 0 && dPdxIndex == 0 &&
!noLodSupport && (spirvOp == spv::OpImageSampleImplicitLod || spirvOp == spv::OpImageFetch);
// Apply any necessary fix up.
if (extractImageFromSampledImage && IsSampler(samplerBasicType))
{
// Get the (non-sampled) image type.
SpirvType imageType = mBuilder.getSpirvType(samplerType, {});
ASSERT(!imageType.isSamplerBaseImage);
imageType.isSamplerBaseImage = true;
const spirv::IdRef extractedImageTypeId = mBuilder.getSpirvTypeData(imageType, nullptr).id;
// Use OpImage to get the image out of the sampled image.
const spirv::IdRef extractedImage = mBuilder.getNewId({});
spirv::WriteImage(mBuilder.getSpirvCurrentFunctionBlock(), extractedImageTypeId,
extractedImage, image);
image = extractedImage;
}
// Gather operands as necessary.
// - Coordinates
int coordinatesChannelCount = 0;
spirv::IdRef coordinatesId;
const TType *coordinatesType = nullptr;
if (coordinatesIndex > 0)
{
coordinatesId = parameters[coordinatesIndex];
coordinatesType = &node->getChildNode(coordinatesIndex)->getAsTyped()->getType();
coordinatesChannelCount = coordinatesType->getNominalSize();
}
// - Dref; either specified as a compare/refz argument (cube array, gather), or:
// * coordinates.z for proj variants
// * coordinates.<last> for others
spirv::IdRef drefId;
if (compareIndex > 0)
{
drefId = parameters[compareIndex];
}
else if (isDref)
{
// Get the component index
ASSERT(coordinatesChannelCount > 0);
int drefComponent = isProj ? 2 : coordinatesChannelCount - 1;
// Get the component type
SpirvType drefSpirvType = mBuilder.getSpirvType(*coordinatesType, {});
drefSpirvType.primarySize = 1;
const spirv::IdRef drefTypeId = mBuilder.getSpirvTypeData(drefSpirvType, nullptr).id;
// Extract the dref component out of coordinates.
drefId = mBuilder.getNewId(mBuilder.getDecorations(*coordinatesType));
spirv::WriteCompositeExtract(mBuilder.getSpirvCurrentFunctionBlock(), drefTypeId, drefId,
coordinatesId, {spirv::LiteralInteger(drefComponent)});
}
// - Gather component
spirv::IdRef gatherComponentId;
if (gatherComponentIndex > 0)
{
gatherComponentId = parameters[gatherComponentIndex];
}
else if (spirvOp == spv::OpImageGather)
{
// If comp is not specified, component 0 is taken as default.
gatherComponentId = mBuilder.getIntConstant(0);
}
// - Image write data
spirv::IdRef dataId;
if (dataIndex > 0)
{
dataId = parameters[dataIndex];
}
// - Other operands
spv::ImageOperandsMask operandsMask = spv::ImageOperandsMaskNone;
spirv::IdRefList imageOperandsList;
if (biasIndex > 0)
{
operandsMask = operandsMask | spv::ImageOperandsBiasMask;
imageOperandsList.push_back(parameters[biasIndex]);
}
if (lodIndex > 0)
{
operandsMask = operandsMask | spv::ImageOperandsLodMask;
imageOperandsList.push_back(parameters[lodIndex]);
}
else if (makeLodExplicit)
{
// If the implicit-lod variant is used outside fragment shaders, switch to explicit and use
// lod 0.
operandsMask = operandsMask | spv::ImageOperandsLodMask;
imageOperandsList.push_back(spirvOp == spv::OpImageFetch ? mBuilder.getUintConstant(0)
: mBuilder.getFloatConstant(0));
}
if (dPdxIndex > 0)
{
ASSERT(dPdyIndex > 0);
operandsMask = operandsMask | spv::ImageOperandsGradMask;
imageOperandsList.push_back(parameters[dPdxIndex]);
imageOperandsList.push_back(parameters[dPdyIndex]);
}
if (offsetIndex > 0)
{
// Non-const offsets require the ImageGatherExtended feature.
if (node->getChildNode(offsetIndex)->getAsTyped()->hasConstantValue())
{
operandsMask = operandsMask | spv::ImageOperandsConstOffsetMask;
}
else
{
ASSERT(spirvOp == spv::OpImageGather);
operandsMask = operandsMask | spv::ImageOperandsOffsetMask;
mBuilder.addCapability(spv::CapabilityImageGatherExtended);
}
imageOperandsList.push_back(parameters[offsetIndex]);
}
if (offsetsIndex > 0)
{
ASSERT(node->getChildNode(offsetsIndex)->getAsTyped()->hasConstantValue());
operandsMask = operandsMask | spv::ImageOperandsConstOffsetsMask;
mBuilder.addCapability(spv::CapabilityImageGatherExtended);
imageOperandsList.push_back(parameters[offsetsIndex]);
}
if (sampleIndex > 0)
{
operandsMask = operandsMask | spv::ImageOperandsSampleMask;
imageOperandsList.push_back(parameters[sampleIndex]);
}
const spv::ImageOperandsMask *imageOperands =
imageOperandsList.empty() ? nullptr : &operandsMask;
// GLSL and SPIR-V are different in the way the projective component is specified:
//
// In GLSL:
//
// > The texture coordinates consumed from P, not including the last component of P, are divided
// > by the last component of P.
//
// In SPIR-V, there's a similar language (division by last element), but with the following
// added:
//
// > ... all unused components will appear after all used components.
//
// So for example for textureProj(sampler, vec4 P), the projective coordinates are P.xy/P.w,
// where P.z is ignored. In SPIR-V instead that would be P.xy/P.z and P.w is ignored.
//
if (isProj)
{
int requiredChannelCount = coordinatesChannelCount;
// texture*Proj* operate on the following parameters:
//
// - sampler1D, vec2 P
// - sampler1D, vec4 P
// - sampler2D, vec3 P
// - sampler2D, vec4 P
// - sampler2DRect, vec3 P
// - sampler2DRect, vec4 P
// - sampler3D, vec4 P
// - sampler1DShadow, vec4 P
// - sampler2DShadow, vec4 P
// - sampler2DRectShadow, vec4 P
//
// Of these cases, only (sampler1D*, vec4 P) and (sampler2D*, vec4 P) require moving the
// proj channel from .w to the appropriate location (.y for 1D and .z for 2D).
if (IsSampler2D(samplerBasicType))
{
requiredChannelCount = 3;
}
else if (IsSampler1D(samplerBasicType))
{
requiredChannelCount = 2;
}
if (requiredChannelCount != coordinatesChannelCount)
{
ASSERT(coordinatesChannelCount == 4);
// Get the component type
SpirvType spirvType = mBuilder.getSpirvType(*coordinatesType, {});
const spirv::IdRef coordinatesTypeId = mBuilder.getSpirvTypeData(spirvType, nullptr).id;
spirvType.primarySize = 1;
const spirv::IdRef channelTypeId = mBuilder.getSpirvTypeData(spirvType, nullptr).id;
// Extract the last component out of coordinates.
const spirv::IdRef projChannelId =
mBuilder.getNewId(mBuilder.getDecorations(*coordinatesType));
spirv::WriteCompositeExtract(mBuilder.getSpirvCurrentFunctionBlock(), channelTypeId,
projChannelId, coordinatesId,
{spirv::LiteralInteger(coordinatesChannelCount - 1)});
// Insert it after the channels that are consumed. The extra channels are ignored per
// the SPIR-V spec.
const spirv::IdRef newCoordinatesId =
mBuilder.getNewId(mBuilder.getDecorations(*coordinatesType));
spirv::WriteCompositeInsert(mBuilder.getSpirvCurrentFunctionBlock(), coordinatesTypeId,
newCoordinatesId, projChannelId, coordinatesId,
{spirv::LiteralInteger(requiredChannelCount - 1)});
coordinatesId = newCoordinatesId;
}
}
// Select the correct sample Op based on whether the Proj, Dref or Explicit variants are used.
if (spirvOp == spv::OpImageSampleImplicitLod)
{
ASSERT(!noLodSupport);
const bool isExplicitLod = lodIndex != 0 || makeLodExplicit || dPdxIndex != 0;
if (isDref)
{
if (isProj)
{
spirvOp = isExplicitLod ? spv::OpImageSampleProjDrefExplicitLod
: spv::OpImageSampleProjDrefImplicitLod;
}
else
{
spirvOp = isExplicitLod ? spv::OpImageSampleDrefExplicitLod
: spv::OpImageSampleDrefImplicitLod;
}
}
else
{
if (isProj)
{
spirvOp = isExplicitLod ? spv::OpImageSampleProjExplicitLod
: spv::OpImageSampleProjImplicitLod;
}
else
{
spirvOp =
isExplicitLod ? spv::OpImageSampleExplicitLod : spv::OpImageSampleImplicitLod;
}
}
}
if (spirvOp == spv::OpImageGather && isDref)
{
spirvOp = spv::OpImageDrefGather;
}
spirv::IdRef result;
if (spirvOp != spv::OpImageWrite)
{
result = mBuilder.getNewId(mBuilder.getDecorations(node->getType()));
}
switch (spirvOp)
{
case spv::OpImageQuerySizeLod:
mBuilder.addCapability(spv::CapabilityImageQuery);
ASSERT(imageOperandsList.size() == 1);
spirv::WriteImageQuerySizeLod(mBuilder.getSpirvCurrentFunctionBlock(), resultTypeId,
result, image, imageOperandsList[0]);
break;
case spv::OpImageQuerySize:
mBuilder.addCapability(spv::CapabilityImageQuery);
spirv::WriteImageQuerySize(mBuilder.getSpirvCurrentFunctionBlock(), resultTypeId,
result, image);
break;
case spv::OpImageQueryLod:
mBuilder.addCapability(spv::CapabilityImageQuery);
spirv::WriteImageQueryLod(mBuilder.getSpirvCurrentFunctionBlock(), resultTypeId, result,
image, coordinatesId);
break;
case spv::OpImageQueryLevels:
mBuilder.addCapability(spv::CapabilityImageQuery);
spirv::WriteImageQueryLevels(mBuilder.getSpirvCurrentFunctionBlock(), resultTypeId,
result, image);
break;
case spv::OpImageQuerySamples:
mBuilder.addCapability(spv::CapabilityImageQuery);
spirv::WriteImageQuerySamples(mBuilder.getSpirvCurrentFunctionBlock(), resultTypeId,
result, image);
break;
case spv::OpImageSampleImplicitLod:
spirv::WriteImageSampleImplicitLod(mBuilder.getSpirvCurrentFunctionBlock(),
resultTypeId, result, image, coordinatesId,
imageOperands, imageOperandsList);
break;
case spv::OpImageSampleExplicitLod:
spirv::WriteImageSampleExplicitLod(mBuilder.getSpirvCurrentFunctionBlock(),
resultTypeId, result, image, coordinatesId,
*imageOperands, imageOperandsList);
break;
case spv::OpImageSampleDrefImplicitLod:
spirv::WriteImageSampleDrefImplicitLod(mBuilder.getSpirvCurrentFunctionBlock(),
resultTypeId, result, image, coordinatesId,
drefId, imageOperands, imageOperandsList);
break;
case spv::OpImageSampleDrefExplicitLod:
spirv::WriteImageSampleDrefExplicitLod(mBuilder.getSpirvCurrentFunctionBlock(),
resultTypeId, result, image, coordinatesId,
drefId, *imageOperands, imageOperandsList);
break;
case spv::OpImageSampleProjImplicitLod:
spirv::WriteImageSampleProjImplicitLod(mBuilder.getSpirvCurrentFunctionBlock(),
resultTypeId, result, image, coordinatesId,
imageOperands, imageOperandsList);
break;
case spv::OpImageSampleProjExplicitLod:
spirv::WriteImageSampleProjExplicitLod(mBuilder.getSpirvCurrentFunctionBlock(),
resultTypeId, result, image, coordinatesId,
*imageOperands, imageOperandsList);
break;
case spv::OpImageSampleProjDrefImplicitLod:
spirv::WriteImageSampleProjDrefImplicitLod(mBuilder.getSpirvCurrentFunctionBlock(),
resultTypeId, result, image, coordinatesId,
drefId, imageOperands, imageOperandsList);
break;
case spv::OpImageSampleProjDrefExplicitLod:
spirv::WriteImageSampleProjDrefExplicitLod(mBuilder.getSpirvCurrentFunctionBlock(),
resultTypeId, result, image, coordinatesId,
drefId, *imageOperands, imageOperandsList);
break;
case spv::OpImageFetch:
spirv::WriteImageFetch(mBuilder.getSpirvCurrentFunctionBlock(), resultTypeId, result,
image, coordinatesId, imageOperands, imageOperandsList);
break;
case spv::OpImageGather:
spirv::WriteImageGather(mBuilder.getSpirvCurrentFunctionBlock(), resultTypeId, result,
image, coordinatesId, gatherComponentId, imageOperands,
imageOperandsList);
break;
case spv::OpImageDrefGather:
spirv::WriteImageDrefGather(mBuilder.getSpirvCurrentFunctionBlock(), resultTypeId,
result, image, coordinatesId, drefId, imageOperands,
imageOperandsList);
break;
case spv::OpImageRead:
spirv::WriteImageRead(mBuilder.getSpirvCurrentFunctionBlock(), resultTypeId, result,
image, coordinatesId, imageOperands, imageOperandsList);
break;
case spv::OpImageWrite:
spirv::WriteImageWrite(mBuilder.getSpirvCurrentFunctionBlock(), image, coordinatesId,
dataId, imageOperands, imageOperandsList);
break;
default:
UNREACHABLE();
}
// In Desktop GLSL, the legacy shadow* built-ins produce a vec4, while SPIR-V
// OpImageSample*Dref* instructions produce a scalar. EXT_shadow_samplers in ESSL introduces
// similar functions but which return a scalar.
//
// TODO: For desktop GLSL, the result must be turned into a vec4. http://anglebug.com/6197.
return result;
}
spirv::IdRef OutputSPIRVTraverser::createSubpassLoadBuiltIn(TIntermOperator *node,
spirv::IdRef resultTypeId)
{
// Load the parameters.
spirv::IdRefList parameters = loadAllParams(node, 0, nullptr);
const spirv::IdRef image = parameters[0];
// If multisampled, an additional parameter specifies the sample. This is passed through as an
// extra image operand.
const bool hasSampleParam = parameters.size() == 2;
const spv::ImageOperandsMask operandsMask =
hasSampleParam ? spv::ImageOperandsSampleMask : spv::ImageOperandsMaskNone;
spirv::IdRefList imageOperandsList;
if (hasSampleParam)
{
imageOperandsList.push_back(parameters[1]);
}
// |subpassLoad| is implemented with OpImageRead. This OP takes a coordinate, which is unused
// and is set to (0, 0) here.
const spirv::IdRef coordId = mBuilder.getNullConstant(mBuilder.getBasicTypeId(EbtUInt, 2));
const spirv::IdRef result = mBuilder.getNewId(mBuilder.getDecorations(node->getType()));
spirv::WriteImageRead(mBuilder.getSpirvCurrentFunctionBlock(), resultTypeId, result, image,
coordId, hasSampleParam ? &operandsMask : nullptr, imageOperandsList);
return result;
}
spirv::IdRef OutputSPIRVTraverser::createInterpolate(TIntermOperator *node,
spirv::IdRef resultTypeId)
{
spv::GLSLstd450 extendedInst = spv::GLSLstd450Bad;
mBuilder.addCapability(spv::CapabilityInterpolationFunction);
switch (node->getOp())
{
case EOpInterpolateAtCentroid:
extendedInst = spv::GLSLstd450InterpolateAtCentroid;
break;
case EOpInterpolateAtSample:
extendedInst = spv::GLSLstd450InterpolateAtSample;
break;
case EOpInterpolateAtOffset:
extendedInst = spv::GLSLstd450InterpolateAtOffset;
break;
default:
UNREACHABLE();
}
size_t childCount = node->getChildCount();
spirv::IdRefList parameters;
// interpolateAt* takes the interpolant as the first argument, *pointer* to which needs to be
// passed to the instruction. Except interpolateAtCentroid, another parameter follows.
parameters.push_back(accessChainCollapse(&mNodeData[mNodeData.size() - childCount]));
if (childCount > 1)
{
parameters.push_back(accessChainLoad(
&mNodeData.back(), node->getChildNode(1)->getAsTyped()->getType(), nullptr));
}
const spirv::IdRef result = mBuilder.getNewId(mBuilder.getDecorations(node->getType()));
spirv::WriteExtInst(mBuilder.getSpirvCurrentFunctionBlock(), resultTypeId, result,
mBuilder.getExtInstImportIdStd(),
spirv::LiteralExtInstInteger(extendedInst), parameters);
return result;
}
spirv::IdRef OutputSPIRVTraverser::castBasicType(spirv::IdRef value,
const TType &valueType,
const TType &expectedType,
spirv::IdRef *resultTypeIdOut)
{
const TBasicType expectedBasicType = expectedType.getBasicType();
if (valueType.getBasicType() == expectedBasicType)
{
return value;
}
// Make sure no attempt is made to cast a matrix to int/uint.
ASSERT(!valueType.isMatrix() || expectedBasicType == EbtFloat);
SpirvType valueSpirvType = mBuilder.getSpirvType(valueType, {});
valueSpirvType.type = expectedBasicType;
valueSpirvType.typeSpec.isOrHasBoolInInterfaceBlock = false;
const spirv::IdRef castTypeId = mBuilder.getSpirvTypeData(valueSpirvType, nullptr).id;
const spirv::IdRef castValue = mBuilder.getNewId(mBuilder.getDecorations(expectedType));
// Write the instruction that casts between types. Different instructions are used based on the
// types being converted.
//
// - int/uint <-> float: OpConvert*To*
// - int <-> uint: OpBitcast
// - bool --> int/uint/float: OpSelect with 0 and 1
// - int/uint --> bool: OPINotEqual 0
// - float --> bool: OpFUnordNotEqual 0
WriteUnaryOp writeUnaryOp = nullptr;
WriteBinaryOp writeBinaryOp = nullptr;
WriteTernaryOp writeTernaryOp = nullptr;
spirv::IdRef zero;
spirv::IdRef one;
switch (valueType.getBasicType())
{
case EbtFloat:
switch (expectedBasicType)
{
case EbtInt:
writeUnaryOp = spirv::WriteConvertFToS;
break;
case EbtUInt:
writeUnaryOp = spirv::WriteConvertFToU;
break;
case EbtBool:
zero = mBuilder.getVecConstant(0, valueType.getNominalSize());
writeBinaryOp = spirv::WriteFUnordNotEqual;
break;
default:
UNREACHABLE();
}
break;
case EbtInt:
case EbtUInt:
switch (expectedBasicType)
{
case EbtFloat:
writeUnaryOp = valueType.getBasicType() == EbtInt ? spirv::WriteConvertSToF
: spirv::WriteConvertUToF;
break;
case EbtInt:
case EbtUInt:
writeUnaryOp = spirv::WriteBitcast;
break;
case EbtBool:
zero = mBuilder.getUvecConstant(0, valueType.getNominalSize());
writeBinaryOp = spirv::WriteINotEqual;
break;
default:
UNREACHABLE();
}
break;
case EbtBool:
writeTernaryOp = spirv::WriteSelect;
switch (expectedBasicType)
{
case EbtFloat:
zero = mBuilder.getVecConstant(0, valueType.getNominalSize());
one = mBuilder.getVecConstant(1, valueType.getNominalSize());
break;
case EbtInt:
zero = mBuilder.getIvecConstant(0, valueType.getNominalSize());
one = mBuilder.getIvecConstant(1, valueType.getNominalSize());
break;
case EbtUInt:
zero = mBuilder.getUvecConstant(0, valueType.getNominalSize());
one = mBuilder.getUvecConstant(1, valueType.getNominalSize());
break;
default:
UNREACHABLE();
}
break;
default:
// TODO: support desktop GLSL. http://anglebug.com/6197
UNIMPLEMENTED();
}
if (writeUnaryOp)
{
writeUnaryOp(mBuilder.getSpirvCurrentFunctionBlock(), castTypeId, castValue, value);
}
else if (writeBinaryOp)
{
writeBinaryOp(mBuilder.getSpirvCurrentFunctionBlock(), castTypeId, castValue, value, zero);
}
else
{
ASSERT(writeTernaryOp);
writeTernaryOp(mBuilder.getSpirvCurrentFunctionBlock(), castTypeId, castValue, value, one,
zero);
}
if (resultTypeIdOut)
{
*resultTypeIdOut = castTypeId;
}
return castValue;
}
spirv::IdRef OutputSPIRVTraverser::cast(spirv::IdRef value,
const TType &valueType,
const SpirvTypeSpec &valueTypeSpec,
const SpirvTypeSpec &expectedTypeSpec,
spirv::IdRef *resultTypeIdOut)
{
// If there's no difference in type specialization, there's nothing to cast.
if (valueTypeSpec.blockStorage == expectedTypeSpec.blockStorage &&
valueTypeSpec.isInvariantBlock == expectedTypeSpec.isInvariantBlock &&
valueTypeSpec.isRowMajorQualifiedBlock == expectedTypeSpec.isRowMajorQualifiedBlock &&
valueTypeSpec.isRowMajorQualifiedArray == expectedTypeSpec.isRowMajorQualifiedArray &&
valueTypeSpec.isOrHasBoolInInterfaceBlock == expectedTypeSpec.isOrHasBoolInInterfaceBlock &&
valueTypeSpec.isPatchIOBlock == expectedTypeSpec.isPatchIOBlock)
{
return value;
}
// At this point, a value is loaded with the |valueType| GLSL type which is of a SPIR-V type
// specialized by |valueTypeSpec|. However, it's being assigned (for example through operator=,
// used in a constructor or passed as a function argument) where the same GLSL type is expected
// but with different SPIR-V type specialization (|expectedTypeSpec|). SPIR-V 1.4 has
// OpCopyLogical that does exactly that, but we generate SPIR-V 1.0 at the moment.
//
// The following code recursively copies the array elements or struct fields and then constructs
// the final result with the expected SPIR-V type.
// Interface blocks cannot be copied or passed as parameters in GLSL.
ASSERT(!valueType.isInterfaceBlock());
spirv::IdRefList constituents;
if (valueType.isArray())
{
// Find the SPIR-V type specialization for the element type.
SpirvTypeSpec valueElementTypeSpec = valueTypeSpec;
SpirvTypeSpec expectedElementTypeSpec = expectedTypeSpec;
const bool isElementBlock = valueType.getStruct() != nullptr;
const bool isElementArray = valueType.isArrayOfArrays();
valueElementTypeSpec.onArrayElementSelection(isElementBlock, isElementArray);
expectedElementTypeSpec.onArrayElementSelection(isElementBlock, isElementArray);
// Get the element type id.
TType elementType(valueType);
elementType.toArrayElementType();
const spirv::IdRef elementTypeId =
mBuilder.getTypeDataOverrideTypeSpec(elementType, valueElementTypeSpec).id;
const SpirvDecorations elementDecorations = mBuilder.getDecorations(elementType);
// Extract each element of the array and cast it to the expected type.
for (unsigned int elementIndex = 0; elementIndex < valueType.getOutermostArraySize();
++elementIndex)
{
const spirv::IdRef elementId = mBuilder.getNewId(elementDecorations);
spirv::WriteCompositeExtract(mBuilder.getSpirvCurrentFunctionBlock(), elementTypeId,
elementId, value, {spirv::LiteralInteger(elementIndex)});
constituents.push_back(cast(elementId, elementType, valueElementTypeSpec,
expectedElementTypeSpec, nullptr));
}
}
else if (valueType.getStruct() != nullptr)
{
uint32_t fieldIndex = 0;
// Extract each field of the struct and cast it to the expected type.
for (const TField *field : valueType.getStruct()->fields())
{
const TType &fieldType = *field->type();
// Find the SPIR-V type specialization for the field type.
SpirvTypeSpec valueFieldTypeSpec = valueTypeSpec;
SpirvTypeSpec expectedFieldTypeSpec = expectedTypeSpec;
valueFieldTypeSpec.onBlockFieldSelection(fieldType);
expectedFieldTypeSpec.onBlockFieldSelection(fieldType);
// Get the field type id.
const spirv::IdRef fieldTypeId =
mBuilder.getTypeDataOverrideTypeSpec(fieldType, valueFieldTypeSpec).id;
// Extract the field.
const spirv::IdRef fieldId = mBuilder.getNewId(mBuilder.getDecorations(fieldType));
spirv::WriteCompositeExtract(mBuilder.getSpirvCurrentFunctionBlock(), fieldTypeId,
fieldId, value, {spirv::LiteralInteger(fieldIndex++)});
constituents.push_back(
cast(fieldId, fieldType, valueFieldTypeSpec, expectedFieldTypeSpec, nullptr));
}
}
else
{
// Bool types in interface blocks are emulated with uint. bool<->uint cast is done here.
ASSERT(valueType.getBasicType() == EbtBool);
ASSERT(valueTypeSpec.isOrHasBoolInInterfaceBlock ||
expectedTypeSpec.isOrHasBoolInInterfaceBlock);
TType emulatedValueType(valueType);
emulatedValueType.setBasicType(EbtUInt);
emulatedValueType.setPrecise(EbpLow);
// If value is loaded as uint, it needs to change to bool. If it's bool, it needs to change
// to uint before storage.
if (valueTypeSpec.isOrHasBoolInInterfaceBlock)
{
return castBasicType(value, emulatedValueType, valueType, resultTypeIdOut);
}
else
{
return castBasicType(value, valueType, emulatedValueType, resultTypeIdOut);
}
}
// Construct the value with the expected type from its cast constituents.
const spirv::IdRef expectedTypeId =
mBuilder.getTypeDataOverrideTypeSpec(valueType, expectedTypeSpec).id;
const spirv::IdRef expectedId = mBuilder.getNewId(mBuilder.getDecorations(valueType));
spirv::WriteCompositeConstruct(mBuilder.getSpirvCurrentFunctionBlock(), expectedTypeId,
expectedId, constituents);
if (resultTypeIdOut)
{
*resultTypeIdOut = expectedTypeId;
}
return expectedId;
}
void OutputSPIRVTraverser::extendScalarParamsToVector(TIntermOperator *node,
spirv::IdRef resultTypeId,
spirv::IdRefList *parameters)
{
const TType &type = node->getType();
if (type.isScalar())
{
// Nothing to do if the operation is applied to scalars.
return;
}
const size_t childCount = node->getChildCount();
for (size_t childIndex = 0; childIndex < childCount; ++childIndex)
{
const TType &childType = node->getChildNode(childIndex)->getAsTyped()->getType();
// If the child is a scalar, replicate it to form a vector of the right size.
if (childType.isScalar())
{
TType vectorType(type);
if (vectorType.isMatrix())
{
vectorType.toMatrixColumnType();
}
(*parameters)[childIndex] = createConstructorVectorFromScalar(
childType, vectorType, resultTypeId, {{(*parameters)[childIndex]}});
}
}
}
spirv::IdRef OutputSPIRVTraverser::reduceBoolVector(TOperator op,
const spirv::IdRefList &valueIds,
spirv::IdRef typeId,
const SpirvDecorations &decorations)
{
if (valueIds.size() == 2)
{
// If two values are given, and/or them directly.
WriteBinaryOp writeBinaryOp =
op == EOpEqual ? spirv::WriteLogicalAnd : spirv::WriteLogicalOr;
const spirv::IdRef result = mBuilder.getNewId(decorations);
writeBinaryOp(mBuilder.getSpirvCurrentFunctionBlock(), typeId, result, valueIds[0],
valueIds[1]);
return result;
}
WriteUnaryOp writeUnaryOp = op == EOpEqual ? spirv::WriteAll : spirv::WriteAny;
spirv::IdRef valueId = valueIds[0];
if (valueIds.size() > 2)
{
// If multiple values are given, construct a bool vector out of them first.
const spirv::IdRef bvecTypeId = mBuilder.getBasicTypeId(EbtBool, valueIds.size());
valueId = {mBuilder.getNewId(decorations)};
spirv::WriteCompositeConstruct(mBuilder.getSpirvCurrentFunctionBlock(), bvecTypeId, valueId,
valueIds);
}
const spirv::IdRef result = mBuilder.getNewId(decorations);
writeUnaryOp(mBuilder.getSpirvCurrentFunctionBlock(), typeId, result, valueId);
return result;
}
void OutputSPIRVTraverser::createCompareImpl(TOperator op,
const TType &operandType,
spirv::IdRef resultTypeId,
spirv::IdRef leftId,
spirv::IdRef rightId,
const SpirvDecorations &operandDecorations,
const SpirvDecorations &resultDecorations,
spirv::LiteralIntegerList *currentAccessChain,
spirv::IdRefList *intermediateResultsOut)
{
const TBasicType basicType = operandType.getBasicType();
const bool isFloat = basicType == EbtFloat || basicType == EbtDouble;
const bool isBool = basicType == EbtBool;
WriteBinaryOp writeBinaryOp = nullptr;
// For arrays, compare them element by element.
if (operandType.isArray())
{
TType elementType(operandType);
elementType.toArrayElementType();
currentAccessChain->emplace_back();
for (unsigned int elementIndex = 0; elementIndex < operandType.getOutermostArraySize();
++elementIndex)
{
// Select the current element.
currentAccessChain->back() = spirv::LiteralInteger(elementIndex);
// Compare and accumulate the results.
createCompareImpl(op, elementType, resultTypeId, leftId, rightId, operandDecorations,
resultDecorations, currentAccessChain, intermediateResultsOut);
}
currentAccessChain->pop_back();
return;
}
// For structs, compare them field by field.
if (operandType.getStruct() != nullptr)
{
uint32_t fieldIndex = 0;
currentAccessChain->emplace_back();
for (const TField *field : operandType.getStruct()->fields())
{
// Select the current field.
currentAccessChain->back() = spirv::LiteralInteger(fieldIndex++);
// Compare and accumulate the results.
createCompareImpl(op, *field->type(), resultTypeId, leftId, rightId, operandDecorations,
resultDecorations, currentAccessChain, intermediateResultsOut);
}
currentAccessChain->pop_back();
return;
}
// For matrices, compare them column by column.
if (operandType.isMatrix())
{
TType columnType(operandType);
columnType.toMatrixColumnType();
currentAccessChain->emplace_back();
for (int columnIndex = 0; columnIndex < operandType.getCols(); ++columnIndex)
{
// Select the current column.
currentAccessChain->back() = spirv::LiteralInteger(columnIndex);
// Compare and accumulate the results.
createCompareImpl(op, columnType, resultTypeId, leftId, rightId, operandDecorations,
resultDecorations, currentAccessChain, intermediateResultsOut);
}
currentAccessChain->pop_back();
return;
}
// For scalars and vectors generate a single instruction for comparison.
if (op == EOpEqual)
{
if (isFloat)
writeBinaryOp = spirv::WriteFOrdEqual;
else if (isBool)
writeBinaryOp = spirv::WriteLogicalEqual;
else
writeBinaryOp = spirv::WriteIEqual;
}
else
{
ASSERT(op == EOpNotEqual);
if (isFloat)
writeBinaryOp = spirv::WriteFUnordNotEqual;
else if (isBool)
writeBinaryOp = spirv::WriteLogicalNotEqual;
else
writeBinaryOp = spirv::WriteINotEqual;
}
// Extract the scalar and vector from composite types, if any.
spirv::IdRef leftComponentId = leftId;
spirv::IdRef rightComponentId = rightId;
if (!currentAccessChain->empty())
{
leftComponentId = mBuilder.getNewId(operandDecorations);
rightComponentId = mBuilder.getNewId(operandDecorations);
const spirv::IdRef componentTypeId =
mBuilder.getBasicTypeId(operandType.getBasicType(), operandType.getNominalSize());
spirv::WriteCompositeExtract(mBuilder.getSpirvCurrentFunctionBlock(), componentTypeId,
leftComponentId, leftId, *currentAccessChain);
spirv::WriteCompositeExtract(mBuilder.getSpirvCurrentFunctionBlock(), componentTypeId,
rightComponentId, rightId, *currentAccessChain);
}
const bool reduceResult = !operandType.isScalar();
spirv::IdRef result = mBuilder.getNewId({});
spirv::IdRef opResultTypeId = resultTypeId;
if (reduceResult)
{
opResultTypeId = mBuilder.getBasicTypeId(EbtBool, operandType.getNominalSize());
}
// Write the comparison operation itself.
writeBinaryOp(mBuilder.getSpirvCurrentFunctionBlock(), opResultTypeId, result, leftComponentId,
rightComponentId);
// If it's a vector, reduce the result.
if (reduceResult)
{
result = reduceBoolVector(op, {result}, resultTypeId, resultDecorations);
}
intermediateResultsOut->push_back(result);
}
spirv::IdRef OutputSPIRVTraverser::makeBuiltInOutputStructType(TIntermOperator *node,
size_t lvalueCount)
{
// The built-ins with lvalues are in one of the following forms:
//
// - lsb = builtin(..., out msb): These are identified by lvalueCount == 1
// - builtin(..., out msb, out lsb): These are identified by lvalueCount == 2
//
// In SPIR-V, the result of all these instructions is a struct { lsb; msb; }.
const size_t childCount = node->getChildCount();
ASSERT(childCount >= 2);
TIntermTyped *lastChild = node->getChildNode(childCount - 1)->getAsTyped();
TIntermTyped *beforeLastChild = node->getChildNode(childCount - 2)->getAsTyped();
const TType &lsbType = lvalueCount == 1 ? node->getType() : lastChild->getType();
const TType &msbType = lvalueCount == 1 ? lastChild->getType() : beforeLastChild->getType();
ASSERT(lsbType.isScalar() || lsbType.isVector());
ASSERT(msbType.isScalar() || msbType.isVector());
const BuiltInResultStruct key = {
lsbType.getBasicType(),
msbType.getBasicType(),
static_cast<uint32_t>(lsbType.getNominalSize()),
static_cast<uint32_t>(msbType.getNominalSize()),
};
auto iter = mBuiltInResultStructMap.find(key);
if (iter == mBuiltInResultStructMap.end())
{
// Create a TStructure and TType for the required structure.
TType *lsbTypeCopy = new TType(lsbType.getBasicType(),
static_cast<unsigned char>(lsbType.getNominalSize()), 1);
TType *msbTypeCopy = new TType(msbType.getBasicType(),
static_cast<unsigned char>(msbType.getNominalSize()), 1);
TFieldList *fields = new TFieldList;
fields->push_back(
new TField(lsbTypeCopy, ImmutableString("lsb"), {}, SymbolType::AngleInternal));
fields->push_back(
new TField(msbTypeCopy, ImmutableString("msb"), {}, SymbolType::AngleInternal));
TStructure *structure =
new TStructure(&mCompiler->getSymbolTable(), ImmutableString("BuiltInResultType"),
fields, SymbolType::AngleInternal);
TType structType(structure, true);
// Get an id for the type and store in the hash map.
const spirv::IdRef structTypeId = mBuilder.getTypeData(structType, {}).id;
iter = mBuiltInResultStructMap.insert({key, structTypeId}).first;
}
return iter->second;
}
// Once the builtin instruction is generated, the two return values are extracted from the
// struct. These are written to the return value (if any) and the out parameters.
void OutputSPIRVTraverser::storeBuiltInStructOutputInParamsAndReturnValue(
TIntermOperator *node,
size_t lvalueCount,
spirv::IdRef structValue,
spirv::IdRef returnValue,
spirv::IdRef returnValueType)
{
const size_t childCount = node->getChildCount();
ASSERT(childCount >= 2);
TIntermTyped *lastChild = node->getChildNode(childCount - 1)->getAsTyped();
TIntermTyped *beforeLastChild = node->getChildNode(childCount - 2)->getAsTyped();
if (lvalueCount == 1)
{
// The built-in is the form:
//
// lsb = builtin(..., out msb): These are identified by lvalueCount == 1
// Field 0 is lsb, which is extracted as the builtin's return value.
spirv::WriteCompositeExtract(mBuilder.getSpirvCurrentFunctionBlock(), returnValueType,
returnValue, structValue, {spirv::LiteralInteger(0)});
// Field 1 is msb, which is extracted and stored through the out parameter.
storeBuiltInStructOutputInParamHelper(&mNodeData[mNodeData.size() - 1], lastChild,
structValue, 1);
}
else
{
// The built-in is the form:
//
// builtin(..., out msb, out lsb): These are identified by lvalueCount == 2
ASSERT(lvalueCount == 2);
// Field 0 is lsb, which is extracted and stored through the second out parameter.
storeBuiltInStructOutputInParamHelper(&mNodeData[mNodeData.size() - 1], lastChild,
structValue, 0);
// Field 1 is msb, which is extracted and stored through the first out parameter.
storeBuiltInStructOutputInParamHelper(&mNodeData[mNodeData.size() - 2], beforeLastChild,
structValue, 1);
}
}
void OutputSPIRVTraverser::storeBuiltInStructOutputInParamHelper(NodeData *data,
TIntermTyped *param,
spirv::IdRef structValue,
uint32_t fieldIndex)
{
spirv::IdRef fieldTypeId = mBuilder.getTypeData(param->getType(), {}).id;
spirv::IdRef fieldValueId = mBuilder.getNewId(mBuilder.getDecorations(param->getType()));
spirv::WriteCompositeExtract(mBuilder.getSpirvCurrentFunctionBlock(), fieldTypeId, fieldValueId,
structValue, {spirv::LiteralInteger(fieldIndex)});
accessChainStore(data, fieldValueId, param->getType());
}
void OutputSPIRVTraverser::visitSymbol(TIntermSymbol *node)
{
// No-op visits to symbols that are being declared. They are handled in visitDeclaration.
if (mIsSymbolBeingDeclared)
{
// Make sure this does not affect other symbols, for example in the initializer expression.
mIsSymbolBeingDeclared = false;
return;
}
mNodeData.emplace_back();
// The symbol is either:
//
// - A specialization constant
// - A variable (local, varying etc)
// - An interface block
// - A field of an unnamed interface block
//
// Specialization constants in SPIR-V are treated largely like constants, in which case make
// this behave like visitConstantUnion().
const TType &type = node->getType();
const TInterfaceBlock *interfaceBlock = type.getInterfaceBlock();
const TSymbol *symbol = interfaceBlock;
if (interfaceBlock == nullptr)
{
symbol = &node->variable();
}
// Track the properties that lead to the symbol's specific SPIR-V type based on the GLSL type.
// They are needed to determine the derived type in an access chain, but are not promoted in
// intermediate nodes' TTypes.
SpirvTypeSpec typeSpec;
typeSpec.inferDefaults(type, mCompiler);
const spirv::IdRef typeId = mBuilder.getTypeData(type, typeSpec).id;
// If the symbol is a const variable, a const function parameter or specialization constant,
// create an rvalue.
if (type.getQualifier() == EvqConst || type.getQualifier() == EvqParamConst ||
type.getQualifier() == EvqSpecConst)
{
ASSERT(interfaceBlock == nullptr);
ASSERT(mSymbolIdMap.count(symbol) > 0);
nodeDataInitRValue(&mNodeData.back(), mSymbolIdMap[symbol], typeId);
return;
}
// Otherwise create an lvalue.
spv::StorageClass storageClass;
const spirv::IdRef symbolId = getSymbolIdAndStorageClass(symbol, type, &storageClass);
nodeDataInitLValue(&mNodeData.back(), symbolId, typeId, storageClass, typeSpec);
// If a field of a nameless interface block, create an access chain.
if (type.getInterfaceBlock() && !type.isInterfaceBlock())
{
uint32_t fieldIndex = static_cast<uint32_t>(type.getInterfaceBlockFieldIndex());
accessChainPushLiteral(&mNodeData.back(), spirv::LiteralInteger(fieldIndex), typeId);
}
// Add gl_PerVertex capabilities only if the field is actually used.
switch (type.getQualifier())
{
case EvqClipDistance:
mBuilder.addCapability(spv::CapabilityClipDistance);
break;
case EvqCullDistance:
mBuilder.addCapability(spv::CapabilityCullDistance);
break;
default:
break;
}
}
void OutputSPIRVTraverser::visitConstantUnion(TIntermConstantUnion *node)
{
mNodeData.emplace_back();
const TType &type = node->getType();
// Find out the expected type for this constant, so it can be cast right away and not need an
// instruction to do that.
TIntermNode *parent = getParentNode();
const size_t childIndex = getParentChildIndex(PreVisit);
TBasicType expectedBasicType = type.getBasicType();
if (parent->getAsAggregate())
{
TIntermAggregate *parentAggregate = parent->getAsAggregate();
// Note that only constructors can cast a type. There are two possibilities:
//
// - It's a struct constructor: The basic type must match that of the corresponding field of
// the struct.
// - It's a non struct constructor: The basic type must match that of the type being
// constructed.
if (parentAggregate->isConstructor())
{
const TType &parentType = parentAggregate->getType();
const TStructure *structure = parentType.getStruct();
if (structure != nullptr && !parentType.isArray())
{
expectedBasicType = structure->fields()[childIndex]->type()->getBasicType();
}
else
{
expectedBasicType = parentAggregate->getType().getBasicType();
}
}
}
const spirv::IdRef typeId = mBuilder.getTypeData(type, {}).id;
const spirv::IdRef constId = createConstant(type, expectedBasicType, node->getConstantValue(),
node->isConstantNullValue());
nodeDataInitRValue(&mNodeData.back(), constId, typeId);
}
bool OutputSPIRVTraverser::visitSwizzle(Visit visit, TIntermSwizzle *node)
{
// Constants are expected to be folded.
ASSERT(!node->hasConstantValue());
if (visit == PreVisit)
{
// Don't add an entry to the stack. The child will create one, which we won't pop.
return true;
}
ASSERT(visit == PostVisit);
ASSERT(mNodeData.size() >= 1);
const TType &vectorType = node->getOperand()->getType();
const uint8_t vectorComponentCount = static_cast<uint8_t>(vectorType.getNominalSize());
const TVector<int> &swizzle = node->getSwizzleOffsets();
// As an optimization, do nothing if the swizzle is selecting all the components of the vector
// in order.
bool isIdentity = swizzle.size() == vectorComponentCount;
for (size_t index = 0; index < swizzle.size(); ++index)
{
isIdentity = isIdentity && static_cast<size_t>(swizzle[index]) == index;
}
if (isIdentity)
{
return true;
}
accessChainOnPush(&mNodeData.back(), vectorType, 0);
const spirv::IdRef typeId =
mBuilder.getTypeData(node->getType(), mNodeData.back().accessChain.typeSpec).id;
accessChainPushSwizzle(&mNodeData.back(), swizzle, typeId, vectorComponentCount);
return true;
}
bool OutputSPIRVTraverser::visitBinary(Visit visit, TIntermBinary *node)
{
// Constants are expected to be folded.
ASSERT(!node->hasConstantValue());
if (visit == PreVisit)
{
// Don't add an entry to the stack. The left child will create one, which we won't pop.
return true;
}
// If this is a variable initialization node, defer any code generation to visitDeclaration.
if (node->getOp() == EOpInitialize)
{
ASSERT(getParentNode()->getAsDeclarationNode() != nullptr);
return true;
}
if (IsShortCircuitNeeded(node))
{
// For && and ||, if short-circuiting behavior is needed, we need to emulate it with an
// |if| construct. At this point, the left-hand side is already evaluated, so we need to
// create an appropriate conditional on in-visit and visit the right-hand-side inside the
// conditional block. On post-visit, OpPhi is used to calculate the result.
if (visit == InVisit)
{
startShortCircuit(node);
return true;
}
spirv::IdRef typeId;
const spirv::IdRef result = endShortCircuit(node, &typeId);
// Replace the access chain with an rvalue that's the result.
nodeDataInitRValue(&mNodeData.back(), result, typeId);
return true;
}
if (visit == InVisit)
{
// Left child visited. Take the entry it created as the current node's.
ASSERT(mNodeData.size() >= 1);
// As an optimization, if the index is EOpIndexDirect*, take the constant index directly and
// add it to the access chain as literal.
switch (node->getOp())
{
default:
break;
case EOpIndexDirect:
case EOpIndexDirectStruct:
case EOpIndexDirectInterfaceBlock:
const uint32_t index = node->getRight()->getAsConstantUnion()->getIConst(0);
accessChainOnPush(&mNodeData.back(), node->getLeft()->getType(), index);
const spirv::IdRef typeId =
mBuilder.getTypeData(node->getType(), mNodeData.back().accessChain.typeSpec).id;
accessChainPushLiteral(&mNodeData.back(), spirv::LiteralInteger(index), typeId);
// Don't visit the right child, it's already processed.
return false;
}
return true;
}
// There are at least two entries, one for the left node and one for the right one.
ASSERT(mNodeData.size() >= 2);
SpirvTypeSpec resultTypeSpec;
if (node->getOp() == EOpIndexIndirect || node->getOp() == EOpAssign)
{
if (node->getOp() == EOpIndexIndirect)
{
accessChainOnPush(&mNodeData[mNodeData.size() - 2], node->getLeft()->getType(), 0);
}
resultTypeSpec = mNodeData[mNodeData.size() - 2].accessChain.typeSpec;
}
const spirv::IdRef resultTypeId = mBuilder.getTypeData(node->getType(), resultTypeSpec).id;
// For EOpIndex* operations, push the right value as an index to the left value's access chain.
// For the other operations, evaluate the expression.
switch (node->getOp())
{
case EOpIndexDirect:
case EOpIndexDirectStruct:
case EOpIndexDirectInterfaceBlock:
UNREACHABLE();
break;
case EOpIndexIndirect:
{
// Load the index.
const spirv::IdRef rightValue =
accessChainLoad(&mNodeData.back(), node->getRight()->getType(), nullptr);
mNodeData.pop_back();
if (!node->getLeft()->getType().isArray() && node->getLeft()->getType().isVector())
{
accessChainPushDynamicComponent(&mNodeData.back(), rightValue, resultTypeId);
}
else
{
accessChainPush(&mNodeData.back(), rightValue, resultTypeId);
}
break;
}
case EOpAssign:
{
// Load the right hand side of assignment.
const spirv::IdRef rightValue =
accessChainLoad(&mNodeData.back(), node->getRight()->getType(), nullptr);
mNodeData.pop_back();
// Store into the access chain. Since the result of the (a = b) expression is b, change
// the access chain to an unindexed rvalue which is |rightValue|.
accessChainStore(&mNodeData.back(), rightValue, node->getLeft()->getType());
nodeDataInitRValue(&mNodeData.back(), rightValue, resultTypeId);
break;
}
case EOpComma:
// When the expression a,b is visited, all side effects of a and b are already
// processed. What's left is to to replace the expression with the result of b. This
// is simply done by dropping the left node and placing the right node as the result.
mNodeData.erase(mNodeData.begin() + mNodeData.size() - 2);
break;
default:
const spirv::IdRef result = visitOperator(node, resultTypeId);
mNodeData.pop_back();
nodeDataInitRValue(&mNodeData.back(), result, resultTypeId);
break;
}
return true;
}
bool OutputSPIRVTraverser::visitUnary(Visit visit, TIntermUnary *node)
{
// Constants are expected to be folded.
ASSERT(!node->hasConstantValue());
// Special case EOpArrayLength.
if (node->getOp() == EOpArrayLength)
{
visitArrayLength(node);
// Children already visited.
return false;
}
if (visit == PreVisit)
{
// Don't add an entry to the stack. The child will create one, which we won't pop.
return true;
}
// It's a unary operation, so there can't be an InVisit.
ASSERT(visit != InVisit);
// There is at least on entry for the child.
ASSERT(mNodeData.size() >= 1);
const spirv::IdRef resultTypeId = mBuilder.getTypeData(node->getType(), {}).id;
const spirv::IdRef result = visitOperator(node, resultTypeId);
// Keep the result as rvalue.
nodeDataInitRValue(&mNodeData.back(), result, resultTypeId);
return true;
}
bool OutputSPIRVTraverser::visitTernary(Visit visit, TIntermTernary *node)
{
if (visit == PreVisit)
{
// Don't add an entry to the stack. The condition will create one, which we won't pop.
return true;
}
size_t lastChildIndex = getLastTraversedChildIndex(visit);
// If the condition was just visited, evaluate it and decide if OpSelect could be used or an
// if-else must be emitted. OpSelect is only used if the type is scalar or vector (required by
// OpSelect) and if neither side has a side effect.
const TType &type = node->getType();
const bool canUseOpSelect = (type.isScalar() || type.isVector()) &&
!node->getTrueExpression()->hasSideEffects() &&
!node->getFalseExpression()->hasSideEffects();
if (lastChildIndex == 0)
{
const TType &conditionType = node->getCondition()->getType();
spirv::IdRef typeId;
spirv::IdRef conditionValue = accessChainLoad(&mNodeData.back(), conditionType, &typeId);
// If OpSelect can be used, keep the condition for later usage.
if (canUseOpSelect)
{
// SPIR-V 1.0 requires that the condition value have as many components as the result.
// So when selecting between vectors, we must replicate the condition scalar.
if (type.isVector())
{
const TType &boolVectorType = *StaticType::GetForVec<EbtBool, EbpUndefined>(
EvqGlobal, static_cast<unsigned char>(type.getNominalSize()));
typeId =
mBuilder.getBasicTypeId(conditionType.getBasicType(), type.getNominalSize());
conditionValue = createConstructorVectorFromScalar(conditionType, boolVectorType,
typeId, {{conditionValue}});
}
nodeDataInitRValue(&mNodeData.back(), conditionValue, typeId);
return true;
}
// Otherwise generate an if-else construct.
// Three blocks necessary; the true, false and merge.
mBuilder.startConditional(3, false, false);
// Generate the branch instructions.
const SpirvConditional *conditional = mBuilder.getCurrentConditional();
const spirv::IdRef trueBlockId = conditional->blockIds[0];
const spirv::IdRef falseBlockId = conditional->blockIds[1];
const spirv::IdRef mergeBlockId = conditional->blockIds.back();
mBuilder.writeBranchConditional(conditionValue, trueBlockId, falseBlockId, mergeBlockId);
nodeDataInitRValue(&mNodeData.back(), conditionValue, typeId);
return true;
}
// Load the result of the true or false part, and keep it for the end. It's either used in
// OpSelect or OpPhi.
spirv::IdRef typeId;
const spirv::IdRef value = accessChainLoad(&mNodeData.back(), type, &typeId);
mNodeData.pop_back();
mNodeData.back().idList.push_back(value);
// Additionally store the id of block that has produced the result.
mNodeData.back().idList.push_back(mBuilder.getSpirvCurrentFunctionBlockId());
if (!canUseOpSelect)
{
// Move on to the next block.
mBuilder.writeBranchConditionalBlockEnd();
}
// When done, generate either OpSelect or OpPhi.
if (visit == PostVisit)
{
const spirv::IdRef result = mBuilder.getNewId(mBuilder.getDecorations(node->getType()));
ASSERT(mNodeData.back().idList.size() == 4);
const spirv::IdRef trueValue = mNodeData.back().idList[0].id;
const spirv::IdRef trueBlockId = mNodeData.back().idList[1].id;
const spirv::IdRef falseValue = mNodeData.back().idList[2].id;
const spirv::IdRef falseBlockId = mNodeData.back().idList[3].id;
if (canUseOpSelect)
{
const spirv::IdRef conditionValue = mNodeData.back().baseId;
spirv::WriteSelect(mBuilder.getSpirvCurrentFunctionBlock(), typeId, result,
conditionValue, trueValue, falseValue);
}
else
{
spirv::WritePhi(mBuilder.getSpirvCurrentFunctionBlock(), typeId, result,
{spirv::PairIdRefIdRef{trueValue, trueBlockId},
spirv::PairIdRefIdRef{falseValue, falseBlockId}});
mBuilder.endConditional();
}
// Replace the access chain with an rvalue that's the result.
nodeDataInitRValue(&mNodeData.back(), result, typeId);
}
return true;
}
bool OutputSPIRVTraverser::visitIfElse(Visit visit, TIntermIfElse *node)
{
// An if condition may or may not have an else block. When both blocks are present, the
// translation is as follows:
//
// if (cond) { trueBody } else { falseBody }
//
// // pre-if block
// %cond = ...
// OpSelectionMerge %merge None
// OpBranchConditional %cond %true %false
//
// %true = OpLabel
// trueBody
// OpBranch %merge
//
// %false = OpLabel
// falseBody
// OpBranch %merge
//
// // post-if block
// %merge = OpLabel
//
// If the else block is missing, OpBranchConditional will simply jump to %merge on the false
// condition and the %false block is removed. Due to the way ParseContext prunes compile-time
// constant conditionals, the if block itself may also be missing, which is treated similarly.
// It's simpler if this function performs the traversal.
ASSERT(visit == PreVisit);
// Visit the condition.
node->getCondition()->traverse(this);
const spirv::IdRef conditionValue =
accessChainLoad(&mNodeData.back(), node->getCondition()->getType(), nullptr);
// If both true and false blocks are missing, there's nothing to do.
if (node->getTrueBlock() == nullptr && node->getFalseBlock() == nullptr)
{
return false;
}
// Create a conditional with maximum 3 blocks, one for the true block (if any), one for the
// else block (if any), and one for the merge block. getChildCount() works here as it
// produces an identical count.
mBuilder.startConditional(node->getChildCount(), false, false);
// Generate the branch instructions.
const SpirvConditional *conditional = mBuilder.getCurrentConditional();
const spirv::IdRef mergeBlock = conditional->blockIds.back();
spirv::IdRef trueBlock = mergeBlock;
spirv::IdRef falseBlock = mergeBlock;
size_t nextBlockIndex = 0;
if (node->getTrueBlock())
{
trueBlock = conditional->blockIds[nextBlockIndex++];
}
if (node->getFalseBlock())
{
falseBlock = conditional->blockIds[nextBlockIndex++];
}
mBuilder.writeBranchConditional(conditionValue, trueBlock, falseBlock, mergeBlock);
// Visit the true block, if any.
if (node->getTrueBlock())
{
node->getTrueBlock()->traverse(this);
mBuilder.writeBranchConditionalBlockEnd();
}
// Visit the false block, if any.
if (node->getFalseBlock())
{
node->getFalseBlock()->traverse(this);
mBuilder.writeBranchConditionalBlockEnd();
}
// Pop from the conditional stack when done.
mBuilder.endConditional();
// Don't traverse the children, that's done already.
return false;
}
bool OutputSPIRVTraverser::visitSwitch(Visit visit, TIntermSwitch *node)
{
// Take the following switch:
//
// switch (c)
// {
// case A:
// ABlock;
// break;
// case B:
// default:
// BBlock;
// break;
// case C:
// CBlock;
// // fallthrough
// case D:
// DBlock;
// }
//
// In SPIR-V, this is implemented similarly to the following pseudo-code:
//
// switch c:
// A -> jump %A
// B -> jump %B
// C -> jump %C
// D -> jump %D
// default -> jump %B
//
// %A:
// ABlock
// jump %merge
//
// %B:
// BBlock
// jump %merge
//
// %C:
// CBlock
// jump %D
//
// %D:
// DBlock
// jump %merge
//
// The OpSwitch instruction contains the jump labels for the default and other cases. Each
// block either terminates with a jump to the merge block or the next block as fallthrough.
//
// // pre-switch block
// OpSelectionMerge %merge None
// OpSwitch %cond %C A %A B %B C %C D %D
//
// %A = OpLabel
// ABlock
// OpBranch %merge
//
// %B = OpLabel
// BBlock
// OpBranch %merge
//
// %C = OpLabel
// CBlock
// OpBranch %D
//
// %D = OpLabel
// DBlock
// OpBranch %merge
if (visit == PreVisit)
{
// Don't add an entry to the stack. The condition will create one, which we won't pop.
return true;
}
// If the condition was just visited, evaluate it and create the switch instruction.
if (visit == InVisit)
{
ASSERT(getLastTraversedChildIndex(visit) == 0);
const spirv::IdRef conditionValue =
accessChainLoad(&mNodeData.back(), node->getInit()->getType(), nullptr);
// First, need to find out how many blocks are there in the switch.
const TIntermSequence &statements = *node->getStatementList()->getSequence();
bool lastWasCase = true;
size_t blockIndex = 0;
size_t defaultBlockIndex = std::numeric_limits<size_t>::max();
TVector<uint32_t> caseValues;
TVector<size_t> caseBlockIndices;
for (TIntermNode *statement : statements)
{
TIntermCase *caseLabel = statement->getAsCaseNode();
const bool isCaseLabel = caseLabel != nullptr;
if (isCaseLabel)
{
// For every case label, remember its block index. This is used later to generate
// the OpSwitch instruction.
if (caseLabel->hasCondition())
{
// All switch conditions are literals.
TIntermConstantUnion *condition =
caseLabel->getCondition()->getAsConstantUnion();
ASSERT(condition != nullptr);
TConstantUnion caseValue;
caseValue.cast(EbtUInt, *condition->getConstantValue());
caseValues.push_back(caseValue.getUConst());
caseBlockIndices.push_back(blockIndex);
}
else
{
// Remember the block index of the default case.
defaultBlockIndex = blockIndex;
}
lastWasCase = true;
}
else if (lastWasCase)
{
// Every time a non-case node is visited and the previous statement was a case node,
// it's a new block.
++blockIndex;
lastWasCase = false;
}
}
// Block count is the number of blocks based on cases + 1 for the merge block.
const size_t blockCount = blockIndex + 1;
mBuilder.startConditional(blockCount, false, true);
// Generate the switch instructions.
const SpirvConditional *conditional = mBuilder.getCurrentConditional();
// Generate the list of caseValue->blockIndex mapping used by the OpSwitch instruction. If
// the switch ends in a number of cases with no statements following them, they will
// naturally jump to the merge block!
spirv::PairLiteralIntegerIdRefList switchTargets;
for (size_t caseIndex = 0; caseIndex < caseValues.size(); ++caseIndex)
{
uint32_t value = caseValues[caseIndex];
size_t caseBlockIndex = caseBlockIndices[caseIndex];
switchTargets.push_back(
{spirv::LiteralInteger(value), conditional->blockIds[caseBlockIndex]});
}
const spirv::IdRef mergeBlock = conditional->blockIds.back();
const spirv::IdRef defaultBlock = defaultBlockIndex <= caseValues.size()
? conditional->blockIds[defaultBlockIndex]
: mergeBlock;
mBuilder.writeSwitch(conditionValue, defaultBlock, switchTargets, mergeBlock);
return true;
}
// Terminate the last block if not already and end the conditional.
mBuilder.writeSwitchCaseBlockEnd();
mBuilder.endConditional();
return true;
}
bool OutputSPIRVTraverser::visitCase(Visit visit, TIntermCase *node)
{
ASSERT(visit == PreVisit);
mNodeData.emplace_back();
TIntermBlock *parent = getParentNode()->getAsBlock();
const size_t childIndex = getParentChildIndex(PreVisit);
ASSERT(parent);
const TIntermSequence &parentStatements = *parent->getSequence();
// Check the previous statement. If it was not a |case|, then a new block is being started so
// handle fallthrough:
//
// ...
// statement;
// case X: <--- end the previous block here
// case Y:
//
//
if (childIndex > 0 && parentStatements[childIndex - 1]->getAsCaseNode() == nullptr)
{
mBuilder.writeSwitchCaseBlockEnd();
}
// Don't traverse the condition, as it was processed in visitSwitch.
return false;
}
bool OutputSPIRVTraverser::visitBlock(Visit visit, TIntermBlock *node)
{
// If global block, nothing to do.
if (getCurrentTraversalDepth() == 0)
{
return true;
}
// Any construct that needs code blocks must have already handled creating the necessary blocks
// and setting the right one "current". If there's a block opened in GLSL for scoping reasons,
// it's ignored here as there are no scopes within a function in SPIR-V.
if (visit == PreVisit)
{
return node->getChildCount() > 0;
}
// Any node that needed to generate code has already done so, just clean up its data. If
// the child node has no effect, it's automatically discarded (such as variable.field[n].x,
// side effects of n already having generated code).
//
// Blocks inside blocks like:
//
// {
// statement;
// {
// statement2;
// }
// }
//
// don't generate nodes.
const size_t childIndex = getLastTraversedChildIndex(visit);
const TIntermSequence &statements = *node->getSequence();
if (statements[childIndex]->getAsBlock() == nullptr)
{
mNodeData.pop_back();
}
return true;
}
bool OutputSPIRVTraverser::visitFunctionDefinition(Visit visit, TIntermFunctionDefinition *node)
{
if (visit == PreVisit)
{
return true;
}
// After the prototype is visited, generate the initial code for the function.
if (visit == InVisit)
{
const TFunction *function = node->getFunction();
ASSERT(mFunctionIdMap.count(function) > 0);
const FunctionIds &ids = mFunctionIdMap[function];
// Declare the function.
spirv::WriteFunction(mBuilder.getSpirvFunctions(), ids.returnTypeId, ids.functionId,
spv::FunctionControlMaskNone, ids.functionTypeId);
for (size_t paramIndex = 0; paramIndex < function->getParamCount(); ++paramIndex)
{
const TVariable *paramVariable = function->getParam(paramIndex);
const spirv::IdRef paramId =
mBuilder.getNewId(mBuilder.getDecorations(paramVariable->getType()));
spirv::WriteFunctionParameter(mBuilder.getSpirvFunctions(),
ids.parameterTypeIds[paramIndex], paramId);
// Remember the id of the variable for future look up.
ASSERT(mSymbolIdMap.count(paramVariable) == 0);
mSymbolIdMap[paramVariable] = paramId;
spirv::WriteName(mBuilder.getSpirvDebug(), paramId,
mBuilder.hashName(paramVariable).data());
}
mBuilder.startNewFunction(ids.functionId, function);
return true;
}
// If no explicit return was specified, add one automatically here.
if (!mBuilder.isCurrentFunctionBlockTerminated())
{
if (node->getFunction()->getReturnType().getBasicType() == EbtVoid)
{
spirv::WriteReturn(mBuilder.getSpirvCurrentFunctionBlock());
}
else
{
// GLSL allows functions expecting a return value to miss a return. In that case,
// return a null constant.
const TFunction *function = node->getFunction();
const TType &returnType = function->getReturnType();
spirv::IdRef nullConstant;
if (returnType.isScalar() && !returnType.isArray())
{
switch (function->getReturnType().getBasicType())
{
case EbtFloat:
nullConstant = mBuilder.getFloatConstant(0);
break;
case EbtUInt:
nullConstant = mBuilder.getUintConstant(0);
break;
case EbtInt:
nullConstant = mBuilder.getIntConstant(0);
break;
default:
break;
}
}
if (!nullConstant.valid())
{
nullConstant = mBuilder.getNullConstant(mFunctionIdMap[function].returnTypeId);
}
spirv::WriteReturnValue(mBuilder.getSpirvCurrentFunctionBlock(), nullConstant);
}
mBuilder.terminateCurrentFunctionBlock();
}
mBuilder.assembleSpirvFunctionBlocks();
// End the function
spirv::WriteFunctionEnd(mBuilder.getSpirvFunctions());
return true;
}
bool OutputSPIRVTraverser::visitGlobalQualifierDeclaration(Visit visit,
TIntermGlobalQualifierDeclaration *node)
{
if (node->isPrecise())
{
// Nothing to do for |precise|.
return false;
}
// Global qualifier declarations apply to variables that are already declared. Invariant simply
// adds a decoration to the variable declaration, which can be done right away. Note that
// invariant cannot be applied to block members like this, except for gl_PerVertex built-ins,
// which are applied to the members directly by DeclarePerVertexBlocks.
ASSERT(node->isInvariant());
const TVariable *variable = &node->getSymbol()->variable();
ASSERT(mSymbolIdMap.count(variable) > 0);
const spirv::IdRef variableId = mSymbolIdMap[variable];
spirv::WriteDecorate(mBuilder.getSpirvDecorations(), variableId, spv::DecorationInvariant, {});
return false;
}
void OutputSPIRVTraverser::visitFunctionPrototype(TIntermFunctionPrototype *node)
{
const TFunction *function = node->getFunction();
// If the function was previously forward declared, skip this.
if (mFunctionIdMap.count(function) > 0)
{
return;
}
FunctionIds ids;
// Declare the function type
ids.returnTypeId = mBuilder.getTypeData(function->getReturnType(), {}).id;
spirv::IdRefList paramTypeIds;
for (size_t paramIndex = 0; paramIndex < function->getParamCount(); ++paramIndex)
{
const TType ¶mType = function->getParam(paramIndex)->getType();
spirv::IdRef paramId = mBuilder.getTypeData(paramType, {}).id;
// const function parameters are intermediate values, while the rest are "variables"
// with the Function storage class.
if (paramType.getQualifier() != EvqParamConst)
{
const spv::StorageClass storageClass = IsOpaqueType(paramType.getBasicType())
? spv::StorageClassUniformConstant
: spv::StorageClassFunction;
paramId = mBuilder.getTypePointerId(paramId, storageClass);
}
ids.parameterTypeIds.push_back(paramId);
}
ids.functionTypeId = mBuilder.getFunctionTypeId(ids.returnTypeId, ids.parameterTypeIds);
// Allocate an id for the function up-front.
//
// Apply decorations to the return value of the function by applying them to the OpFunction
// instruction.
ids.functionId = mBuilder.getNewId(mBuilder.getDecorations(function->getReturnType()));
// Remember the ID of main() for the sake of OpEntryPoint.
if (function->isMain())
{
mBuilder.setEntryPointId(ids.functionId);
}
// Remember the id of the function for future look up.
mFunctionIdMap[function] = ids;
}
bool OutputSPIRVTraverser::visitAggregate(Visit visit, TIntermAggregate *node)
{
// Constants are expected to be folded. However, large constructors (such as arrays) are not
// folded and are handled here.
ASSERT(node->getOp() == EOpConstruct || !node->hasConstantValue());
if (visit == PreVisit)
{
mNodeData.emplace_back();
return true;
}
// Keep the parameters on the stack. If a function call contains out or inout parameters, we
// need to know the access chains for the eventual write back to them.
if (visit == InVisit)
{
return true;
}
// Expect to have accumulated as many parameters as the node requires.
ASSERT(mNodeData.size() > node->getChildCount());
const spirv::IdRef resultTypeId = mBuilder.getTypeData(node->getType(), {}).id;
spirv::IdRef result;
switch (node->getOp())
{
case EOpConstruct:
// Construct a value out of the accumulated parameters.
result = createConstructor(node, resultTypeId);
break;
case EOpCallFunctionInAST:
// Create a call to the function.
result = createFunctionCall(node, resultTypeId);
break;
// For barrier functions the scope is device, or with the Vulkan memory model, the queue
// family. We don't use the Vulkan memory model.
case EOpBarrier:
spirv::WriteControlBarrier(
mBuilder.getSpirvCurrentFunctionBlock(),
mBuilder.getUintConstant(spv::ScopeWorkgroup),
mBuilder.getUintConstant(spv::ScopeWorkgroup),
mBuilder.getUintConstant(spv::MemorySemanticsWorkgroupMemoryMask |
spv::MemorySemanticsAcquireReleaseMask));
break;
case EOpBarrierTCS:
// Note: The memory scope and semantics are different with the Vulkan memory model,
// which is not supported.
spirv::WriteControlBarrier(mBuilder.getSpirvCurrentFunctionBlock(),
mBuilder.getUintConstant(spv::ScopeWorkgroup),
mBuilder.getUintConstant(spv::ScopeInvocation),
mBuilder.getUintConstant(spv::MemorySemanticsMaskNone));
break;
case EOpMemoryBarrier:
case EOpGroupMemoryBarrier:
{
const spv::Scope scope =
node->getOp() == EOpMemoryBarrier ? spv::ScopeDevice : spv::ScopeWorkgroup;
spirv::WriteMemoryBarrier(
mBuilder.getSpirvCurrentFunctionBlock(), mBuilder.getUintConstant(scope),
mBuilder.getUintConstant(spv::MemorySemanticsUniformMemoryMask |
spv::MemorySemanticsWorkgroupMemoryMask |
spv::MemorySemanticsImageMemoryMask |
spv::MemorySemanticsAcquireReleaseMask));
break;
}
case EOpMemoryBarrierBuffer:
spirv::WriteMemoryBarrier(
mBuilder.getSpirvCurrentFunctionBlock(), mBuilder.getUintConstant(spv::ScopeDevice),
mBuilder.getUintConstant(spv::MemorySemanticsUniformMemoryMask |
spv::MemorySemanticsAcquireReleaseMask));
break;
case EOpMemoryBarrierImage:
spirv::WriteMemoryBarrier(
mBuilder.getSpirvCurrentFunctionBlock(), mBuilder.getUintConstant(spv::ScopeDevice),
mBuilder.getUintConstant(spv::MemorySemanticsImageMemoryMask |
spv::MemorySemanticsAcquireReleaseMask));
break;
case EOpMemoryBarrierShared:
spirv::WriteMemoryBarrier(
mBuilder.getSpirvCurrentFunctionBlock(), mBuilder.getUintConstant(spv::ScopeDevice),
mBuilder.getUintConstant(spv::MemorySemanticsWorkgroupMemoryMask |
spv::MemorySemanticsAcquireReleaseMask));
break;
case EOpMemoryBarrierAtomicCounter:
// Atomic counters are emulated.
UNREACHABLE();
break;
case EOpEmitVertex:
spirv::WriteEmitVertex(mBuilder.getSpirvCurrentFunctionBlock());
break;
case EOpEndPrimitive:
spirv::WriteEndPrimitive(mBuilder.getSpirvCurrentFunctionBlock());
break;
case EOpEmitStreamVertex:
case EOpEndStreamPrimitive:
// TODO: support desktop GLSL. http://anglebug.com/6197
UNIMPLEMENTED();
break;
default:
result = visitOperator(node, resultTypeId);
break;
}
// Pop the parameters.
mNodeData.resize(mNodeData.size() - node->getChildCount());
// Keep the result as rvalue.
nodeDataInitRValue(&mNodeData.back(), result, resultTypeId);
return false;
}
bool OutputSPIRVTraverser::visitDeclaration(Visit visit, TIntermDeclaration *node)
{
const TIntermSequence &sequence = *node->getSequence();
// Enforced by ValidateASTOptions::validateMultiDeclarations.
ASSERT(sequence.size() == 1);
// Declare specialization constants especially; they don't require processing the left and right
// nodes, and they are like constant declarations with special instructions and decorations.
const TQualifier qualifier = sequence.front()->getAsTyped()->getType().getQualifier();
if (qualifier == EvqSpecConst)
{
declareSpecConst(node);
return false;
}
// Similarly, constant declarations are turned into actual constants.
if (qualifier == EvqConst)
{
declareConst(node);
return false;
}
// Skip redeclaration of builtins. They will correctly declare as built-in on first use.
if (mInGlobalScope && (qualifier == EvqClipDistance || qualifier == EvqCullDistance))
{
return false;
}
if (!mInGlobalScope && visit == PreVisit)
{
mNodeData.emplace_back();
}
mIsSymbolBeingDeclared = visit == PreVisit;
if (visit != PostVisit)
{
return true;
}
TIntermSymbol *symbol = sequence.front()->getAsSymbolNode();
spirv::IdRef initializerId;
bool initializeWithDeclaration = false;
// Handle declarations with initializer.
if (symbol == nullptr)
{
TIntermBinary *assign = sequence.front()->getAsBinaryNode();
ASSERT(assign != nullptr && assign->getOp() == EOpInitialize);
symbol = assign->getLeft()->getAsSymbolNode();
ASSERT(symbol != nullptr);
// In SPIR-V, it's only possible to initialize a variable together with its declaration if
// the initializer is a constant or a global variable. We ignore the global variable case
// to avoid tracking whether the variable has been modified since the beginning of the
// function. Since variable declarations are always placed at the beginning of the function
// in SPIR-V, it would be wrong for example to initialize |var| below with the global
// variable at declaration time:
//
// vec4 global = A;
// void f()
// {
// global = B;
// {
// vec4 var = global;
// }
// }
//
// So the initializer is only used when declarating a variable when it's a constant
// expression. Note that if the variable being declared is itself global (and the
// initializer is not constant), a previous AST transformation (DeferGlobalInitializers)
// makes sure their initialization is deferred to the beginning of main.
//
// Additionally, if the variable is being defined inside a loop, the initializer is not used
// as that would prevent it from being reintialized in the next iteration of the loop.
TIntermTyped *initializer = assign->getRight();
initializeWithDeclaration =
!mBuilder.isInLoop() &&
(initializer->getAsConstantUnion() != nullptr || initializer->hasConstantValue());
if (initializeWithDeclaration)
{
// If a constant, take the Id directly.
initializerId = mNodeData.back().baseId;
}
else
{
// Otherwise generate code to load from right hand side expression.
initializerId = accessChainLoad(&mNodeData.back(), symbol->getType(), nullptr);
}
// Clean up the initializer data.
mNodeData.pop_back();
}
const TType &type = symbol->getType();
const TVariable *variable = &symbol->variable();
// If this is just a struct declaration (and not a variable declaration), don't declare the
// struct up-front and let it be lazily defined. If the struct is only used inside an interface
// block for example, this avoids it being doubly defined (once with the unspecified block
// storage and once with interface block's).
if (type.isStructSpecifier() && variable->symbolType() == SymbolType::Empty)
{
return false;
}
const spirv::IdRef typeId = mBuilder.getTypeData(type, {}).id;
spv::StorageClass storageClass = GetStorageClass(type, mCompiler->getShaderType());
SpirvDecorations decorations = mBuilder.getDecorations(type);
if (mBuilder.isInvariantOutput(type))
{
// Apply the Invariant decoration to output variables if specified or if globally enabled.
decorations.push_back(spv::DecorationInvariant);
}
const spirv::IdRef variableId = mBuilder.declareVariable(
typeId, storageClass, decorations, initializeWithDeclaration ? &initializerId : nullptr,
mBuilder.hashName(variable).data());
if (!initializeWithDeclaration && initializerId.valid())
{
// If not initializing at the same time as the declaration, issue a store instruction.
spirv::WriteStore(mBuilder.getSpirvCurrentFunctionBlock(), variableId, initializerId,
nullptr);
}
const bool isShaderInOut = IsShaderIn(type.getQualifier()) || IsShaderOut(type.getQualifier());
const bool isInterfaceBlock = type.getBasicType() == EbtInterfaceBlock;
// Add decorations, which apply to the element type of arrays, if array.
spirv::IdRef nonArrayTypeId = typeId;
if (type.isArray() && (isShaderInOut || isInterfaceBlock))
{
SpirvType elementType = mBuilder.getSpirvType(type, {});
elementType.arraySizes = {};
nonArrayTypeId = mBuilder.getSpirvTypeData(elementType, nullptr).id;
}
if (isShaderInOut)
{
// Add in and out variables to the list of interface variables.
mBuilder.addEntryPointInterfaceVariableId(variableId);
if (IsShaderIoBlock(type.getQualifier()) && type.isInterfaceBlock())
{
// For gl_PerVertex in particular, write the necessary BuiltIn decorations
if (type.getQualifier() == EvqPerVertexIn || type.getQualifier() == EvqPerVertexOut)
{
mBuilder.writePerVertexBuiltIns(type, nonArrayTypeId);
}
// I/O blocks are decorated with Block
spirv::WriteDecorate(mBuilder.getSpirvDecorations(), nonArrayTypeId,
spv::DecorationBlock, {});
}
else if (type.getQualifier() == EvqPatchIn || type.getQualifier() == EvqPatchOut)
{
// Tessellation shaders can have their input or output qualified with |patch|. For I/O
// blocks, the members are decorated instead.
spirv::WriteDecorate(mBuilder.getSpirvDecorations(), variableId, spv::DecorationPatch,
{});
}
}
else if (isInterfaceBlock)
{
// For uniform and buffer variables, add Block and BufferBlock decorations respectively.
const spv::Decoration decoration =
type.getQualifier() == EvqUniform ? spv::DecorationBlock : spv::DecorationBufferBlock;
spirv::WriteDecorate(mBuilder.getSpirvDecorations(), nonArrayTypeId, decoration, {});
}
// Write DescriptorSet, Binding, Location etc decorations if necessary.
mBuilder.writeInterfaceVariableDecorations(type, variableId);
// Remember the id of the variable for future look up. For interface blocks, also remember the
// id of the interface block.
ASSERT(mSymbolIdMap.count(variable) == 0);
mSymbolIdMap[variable] = variableId;
if (type.isInterfaceBlock())
{
ASSERT(mSymbolIdMap.count(type.getInterfaceBlock()) == 0);
mSymbolIdMap[type.getInterfaceBlock()] = variableId;
}
return false;
}
void GetLoopBlocks(const SpirvConditional *conditional,
TLoopType loopType,
bool hasCondition,
spirv::IdRef *headerBlock,
spirv::IdRef *condBlock,
spirv::IdRef *bodyBlock,
spirv::IdRef *continueBlock,
spirv::IdRef *mergeBlock)
{
// The order of the blocks is for |for| and |while|:
//
// %header %cond [optional] %body %continue %merge
//
// and for |do-while|:
//
// %header %body %cond %merge
//
// Note that the |break| target is always the last block and the |continue| target is the one
// before last.
//
// If %continue is not present, all jumps are made to %cond (which is necessarily present).
// If %cond is not present, all jumps are made to %body instead.
size_t nextBlock = 0;
*headerBlock = conditional->blockIds[nextBlock++];
// %cond, if any is after header except for |do-while|.
if (loopType != ELoopDoWhile && hasCondition)
{
*condBlock = conditional->blockIds[nextBlock++];
}
*bodyBlock = conditional->blockIds[nextBlock++];
// After the block is either %cond or %continue based on |do-while| or not.
if (loopType != ELoopDoWhile)
{
*continueBlock = conditional->blockIds[nextBlock++];
}
else
{
*condBlock = conditional->blockIds[nextBlock++];
}
*mergeBlock = conditional->blockIds[nextBlock++];
ASSERT(nextBlock == conditional->blockIds.size());
if (!continueBlock->valid())
{
ASSERT(condBlock->valid());
*continueBlock = *condBlock;
}
if (!condBlock->valid())
{
*condBlock = *bodyBlock;
}
}
bool OutputSPIRVTraverser::visitLoop(Visit visit, TIntermLoop *node)
{
// There are three kinds of loops, and they translate as such:
//
// for (init; cond; expr) body;
//
// // pre-loop block
// init
// OpBranch %header
//
// %header = OpLabel
// OpLoopMerge %merge %continue None
// OpBranch %cond
//
// // Note: if cond doesn't exist, this section is not generated. The above
// // OpBranch would jump directly to %body.
// %cond = OpLabel
// %v = cond
// OpBranchConditional %v %body %merge None
//
// %body = OpLabel
// body
// OpBranch %continue
//
// %continue = OpLabel
// expr
// OpBranch %header
//
// // post-loop block
// %merge = OpLabel
//
//
// while (cond) body;
//
// // pre-for block
// OpBranch %header
//
// %header = OpLabel
// OpLoopMerge %merge %continue None
// OpBranch %cond
//
// %cond = OpLabel
// %v = cond
// OpBranchConditional %v %body %merge None
//
// %body = OpLabel
// body
// OpBranch %continue
//
// %continue = OpLabel
// OpBranch %header
//
// // post-loop block
// %merge = OpLabel
//
//
// do body; while (cond);
//
// // pre-for block
// OpBranch %header
//
// %header = OpLabel
// OpLoopMerge %merge %cond None
// OpBranch %body
//
// %body = OpLabel
// body
// OpBranch %cond
//
// %cond = OpLabel
// %v = cond
// OpBranchConditional %v %header %merge None
//
// // post-loop block
// %merge = OpLabel
//
// The order of the blocks is not necessarily the same as traversed, so it's much simpler if
// this function enforces traversal in the right order.
ASSERT(visit == PreVisit);
mNodeData.emplace_back();
const TLoopType loopType = node->getType();
// The init statement of a for loop is placed in the previous block, so continue generating code
// as-is until that statement is done.
if (node->getInit())
{
ASSERT(loopType == ELoopFor);
node->getInit()->traverse(this);
mNodeData.pop_back();
}
const bool hasCondition = node->getCondition() != nullptr;
// Once the init node is visited, if any, we need to set up the loop.
//
// For |for| and |while|, we need %header, %body, %continue and %merge. For |do-while|, we
// need %header, %body and %merge. If condition is present, an additional %cond block is
// needed in each case.
const size_t blockCount = (loopType == ELoopDoWhile ? 3 : 4) + (hasCondition ? 1 : 0);
mBuilder.startConditional(blockCount, true, true);
// Generate the %header block.
const SpirvConditional *conditional = mBuilder.getCurrentConditional();
spirv::IdRef headerBlock, condBlock, bodyBlock, continueBlock, mergeBlock;
GetLoopBlocks(conditional, loopType, hasCondition, &headerBlock, &condBlock, &bodyBlock,
&continueBlock, &mergeBlock);
mBuilder.writeLoopHeader(loopType == ELoopDoWhile ? bodyBlock : condBlock, continueBlock,
mergeBlock);
// %cond, if any is after header except for |do-while|.
if (loopType != ELoopDoWhile && hasCondition)
{
node->getCondition()->traverse(this);
// Generate the branch at the end of the %cond block.
const spirv::IdRef conditionValue =
accessChainLoad(&mNodeData.back(), node->getCondition()->getType(), nullptr);
mBuilder.writeLoopConditionEnd(conditionValue, bodyBlock, mergeBlock);
mNodeData.pop_back();
}
// Next comes %body.
{
node->getBody()->traverse(this);
// Generate the branch at the end of the %body block.
mBuilder.writeLoopBodyEnd(continueBlock);
}
switch (loopType)
{
case ELoopFor:
// For |for| loops, the expression is placed after the body and acts as the continue
// block.
if (node->getExpression())
{
node->getExpression()->traverse(this);
mNodeData.pop_back();
}
// Generate the branch at the end of the %continue block.
mBuilder.writeLoopContinueEnd(headerBlock);
break;
case ELoopWhile:
// |for| loops have the expression in the continue block and |do-while| loops have their
// condition block act as the loop's continue block. |while| loops need a branch-only
// continue loop, which is generated here.
mBuilder.writeLoopContinueEnd(headerBlock);
break;
case ELoopDoWhile:
// For |do-while|, %cond comes last.
ASSERT(hasCondition);
node->getCondition()->traverse(this);
// Generate the branch at the end of the %cond block.
const spirv::IdRef conditionValue =
accessChainLoad(&mNodeData.back(), node->getCondition()->getType(), nullptr);
mBuilder.writeLoopConditionEnd(conditionValue, headerBlock, mergeBlock);
mNodeData.pop_back();
break;
}
// Pop from the conditional stack when done.
mBuilder.endConditional();
// Don't traverse the children, that's done already.
return false;
}
bool OutputSPIRVTraverser::visitBranch(Visit visit, TIntermBranch *node)
{
if (visit == PreVisit)
{
mNodeData.emplace_back();
return true;
}
// There is only ever one child at most.
ASSERT(visit != InVisit);
switch (node->getFlowOp())
{
case EOpKill:
spirv::WriteKill(mBuilder.getSpirvCurrentFunctionBlock());
mBuilder.terminateCurrentFunctionBlock();
break;
case EOpBreak:
spirv::WriteBranch(mBuilder.getSpirvCurrentFunctionBlock(),
mBuilder.getBreakTargetId());
mBuilder.terminateCurrentFunctionBlock();
break;
case EOpContinue:
spirv::WriteBranch(mBuilder.getSpirvCurrentFunctionBlock(),
mBuilder.getContinueTargetId());
mBuilder.terminateCurrentFunctionBlock();
break;
case EOpReturn:
// Evaluate the expression if any, and return.
if (node->getExpression() != nullptr)
{
ASSERT(mNodeData.size() >= 1);
const spirv::IdRef expressionValue =
accessChainLoad(&mNodeData.back(), node->getExpression()->getType(), nullptr);
mNodeData.pop_back();
spirv::WriteReturnValue(mBuilder.getSpirvCurrentFunctionBlock(), expressionValue);
mBuilder.terminateCurrentFunctionBlock();
}
else
{
spirv::WriteReturn(mBuilder.getSpirvCurrentFunctionBlock());
mBuilder.terminateCurrentFunctionBlock();
}
break;
default:
UNREACHABLE();
}
return true;
}
void OutputSPIRVTraverser::visitPreprocessorDirective(TIntermPreprocessorDirective *node)
{
// No preprocessor directives expected at this point.
UNREACHABLE();
}
spirv::Blob OutputSPIRVTraverser::getSpirv()
{
spirv::Blob result = mBuilder.getSpirv();
// Validate that correct SPIR-V was generated
ASSERT(spirv::Validate(result));
#if ANGLE_DEBUG_SPIRV_GENERATION
// Disassemble and log the generated SPIR-V for debugging.
spvtools::SpirvTools spirvTools(SPV_ENV_VULKAN_1_1);
std::string readableSpirv;
spirvTools.Disassemble(result, &readableSpirv, 0);
fprintf(stderr, "%s\n", readableSpirv.c_str());
#endif // ANGLE_DEBUG_SPIRV_GENERATION
return result;
}
} // anonymous namespace
bool OutputSPIRV(TCompiler *compiler, TIntermBlock *root, ShCompileOptions compileOptions)
{
// Find the list of nodes that require NoContraction (as a result of |precise|).
if (compiler->hasAnyPreciseType())
{
FindPreciseNodes(compiler, root);
}
// Traverse the tree and generate SPIR-V instructions
OutputSPIRVTraverser traverser(compiler, compileOptions);
root->traverse(&traverser);
// Generate the final SPIR-V and store in the sink
spirv::Blob spirvBlob = traverser.getSpirv();
compiler->getInfoSink().obj.setBinary(std::move(spirvBlob));
return true;
}
} // namespace sh
| [
"angle-scoped@luci-project-accounts.iam.gserviceaccount.com"
] | angle-scoped@luci-project-accounts.iam.gserviceaccount.com |
16ad139dd7e467cc908236453288c46ab6662f33 | 86c6f65a28d13c2dce7c3d3f75d2f0f21a38c240 | /src/DBManager.h | 3ba003b7733aa01d386567149c2350e6441d4ecd | [] | no_license | LiamAshdown/Quad-AutoLogin | 303cc5d3f8216330a11a6fb34aaa1d43a31bb053 | d6c33d4e05f1a2fc07c76dfcf83d6bac3f77f52a | refs/heads/master | 2021-10-20T06:34:55.341794 | 2019-02-26T10:25:52 | 2019-02-26T10:25:52 | 172,688,939 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,478 | h | #include "mysql_connection.h"
#include "mysql_driver.h"
#include <cppconn/driver.h>
#include <cppconn/exception.h>
#include <cppconn/resultset.h>
#include <cppconn/statement.h>
#include <cppconn/prepared_statement.h>
#include <iostream>
#include <string>
#include <vector>
#pragma once
class DBManager
{
public:
DBManager(const char* DbUser, const char* DbPass, const unsigned int port, const char* DbHost, const char* Dbase) :
Username(DbUser), Password(DbPass), DbPort(port), DBHost(DbHost), DbName(Dbase) {}
~DBManager();
bool ConnectToDB();
unsigned long int const GetRowCount();
std::vector<std::pair<std::string, std::string>> GetUserContainer() { return rawContainer; }
void InsertAccount(const char* username, const char* password, const char* serverName);
bool CheckAccountExist(const char* username, const char* password, const char* serverName);
private:
sql::mysql::MySQL_Driver* driver;
sql::Connection *Con;
sql::PreparedStatement *pstmt;
sql::ResultSet *res;
sql::Statement *stmt;
protected:
const unsigned int DbPort;
const char* Username;
const char* Password;
const char* DBHost;
const char* DbName;
unsigned long TotalRowCount;
std::vector<std::pair<std::string, std::string>> rawContainer;
protected:
void ManageException(sql::SQLException& e);
void LoadRowCount();
void LoadIntoContainer();
std::string GetStringField(const std::string& Field);
};
| [
"liam-ashdown@outlook.com"
] | liam-ashdown@outlook.com |
e462834d0c1954081591f73401e5b542faff32c4 | 87de63798f786e8f32c171554f16cc1cb05bd61f | /SystemModels/Systems/BloodSystem/BodyBioChemBloodSys.cpp | be500a9122a72cd9207b97412bda96d627ccb790 | [] | no_license | avgolov/virtual-human | a0bd4d88b0c76f8f9c0fbf795e9c0e3ccff43d60 | 82636e04489efad9efe57077b8e6369d8cf5feff | refs/heads/master | 2021-07-17T17:15:47.189088 | 2017-10-24T08:57:21 | 2017-10-24T08:57:21 | 108,100,427 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,627 | cpp | #include "BodyBioChemBloodSys.h"
namespace SystemModels
{
void BodyBioChemBloodSys::Compute(TimeSpan* timeSpan) {
SetOldValues();
}
void BodyBioChemBloodSys::SetParam(BloodSysParam param, double value)
{
switch (param)
{
case AllVol: {
SetVolume(value);
break;
}
//fractions
case O2Art: {
SetO2(value);
break;
}
case Co2Art: {
SetCo2(value);
break;
}
default:
throw std::exception("Wrong for setting blood system's parameter");
}
}
double BodyBioChemBloodSys::GetParam(BloodSysParam param) const
{
switch (param)
{
case O2Art: {
return GetO2();
}
case Co2Art: {
return GetCo2();
}
case O2ArtOld: {
return GetO2Old();
}
case Co2ArtOld: {
return GetCo2Old();
}
case HArt: {
return GetH();
}
case Hco3Art: {
return GetHCo3();
}
case HbArt: {
return GetHb();
}
case PhArt: {
return -log10(GetH());
}
case SysArtO2Sat: {
return 100.*GetHb() / GetHbTot();
}
case Po2Art: {
return GetO2Free() / GetSolCoefO2();
}
case Pco2Art: {
return GetCo2Free() / GetSolCoefCo2();
}
case Po2ArtOld: {
return GetO2FreeOld() / GetSolCoefO2();
}
case Pco2ArtOld: {
return GetCo2FreeOld() / GetSolCoefCo2();
}
case AllVol: {
return GetVolume();
}
default:
throw std::exception("Bad blood system's parameter!");
}
}
void BodyBioChemBloodSys::SetSubstances(std::valarray<double> substances)
{
if (substances.size() == 5) {
substances_ = substances;
}
else {
throw std::exception("Wrong substances number");
}
};
double BodyBioChemBloodSys::GetCo2FreeOld() const {
/*[CO2] = [CO2free]+[HCO3-] in mols*/
return GetCo2Old() / litMolCoef_ - GetHCo3Old();
}
double BodyBioChemBloodSys::GetO2FreeOld() const {
/*[O2] = [O2free]+m[Hb] in mols*/
return GetO2Old() / litMolCoef_ - hillConst_*GetHbOld();
}
double BodyBioChemBloodSys::GetCo2Free() const {
return GetCo2() / litMolCoef_ - GetHCo3();
}
double BodyBioChemBloodSys::GetO2Free() const {
return GetO2() / litMolCoef_ - hillConst_*GetHb();
}
void BodyBioChemBloodSys::SetO2Free(double value) {
auto hb = hbTot_*pow(value, hillConst_) / (kO2Hb_ + pow(value, hillConst_));
SetHb(hb);
auto o2 = (value + hillConst_*hb)*litMolCoef_;
SetO2(o2);
}
void BodyBioChemBloodSys::SetHco3(double value) {
auto m = GetHCo3() - GetH();
substances_[3] = value;
auto h = value - m;
SetH(h);
auto co2 = (value*h/kCo2Bb_);
SetCo2((co2 + value)*litMolCoef_);
}
} | [
"golov.andrey@hotmail.com"
] | golov.andrey@hotmail.com |
c9fc9c403728f6ddf5d887f69164abc20a7ee341 | 24c15f237750892c906c420e0a4f10c29c458012 | /vectorMatrix/vector.h | 178be555fd406d8f29f2c8ebafd726f07615650e | [] | no_license | Celelibi/CPOA | 8c0beb19795275c5ebaca7d462a53bb7c2e4e054 | 951b396082c9c0873bd95deff707318b8fb65207 | refs/heads/master | 2021-01-18T00:13:32.738943 | 2014-01-13T23:48:18 | 2014-01-13T23:48:18 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,712 | h | #ifndef VECTOR_H
#define VECTOR_H
#include "array.h"
/**
* class that manage template Vectors
*/
template< unsigned int N, typename T>
class Vector: public Array<N,T>
{
public:
/**
* @brief Default constructor
*/
Vector();
/**
* @brief copy constructor from other type of array/vector (same size)
*/
template<typename T2>
Vector(const Array<N,T2>& vec);
/**
* @brief operator +
* @param v
* @return
*/
Vector operator+(const Vector<N,T>& v) const;
/**
* @brief operator -
* @param v
* @return
*/
Vector operator-(const Vector<N,T>& v) const;
/**
* @brief operator +=
* @param v
* @return
*/
Vector& operator+=(const Vector<N,T>& v);
/**
* @brief operator -=
* @param v
* @return
*/
Vector& operator-=(const Vector<N,T>& v);
/**
* @brief operator *=
* @param v
* @return
*/
Vector& operator*=(const T& val);
/**
* @brief operator *=
* @param v
* @return
*/
Vector& operator/=(const T& val);
/**
* @brief operator *
* @param val
* @return
*/
Vector operator*(const T& val) const;
/**
* @brief operator /
* @param val
* @return
*/
Vector operator/(const T& val) const;
};
template <unsigned int N, typename T>
Vector<N, T> operator*(const T& a, const Vector<N,T>& v);
// typedefs
typedef Vector<2,int> Vec2i;
typedef Vector<3,int> Vec3i;
typedef Vector<4,int> Vec4i;
typedef Vector<2,unsigned int> Vec2ui;
typedef Vector<3,unsigned int> Vec3ui;
typedef Vector<4,unsigned int> Vec4ui;
typedef Vector<4,float> Vec4f;
typedef Vector<2,double> Vec2d;
typedef Vector<3,double> Vec3d;
typedef Vector<4,double> Vec4d;
#ifndef NO_TEMPLATE_IMPLEMENTATION
#include "vector.hpp"
#endif
#endif // VECTOR_H
| [
"snqke@Kigle.(none)"
] | snqke@Kigle.(none) |
89bf851cf9a1797af6ff2f228801a9edd841bd97 | 8ecdbfc9e5ec00098200cb0335a97ee756ffab61 | /games-generated/Stencyl_Vertical_Shooter/Export/windows/obj/src/openfl/events/UncaughtErrorEvents.cpp | dfb13d59aca86c137914227500c4b60abec765d5 | [] | no_license | elsandkls/Stencyl_VerticalSpaceShooter | 89ccaafe717297a2620d6b777441e67f8751f0ec | 87e501dcca05eaa5f8aeacc9f563b5d5080ffb53 | refs/heads/master | 2021-07-06T11:08:31.016728 | 2020-10-01T05:57:11 | 2020-10-01T05:57:11 | 184,013,592 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | true | 3,697 | cpp | // Generated by Haxe 3.4.7
#include <hxcpp.h>
#ifndef INCLUDED_openfl_events_EventDispatcher
#include <openfl/events/EventDispatcher.h>
#endif
#ifndef INCLUDED_openfl_events_IEventDispatcher
#include <openfl/events/IEventDispatcher.h>
#endif
#ifndef INCLUDED_openfl_events_UncaughtErrorEvents
#include <openfl/events/UncaughtErrorEvents.h>
#endif
HX_DEFINE_STACK_FRAME(_hx_pos_f614a07866ea6e55_15_new,"openfl.events.UncaughtErrorEvents","new",0xf17d0a07,"openfl.events.UncaughtErrorEvents.new","openfl/events/UncaughtErrorEvents.hx",15,0x17415d69)
namespace openfl{
namespace events{
void UncaughtErrorEvents_obj::__construct(){
HX_STACKFRAME(&_hx_pos_f614a07866ea6e55_15_new)
HXDLIN( 15) super::__construct(null());
}
Dynamic UncaughtErrorEvents_obj::__CreateEmpty() { return new UncaughtErrorEvents_obj; }
void *UncaughtErrorEvents_obj::_hx_vtable = 0;
Dynamic UncaughtErrorEvents_obj::__Create(hx::DynamicArray inArgs)
{
hx::ObjectPtr< UncaughtErrorEvents_obj > _hx_result = new UncaughtErrorEvents_obj();
_hx_result->__construct();
return _hx_result;
}
bool UncaughtErrorEvents_obj::_hx_isInstanceOf(int inClassId) {
if (inClassId<=(int)0x0dd4339f) {
return inClassId==(int)0x00000001 || inClassId==(int)0x0dd4339f;
} else {
return inClassId==(int)0x1b123bf8;
}
}
hx::ObjectPtr< UncaughtErrorEvents_obj > UncaughtErrorEvents_obj::__new() {
hx::ObjectPtr< UncaughtErrorEvents_obj > __this = new UncaughtErrorEvents_obj();
__this->__construct();
return __this;
}
hx::ObjectPtr< UncaughtErrorEvents_obj > UncaughtErrorEvents_obj::__alloc(hx::Ctx *_hx_ctx) {
UncaughtErrorEvents_obj *__this = (UncaughtErrorEvents_obj*)(hx::Ctx::alloc(_hx_ctx, sizeof(UncaughtErrorEvents_obj), true, "openfl.events.UncaughtErrorEvents"));
*(void **)__this = UncaughtErrorEvents_obj::_hx_vtable;
__this->__construct();
return __this;
}
UncaughtErrorEvents_obj::UncaughtErrorEvents_obj()
{
}
#if HXCPP_SCRIPTABLE
static hx::StorageInfo *UncaughtErrorEvents_obj_sMemberStorageInfo = 0;
static hx::StaticInfo *UncaughtErrorEvents_obj_sStaticStorageInfo = 0;
#endif
static void UncaughtErrorEvents_obj_sMarkStatics(HX_MARK_PARAMS) {
HX_MARK_MEMBER_NAME(UncaughtErrorEvents_obj::__mClass,"__mClass");
};
#ifdef HXCPP_VISIT_ALLOCS
static void UncaughtErrorEvents_obj_sVisitStatics(HX_VISIT_PARAMS) {
HX_VISIT_MEMBER_NAME(UncaughtErrorEvents_obj::__mClass,"__mClass");
};
#endif
hx::Class UncaughtErrorEvents_obj::__mClass;
void UncaughtErrorEvents_obj::__register()
{
hx::Object *dummy = new UncaughtErrorEvents_obj;
UncaughtErrorEvents_obj::_hx_vtable = *(void **)dummy;
hx::Static(__mClass) = new hx::Class_obj();
__mClass->mName = HX_HCSTRING("openfl.events.UncaughtErrorEvents","\x95","\xfa","\x87","\x0b");
__mClass->mSuper = &super::__SGetClass();
__mClass->mConstructEmpty = &__CreateEmpty;
__mClass->mConstructArgs = &__Create;
__mClass->mGetStaticField = &hx::Class_obj::GetNoStaticField;
__mClass->mSetStaticField = &hx::Class_obj::SetNoStaticField;
__mClass->mMarkFunc = UncaughtErrorEvents_obj_sMarkStatics;
__mClass->mStatics = hx::Class_obj::dupFunctions(0 /* sStaticFields */);
__mClass->mMembers = hx::Class_obj::dupFunctions(0 /* sMemberFields */);
__mClass->mCanCast = hx::TCanCast< UncaughtErrorEvents_obj >;
#ifdef HXCPP_VISIT_ALLOCS
__mClass->mVisitFunc = UncaughtErrorEvents_obj_sVisitStatics;
#endif
#ifdef HXCPP_SCRIPTABLE
__mClass->mMemberStorageInfo = UncaughtErrorEvents_obj_sMemberStorageInfo;
#endif
#ifdef HXCPP_SCRIPTABLE
__mClass->mStaticStorageInfo = UncaughtErrorEvents_obj_sStaticStorageInfo;
#endif
hx::_hx_RegisterClass(__mClass->mName, __mClass);
}
} // end namespace openfl
} // end namespace events
| [
"elsandkls@kidshideaway.net"
] | elsandkls@kidshideaway.net |
7ad2d5ea33974c369fc5fe80521aba6d98a09212 | 40d291bc8a7a04401b602d5491fd1774fb20f061 | /sample/environ1/environ1/environ1/KHOpenAPICtrl.cpp | 730fad741e6e887963557539f93c17c0139b938a | [
"MIT"
] | permissive | Rinuys/RLTradingBot | f30516afc2e04378192f61877b10b05109873c06 | 07e6be338d1255b2a117501f1d960e0aa3e256f1 | refs/heads/master | 2021-11-24T13:15:19.699121 | 2021-11-04T00:37:45 | 2021-11-04T00:37:45 | 176,231,150 | 1 | 1 | MIT | 2023-09-08T05:05:16 | 2019-03-18T07:53:50 | OpenEdge ABL | UHC | C++ | false | false | 365 | cpp | // KHOpenAPI.cpp : Microsoft Visual C++로 만든 ActiveX 컨트롤 래퍼 클래스의 정의입니다.
#include "stdafx.h"
#include "KHOpenAPICtrl.h"
/////////////////////////////////////////////////////////////////////////////
// CKHOpenAPI
IMPLEMENT_DYNCREATE(CKHOpenAPI, CWnd)
// CKHOpenAPI 속성입니다.
// CKHOpenAPI 작업입니다.
| [
"jeonghan@ijeonghan-ui-MacBookPro.local"
] | jeonghan@ijeonghan-ui-MacBookPro.local |
48407efbc329ddc87bebce8169ad654611a74671 | aa69f4680f318295547d1ce76e471a2d53251a02 | /Users/Giles/Downloads/Traffic Simulator 2017/gameengine/gameobjects/Primitives/Ray.cpp | 7f383ad49d27471ccc137498061c97e18b966ced | [] | no_license | GilesPenfold/Traffic-Simulator-2017 | 66c9048eaa1c5abd015f34856552a361670f0d67 | 4baf0cbe666066ed0d81e8b22c54111446a9bbc9 | refs/heads/master | 2021-01-02T09:45:09.691614 | 2017-10-07T09:13:30 | 2017-10-07T09:13:30 | 99,288,529 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 809 | cpp | #include "Ray.h"
Ray::Ray(float mouseX, float mouseY, float width, float height, Camera* cam){
this->mouseX = mouseX;
this->mouseY = mouseY;
this->width = width;
this->height = height;
this->cam = cam;
}
glm::vec3 Ray::getRayDir()
{
this->rayDir = glm::vec3(0, 0, 0);
glm::vec4 viewport(0.0, 0.0, width, height);
glm::vec3 rayOrigin2D = glm::vec3(mouseX, mouseY, 0);
glm::vec3 rayEnd2D = glm::vec3(mouseX, mouseY, 1);
glm::vec3 rayOrigin = glm::unProject(rayOrigin2D, cam->getView(), cam->getProjectionMatrix(), viewport);
glm::vec3 rayEnd = glm::unProject(rayEnd2D, cam->getView(), cam->getProjectionMatrix(), viewport);
if (rayEnd - rayOrigin != glm::vec3(0,0,0)) {
glm::vec3 rayDirection = glm::normalize(rayEnd - rayOrigin);
this->rayDir = rayDirection;
}
return this->rayDir;
} | [
"gtpenfold@hotmail.co.uk"
] | gtpenfold@hotmail.co.uk |
d894b46ec7aa2bea0bd9df79ca0015a99ef3b31b | f29ac2d8c991decbfb619298e3bf5af655f9fb3e | /aws-cpp-sdk-lakeformation/include/aws/lakeformation/model/DatabaseResource.h | 0c9940aa17e24c78f56c1cb64b4d028ab58172a9 | [
"MIT",
"Apache-2.0",
"JSON"
] | permissive | corporategoth/aws-sdk-cpp | c38ea1a6d94e1b35e17bb1e8cb18c9bf2596f355 | 819b17b3915b1e6a9b704998efcaa51711dd1357 | refs/heads/master | 2022-11-06T21:53:27.936475 | 2020-07-06T19:05:56 | 2020-07-06T19:05:56 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,511 | h | /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/lakeformation/LakeFormation_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
namespace Utils
{
namespace Json
{
class JsonValue;
class JsonView;
} // namespace Json
} // namespace Utils
namespace LakeFormation
{
namespace Model
{
/**
* <p>A structure for the database object.</p><p><h3>See Also:</h3> <a
* href="http://docs.aws.amazon.com/goto/WebAPI/lakeformation-2017-03-31/DatabaseResource">AWS
* API Reference</a></p>
*/
class AWS_LAKEFORMATION_API DatabaseResource
{
public:
DatabaseResource();
DatabaseResource(Aws::Utils::Json::JsonView jsonValue);
DatabaseResource& operator=(Aws::Utils::Json::JsonView jsonValue);
Aws::Utils::Json::JsonValue Jsonize() const;
/**
* <p>The name of the database resource. Unique to the Data Catalog.</p>
*/
inline const Aws::String& GetName() const{ return m_name; }
/**
* <p>The name of the database resource. Unique to the Data Catalog.</p>
*/
inline bool NameHasBeenSet() const { return m_nameHasBeenSet; }
/**
* <p>The name of the database resource. Unique to the Data Catalog.</p>
*/
inline void SetName(const Aws::String& value) { m_nameHasBeenSet = true; m_name = value; }
/**
* <p>The name of the database resource. Unique to the Data Catalog.</p>
*/
inline void SetName(Aws::String&& value) { m_nameHasBeenSet = true; m_name = std::move(value); }
/**
* <p>The name of the database resource. Unique to the Data Catalog.</p>
*/
inline void SetName(const char* value) { m_nameHasBeenSet = true; m_name.assign(value); }
/**
* <p>The name of the database resource. Unique to the Data Catalog.</p>
*/
inline DatabaseResource& WithName(const Aws::String& value) { SetName(value); return *this;}
/**
* <p>The name of the database resource. Unique to the Data Catalog.</p>
*/
inline DatabaseResource& WithName(Aws::String&& value) { SetName(std::move(value)); return *this;}
/**
* <p>The name of the database resource. Unique to the Data Catalog.</p>
*/
inline DatabaseResource& WithName(const char* value) { SetName(value); return *this;}
private:
Aws::String m_name;
bool m_nameHasBeenSet;
};
} // namespace Model
} // namespace LakeFormation
} // namespace Aws
| [
"aws-sdk-cpp-automation@github.com"
] | aws-sdk-cpp-automation@github.com |
316fa90947204ce7df9c536f685d0fea7fe62123 | 395aa4a00bc9d9dabfeb58aa64da3647777323ed | /Source/AdventOfTheMystics/Private/Characters/RPGCharacter.cpp | 5e32b66f651d4b83c1d602f853e33e8717fb3093 | [] | no_license | LikeTheBossOne/AdventOfTheMystics | ebc82a1f3d7ccbd72909a5059754a75436f5540b | 08e3c7cfc56ace600433efe9beff49c1cfae7e84 | refs/heads/main | 2023-04-12T09:31:08.187356 | 2023-04-07T04:13:43 | 2023-04-07T04:13:43 | 308,163,487 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 658 | cpp | // Fill out your copyright notice in the Description page of Project Settings.
#include "../Public/Characters/RPGCharacter.h"
#include "../Public/GAS/RPGAbilitySystemComponent.h"
#include "../Public/GAS/AttributeSetBase.h"
#include "../Public/GAS/RPGGameplayAbility.h"
#include <GameplayEffectTypes.h>
#include "../Public/Inventory/RPGItem.h"
// Sets default values
ARPGCharacter::ARPGCharacter()
{
// Set this character to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
}
// Called every frame
void ARPGCharacter::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
| [
"bbossdev@gmail.com"
] | bbossdev@gmail.com |
c0a13c4c291b40ba5cc41a97137ca05640ffca15 | c553f0edb3f031b196bfb785688d3c762fbd34c1 | /A_Two_Rival_Students.cpp | 06caec6387e8b1225dac6a6b4d5bb8477666ff8f | [] | no_license | akashksinghal/My-Codeforces-Archive | 320b7f82768817dd81c0452a9635541d38b47f77 | 114750ba1c43f4f3a95d3ad73be105b0c2a59187 | refs/heads/master | 2022-12-03T16:34:39.471771 | 2020-08-17T09:24:38 | 2020-08-17T09:24:38 | 241,869,193 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 447 | cpp | // I'm a f*cking looser
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fasino ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define input(A) for(auto &i:A) cin>>i;
void solve()
{
ll n,x,a,b;
cin>>n>>x>>a>>b;
ll dif = abs(a-b);
cout<<min(dif+x, n-1)<<'\n';
}
signed main()
{
fasino
int testcase;
cin>>testcase;
while(testcase--)
{
solve();
}
return 0;
} | [
"akashksinghalnewdelhi@gmail.com"
] | akashksinghalnewdelhi@gmail.com |
f5c2a36e184e31efef8af50526592bca7302b011 | 684aa1247c9641e51f5d266ed83fcfd2164050ee | /Nodo.cpp | a2b586454fc231388050154668045be4287895f6 | [] | no_license | galvismaria/Reader | ca633f2184af996dc152615e027b4dfa3d22d061 | 28b5dd463757e58550b5c70d2bc9ce6502a297e9 | refs/heads/main | 2023-04-08T22:58:18.604604 | 2021-04-28T02:13:26 | 2021-04-28T02:13:26 | 358,730,208 | 0 | 0 | null | null | null | null | WINDOWS-1250 | C++ | false | false | 2,896 | cpp | #include "Nodo.h"
Nodo::Nodo( Palabra *p ){
info = p;
altura = 0;
der = nullptr;
izq = nullptr;
padre = nullptr;
}
// Calcula el punto de balance
// -> Negativo, el lado derecho es más profundo
// -> Cero, ambos lados son iguales
// -> Positivo, el lado izquierdo es más profundo
int Nodo::getBalance(){
int result;
// Si no hay subárbol izquierdo, se verifica el derecho
if ( izq == nullptr ){
// Si ninguno de los subárboles existe, retorna cero
if ( der == nullptr )
result = 0;
// Si el subárbol derecho existe, se hace la altura negativa y se resta uno
else
result = -der->altura - 1;
}
// Si hay un subárbol izquierdo y no hay uno derecho, se devuelve la altura izquierda y se suma uno
else if ( der == nullptr )
result = izq->altura + 1;
// Si los dos subárboles existen, se restan ambas alturas y se devuelve el resultado
else
result = izq->altura - der->altura;
return result;
}
Palabra* Nodo::getInfo(){
return info;
}
int Nodo::getAltura(){
return altura;
}
Nodo* Nodo::getDerecha(){
return der;
}
Nodo* Nodo::getIzquierda(){
return izq;
}
Nodo* Nodo::getPadre(){
return padre;
}
void Nodo::quitarPadre(){
padre = nullptr;
}
Nodo* Nodo::setIzquierda(Nodo *nuevoIzq){
// Si nuevoIzq existe, *este* será el nuevo padre
if ( nuevoIzq != nullptr )
nuevoIzq->padre = this;
// En cualquier caso, el subárbol izquierdo será nuevoIzq
izq = nuevoIzq;
// Debe actualizarse la altura
actualizarAltura();
return izq;
}
Nodo* Nodo::setDerecha( Nodo *nuevoDer ){
// Si nuevoDer existe, *este* será el nuevo padre
if ( nuevoDer != nullptr )
nuevoDer->padre = this;
// En cualquier caso, el subárbol derecho será nuevoDer
der = nuevoDer;
// Debe actualizarse la altura
actualizarAltura();
return der;
}
int Nodo::actualizarAltura(){
// Si no hay un subárbol izquierdo, se verifica del derecho
if ( izq == nullptr ){
// Si no hay un subárbol derecho, la altura es igual a 0
if ( der == nullptr )
altura = 0;
// En otro caso, solo se encuentra el subárbol derecho, así que nuestra altura es su altura más uno
else
altura = der->altura + 1;
}
// Si el subárbol izquiero existe pero el derecho no, nuestra altura es la altura del árbol izquierdo más uno
else if ( der == nullptr )
altura = izq->altura + 1;
// Si los dos subárboles existen y la altura de la izquierda es mayor que la de la derecha, nuestra altura es la altura del árbol izquierdo más uno
else if ( izq->altura > der->altura )
altura = izq->altura + 1;
// En otro caso, nuestra altura es la al altura del subárbol derecho más uno
else
altura = der->altura + 1;
return altura;
}
Nodo::~Nodo(){
delete [] info;
delete &altura;
delete [] der;
delete [] izq;
delete [] padre;
}
| [
"galvismariaj@gmail.com"
] | galvismariaj@gmail.com |
10624ff1967310fb3c67c593a1f389346f115b09 | f11b0552104fdf0d2cab3d1db3a858e6c5a238e9 | /HDU2017(AC).cpp | 8f22ef981c4a82ed9096a5a472b9f8e5c776e8fc | [] | no_license | zhuli19901106/hdoj | 2551053011cadae284fd7165a1722ffc29680515 | ae2f0a096f5fb9f14ffd7c8e0ade5d7329c26143 | refs/heads/master | 2020-04-27T08:39:54.189514 | 2015-11-07T15:48:58 | 2015-11-07T15:48:58 | 14,063,696 | 3 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 433 | cpp | #define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
int main()
{
char s[1000];
int n, ni, i;
int res;
while(gets(s) != NULL){
sscanf(s, "%d", &n);
for(ni = 0; ni < n; ++ni){
gets(s);
res = 0;
for(i = 0; s[i]; ++i){
if(s[i] >= '0' && s[i] <= '9'){
++res;
}
}
printf("%d\n", res);
}
}
return 0;
}
| [
"zhuli19901106@gmail.com"
] | zhuli19901106@gmail.com |
a92db15d33174a513deed9837ef461a652852101 | 6e20207f8aff0f0ad94f05bd025810c6b10a1d5f | /SDK/SteelBoots_RecipePickup_classes.h | 3d4f3af74464cf404c24f8b7a7af885c387045a6 | [] | no_license | zH4x-SDK/zWeHappyFew-SDK | 2a4e246d8ee4b58e45feaa4335f1feb8ea618a4a | 5906adc3edfe1b5de86b7ef0a0eff38073e12214 | refs/heads/main | 2023-08-17T06:05:18.561339 | 2021-08-27T13:36:09 | 2021-08-27T13:36:09 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 684 | h | #pragma once
// Name: WeHappyFew, Version: 1.8.8
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
namespace SDK
{
//---------------------------------------------------------------------------
// Classes
//---------------------------------------------------------------------------
// BlueprintGeneratedClass SteelBoots_RecipePickup.SteelBoots_RecipePickup_C
// 0x0000 (0x07A1 - 0x07A1)
class ASteelBoots_RecipePickup_C : public ACraftingRecipePickup_C
{
public:
static UClass* StaticClass()
{
static auto ptr = UObject::FindClass("BlueprintGeneratedClass SteelBoots_RecipePickup.SteelBoots_RecipePickup_C");
return ptr;
}
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| [
"zp2kshield@gmail.com"
] | zp2kshield@gmail.com |
e09e0c9c006adb98bb686d649c90830d7748470f | 922d57b0c0273784ec113f8f9b534e190ca25690 | /submodules/GANXiS/GANXiS-S_v1.0/CommonFuns_Measure.h | 6db433674b8221f2c280803d680860f9f1c0ed9b | [] | no_license | jiafangdi-guang/graph_clustering_toolkit | 5a02be4a0e41f0c14eca14e61a9a70f0b16e3246 | 8b2163f0b602f59ea1e9ecd4281e286b2c9c71a0 | refs/heads/master | 2022-12-29T20:12:18.700578 | 2020-05-13T16:09:41 | 2020-05-13T16:09:41 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,174 | h | /*
* CommonFuns.h
*
* Created on: Oct 14, 2011
* Author: Jerry
*/
#ifndef COMMONFUNS_H_
#define COMMONFUNS_H_
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <string>
#include <ctime> // time()
#include <cmath>
#include <tr1/unordered_set>
using namespace std;
struct sort_pair_INT_INT {
bool operator()(const std::pair<int,int> &i, const std::pair<int,int> &j) {
return i.second > j.second;
}
};//sort_pair_intint_dec;
struct sort_INT_DEC {
bool operator()(int i, int j) {
return i > j;
}
};
struct sort_INT_INC {
bool operator()(int i, int j) {
return i < j;
}
};//sort_int_inc;
//-----------------
void sort_cpm_vectINT(vector<vector<int> >& cpm);
void sortMapInt_Int( map<int,int> & words, vector< pair<int,int> >& wordsvec);
void createHistogram(map<int,int>& hist, const vector<int>& wordsList);
double myround(double value);
string int2str(int i);
string dbl2str(double f);
double nchoosek(double n,double k);
#endif /* COMMONFUNS_H_ */
| [
"lizhen9.shi@gmail.com"
] | lizhen9.shi@gmail.com |
b1f7341ec80e215db18d36e9250272b0e4e5a69f | b367fe5f0c2c50846b002b59472c50453e1629bc | /xbox_leak_may_2020/xbox trunk/xbox/private/test/network/tcpip/sparta/inc/igmpheaderv1.hpp | b471c2acacde35ee4b28a3d1f65aeaebe011c7ae | [] | no_license | sgzwiz/xbox_leak_may_2020 | 11b441502a659c8da8a1aa199f89f6236dd59325 | fd00b4b3b2abb1ea6ef9ac64b755419741a3af00 | refs/heads/master | 2022-12-23T16:14:54.706755 | 2020-09-27T18:24:48 | 2020-09-27T18:24:48 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,653 | hpp | /****************************************************************************************
* SPARTA project *
* *
* (TCP/IP test team) *
* *
* Filename: IGMPHeaderV1.hpp *
* Description: This is the implementation of the MediaHeader functions *
* *
* *
* Revision history: name date modifications *
* *
* deepakp 5/22/2000 created *
* *
* *
* (C) Copyright Microsoft Corporation 1999-2000 *
*****************************************************************************************/
#ifndef __SPARTA_IGMPHeaderV1_H__
#define __SPARTA_IGMPHeaderV1_H__
#include "sparta.h"
#include "packets.h"
#include "IPConstants.h"
typedef struct
{
USHORT reserved;
UCHAR minorVer;
UCHAR majorVer;
}tDVMRP,*DVMRP;
typedef struct
{
UCHAR igmp_ver_type;
UCHAR igmp_code;
USHORT igmp_chksum;
union
{
ULONG igmp_group;
tDVMRP dvmrp;
}dvmrp_group_union;
#define igmp_group dvmrp_group_union.igmp_group
#define igmp_reserved dvmrp_group_union.dvmrp.reserved
#define igmp_minorVer dvmrp_group_union.dvmrp.minorVer
#define igmp_majorVer dvmrp_group_union.dvmrp.majorVer
} tIGMPHeaderV1, *IGMPHeaderV1;
class CIGMPHeaderV1
{
friend class CIGMPPacketV1;
AUTO_CAL_TYPES m_autoCalcIGMPChecksum;
IGMPHeaderV1 m_pIGMPHeaderV1;
protected:
PKT_BUFFER m_IGMPHeaderV1; // we want access to these members from the CIGMPPacketV1 class
public:
PVOID GetRawBuffer();
DWORD GetRawBufferLength();
CIGMPHeaderV1(UCHAR type);
CIGMPHeaderV1(PVOID pvRawData, DWORD dwBytesRemaining, OUT PDWORD pdwBytesRead);
~CIGMPHeaderV1();
SPARTA_STATUS SetVersion(UCHAR ver);
SPARTA_STATUS SetType(UCHAR type);
SPARTA_STATUS SetCode(UCHAR code);
SPARTA_STATUS SetChksum(USHORT chksum);
SPARTA_STATUS SetGroupAddr(DWORD addr); // NETWORK byte order
SPARTA_STATUS SetGroupAddr(TCHAR * addr)
{
return SetGroupAddr(inet_addr(addr));
}
UCHAR GetVersion();
UCHAR GetType();
UCHAR GetCode();
USHORT GetChksum();
DWORD GetGroupAddr(); // NETWORK byte order
SPARTA_STATUS SetAutoCalcChecksum(const AUTO_CAL_TYPES status);
USHORT CalcChecksum();
SPARTA_STATUS PreparePacketForSend();
// Methods for DVMRP, type 0x13
SPARTA_STATUS SetDVMRPReserved(USHORT res);
SPARTA_STATUS SetDVMRPMinorVer(UCHAR ver);
SPARTA_STATUS SetDVMRPMajorVer(UCHAR ver);
USHORT GetDVMRPReserved();
UCHAR GetDVMRPMinorVer();
UCHAR GetDVMRPMajorVer();
void Print();
};
#endif // __SPARTA_IGMPHeaderV1_H__
| [
"benjamin.barratt@icloud.com"
] | benjamin.barratt@icloud.com |
4a512c1bfa2eef00fd9edb489dbe3295394fe3f6 | 04d5131f1753da82f0f6d271d39a9f6db1cf36e5 | /Week3/Number-Of-Islands.cpp | 58d1185b41917e708e777086884f0be7e58a7a50 | [] | no_license | richidubey/LeetCode-30-Day-Challenge-April-2020 | 87e80b60a2db2491d42012765009fc0ee06e828c | 6387328d09742e9d47f914c6cf5e7d33b73188a7 | refs/heads/master | 2022-04-19T00:52:44.953542 | 2020-04-20T14:24:02 | 2020-04-20T14:24:02 | 255,030,580 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,916 | cpp | //Que Link:https://leetcode.com/explore/challenge/card/30-day-leetcoding-challenge/530/week-3/3302/
class Solution {
public:
int numIslands(vector<vector<char>>& grid) {
int count=0;
stack<pair<int,int>>trav;
int xlim=grid.size();
if(xlim==0)
return 0;
int ylim=grid[0].size();
vector<vector<bool>> vis(grid.size(),vector<bool>(grid[0].size(),false));
cout<<"Xlim is "<<xlim<<" Ylim is "<<ylim<<endl;
for(int i=0;i<xlim;i++)
{
for(int j=0;j<ylim;j++)
{
if((grid[i][j]=='1')&&(vis[i][j]==false))
{
count++;
// cout<<"Count increased for"<<i<<" "<<j<<endl;
trav.push(make_pair(i,j));
while(trav.size()!=0)
{
int x=trav.top().first;
int y=trav.top().second;
// cout<<"Curr stack "<<x<<" "<<y<<endl;
vis[trav.top().first][trav.top().second]=true;
trav.pop();
if((x>0))
{
if((grid[x-1][y]=='1')&&(vis[x-1][y]==false))
{trav.push(make_pair(x-1,y));
vis[x-1][y]=true;
}
}
if((y>0))
{
if((grid[x][y-1]=='1')&&(vis[x][y-1]==false))
{trav.push(make_pair(x,y-1));
vis[x][y-1]=true;}
}
if((x<xlim-1))
{ if((grid[x+1][y]=='1')&&(vis[x+1][y]==false))
{trav.push(make_pair(x+1,y));
vis[x+1][y]=true;
}
}
if((y<(ylim-1)))
{
if((grid[x][y+1]=='1')&&(vis[x][y+1]==false))
{trav.push(make_pair(x,y+1));
vis[x][y+1]=true;}
}
// cout<<"Stack size"<<trav.size()<<endl;
}
}
}
}
return count;
}
};
| [
"richidubey@gmail.com"
] | richidubey@gmail.com |
49f430b098fc749f2cf8a1e6a5fb0d0f9dacd108 | 2c4a5c6037ecc40d04c89d55c867c347042f1f4e | /Wet4/tests/test375.cpp | b98f890e0a89c361725e1d6fb069d4bb1c24455b | [] | no_license | kariander1/OperatingSystems | 056d684833286e49ef375e2ed0a0b00f482064ef | 4671a3cc6746e02e6938c9eb229b3e7016f06c69 | refs/heads/master | 2023-08-11T04:01:39.533946 | 2021-10-09T10:17:06 | 2021-10-09T10:17:06 | 358,538,381 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 111,363 | cpp | #include "aux_macro.h"
#include "../malloc_4.cpp"
#include <iostream>
void printStats()
{
std::cout << "_num_free_blocks: " << _num_free_blocks() << std::endl;
std::cout << "_num_free_bytes: " << _num_free_bytes() << std::endl;
std::cout << "_num_allocated_blocks: " << _num_allocated_blocks() << std::endl;
std::cout << "_num_allocated_bytes: " << _num_allocated_bytes() << std::endl;
std::cout << "_num_meta_data_bytes: " << _num_meta_data_bytes() << std::endl;
std::cout << "_size_meta_data: " << _size_meta_data() << std::endl;
}
int main()
{
PRINT_POINTER(scalloc(248,190););
printStats();
void* p0 = last_address;
DEBUG_PRINT(sfree(p0););
printStats();
PRINT_POINTER(scalloc(151,171););
printStats();
void* p1 = last_address;
PRINT_POINTER(smalloc(33););
printStats();
void* p2 = last_address;
DEBUG_PRINT(sfree(p1););
printStats();
PRINT_POINTER(scalloc(221,126););
printStats();
void* p3 = last_address;
PRINT_POINTER(srealloc(p3,5););
printStats();
void* p4 = last_address;
DEBUG_PRINT(sfree(p4););
printStats();
DEBUG_PRINT(sfree(p2););
printStats();
PRINT_POINTER(scalloc(163,176););
printStats();
void* p5 = last_address;
DEBUG_PRINT(sfree(p5););
printStats();
PRINT_POINTER(smalloc(12););
printStats();
void* p6 = last_address;
DEBUG_PRINT(sfree(p6););
printStats();
PRINT_POINTER(scalloc(125,209););
printStats();
void* p7 = last_address;
DEBUG_PRINT(sfree(p7););
printStats();
PRINT_POINTER(smalloc(129););
printStats();
void* p8 = last_address;
PRINT_POINTER(scalloc(67,206););
printStats();
void* p9 = last_address;
PRINT_POINTER(scalloc(176,198););
printStats();
void* p10 = last_address;
PRINT_POINTER(smalloc(150););
printStats();
void* p11 = last_address;
PRINT_POINTER(smalloc(229););
printStats();
void* p12 = last_address;
PRINT_POINTER(smalloc(187););
printStats();
void* p13 = last_address;
PRINT_POINTER(srealloc(p8,74););
printStats();
void* p14 = last_address;
PRINT_POINTER(smalloc(242););
printStats();
void* p15 = last_address;
PRINT_POINTER(srealloc(p11,26););
printStats();
void* p16 = last_address;
PRINT_POINTER(smalloc(98););
printStats();
void* p17 = last_address;
PRINT_POINTER(srealloc(p10,158););
printStats();
void* p18 = last_address;
PRINT_POINTER(scalloc(84,1););
printStats();
void* p19 = last_address;
PRINT_POINTER(srealloc(p16,14););
printStats();
void* p20 = last_address;
PRINT_POINTER(smalloc(96););
printStats();
void* p21 = last_address;
PRINT_POINTER(scalloc(175,129););
printStats();
void* p22 = last_address;
PRINT_POINTER(smalloc(113););
printStats();
void* p23 = last_address;
PRINT_POINTER(scalloc(217,163););
printStats();
void* p24 = last_address;
PRINT_POINTER(smalloc(225););
printStats();
void* p25 = last_address;
PRINT_POINTER(scalloc(69,74););
printStats();
void* p26 = last_address;
PRINT_POINTER(smalloc(187););
printStats();
void* p27 = last_address;
PRINT_POINTER(srealloc(p15,216););
printStats();
void* p28 = last_address;
PRINT_POINTER(smalloc(5););
printStats();
void* p29 = last_address;
PRINT_POINTER(smalloc(76););
printStats();
void* p30 = last_address;
DEBUG_PRINT(sfree(p24););
printStats();
PRINT_POINTER(srealloc(p27,63););
printStats();
void* p31 = last_address;
PRINT_POINTER(scalloc(249,219););
printStats();
void* p32 = last_address;
PRINT_POINTER(scalloc(215,229););
printStats();
void* p33 = last_address;
PRINT_POINTER(scalloc(49,86););
printStats();
void* p34 = last_address;
DEBUG_PRINT(sfree(p17););
printStats();
PRINT_POINTER(srealloc(p20,113););
printStats();
void* p35 = last_address;
PRINT_POINTER(scalloc(27,123););
printStats();
void* p36 = last_address;
PRINT_POINTER(scalloc(242,84););
printStats();
void* p37 = last_address;
PRINT_POINTER(scalloc(146,106););
printStats();
void* p38 = last_address;
PRINT_POINTER(scalloc(197,215););
printStats();
void* p39 = last_address;
PRINT_POINTER(smalloc(39););
printStats();
void* p40 = last_address;
PRINT_POINTER(smalloc(193););
printStats();
void* p41 = last_address;
DEBUG_PRINT(sfree(p28););
printStats();
PRINT_POINTER(srealloc(p9,103););
printStats();
void* p42 = last_address;
PRINT_POINTER(srealloc(p21,117););
printStats();
void* p43 = last_address;
PRINT_POINTER(scalloc(89,233););
printStats();
void* p44 = last_address;
DEBUG_PRINT(sfree(p30););
printStats();
DEBUG_PRINT(sfree(p12););
printStats();
PRINT_POINTER(scalloc(207,141););
printStats();
void* p45 = last_address;
DEBUG_PRINT(sfree(p22););
printStats();
PRINT_POINTER(scalloc(91,152););
printStats();
void* p46 = last_address;
PRINT_POINTER(scalloc(228,217););
printStats();
void* p47 = last_address;
PRINT_POINTER(srealloc(p33,160););
printStats();
void* p48 = last_address;
DEBUG_PRINT(sfree(p43););
printStats();
PRINT_POINTER(smalloc(6););
printStats();
void* p49 = last_address;
PRINT_POINTER(srealloc(p47,191););
printStats();
void* p50 = last_address;
DEBUG_PRINT(sfree(p32););
printStats();
PRINT_POINTER(smalloc(199););
printStats();
void* p51 = last_address;
DEBUG_PRINT(sfree(p13););
printStats();
DEBUG_PRINT(sfree(p40););
printStats();
PRINT_POINTER(scalloc(107,44););
printStats();
void* p52 = last_address;
PRINT_POINTER(srealloc(p36,110););
printStats();
void* p53 = last_address;
PRINT_POINTER(smalloc(142););
printStats();
void* p54 = last_address;
PRINT_POINTER(scalloc(243,84););
printStats();
void* p55 = last_address;
PRINT_POINTER(scalloc(210,58););
printStats();
void* p56 = last_address;
PRINT_POINTER(smalloc(135););
printStats();
void* p57 = last_address;
PRINT_POINTER(smalloc(202););
printStats();
void* p58 = last_address;
DEBUG_PRINT(sfree(p41););
printStats();
PRINT_POINTER(srealloc(p51,221););
printStats();
void* p59 = last_address;
DEBUG_PRINT(sfree(p56););
printStats();
PRINT_POINTER(scalloc(125,117););
printStats();
void* p60 = last_address;
PRINT_POINTER(srealloc(p60,78););
printStats();
void* p61 = last_address;
PRINT_POINTER(scalloc(133,249););
printStats();
void* p62 = last_address;
PRINT_POINTER(smalloc(120););
printStats();
void* p63 = last_address;
PRINT_POINTER(srealloc(p62,246););
printStats();
void* p64 = last_address;
PRINT_POINTER(smalloc(242););
printStats();
void* p65 = last_address;
PRINT_POINTER(smalloc(205););
printStats();
void* p66 = last_address;
PRINT_POINTER(smalloc(58););
printStats();
void* p67 = last_address;
PRINT_POINTER(scalloc(230,152););
printStats();
void* p68 = last_address;
PRINT_POINTER(scalloc(124,177););
printStats();
void* p69 = last_address;
PRINT_POINTER(smalloc(47););
printStats();
void* p70 = last_address;
PRINT_POINTER(scalloc(8,169););
printStats();
void* p71 = last_address;
PRINT_POINTER(srealloc(p39,184););
printStats();
void* p72 = last_address;
PRINT_POINTER(smalloc(234););
printStats();
void* p73 = last_address;
PRINT_POINTER(srealloc(p18,101););
printStats();
void* p74 = last_address;
PRINT_POINTER(srealloc(p72,240););
printStats();
void* p75 = last_address;
DEBUG_PRINT(sfree(p34););
printStats();
PRINT_POINTER(srealloc(p69,33););
printStats();
void* p76 = last_address;
DEBUG_PRINT(sfree(p59););
printStats();
PRINT_POINTER(scalloc(90,226););
printStats();
void* p77 = last_address;
DEBUG_PRINT(sfree(p58););
printStats();
PRINT_POINTER(scalloc(87,223););
printStats();
void* p78 = last_address;
PRINT_POINTER(smalloc(6););
printStats();
void* p79 = last_address;
PRINT_POINTER(scalloc(60,56););
printStats();
void* p80 = last_address;
PRINT_POINTER(smalloc(240););
printStats();
void* p81 = last_address;
PRINT_POINTER(scalloc(235,86););
printStats();
void* p82 = last_address;
PRINT_POINTER(smalloc(208););
printStats();
void* p83 = last_address;
PRINT_POINTER(scalloc(102,41););
printStats();
void* p84 = last_address;
PRINT_POINTER(scalloc(97,78););
printStats();
void* p85 = last_address;
PRINT_POINTER(scalloc(19,101););
printStats();
void* p86 = last_address;
PRINT_POINTER(srealloc(p68,144););
printStats();
void* p87 = last_address;
PRINT_POINTER(scalloc(139,222););
printStats();
void* p88 = last_address;
PRINT_POINTER(srealloc(p78,176););
printStats();
void* p89 = last_address;
PRINT_POINTER(srealloc(p45,201););
printStats();
void* p90 = last_address;
PRINT_POINTER(smalloc(89););
printStats();
void* p91 = last_address;
PRINT_POINTER(smalloc(35););
printStats();
void* p92 = last_address;
PRINT_POINTER(scalloc(174,201););
printStats();
void* p93 = last_address;
DEBUG_PRINT(sfree(p86););
printStats();
PRINT_POINTER(srealloc(p65,231););
printStats();
void* p94 = last_address;
DEBUG_PRINT(sfree(p53););
printStats();
PRINT_POINTER(smalloc(48););
printStats();
void* p95 = last_address;
PRINT_POINTER(scalloc(111,71););
printStats();
void* p96 = last_address;
DEBUG_PRINT(sfree(p48););
printStats();
PRINT_POINTER(scalloc(135,95););
printStats();
void* p97 = last_address;
PRINT_POINTER(srealloc(p97,166););
printStats();
void* p98 = last_address;
PRINT_POINTER(scalloc(73,145););
printStats();
void* p99 = last_address;
PRINT_POINTER(smalloc(149););
printStats();
void* p100 = last_address;
DEBUG_PRINT(sfree(p19););
printStats();
PRINT_POINTER(smalloc(13););
printStats();
void* p101 = last_address;
PRINT_POINTER(smalloc(68););
printStats();
void* p102 = last_address;
DEBUG_PRINT(sfree(p80););
printStats();
PRINT_POINTER(srealloc(p44,140););
printStats();
void* p103 = last_address;
DEBUG_PRINT(sfree(p35););
printStats();
PRINT_POINTER(srealloc(p52,46););
printStats();
void* p104 = last_address;
DEBUG_PRINT(sfree(p74););
printStats();
PRINT_POINTER(scalloc(64,115););
printStats();
void* p105 = last_address;
PRINT_POINTER(scalloc(134,138););
printStats();
void* p106 = last_address;
DEBUG_PRINT(sfree(p87););
printStats();
PRINT_POINTER(scalloc(107,8););
printStats();
void* p107 = last_address;
PRINT_POINTER(srealloc(p84,66););
printStats();
void* p108 = last_address;
PRINT_POINTER(scalloc(228,249););
printStats();
void* p109 = last_address;
DEBUG_PRINT(sfree(p38););
printStats();
PRINT_POINTER(smalloc(12););
printStats();
void* p110 = last_address;
PRINT_POINTER(smalloc(119););
printStats();
void* p111 = last_address;
PRINT_POINTER(srealloc(p66,17););
printStats();
void* p112 = last_address;
DEBUG_PRINT(sfree(p88););
printStats();
PRINT_POINTER(smalloc(9););
printStats();
void* p113 = last_address;
PRINT_POINTER(srealloc(p81,113););
printStats();
void* p114 = last_address;
DEBUG_PRINT(sfree(p63););
printStats();
DEBUG_PRINT(sfree(p42););
printStats();
PRINT_POINTER(srealloc(p83,165););
printStats();
void* p115 = last_address;
PRINT_POINTER(smalloc(127););
printStats();
void* p116 = last_address;
DEBUG_PRINT(sfree(p92););
printStats();
PRINT_POINTER(srealloc(p37,152););
printStats();
void* p117 = last_address;
PRINT_POINTER(scalloc(139,55););
printStats();
void* p118 = last_address;
PRINT_POINTER(srealloc(p70,9););
printStats();
void* p119 = last_address;
DEBUG_PRINT(sfree(p85););
printStats();
PRINT_POINTER(smalloc(194););
printStats();
void* p120 = last_address;
DEBUG_PRINT(sfree(p119););
printStats();
PRINT_POINTER(scalloc(157,65););
printStats();
void* p121 = last_address;
PRINT_POINTER(scalloc(103,174););
printStats();
void* p122 = last_address;
PRINT_POINTER(srealloc(p29,192););
printStats();
void* p123 = last_address;
DEBUG_PRINT(sfree(p91););
printStats();
DEBUG_PRINT(sfree(p77););
printStats();
PRINT_POINTER(scalloc(121,196););
printStats();
void* p124 = last_address;
PRINT_POINTER(srealloc(p89,234););
printStats();
void* p125 = last_address;
PRINT_POINTER(smalloc(52););
printStats();
void* p126 = last_address;
PRINT_POINTER(scalloc(156,248););
printStats();
void* p127 = last_address;
PRINT_POINTER(smalloc(96););
printStats();
void* p128 = last_address;
PRINT_POINTER(scalloc(110,165););
printStats();
void* p129 = last_address;
PRINT_POINTER(scalloc(57,50););
printStats();
void* p130 = last_address;
PRINT_POINTER(scalloc(168,4););
printStats();
void* p131 = last_address;
PRINT_POINTER(smalloc(243););
printStats();
void* p132 = last_address;
PRINT_POINTER(smalloc(101););
printStats();
void* p133 = last_address;
DEBUG_PRINT(sfree(p23););
printStats();
PRINT_POINTER(smalloc(209););
printStats();
void* p134 = last_address;
PRINT_POINTER(scalloc(26,111););
printStats();
void* p135 = last_address;
PRINT_POINTER(scalloc(203,137););
printStats();
void* p136 = last_address;
PRINT_POINTER(smalloc(222););
printStats();
void* p137 = last_address;
PRINT_POINTER(srealloc(p127,176););
printStats();
void* p138 = last_address;
DEBUG_PRINT(sfree(p14););
printStats();
PRINT_POINTER(smalloc(67););
printStats();
void* p139 = last_address;
PRINT_POINTER(scalloc(7,64););
printStats();
void* p140 = last_address;
PRINT_POINTER(smalloc(106););
printStats();
void* p141 = last_address;
PRINT_POINTER(scalloc(184,62););
printStats();
void* p142 = last_address;
PRINT_POINTER(scalloc(172,114););
printStats();
void* p143 = last_address;
PRINT_POINTER(scalloc(203,104););
printStats();
void* p144 = last_address;
DEBUG_PRINT(sfree(p54););
printStats();
PRINT_POINTER(smalloc(43););
printStats();
void* p145 = last_address;
PRINT_POINTER(srealloc(p95,221););
printStats();
void* p146 = last_address;
PRINT_POINTER(srealloc(p55,155););
printStats();
void* p147 = last_address;
DEBUG_PRINT(sfree(p123););
printStats();
PRINT_POINTER(scalloc(139,90););
printStats();
void* p148 = last_address;
PRINT_POINTER(srealloc(p143,2););
printStats();
void* p149 = last_address;
PRINT_POINTER(smalloc(175););
printStats();
void* p150 = last_address;
DEBUG_PRINT(sfree(p104););
printStats();
PRINT_POINTER(srealloc(p145,152););
printStats();
void* p151 = last_address;
PRINT_POINTER(scalloc(148,213););
printStats();
void* p152 = last_address;
PRINT_POINTER(smalloc(150););
printStats();
void* p153 = last_address;
PRINT_POINTER(scalloc(23,47););
printStats();
void* p154 = last_address;
PRINT_POINTER(scalloc(170,185););
printStats();
void* p155 = last_address;
PRINT_POINTER(srealloc(p121,97););
printStats();
void* p156 = last_address;
PRINT_POINTER(srealloc(p106,195););
printStats();
void* p157 = last_address;
DEBUG_PRINT(sfree(p129););
printStats();
PRINT_POINTER(smalloc(190););
printStats();
void* p158 = last_address;
DEBUG_PRINT(sfree(p76););
printStats();
DEBUG_PRINT(sfree(p142););
printStats();
DEBUG_PRINT(sfree(p112););
printStats();
PRINT_POINTER(scalloc(27,164););
printStats();
void* p159 = last_address;
PRINT_POINTER(srealloc(p118,35););
printStats();
void* p160 = last_address;
PRINT_POINTER(srealloc(p73,175););
printStats();
void* p161 = last_address;
PRINT_POINTER(smalloc(142););
printStats();
void* p162 = last_address;
PRINT_POINTER(scalloc(66,199););
printStats();
void* p163 = last_address;
PRINT_POINTER(scalloc(6,218););
printStats();
void* p164 = last_address;
PRINT_POINTER(srealloc(p164,85););
printStats();
void* p165 = last_address;
PRINT_POINTER(srealloc(p103,79););
printStats();
void* p166 = last_address;
DEBUG_PRINT(sfree(p116););
printStats();
DEBUG_PRINT(sfree(p141););
printStats();
DEBUG_PRINT(sfree(p131););
printStats();
PRINT_POINTER(scalloc(241,53););
printStats();
void* p167 = last_address;
DEBUG_PRINT(sfree(p160););
printStats();
PRINT_POINTER(srealloc(p50,203););
printStats();
void* p168 = last_address;
PRINT_POINTER(smalloc(55););
printStats();
void* p169 = last_address;
PRINT_POINTER(srealloc(p25,57););
printStats();
void* p170 = last_address;
PRINT_POINTER(smalloc(88););
printStats();
void* p171 = last_address;
PRINT_POINTER(smalloc(110););
printStats();
void* p172 = last_address;
PRINT_POINTER(scalloc(104,72););
printStats();
void* p173 = last_address;
DEBUG_PRINT(sfree(p107););
printStats();
PRINT_POINTER(scalloc(201,106););
printStats();
void* p174 = last_address;
DEBUG_PRINT(sfree(p71););
printStats();
DEBUG_PRINT(sfree(p149););
printStats();
PRINT_POINTER(smalloc(143););
printStats();
void* p175 = last_address;
PRINT_POINTER(scalloc(179,147););
printStats();
void* p176 = last_address;
PRINT_POINTER(scalloc(16,89););
printStats();
void* p177 = last_address;
PRINT_POINTER(srealloc(p115,33););
printStats();
void* p178 = last_address;
PRINT_POINTER(scalloc(52,201););
printStats();
void* p179 = last_address;
PRINT_POINTER(scalloc(121,81););
printStats();
void* p180 = last_address;
PRINT_POINTER(scalloc(76,241););
printStats();
void* p181 = last_address;
DEBUG_PRINT(sfree(p26););
printStats();
PRINT_POINTER(srealloc(p109,138););
printStats();
void* p182 = last_address;
PRINT_POINTER(srealloc(p79,173););
printStats();
void* p183 = last_address;
PRINT_POINTER(scalloc(101,17););
printStats();
void* p184 = last_address;
PRINT_POINTER(srealloc(p113,33););
printStats();
void* p185 = last_address;
DEBUG_PRINT(sfree(p156););
printStats();
PRINT_POINTER(smalloc(73););
printStats();
void* p186 = last_address;
PRINT_POINTER(srealloc(p165,72););
printStats();
void* p187 = last_address;
DEBUG_PRINT(sfree(p170););
printStats();
PRINT_POINTER(smalloc(71););
printStats();
void* p188 = last_address;
DEBUG_PRINT(sfree(p157););
printStats();
PRINT_POINTER(srealloc(p179,80););
printStats();
void* p189 = last_address;
PRINT_POINTER(smalloc(111););
printStats();
void* p190 = last_address;
DEBUG_PRINT(sfree(p176););
printStats();
DEBUG_PRINT(sfree(p96););
printStats();
DEBUG_PRINT(sfree(p98););
printStats();
PRINT_POINTER(smalloc(218););
printStats();
void* p191 = last_address;
PRINT_POINTER(smalloc(92););
printStats();
void* p192 = last_address;
DEBUG_PRINT(sfree(p111););
printStats();
PRINT_POINTER(scalloc(145,26););
printStats();
void* p193 = last_address;
PRINT_POINTER(smalloc(225););
printStats();
void* p194 = last_address;
PRINT_POINTER(srealloc(p136,8););
printStats();
void* p195 = last_address;
PRINT_POINTER(srealloc(p155,168););
printStats();
void* p196 = last_address;
DEBUG_PRINT(sfree(p108););
printStats();
PRINT_POINTER(srealloc(p196,164););
printStats();
void* p197 = last_address;
PRINT_POINTER(smalloc(151););
printStats();
void* p198 = last_address;
DEBUG_PRINT(sfree(p67););
printStats();
PRINT_POINTER(scalloc(156,186););
printStats();
void* p199 = last_address;
PRINT_POINTER(scalloc(54,185););
printStats();
void* p200 = last_address;
PRINT_POINTER(srealloc(p191,32););
printStats();
void* p201 = last_address;
DEBUG_PRINT(sfree(p154););
printStats();
DEBUG_PRINT(sfree(p193););
printStats();
PRINT_POINTER(srealloc(p175,176););
printStats();
void* p202 = last_address;
DEBUG_PRINT(sfree(p159););
printStats();
PRINT_POINTER(srealloc(p93,224););
printStats();
void* p203 = last_address;
PRINT_POINTER(smalloc(173););
printStats();
void* p204 = last_address;
PRINT_POINTER(smalloc(37););
printStats();
void* p205 = last_address;
PRINT_POINTER(smalloc(234););
printStats();
void* p206 = last_address;
PRINT_POINTER(scalloc(43,126););
printStats();
void* p207 = last_address;
DEBUG_PRINT(sfree(p167););
printStats();
PRINT_POINTER(srealloc(p197,237););
printStats();
void* p208 = last_address;
PRINT_POINTER(srealloc(p194,160););
printStats();
void* p209 = last_address;
DEBUG_PRINT(sfree(p101););
printStats();
PRINT_POINTER(smalloc(131););
printStats();
void* p210 = last_address;
DEBUG_PRINT(sfree(p209););
printStats();
PRINT_POINTER(smalloc(189););
printStats();
void* p211 = last_address;
PRINT_POINTER(smalloc(174););
printStats();
void* p212 = last_address;
DEBUG_PRINT(sfree(p128););
printStats();
DEBUG_PRINT(sfree(p158););
printStats();
PRINT_POINTER(smalloc(174););
printStats();
void* p213 = last_address;
PRINT_POINTER(smalloc(59););
printStats();
void* p214 = last_address;
DEBUG_PRINT(sfree(p163););
printStats();
PRINT_POINTER(scalloc(53,201););
printStats();
void* p215 = last_address;
PRINT_POINTER(smalloc(181););
printStats();
void* p216 = last_address;
PRINT_POINTER(srealloc(p214,238););
printStats();
void* p217 = last_address;
PRINT_POINTER(scalloc(8,144););
printStats();
void* p218 = last_address;
PRINT_POINTER(smalloc(217););
printStats();
void* p219 = last_address;
PRINT_POINTER(smalloc(178););
printStats();
void* p220 = last_address;
PRINT_POINTER(scalloc(7,93););
printStats();
void* p221 = last_address;
PRINT_POINTER(smalloc(177););
printStats();
void* p222 = last_address;
PRINT_POINTER(smalloc(98););
printStats();
void* p223 = last_address;
DEBUG_PRINT(sfree(p125););
printStats();
PRINT_POINTER(srealloc(p213,160););
printStats();
void* p224 = last_address;
PRINT_POINTER(scalloc(143,212););
printStats();
void* p225 = last_address;
PRINT_POINTER(srealloc(p195,183););
printStats();
void* p226 = last_address;
PRINT_POINTER(scalloc(83,160););
printStats();
void* p227 = last_address;
PRINT_POINTER(scalloc(217,199););
printStats();
void* p228 = last_address;
PRINT_POINTER(scalloc(4,24););
printStats();
void* p229 = last_address;
PRINT_POINTER(scalloc(244,30););
printStats();
void* p230 = last_address;
DEBUG_PRINT(sfree(p161););
printStats();
PRINT_POINTER(srealloc(p208,141););
printStats();
void* p231 = last_address;
PRINT_POINTER(srealloc(p215,19););
printStats();
void* p232 = last_address;
PRINT_POINTER(smalloc(88););
printStats();
void* p233 = last_address;
DEBUG_PRINT(sfree(p126););
printStats();
PRINT_POINTER(srealloc(p192,210););
printStats();
void* p234 = last_address;
DEBUG_PRINT(sfree(p199););
printStats();
PRINT_POINTER(scalloc(129,88););
printStats();
void* p235 = last_address;
DEBUG_PRINT(sfree(p140););
printStats();
PRINT_POINTER(srealloc(p219,18););
printStats();
void* p236 = last_address;
PRINT_POINTER(smalloc(39););
printStats();
void* p237 = last_address;
PRINT_POINTER(srealloc(p227,173););
printStats();
void* p238 = last_address;
PRINT_POINTER(smalloc(0););
printStats();
void* p239 = last_address;
PRINT_POINTER(smalloc(29););
printStats();
void* p240 = last_address;
DEBUG_PRINT(sfree(p173););
printStats();
DEBUG_PRINT(sfree(p181););
printStats();
PRINT_POINTER(smalloc(45););
printStats();
void* p241 = last_address;
DEBUG_PRINT(sfree(p201););
printStats();
PRINT_POINTER(srealloc(p238,103););
printStats();
void* p242 = last_address;
PRINT_POINTER(scalloc(197,54););
printStats();
void* p243 = last_address;
DEBUG_PRINT(sfree(p139););
printStats();
PRINT_POINTER(scalloc(179,217););
printStats();
void* p244 = last_address;
PRINT_POINTER(srealloc(p134,122););
printStats();
void* p245 = last_address;
DEBUG_PRINT(sfree(p235););
printStats();
PRINT_POINTER(srealloc(p180,127););
printStats();
void* p246 = last_address;
PRINT_POINTER(smalloc(49););
printStats();
void* p247 = last_address;
PRINT_POINTER(srealloc(p138,228););
printStats();
void* p248 = last_address;
PRINT_POINTER(smalloc(112););
printStats();
void* p249 = last_address;
DEBUG_PRINT(sfree(p166););
printStats();
PRINT_POINTER(smalloc(36););
printStats();
void* p250 = last_address;
PRINT_POINTER(scalloc(83,121););
printStats();
void* p251 = last_address;
PRINT_POINTER(smalloc(200););
printStats();
void* p252 = last_address;
PRINT_POINTER(srealloc(p172,163););
printStats();
void* p253 = last_address;
PRINT_POINTER(scalloc(235,154););
printStats();
void* p254 = last_address;
PRINT_POINTER(srealloc(p153,88););
printStats();
void* p255 = last_address;
PRINT_POINTER(smalloc(98););
printStats();
void* p256 = last_address;
DEBUG_PRINT(sfree(p146););
printStats();
PRINT_POINTER(srealloc(p49,201););
printStats();
void* p257 = last_address;
PRINT_POINTER(srealloc(p223,157););
printStats();
void* p258 = last_address;
PRINT_POINTER(scalloc(246,169););
printStats();
void* p259 = last_address;
PRINT_POINTER(scalloc(53,85););
printStats();
void* p260 = last_address;
PRINT_POINTER(scalloc(146,60););
printStats();
void* p261 = last_address;
PRINT_POINTER(smalloc(88););
printStats();
void* p262 = last_address;
PRINT_POINTER(srealloc(p110,5););
printStats();
void* p263 = last_address;
PRINT_POINTER(srealloc(p150,124););
printStats();
void* p264 = last_address;
PRINT_POINTER(smalloc(45););
printStats();
void* p265 = last_address;
PRINT_POINTER(srealloc(p225,155););
printStats();
void* p266 = last_address;
PRINT_POINTER(smalloc(232););
printStats();
void* p267 = last_address;
DEBUG_PRINT(sfree(p248););
printStats();
PRINT_POINTER(srealloc(p224,192););
printStats();
void* p268 = last_address;
PRINT_POINTER(smalloc(85););
printStats();
void* p269 = last_address;
DEBUG_PRINT(sfree(p232););
printStats();
DEBUG_PRINT(sfree(p249););
printStats();
DEBUG_PRINT(sfree(p261););
printStats();
DEBUG_PRINT(sfree(p189););
printStats();
DEBUG_PRINT(sfree(p222););
printStats();
PRINT_POINTER(smalloc(83););
printStats();
void* p270 = last_address;
PRINT_POINTER(smalloc(249););
printStats();
void* p271 = last_address;
PRINT_POINTER(srealloc(p148,209););
printStats();
void* p272 = last_address;
PRINT_POINTER(srealloc(p178,131););
printStats();
void* p273 = last_address;
PRINT_POINTER(srealloc(p183,26););
printStats();
void* p274 = last_address;
PRINT_POINTER(smalloc(202););
printStats();
void* p275 = last_address;
DEBUG_PRINT(sfree(p250););
printStats();
PRINT_POINTER(srealloc(p190,188););
printStats();
void* p276 = last_address;
PRINT_POINTER(srealloc(p257,52););
printStats();
void* p277 = last_address;
DEBUG_PRINT(sfree(p217););
printStats();
DEBUG_PRINT(sfree(p162););
printStats();
PRINT_POINTER(smalloc(218););
printStats();
void* p278 = last_address;
PRINT_POINTER(scalloc(148,154););
printStats();
void* p279 = last_address;
PRINT_POINTER(smalloc(238););
printStats();
void* p280 = last_address;
PRINT_POINTER(srealloc(p169,15););
printStats();
void* p281 = last_address;
DEBUG_PRINT(sfree(p130););
printStats();
PRINT_POINTER(srealloc(p255,6););
printStats();
void* p282 = last_address;
PRINT_POINTER(scalloc(126,149););
printStats();
void* p283 = last_address;
PRINT_POINTER(scalloc(139,212););
printStats();
void* p284 = last_address;
DEBUG_PRINT(sfree(p46););
printStats();
PRINT_POINTER(smalloc(47););
printStats();
void* p285 = last_address;
PRINT_POINTER(smalloc(50););
printStats();
void* p286 = last_address;
DEBUG_PRINT(sfree(p144););
printStats();
PRINT_POINTER(smalloc(66););
printStats();
void* p287 = last_address;
PRINT_POINTER(scalloc(180,245););
printStats();
void* p288 = last_address;
PRINT_POINTER(srealloc(p258,248););
printStats();
void* p289 = last_address;
DEBUG_PRINT(sfree(p117););
printStats();
PRINT_POINTER(smalloc(37););
printStats();
void* p290 = last_address;
PRINT_POINTER(scalloc(130,183););
printStats();
void* p291 = last_address;
DEBUG_PRINT(sfree(p234););
printStats();
DEBUG_PRINT(sfree(p31););
printStats();
PRINT_POINTER(srealloc(p207,176););
printStats();
void* p292 = last_address;
PRINT_POINTER(scalloc(10,79););
printStats();
void* p293 = last_address;
PRINT_POINTER(scalloc(58,213););
printStats();
void* p294 = last_address;
PRINT_POINTER(smalloc(101););
printStats();
void* p295 = last_address;
PRINT_POINTER(srealloc(p64,15););
printStats();
void* p296 = last_address;
PRINT_POINTER(scalloc(41,199););
printStats();
void* p297 = last_address;
PRINT_POINTER(scalloc(116,142););
printStats();
void* p298 = last_address;
PRINT_POINTER(smalloc(79););
printStats();
void* p299 = last_address;
PRINT_POINTER(scalloc(142,116););
printStats();
void* p300 = last_address;
PRINT_POINTER(scalloc(102,108););
printStats();
void* p301 = last_address;
PRINT_POINTER(scalloc(71,87););
printStats();
void* p302 = last_address;
PRINT_POINTER(srealloc(p151,50););
printStats();
void* p303 = last_address;
PRINT_POINTER(smalloc(206););
printStats();
void* p304 = last_address;
PRINT_POINTER(scalloc(248,108););
printStats();
void* p305 = last_address;
PRINT_POINTER(scalloc(138,94););
printStats();
void* p306 = last_address;
DEBUG_PRINT(sfree(p286););
printStats();
PRINT_POINTER(srealloc(p247,27););
printStats();
void* p307 = last_address;
PRINT_POINTER(smalloc(10););
printStats();
void* p308 = last_address;
PRINT_POINTER(scalloc(234,91););
printStats();
void* p309 = last_address;
PRINT_POINTER(smalloc(71););
printStats();
void* p310 = last_address;
DEBUG_PRINT(sfree(p220););
printStats();
DEBUG_PRINT(sfree(p133););
printStats();
DEBUG_PRINT(sfree(p275););
printStats();
DEBUG_PRINT(sfree(p310););
printStats();
DEBUG_PRINT(sfree(p259););
printStats();
DEBUG_PRINT(sfree(p280););
printStats();
PRINT_POINTER(scalloc(204,213););
printStats();
void* p311 = last_address;
PRINT_POINTER(srealloc(p282,200););
printStats();
void* p312 = last_address;
PRINT_POINTER(smalloc(15););
printStats();
void* p313 = last_address;
PRINT_POINTER(smalloc(190););
printStats();
void* p314 = last_address;
PRINT_POINTER(scalloc(154,9););
printStats();
void* p315 = last_address;
DEBUG_PRINT(sfree(p187););
printStats();
PRINT_POINTER(scalloc(98,28););
printStats();
void* p316 = last_address;
PRINT_POINTER(scalloc(245,150););
printStats();
void* p317 = last_address;
DEBUG_PRINT(sfree(p216););
printStats();
DEBUG_PRINT(sfree(p302););
printStats();
PRINT_POINTER(scalloc(48,185););
printStats();
void* p318 = last_address;
PRINT_POINTER(scalloc(140,152););
printStats();
void* p319 = last_address;
PRINT_POINTER(scalloc(246,196););
printStats();
void* p320 = last_address;
PRINT_POINTER(smalloc(72););
printStats();
void* p321 = last_address;
PRINT_POINTER(smalloc(123););
printStats();
void* p322 = last_address;
PRINT_POINTER(srealloc(p135,87););
printStats();
void* p323 = last_address;
DEBUG_PRINT(sfree(p204););
printStats();
PRINT_POINTER(smalloc(227););
printStats();
void* p324 = last_address;
PRINT_POINTER(scalloc(23,218););
printStats();
void* p325 = last_address;
PRINT_POINTER(scalloc(146,149););
printStats();
void* p326 = last_address;
PRINT_POINTER(srealloc(p188,212););
printStats();
void* p327 = last_address;
PRINT_POINTER(smalloc(130););
printStats();
void* p328 = last_address;
PRINT_POINTER(scalloc(5,168););
printStats();
void* p329 = last_address;
PRINT_POINTER(scalloc(152,68););
printStats();
void* p330 = last_address;
PRINT_POINTER(srealloc(p253,38););
printStats();
void* p331 = last_address;
PRINT_POINTER(smalloc(157););
printStats();
void* p332 = last_address;
PRINT_POINTER(scalloc(198,238););
printStats();
void* p333 = last_address;
PRINT_POINTER(smalloc(224););
printStats();
void* p334 = last_address;
PRINT_POINTER(srealloc(p198,157););
printStats();
void* p335 = last_address;
PRINT_POINTER(srealloc(p285,59););
printStats();
void* p336 = last_address;
DEBUG_PRINT(sfree(p272););
printStats();
PRINT_POINTER(smalloc(79););
printStats();
void* p337 = last_address;
PRINT_POINTER(scalloc(227,240););
printStats();
void* p338 = last_address;
DEBUG_PRINT(sfree(p100););
printStats();
PRINT_POINTER(smalloc(161););
printStats();
void* p339 = last_address;
PRINT_POINTER(srealloc(p315,52););
printStats();
void* p340 = last_address;
DEBUG_PRINT(sfree(p168););
printStats();
PRINT_POINTER(srealloc(p114,107););
printStats();
void* p341 = last_address;
DEBUG_PRINT(sfree(p335););
printStats();
PRINT_POINTER(srealloc(p301,210););
printStats();
void* p342 = last_address;
PRINT_POINTER(smalloc(124););
printStats();
void* p343 = last_address;
PRINT_POINTER(srealloc(p303,36););
printStats();
void* p344 = last_address;
PRINT_POINTER(smalloc(54););
printStats();
void* p345 = last_address;
PRINT_POINTER(srealloc(p332,60););
printStats();
void* p346 = last_address;
PRINT_POINTER(smalloc(34););
printStats();
void* p347 = last_address;
PRINT_POINTER(scalloc(72,245););
printStats();
void* p348 = last_address;
PRINT_POINTER(srealloc(p271,50););
printStats();
void* p349 = last_address;
PRINT_POINTER(smalloc(123););
printStats();
void* p350 = last_address;
PRINT_POINTER(srealloc(p202,36););
printStats();
void* p351 = last_address;
DEBUG_PRINT(sfree(p122););
printStats();
PRINT_POINTER(scalloc(171,138););
printStats();
void* p352 = last_address;
PRINT_POINTER(smalloc(202););
printStats();
void* p353 = last_address;
PRINT_POINTER(scalloc(48,208););
printStats();
void* p354 = last_address;
PRINT_POINTER(scalloc(59,198););
printStats();
void* p355 = last_address;
PRINT_POINTER(scalloc(65,202););
printStats();
void* p356 = last_address;
PRINT_POINTER(smalloc(229););
printStats();
void* p357 = last_address;
PRINT_POINTER(smalloc(176););
printStats();
void* p358 = last_address;
PRINT_POINTER(srealloc(p171,170););
printStats();
void* p359 = last_address;
DEBUG_PRINT(sfree(p228););
printStats();
PRINT_POINTER(smalloc(193););
printStats();
void* p360 = last_address;
PRINT_POINTER(scalloc(186,152););
printStats();
void* p361 = last_address;
PRINT_POINTER(smalloc(58););
printStats();
void* p362 = last_address;
DEBUG_PRINT(sfree(p256););
printStats();
PRINT_POINTER(srealloc(p307,192););
printStats();
void* p363 = last_address;
PRINT_POINTER(scalloc(165,90););
printStats();
void* p364 = last_address;
PRINT_POINTER(smalloc(237););
printStats();
void* p365 = last_address;
DEBUG_PRINT(sfree(p243););
printStats();
DEBUG_PRINT(sfree(p102););
printStats();
PRINT_POINTER(smalloc(61););
printStats();
void* p366 = last_address;
PRINT_POINTER(smalloc(97););
printStats();
void* p367 = last_address;
PRINT_POINTER(smalloc(144););
printStats();
void* p368 = last_address;
PRINT_POINTER(srealloc(p288,144););
printStats();
void* p369 = last_address;
DEBUG_PRINT(sfree(p270););
printStats();
PRINT_POINTER(srealloc(p283,116););
printStats();
void* p370 = last_address;
PRINT_POINTER(scalloc(123,136););
printStats();
void* p371 = last_address;
PRINT_POINTER(srealloc(p317,28););
printStats();
void* p372 = last_address;
PRINT_POINTER(scalloc(110,195););
printStats();
void* p373 = last_address;
PRINT_POINTER(srealloc(p94,182););
printStats();
void* p374 = last_address;
PRINT_POINTER(scalloc(185,153););
printStats();
void* p375 = last_address;
PRINT_POINTER(srealloc(p229,94););
printStats();
void* p376 = last_address;
DEBUG_PRINT(sfree(p218););
printStats();
DEBUG_PRINT(sfree(p304););
printStats();
PRINT_POINTER(smalloc(88););
printStats();
void* p377 = last_address;
PRINT_POINTER(srealloc(p324,182););
printStats();
void* p378 = last_address;
PRINT_POINTER(scalloc(193,216););
printStats();
void* p379 = last_address;
PRINT_POINTER(smalloc(62););
printStats();
void* p380 = last_address;
DEBUG_PRINT(sfree(p230););
printStats();
DEBUG_PRINT(sfree(p321););
printStats();
PRINT_POINTER(scalloc(79,169););
printStats();
void* p381 = last_address;
DEBUG_PRINT(sfree(p340););
printStats();
PRINT_POINTER(srealloc(p294,148););
printStats();
void* p382 = last_address;
PRINT_POINTER(scalloc(84,80););
printStats();
void* p383 = last_address;
DEBUG_PRINT(sfree(p364););
printStats();
DEBUG_PRINT(sfree(p313););
printStats();
PRINT_POINTER(smalloc(149););
printStats();
void* p384 = last_address;
PRINT_POINTER(scalloc(141,218););
printStats();
void* p385 = last_address;
PRINT_POINTER(scalloc(47,11););
printStats();
void* p386 = last_address;
DEBUG_PRINT(sfree(p277););
printStats();
DEBUG_PRINT(sfree(p337););
printStats();
DEBUG_PRINT(sfree(p287););
printStats();
DEBUG_PRINT(sfree(p367););
printStats();
PRINT_POINTER(smalloc(194););
printStats();
void* p387 = last_address;
PRINT_POINTER(smalloc(51););
printStats();
void* p388 = last_address;
DEBUG_PRINT(sfree(p345););
printStats();
PRINT_POINTER(smalloc(119););
printStats();
void* p389 = last_address;
PRINT_POINTER(smalloc(15););
printStats();
void* p390 = last_address;
PRINT_POINTER(scalloc(0,51););
printStats();
void* p391 = last_address;
PRINT_POINTER(scalloc(242,137););
printStats();
void* p392 = last_address;
DEBUG_PRINT(sfree(p263););
printStats();
PRINT_POINTER(smalloc(162););
printStats();
void* p393 = last_address;
PRINT_POINTER(srealloc(p336,22););
printStats();
void* p394 = last_address;
PRINT_POINTER(smalloc(54););
printStats();
void* p395 = last_address;
PRINT_POINTER(scalloc(172,109););
printStats();
void* p396 = last_address;
DEBUG_PRINT(sfree(p147););
printStats();
PRINT_POINTER(srealloc(p221,140););
printStats();
void* p397 = last_address;
PRINT_POINTER(scalloc(65,245););
printStats();
void* p398 = last_address;
DEBUG_PRINT(sfree(p361););
printStats();
PRINT_POINTER(srealloc(p267,125););
printStats();
void* p399 = last_address;
DEBUG_PRINT(sfree(p295););
printStats();
DEBUG_PRINT(sfree(p389););
printStats();
PRINT_POINTER(smalloc(209););
printStats();
void* p400 = last_address;
PRINT_POINTER(srealloc(p296,94););
printStats();
void* p401 = last_address;
DEBUG_PRINT(sfree(p339););
printStats();
PRINT_POINTER(smalloc(34););
printStats();
void* p402 = last_address;
PRINT_POINTER(scalloc(105,171););
printStats();
void* p403 = last_address;
DEBUG_PRINT(sfree(p402););
printStats();
PRINT_POINTER(srealloc(p61,164););
printStats();
void* p404 = last_address;
PRINT_POINTER(srealloc(p152,127););
printStats();
void* p405 = last_address;
PRINT_POINTER(scalloc(109,182););
printStats();
void* p406 = last_address;
PRINT_POINTER(smalloc(246););
printStats();
void* p407 = last_address;
PRINT_POINTER(srealloc(p124,160););
printStats();
void* p408 = last_address;
DEBUG_PRINT(sfree(p212););
printStats();
DEBUG_PRINT(sfree(p245););
printStats();
PRINT_POINTER(scalloc(64,7););
printStats();
void* p409 = last_address;
PRINT_POINTER(scalloc(2,5););
printStats();
void* p410 = last_address;
PRINT_POINTER(scalloc(56,236););
printStats();
void* p411 = last_address;
DEBUG_PRINT(sfree(p311););
printStats();
PRINT_POINTER(smalloc(209););
printStats();
void* p412 = last_address;
PRINT_POINTER(scalloc(4,192););
printStats();
void* p413 = last_address;
PRINT_POINTER(smalloc(76););
printStats();
void* p414 = last_address;
DEBUG_PRINT(sfree(p185););
printStats();
PRINT_POINTER(scalloc(76,154););
printStats();
void* p415 = last_address;
PRINT_POINTER(srealloc(p205,157););
printStats();
void* p416 = last_address;
PRINT_POINTER(scalloc(169,200););
printStats();
void* p417 = last_address;
DEBUG_PRINT(sfree(p290););
printStats();
DEBUG_PRINT(sfree(p323););
printStats();
PRINT_POINTER(smalloc(102););
printStats();
void* p418 = last_address;
PRINT_POINTER(srealloc(p412,44););
printStats();
void* p419 = last_address;
PRINT_POINTER(smalloc(158););
printStats();
void* p420 = last_address;
PRINT_POINTER(scalloc(210,140););
printStats();
void* p421 = last_address;
PRINT_POINTER(scalloc(3,129););
printStats();
void* p422 = last_address;
PRINT_POINTER(smalloc(173););
printStats();
void* p423 = last_address;
PRINT_POINTER(srealloc(p278,146););
printStats();
void* p424 = last_address;
PRINT_POINTER(srealloc(p289,180););
printStats();
void* p425 = last_address;
DEBUG_PRINT(sfree(p422););
printStats();
PRINT_POINTER(srealloc(p276,81););
printStats();
void* p426 = last_address;
PRINT_POINTER(scalloc(148,179););
printStats();
void* p427 = last_address;
PRINT_POINTER(scalloc(245,160););
printStats();
void* p428 = last_address;
PRINT_POINTER(scalloc(191,159););
printStats();
void* p429 = last_address;
DEBUG_PRINT(sfree(p330););
printStats();
DEBUG_PRINT(sfree(p409););
printStats();
PRINT_POINTER(scalloc(51,196););
printStats();
void* p430 = last_address;
PRINT_POINTER(scalloc(185,68););
printStats();
void* p431 = last_address;
PRINT_POINTER(srealloc(p362,105););
printStats();
void* p432 = last_address;
PRINT_POINTER(srealloc(p432,129););
printStats();
void* p433 = last_address;
PRINT_POINTER(scalloc(185,171););
printStats();
void* p434 = last_address;
PRINT_POINTER(srealloc(p298,108););
printStats();
void* p435 = last_address;
DEBUG_PRINT(sfree(p380););
printStats();
DEBUG_PRINT(sfree(p370););
printStats();
PRINT_POINTER(smalloc(145););
printStats();
void* p436 = last_address;
PRINT_POINTER(scalloc(144,175););
printStats();
void* p437 = last_address;
PRINT_POINTER(srealloc(p394,142););
printStats();
void* p438 = last_address;
DEBUG_PRINT(sfree(p266););
printStats();
PRINT_POINTER(scalloc(177,69););
printStats();
void* p439 = last_address;
PRINT_POINTER(smalloc(233););
printStats();
void* p440 = last_address;
PRINT_POINTER(scalloc(58,90););
printStats();
void* p441 = last_address;
PRINT_POINTER(srealloc(p395,239););
printStats();
void* p442 = last_address;
DEBUG_PRINT(sfree(p392););
printStats();
DEBUG_PRINT(sfree(p371););
printStats();
DEBUG_PRINT(sfree(p399););
printStats();
PRINT_POINTER(smalloc(78););
printStats();
void* p443 = last_address;
PRINT_POINTER(scalloc(127,32););
printStats();
void* p444 = last_address;
PRINT_POINTER(smalloc(170););
printStats();
void* p445 = last_address;
PRINT_POINTER(smalloc(51););
printStats();
void* p446 = last_address;
PRINT_POINTER(smalloc(40););
printStats();
void* p447 = last_address;
PRINT_POINTER(srealloc(p240,209););
printStats();
void* p448 = last_address;
DEBUG_PRINT(sfree(p437););
printStats();
DEBUG_PRINT(sfree(p120););
printStats();
PRINT_POINTER(srealloc(p346,146););
printStats();
void* p449 = last_address;
DEBUG_PRINT(sfree(p440););
printStats();
PRINT_POINTER(smalloc(143););
printStats();
void* p450 = last_address;
PRINT_POINTER(smalloc(28););
printStats();
void* p451 = last_address;
PRINT_POINTER(srealloc(p251,214););
printStats();
void* p452 = last_address;
PRINT_POINTER(srealloc(p448,200););
printStats();
void* p453 = last_address;
DEBUG_PRINT(sfree(p400););
printStats();
PRINT_POINTER(scalloc(89,182););
printStats();
void* p454 = last_address;
PRINT_POINTER(scalloc(170,149););
printStats();
void* p455 = last_address;
DEBUG_PRINT(sfree(p406););
printStats();
PRINT_POINTER(scalloc(17,197););
printStats();
void* p456 = last_address;
PRINT_POINTER(scalloc(224,27););
printStats();
void* p457 = last_address;
DEBUG_PRINT(sfree(p453););
printStats();
DEBUG_PRINT(sfree(p446););
printStats();
PRINT_POINTER(scalloc(41,61););
printStats();
void* p458 = last_address;
PRINT_POINTER(scalloc(61,233););
printStats();
void* p459 = last_address;
DEBUG_PRINT(sfree(p442););
printStats();
PRINT_POINTER(smalloc(246););
printStats();
void* p460 = last_address;
PRINT_POINTER(scalloc(143,48););
printStats();
void* p461 = last_address;
DEBUG_PRINT(sfree(p316););
printStats();
PRINT_POINTER(smalloc(147););
printStats();
void* p462 = last_address;
PRINT_POINTER(srealloc(p90,173););
printStats();
void* p463 = last_address;
DEBUG_PRINT(sfree(p436););
printStats();
PRINT_POINTER(srealloc(p182,160););
printStats();
void* p464 = last_address;
PRINT_POINTER(smalloc(196););
printStats();
void* p465 = last_address;
PRINT_POINTER(srealloc(p274,137););
printStats();
void* p466 = last_address;
PRINT_POINTER(scalloc(221,160););
printStats();
void* p467 = last_address;
PRINT_POINTER(smalloc(90););
printStats();
void* p468 = last_address;
PRINT_POINTER(srealloc(p356,220););
printStats();
void* p469 = last_address;
PRINT_POINTER(smalloc(199););
printStats();
void* p470 = last_address;
PRINT_POINTER(scalloc(192,144););
printStats();
void* p471 = last_address;
DEBUG_PRINT(sfree(p341););
printStats();
PRINT_POINTER(srealloc(p450,4););
printStats();
void* p472 = last_address;
PRINT_POINTER(smalloc(193););
printStats();
void* p473 = last_address;
PRINT_POINTER(srealloc(p329,237););
printStats();
void* p474 = last_address;
PRINT_POINTER(smalloc(239););
printStats();
void* p475 = last_address;
PRINT_POINTER(srealloc(p373,46););
printStats();
void* p476 = last_address;
PRINT_POINTER(srealloc(p233,36););
printStats();
void* p477 = last_address;
PRINT_POINTER(scalloc(173,117););
printStats();
void* p478 = last_address;
PRINT_POINTER(srealloc(p360,233););
printStats();
void* p479 = last_address;
PRINT_POINTER(smalloc(102););
printStats();
void* p480 = last_address;
PRINT_POINTER(srealloc(p413,177););
printStats();
void* p481 = last_address;
PRINT_POINTER(scalloc(56,87););
printStats();
void* p482 = last_address;
PRINT_POINTER(smalloc(72););
printStats();
void* p483 = last_address;
PRINT_POINTER(srealloc(p419,228););
printStats();
void* p484 = last_address;
PRINT_POINTER(scalloc(192,174););
printStats();
void* p485 = last_address;
PRINT_POINTER(scalloc(7,223););
printStats();
void* p486 = last_address;
DEBUG_PRINT(sfree(p369););
printStats();
PRINT_POINTER(smalloc(197););
printStats();
void* p487 = last_address;
PRINT_POINTER(smalloc(70););
printStats();
void* p488 = last_address;
PRINT_POINTER(smalloc(0););
printStats();
void* p489 = last_address;
PRINT_POINTER(srealloc(p226,19););
printStats();
void* p490 = last_address;
PRINT_POINTER(smalloc(53););
printStats();
void* p491 = last_address;
DEBUG_PRINT(sfree(p455););
printStats();
PRINT_POINTER(srealloc(p408,93););
printStats();
void* p492 = last_address;
PRINT_POINTER(smalloc(202););
printStats();
void* p493 = last_address;
DEBUG_PRINT(sfree(p438););
printStats();
DEBUG_PRINT(sfree(p444););
printStats();
PRINT_POINTER(scalloc(200,127););
printStats();
void* p494 = last_address;
DEBUG_PRINT(sfree(p469););
printStats();
PRINT_POINTER(scalloc(138,62););
printStats();
void* p495 = last_address;
PRINT_POINTER(scalloc(209,130););
printStats();
void* p496 = last_address;
PRINT_POINTER(scalloc(23,154););
printStats();
void* p497 = last_address;
PRINT_POINTER(srealloc(p349,139););
printStats();
void* p498 = last_address;
PRINT_POINTER(scalloc(144,63););
printStats();
void* p499 = last_address;
PRINT_POINTER(smalloc(45););
printStats();
void* p500 = last_address;
PRINT_POINTER(scalloc(188,30););
printStats();
void* p501 = last_address;
PRINT_POINTER(srealloc(p264,80););
printStats();
void* p502 = last_address;
PRINT_POINTER(scalloc(55,249););
printStats();
void* p503 = last_address;
PRINT_POINTER(smalloc(161););
printStats();
void* p504 = last_address;
PRINT_POINTER(scalloc(126,86););
printStats();
void* p505 = last_address;
DEBUG_PRINT(sfree(p343););
printStats();
PRINT_POINTER(smalloc(67););
printStats();
void* p506 = last_address;
PRINT_POINTER(srealloc(p475,167););
printStats();
void* p507 = last_address;
PRINT_POINTER(scalloc(99,82););
printStats();
void* p508 = last_address;
PRINT_POINTER(srealloc(p507,212););
printStats();
void* p509 = last_address;
PRINT_POINTER(srealloc(p314,109););
printStats();
void* p510 = last_address;
PRINT_POINTER(smalloc(142););
printStats();
void* p511 = last_address;
PRINT_POINTER(srealloc(p237,76););
printStats();
void* p512 = last_address;
DEBUG_PRINT(sfree(p452););
printStats();
PRINT_POINTER(scalloc(54,57););
printStats();
void* p513 = last_address;
DEBUG_PRINT(sfree(p300););
printStats();
DEBUG_PRINT(sfree(p342););
printStats();
DEBUG_PRINT(sfree(p468););
printStats();
PRINT_POINTER(smalloc(44););
printStats();
void* p514 = last_address;
PRINT_POINTER(srealloc(p306,78););
printStats();
void* p515 = last_address;
PRINT_POINTER(scalloc(177,76););
printStats();
void* p516 = last_address;
PRINT_POINTER(srealloc(p244,88););
printStats();
void* p517 = last_address;
DEBUG_PRINT(sfree(p503););
printStats();
PRINT_POINTER(smalloc(118););
printStats();
void* p518 = last_address;
PRINT_POINTER(srealloc(p512,140););
printStats();
void* p519 = last_address;
PRINT_POINTER(smalloc(18););
printStats();
void* p520 = last_address;
PRINT_POINTER(srealloc(p377,10););
printStats();
void* p521 = last_address;
PRINT_POINTER(smalloc(159););
printStats();
void* p522 = last_address;
DEBUG_PRINT(sfree(p186););
printStats();
PRINT_POINTER(scalloc(226,112););
printStats();
void* p523 = last_address;
PRINT_POINTER(srealloc(p236,126););
printStats();
void* p524 = last_address;
DEBUG_PRINT(sfree(p499););
printStats();
PRINT_POINTER(srealloc(p273,8););
printStats();
void* p525 = last_address;
PRINT_POINTER(smalloc(210););
printStats();
void* p526 = last_address;
DEBUG_PRINT(sfree(p351););
printStats();
PRINT_POINTER(srealloc(p299,100););
printStats();
void* p527 = last_address;
DEBUG_PRINT(sfree(p379););
printStats();
PRINT_POINTER(smalloc(188););
printStats();
void* p528 = last_address;
PRINT_POINTER(scalloc(62,69););
printStats();
void* p529 = last_address;
PRINT_POINTER(smalloc(187););
printStats();
void* p530 = last_address;
PRINT_POINTER(smalloc(177););
printStats();
void* p531 = last_address;
PRINT_POINTER(smalloc(144););
printStats();
void* p532 = last_address;
PRINT_POINTER(srealloc(p410,62););
printStats();
void* p533 = last_address;
PRINT_POINTER(scalloc(100,15););
printStats();
void* p534 = last_address;
PRINT_POINTER(srealloc(p338,71););
printStats();
void* p535 = last_address;
PRINT_POINTER(smalloc(73););
printStats();
void* p536 = last_address;
DEBUG_PRINT(sfree(p398););
printStats();
DEBUG_PRINT(sfree(p401););
printStats();
PRINT_POINTER(smalloc(52););
printStats();
void* p537 = last_address;
PRINT_POINTER(scalloc(204,213););
printStats();
void* p538 = last_address;
PRINT_POINTER(srealloc(p484,113););
printStats();
void* p539 = last_address;
PRINT_POINTER(smalloc(139););
printStats();
void* p540 = last_address;
PRINT_POINTER(srealloc(p318,64););
printStats();
void* p541 = last_address;
DEBUG_PRINT(sfree(p491););
printStats();
DEBUG_PRINT(sfree(p293););
printStats();
PRINT_POINTER(srealloc(p445,111););
printStats();
void* p542 = last_address;
PRINT_POINTER(srealloc(p456,116););
printStats();
void* p543 = last_address;
DEBUG_PRINT(sfree(p430););
printStats();
PRINT_POINTER(srealloc(p268,154););
printStats();
void* p544 = last_address;
PRINT_POINTER(scalloc(187,237););
printStats();
void* p545 = last_address;
DEBUG_PRINT(sfree(p366););
printStats();
DEBUG_PRINT(sfree(p99););
printStats();
PRINT_POINTER(srealloc(p467,222););
printStats();
void* p546 = last_address;
PRINT_POINTER(scalloc(239,212););
printStats();
void* p547 = last_address;
PRINT_POINTER(smalloc(59););
printStats();
void* p548 = last_address;
DEBUG_PRINT(sfree(p517););
printStats();
DEBUG_PRINT(sfree(p374););
printStats();
PRINT_POINTER(scalloc(131,66););
printStats();
void* p549 = last_address;
PRINT_POINTER(smalloc(68););
printStats();
void* p550 = last_address;
DEBUG_PRINT(sfree(p427););
printStats();
DEBUG_PRINT(sfree(p474););
printStats();
PRINT_POINTER(srealloc(p435,73););
printStats();
void* p551 = last_address;
PRINT_POINTER(smalloc(120););
printStats();
void* p552 = last_address;
PRINT_POINTER(smalloc(35););
printStats();
void* p553 = last_address;
PRINT_POINTER(scalloc(151,163););
printStats();
void* p554 = last_address;
DEBUG_PRINT(sfree(p407););
printStats();
DEBUG_PRINT(sfree(p328););
printStats();
PRINT_POINTER(smalloc(69););
printStats();
void* p555 = last_address;
PRINT_POINTER(smalloc(152););
printStats();
void* p556 = last_address;
PRINT_POINTER(srealloc(p478,88););
printStats();
void* p557 = last_address;
PRINT_POINTER(srealloc(p210,165););
printStats();
void* p558 = last_address;
PRINT_POINTER(scalloc(180,22););
printStats();
void* p559 = last_address;
PRINT_POINTER(smalloc(156););
printStats();
void* p560 = last_address;
PRINT_POINTER(srealloc(p184,207););
printStats();
void* p561 = last_address;
PRINT_POINTER(smalloc(95););
printStats();
void* p562 = last_address;
DEBUG_PRINT(sfree(p262););
printStats();
PRINT_POINTER(srealloc(p177,119););
printStats();
void* p563 = last_address;
PRINT_POINTER(srealloc(p541,245););
printStats();
void* p564 = last_address;
PRINT_POINTER(smalloc(44););
printStats();
void* p565 = last_address;
DEBUG_PRINT(sfree(p548););
printStats();
PRINT_POINTER(srealloc(p381,21););
printStats();
void* p566 = last_address;
DEBUG_PRINT(sfree(p137););
printStats();
PRINT_POINTER(scalloc(222,42););
printStats();
void* p567 = last_address;
PRINT_POINTER(scalloc(28,114););
printStats();
void* p568 = last_address;
PRINT_POINTER(srealloc(p561,190););
printStats();
void* p569 = last_address;
PRINT_POINTER(smalloc(22););
printStats();
void* p570 = last_address;
PRINT_POINTER(srealloc(p556,152););
printStats();
void* p571 = last_address;
PRINT_POINTER(smalloc(91););
printStats();
void* p572 = last_address;
PRINT_POINTER(scalloc(106,17););
printStats();
void* p573 = last_address;
PRINT_POINTER(srealloc(p347,33););
printStats();
void* p574 = last_address;
DEBUG_PRINT(sfree(p519););
printStats();
PRINT_POINTER(scalloc(100,220););
printStats();
void* p575 = last_address;
PRINT_POINTER(srealloc(p415,35););
printStats();
void* p576 = last_address;
DEBUG_PRINT(sfree(p569););
printStats();
DEBUG_PRINT(sfree(p497););
printStats();
DEBUG_PRINT(sfree(p564););
printStats();
DEBUG_PRINT(sfree(p269););
printStats();
PRINT_POINTER(srealloc(p496,242););
printStats();
void* p577 = last_address;
PRINT_POINTER(smalloc(178););
printStats();
void* p578 = last_address;
PRINT_POINTER(srealloc(p532,86););
printStats();
void* p579 = last_address;
PRINT_POINTER(scalloc(142,231););
printStats();
void* p580 = last_address;
PRINT_POINTER(srealloc(p305,219););
printStats();
void* p581 = last_address;
PRINT_POINTER(smalloc(42););
printStats();
void* p582 = last_address;
DEBUG_PRINT(sfree(p292););
printStats();
PRINT_POINTER(smalloc(107););
printStats();
void* p583 = last_address;
DEBUG_PRINT(sfree(p520););
printStats();
PRINT_POINTER(srealloc(p573,145););
printStats();
void* p584 = last_address;
PRINT_POINTER(srealloc(p363,32););
printStats();
void* p585 = last_address;
DEBUG_PRINT(sfree(p384););
printStats();
DEBUG_PRINT(sfree(p284););
printStats();
PRINT_POINTER(scalloc(86,186););
printStats();
void* p586 = last_address;
PRINT_POINTER(scalloc(177,30););
printStats();
void* p587 = last_address;
PRINT_POINTER(scalloc(36,236););
printStats();
void* p588 = last_address;
PRINT_POINTER(smalloc(25););
printStats();
void* p589 = last_address;
PRINT_POINTER(scalloc(189,208););
printStats();
void* p590 = last_address;
PRINT_POINTER(smalloc(226););
printStats();
void* p591 = last_address;
DEBUG_PRINT(sfree(p500););
printStats();
DEBUG_PRINT(sfree(p516););
printStats();
DEBUG_PRINT(sfree(p457););
printStats();
PRINT_POINTER(smalloc(242););
printStats();
void* p592 = last_address;
PRINT_POINTER(smalloc(5););
printStats();
void* p593 = last_address;
PRINT_POINTER(scalloc(23,119););
printStats();
void* p594 = last_address;
PRINT_POINTER(srealloc(p466,5););
printStats();
void* p595 = last_address;
DEBUG_PRINT(sfree(p553););
printStats();
PRINT_POINTER(smalloc(195););
printStats();
void* p596 = last_address;
PRINT_POINTER(smalloc(148););
printStats();
void* p597 = last_address;
PRINT_POINTER(scalloc(175,175););
printStats();
void* p598 = last_address;
DEBUG_PRINT(sfree(p470););
printStats();
DEBUG_PRINT(sfree(p506););
printStats();
PRINT_POINTER(scalloc(47,187););
printStats();
void* p599 = last_address;
PRINT_POINTER(srealloc(p411,44););
printStats();
void* p600 = last_address;
PRINT_POINTER(smalloc(112););
printStats();
void* p601 = last_address;
PRINT_POINTER(smalloc(51););
printStats();
void* p602 = last_address;
PRINT_POINTER(smalloc(38););
printStats();
void* p603 = last_address;
DEBUG_PRINT(sfree(p420););
printStats();
PRINT_POINTER(srealloc(p515,80););
printStats();
void* p604 = last_address;
PRINT_POINTER(srealloc(p390,134););
printStats();
void* p605 = last_address;
PRINT_POINTER(smalloc(140););
printStats();
void* p606 = last_address;
DEBUG_PRINT(sfree(p557););
printStats();
PRINT_POINTER(smalloc(193););
printStats();
void* p607 = last_address;
PRINT_POINTER(scalloc(37,32););
printStats();
void* p608 = last_address;
DEBUG_PRINT(sfree(p105););
printStats();
DEBUG_PRINT(sfree(p405););
printStats();
PRINT_POINTER(scalloc(204,208););
printStats();
void* p609 = last_address;
DEBUG_PRINT(sfree(p480););
printStats();
PRINT_POINTER(smalloc(121););
printStats();
void* p610 = last_address;
PRINT_POINTER(smalloc(142););
printStats();
void* p611 = last_address;
PRINT_POINTER(srealloc(p521,6););
printStats();
void* p612 = last_address;
PRINT_POINTER(srealloc(p431,61););
printStats();
void* p613 = last_address;
DEBUG_PRINT(sfree(p254););
printStats();
PRINT_POINTER(scalloc(54,49););
printStats();
void* p614 = last_address;
PRINT_POINTER(scalloc(132,173););
printStats();
void* p615 = last_address;
PRINT_POINTER(smalloc(243););
printStats();
void* p616 = last_address;
PRINT_POINTER(scalloc(139,205););
printStats();
void* p617 = last_address;
PRINT_POINTER(smalloc(80););
printStats();
void* p618 = last_address;
PRINT_POINTER(smalloc(47););
printStats();
void* p619 = last_address;
PRINT_POINTER(smalloc(211););
printStats();
void* p620 = last_address;
PRINT_POINTER(scalloc(131,212););
printStats();
void* p621 = last_address;
DEBUG_PRINT(sfree(p588););
printStats();
PRINT_POINTER(srealloc(p579,74););
printStats();
void* p622 = last_address;
PRINT_POINTER(srealloc(p614,85););
printStats();
void* p623 = last_address;
PRINT_POINTER(srealloc(p526,103););
printStats();
void* p624 = last_address;
PRINT_POINTER(smalloc(94););
printStats();
void* p625 = last_address;
PRINT_POINTER(smalloc(148););
printStats();
void* p626 = last_address;
DEBUG_PRINT(sfree(p576););
printStats();
DEBUG_PRINT(sfree(p590););
printStats();
PRINT_POINTER(smalloc(148););
printStats();
void* p627 = last_address;
DEBUG_PRINT(sfree(p297););
printStats();
PRINT_POINTER(srealloc(p544,35););
printStats();
void* p628 = last_address;
PRINT_POINTER(smalloc(107););
printStats();
void* p629 = last_address;
PRINT_POINTER(scalloc(242,195););
printStats();
void* p630 = last_address;
DEBUG_PRINT(sfree(p565););
printStats();
DEBUG_PRINT(sfree(p365););
printStats();
PRINT_POINTER(srealloc(p555,99););
printStats();
void* p631 = last_address;
PRINT_POINTER(smalloc(5););
printStats();
void* p632 = last_address;
PRINT_POINTER(srealloc(p611,55););
printStats();
void* p633 = last_address;
DEBUG_PRINT(sfree(p331););
printStats();
PRINT_POINTER(srealloc(p567,67););
printStats();
void* p634 = last_address;
PRINT_POINTER(srealloc(p461,71););
printStats();
void* p635 = last_address;
DEBUG_PRINT(sfree(p528););
printStats();
PRINT_POINTER(scalloc(64,23););
printStats();
void* p636 = last_address;
PRINT_POINTER(srealloc(p622,33););
printStats();
void* p637 = last_address;
PRINT_POINTER(smalloc(65););
printStats();
void* p638 = last_address;
PRINT_POINTER(srealloc(p623,195););
printStats();
void* p639 = last_address;
DEBUG_PRINT(sfree(p488););
printStats();
PRINT_POINTER(scalloc(113,212););
printStats();
void* p640 = last_address;
PRINT_POINTER(smalloc(25););
printStats();
void* p641 = last_address;
PRINT_POINTER(scalloc(230,202););
printStats();
void* p642 = last_address;
PRINT_POINTER(scalloc(172,138););
printStats();
void* p643 = last_address;
PRINT_POINTER(scalloc(112,238););
printStats();
void* p644 = last_address;
PRINT_POINTER(scalloc(244,211););
printStats();
void* p645 = last_address;
PRINT_POINTER(smalloc(170););
printStats();
void* p646 = last_address;
DEBUG_PRINT(sfree(p458););
printStats();
PRINT_POINTER(scalloc(166,27););
printStats();
void* p647 = last_address;
DEBUG_PRINT(sfree(p593););
printStats();
PRINT_POINTER(scalloc(222,189););
printStats();
void* p648 = last_address;
PRINT_POINTER(smalloc(244););
printStats();
void* p649 = last_address;
PRINT_POINTER(scalloc(243,169););
printStats();
void* p650 = last_address;
PRINT_POINTER(scalloc(66,105););
printStats();
void* p651 = last_address;
PRINT_POINTER(srealloc(p421,226););
printStats();
void* p652 = last_address;
DEBUG_PRINT(sfree(p599););
printStats();
PRINT_POINTER(smalloc(141););
printStats();
void* p653 = last_address;
PRINT_POINTER(srealloc(p487,120););
printStats();
void* p654 = last_address;
PRINT_POINTER(smalloc(182););
printStats();
void* p655 = last_address;
PRINT_POINTER(scalloc(170,224););
printStats();
void* p656 = last_address;
PRINT_POINTER(smalloc(227););
printStats();
void* p657 = last_address;
PRINT_POINTER(smalloc(17););
printStats();
void* p658 = last_address;
DEBUG_PRINT(sfree(p596););
printStats();
PRINT_POINTER(scalloc(84,29););
printStats();
void* p659 = last_address;
PRINT_POINTER(smalloc(12););
printStats();
void* p660 = last_address;
PRINT_POINTER(smalloc(178););
printStats();
void* p661 = last_address;
PRINT_POINTER(smalloc(83););
printStats();
void* p662 = last_address;
DEBUG_PRINT(sfree(p566););
printStats();
PRINT_POINTER(smalloc(138););
printStats();
void* p663 = last_address;
PRINT_POINTER(scalloc(184,194););
printStats();
void* p664 = last_address;
DEBUG_PRINT(sfree(p550););
printStats();
PRINT_POINTER(scalloc(24,142););
printStats();
void* p665 = last_address;
PRINT_POINTER(scalloc(70,20););
printStats();
void* p666 = last_address;
PRINT_POINTER(smalloc(118););
printStats();
void* p667 = last_address;
PRINT_POINTER(srealloc(p279,86););
printStats();
void* p668 = last_address;
PRINT_POINTER(smalloc(143););
printStats();
void* p669 = last_address;
PRINT_POINTER(smalloc(119););
printStats();
void* p670 = last_address;
PRINT_POINTER(srealloc(p425,237););
printStats();
void* p671 = last_address;
DEBUG_PRINT(sfree(p655););
printStats();
PRINT_POINTER(srealloc(p634,213););
printStats();
void* p672 = last_address;
PRINT_POINTER(scalloc(24,177););
printStats();
void* p673 = last_address;
PRINT_POINTER(srealloc(p551,182););
printStats();
void* p674 = last_address;
PRINT_POINTER(scalloc(39,79););
printStats();
void* p675 = last_address;
DEBUG_PRINT(sfree(p531););
printStats();
DEBUG_PRINT(sfree(p597););
printStats();
PRINT_POINTER(smalloc(221););
printStats();
void* p676 = last_address;
PRINT_POINTER(smalloc(8););
printStats();
void* p677 = last_address;
DEBUG_PRINT(sfree(p558););
printStats();
PRINT_POINTER(srealloc(p581,191););
printStats();
void* p678 = last_address;
PRINT_POINTER(scalloc(49,95););
printStats();
void* p679 = last_address;
PRINT_POINTER(srealloc(p649,10););
printStats();
void* p680 = last_address;
DEBUG_PRINT(sfree(p678););
printStats();
PRINT_POINTER(smalloc(217););
printStats();
void* p681 = last_address;
PRINT_POINTER(scalloc(61,35););
printStats();
void* p682 = last_address;
PRINT_POINTER(scalloc(142,133););
printStats();
void* p683 = last_address;
PRINT_POINTER(srealloc(p618,39););
printStats();
void* p684 = last_address;
DEBUG_PRINT(sfree(p203););
printStats();
PRINT_POINTER(smalloc(16););
printStats();
void* p685 = last_address;
PRINT_POINTER(scalloc(197,127););
printStats();
void* p686 = last_address;
PRINT_POINTER(scalloc(224,188););
printStats();
void* p687 = last_address;
PRINT_POINTER(smalloc(36););
printStats();
void* p688 = last_address;
PRINT_POINTER(smalloc(54););
printStats();
void* p689 = last_address;
PRINT_POINTER(srealloc(p646,128););
printStats();
void* p690 = last_address;
PRINT_POINTER(smalloc(222););
printStats();
void* p691 = last_address;
DEBUG_PRINT(sfree(p463););
printStats();
PRINT_POINTER(scalloc(82,236););
printStats();
void* p692 = last_address;
PRINT_POINTER(srealloc(p462,110););
printStats();
void* p693 = last_address;
PRINT_POINTER(smalloc(153););
printStats();
void* p694 = last_address;
PRINT_POINTER(scalloc(125,70););
printStats();
void* p695 = last_address;
DEBUG_PRINT(sfree(p538););
printStats();
PRINT_POINTER(srealloc(p628,41););
printStats();
void* p696 = last_address;
PRINT_POINTER(smalloc(227););
printStats();
void* p697 = last_address;
DEBUG_PRINT(sfree(p483););
printStats();
PRINT_POINTER(srealloc(p671,58););
printStats();
void* p698 = last_address;
DEBUG_PRINT(sfree(p626););
printStats();
PRINT_POINTER(scalloc(7,120););
printStats();
void* p699 = last_address;
PRINT_POINTER(scalloc(14,92););
printStats();
void* p700 = last_address;
PRINT_POINTER(srealloc(p672,208););
printStats();
void* p701 = last_address;
PRINT_POINTER(srealloc(p616,39););
printStats();
void* p702 = last_address;
PRINT_POINTER(scalloc(38,86););
printStats();
void* p703 = last_address;
PRINT_POINTER(scalloc(194,103););
printStats();
void* p704 = last_address;
PRINT_POINTER(scalloc(194,79););
printStats();
void* p705 = last_address;
PRINT_POINTER(srealloc(p545,229););
printStats();
void* p706 = last_address;
PRINT_POINTER(srealloc(p498,63););
printStats();
void* p707 = last_address;
DEBUG_PRINT(sfree(p546););
printStats();
PRINT_POINTER(srealloc(p536,24););
printStats();
void* p708 = last_address;
DEBUG_PRINT(sfree(p687););
printStats();
PRINT_POINTER(smalloc(103););
printStats();
void* p709 = last_address;
PRINT_POINTER(srealloc(p375,106););
printStats();
void* p710 = last_address;
PRINT_POINTER(smalloc(146););
printStats();
void* p711 = last_address;
DEBUG_PRINT(sfree(p613););
printStats();
PRINT_POINTER(smalloc(11););
printStats();
void* p712 = last_address;
PRINT_POINTER(smalloc(174););
printStats();
void* p713 = last_address;
DEBUG_PRINT(sfree(p577););
printStats();
DEBUG_PRINT(sfree(p682););
printStats();
PRINT_POINTER(scalloc(245,45););
printStats();
void* p714 = last_address;
PRINT_POINTER(scalloc(142,132););
printStats();
void* p715 = last_address;
PRINT_POINTER(srealloc(p656,167););
printStats();
void* p716 = last_address;
PRINT_POINTER(smalloc(174););
printStats();
void* p717 = last_address;
PRINT_POINTER(scalloc(41,18););
printStats();
void* p718 = last_address;
PRINT_POINTER(srealloc(p378,130););
printStats();
void* p719 = last_address;
PRINT_POINTER(smalloc(233););
printStats();
void* p720 = last_address;
DEBUG_PRINT(sfree(p604););
printStats();
DEBUG_PRINT(sfree(p344););
printStats();
PRINT_POINTER(smalloc(93););
printStats();
void* p721 = last_address;
PRINT_POINTER(smalloc(83););
printStats();
void* p722 = last_address;
DEBUG_PRINT(sfree(p627););
printStats();
PRINT_POINTER(srealloc(p562,113););
printStats();
void* p723 = last_address;
PRINT_POINTER(srealloc(p668,249););
printStats();
void* p724 = last_address;
PRINT_POINTER(smalloc(201););
printStats();
void* p725 = last_address;
PRINT_POINTER(srealloc(p554,220););
printStats();
void* p726 = last_address;
DEBUG_PRINT(sfree(p510););
printStats();
DEBUG_PRINT(sfree(p174););
printStats();
DEBUG_PRINT(sfree(p591););
printStats();
PRINT_POINTER(scalloc(22,112););
printStats();
void* p727 = last_address;
DEBUG_PRINT(sfree(p386););
printStats();
PRINT_POINTER(srealloc(p612,234););
printStats();
void* p728 = last_address;
PRINT_POINTER(scalloc(123,216););
printStats();
void* p729 = last_address;
DEBUG_PRINT(sfree(p239););
printStats();
PRINT_POINTER(srealloc(p397,172););
printStats();
void* p730 = last_address;
PRINT_POINTER(smalloc(245););
printStats();
void* p731 = last_address;
PRINT_POINTER(srealloc(p434,191););
printStats();
void* p732 = last_address;
PRINT_POINTER(scalloc(19,121););
printStats();
void* p733 = last_address;
PRINT_POINTER(scalloc(4,153););
printStats();
void* p734 = last_address;
PRINT_POINTER(smalloc(238););
printStats();
void* p735 = last_address;
PRINT_POINTER(smalloc(57););
printStats();
void* p736 = last_address;
PRINT_POINTER(smalloc(75););
printStats();
void* p737 = last_address;
DEBUG_PRINT(sfree(p598););
printStats();
PRINT_POINTER(smalloc(106););
printStats();
void* p738 = last_address;
DEBUG_PRINT(sfree(p585););
printStats();
DEBUG_PRINT(sfree(p699););
printStats();
PRINT_POINTER(srealloc(p589,125););
printStats();
void* p739 = last_address;
PRINT_POINTER(smalloc(203););
printStats();
void* p740 = last_address;
PRINT_POINTER(scalloc(237,172););
printStats();
void* p741 = last_address;
PRINT_POINTER(scalloc(68,193););
printStats();
void* p742 = last_address;
PRINT_POINTER(scalloc(161,196););
printStats();
void* p743 = last_address;
PRINT_POINTER(smalloc(2););
printStats();
void* p744 = last_address;
DEBUG_PRINT(sfree(p570););
printStats();
PRINT_POINTER(smalloc(9););
printStats();
void* p745 = last_address;
PRINT_POINTER(srealloc(p742,14););
printStats();
void* p746 = last_address;
PRINT_POINTER(scalloc(191,171););
printStats();
void* p747 = last_address;
PRINT_POINTER(smalloc(248););
printStats();
void* p748 = last_address;
DEBUG_PRINT(sfree(p460););
printStats();
PRINT_POINTER(scalloc(116,190););
printStats();
void* p749 = last_address;
PRINT_POINTER(scalloc(21,211););
printStats();
void* p750 = last_address;
PRINT_POINTER(srealloc(p441,137););
printStats();
void* p751 = last_address;
PRINT_POINTER(srealloc(p657,90););
printStats();
void* p752 = last_address;
PRINT_POINTER(srealloc(p736,113););
printStats();
void* p753 = last_address;
PRINT_POINTER(srealloc(p653,8););
printStats();
void* p754 = last_address;
PRINT_POINTER(scalloc(58,115););
printStats();
void* p755 = last_address;
PRINT_POINTER(scalloc(89,202););
printStats();
void* p756 = last_address;
PRINT_POINTER(scalloc(173,116););
printStats();
void* p757 = last_address;
PRINT_POINTER(smalloc(120););
printStats();
void* p758 = last_address;
PRINT_POINTER(smalloc(62););
printStats();
void* p759 = last_address;
DEBUG_PRINT(sfree(p689););
printStats();
PRINT_POINTER(smalloc(245););
printStats();
void* p760 = last_address;
PRINT_POINTER(scalloc(160,61););
printStats();
void* p761 = last_address;
PRINT_POINTER(srealloc(p477,109););
printStats();
void* p762 = last_address;
PRINT_POINTER(srealloc(p739,150););
printStats();
void* p763 = last_address;
PRINT_POINTER(scalloc(50,82););
printStats();
void* p764 = last_address;
PRINT_POINTER(smalloc(201););
printStats();
void* p765 = last_address;
PRINT_POINTER(smalloc(7););
printStats();
void* p766 = last_address;
PRINT_POINTER(smalloc(143););
printStats();
void* p767 = last_address;
PRINT_POINTER(srealloc(p712,232););
printStats();
void* p768 = last_address;
PRINT_POINTER(smalloc(237););
printStats();
void* p769 = last_address;
PRINT_POINTER(smalloc(97););
printStats();
void* p770 = last_address;
PRINT_POINTER(scalloc(83,188););
printStats();
void* p771 = last_address;
PRINT_POINTER(scalloc(76,176););
printStats();
void* p772 = last_address;
PRINT_POINTER(srealloc(p660,238););
printStats();
void* p773 = last_address;
PRINT_POINTER(smalloc(12););
printStats();
void* p774 = last_address;
PRINT_POINTER(scalloc(82,35););
printStats();
void* p775 = last_address;
DEBUG_PRINT(sfree(p698););
printStats();
PRINT_POINTER(scalloc(188,109););
printStats();
void* p776 = last_address;
PRINT_POINTER(smalloc(91););
printStats();
void* p777 = last_address;
PRINT_POINTER(scalloc(108,102););
printStats();
void* p778 = last_address;
PRINT_POINTER(smalloc(16););
printStats();
void* p779 = last_address;
PRINT_POINTER(scalloc(7,56););
printStats();
void* p780 = last_address;
PRINT_POINTER(smalloc(49););
printStats();
void* p781 = last_address;
PRINT_POINTER(srealloc(p359,77););
printStats();
void* p782 = last_address;
DEBUG_PRINT(sfree(p348););
printStats();
DEBUG_PRINT(sfree(p610););
printStats();
PRINT_POINTER(scalloc(166,145););
printStats();
void* p783 = last_address;
PRINT_POINTER(srealloc(p396,165););
printStats();
void* p784 = last_address;
PRINT_POINTER(smalloc(154););
printStats();
void* p785 = last_address;
DEBUG_PRINT(sfree(p584););
printStats();
DEBUG_PRINT(sfree(p319););
printStats();
PRINT_POINTER(scalloc(88,128););
printStats();
void* p786 = last_address;
PRINT_POINTER(smalloc(6););
printStats();
void* p787 = last_address;
PRINT_POINTER(smalloc(225););
printStats();
void* p788 = last_address;
PRINT_POINTER(scalloc(80,59););
printStats();
void* p789 = last_address;
PRINT_POINTER(scalloc(147,100););
printStats();
void* p790 = last_address;
DEBUG_PRINT(sfree(p776););
printStats();
PRINT_POINTER(scalloc(70,5););
printStats();
void* p791 = last_address;
PRINT_POINTER(smalloc(174););
printStats();
void* p792 = last_address;
DEBUG_PRINT(sfree(p779););
printStats();
PRINT_POINTER(scalloc(192,123););
printStats();
void* p793 = last_address;
PRINT_POINTER(srealloc(p428,192););
printStats();
void* p794 = last_address;
PRINT_POINTER(scalloc(120,53););
printStats();
void* p795 = last_address;
DEBUG_PRINT(sfree(p357););
printStats();
PRINT_POINTER(smalloc(141););
printStats();
void* p796 = last_address;
DEBUG_PRINT(sfree(p426););
printStats();
PRINT_POINTER(smalloc(70););
printStats();
void* p797 = last_address;
DEBUG_PRINT(sfree(p449););
printStats();
PRINT_POINTER(srealloc(p423,14););
printStats();
void* p798 = last_address;
PRINT_POINTER(scalloc(248,74););
printStats();
void* p799 = last_address;
PRINT_POINTER(scalloc(177,166););
printStats();
void* p800 = last_address;
PRINT_POINTER(scalloc(207,47););
printStats();
void* p801 = last_address;
PRINT_POINTER(smalloc(76););
printStats();
void* p802 = last_address;
PRINT_POINTER(srealloc(p771,185););
printStats();
void* p803 = last_address;
PRINT_POINTER(srealloc(p559,210););
printStats();
void* p804 = last_address;
PRINT_POINTER(smalloc(240););
printStats();
void* p805 = last_address;
DEBUG_PRINT(sfree(p231););
printStats();
PRINT_POINTER(scalloc(119,60););
printStats();
void* p806 = last_address;
PRINT_POINTER(scalloc(26,44););
printStats();
void* p807 = last_address;
PRINT_POINTER(smalloc(184););
printStats();
void* p808 = last_address;
PRINT_POINTER(scalloc(125,33););
printStats();
void* p809 = last_address;
DEBUG_PRINT(sfree(p594););
printStats();
PRINT_POINTER(scalloc(125,92););
printStats();
void* p810 = last_address;
DEBUG_PRINT(sfree(p312););
printStats();
PRINT_POINTER(srealloc(p404,95););
printStats();
void* p811 = last_address;
DEBUG_PRINT(sfree(p780););
printStats();
DEBUG_PRINT(sfree(p246););
printStats();
DEBUG_PRINT(sfree(p620););
printStats();
PRINT_POINTER(srealloc(p790,6););
printStats();
void* p812 = last_address;
PRINT_POINTER(smalloc(166););
printStats();
void* p813 = last_address;
PRINT_POINTER(scalloc(8,244););
printStats();
void* p814 = last_address;
PRINT_POINTER(srealloc(p309,230););
printStats();
void* p815 = last_address;
PRINT_POINTER(srealloc(p643,35););
printStats();
void* p816 = last_address;
PRINT_POINTER(smalloc(202););
printStats();
void* p817 = last_address;
PRINT_POINTER(srealloc(p454,188););
printStats();
void* p818 = last_address;
PRINT_POINTER(scalloc(79,10););
printStats();
void* p819 = last_address;
DEBUG_PRINT(sfree(p795););
printStats();
PRINT_POINTER(smalloc(60););
printStats();
void* p820 = last_address;
PRINT_POINTER(srealloc(p707,151););
printStats();
void* p821 = last_address;
PRINT_POINTER(srealloc(p602,75););
printStats();
void* p822 = last_address;
PRINT_POINTER(smalloc(185););
printStats();
void* p823 = last_address;
PRINT_POINTER(srealloc(p763,88););
printStats();
void* p824 = last_address;
PRINT_POINTER(scalloc(116,111););
printStats();
void* p825 = last_address;
PRINT_POINTER(scalloc(111,245););
printStats();
void* p826 = last_address;
PRINT_POINTER(scalloc(1,113););
printStats();
void* p827 = last_address;
PRINT_POINTER(smalloc(0););
printStats();
void* p828 = last_address;
PRINT_POINTER(scalloc(238,43););
printStats();
void* p829 = last_address;
PRINT_POINTER(srealloc(p529,112););
printStats();
void* p830 = last_address;
PRINT_POINTER(smalloc(124););
printStats();
void* p831 = last_address;
DEBUG_PRINT(sfree(p383););
printStats();
DEBUG_PRINT(sfree(p631););
printStats();
PRINT_POINTER(srealloc(p607,93););
printStats();
void* p832 = last_address;
DEBUG_PRINT(sfree(p723););
printStats();
PRINT_POINTER(srealloc(p640,186););
printStats();
void* p833 = last_address;
PRINT_POINTER(scalloc(69,114););
printStats();
void* p834 = last_address;
PRINT_POINTER(scalloc(176,76););
printStats();
void* p835 = last_address;
PRINT_POINTER(smalloc(218););
printStats();
void* p836 = last_address;
PRINT_POINTER(smalloc(169););
printStats();
void* p837 = last_address;
DEBUG_PRINT(sfree(p711););
printStats();
PRINT_POINTER(smalloc(172););
printStats();
void* p838 = last_address;
PRINT_POINTER(scalloc(162,102););
printStats();
void* p839 = last_address;
PRINT_POINTER(srealloc(p211,176););
printStats();
void* p840 = last_address;
PRINT_POINTER(srealloc(p443,219););
printStats();
void* p841 = last_address;
PRINT_POINTER(smalloc(110););
printStats();
void* p842 = last_address;
PRINT_POINTER(smalloc(201););
printStats();
void* p843 = last_address;
DEBUG_PRINT(sfree(p350););
printStats();
PRINT_POINTER(smalloc(162););
printStats();
void* p844 = last_address;
PRINT_POINTER(scalloc(1,120););
printStats();
void* p845 = last_address;
PRINT_POINTER(srealloc(p200,123););
printStats();
void* p846 = last_address;
DEBUG_PRINT(sfree(p837););
printStats();
DEBUG_PRINT(sfree(p575););
printStats();
PRINT_POINTER(smalloc(109););
printStats();
void* p847 = last_address;
PRINT_POINTER(scalloc(50,93););
printStats();
void* p848 = last_address;
PRINT_POINTER(scalloc(237,9););
printStats();
void* p849 = last_address;
PRINT_POINTER(srealloc(p686,236););
printStats();
void* p850 = last_address;
PRINT_POINTER(srealloc(p765,30););
printStats();
void* p851 = last_address;
PRINT_POINTER(scalloc(99,53););
printStats();
void* p852 = last_address;
DEBUG_PRINT(sfree(p740););
printStats();
PRINT_POINTER(srealloc(p459,200););
printStats();
void* p853 = last_address;
PRINT_POINTER(smalloc(6););
printStats();
void* p854 = last_address;
PRINT_POINTER(srealloc(p722,133););
printStats();
void* p855 = last_address;
PRINT_POINTER(smalloc(83););
printStats();
void* p856 = last_address;
PRINT_POINTER(smalloc(130););
printStats();
void* p857 = last_address;
PRINT_POINTER(srealloc(p320,96););
printStats();
void* p858 = last_address;
PRINT_POINTER(scalloc(178,155););
printStats();
void* p859 = last_address;
PRINT_POINTER(smalloc(16););
printStats();
void* p860 = last_address;
PRINT_POINTER(srealloc(p815,235););
printStats();
void* p861 = last_address;
PRINT_POINTER(scalloc(131,176););
printStats();
void* p862 = last_address;
DEBUG_PRINT(sfree(p540););
printStats();
PRINT_POINTER(scalloc(42,154););
printStats();
void* p863 = last_address;
PRINT_POINTER(scalloc(12,76););
printStats();
void* p864 = last_address;
PRINT_POINTER(scalloc(42,111););
printStats();
void* p865 = last_address;
PRINT_POINTER(scalloc(57,171););
printStats();
void* p866 = last_address;
DEBUG_PRINT(sfree(p827););
printStats();
DEBUG_PRINT(sfree(p764););
printStats();
PRINT_POINTER(srealloc(p57,49););
printStats();
void* p867 = last_address;
PRINT_POINTER(srealloc(p621,186););
printStats();
void* p868 = last_address;
PRINT_POINTER(srealloc(p794,44););
printStats();
void* p869 = last_address;
DEBUG_PRINT(sfree(p265););
printStats();
PRINT_POINTER(srealloc(p509,112););
printStats();
void* p870 = last_address;
PRINT_POINTER(scalloc(80,180););
printStats();
void* p871 = last_address;
PRINT_POINTER(scalloc(43,2););
printStats();
void* p872 = last_address;
PRINT_POINTER(srealloc(p834,118););
printStats();
void* p873 = last_address;
PRINT_POINTER(scalloc(142,53););
printStats();
void* p874 = last_address;
DEBUG_PRINT(sfree(p578););
printStats();
PRINT_POINTER(scalloc(87,75););
printStats();
void* p875 = last_address;
DEBUG_PRINT(sfree(p385););
printStats();
PRINT_POINTER(smalloc(196););
printStats();
void* p876 = last_address;
PRINT_POINTER(srealloc(p697,60););
printStats();
void* p877 = last_address;
DEBUG_PRINT(sfree(p743););
printStats();
PRINT_POINTER(srealloc(p826,25););
printStats();
void* p878 = last_address;
PRINT_POINTER(scalloc(69,206););
printStats();
void* p879 = last_address;
DEBUG_PRINT(sfree(p878););
printStats();
DEBUG_PRINT(sfree(p849););
printStats();
DEBUG_PRINT(sfree(p662););
printStats();
PRINT_POINTER(srealloc(p798,246););
printStats();
void* p880 = last_address;
PRINT_POINTER(srealloc(p708,189););
printStats();
void* p881 = last_address;
DEBUG_PRINT(sfree(p471););
printStats();
DEBUG_PRINT(sfree(p617););
printStats();
PRINT_POINTER(scalloc(206,117););
printStats();
void* p882 = last_address;
PRINT_POINTER(scalloc(140,242););
printStats();
void* p883 = last_address;
PRINT_POINTER(srealloc(p872,204););
printStats();
void* p884 = last_address;
PRINT_POINTER(scalloc(108,139););
printStats();
void* p885 = last_address;
PRINT_POINTER(scalloc(217,194););
printStats();
void* p886 = last_address;
PRINT_POINTER(smalloc(40););
printStats();
void* p887 = last_address;
PRINT_POINTER(srealloc(p543,234););
printStats();
void* p888 = last_address;
PRINT_POINTER(scalloc(121,96););
printStats();
void* p889 = last_address;
DEBUG_PRINT(sfree(p352););
printStats();
PRINT_POINTER(scalloc(63,24););
printStats();
void* p890 = last_address;
DEBUG_PRINT(sfree(p804););
printStats();
PRINT_POINTER(scalloc(192,200););
printStats();
void* p891 = last_address;
PRINT_POINTER(smalloc(116););
printStats();
void* p892 = last_address;
PRINT_POINTER(scalloc(201,2););
printStats();
void* p893 = last_address;
PRINT_POINTER(scalloc(248,82););
printStats();
void* p894 = last_address;
DEBUG_PRINT(sfree(p393););
printStats();
PRINT_POINTER(scalloc(246,35););
printStats();
void* p895 = last_address;
PRINT_POINTER(scalloc(28,227););
printStats();
void* p896 = last_address;
PRINT_POINTER(scalloc(149,58););
printStats();
void* p897 = last_address;
DEBUG_PRINT(sfree(p855););
printStats();
DEBUG_PRINT(sfree(p861););
printStats();
PRINT_POINTER(scalloc(147,53););
printStats();
void* p898 = last_address;
PRINT_POINTER(smalloc(179););
printStats();
void* p899 = last_address;
PRINT_POINTER(srealloc(p890,17););
printStats();
void* p900 = last_address;
PRINT_POINTER(smalloc(166););
printStats();
void* p901 = last_address;
DEBUG_PRINT(sfree(p571););
printStats();
PRINT_POINTER(scalloc(125,98););
printStats();
void* p902 = last_address;
PRINT_POINTER(smalloc(119););
printStats();
void* p903 = last_address;
PRINT_POINTER(scalloc(152,98););
printStats();
void* p904 = last_address;
PRINT_POINTER(scalloc(225,223););
printStats();
void* p905 = last_address;
DEBUG_PRINT(sfree(p308););
printStats();
PRINT_POINTER(smalloc(47););
printStats();
void* p906 = last_address;
PRINT_POINTER(srealloc(p489,7););
printStats();
void* p907 = last_address;
DEBUG_PRINT(sfree(p884););
printStats();
PRINT_POINTER(smalloc(143););
printStats();
void* p908 = last_address;
DEBUG_PRINT(sfree(p533););
printStats();
DEBUG_PRINT(sfree(p322););
printStats();
PRINT_POINTER(scalloc(190,248););
printStats();
void* p909 = last_address;
PRINT_POINTER(smalloc(67););
printStats();
void* p910 = last_address;
PRINT_POINTER(scalloc(97,8););
printStats();
void* p911 = last_address;
PRINT_POINTER(srealloc(p676,234););
printStats();
void* p912 = last_address;
PRINT_POINTER(scalloc(189,157););
printStats();
void* p913 = last_address;
PRINT_POINTER(scalloc(146,123););
printStats();
void* p914 = last_address;
PRINT_POINTER(srealloc(p805,75););
printStats();
void* p915 = last_address;
PRINT_POINTER(smalloc(144););
printStats();
void* p916 = last_address;
PRINT_POINTER(scalloc(76,229););
printStats();
void* p917 = last_address;
PRINT_POINTER(smalloc(197););
printStats();
void* p918 = last_address;
DEBUG_PRINT(sfree(p291););
printStats();
DEBUG_PRINT(sfree(p793););
printStats();
PRINT_POINTER(smalloc(89););
printStats();
void* p919 = last_address;
PRINT_POINTER(scalloc(245,211););
printStats();
void* p920 = last_address;
PRINT_POINTER(scalloc(94,158););
printStats();
void* p921 = last_address;
PRINT_POINTER(srealloc(p734,248););
printStats();
void* p922 = last_address;
PRINT_POINTER(scalloc(196,181););
printStats();
void* p923 = last_address;
PRINT_POINTER(srealloc(p605,61););
printStats();
void* p924 = last_address;
PRINT_POINTER(srealloc(p788,19););
printStats();
void* p925 = last_address;
PRINT_POINTER(scalloc(128,123););
printStats();
void* p926 = last_address;
DEBUG_PRINT(sfree(p816););
printStats();
PRINT_POINTER(scalloc(172,26););
printStats();
void* p927 = last_address;
PRINT_POINTER(smalloc(133););
printStats();
void* p928 = last_address;
PRINT_POINTER(srealloc(p82,218););
printStats();
void* p929 = last_address;
PRINT_POINTER(srealloc(p842,21););
printStats();
void* p930 = last_address;
PRINT_POINTER(scalloc(161,104););
printStats();
void* p931 = last_address;
PRINT_POINTER(smalloc(29););
printStats();
void* p932 = last_address;
DEBUG_PRINT(sfree(p482););
printStats();
DEBUG_PRINT(sfree(p547););
printStats();
PRINT_POINTER(smalloc(147););
printStats();
void* p933 = last_address;
PRINT_POINTER(srealloc(p549,229););
printStats();
void* p934 = last_address;
PRINT_POINTER(srealloc(p508,96););
printStats();
void* p935 = last_address;
DEBUG_PRINT(sfree(p677););
printStats();
PRINT_POINTER(srealloc(p889,154););
printStats();
void* p936 = last_address;
PRINT_POINTER(scalloc(115,177););
printStats();
void* p937 = last_address;
PRINT_POINTER(scalloc(137,10););
printStats();
void* p938 = last_address;
DEBUG_PRINT(sfree(p935););
printStats();
PRINT_POINTER(srealloc(p355,241););
printStats();
void* p939 = last_address;
PRINT_POINTER(srealloc(p924,150););
printStats();
void* p940 = last_address;
PRINT_POINTER(smalloc(114););
printStats();
void* p941 = last_address;
DEBUG_PRINT(sfree(p691););
printStats();
PRINT_POINTER(scalloc(178,154););
printStats();
void* p942 = last_address;
PRINT_POINTER(srealloc(p867,27););
printStats();
void* p943 = last_address;
DEBUG_PRINT(sfree(p514););
printStats();
DEBUG_PRINT(sfree(p696););
printStats();
PRINT_POINTER(srealloc(p481,91););
printStats();
void* p944 = last_address;
PRINT_POINTER(smalloc(55););
printStats();
void* p945 = last_address;
PRINT_POINTER(srealloc(p679,238););
printStats();
void* p946 = last_address;
PRINT_POINTER(scalloc(211,88););
printStats();
void* p947 = last_address;
PRINT_POINTER(smalloc(204););
printStats();
void* p948 = last_address;
PRINT_POINTER(smalloc(147););
printStats();
void* p949 = last_address;
PRINT_POINTER(srealloc(p799,146););
printStats();
void* p950 = last_address;
DEBUG_PRINT(sfree(p929););
printStats();
DEBUG_PRINT(sfree(p923););
printStats();
DEBUG_PRINT(sfree(p943););
printStats();
PRINT_POINTER(scalloc(37,0););
printStats();
void* p951 = last_address;
PRINT_POINTER(srealloc(p821,149););
printStats();
void* p952 = last_address;
PRINT_POINTER(scalloc(97,12););
printStats();
void* p953 = last_address;
PRINT_POINTER(srealloc(p685,108););
printStats();
void* p954 = last_address;
PRINT_POINTER(srealloc(p907,99););
printStats();
void* p955 = last_address;
PRINT_POINTER(scalloc(59,73););
printStats();
void* p956 = last_address;
DEBUG_PRINT(sfree(p476););
printStats();
PRINT_POINTER(smalloc(75););
printStats();
void* p957 = last_address;
DEBUG_PRINT(sfree(p705););
printStats();
DEBUG_PRINT(sfree(p615););
printStats();
PRINT_POINTER(scalloc(78,51););
printStats();
void* p958 = last_address;
PRINT_POINTER(smalloc(122););
printStats();
void* p959 = last_address;
PRINT_POINTER(srealloc(p666,97););
printStats();
void* p960 = last_address;
DEBUG_PRINT(sfree(p414););
printStats();
PRINT_POINTER(srealloc(p814,72););
printStats();
void* p961 = last_address;
DEBUG_PRINT(sfree(p745););
printStats();
DEBUG_PRINT(sfree(p334););
printStats();
PRINT_POINTER(scalloc(211,38););
printStats();
void* p962 = last_address;
DEBUG_PRINT(sfree(p863););
printStats();
PRINT_POINTER(smalloc(173););
printStats();
void* p963 = last_address;
PRINT_POINTER(srealloc(p812,236););
printStats();
void* p964 = last_address;
PRINT_POINTER(srealloc(p944,243););
printStats();
void* p965 = last_address;
PRINT_POINTER(scalloc(149,191););
printStats();
void* p966 = last_address;
PRINT_POINTER(scalloc(25,15););
printStats();
void* p967 = last_address;
PRINT_POINTER(smalloc(249););
printStats();
void* p968 = last_address;
PRINT_POINTER(smalloc(169););
printStats();
void* p969 = last_address;
PRINT_POINTER(smalloc(72););
printStats();
void* p970 = last_address;
PRINT_POINTER(smalloc(81););
printStats();
void* p971 = last_address;
PRINT_POINTER(srealloc(p811,1););
printStats();
void* p972 = last_address;
PRINT_POINTER(smalloc(160););
printStats();
void* p973 = last_address;
PRINT_POINTER(smalloc(66););
printStats();
void* p974 = last_address;
PRINT_POINTER(srealloc(p785,202););
printStats();
void* p975 = last_address;
PRINT_POINTER(scalloc(189,31););
printStats();
void* p976 = last_address;
PRINT_POINTER(srealloc(p688,217););
printStats();
void* p977 = last_address;
PRINT_POINTER(srealloc(p841,112););
printStats();
void* p978 = last_address;
DEBUG_PRINT(sfree(p911););
printStats();
PRINT_POINTER(smalloc(216););
printStats();
void* p979 = last_address;
DEBUG_PRINT(sfree(p896););
printStats();
PRINT_POINTER(scalloc(195,10););
printStats();
void* p980 = last_address;
PRINT_POINTER(smalloc(42););
printStats();
void* p981 = last_address;
PRINT_POINTER(smalloc(143););
printStats();
void* p982 = last_address;
PRINT_POINTER(srealloc(p931,31););
printStats();
void* p983 = last_address;
PRINT_POINTER(smalloc(153););
printStats();
void* p984 = last_address;
DEBUG_PRINT(sfree(p353););
printStats();
DEBUG_PRINT(sfree(p869););
printStats();
PRINT_POINTER(srealloc(p376,238););
printStats();
void* p985 = last_address;
PRINT_POINTER(smalloc(85););
printStats();
void* p986 = last_address;
DEBUG_PRINT(sfree(p854););
printStats();
PRINT_POINTER(srealloc(p583,233););
printStats();
void* p987 = last_address;
PRINT_POINTER(scalloc(209,54););
printStats();
void* p988 = last_address;
PRINT_POINTER(srealloc(p757,185););
printStats();
void* p989 = last_address;
PRINT_POINTER(smalloc(79););
printStats();
void* p990 = last_address;
PRINT_POINTER(smalloc(73););
printStats();
void* p991 = last_address;
PRINT_POINTER(smalloc(111););
printStats();
void* p992 = last_address;
PRINT_POINTER(scalloc(190,202););
printStats();
void* p993 = last_address;
PRINT_POINTER(smalloc(66););
printStats();
void* p994 = last_address;
PRINT_POINTER(scalloc(63,63););
printStats();
void* p995 = last_address;
DEBUG_PRINT(sfree(p838););
printStats();
PRINT_POINTER(srealloc(p505,51););
printStats();
void* p996 = last_address;
PRINT_POINTER(smalloc(227););
printStats();
void* p997 = last_address;
DEBUG_PRINT(sfree(p747););
printStats();
PRINT_POINTER(scalloc(26,98););
printStats();
void* p998 = last_address;
DEBUG_PRINT(sfree(p632););
printStats();
PRINT_POINTER(srealloc(p897,115););
printStats();
void* p999 = last_address;
PRINT_POINTER(scalloc(162,88););
printStats();
void* p1000 = last_address;
PRINT_POINTER(scalloc(132,202););
printStats();
void* p1001 = last_address;
PRINT_POINTER(srealloc(p770,42););
printStats();
void* p1002 = last_address;
PRINT_POINTER(srealloc(p586,56););
printStats();
void* p1003 = last_address;
PRINT_POINTER(scalloc(166,72););
printStats();
void* p1004 = last_address;
PRINT_POINTER(scalloc(235,9););
printStats();
void* p1005 = last_address;
DEBUG_PRINT(sfree(p645););
printStats();
PRINT_POINTER(smalloc(74););
printStats();
void* p1006 = last_address;
PRINT_POINTER(scalloc(208,74););
printStats();
void* p1007 = last_address;
DEBUG_PRINT(sfree(p909););
printStats();
PRINT_POINTER(smalloc(207););
printStats();
void* p1008 = last_address;
PRINT_POINTER(scalloc(36,40););
printStats();
void* p1009 = last_address;
PRINT_POINTER(smalloc(154););
printStats();
void* p1010 = last_address;
DEBUG_PRINT(sfree(p906););
printStats();
DEBUG_PRINT(sfree(p925););
printStats();
PRINT_POINTER(scalloc(202,2););
printStats();
void* p1011 = last_address;
PRINT_POINTER(srealloc(p368,95););
printStats();
void* p1012 = last_address;
PRINT_POINTER(srealloc(p848,44););
printStats();
void* p1013 = last_address;
DEBUG_PRINT(sfree(p948););
printStats();
PRINT_POINTER(smalloc(12););
printStats();
void* p1014 = last_address;
PRINT_POINTER(smalloc(191););
printStats();
void* p1015 = last_address;
PRINT_POINTER(scalloc(93,14););
printStats();
void* p1016 = last_address;
PRINT_POINTER(smalloc(129););
printStats();
void* p1017 = last_address;
PRINT_POINTER(smalloc(162););
printStats();
void* p1018 = last_address;
PRINT_POINTER(smalloc(96););
printStats();
void* p1019 = last_address;
PRINT_POINTER(srealloc(p904,128););
printStats();
void* p1020 = last_address;
PRINT_POINTER(smalloc(38););
printStats();
void* p1021 = last_address;
PRINT_POINTER(srealloc(p927,138););
printStats();
void* p1022 = last_address;
PRINT_POINTER(scalloc(42,167););
printStats();
void* p1023 = last_address;
PRINT_POINTER(smalloc(60););
printStats();
void* p1024 = last_address;
PRINT_POINTER(scalloc(64,11););
printStats();
void* p1025 = last_address;
PRINT_POINTER(smalloc(171););
printStats();
void* p1026 = last_address;
PRINT_POINTER(srealloc(p1001,92););
printStats();
void* p1027 = last_address;
DEBUG_PRINT(sfree(p744););
printStats();
DEBUG_PRINT(sfree(p737););
printStats();
PRINT_POINTER(srealloc(p642,212););
printStats();
void* p1028 = last_address;
PRINT_POINTER(srealloc(p731,147););
printStats();
void* p1029 = last_address;
PRINT_POINTER(srealloc(p933,155););
printStats();
void* p1030 = last_address;
DEBUG_PRINT(sfree(p702););
printStats();
DEBUG_PRINT(sfree(p900););
printStats();
PRINT_POINTER(scalloc(132,14););
printStats();
void* p1031 = last_address;
PRINT_POINTER(scalloc(128,219););
printStats();
void* p1032 = last_address;
PRINT_POINTER(srealloc(p937,59););
printStats();
void* p1033 = last_address;
DEBUG_PRINT(sfree(p961););
printStats();
PRINT_POINTER(smalloc(101););
printStats();
void* p1034 = last_address;
PRINT_POINTER(scalloc(235,32););
printStats();
void* p1035 = last_address;
PRINT_POINTER(smalloc(206););
printStats();
void* p1036 = last_address;
PRINT_POINTER(scalloc(141,158););
printStats();
void* p1037 = last_address;
PRINT_POINTER(srealloc(p752,225););
printStats();
void* p1038 = last_address;
PRINT_POINTER(smalloc(26););
printStats();
void* p1039 = last_address;
PRINT_POINTER(srealloc(p1022,67););
printStats();
void* p1040 = last_address;
PRINT_POINTER(srealloc(p778,233););
printStats();
void* p1041 = last_address;
PRINT_POINTER(smalloc(106););
printStats();
void* p1042 = last_address;
PRINT_POINTER(smalloc(43););
printStats();
void* p1043 = last_address;
DEBUG_PRINT(sfree(p494););
printStats();
PRINT_POINTER(scalloc(130,104););
printStats();
void* p1044 = last_address;
PRINT_POINTER(srealloc(p724,77););
printStats();
void* p1045 = last_address;
PRINT_POINTER(smalloc(85););
printStats();
void* p1046 = last_address;
DEBUG_PRINT(sfree(p485););
printStats();
DEBUG_PRINT(sfree(p879););
printStats();
PRINT_POINTER(srealloc(p572,2););
printStats();
void* p1047 = last_address;
PRINT_POINTER(scalloc(13,224););
printStats();
void* p1048 = last_address;
PRINT_POINTER(smalloc(39););
printStats();
void* p1049 = last_address;
PRINT_POINTER(smalloc(101););
printStats();
void* p1050 = last_address;
PRINT_POINTER(scalloc(144,119););
printStats();
void* p1051 = last_address;
PRINT_POINTER(srealloc(p807,217););
printStats();
void* p1052 = last_address;
DEBUG_PRINT(sfree(p1044););
printStats();
PRINT_POINTER(scalloc(192,64););
printStats();
void* p1053 = last_address;
DEBUG_PRINT(sfree(p828););
printStats();
DEBUG_PRINT(sfree(p539););
printStats();
DEBUG_PRINT(sfree(p635););
printStats();
PRINT_POINTER(smalloc(213););
printStats();
void* p1054 = last_address;
PRINT_POINTER(srealloc(p524,122););
printStats();
void* p1055 = last_address;
PRINT_POINTER(smalloc(163););
printStats();
void* p1056 = last_address;
PRINT_POINTER(smalloc(72););
printStats();
void* p1057 = last_address;
DEBUG_PRINT(sfree(p1010););
printStats();
PRINT_POINTER(scalloc(82,12););
printStats();
void* p1058 = last_address;
PRINT_POINTER(srealloc(p1013,227););
printStats();
void* p1059 = last_address;
PRINT_POINTER(smalloc(210););
printStats();
void* p1060 = last_address;
PRINT_POINTER(smalloc(183););
printStats();
void* p1061 = last_address;
DEBUG_PRINT(sfree(p603););
printStats();
PRINT_POINTER(scalloc(0,206););
printStats();
void* p1062 = last_address;
PRINT_POINTER(smalloc(89););
printStats();
void* p1063 = last_address;
PRINT_POINTER(srealloc(p915,55););
printStats();
void* p1064 = last_address;
PRINT_POINTER(smalloc(17););
printStats();
void* p1065 = last_address;
PRINT_POINTER(srealloc(p333,75););
printStats();
void* p1066 = last_address;
PRINT_POINTER(srealloc(p693,202););
printStats();
void* p1067 = last_address;
PRINT_POINTER(scalloc(205,150););
printStats();
void* p1068 = last_address;
PRINT_POINTER(smalloc(237););
printStats();
void* p1069 = last_address;
PRINT_POINTER(smalloc(151););
printStats();
void* p1070 = last_address;
DEBUG_PRINT(sfree(p958););
printStats();
PRINT_POINTER(srealloc(p354,149););
printStats();
void* p1071 = last_address;
PRINT_POINTER(srealloc(p716,202););
printStats();
void* p1072 = last_address;
PRINT_POINTER(scalloc(65,168););
printStats();
void* p1073 = last_address;
PRINT_POINTER(scalloc(31,165););
printStats();
void* p1074 = last_address;
PRINT_POINTER(smalloc(74););
printStats();
void* p1075 = last_address;
PRINT_POINTER(scalloc(159,175););
printStats();
void* p1076 = last_address;
PRINT_POINTER(srealloc(p715,160););
printStats();
void* p1077 = last_address;
PRINT_POINTER(smalloc(103););
printStats();
void* p1078 = last_address;
PRINT_POINTER(scalloc(158,103););
printStats();
void* p1079 = last_address;
PRINT_POINTER(scalloc(87,33););
printStats();
void* p1080 = last_address;
PRINT_POINTER(srealloc(p663,57););
printStats();
void* p1081 = last_address;
PRINT_POINTER(scalloc(221,71););
printStats();
void* p1082 = last_address;
DEBUG_PRINT(sfree(p942););
printStats();
PRINT_POINTER(smalloc(163););
printStats();
void* p1083 = last_address;
DEBUG_PRINT(sfree(p690););
printStats();
PRINT_POINTER(smalloc(192););
printStats();
void* p1084 = last_address;
PRINT_POINTER(srealloc(p630,37););
printStats();
void* p1085 = last_address;
PRINT_POINTER(smalloc(57););
printStats();
void* p1086 = last_address;
PRINT_POINTER(srealloc(p710,137););
printStats();
void* p1087 = last_address;
PRINT_POINTER(smalloc(98););
printStats();
void* p1088 = last_address;
PRINT_POINTER(scalloc(74,175););
printStats();
void* p1089 = last_address;
PRINT_POINTER(smalloc(168););
printStats();
void* p1090 = last_address;
DEBUG_PRINT(sfree(p592););
printStats();
DEBUG_PRINT(sfree(p832););
printStats();
PRINT_POINTER(scalloc(154,111););
printStats();
void* p1091 = last_address;
PRINT_POINTER(smalloc(182););
printStats();
void* p1092 = last_address;
DEBUG_PRINT(sfree(p1048););
printStats();
PRINT_POINTER(scalloc(165,145););
printStats();
void* p1093 = last_address;
PRINT_POINTER(smalloc(219););
printStats();
void* p1094 = last_address;
PRINT_POINTER(smalloc(105););
printStats();
void* p1095 = last_address;
PRINT_POINTER(smalloc(196););
printStats();
void* p1096 = last_address;
PRINT_POINTER(smalloc(121););
printStats();
void* p1097 = last_address;
PRINT_POINTER(scalloc(53,206););
printStats();
void* p1098 = last_address;
DEBUG_PRINT(sfree(p501););
printStats();
DEBUG_PRINT(sfree(p1033););
printStats();
PRINT_POINTER(smalloc(147););
printStats();
void* p1099 = last_address;
PRINT_POINTER(srealloc(p967,246););
printStats();
void* p1100 = last_address;
PRINT_POINTER(smalloc(124););
printStats();
void* p1101 = last_address;
DEBUG_PRINT(sfree(p1018););
printStats();
DEBUG_PRINT(sfree(p595););
printStats();
PRINT_POINTER(smalloc(17););
printStats();
void* p1102 = last_address;
PRINT_POINTER(scalloc(92,85););
printStats();
void* p1103 = last_address;
PRINT_POINTER(smalloc(154););
printStats();
void* p1104 = last_address;
DEBUG_PRINT(sfree(p651););
printStats();
PRINT_POINTER(srealloc(p714,218););
printStats();
void* p1105 = last_address;
PRINT_POINTER(scalloc(85,126););
printStats();
void* p1106 = last_address;
PRINT_POINTER(scalloc(221,162););
printStats();
void* p1107 = last_address;
PRINT_POINTER(srealloc(p860,131););
printStats();
void* p1108 = last_address;
PRINT_POINTER(scalloc(68,159););
printStats();
void* p1109 = last_address;
PRINT_POINTER(smalloc(74););
printStats();
void* p1110 = last_address;
DEBUG_PRINT(sfree(p972););
printStats();
PRINT_POINTER(scalloc(137,222););
printStats();
void* p1111 = last_address;
PRINT_POINTER(smalloc(136););
printStats();
void* p1112 = last_address;
PRINT_POINTER(smalloc(151););
printStats();
void* p1113 = last_address;
PRINT_POINTER(smalloc(16););
printStats();
void* p1114 = last_address;
DEBUG_PRINT(sfree(p1062););
printStats();
DEBUG_PRINT(sfree(p692););
printStats();
PRINT_POINTER(smalloc(195););
printStats();
void* p1115 = last_address;
PRINT_POINTER(scalloc(206,179););
printStats();
void* p1116 = last_address;
PRINT_POINTER(smalloc(84););
printStats();
void* p1117 = last_address;
PRINT_POINTER(scalloc(152,152););
printStats();
void* p1118 = last_address;
PRINT_POINTER(scalloc(41,97););
printStats();
void* p1119 = last_address;
PRINT_POINTER(srealloc(p995,199););
printStats();
void* p1120 = last_address;
DEBUG_PRINT(sfree(p644););
printStats();
PRINT_POINTER(smalloc(60););
printStats();
void* p1121 = last_address;
DEBUG_PRINT(sfree(p864););
printStats();
PRINT_POINTER(srealloc(p955,6););
printStats();
void* p1122 = last_address;
PRINT_POINTER(scalloc(87,184););
printStats();
void* p1123 = last_address;
PRINT_POINTER(scalloc(104,247););
printStats();
void* p1124 = last_address;
DEBUG_PRINT(sfree(p1065););
printStats();
PRINT_POINTER(smalloc(99););
printStats();
void* p1125 = last_address;
PRINT_POINTER(srealloc(p1105,203););
printStats();
void* p1126 = last_address;
PRINT_POINTER(scalloc(41,114););
printStats();
void* p1127 = last_address;
PRINT_POINTER(smalloc(220););
printStats();
void* p1128 = last_address;
DEBUG_PRINT(sfree(p917););
printStats();
PRINT_POINTER(smalloc(38););
printStats();
void* p1129 = last_address;
PRINT_POINTER(scalloc(222,75););
printStats();
void* p1130 = last_address;
PRINT_POINTER(scalloc(178,206););
printStats();
void* p1131 = last_address;
PRINT_POINTER(srealloc(p749,162););
printStats();
void* p1132 = last_address;
PRINT_POINTER(smalloc(175););
printStats();
void* p1133 = last_address;
DEBUG_PRINT(sfree(p810););
printStats();
DEBUG_PRINT(sfree(p954););
printStats();
PRINT_POINTER(smalloc(48););
printStats();
void* p1134 = last_address;
PRINT_POINTER(srealloc(p922,77););
printStats();
void* p1135 = last_address;
PRINT_POINTER(smalloc(56););
printStats();
void* p1136 = last_address;
PRINT_POINTER(smalloc(211););
printStats();
void* p1137 = last_address;
DEBUG_PRINT(sfree(p1009););
printStats();
DEBUG_PRINT(sfree(p1043););
printStats();
PRINT_POINTER(srealloc(p950,178););
printStats();
void* p1138 = last_address;
PRINT_POINTER(smalloc(237););
printStats();
void* p1139 = last_address;
PRINT_POINTER(smalloc(219););
printStats();
void* p1140 = last_address;
DEBUG_PRINT(sfree(p522););
printStats();
PRINT_POINTER(smalloc(69););
printStats();
void* p1141 = last_address;
DEBUG_PRINT(sfree(p762););
printStats();
DEBUG_PRINT(sfree(p1031););
printStats();
PRINT_POINTER(srealloc(p713,3););
printStats();
void* p1142 = last_address;
PRINT_POINTER(smalloc(95););
printStats();
void* p1143 = last_address;
DEBUG_PRINT(sfree(p535););
printStats();
PRINT_POINTER(srealloc(p768,249););
printStats();
void* p1144 = last_address;
DEBUG_PRINT(sfree(p252););
printStats();
PRINT_POINTER(smalloc(213););
printStats();
void* p1145 = last_address;
PRINT_POINTER(scalloc(78,249););
printStats();
void* p1146 = last_address;
DEBUG_PRINT(sfree(p1039););
printStats();
PRINT_POINTER(srealloc(p447,105););
printStats();
void* p1147 = last_address;
PRINT_POINTER(srealloc(p1084,53););
printStats();
void* p1148 = last_address;
DEBUG_PRINT(sfree(p1042););
printStats();
DEBUG_PRINT(sfree(p451););
printStats();
PRINT_POINTER(scalloc(151,249););
printStats();
void* p1149 = last_address;
PRINT_POINTER(smalloc(119););
printStats();
void* p1150 = last_address;
PRINT_POINTER(scalloc(149,238););
printStats();
void* p1151 = last_address;
PRINT_POINTER(srealloc(p898,231););
printStats();
void* p1152 = last_address;
PRINT_POINTER(srealloc(p1111,98););
printStats();
void* p1153 = last_address;
PRINT_POINTER(smalloc(46););
printStats();
void* p1154 = last_address;
PRINT_POINTER(smalloc(158););
printStats();
void* p1155 = last_address;
DEBUG_PRINT(sfree(p990););
printStats();
DEBUG_PRINT(sfree(p750););
printStats();
PRINT_POINTER(smalloc(140););
printStats();
void* p1156 = last_address;
PRINT_POINTER(scalloc(172,30););
printStats();
void* p1157 = last_address;
PRINT_POINTER(srealloc(p641,216););
printStats();
void* p1158 = last_address;
PRINT_POINTER(scalloc(24,35););
printStats();
void* p1159 = last_address;
PRINT_POINTER(srealloc(p1150,97););
printStats();
void* p1160 = last_address;
DEBUG_PRINT(sfree(p1086););
printStats();
DEBUG_PRINT(sfree(p817););
printStats();
DEBUG_PRINT(sfree(p813););
printStats();
PRINT_POINTER(scalloc(112,206););
printStats();
void* p1161 = last_address;
DEBUG_PRINT(sfree(p637););
printStats();
PRINT_POINTER(smalloc(140););
printStats();
void* p1162 = last_address;
PRINT_POINTER(srealloc(p439,67););
printStats();
void* p1163 = last_address;
DEBUG_PRINT(sfree(p789););
printStats();
PRINT_POINTER(smalloc(15););
printStats();
void* p1164 = last_address;
PRINT_POINTER(srealloc(p873,194););
printStats();
void* p1165 = last_address;
DEBUG_PRINT(sfree(p824););
printStats();
DEBUG_PRINT(sfree(p1073););
printStats();
DEBUG_PRINT(sfree(p326););
printStats();
DEBUG_PRINT(sfree(p910););
printStats();
PRINT_POINTER(scalloc(104,169););
printStats();
void* p1166 = last_address;
PRINT_POINTER(scalloc(82,216););
printStats();
void* p1167 = last_address;
PRINT_POINTER(srealloc(p1076,114););
printStats();
void* p1168 = last_address;
DEBUG_PRINT(sfree(p959););
printStats();
PRINT_POINTER(srealloc(p914,133););
printStats();
void* p1169 = last_address;
PRINT_POINTER(smalloc(12););
printStats();
void* p1170 = last_address;
PRINT_POINTER(srealloc(p1089,51););
printStats();
void* p1171 = last_address;
PRINT_POINTER(scalloc(203,97););
printStats();
void* p1172 = last_address;
DEBUG_PRINT(sfree(p1080););
printStats();
PRINT_POINTER(scalloc(12,245););
printStats();
void* p1173 = last_address;
DEBUG_PRINT(sfree(p1120););
printStats();
PRINT_POINTER(srealloc(p984,106););
printStats();
void* p1174 = last_address;
DEBUG_PRINT(sfree(p865););
printStats();
DEBUG_PRINT(sfree(p987););
printStats();
DEBUG_PRINT(sfree(p725););
printStats();
PRINT_POINTER(srealloc(p852,34););
printStats();
void* p1175 = last_address;
PRINT_POINTER(srealloc(p1081,37););
printStats();
void* p1176 = last_address;
PRINT_POINTER(smalloc(175););
printStats();
void* p1177 = last_address;
PRINT_POINTER(scalloc(63,67););
printStats();
void* p1178 = last_address;
DEBUG_PRINT(sfree(p758););
printStats();
DEBUG_PRINT(sfree(p1099););
printStats();
PRINT_POINTER(scalloc(169,219););
printStats();
void* p1179 = last_address;
PRINT_POINTER(srealloc(p1133,21););
printStats();
void* p1180 = last_address;
PRINT_POINTER(scalloc(220,158););
printStats();
void* p1181 = last_address;
DEBUG_PRINT(sfree(p1131););
printStats();
PRINT_POINTER(scalloc(32,183););
printStats();
void* p1182 = last_address;
PRINT_POINTER(smalloc(160););
printStats();
void* p1183 = last_address;
PRINT_POINTER(scalloc(42,66););
printStats();
void* p1184 = last_address;
PRINT_POINTER(smalloc(199););
printStats();
void* p1185 = last_address;
PRINT_POINTER(smalloc(68););
printStats();
void* p1186 = last_address;
PRINT_POINTER(srealloc(p1078,186););
printStats();
void* p1187 = last_address;
PRINT_POINTER(srealloc(p1083,181););
printStats();
void* p1188 = last_address;
PRINT_POINTER(srealloc(p1164,72););
printStats();
void* p1189 = last_address;
PRINT_POINTER(srealloc(p997,125););
printStats();
void* p1190 = last_address;
PRINT_POINTER(srealloc(p260,26););
printStats();
void* p1191 = last_address;
DEBUG_PRINT(sfree(p639););
printStats();
PRINT_POINTER(scalloc(130,125););
printStats();
void* p1192 = last_address;
PRINT_POINTER(srealloc(p1151,210););
printStats();
void* p1193 = last_address;
DEBUG_PRINT(sfree(p1180););
printStats();
PRINT_POINTER(smalloc(152););
printStats();
void* p1194 = last_address;
DEBUG_PRINT(sfree(p1085););
printStats();
PRINT_POINTER(smalloc(217););
printStats();
void* p1195 = last_address;
PRINT_POINTER(smalloc(75););
printStats();
void* p1196 = last_address;
PRINT_POINTER(scalloc(67,184););
printStats();
void* p1197 = last_address;
PRINT_POINTER(smalloc(114););
printStats();
void* p1198 = last_address;
PRINT_POINTER(srealloc(p650,227););
printStats();
void* p1199 = last_address;
DEBUG_PRINT(sfree(p992););
printStats();
PRINT_POINTER(srealloc(p949,58););
printStats();
void* p1200 = last_address;
PRINT_POINTER(scalloc(157,96););
printStats();
void* p1201 = last_address;
PRINT_POINTER(smalloc(27););
printStats();
void* p1202 = last_address;
PRINT_POINTER(srealloc(p766,173););
printStats();
void* p1203 = last_address;
PRINT_POINTER(srealloc(p1058,231););
printStats();
void* p1204 = last_address;
DEBUG_PRINT(sfree(p1035););
printStats();
PRINT_POINTER(srealloc(p580,236););
printStats();
void* p1205 = last_address;
PRINT_POINTER(smalloc(68););
printStats();
void* p1206 = last_address;
DEBUG_PRINT(sfree(p1002););
printStats();
PRINT_POINTER(smalloc(84););
printStats();
void* p1207 = last_address;
PRINT_POINTER(srealloc(p844,212););
printStats();
void* p1208 = last_address;
PRINT_POINTER(srealloc(p1184,91););
printStats();
void* p1209 = last_address;
PRINT_POINTER(srealloc(p1029,77););
printStats();
void* p1210 = last_address;
PRINT_POINTER(smalloc(100););
printStats();
void* p1211 = last_address;
PRINT_POINTER(srealloc(p1154,245););
printStats();
void* p1212 = last_address;
PRINT_POINTER(scalloc(147,226););
printStats();
void* p1213 = last_address;
PRINT_POINTER(smalloc(184););
printStats();
void* p1214 = last_address;
PRINT_POINTER(srealloc(p1100,141););
printStats();
void* p1215 = last_address;
DEBUG_PRINT(sfree(p801););
printStats();
DEBUG_PRINT(sfree(p1190););
printStats();
PRINT_POINTER(smalloc(240););
printStats();
void* p1216 = last_address;
DEBUG_PRINT(sfree(p803););
printStats();
DEBUG_PRINT(sfree(p1179););
printStats();
PRINT_POINTER(smalloc(248););
printStats();
void* p1217 = last_address;
DEBUG_PRINT(sfree(p327););
printStats();
PRINT_POINTER(scalloc(103,173););
printStats();
void* p1218 = last_address;
DEBUG_PRINT(sfree(p552););
printStats();
PRINT_POINTER(smalloc(98););
printStats();
void* p1219 = last_address;
PRINT_POINTER(srealloc(p894,231););
printStats();
void* p1220 = last_address;
PRINT_POINTER(srealloc(p629,138););
printStats();
void* p1221 = last_address;
PRINT_POINTER(srealloc(p853,135););
printStats();
void* p1222 = last_address;
DEBUG_PRINT(sfree(p1014););
printStats();
PRINT_POINTER(srealloc(p674,138););
printStats();
void* p1223 = last_address;
PRINT_POINTER(srealloc(p1177,0););
printStats();
void* p1224 = last_address;
PRINT_POINTER(scalloc(157,211););
printStats();
void* p1225 = last_address;
DEBUG_PRINT(sfree(p806););
printStats();
PRINT_POINTER(scalloc(175,218););
printStats();
void* p1226 = last_address;
PRINT_POINTER(smalloc(93););
printStats();
void* p1227 = last_address;
PRINT_POINTER(scalloc(123,135););
printStats();
void* p1228 = last_address;
DEBUG_PRINT(sfree(p966););
printStats();
PRINT_POINTER(srealloc(p675,18););
printStats();
void* p1229 = last_address;
DEBUG_PRINT(sfree(p1171););
printStats();
PRINT_POINTER(smalloc(226););
printStats();
void* p1230 = last_address;
PRINT_POINTER(scalloc(53,237););
printStats();
void* p1231 = last_address;
PRINT_POINTER(scalloc(15,109););
printStats();
void* p1232 = last_address;
PRINT_POINTER(scalloc(178,116););
printStats();
void* p1233 = last_address;
DEBUG_PRINT(sfree(p976););
printStats();
PRINT_POINTER(srealloc(p1016,117););
printStats();
void* p1234 = last_address;
PRINT_POINTER(smalloc(99););
printStats();
void* p1235 = last_address;
PRINT_POINTER(scalloc(236,55););
printStats();
void* p1236 = last_address;
DEBUG_PRINT(sfree(p429););
printStats();
PRINT_POINTER(smalloc(80););
printStats();
void* p1237 = last_address;
DEBUG_PRINT(sfree(p75););
printStats();
PRINT_POINTER(smalloc(22););
printStats();
void* p1238 = last_address;
DEBUG_PRINT(sfree(p132););
printStats();
PRINT_POINTER(scalloc(162,6););
printStats();
void* p1239 = last_address;
DEBUG_PRINT(sfree(p912););
printStats();
PRINT_POINTER(smalloc(157););
printStats();
void* p1240 = last_address;
PRINT_POINTER(smalloc(243););
printStats();
void* p1241 = last_address;
PRINT_POINTER(scalloc(66,116););
printStats();
void* p1242 = last_address;
PRINT_POINTER(scalloc(227,119););
printStats();
void* p1243 = last_address;
DEBUG_PRINT(sfree(p1174););
printStats();
PRINT_POINTER(smalloc(9););
printStats();
void* p1244 = last_address;
PRINT_POINTER(srealloc(p1137,161););
printStats();
void* p1245 = last_address;
DEBUG_PRINT(sfree(p1067););
printStats();
PRINT_POINTER(scalloc(215,58););
printStats();
void* p1246 = last_address;
DEBUG_PRINT(sfree(p525););
printStats();
PRINT_POINTER(scalloc(8,87););
printStats();
void* p1247 = last_address;
PRINT_POINTER(srealloc(p1109,246););
printStats();
void* p1248 = last_address;
PRINT_POINTER(smalloc(123););
printStats();
void* p1249 = last_address;
DEBUG_PRINT(sfree(p680););
printStats();
PRINT_POINTER(smalloc(132););
printStats();
void* p1250 = last_address;
PRINT_POINTER(scalloc(114,131););
printStats();
void* p1251 = last_address;
DEBUG_PRINT(sfree(p870););
printStats();
PRINT_POINTER(srealloc(p784,210););
printStats();
void* p1252 = last_address;
DEBUG_PRINT(sfree(p667););
printStats();
DEBUG_PRINT(sfree(p486););
printStats();
PRINT_POINTER(scalloc(56,208););
printStats();
void* p1253 = last_address;
PRINT_POINTER(srealloc(p887,85););
printStats();
void* p1254 = last_address;
PRINT_POINTER(srealloc(p1249,184););
printStats();
void* p1255 = last_address;
DEBUG_PRINT(sfree(p1070););
printStats();
PRINT_POINTER(scalloc(228,223););
printStats();
void* p1256 = last_address;
}
| [
"shaiyehezkel@campus.technion.ac.il"
] | shaiyehezkel@campus.technion.ac.il |
b8f0b58cf065a6d5d254d4455c85c3b5ab835e5d | 083100943aa21e05d2eb0ad745349331dd35239a | /aws-cpp-sdk-glacier/include/aws/glacier/model/ActionCode.h | 8ae2c68e0e20a526f62dff901065f3bfdad36fb1 | [
"JSON",
"MIT",
"Apache-2.0"
] | permissive | bmildner/aws-sdk-cpp | d853faf39ab001b2878de57aa7ba132579d1dcd2 | 983be395fdff4ec944b3bcfcd6ead6b4510b2991 | refs/heads/master | 2021-01-15T16:52:31.496867 | 2015-09-10T06:57:18 | 2015-09-10T06:57:18 | 41,954,994 | 1 | 0 | null | 2015-09-05T08:57:22 | 2015-09-05T08:57:22 | null | UTF-8 | C++ | false | false | 1,089 | h | /*
* Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#pragma once
#include <aws/glacier/Glacier_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
namespace Aws
{
namespace Glacier
{
namespace Model
{
enum class ActionCode
{
NOT_SET,
ArchiveRetrieval,
InventoryRetrieval
};
namespace ActionCodeMapper
{
AWS_GLACIER_API ActionCode GetActionCodeForName(const Aws::String& name);
AWS_GLACIER_API Aws::String GetNameForActionCode(ActionCode value);
} // namespace ActionCodeMapper
} // namespace Model
} // namespace Glacier
} // namespace Aws
| [
"henso@amazon.com"
] | henso@amazon.com |
9a6c78eeb165f8fcff86298214d79c0fd6c2045e | 0122613b40827922407a4e5ffb12adad05d710e1 | /base/epoll_api.h | 5ea42b216772c0fc6859e411e4590eb18eb9d5b1 | [
"Apache-2.0"
] | permissive | jinghao666/net | c898f7663c0befea0e832f84a656402a92060e59 | c98961e094d8c9f1eeb4caad959e9a33968e2e40 | refs/heads/main | 2023-06-19T08:24:23.051263 | 2021-07-27T01:28:54 | 2021-07-27T01:28:54 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 142 | h | #pragma once
#include "simple_epoll_server.h"
namespace basic{
using EpollServer=SimpleEpollServer;
using EpollAlarmBase =EpollAlarm;
}
| [
"865678017peiwen@gmail.com"
] | 865678017peiwen@gmail.com |
e6f7abc643becbe4f767733919ae34d01cd37d49 | efe0fbaa38b9ce5cd147101b5d2399ad5836a6c5 | /plugins/VLQAnalyzer.cc | 5f9061fceabc9176a31aa99422bfbd9de1222dcc | [] | no_license | jking79/sadi_VLQana | d395d8eff1232e7c957efa2d77841049930d6124 | 5e5cc63087ef1cc686ffb7f12f1ef59fcb3d4b83 | refs/heads/master | 2021-05-04T15:42:58.032817 | 2018-02-05T01:04:58 | 2018-02-05T01:04:58 | 120,237,127 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 15,069 | cc | // -*- C++ -*-
//
// Package: Upgrades/VLQAnalyzer
// Class: VLQAnalyzer
//
/**\class VLQAnalyzer VLQAnalyzer.cc Upgrades/VLQAnalyzer/plugins/VLQAnalyzer.cc
Description: [one line class summary]
Implementation:
[Notes on implementation]
*/
//
// Original Author: Sadia Khalil
// Created: Mon, 15 Jan 2018 19:19:16 GMT
//
//
// system include files
#include <memory>
// user include files
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/one/EDAnalyzer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "CommonTools/UtilAlgos/interface/TFileService.h"
#include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h"
#include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h"
#include "DataFormats/VertexReco/interface/VertexFwd.h"
#include "DataFormats/VertexReco/interface/Vertex.h"
#include "DataFormats/HepMCCandidate/interface/GenParticle.h"
#include "DataFormats/PatCandidates/interface/Muon.h"
#include "DataFormats/PatCandidates/interface/Electron.h"
#include "DataFormats/PatCandidates/interface/Jet.h"
#include "DataFormats/PatCandidates/interface/MET.h"
#include "DataFormats/TrackReco/interface/TrackFwd.h"
#include "DataFormats/TrackReco/interface/Track.h"
#include "DataFormats/TrackReco/interface/TrackExtra.h"
#include "DataFormats/MuonReco/interface/MuonCocktails.h"
#include "Upgrades/VLQAnalyzer/interface/EventInfoTree.h"
#include "Upgrades/VLQAnalyzer/interface/VLQTree.h"
#include "TTree.h"
#include "TFile.h"
#include "TLorentzVector.h"
//
// class declaration
//
// If the analyzer does not use TFileService, please remove
// the template argument to the base class so the class inherits
// from edm::one::EDAnalyzer<> and also remove the line from
// constructor "usesResource("TFileService");"
// This will improve performance in multithreaded jobs.
class VLQAnalyzer : public edm::one::EDAnalyzer<edm::one::SharedResources> {
public:
explicit VLQAnalyzer(const edm::ParameterSet&);
~VLQAnalyzer();
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
private:
virtual void beginJob() override;
virtual void analyze(const edm::Event&, const edm::EventSetup&) override;
virtual void endJob() override;
// ----------member data ---------------------------
//unsigned int pileup_;
//edm::EDGetTokenT<std::vector<PileupSummaryInfo>> puInfo_;
edm::InputTag puInfo_;
//edm::EDGetTokenT<reco::VertexCollection > vtxToken_;
edm::EDGetTokenT<std::vector<reco::Vertex>> vtxToken_;
edm::Service<TFileService> fs_;
edm::EDGetTokenT<edm::View<pat::Jet> > ak4jetsToken_;
edm::EDGetTokenT<edm::View<pat::Jet> > ak8jetsToken_;
edm::EDGetTokenT<edm::View<pat::Jet> > subak8jetsToken_;
edm::EDGetTokenT<reco::VertexCollection > vtxToken_;
edm::EDGetTokenT<reco::GenParticleCollection> genparToken_;
double ak4ptmin_, ak4etamax_, ak8ptmin_, ak8etamax_;
edm::Service<TFileService> fs_;
TTree* tree_;
VBFEventInfoBranches evt_;
VBFGenParticleInfoBranches gen_;
VBFJetInfoBranches ak4jets_;
VBFJetInfoBranches ak8jets_;
EventInfoTree evt_;
};
//
// constants, enums and typedefs
//
//
// static data member definitions
//
//
// constructors and destructor
//
VLQAnalyzer::VLQAnalyzer(const edm::ParameterSet& iConfig):
puInfo_ (iConfig.getParameter<edm::InputTag>("puInfo")),
//pileup_ (iConfig.getParameter<unsigned int>("pileup"))
//vtxToken_ (consumes<reco::VertexCollection> (iConfig.getParameter<edm::InputTag>("vertices"))),
vtxToken_ (consumes<std::vector<reco::Vertex>>(iConfig.getParameter<edm::InputTag>("vertices")))
ak4jetsToken_ (consumes<edm::View<pat::Jet> >(iConfig.getParameter<edm::InputTag>("jets"))),
ak8jetsToken_ (consumes<edm::View<pat::Jet> >(iConfig.getParameter<edm::InputTag>("jets_ak8"))),
subak8jetsToken_(consumes<edm::View<pat::Jet> >(iConfig.getParameter<edm::InputTag>("subjets_ak8"))),
vtxToken_ (consumes<reco::VertexCollection >(iConfig.getParameter<edm::InputTag>("vertices"))),
genparToken_ (consumes<std::vector<reco::GenParticle>>(iConfig.getParameter<edm::InputTag>("genparToken"))),
ak4ptmin_ (iConfig.getParameter<double>("ak4ptmin")),
ak4etamax_ (iConfig.getParameter<double>("ak4etamax")),
ak8ptmin_ (iConfig.getParameter<double>("ak8ptmin")),
ak8etamax_ (iConfig.getParameter<double>("ak8etamax"))
{
consumes<std::vector<PileupSummaryInfo>>(puInfo_);
//now do what ever initialization is needed
usesResource("TFileService");
}
VLQAnalyzer::~VLQAnalyzer()
{
// do anything here that needs to be done at desctruction time
// (e.g. close files, deallocate resources etc.)
}
//
// member functions
//
// ------------ method called for each event ------------
void
VLQAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
{
using namespace edm;
evt_.runno = iEvent.eventAuxiliary().run();
evt_.lumisec = iEvent.eventAuxiliary().luminosityBlock();
evt_.evtno = iEvent.eventAuxiliary().event();
edm::Handle<std::vector< PileupSummaryInfo > > puInfo;
iEvent.getByLabel(puInfo_, puInfo);
std::vector<PileupSummaryInfo>::const_iterator pvi;
for(pvi = puInfo->begin(); pvi != puInfo->end(); ++pvi) {
//std::cout << " Pileup Information: bunchXing, nInt, TrueNInt " << pvi->getBunchCrossing() << " " << pvi->getPU_NumInteractions() << " "<< pvi->getTrueNumInteractions() <<std::endl;
evt_.npuTrue = pvi->getTrueNumInteractions();
evt_.npuInt = pvi->getBunchCrossing();
evt_.puBX = pvi->getPU_NumInteractions();
}
//std::cout << " next ... " << std::endl;
edm::Handle<reco::VertexCollection> vertices;
iEvent.getByToken(vtxToken_, vertices);
if (vertices->empty()) return;
evt_.npv = vertices->size();
evt_.nvtx = 0;
for (size_t i = 0; i < vertices->size(); i++) {
if (vertices->at(i).isFake()) continue;
if (vertices->at(i).ndof() <= 4) continue;
evt_.vPt2.push_back(vertices->at(i).p4().pt());
evt_.nvtx++;
}
gen_.clearTreeVectors();
ak4jets_.clearTreeVectors();
ak8jets_.clearTreeVectors();
edm::Handle<std::vector<reco::GenParticle>> h_genpar;
iEvent.getByToken(genparToken_, h_genpar);
for (reco::GenParticle igen : *(h_genpar.product())) {
if ( igen.isHardProcess() || igen.fromHardProcessFinalState() || igen.fromHardProcessDecayed()
|| igen.fromHardProcessBeforeFSR() || igen.statusFlags().isLastCopy() ) {
gen_.genpid .push_back(igen.pdgId());
gen_.genpt .push_back(igen.pt());
gen_.geneta .push_back(igen.eta());
gen_.genphi .push_back(igen.phi());
gen_.genmass .push_back(igen.mass());
gen_.gencharge .push_back(igen.charge());
gen_.genstatus .push_back(igen.status());
if (igen.numberOfMothers() > 0 && igen.mother(0) != nullptr) {
gen_.mom0pt .push_back(igen.mother(0)->pt());
gen_.mom0eta .push_back(igen.mother(0)->eta());
gen_.mom0phi .push_back(igen.mother(0)->phi());
gen_.mom0pid .push_back(igen.mother(0)->pdgId());
gen_.mom0status.push_back(igen.mother(0)->status());
}
if (igen.numberOfMothers() > 1 && igen.mother(1) != nullptr) {
gen_.mom1pt .push_back(igen.mother(1)->pt());
gen_.mom1eta .push_back(igen.mother(1)->eta());
gen_.mom1phi .push_back(igen.mother(1)->phi());
gen_.mom1pid .push_back(igen.mother(1)->pdgId());
gen_.mom1status.push_back(igen.mother(1)->status());
}
if (igen.numberOfDaughters() > 0 && igen.daughter(0) != nullptr) {
gen_.dau0pt .push_back(igen.daughter(0)->pt());
gen_.dau0eta .push_back(igen.daughter(0)->eta());
gen_.dau0phi .push_back(igen.daughter(0)->phi());
gen_.dau0pid .push_back(igen.daughter(0)->pdgId());
gen_.dau0status.push_back(igen.daughter(0)->status());
}
if (igen.numberOfDaughters() > 1 && igen.daughter(1) != nullptr) {
gen_.dau1pt .push_back(igen.daughter(1)->pt());
gen_.dau1eta .push_back(igen.daughter(1)->eta());
gen_.dau1phi .push_back(igen.daughter(1)->phi());
gen_.dau1pid .push_back(igen.daughter(1)->pdgId());
gen_.dau1status .push_back(igen.daughter(1)->status());
}
}
}
edm::Handle<reco::VertexCollection> h_vertices;
iEvent.getByToken(vtxToken_, h_vertices);
if (h_vertices->empty()) return;
evt_.npv = h_vertices->size();
edm::Handle<edm::View<pat::Jet> > h_ak4jets;
iEvent.getByToken(ak4jetsToken_, h_ak4jets);
for (const pat::Jet & j : *h_ak4jets) {
if (j.pt() < ak4ptmin_ || abs(j.eta()) > ak4etamax_) continue;
const reco::GenJet* genjet = j.genJet() ;
if (genjet != nullptr) ak4jets_.genjetpt.push_back(j.genJet()->pt()) ;
else ak4jets_.genjetpt.push_back(-9999) ;
ak4jets_.pt .push_back(j.pt()) ;
ak4jets_.eta .push_back(j.eta()) ;
ak4jets_.phi .push_back(j.phi()) ;
ak4jets_.energy .push_back(j.energy());
ak4jets_.mass .push_back(j.mass());
ak4jets_.partonFlavour.push_back(j.partonFlavour());
ak4jets_.hadronFlavour.push_back(j.hadronFlavour());
ak4jets_.csvv2 .push_back(j.bDiscriminator("pfCombinedInclusiveSecondaryVertexV2BJetTags"));
ak4jets_.deepcsv .push_back(j.bDiscriminator("pfDeepCSVJetTags:probb")
+ j.bDiscriminator("pfDeepCSVJetTags:probbb"));
ak4jets_.pujetid .push_back(j.userFloat("pileupJetId:fullDiscriminant"));
}
edm::Handle<edm::View<pat::Jet> > h_ak8jets;
iEvent.getByToken(ak8jetsToken_, h_ak8jets);
for (const pat::Jet & j : *h_ak8jets) {
if (j.pt() < ak8ptmin_ || abs(j.eta()) > ak8etamax_) continue;
const reco::GenJet* genjet = j.genJet() ;
if (genjet != nullptr) ak8jets_.genjetpt.push_back(j.genJet()->pt()) ;
else ak8jets_.genjetpt.push_back(-9999) ;
ak8jets_.pt .push_back(j.pt()) ;
ak8jets_.eta .push_back(j.eta()) ;
ak8jets_.phi .push_back(j.phi()) ;
ak8jets_.energy .push_back(j.energy());
ak8jets_.mass .push_back(j.mass());
ak8jets_.ptCHS .push_back(j.userFloat("ak8PFJetsCHSValueMap:pt")) ;
ak8jets_.etaCHS .push_back(j.userFloat("ak8PFJetsCHSValueMap:eta")) ;
ak8jets_.phiCHS .push_back(j.userFloat("ak8PFJetsCHSValueMap:phi")) ;
ak8jets_.massCHS .push_back(j.userFloat("ak8PFJetsCHSValueMap:mass")) ;
ak8jets_.softDropMassCHS .push_back(j.userFloat("ak8PFJetsCHSValueMap:ak8PFJetsCHSSoftDropMass")) ;
ak8jets_.prunedMassCHS .push_back(j.userFloat("ak8PFJetsCHSValueMap:ak8PFJetsCHSPrunedMass")) ;
ak8jets_.tau1CHS .push_back(j.userFloat("ak8PFJetsCHSValueMap:NjettinessAK8CHSTau1"));
ak8jets_.tau2CHS .push_back(j.userFloat("ak8PFJetsCHSValueMap:NjettinessAK8CHSTau2"));
ak8jets_.tau3CHS .push_back(j.userFloat("ak8PFJetsCHSValueMap:NjettinessAK8CHSTau3"));
ak8jets_.softDropMassPuppi.push_back(j.userFloat("ak8PFJetsPuppiSoftDropMass")) ;
ak8jets_.tau1Puppi .push_back(j.userFloat("NjettinessAK8Puppi:tau1"));
ak8jets_.tau2Puppi .push_back(j.userFloat("NjettinessAK8Puppi:tau2"));
ak8jets_.tau3Puppi .push_back(j.userFloat("NjettinessAK8Puppi:tau3"));
ak8jets_.csvv2 .push_back(j.bDiscriminator("pfCombinedInclusiveSecondaryVertexV2BJetTags"));
ak8jets_.deepcsv .push_back(j.bDiscriminator("pfDeepCSVJetTags:probb")
+ j.bDiscriminator("pfDeepCSVJetTags:probbb"));
ak8jets_.partonFlavour .push_back(j.partonFlavour());
ak8jets_.hadronFlavour .push_back(j.hadronFlavour());
std::vector<edm::Ptr<pat::Jet> > const& sdsubjets = j.subjets("SoftDropPuppi") ;
if (sdsubjets.size() < 2) continue ;
ak8jets_.sj0pt .push_back(sdsubjets.at(0)->pt()) ;
ak8jets_.sj1pt .push_back(sdsubjets.at(1)->pt()) ;
ak8jets_.sj0eta .push_back(sdsubjets.at(0)->eta()) ;
ak8jets_.sj1eta .push_back(sdsubjets.at(1)->eta()) ;
ak8jets_.sj0phi .push_back(sdsubjets.at(0)->phi()) ;
ak8jets_.sj1phi .push_back(sdsubjets.at(1)->phi()) ;
ak8jets_.sj0partonFlavour.push_back(sdsubjets.at(0)->partonFlavour());
ak8jets_.sj0hadronFlavour.push_back(sdsubjets.at(0)->hadronFlavour());
ak8jets_.sj1partonFlavour.push_back(sdsubjets.at(1)->partonFlavour());
ak8jets_.sj1hadronFlavour.push_back(sdsubjets.at(1)->hadronFlavour());
ak8jets_.sj0csvv2 .push_back(sdsubjets.at(0)->bDiscriminator("pfCombinedInclusiveSecondaryVertexV2BJetTags"));
ak8jets_.sj1csvv2 .push_back(sdsubjets.at(1)->bDiscriminator("pfCombinedInclusiveSecondaryVertexV2BJetTags"));
ak8jets_.sj0deepcsv .push_back(sdsubjets.at(0)->bDiscriminator("pfDeepCSVJetTags:probb")
+ sdsubjets.at(0)->bDiscriminator("pfDeepCSVJetTags:probbb"));
ak8jets_.sj1deepcsv .push_back(sdsubjets.at(1)->bDiscriminator("pfDeepCSVJetTags:probb")
+ sdsubjets.at(1)->bDiscriminator("pfDeepCSVJetTags:probbb"));
}
tree_->Fill();
#ifdef THIS_IS_AN_EVENT_EXAMPLE
Handle<ExampleData> pIn;
iEvent.getByLabel("example",pIn);
#endif
#ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE
ESHandle<SetupData> pSetup;
iSetup.get<SetupRecord>().get(pSetup);
#endif
}
// ------------ method called once each job just before starting event loop ------------
void
VLQAnalyzer::beginJob()
{
tree_ = fs_->make<TTree>("anatree", "anatree") ;
evt_.RegisterTree(tree_, "SelectedEvt") ;
gen_.RegisterTree(tree_, "GenParticles") ;
ak4jets_.RegisterTree(tree_, "AK4JetsCHS") ;
ak8jets_.RegisterTree(tree_, "AK8JetsPuppi") ;
}
// ------------ method called once each job just after ending the event loop ------------
void
VLQAnalyzer::endJob()
{
}
// ------------ method fills 'descriptions' with the allowed parameters for the module ------------
void
VLQAnalyzer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
//The following says we do not know what parameters are allowed so do no validation
// Please change this to state exactly what you do use, even if it is no parameters
edm::ParameterSetDescription desc;
desc.setUnknown();
descriptions.addDefault(desc);
}
//define this as a plug-in
DEFINE_FWK_MODULE(VLQAnalyzer);
| [
"jking79@ku.edu"
] | jking79@ku.edu |
d272e63f5ea5c01004eb9c5a7c0863844753ccb5 | f55def6bda4baefa3ff55c1f341fa2eb91e4f2b5 | /MMOCoreORB/src/server/zone/objects/creature/commands/WbossAreaAttackCommand.h | c7ecd087cb8c0c2126300e9279582db6de3be234 | [] | no_license | SWGEmu-Private-Servers/Sunrunner-II | 8e5048967cd99ab8f5b0b20045805f62d3ae4b76 | 98fc568300ced38582173e33a3dcfd233abbce9c | refs/heads/master | 2022-12-23T04:28:43.431737 | 2020-09-22T18:59:24 | 2020-09-22T18:59:24 | 297,396,146 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 745 | h | /*
Copyright <SWGEmu>
See file COPYING for copying conditions.*/
#ifndef WBOSSAREAATTACKCOMMAND_H_
#define WBOSSAREAATTACKCOMMAND_H_
#include "CombatQueueCommand.h"
class WbossAreaAttackCommand : public CombatQueueCommand {
public:
WbossAreaAttackCommand(const String& name, ZoneProcessServer* server) : CombatQueueCommand(name, server) {
}
int doQueueCommand(CreatureObject* creature, const uint64& target, const UnicodeString& arguments) const {
if (!checkStateMask(creature))
return INVALIDSTATE;
if (!checkInvalidLocomotions(creature))
return INVALIDLOCOMOTION;
if (!creature->isAiAgent())
return GENERALERROR;
return doCombatAction(creature, target, arguments);
}
};
#endif //WBOSSAREAATTACKCOMMAND_H_
| [
"thrax989@yahoo.com"
] | thrax989@yahoo.com |
607d6380ef6862cc67c4897697ecacd858e46c49 | c65251aafac2452de89b33a97018f5fc07d19830 | /src/vt/group/id/group_id.cc | 919d346bbe419aebc0419e5c3b44080e057c03ac | [
"BSD-2-Clause"
] | permissive | PhilMiller/vt | b0454520e8d0a31ca8ccd8b3cb37eea2018c029a | 9a5983cc884b998e313b741acc7c3d03916207cf | refs/heads/master | 2020-07-22T19:30:45.905074 | 2019-08-14T21:48:49 | 2019-08-14T21:48:49 | 207,304,466 | 0 | 0 | null | 2019-09-09T12:32:37 | 2019-09-09T12:32:36 | null | UTF-8 | C++ | false | false | 3,891 | cc | /*
//@HEADER
// ************************************************************************
//
// group_id.cc
// vt (Virtual Transport)
// Copyright (C) 2018 NTESS, LLC
//
// Under the terms of Contract DE-NA-0003525 with NTESS, LLC,
// the U.S. Government retains certain rights in this software.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "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 SANDIA CORPORATION OR THE
// 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.
//
// Questions? Contact darma@sandia.gov
//
// ************************************************************************
//@HEADER
*/
#include "vt/config.h"
#include "vt/group/group_common.h"
#include "vt/group/id/group_id.h"
#include "vt/utils/bits/bits_common.h"
namespace vt { namespace group {
/*static*/ GroupType GroupIDBuilder::createGroupID(
GroupIDType const& id, NodeType const& node, bool const& is_collective,
bool const& is_static
) {
auto const& set_node = !is_collective ? node : group_collective_node;
GroupType new_group = 0;
setIsCollective(new_group, is_collective);
setIsStatic(new_group, is_static);
setNode(new_group, set_node);
setID(new_group, id);
return new_group;
}
/*static*/ void GroupIDBuilder::setIsCollective(
GroupType& group, bool const& is_coll
) {
BitPackerType::boolSetField<eGroupIDBits::Collective>(group, is_coll);
}
/*static*/ void GroupIDBuilder::setIsStatic(
GroupType& group, bool const& is_static
) {
BitPackerType::boolSetField<eGroupIDBits::Static>(group, is_static);
}
/*static*/ void GroupIDBuilder::setNode(
GroupType& group, NodeType const& node
) {
BitPackerType::setField<eGroupIDBits::Node, group_node_num_bits>(group, node);
}
/*static*/ void GroupIDBuilder::setID(
GroupType& group, GroupIDType const& id
) {
BitPackerType::setField<eGroupIDBits::ID, group_id_num_bits>(group, id);
}
/*static*/ bool GroupIDBuilder::isCollective(GroupType const& group) {
return BitPackerType::boolGetField<eGroupIDBits::Collective>(group);
}
/*static*/ bool GroupIDBuilder::isStatic(GroupType const& group) {
return BitPackerType::boolGetField<eGroupIDBits::Static>(group);
}
/*static*/ NodeType GroupIDBuilder::getNode(GroupType const& group) {
return BitPackerType::getField<
eGroupIDBits::Node, group_node_num_bits, NodeType
>(group);
}
/*static*/ GroupIDType GroupIDBuilder::getGroupID(GroupType const& group) {
return BitPackerType::getField<
eGroupIDBits::ID, group_id_num_bits, GroupIDType
>(group);
}
}} /* end namespace vt::group */
| [
"jliffla@sandia.gov"
] | jliffla@sandia.gov |
8cc32e6c5fe4975ab54fa7d7b001a2366f0fead6 | 72d44d01083aeb66606cecd9d84dbb0eb17b0acb | /leetcode/leetcode414/leetcode414/main.cpp | 22c67f6596a73d239ea10fb2c92b192760914ff4 | [] | no_license | danache/coding | e3d704b6302acb913d3f58ea1dfe9e126d1b0f39 | ef798534e8412eb81f31318244305e1a6110ea72 | refs/heads/master | 2020-04-19T15:12:56.562307 | 2018-06-03T06:24:37 | 2018-06-03T06:24:37 | 66,996,085 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 770 | cpp | //
// main.cpp
// leetcode414
//
// Created by 萧天牧 on 17/8/16.
// Copyright © 2017年 萧天牧. All rights reserved.
//
#include <iostream>
#include <vector>
#include <queue>
#include <map>
using namespace std;
int thirdMax(vector<int>& nums) {
priority_queue<int> a;
map<int,int> mp;
for(auto n : nums){
if (mp.count(n) == 0){
a.push(n);
mp[n] = 1;
}
}
if(a.size() < 3){
int top1 = a.top();
a.pop();
return max(top1, a.top());
}
a.pop();
a.pop();
return a.top();
}
int main(int argc, const char * argv[]) {
// insert code here...
vector<int> a {1,2,2,3};
cout << thirdMax(a)<<endl;
std::cout << "Hello, World!\n";
return 0;
}
| [
"danache@126.com"
] | danache@126.com |
0291527cc1442607e6ac8fe22f07e47e8fe7b59e | 253e782c6cfb45ef6e7761c23fb12df8717e783f | /Chapter02/Source/Chapter2/UserProfile.cpp | 699d8e804384d8a38e87b8813e0c1c760a175b37 | [
"MIT"
] | permissive | sunithshetty/Unreal-Engine-4-Scripting-with-CPlusPlus-Cookbook | 548639184020fbd483e1bebb15ffd93f377408bd | 0b78eed3f712bf2965a981b28801da528b4231bf | refs/heads/master | 2021-01-11T04:41:18.777016 | 2016-10-17T09:11:29 | 2016-10-17T09:11:29 | 71,113,373 | 13 | 6 | null | null | null | null | UTF-8 | C++ | false | false | 131 | cpp | // Fill out your copyright notice in the Description page of Project Settings.
#include "Chapter2.h"
#include "UserProfile.h"
| [
"packt.suniths@gmail.com"
] | packt.suniths@gmail.com |
4962a351703e049a98776deb64d584d45dc33bcd | e2eac5e18d38c399e85f8d23c47b5bbec485ea49 | /SVG_TriangleFollow/ReadGlobalData.cpp | f403ff695a9ebbe0de93173266e3eef3275f2912 | [] | no_license | dwpaley/LatticeRepLib | 5cadeadc26e20383d73b4ae9d3735f0f5b374346 | 320c40916e7de7a582c268b2d5a78d1c3448556d | refs/heads/master | 2023-04-22T17:00:51.436160 | 2021-05-14T18:51:41 | 2021-05-14T18:51:41 | 366,528,924 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 15,095 | cpp |
#include "ReadGlobalData.h"
#include "GlobalTriangleFollowerConstants.h"
#include "LRL_RandTools.h"
#include "LRL_StringTools.h"
#include "LRL_ToString.h"
#include "Theta.h"
#include <algorithm>
#include <cfloat>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstddef>
#include <iostream>
#include <iterator>
#include <list>
#include <string>
#include <utility>
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
bool not_space( const char c ) {
return( c != ' ' );
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
bool space( const char c ) {
return( c == ' ' );
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
const std::vector<std::string> SplitBetweenBlanks( const std::string& s ) {
std::vector<std::string> str;
std::string::const_iterator i = s.begin( );
while ( i != s.end( ) )
{
//look for the next non-blank
i = std::find_if( i, s.end(), not_space );
const std::string::const_iterator i2 = std::find_if( i, s.end( ), space );
str.push_back( std::string( i, i2 ) );
i = i2;
}
return( str );
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
const std::string GetDataString( const std::string& s, const size_t n ) {
std::vector<std::string> vstr = SplitBetweenBlanks(s);
if ( vstr.size( ) < n+1 ) vstr.resize( n+1, "0" );
return( vstr[n] );
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
const int GetIntData( const std::string& s ) {
return( atoi(s.c_str( ) ) );
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
const double GetDoubleData( const std::string& s ) {
const double result = atof(s.c_str( ) );
return( atof(s.c_str( ) ) );
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
//std::string ReadGlobalData::strToupper(const std::string& s) {
// std::string ss;
// std::transform(s.begin(), s.end(), std::back_inserter( ss ), toupper );
// return( ss );
//}
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
const bool GetBoolData( const std::string& s ) {
const std::string sData = GetDataString(LRL_StringTools::strToupper(s), 0);
return( sData == "TRUE" || sData == "YES" );
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
const std::pair<int,int> Get2IntData( const std::vector<std::string>& s ) {
const std::string sData1 = GetDataString( s[1], 0 );
const std::string sData2 = GetDataString( s[2], 0 );
return( std::make_pair( atoi(sData1.c_str()), atoi(sData2.c_str()) ) );
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
std::string GetG6Data( const std::vector<std::string>& v ) {
std::string s = """";
for( size_t i=1; i<7; ++i )
s += v[i] + " ";
return( s + """" );
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
void SetGlobalValue( const std::string& dataType,
const std::vector<std::string>& value,
void* pData ) {
if ( dataType == "g6" && value.size() < 7) {
std::cout << "REJECTED " << value[0] << std::endl << std::flush;
return;
} else if ( dataType != "g6" && value.size() < 2 ) {
std::cout << "REJECTED " << value[0] << std::endl << std::flush;
return;
}
if ( dataType == "bool" ) {
*(bool*)pData = GetBoolData( value[1] );
} else if ( dataType == "int" ) {
*(int*)pData = GetIntData( value[1] );
} else if ( dataType == "double" ) {
*(double*)pData = GetDoubleData( value[1] );
} else if ( dataType == "2doubles" ) {
const std::pair<int,int> plotSpec = Get2IntData( value );
*(std::pair<int,int>*)pData = plotSpec;
} else if ( dataType == "string" ) {
*(std::string*)pData = value[1];
} else if ( dataType == "g6" ) {
const std::string v6 = GetG6Data( value );
if ( v6[0] != DBL_MAX )
GLOBAL_RunInputVector::globalData.push_back( v6 );
} else if ( dataType == "g6Perturb" ) {
const std::string v6 = GetG6Data( value );
if ( v6[0] != DBL_MAX )
GLOBAL_RunInputVector::globalData.push_back( ReadGlobalData::GeneratePerturbation( v6 ) );
} else if ( dataType == "fixRandomSeed" ) {
*(bool*)pData = GetBoolData( value[1] );
} else if ( dataType == "MovieMode" ) {
GlobalConstants::globalMovieMode = LRL_StringTools::strToupper(value[1]) == "STAR" ? GlobalConstants::globalStar : GlobalConstants::globalTrail;
} else if ( dataType == "FollowerMode" ) {
if (LRL_StringTools::strToupper(value[1]) == "WEB") {
GlobalConstants::globalFollowerMode = GlobalConstants::globalWeb;
}
else if (LRL_StringTools::strToupper(value[1]) == "FOLLOW") {
GlobalConstants::globalFollowerMode = GlobalConstants::globalFollow;
}
else {
GlobalConstants::globalFollowerMode = GlobalConstants::globalMovie;
}
}
else {
}
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
// add some small random perturbation
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
G6 ReadGlobalData::GeneratePerturbation(const G6& v) {
return( v + GlobalConstants::globalFractionalAmountToPerturb * G6::rand( ) );
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
std::string TranslateGlobalValue( const std::string& dataType, void* pData ) {
std::string s;
if ( dataType == "bool" )
s = *(bool*)pData ? "true" : "false";
else if ( dataType == "int" )
s = LRL_ToString(*(int*)pData);
else if ( dataType == "double" )
s = LRL_ToString(*(double*)pData);
else if ( dataType == "2doubles" )
s = LRL_ToString( (*(std::pair<int,int>*)pData).first ) + " " + LRL_ToString( (*(std::pair<int,int>*)pData).second );
else if ( dataType == "string" )
s = *(std::string*)pData;
else if ( dataType == "fixRandomSeed" ) {
s = *(bool*)pData ? "true" : "false";
SetSeed(std::abs(GLOBAL_RunInputVector::globalConstantRandomSeed ? GLOBAL_RunInputVector::globalInputRandomSeed : (int)(time(0)%32767)) );
} else if ( dataType == "MovieMode" )
s = ((*(GlobalConstants::enumMovieMode*)pData == GlobalConstants::globalStar) ? "STAR" : "TRAIL");
else if ( dataType == "FollowerMode" ) { //globalFollow, globalMovie, globalWeb
if ( (*(GlobalConstants::enumFollowerMode*)pData) == GlobalConstants::globalMovie )
s = "Movie";
else if ( (*(GlobalConstants::enumFollowerMode*)pData) == GlobalConstants::globalWeb )
s = "Web";
else
s = "Follow";
} else {
}
return( s );
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
const std::pair<std::string, void*> FindBestTextMatch( const std::string& stringToMatch,
const std::vector<ReadGlobalData::ParseData>& parseData,
const ThetaMatch<std::string>& tMatch ) {
size_t bestMatchIndex = 0;
double bestMatch = DBL_MAX;
const std::string commandToMatch = SplitBetweenBlanks(stringToMatch)[0];
for( size_t i=0; i!=parseData.size( ); ++i ) {
const double match = tMatch.theta(LRL_StringTools::strToupper(commandToMatch), parseData[i].m_label);
if ( match < bestMatch ) {
bestMatch = match;
bestMatchIndex = i;
}
}
if ( bestMatch > 0.9 )
return( std::make_pair( "", (void*)0 ) );
else
return(std::make_pair(parseData[bestMatchIndex].m_dataTypeToRead, parseData[bestMatchIndex].m_dataLocation));
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
bool ReadGlobalData::GetDataFromCIN( const std::vector<ReadGlobalData::ParseData>& parseData ) {
ThetaMatch<std::string> tMatch;
char buffer[200];
std::string s;
std::vector<std::string> vStrTest;
do {
if ( std::cin.getline( buffer, sizeof(buffer)/sizeof(buffer[0]) ).eof( ) ) break;
s = LRL_StringTools::strToupper( buffer );
vStrTest = SplitBetweenBlanks( s );
} while ( (! std::cin) || s.empty( ) || vStrTest.empty( ) || vStrTest[0].empty( ) );
if ( ! std::cin || s.substr(0,3)==std::string( "END" ) ) {
return( false );
} else {
const std::pair<std::string, void*> bestMatch = FindBestTextMatch( std::string(buffer), parseData, tMatch );
const std::vector<std::string> vStr = SplitBetweenBlanks( s );
if ( vStr.empty( ) || vStr[0].empty( ) || bestMatch.first.empty( ) )
return( true );
SetGlobalValue( bestMatch.first, vStr, bestMatch.second );
return( true );
}
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
const std::vector<ReadGlobalData::ParseData> ReadGlobalData::BuildParseStructure( void ) {
std::vector<ParseData> v;
v.push_back( ParseData( LRL_StringTools::strToupper( "CirclePlot" ), "bool", (void*)&GlobalConstants::globalDrawCirclePlot ) );
v.push_back( ParseData( LRL_StringTools::strToupper( "DistancePlot" ), "bool", (void*)&GlobalConstants::globalDrawDistancePlot ) );
v.push_back( ParseData( LRL_StringTools::strToupper( "PrintDistanceData" ), "bool", (void*)&GlobalConstants::globalPrintAllDistanceData ) );
v.push_back( ParseData( LRL_StringTools::strToupper( "GlitchesOnly" ), "bool", (void*)&GlobalConstants::globalOutputGlitchesOnly ) );
v.push_back( ParseData(LRL_StringTools::strToupper( "Plot" ), "2doubles", (void*)&GlobalConstants::globalWhichComponentsToPlot ) );
v.push_back( ParseData( LRL_StringTools::strToupper( "PerturbBy" ), "double", (void*)&GlobalConstants::globalFractionalAmountToPerturb ) );
v.push_back( ParseData( LRL_StringTools::strToupper( "GlitchLevel" ), "double", (void*)&GlobalConstants::globalPercentChangeToDetect ) );
v.push_back( ParseData( LRL_StringTools::strToupper( "BoundaryWindow" ), "double", (void*)&GlobalConstants::globalFractionToDetermineCloseToBoundary ) );
v.push_back( ParseData( LRL_StringTools::strToupper( "FramesPerPath" ), "int", (void*)&GlobalConstants::globalFramesPerSegment ) );
v.push_back( ParseData( LRL_StringTools::strToupper( "StepsPerFrame" ),"int", (void*)&GlobalConstants::globalStepsPerFrame ) );
v.push_back( ParseData( LRL_StringTools::strToupper( "Trials" ), "int", (void*)&GlobalConstants::globalNumberOfTrialsToAttempt ) );
v.push_back( ParseData( LRL_StringTools::strToupper( "AllBlack" ), "bool", (void*)&GlobalConstants::globalPlotAllSegmentsAsBlack ) );
v.push_back( ParseData(LRL_StringTools::strToupper( "FilePrefix" ), "string", (void*)&GlobalConstants::globalFileNamePrefix ) );
v.push_back( ParseData( LRL_StringTools::strToupper( "GraphSize" ), "int", (void*)&SVG_WriterConstants::globalGraphSpace ) );
v.push_back( ParseData( LRL_StringTools::strToupper( "Border" ), "int", (void*)&SVG_WriterConstants::globalGraphBorder ) );
v.push_back( ParseData( LRL_StringTools::strToupper( "PlotSize" ), "int", (void*)&SVG_WriterConstants::globalPlotSpace ) );
v.push_back( ParseData( LRL_StringTools::strToupper( "CirclePlotSize" ), "int", (void*)&SVG_CirclePlotConstants::globalCirclePlotSize ) );
v.push_back( ParseData( LRL_StringTools::strToupper( "CircleRadius" ), "int", (void*)&SVG_CirclePlotConstants::globalCircleRadius ) );
v.push_back( ParseData( LRL_StringTools::strToupper( "CircleStrokeWidth" ), "int", (void*)&SVG_CirclePlotConstants::globalCircleStrokeWidth ) );
v.push_back(ParseData(LRL_StringTools::strToupper("G6LineWidth" ), "int", (void*)&SVG_DistancePlotConstants::globalG6DataLineStrokeWidth));
v.push_back(ParseData(LRL_StringTools::strToupper("DeloneLineWidth"), "int", (void*)&SVG_DistancePlotConstants::globalDeloneDataLineStrokeWidth));
v.push_back( ParseData(LRL_StringTools::strToupper( "AxisWidth" ), "int", (void*)&SVG_DistancePlotConstants::globalDataAxisWidth ) );
v.push_back( ParseData(LRL_StringTools::strToupper( "TicLength" ), "int", (void*)&SVG_DistancePlotConstants::globalY_AxisTicMarkLength ) );
v.push_back( ParseData(LRL_StringTools::strToupper( "Vector" ), "g6", (void*)0 ) );
v.push_back( ParseData(LRL_StringTools::strToupper( "Perturb" ), "g6Perturb", (void*)0 ) );
v.push_back( ParseData(LRL_StringTools::strToupper( "MovieMode" ), "MovieMode", (void*)&GlobalConstants::globalMovieMode ) );
v.push_back( ParseData(LRL_StringTools::strToupper( "FollowerMode" ), "FollowerMode", (void*)&GlobalConstants::globalFollowerMode ) );
v.push_back( ParseData(LRL_StringTools::strToupper( "FixRandomSeed" ), "fixRandomSeed", (void*)&GLOBAL_RunInputVector::globalConstantRandomSeed ) );
v.push_back(ParseData(LRL_StringTools::strToupper("RandomSeed"), "int", (void*)&GLOBAL_RunInputVector::globalInputRandomSeed));
//bool GLOBAL_FileNames::globalShouldTimeStamp = true; // NOT IMPLEMENTED AS INPUT VARIABLE !!!!!!!!!!!!
v.push_back(ParseData(LRL_StringTools::strToupper("TimeStamp"), "bool", (void*)&GLOBAL_FileNames::globalShouldTimeStamp));
v.push_back( ParseData(LRL_StringTools::strToupper( "END" ), "end", (void*)0) );
return( v );
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
std::string ReadGlobalData::FormatGlobalDataAsString( const std::vector<ParseData>& parseData ) {
std::string s;
for( size_t i=0; i<parseData.size(); ++i )
{
const ParseData& pd = parseData[i];
s += pd.m_label + " " + pd.m_dataTypeToRead + " " + TranslateGlobalValue(pd.m_dataTypeToRead, pd.m_dataLocation) + "\n";
}
s += "\n";
s += ((GLOBAL_RunInputVector::globalData.empty( ) ) ? "\n" : "User Input Vectors ****************************\n");
std::vector<G6>::const_iterator it = GLOBAL_RunInputVector::globalData.begin();
for ( ;it !=GLOBAL_RunInputVector::globalData.end(); ++ it )
s += LRL_ToString( *it ) + "\n";
s += ((GLOBAL_RunInputVector::globalData.empty( ) ) ? "\n" : "END User Input Vectors ****************************\n\n");
return( s );
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
ReadGlobalData::ReadGlobalData( ) {
std::cout << "Input Global Data, end with \"end\"" << std::endl;
const std::vector<ParseData> inputLabels = BuildParseStructure( );
while( std::cin && GetDataFromCIN( inputLabels ) ) { }
if (GlobalConstants::globalFollowerMode != GlobalConstants::globalWeb) {
GLOBAL_Report::globalDataReport = FormatGlobalDataAsString(inputLabels);
std::cout << GLOBAL_Report::globalDataReport;
}
}
| [
"larry6640995@gmail.com"
] | larry6640995@gmail.com |
24b4a53cc92883e5c00d403c78ff499e27908585 | 4f4c40fd67cfccf81fc83868258a0e45273126f6 | /PrioEngineStaticLibrary/Engine/RefractReflectShader.h | f633f6604bcf7b83af5529bea0e9b803571fc918 | [
"Apache-2.0"
] | permissive | SamConnolly94/PrioEngineStaticLibrary | 9319ec64bb3f2817fbe28bae6ca3e63603fbe964 | f9be61923a08a3a6e4d3e09a11f0f9479975ab4a | refs/heads/master | 2021-01-11T08:18:46.243436 | 2017-03-31T15:31:21 | 2017-03-31T15:31:21 | 72,927,741 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,460 | h | #ifndef REFRACTIONSHADER_H
#define REFRACTIONSHADER_H
#include "Shader.h"
#include "Light.h"
class CReflectRefractShader :
public CShader
{
private:
struct ViewportBufferType
{
D3DXVECTOR2 ViewportSize;
D3DXVECTOR4 viewportPadding1;
D3DXVECTOR2 viewportPadding2;
};
struct LightBufferType
{
D3DXVECTOR4 AmbientColour;
D3DXVECTOR4 DiffuseColour;
D3DXVECTOR3 LightDirection;
D3DXVECTOR4 mSpecularColour;
D3DXVECTOR3 mLightPosition;
float mSpecularPower;
float lightBufferPadding;
};
struct TerrainAreaBufferType
{
float snowHeight;
float grassHeight;
float dirtHeight;
float sandHeight;
};
struct PositioningBufferType
{
float yOffset;
float WaterPlaneY;
D3DXVECTOR2 posPadding;
D3DXVECTOR4 posPadding2;
};
struct GradientBufferType
{
D3DXVECTOR4 apexColour;
D3DXVECTOR4 centreColour;
};
public:
CReflectRefractShader();
~CReflectRefractShader();
public:
bool Initialise(ID3D11Device* device, HWND hwnd);
void Shutdown();
bool RefractionRender(ID3D11DeviceContext* deviceContext, int indexCount);
bool ReflectionRender(ID3D11DeviceContext* deviceContext, int indexCount);
/*bool SkyboxRefractionRender(ID3D11DeviceContext* deviceContext, int indexCount, D3DXMATRIX worldMatrix, D3DXMATRIX viewMatrix,
D3DXMATRIX projMatrix, D3DXVECTOR3 lightDirection, D3DXVECTOR4 ambientColour, D3DXVECTOR4 diffuseColour, D3DXVECTOR4 apexColour, D3DXVECTOR4 centreColour, ID3D11ShaderResourceView* waterHeightMap);*/
private:
D3DXMATRIX mWorldMatrix;
D3DXMATRIX mViewMatrix;
D3DXMATRIX mProjMatrix;
D3DXVECTOR4 mAmbientColour;
D3DXVECTOR4 mDiffuseColour;
D3DXVECTOR3 mLightDirection;
float mSpecularPower;
D3DXVECTOR4 mSpecularColour;
D3DXVECTOR3 mLightPosition;
D3DXVECTOR2 mViewportSize;
float mSnowHeight;
float mGrassHeight;
float mDirtHeight;
float mSandHeight;
float mTerrainYOffset;
float mWaterPlaneYOffset;
// Don't manage memory for these, we should never allocate it in the class to the texture resoureces, so deallocate / release it outside too.
ID3D11ShaderResourceView* mpWaterHeightMap;
ID3D11ShaderResourceView* mpDirtTexArray[2];
ID3D11ShaderResourceView* mpGrassTextures[2];
ID3D11ShaderResourceView* mpPatchMap;
ID3D11ShaderResourceView* mpRockTextures[2];
public:
void SetLightProperties(CLight* light);
void SetViewportProperties(int screenWidth, int screenHeight);
void SetTerrainAreaProperties(float snowHeight, float grassHeight, float dirtHeight, float sandHeight);
void SetPositioningProperties(float terrainPositionY, float waterPlanePositionY);
void SetWaterHeightmap(ID3D11ShaderResourceView* waterHeightMap);
void SetDirtTextureArray(CTexture** dirtTexArray);
void SetGrassTextureArray(CTexture** grassTexArray);
void SetPatchMap(CTexture* patchMap);
void SetRockTexture(CTexture** rockTexArray);
private:
bool InitialiseShader(ID3D11Device * device, HWND hwnd, std::string vsFilename, std::string psFilename, std::string reflectionPSFilename, std::string modelReflectionPSName/*, std::string skyboxRefractionVSName, std::string skyboxRefractionPSName*/);
void ShutdownShader();
void OutputShaderErrorMessage(ID3D10Blob *errorMessage, HWND hwnd, std::string shaderFilename);
bool SetShaderParameters(ID3D11DeviceContext* deviceContext);
//bool SetSkyboxShaderParameters(ID3D11DeviceContext* deviceContext, D3DXMATRIX worldMatrix, D3DXMATRIX viewMatrix,
// D3DXMATRIX projMatrix, D3DXVECTOR3 lightDirection, D3DXVECTOR4 ambientColour, D3DXVECTOR4 diffuseColour, D3DXVECTOR4 apexColour, D3DXVECTOR4 centreColour, ID3D11ShaderResourceView* waterHeightMap);
void CReflectRefractShader::RenderRefractionShader(ID3D11DeviceContext * deviceContext, int indexCount);
void CReflectRefractShader::RenderReflectionShader(ID3D11DeviceContext * deviceContext, int indexCount);
//void RenderSkyboxRefractionShader(ID3D11DeviceContext * deviceContext, int indexCount);
private:
ID3D11VertexShader* mpVertexShader;
//ID3D11VertexShader* mpSkyboxVertexShader;
ID3D11PixelShader* mpRefractionPixelShader;
ID3D11PixelShader* mpReflectionPixelShader;
ID3D11PixelShader* mpModelReflectionPixelShader;
//ID3D11PixelShader* mpSkyboxRefractionPixelShader;
ID3D11InputLayout* mpLayout;
ID3D11SamplerState* mpTrilinearWrap;
ID3D11SamplerState* mpBilinearMirror;
ID3D11Buffer* mpLightBuffer;
ID3D11Buffer* mpViewportBuffer;
ID3D11Buffer* mpTerrainAreaBuffer;
ID3D11Buffer* mpPositioningBuffer;
ID3D11Buffer* mpGradientBuffer;
};
#endif | [
"samconnolly94@gmail.com"
] | samconnolly94@gmail.com |
e785ee15d48ed0dfce0a6e8244df2276362cf059 | 2048a4ad9c500061bbd9fbe4f76cb6f1beb8686d | /third-party/armadillo_bits/Cube_bones.hpp | 4362331a9f0e7b1ed902a7aa818964d729eb311a | [
"MIT"
] | permissive | joshloyal/drforest | ed054f9527553958b7cfefa48cbe04fb7948be55 | d66c1b1cd7640520ee071e2cb1448ef915d7d86b | refs/heads/main | 2023-04-06T20:30:49.902197 | 2023-03-08T22:17:56 | 2023-03-08T22:17:56 | 341,343,329 | 9 | 0 | MIT | 2021-12-31T21:26:04 | 2021-02-22T21:32:37 | Jupyter Notebook | UTF-8 | C++ | false | false | 26,165 | hpp | // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 National ICT Australia (NICTA)
//
// 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.
// ------------------------------------------------------------------------
//! \addtogroup Cube
//! @{
struct Cube_prealloc
{
static constexpr uword mat_ptrs_size = 4;
static constexpr uword mem_n_elem = 64;
};
//! Dense cube class
template<typename eT>
class Cube : public BaseCube< eT, Cube<eT> >
{
public:
typedef eT elem_type; //!< the type of elements stored in the cube
typedef typename get_pod_type<eT>::result pod_type; //!< if eT is std::complex<T>, pod_type is T; otherwise pod_type is eT
const uword n_rows; //!< number of rows in each slice (read-only)
const uword n_cols; //!< number of columns in each slice (read-only)
const uword n_elem_slice; //!< number of elements in each slice (read-only)
const uword n_slices; //!< number of slices in the cube (read-only)
const uword n_elem; //!< number of elements in the cube (read-only)
const uword n_alloc; //!< number of allocated elements (read-only); NOTE: n_alloc can be 0, even if n_elem > 0
const uword mem_state;
// mem_state = 0: normal cube which manages its own memory
// mem_state = 1: use auxiliary memory until a size change
// mem_state = 2: use auxiliary memory and don't allow the number of elements to be changed
// mem_state = 3: fixed size (eg. via template based size specification)
arma_aligned const eT* const mem; //!< pointer to the memory used for storing elements (memory is read-only)
protected:
arma_aligned const Mat<eT>** const mat_ptrs;
arma_align_mem Mat<eT>* mat_ptrs_local[ Cube_prealloc::mat_ptrs_size ];
arma_align_mem eT mem_local[ Cube_prealloc::mem_n_elem ]; // local storage, for small cubes
public:
inline ~Cube();
inline Cube();
inline explicit Cube(const uword in_rows, const uword in_cols, const uword in_slices);
inline explicit Cube(const SizeCube& s);
template<typename fill_type> inline Cube(const uword in_rows, const uword in_cols, const uword in_slices, const fill::fill_class<fill_type>& f);
template<typename fill_type> inline Cube(const SizeCube& s, const fill::fill_class<fill_type>& f);
inline Cube(Cube&& m);
inline Cube& operator=(Cube&& m);
inline Cube( eT* aux_mem, const uword aux_n_rows, const uword aux_n_cols, const uword aux_n_slices, const bool copy_aux_mem = true, const bool strict = false, const bool prealloc_mat = false);
inline Cube(const eT* aux_mem, const uword aux_n_rows, const uword aux_n_cols, const uword aux_n_slices);
inline Cube& operator= (const eT val);
inline Cube& operator+=(const eT val);
inline Cube& operator-=(const eT val);
inline Cube& operator*=(const eT val);
inline Cube& operator/=(const eT val);
inline Cube(const Cube& m);
inline Cube& operator= (const Cube& m);
inline Cube& operator+=(const Cube& m);
inline Cube& operator-=(const Cube& m);
inline Cube& operator%=(const Cube& m);
inline Cube& operator/=(const Cube& m);
template<typename T1, typename T2>
inline explicit Cube(const BaseCube<pod_type,T1>& A, const BaseCube<pod_type,T2>& B);
inline Cube(const subview_cube<eT>& X);
inline Cube& operator= (const subview_cube<eT>& X);
inline Cube& operator+=(const subview_cube<eT>& X);
inline Cube& operator-=(const subview_cube<eT>& X);
inline Cube& operator%=(const subview_cube<eT>& X);
inline Cube& operator/=(const subview_cube<eT>& X);
template<typename T1> inline Cube(const subview_cube_slices<eT,T1>& X);
template<typename T1> inline Cube& operator= (const subview_cube_slices<eT,T1>& X);
template<typename T1> inline Cube& operator+=(const subview_cube_slices<eT,T1>& X);
template<typename T1> inline Cube& operator-=(const subview_cube_slices<eT,T1>& X);
template<typename T1> inline Cube& operator%=(const subview_cube_slices<eT,T1>& X);
template<typename T1> inline Cube& operator/=(const subview_cube_slices<eT,T1>& X);
arma_inline subview_cube<eT> row(const uword in_row);
arma_inline const subview_cube<eT> row(const uword in_row) const;
arma_inline subview_cube<eT> col(const uword in_col);
arma_inline const subview_cube<eT> col(const uword in_col) const;
inline Mat<eT>& slice(const uword in_slice);
inline const Mat<eT>& slice(const uword in_slice) const;
arma_inline subview_cube<eT> rows(const uword in_row1, const uword in_row2);
arma_inline const subview_cube<eT> rows(const uword in_row1, const uword in_row2) const;
arma_inline subview_cube<eT> cols(const uword in_col1, const uword in_col2);
arma_inline const subview_cube<eT> cols(const uword in_col1, const uword in_col2) const;
arma_inline subview_cube<eT> slices(const uword in_slice1, const uword in_slice2);
arma_inline const subview_cube<eT> slices(const uword in_slice1, const uword in_slice2) const;
arma_inline subview_cube<eT> subcube(const uword in_row1, const uword in_col1, const uword in_slice1, const uword in_row2, const uword in_col2, const uword in_slice2);
arma_inline const subview_cube<eT> subcube(const uword in_row1, const uword in_col1, const uword in_slice1, const uword in_row2, const uword in_col2, const uword in_slice2) const;
inline subview_cube<eT> subcube(const uword in_row1, const uword in_col1, const uword in_slice1, const SizeCube& s);
inline const subview_cube<eT> subcube(const uword in_row1, const uword in_col1, const uword in_slice1, const SizeCube& s) const;
inline subview_cube<eT> subcube(const span& row_span, const span& col_span, const span& slice_span);
inline const subview_cube<eT> subcube(const span& row_span, const span& col_span, const span& slice_span) const;
inline subview_cube<eT> operator()(const span& row_span, const span& col_span, const span& slice_span);
inline const subview_cube<eT> operator()(const span& row_span, const span& col_span, const span& slice_span) const;
inline subview_cube<eT> operator()(const uword in_row1, const uword in_col1, const uword in_slice1, const SizeCube& s);
inline const subview_cube<eT> operator()(const uword in_row1, const uword in_col1, const uword in_slice1, const SizeCube& s) const;
arma_inline subview_cube<eT> tube(const uword in_row1, const uword in_col1);
arma_inline const subview_cube<eT> tube(const uword in_row1, const uword in_col1) const;
arma_inline subview_cube<eT> tube(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2);
arma_inline const subview_cube<eT> tube(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) const;
arma_inline subview_cube<eT> tube(const uword in_row1, const uword in_col1, const SizeMat& s);
arma_inline const subview_cube<eT> tube(const uword in_row1, const uword in_col1, const SizeMat& s) const;
inline subview_cube<eT> tube(const span& row_span, const span& col_span);
inline const subview_cube<eT> tube(const span& row_span, const span& col_span) const;
inline subview_cube<eT> head_slices(const uword N);
inline const subview_cube<eT> head_slices(const uword N) const;
inline subview_cube<eT> tail_slices(const uword N);
inline const subview_cube<eT> tail_slices(const uword N) const;
template<typename T1> arma_inline subview_elem1<eT,T1> elem(const Base<uword,T1>& a);
template<typename T1> arma_inline const subview_elem1<eT,T1> elem(const Base<uword,T1>& a) const;
template<typename T1> arma_inline subview_elem1<eT,T1> operator()(const Base<uword,T1>& a);
template<typename T1> arma_inline const subview_elem1<eT,T1> operator()(const Base<uword,T1>& a) const;
arma_inline subview_cube_each1<eT> each_slice();
arma_inline const subview_cube_each1<eT> each_slice() const;
template<typename T1> inline subview_cube_each2<eT, T1> each_slice(const Base<uword, T1>& indices);
template<typename T1> inline const subview_cube_each2<eT, T1> each_slice(const Base<uword, T1>& indices) const;
inline const Cube& each_slice(const std::function< void( Mat<eT>&) >& F);
inline const Cube& each_slice(const std::function< void(const Mat<eT>&) >& F) const;
inline const Cube& each_slice(const std::function< void( Mat<eT>&) >& F, const bool use_mp);
inline const Cube& each_slice(const std::function< void(const Mat<eT>&) >& F, const bool use_mp) const;
template<typename T1> arma_inline subview_cube_slices<eT,T1> slices(const Base<uword,T1>& indices);
template<typename T1> arma_inline const subview_cube_slices<eT,T1> slices(const Base<uword,T1>& indices) const;
inline void shed_row(const uword row_num);
inline void shed_col(const uword col_num);
inline void shed_slice(const uword slice_num);
inline void shed_rows(const uword in_row1, const uword in_row2);
inline void shed_cols(const uword in_col1, const uword in_col2);
inline void shed_slices(const uword in_slice1, const uword in_slice2);
template<typename T1> inline void shed_slices(const Base<uword, T1>& indices);
inline void insert_rows(const uword row_num, const uword N, const bool set_to_zero = true);
inline void insert_cols(const uword row_num, const uword N, const bool set_to_zero = true);
inline void insert_slices(const uword slice_num, const uword N, const bool set_to_zero = true);
template<typename T1> inline void insert_rows(const uword row_num, const BaseCube<eT,T1>& X);
template<typename T1> inline void insert_cols(const uword col_num, const BaseCube<eT,T1>& X);
template<typename T1> inline void insert_slices(const uword slice_num, const BaseCube<eT,T1>& X);
template<typename gen_type> inline Cube(const GenCube<eT, gen_type>& X);
template<typename gen_type> inline Cube& operator= (const GenCube<eT, gen_type>& X);
template<typename gen_type> inline Cube& operator+=(const GenCube<eT, gen_type>& X);
template<typename gen_type> inline Cube& operator-=(const GenCube<eT, gen_type>& X);
template<typename gen_type> inline Cube& operator%=(const GenCube<eT, gen_type>& X);
template<typename gen_type> inline Cube& operator/=(const GenCube<eT, gen_type>& X);
template<typename T1, typename op_type> inline Cube(const OpCube<T1, op_type>& X);
template<typename T1, typename op_type> inline Cube& operator= (const OpCube<T1, op_type>& X);
template<typename T1, typename op_type> inline Cube& operator+=(const OpCube<T1, op_type>& X);
template<typename T1, typename op_type> inline Cube& operator-=(const OpCube<T1, op_type>& X);
template<typename T1, typename op_type> inline Cube& operator%=(const OpCube<T1, op_type>& X);
template<typename T1, typename op_type> inline Cube& operator/=(const OpCube<T1, op_type>& X);
template<typename T1, typename eop_type> inline Cube(const eOpCube<T1, eop_type>& X);
template<typename T1, typename eop_type> inline Cube& operator= (const eOpCube<T1, eop_type>& X);
template<typename T1, typename eop_type> inline Cube& operator+=(const eOpCube<T1, eop_type>& X);
template<typename T1, typename eop_type> inline Cube& operator-=(const eOpCube<T1, eop_type>& X);
template<typename T1, typename eop_type> inline Cube& operator%=(const eOpCube<T1, eop_type>& X);
template<typename T1, typename eop_type> inline Cube& operator/=(const eOpCube<T1, eop_type>& X);
template<typename T1, typename op_type> inline Cube(const mtOpCube<eT, T1, op_type>& X);
template<typename T1, typename op_type> inline Cube& operator= (const mtOpCube<eT, T1, op_type>& X);
template<typename T1, typename op_type> inline Cube& operator+=(const mtOpCube<eT, T1, op_type>& X);
template<typename T1, typename op_type> inline Cube& operator-=(const mtOpCube<eT, T1, op_type>& X);
template<typename T1, typename op_type> inline Cube& operator%=(const mtOpCube<eT, T1, op_type>& X);
template<typename T1, typename op_type> inline Cube& operator/=(const mtOpCube<eT, T1, op_type>& X);
template<typename T1, typename T2, typename glue_type> inline Cube(const GlueCube<T1, T2, glue_type>& X);
template<typename T1, typename T2, typename glue_type> inline Cube& operator= (const GlueCube<T1, T2, glue_type>& X);
template<typename T1, typename T2, typename glue_type> inline Cube& operator+=(const GlueCube<T1, T2, glue_type>& X);
template<typename T1, typename T2, typename glue_type> inline Cube& operator-=(const GlueCube<T1, T2, glue_type>& X);
template<typename T1, typename T2, typename glue_type> inline Cube& operator%=(const GlueCube<T1, T2, glue_type>& X);
template<typename T1, typename T2, typename glue_type> inline Cube& operator/=(const GlueCube<T1, T2, glue_type>& X);
template<typename T1, typename T2, typename eglue_type> inline Cube(const eGlueCube<T1, T2, eglue_type>& X);
template<typename T1, typename T2, typename eglue_type> inline Cube& operator= (const eGlueCube<T1, T2, eglue_type>& X);
template<typename T1, typename T2, typename eglue_type> inline Cube& operator+=(const eGlueCube<T1, T2, eglue_type>& X);
template<typename T1, typename T2, typename eglue_type> inline Cube& operator-=(const eGlueCube<T1, T2, eglue_type>& X);
template<typename T1, typename T2, typename eglue_type> inline Cube& operator%=(const eGlueCube<T1, T2, eglue_type>& X);
template<typename T1, typename T2, typename eglue_type> inline Cube& operator/=(const eGlueCube<T1, T2, eglue_type>& X);
template<typename T1, typename T2, typename glue_type> inline Cube(const mtGlueCube<eT, T1, T2, glue_type>& X);
template<typename T1, typename T2, typename glue_type> inline Cube& operator= (const mtGlueCube<eT, T1, T2, glue_type>& X);
template<typename T1, typename T2, typename glue_type> inline Cube& operator+=(const mtGlueCube<eT, T1, T2, glue_type>& X);
template<typename T1, typename T2, typename glue_type> inline Cube& operator-=(const mtGlueCube<eT, T1, T2, glue_type>& X);
template<typename T1, typename T2, typename glue_type> inline Cube& operator%=(const mtGlueCube<eT, T1, T2, glue_type>& X);
template<typename T1, typename T2, typename glue_type> inline Cube& operator/=(const mtGlueCube<eT, T1, T2, glue_type>& X);
arma_inline arma_warn_unused const eT& at_alt (const uword i) const;
arma_inline arma_warn_unused eT& operator[] (const uword i);
arma_inline arma_warn_unused const eT& operator[] (const uword i) const;
arma_inline arma_warn_unused eT& at(const uword i);
arma_inline arma_warn_unused const eT& at(const uword i) const;
arma_inline arma_warn_unused eT& operator() (const uword i);
arma_inline arma_warn_unused const eT& operator() (const uword i) const;
arma_inline arma_warn_unused eT& at (const uword in_row, const uword in_col, const uword in_slice);
arma_inline arma_warn_unused const eT& at (const uword in_row, const uword in_col, const uword in_slice) const;
arma_inline arma_warn_unused eT& operator() (const uword in_row, const uword in_col, const uword in_slice);
arma_inline arma_warn_unused const eT& operator() (const uword in_row, const uword in_col, const uword in_slice) const;
arma_inline const Cube& operator++();
arma_inline void operator++(int);
arma_inline const Cube& operator--();
arma_inline void operator--(int);
inline arma_warn_unused bool is_finite() const;
arma_inline arma_warn_unused bool is_empty() const;
inline arma_warn_unused bool has_inf() const;
inline arma_warn_unused bool has_nan() const;
arma_inline arma_warn_unused bool in_range(const uword i) const;
arma_inline arma_warn_unused bool in_range(const span& x) const;
arma_inline arma_warn_unused bool in_range(const uword in_row, const uword in_col, const uword in_slice) const;
inline arma_warn_unused bool in_range(const span& row_span, const span& col_span, const span& slice_span) const;
inline arma_warn_unused bool in_range(const uword in_row, const uword in_col, const uword in_slice, const SizeCube& s) const;
arma_inline arma_warn_unused eT* memptr();
arma_inline arma_warn_unused const eT* memptr() const;
arma_inline arma_warn_unused eT* slice_memptr(const uword slice);
arma_inline arma_warn_unused const eT* slice_memptr(const uword slice) const;
arma_inline arma_warn_unused eT* slice_colptr(const uword in_slice, const uword in_col);
arma_inline arma_warn_unused const eT* slice_colptr(const uword in_slice, const uword in_col) const;
inline void set_size(const uword in_rows, const uword in_cols, const uword in_slices);
inline void set_size(const SizeCube& s);
inline void reshape(const uword in_rows, const uword in_cols, const uword in_slices);
inline void reshape(const SizeCube& s);
inline void resize(const uword in_rows, const uword in_cols, const uword in_slices);
inline void resize(const SizeCube& s);
template<typename eT2> inline void copy_size(const Cube<eT2>& m);
template<typename functor> inline const Cube& for_each(functor F);
template<typename functor> inline const Cube& for_each(functor F) const;
template<typename functor> inline const Cube& transform(functor F);
template<typename functor> inline const Cube& imbue(functor F);
inline const Cube& replace(const eT old_val, const eT new_val);
inline const Cube& clean(const pod_type threshold);
inline const Cube& fill(const eT val);
inline const Cube& zeros();
inline const Cube& zeros(const uword in_rows, const uword in_cols, const uword in_slices);
inline const Cube& zeros(const SizeCube& s);
inline const Cube& ones();
inline const Cube& ones(const uword in_rows, const uword in_cols, const uword in_slices);
inline const Cube& ones(const SizeCube& s);
inline const Cube& randu();
inline const Cube& randu(const uword in_rows, const uword in_cols, const uword in_slices);
inline const Cube& randu(const SizeCube& s);
inline const Cube& randn();
inline const Cube& randn(const uword in_rows, const uword in_cols, const uword in_slices);
inline const Cube& randn(const SizeCube& s);
inline void reset();
inline void soft_reset();
template<typename T1> inline void set_real(const BaseCube<pod_type,T1>& X);
template<typename T1> inline void set_imag(const BaseCube<pod_type,T1>& X);
inline arma_warn_unused eT min() const;
inline arma_warn_unused eT max() const;
inline eT min(uword& index_of_min_val) const;
inline eT max(uword& index_of_max_val) const;
inline eT min(uword& row_of_min_val, uword& col_of_min_val, uword& slice_of_min_val) const;
inline eT max(uword& row_of_max_val, uword& col_of_max_val, uword& slice_of_max_val) const;
inline arma_cold bool save(const std::string name, const file_type type = arma_binary, const bool print_status = true) const;
inline arma_cold bool save(const hdf5_name& spec, const file_type type = hdf5_binary, const bool print_status = true) const;
inline arma_cold bool save( std::ostream& os, const file_type type = arma_binary, const bool print_status = true) const;
inline arma_cold bool load(const std::string name, const file_type type = auto_detect, const bool print_status = true);
inline arma_cold bool load(const hdf5_name& spec, const file_type type = hdf5_binary, const bool print_status = true);
inline arma_cold bool load( std::istream& is, const file_type type = auto_detect, const bool print_status = true);
inline arma_cold bool quiet_save(const std::string name, const file_type type = arma_binary) const;
inline arma_cold bool quiet_save(const hdf5_name& spec, const file_type type = hdf5_binary) const;
inline arma_cold bool quiet_save( std::ostream& os, const file_type type = arma_binary) const;
inline arma_cold bool quiet_load(const std::string name, const file_type type = auto_detect);
inline arma_cold bool quiet_load(const hdf5_name& spec, const file_type type = hdf5_binary);
inline arma_cold bool quiet_load( std::istream& is, const file_type type = auto_detect);
// iterators
typedef eT* iterator;
typedef const eT* const_iterator;
typedef eT* slice_iterator;
typedef const eT* const_slice_iterator;
inline iterator begin();
inline const_iterator begin() const;
inline const_iterator cbegin() const;
inline iterator end();
inline const_iterator end() const;
inline const_iterator cend() const;
inline slice_iterator begin_slice(const uword slice_num);
inline const_slice_iterator begin_slice(const uword slice_num) const;
inline slice_iterator end_slice(const uword slice_num);
inline const_slice_iterator end_slice(const uword slice_num) const;
inline void clear();
inline bool empty() const;
inline uword size() const;
inline eT& front();
inline const eT& front() const;
inline eT& back();
inline const eT& back() const;
inline void swap(Cube& B);
inline void steal_mem(Cube& X); //!< don't use this unless you're writing code internal to Armadillo
template<uword fixed_n_rows, uword fixed_n_cols, uword fixed_n_slices> class fixed;
protected:
inline void init_cold();
inline void init_warm(const uword in_rows, const uword in_cols, const uword in_slices);
template<typename T1, typename T2>
inline void init(const BaseCube<pod_type,T1>& A, const BaseCube<pod_type,T2>& B);
inline void delete_mat();
inline void create_mat();
friend class glue_join;
friend class op_reshape;
friend class op_resize;
friend class subview_cube<eT>;
public:
#ifdef ARMA_EXTRA_CUBE_PROTO
#include ARMA_INCFILE_WRAP(ARMA_EXTRA_CUBE_PROTO)
#endif
};
template<typename eT>
template<uword fixed_n_rows, uword fixed_n_cols, uword fixed_n_slices>
class Cube<eT>::fixed : public Cube<eT>
{
private:
static constexpr uword fixed_n_elem = fixed_n_rows * fixed_n_cols * fixed_n_slices;
static constexpr uword fixed_n_elem_slice = fixed_n_rows * fixed_n_cols;
static constexpr bool use_extra = (fixed_n_elem > Cube_prealloc::mem_n_elem);
arma_aligned Mat<eT>* mat_ptrs_local_extra[ (fixed_n_slices > Cube_prealloc::mat_ptrs_size) ? fixed_n_slices : 1 ];
arma_align_mem eT mem_local_extra [ use_extra ? fixed_n_elem : 1 ];
arma_inline void mem_setup();
public:
inline fixed();
inline fixed(const fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>& X);
template<typename fill_type> inline fixed(const fill::fill_class<fill_type>& f);
template<typename T1> inline fixed(const BaseCube<eT,T1>& A);
template<typename T1, typename T2> inline fixed(const BaseCube<pod_type,T1>& A, const BaseCube<pod_type,T2>& B);
using Cube<eT>::operator=;
using Cube<eT>::operator();
inline Cube& operator=(const fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>& X);
arma_inline arma_warn_unused eT& operator[] (const uword i);
arma_inline arma_warn_unused const eT& operator[] (const uword i) const;
arma_inline arma_warn_unused eT& at (const uword i);
arma_inline arma_warn_unused const eT& at (const uword i) const;
arma_inline arma_warn_unused eT& operator() (const uword i);
arma_inline arma_warn_unused const eT& operator() (const uword i) const;
arma_inline arma_warn_unused eT& at (const uword in_row, const uword in_col, const uword in_slice);
arma_inline arma_warn_unused const eT& at (const uword in_row, const uword in_col, const uword in_slice) const;
arma_inline arma_warn_unused eT& operator() (const uword in_row, const uword in_col, const uword in_slice);
arma_inline arma_warn_unused const eT& operator() (const uword in_row, const uword in_col, const uword in_slice) const;
};
class Cube_aux
{
public:
template<typename eT> arma_inline static void prefix_pp(Cube<eT>& x);
template<typename T> arma_inline static void prefix_pp(Cube< std::complex<T> >& x);
template<typename eT> arma_inline static void postfix_pp(Cube<eT>& x);
template<typename T> arma_inline static void postfix_pp(Cube< std::complex<T> >& x);
template<typename eT> arma_inline static void prefix_mm(Cube<eT>& x);
template<typename T> arma_inline static void prefix_mm(Cube< std::complex<T> >& x);
template<typename eT> arma_inline static void postfix_mm(Cube<eT>& x);
template<typename T> arma_inline static void postfix_mm(Cube< std::complex<T> >& x);
template<typename eT, typename T1> inline static void set_real(Cube<eT>& out, const BaseCube<eT,T1>& X);
template<typename eT, typename T1> inline static void set_imag(Cube<eT>& out, const BaseCube<eT,T1>& X);
template<typename T, typename T1> inline static void set_real(Cube< std::complex<T> >& out, const BaseCube< T,T1>& X);
template<typename T, typename T1> inline static void set_imag(Cube< std::complex<T> >& out, const BaseCube< T,T1>& X);
};
//! @}
| [
"jloyal25@gmail.com"
] | jloyal25@gmail.com |
bc060643993e5c4ec64bb476222206fb84114000 | 9ffc3deb77c4e98e009e49324458179a59f8b2d5 | /inc/oni-core/entities/factory/client/oni-entities-factory-client.h | 28ad01bc10576a5e7d5b345d704321db13687715 | [
"MIT"
] | permissive | sina-/oni | befe59437628811a6b62c4c425138fd4f9d23b75 | 95b873bc545cd4925b5cea8c632a82f2d815be6e | refs/heads/master | 2021-06-04T23:50:25.188350 | 2020-10-05T13:32:08 | 2020-10-05T13:32:08 | 112,530,006 | 2 | 1 | MIT | 2019-11-24T12:55:15 | 2017-11-29T21:30:02 | C++ | UTF-8 | C++ | false | false | 535 | h | #pragma once
#include <oni-core/entities/oni-entities-factory.h>
#include <oni-core/graphic/oni-graphic-fwd.h>
namespace oni {
class EntityFactory_Client : public EntityFactory {
public:
EntityFactory_Client(FontManager &,
TextureManager &,
ZLayerManager &);
protected:
void
_postProcess(EntityManager &,
EntityID) override;
private:
FontManager &mFontMng;
TextureManager &mTextureMng;
};
} | [
"sina.tamanna@gmail.com"
] | sina.tamanna@gmail.com |
d357f9789a748407663aa346bd56a6fea03d4588 | 4bea57e631734f8cb1c230f521fd523a63c1ff23 | /projects/openfoam/rarefied-flows/hyperCavity/test_case/0.00032/boundaryU | bf0c150dc587bde1c3f2df2e046a58011010534d | [] | no_license | andytorrestb/cfal | 76217f77dd43474f6b0a7eb430887e8775b78d7f | 730fb66a3070ccb3e0c52c03417e3b09140f3605 | refs/heads/master | 2023-07-04T01:22:01.990628 | 2021-08-01T15:36:17 | 2021-08-01T15:36:17 | 294,183,829 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,276 | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1912 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "0.00032";
object boundaryU;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
inlet
{
type fixedValue;
value uniform (1736 250 0);
}
outlet
{
type fixedValue;
value uniform (1736 250 0);
}
wall
{
type noSlip;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //
| [
"andytorrestb@gmail.com"
] | andytorrestb@gmail.com | |
3288481f8f0b7dfdc60d8107a29953c6e50f734c | e94caa5e0894eb25ff09ad75aa104e484d9f0582 | /data/l7/mp2/cbh/AB/cc-pVTZ/restart.cc | 4ec460bc18806346b6dd7c5cddd24ae662a76dea | [] | no_license | bdnguye2/divergence_mbpt_noncovalent | d74e5d755497509026e4ac0213ed66f3ca296908 | f29b8c75ba2f1c281a9b81979d2a66d2fd48e09c | refs/heads/master | 2022-04-14T14:09:08.951134 | 2020-04-04T10:49:03 | 2020-04-04T10:49:03 | 240,377,466 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 444 | cc | $chkbas= 89375.9720571813
$nucrep= 3874.31352836909
$chkaux= 572449562.122813
$chkupro= 1.00000000000000
$chkipro= 2.00000000000000
$chklasrep= 1.00000000000000
$chkisy6= 4.00000000000000
$chkmos= 418.806003435638
$chkCCVPQ_ISQR= 7303.41627926526
$chkbqia= 154.417005677530
$chkr0_MP2= 0.00000000000000
$energy_MP2= -1414.38004880089
$sccss= 1.00000000000000
$sccos= 1.00000000000000
$end
| [
"bdnguye2@uci.edu"
] | bdnguye2@uci.edu |
cff8bebf1c19bb681d0302bfc0eaefc43646aa77 | 2a88b58673d0314ed00e37ab7329ab0bbddd3bdc | /blaze/math/expressions/CrossExpr.h | 84e886c3deb68f3869b234d377e45384067a837f | [
"BSD-3-Clause"
] | permissive | shiver/blaze-lib | 3083de9600a66a586e73166e105585a954e324ea | 824925ed21faf82bb6edc48da89d3c84b8246cbf | refs/heads/master | 2020-09-05T23:00:34.583144 | 2016-08-24T03:55:17 | 2016-08-24T03:55:17 | 66,765,250 | 2 | 1 | NOASSERTION | 2020-04-06T05:02:41 | 2016-08-28T11:43:51 | C++ | UTF-8 | C++ | false | false | 3,515 | h | //=================================================================================================
/*!
// \file blaze/math/expressions/CrossExpr.h
// \brief Header file for the CrossExpr base class
//
// Copyright (C) 2013 Klaus Iglberger - All Rights Reserved
//
// This file is part of the Blaze library. You can redistribute it and/or modify it under
// the terms of the New (Revised) BSD License. Redistribution and use in source and binary
// forms, with or without modification, are permitted provided that the following conditions
// are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
// 3. Neither the names of the Blaze development group 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 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
// DAMAGE.
*/
//=================================================================================================
#ifndef _BLAZE_MATH_EXPRESSIONS_CROSSEXPR_H_
#define _BLAZE_MATH_EXPRESSIONS_CROSSEXPR_H_
//*************************************************************************************************
// Includes
//*************************************************************************************************
#include <blaze/math/expressions/Expression.h>
namespace blaze {
//=================================================================================================
//
// CLASS DEFINITION
//
//=================================================================================================
//*************************************************************************************************
/*!\brief Base class for all cross product expression templates.
// \ingroup math
//
// The CrossExpr class serves as a tag for all expression templates that implement mathematical
// cross products. All classes, that represent a mathematical cross product and that are used
// within the expression template environment of the Blaze library have to derive from this class
// in order to qualify as cross product expression template. Only in case a class is derived from
// the CrossExpr base class, the IsCrossExpr type trait recognizes the class as valid cross
// product expression template.
*/
struct CrossExpr : private Expression
{};
//*************************************************************************************************
} // namespace blaze
#endif
| [
"klaus.iglberger@gmail.com"
] | klaus.iglberger@gmail.com |
7a864b7ea2f1b0e5bb574ecc7776f2cf60ccc03c | 948414e696951797a2c79b6c4dcbee888ca59b27 | /Responsi_1/3/main.cpp | 4df866797bfc28191173db6944dd6eadce2a4f9d | [] | no_license | owencwijaya/IF2210_OOP | 402c98cb02e83b3d6c14e42e1035276414adadf2 | 5c7429251de588c20f3253faf2009f1870d9fa4f | refs/heads/main | 2023-04-05T07:21:19.679577 | 2021-04-22T07:54:50 | 2021-04-22T07:54:50 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 485 | cpp | /*new empty box 2
new empty box with default id 0
new empty box 1
assign box 0 <- 2
copy box 1
box 2
box 1
destroy box 2
destroy box 1
destroy box 1
destroy box 2*/
#include "Box.hpp"
using namespace std;
int main(int argc, char const *argv[])
{
Box * b1 = new Box(2);
Box * b2 = new Box();
Box * b3 = new Box(1);
(*b2) = (*b1);
Box * b4 = new Box(*b3);
b1->peek();
b3->peek();
delete b1;
delete b3;
delete b4;
delete b2;
return 0;
}
| [
"leo.matt.547@gmail.com"
] | leo.matt.547@gmail.com |
33e21a92fa8efe6c4c90debbddf96444df0b7129 | b1cca159764e0cedd802239af2fc95543c7e761c | /ext/libgecode3/vendor/gecode-3.7.3/gecode/int/exec.cpp | a6410631ce30793384930405af522d221a8edca2 | [
"MIT",
"Apache-2.0"
] | permissive | chef/dep-selector-libgecode | b6b878a1ed4a6c9c6045297e2bfec534cf1a1e8e | 76d7245d981c8742dc539be18ec63ad3e9f4a16a | refs/heads/main | 2023-09-02T19:15:43.797125 | 2021-08-24T17:02:02 | 2021-08-24T17:02:02 | 18,507,156 | 8 | 18 | Apache-2.0 | 2023-08-22T21:15:31 | 2014-04-07T05:23:13 | Ruby | UTF-8 | C++ | false | false | 2,698 | cpp | /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Christian Schulte <schulte@gecode.org>
*
* Copyright:
* Christian Schulte, 2009
*
* Last modified:
* $Date: 2010-03-04 03:40:32 +1100 (Thu, 04 Mar 2010) $ by $Author: schulte $
* $Revision: 10365 $
*
* This file is part of Gecode, the generic constraint
* development environment:
* http://www.gecode.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 <gecode/int/exec.hh>
#include <gecode/kernel/wait.hh>
namespace Gecode {
void
wait(Home home, IntVar x, void (*c)(Space& home),
IntConLevel) {
if (home.failed()) return;
GECODE_ES_FAIL(Kernel::UnaryWait<Int::IntView>::post(home,x,c));
}
void
wait(Home home, BoolVar x, void (*c)(Space& home),
IntConLevel) {
if (home.failed()) return;
GECODE_ES_FAIL(Kernel::UnaryWait<Int::BoolView>::post(home,x,c));
}
void
wait(Home home, const IntVarArgs& x, void (*c)(Space& home),
IntConLevel) {
if (home.failed()) return;
ViewArray<Int::IntView> xv(home,x);
GECODE_ES_FAIL(Kernel::NaryWait<Int::IntView>::post(home,xv,c));
}
void
wait(Home home, const BoolVarArgs& x, void (*c)(Space& home),
IntConLevel) {
if (home.failed()) return;
ViewArray<Int::BoolView> xv(home,x);
GECODE_ES_FAIL(Kernel::NaryWait<Int::BoolView>::post(home,xv,c));
}
void
when(Home home, BoolVar x,
void (*t)(Space& home), void (*e)(Space& home),
IntConLevel) {
if (home.failed()) return;
GECODE_ES_FAIL(Int::Exec::When::post(home,x,t,e));
}
}
// STATISTICS: int-post
| [
"dan@getchef.com"
] | dan@getchef.com |
fafea8aff989f8de566d7e5ec2e774a8de5ea97b | 9ca6885d197aaf6869e2080901b361b034e4cc37 | /EventFilter/EcalRawToDigiDev/src/DCCSCBlock.cc | f4ed0db84e01ef7c77f9ebcf3e94673ba3804b87 | [] | no_license | ktf/cmssw-migration | 153ff14346b20086f908a370029aa96575a2c51a | 583340dd03481dff673a52a2075c8bb46fa22ac6 | refs/heads/master | 2020-07-25T15:37:45.528173 | 2013-07-11T04:54:56 | 2013-07-11T04:54:56 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,046 | cc | #include "EventFilter/EcalRawToDigiDev/interface/DCCSCBlock.h"
#include "EventFilter/EcalRawToDigiDev/interface/DCCEventBlock.h"
#include "EventFilter/EcalRawToDigiDev/interface/DCCDataUnpacker.h"
#include <stdio.h>
#include "EventFilter/EcalRawToDigiDev/interface/EcalElectronicsMapper.h"
DCCSCBlock::DCCSCBlock( DCCDataUnpacker * u,EcalElectronicsMapper * m , DCCEventBlock * e, bool unpack)
: DCCFEBlock(u,m,e,unpack){}
void DCCSCBlock::updateCollectors(){
DCCFEBlock::updateCollectors();
// needs to be update for eb/ee
digis_ = unpacker_->eeDigisCollection();
invalidGains_ = unpacker_->invalidEEGainsCollection();
invalidGainsSwitch_ = unpacker_->invalidEEGainsSwitchCollection();
invalidChIds_ = unpacker_->invalidEEChIdsCollection();
}
int DCCSCBlock::unpackXtalData(uint expStripID, uint expXtalID){
bool errorOnXtal(false);
uint16_t * xData_= reinterpret_cast<uint16_t *>(data_);
// Get xtal data ids
uint stripId = (*xData_) & TOWER_STRIPID_MASK;
uint xtalId =((*xData_)>>TOWER_XTALID_B ) & TOWER_XTALID_MASK;
// cout<<"\n DEBUG : unpacked xtal data for strip id "<<stripId<<" and xtal id "<<xtalId<<endl;
// cout<<"\n DEBUG : expected strip id "<<expStripID<<" expected xtal id "<<expXtalID<<endl;
if( !zs_ && (expStripID != stripId || expXtalID != xtalId)){
if( ! DCCDataUnpacker::silentMode_ ){
edm::LogWarning("EcalRawToDigiDevChId")
<<"\n For event LV1: "<<event_->l1A()<<", fed "<<mapper_->getActiveDCC()<<" and tower "<<towerId_
<<"\n The expected strip is "<<expStripID<<" and "<<stripId<<" was found"
<<"\n The expected xtal is "<<expXtalID <<" and "<<xtalId<<" was found";
}
// using expected cry_di to raise warning about xtal_id problem
pDetId_ = (EEDetId*) mapper_->getDetIdPointer(towerId_,expStripID,expXtalID);
if(pDetId_){ (*invalidChIds_)->push_back(*pDetId_); }
stripId = expStripID;
xtalId = expXtalID;
errorOnXtal = true;
// return here, so to skip all following checks
data_ += numbDWInXtalBlock_;
return BLOCK_UNPACKED;
}
// check id in case of 0suppressed data
else if(zs_){
// Check for valid Ids 1) values out of range
if(stripId == 0 || stripId > 5 || xtalId == 0 || xtalId > 5){
if( ! DCCDataUnpacker::silentMode_ ){
edm::LogWarning("EcalRawToDigiDevChId")
<<"\n For event LV1: "<<event_->l1A()<<", fed "<<mapper_->getActiveDCC()<<" and tower "<<towerId_
<<"\n Invalid strip : "<<stripId<<" or xtal : "<<xtalId
<<" ids ( last strip was: " << lastStripId_ << " last ch was: " << lastXtalId_ << ")";
}
int st = lastStripId_;
int ch = lastXtalId_;
ch++;
if (ch > NUMB_XTAL) {ch=1; st++;}
if (st > NUMB_STRIP) {ch=1; st=1;}
// adding channel following the last valid
// pDetId_ = (EEDetId*) mapper_->getDetIdPointer(towerId_,st,ch);
// (*invalidChIds_)->push_back(*pDetId_);
fillEcalElectronicsError(invalidZSXtalIds_);
errorOnXtal = true;
lastStripId_ = st;
lastXtalId_ = ch;
// return here, so to skip all following checks
return SKIP_BLOCK_UNPACKING;
}else{
// Check for zs valid Ids 2) if channel-in-strip has increased wrt previous xtal
// 3) if strip has increased wrt previous xtal
if( ( stripId == lastStripId_ && xtalId <= lastXtalId_ ) ||
(stripId < lastStripId_))
{
if( ! DCCDataUnpacker::silentMode_ ){
edm::LogWarning("EcalRawToDigiDevChId")
<<"\n For event LV1: "<<event_->l1A()<<", fed "<<mapper_->getActiveDCC()<<" and tower "<<towerId_
<<"\n Xtal id was expected to increase but it didn't. "
<<"\n Last unpacked xtal was "<<lastXtalId_<<" while current xtal is "<<xtalId<<".";
}
int st = lastStripId_;
int ch = lastXtalId_;
ch++;
if (ch > NUMB_XTAL) {ch=1; st++;}
if (st > NUMB_STRIP) {ch=1; st=1;}
// adding channel following the last valid
//pDetId_ = (EEDetId*) mapper_->getDetIdPointer(towerId_,stripId,xtalId);
// (*invalidChIds_)->push_back(*pDetId_);
fillEcalElectronicsError(invalidZSXtalIds_);
errorOnXtal = true;
lastStripId_ = st;
lastXtalId_ = ch;
// return here, so to skip all following checks
return SKIP_BLOCK_UNPACKING;
}
lastStripId_ = stripId;
lastXtalId_ = xtalId;
}// end else
}// end if(zs_)
bool frameAdded=false;
// if there is an error on xtal id ignore next error checks
// otherwise, assume channel_id is valid and proceed with making and checking the data frame
if(errorOnXtal) return SKIP_BLOCK_UNPACKING;
pDetId_ = (EEDetId*) mapper_->getDetIdPointer(towerId_,stripId,xtalId);
if(pDetId_){// checking that requested EEDetId exists
(*digis_)->push_back(*pDetId_);
EEDataFrame df( (*digis_)->back() );
frameAdded=true;
bool wrongGain(false);
//set samples in the frame
for(uint i =0; i< nTSamples_ ;i++){
xData_++;
uint data = (*xData_) & TOWER_DIGI_MASK;
uint gain = data>>12;
xtalGains_[i]=gain;
if(gain == 0){ wrongGain = true; }
df.setSample(i,data);
}
if(wrongGain){
if( ! DCCDataUnpacker::silentMode_ ){
edm::LogWarning("EcalRawToDigiDevGainZero")
<<"\n For event LV1: "<<event_->l1A()<<", fed "<<mapper_->getActiveDCC()<<" and tower "<<towerId_
<<"\n Gain zero was found in strip "<<stripId<<" and xtal "<<xtalId;
}
(*invalidGains_)->push_back(*pDetId_);
errorOnXtal = true;
//return here, so to skip all the rest
//make special collection for gain0 data frames (saturation)
//Point to begin of next xtal Block
data_ += numbDWInXtalBlock_;
return BLOCK_UNPACKED;
}
short firstGainWrong=-1;
short numGainWrong=0;
for (uint i=0; i<nTSamples_; i++ ) {
if (i>0 && xtalGains_[i-1]>xtalGains_[i]) {
numGainWrong++;
if (firstGainWrong == -1) { firstGainWrong=i;}
}
}
if (numGainWrong>0) {
if( ! DCCDataUnpacker::silentMode_ ){
edm::LogWarning("EcalRawToDigiDevGainSwitch")
<<"\n For event LV1: "<<event_->l1A()<<", fed "<<mapper_->getActiveDCC()<<" and tower "<<towerId_
<<"\n A wrong gain transition switch was found in strip "<<stripId<<" and xtal "<<xtalId;
}
(*invalidGainsSwitch_)->push_back(*pDetId_);
errorOnXtal = true;
}
//Add frame to collection only if all data format and gain rules are respected
if(errorOnXtal&&frameAdded) {
(*digis_)->pop_back();
}
}// End 'if EE id exist'
else{// in case EE did not exist
if( ! DCCDataUnpacker::silentMode_ ){
edm::LogWarning("EcalRawToDigiDevChId")
<<"\n For event LV1: "<<event_->l1A()<<", fed "<<mapper_->getActiveDCC()<<" and tower "<<towerId_
<<"\n An EEDetId was requested that does not exist";
}
}
//Point to begin of next xtal Block
data_ += numbDWInXtalBlock_;
return BLOCK_UNPACKED;
}
void DCCSCBlock::fillEcalElectronicsError( std::auto_ptr<EcalElectronicsIdCollection> * errorColection){
int activeDCC = mapper_->getActiveSM();
if ( (NUMB_SM_EE_MIN_MIN <=activeDCC && activeDCC<=NUMB_SM_EE_MIN_MAX) ||
(NUMB_SM_EE_PLU_MIN <=activeDCC && activeDCC<=NUMB_SM_EE_PLU_MAX) ){
EcalElectronicsId * eleTp = mapper_->getSCElectronicsPointer(activeDCC,expTowerID_);
(*errorColection)->push_back(*eleTp);
}else{
if( ! DCCDataUnpacker::silentMode_ ){
edm::LogWarning("EcalRawToDigiDevChId")
<<"\n For event "<<event_->l1A()<<" there's fed: "<< activeDCC
<<" activeDcc: "<<mapper_->getActiveSM()
<<" but that activeDcc is not valid in EE.";
}
}
}
| [
"sha1-503ed86a7512692e45da5b2d6fd04f9879577ff8@cern.ch"
] | sha1-503ed86a7512692e45da5b2d6fd04f9879577ff8@cern.ch |
e7fb9775199e00c61e0f5ca0d452e7e09d3080fc | 91a882547e393d4c4946a6c2c99186b5f72122dd | /Source/XPSP1/NT/net/unimodem/src/umcfg/docomm.cpp | 7c174c826a4694d4eb829cbecaa0a3acf35be307 | [] | no_license | IAmAnubhavSaini/cryptoAlgorithm-nt5src | 94f9b46f101b983954ac6e453d0cf8d02aa76fc7 | d9e1cdeec650b9d6d3ce63f9f0abe50dabfaf9e2 | refs/heads/master | 2023-09-02T10:14:14.795579 | 2021-11-20T13:47:06 | 2021-11-20T13:47:06 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,286 | cpp | //****************************************************************************
//
// Module: UMCONFIG
// File: DOCOMM.C
//
// Copyright (c) 1992-1996, Microsoft Corporation, all rights reserved
//
// Revision History
//
//
// 10/17/97 JosephJ Created
//
//
// COMM-related utilities
//
//
//****************************************************************************
#include "tsppch.h"
#include "parse.h"
#include "docomm.h"
HANDLE ghComm;
void
do_open_comm(DWORD dwComm)
{
TCHAR rgchComm[32];
if (ghComm)
{
printf("Some comm port already opened!\n");
goto end;
}
wsprintf(rgchComm, "\\\\.\\COM%lu", dwComm);
ghComm = CreateFile(rgchComm,
GENERIC_WRITE | GENERIC_READ,
0, NULL,
OPEN_EXISTING, 0, NULL);
if (ghComm == INVALID_HANDLE_VALUE)
{
DWORD dwRet = GetLastError();
if (dwRet == ERROR_ACCESS_DENIED) {
printf("Port %s is in use by another app.\r\n", rgchComm);
}
else
{
printf("Couldn't open port %s.\r\n", rgchComm);
}
ghComm=NULL;
}
else
{
printf("Comm port %s opend. Handle= 0x%p\n", rgchComm, ghComm);
}
end:
return;
}
| [
"support@cryptoalgo.cf"
] | support@cryptoalgo.cf |
5144527a1f52fbf68cb1926064c29583e5158137 | a3b0944fb4832c89e8697c506445bcdfd9bb5032 | /src/secs/BS2Int2.cpp | 85920033e4639877f7495aeb7238a73a9426653b | [] | no_license | newslime/EAP_Emulator-1.4 | 5411c96771f382ad16a35069f23ae007da8fbd46 | 13b7e985c5759b7493251e3c09cc16215033b571 | refs/heads/master | 2021-08-23T19:37:58.872816 | 2017-12-06T07:50:36 | 2017-12-06T07:50:36 | 113,285,909 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 6,292 | cpp | // $Id: BS2Int2.cpp,v 1.6 2004/06/20 15:23:40 fukasawa Exp $
//=============================================================================
/**
* @file BS2Int2.cpp
*
* @author Fukasawa Mitsuo
*
*
* Copyright (C) 1998-2004 BEE Co.,Ltd. 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 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.
*/
//=============================================================================
#define BEE_BUILD_DLL
#include "BS2ItemHeader.h"
#include "BS2Int2.h"
#include "BS2Stream.h"
#include "BS2Array.h"
#include "BS2Interpreter.h"
//-----------------------------------------------------------------------------
// Constructor/Destructor
//-----------------------------------------------------------------------------
BS2Int2::BS2Int2(const BS2Int2& rhs) : BS2Atom(rhs)
{
TRACE_FUNCTION(TRL_CONSTRUCT, "BS2Int2::BS2Int2");
BS2Assert(rhs.m_t == ATOM_INT2);
}
//-----------------------------------------------------------------------------
BS2Int2::BS2Int2(BYTE * data, size_t len)
{
TRACE_FUNCTION(TRL_CONSTRUCT, "BS2Int2::BS2Int2");
if (len >= sizeof(short))
{
this->setStreamData(data);
}
else
{
initNull();
}
}
//-----------------------------------------------------------------------------
// Copy
//-----------------------------------------------------------------------------
const BS2Int2& BS2Int2::operator=(const BS2Int2& rhs)
{
TRACE_FUNCTION(TRL_LOW, "BS2Int2::operator=");
BS2Assert(m_t == ATOM_INT2 && rhs.m_t == ATOM_INT2);
if (this == &rhs)
return *this;
this->copy((BS2Atom&)rhs);
return *this;
}
//-----------------------------------------------------------------------------
const BS2Int2& BS2Int2::operator=(short data)
{
TRACE_FUNCTION(TRL_LOW, "BS2Int2::operator=");
initv(data);
return *this;
}
//-----------------------------------------------------------------------------
// set SECS-II data
//-----------------------------------------------------------------------------
void BS2Int2::set(BS2IStream& buf)
{
TRACE_FUNCTION(TRL_LOW, "BS2Int2::set");
BS2ItemHeader itemHeader;
buf >> itemHeader;
initv((short)0); // set type, qty and size
if (itemHeader.dataLength() == sizeof(short))
{
buf >> m._sh;
}
else
m_q = 0; // data is nothing
}
//-----------------------------------------------------------------------------
// set value from stream buf
//-----------------------------------------------------------------------------
void BS2Int2::setStreamData(BYTE * buf)
{
TRACE_FUNCTION(TRL_LOW, "BS2Int2::setStreamData");
initv((short)((*buf << 8) + *(buf + 1)));
}
//-----------------------------------------------------------------------------
// get SECS-II data
//-----------------------------------------------------------------------------
void BS2Int2::get(BS2OStream& buf) const
{
TRACE_FUNCTION(TRL_LOW, "BS2Int2::get");
BS2Assert(m_t == ATOM_INT2);
int len = haveData() ? sizeof(short) : 0;
BS2ItemHeader itemHeader(ATOM_INT2, 1, len);
buf << itemHeader;
if (len > 0)
buf << m._sh;
}
//-----------------------------------------------------------------------------
// get value in stream buf
//-----------------------------------------------------------------------------
void BS2Int2::getStreamData(BYTE * buf) const
{
TRACE_FUNCTION(TRL_LOW, "BS2Int2::getStreamData");
if (! haveData())
return;
*(buf + 0) = (m._sh >> 8) & 0xFF;
*(buf + 1) = m._sh & 0xFF;
}
//-----------------------------------------------------------------------------
// Factory
//-----------------------------------------------------------------------------
BS2Atom * BS2Int2::factory(BYTE * data, size_t len) const
{
TRACE_FUNCTION(TRL_LOW, "BS2Int2::factory");
if (len > sizeof(short))
{
BS2Int2Array * clone = new BS2Int2Array(data, len);
return (BS2Atom *)clone;
}
else
{
BS2Int2 * clone = new BS2Int2(data, len);
return (BS2Atom *)clone;
}
}
//-----------------------------------------------------------------------------
BS2Atom * BS2Int2::replicate() const
{
TRACE_FUNCTION(TRL_LOW, "BS2Int2::replicate");
BS2Int2 * replica = new BS2Int2;
*replica = *this;
return (BS2Atom *)replica;
}
//-----------------------------------------------------------------------------
// IO Stream
//-----------------------------------------------------------------------------
BS2IStream& operator>>(BS2IStream& is, BS2Int2& atom)
{
TRACE_FUNCTION(TRL_LOW, "BS2IStream::operator>>(BS2Int2&)");
atom.set(is);
return is;
}
BS2OStream& operator<<(BS2OStream& os, BS2Int2& atom)
{
TRACE_FUNCTION(TRL_LOW, "BS2OStream::operator<<(BS2Int2&)");
atom.get(os);
return os;
}
//-----------------------------------------------------------------------------
// Print
//-----------------------------------------------------------------------------
void BS2Int2::print(BS2InterpBase * interp) const
{
TRACE_FUNCTION(TRL_LOW, "BS2Int2::print");
if (haveData())
interp->printf(interp->print_xml() ? _TX(" %d ") : _TX(" %d"), m._sh);
else
interp->printf(interp->print_xml() ? _TX(" ") : _TX(" {}"));
}
//-----------------------------------------------------------------------------
// Dump
//-----------------------------------------------------------------------------
void BS2Int2::dump() const
{
TRACE_FUNCTION(TRL_LOW, "BS2Int2::dump");
if (haveData())
b_printf(_TX(" %d"), m._sh);
else
b_printf(_TX(" {}"));
}
//
// *** End of File ***
| [
"g9783006@gmail.com"
] | g9783006@gmail.com |
910fa2a2e6c4f6fc0ecb882c6db8bb23ebbdf47a | 7a92e39f0cbb62bf4e480ea33faa90f2dd9f42a4 | /src/physics.cpp | 5b5177ab647b90416be36b0b5de22f01abe06e03 | [
"MIT"
] | permissive | Ogravius/CarGame | e2c686866e27c2f5668be021f70138d00ee27a4a | af7329780e55e550dd787f6dd233bb7a079a7d84 | refs/heads/master | 2022-11-03T05:00:31.858626 | 2017-10-25T00:03:20 | 2017-10-25T00:03:20 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,892 | cpp | #include "physics.h"
#include <iostream>
//!< Initializer
Physics::Physics()
{
//Initialize all variables
position = m_vectMaths.zero();
velocity = m_vectMaths.zero();
friction = m_vectMaths.zero();
direction = m_vectMaths.zero();
rotationAndDirection = m_vectMaths.zero();
fSpeed = 0.f;
fMass = 0.f;
fAngle = 0.f;
eCurrentDirection = Direction::None;
//DegToRad
fDegToRad = (float)M_PI / 180;
}
//!< Physics update
void Physics::updatePhysics(float timeStep)
{
//Setup rotation
rotationAndDirection = m_vectMaths.rotationMatrix(direction, fAngle * fDegToRad);
//Change direction
if (eCurrentDirection == Direction::Positive) velocity += rotationAndDirection * fSpeed;
if (eCurrentDirection == Direction::Negative) velocity -= rotationAndDirection * fSpeed;
//Apply friction
velocity.x *= friction.x;
velocity.y *= friction.y;
//Set position
position += velocity * timeStep;
}
//!< Sets the position
void Physics::setPosition(sf::Vector2f newPos)
{
position = newPos;
}
//!< Sets the velocity
void Physics::setVelocity(sf::Vector2f newVel)
{
velocity = newVel;
}
//!< Sets the mass
void Physics::setMass(float fNewMass)
{
fMass = fNewMass;
}
//!< Sets the speed
void Physics::setSpeed(float fNewSpeed)
{
fSpeed = fNewSpeed;
}
//!< Sets the direction
void Physics::setDirection(sf::Vector2f newDir)
{
direction = newDir;
}
//!< Sets the friction
void Physics::setFriction(sf::Vector2f newFri)
{
friction = newFri;
}
//!< Sets the angle
void Physics::setAngle(float fNewAngle)
{
fAngle = fNewAngle;
}
//!< Returns the position
sf::Vector2f Physics::getPosition() const
{
return position;
}
//!< Returns the velocity
sf::Vector2f Physics::getVelocity() const
{
return velocity;
}
/*!Sets a direction for the object.*/
/**@param eDirection = New direction.*/
void Physics::setDirection(Direction eDirection)
{
eCurrentDirection = eDirection;
}
| [
"jerzysciechowski345@gmail.com"
] | jerzysciechowski345@gmail.com |
cda46bf992314d5bbd846c7fa830fafced7d6384 | ce8feac87157333d43ec8bed2391f22cfd5ec6fb | /src/main/include/tigertronics/Util.h | e9b0037fdf011e191506600f2a889c1dc0c0c5d6 | [
"MIT"
] | permissive | frc2053/Robot2020 | 8b58d7049f566ca3042a6a5d4c4d82b6e297162f | 021fae6f8cfc412bb645a4c50c7b4cd9e65e6524 | refs/heads/master | 2022-04-08T01:59:33.494417 | 2020-03-10T01:26:16 | 2020-03-10T01:26:16 | 210,482,731 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 225 | h | #pragma once
class Util {
public:
Util();
static double map(double x, double in_min, double in_max, double out_min, double out_max) {
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
};
};
| [
"williams.r.drew@gmail.com"
] | williams.r.drew@gmail.com |
1f6f7217c35d152e746f87f1090265691ad5106b | d8bab638248606cb91fd9d9e87983b5a5e018130 | /LeetCode/LeetCode 47. 全排列 II (dfs + 全排列).cpp | 5496dd975020703cb952e2280165b5d3a25de9ef | [] | no_license | ning2510/Think-twice-Code-once | cbb8c06a6b55b6c74e4361ecf879b14b0a0e74de | 45e2fb2448cd85df451722e562fc146db5910cde | refs/heads/master | 2023-01-01T00:04:47.509070 | 2020-10-24T07:01:07 | 2020-10-24T07:01:07 | 264,395,014 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 742 | cpp | class Solution {
public:
int n;
vector <int> ss;
vector <vector<int>> ans;
void dfs(int x, vector<int>& vis, vector<int>& nums) {
if(x == n) {
ans.push_back(ss);
return ;
}
for(int i = 0; i < n; i++) {
if(vis[i] || (i > 0 && nums[i] == nums[i - 1] && !vis[i - 1])) continue;
vis[i] = 1;
ss.push_back(nums[i]);
dfs(x + 1, vis, nums);
ss.pop_back();
vis[i] = 0;
}
return ;
}
vector<vector<int>> permuteUnique(vector<int>& nums) {
n = nums.size();
vector <int> vis(n, 0);
sort(nums.begin(), nums.end());
dfs(0, vis, nums);
return ans;
}
}; | [
"1367560112@qq.com"
] | 1367560112@qq.com |
be3f4e5e8b5c34cbd96f12bf542f1dd0b46e5d8d | 86495384057c4a9428f654ff96f2fe620db21484 | /libs/python35/src/main.cc | 0739845985d3b7677d83146f7275e8aa339c964c | [
"MIT"
] | permissive | taubenangriff/anno1800-mod-loader | f121831824dfe91fb0e3830f3f57f461612d0ad6 | 34179ab742460db257f957c714199a19300d6a27 | refs/heads/master | 2022-12-11T22:12:14.444771 | 2022-12-07T22:39:21 | 2022-12-07T22:39:21 | 232,338,359 | 0 | 1 | MIT | 2020-10-19T13:01:35 | 2020-01-07T14:09:58 | C++ | UTF-8 | C++ | false | false | 17,672 | cc | #include "interface.h"
#include "version.h"
#if defined(INTERNAL_ENABLED)
#include "libs/internal/debuggable/include/debuggable.h"
#endif
#include "libs/external-file-loader/include/external-file-loader.h"
#include "libs/external-file-loader/include/mod_manager.h"
#include "nlohmann/json.hpp"
#include "spdlog/sinks/basic_file_sink.h"
#include "spdlog/sinks/stdout_color_sinks.h"
#include "spdlog/spdlog.h"
#include <WinInet.h>
#include <Windows.h>
#include <tlhelp32.h>
#pragma comment(lib, "Wininet.lib")
#include <cstdio>
#include <filesystem>
#include <thread>
namespace fs = std::filesystem;
// Global events instance
static Events events;
static std::string GetLatestVersion()
{
char data[1024] = {0};
// initialize WinInet
HINTERNET hInternet =
::InternetOpen(TEXT("Anno 1800 Mod Loader"), INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
if (hInternet != nullptr) {
// 5 second timeout for now
DWORD timeout = 5 * 1000;
auto result = InternetSetOption(hInternet, INTERNET_OPTION_RECEIVE_TIMEOUT, &timeout,
sizeof(timeout));
InternetSetOption(hInternet, INTERNET_OPTION_SEND_TIMEOUT, &timeout, sizeof(timeout));
InternetSetOption(hInternet, INTERNET_OPTION_CONNECT_TIMEOUT, &timeout, sizeof(timeout));
// open HTTP session
HINTERNET hConnect =
::InternetConnectA(hInternet, "xforce.dev", INTERNET_DEFAULT_HTTPS_PORT, 0, 0,
INTERNET_SERVICE_HTTP, 0, 0);
if (hConnect != nullptr) {
HINTERNET hRequest = ::HttpOpenRequestA(
hConnect, "GET", "/anno1800-mod-loader/latest.json", 0, 0, 0,
INTERNET_FLAG_SECURE | INTERNET_FLAG_PRAGMA_NOCACHE | INTERNET_FLAG_RELOAD, 0);
if (hRequest != nullptr) {
// send request
const auto was_sent = ::HttpSendRequest(hRequest, nullptr, 0, nullptr, 0);
if (was_sent) {
DWORD status_code = 0;
DWORD status_code_size = sizeof(status_code);
HttpQueryInfo(hRequest, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER,
&status_code, &status_code_size, 0);
if (status_code != 200) {
throw std::runtime_error("Failed to read version info");
}
for (;;) {
// reading data
DWORD bytes_read;
const auto was_read =
::InternetReadFile(hRequest, data, sizeof(data) - 1, &bytes_read);
// break cycle if error or end
if (was_read == FALSE || bytes_read == 0) {
if (was_read == FALSE) {
throw std::runtime_error("Failed to read version info");
}
break;
}
// saving result
data[bytes_read] = 0;
}
}
::InternetCloseHandle(hRequest);
}
::InternetCloseHandle(hConnect);
}
::InternetCloseHandle(hInternet);
}
return data;
}
void ForEachThread(std::function<void(DWORD threadId, DWORD processId, HANDLE)> func)
{
HANDLE h = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);
if (h != INVALID_HANDLE_VALUE)
{
THREADENTRY32 te;
te.dwSize = sizeof(te);
if (Thread32First(h, &te))
{
do
{
if (te.dwSize >= FIELD_OFFSET(THREADENTRY32, th32OwnerProcessID) + sizeof(te.th32OwnerProcessID))
{
HANDLE thread = ::OpenThread(THREAD_ALL_ACCESS, FALSE, te.th32ThreadID);
if (thread != NULL)
{
func(te.th32ThreadID, te.th32OwnerProcessID, thread);
CloseHandle(thread);
}
}
te.dwSize = sizeof(te);
} while (Thread32Next(h, &te));
}
CloseHandle(h);
}
}
// Pass 0 as the targetProcessId to suspend threads in the current process
void DoSuspendThread(DWORD targetProcessId, DWORD targetThreadId)
{
ForEachThread([targetProcessId, targetThreadId](auto th32ThreadID, auto th32OwnerProcessID, auto hThread) {
if (hThread != NULL && th32ThreadID != targetThreadId && th32OwnerProcessID == targetProcessId)
{
spdlog::debug("Suspend thread");
SuspendThread(hThread);
}
});
}
void DoResumeThreads(DWORD targetProcessId)
{
ForEachThread([targetProcessId](auto th32ThreadID, auto th32OwnerProcessID, auto hThread) {
if (hThread != NULL && th32OwnerProcessID == targetProcessId)
{
spdlog::debug("Resume thread");
ResumeThread(hThread);
}
});
}
static std::once_flag hooking_once_flag;
static bool checked_hooking = false;
HANDLE CreateFileW_S(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition,
DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
{
if (!checked_hooking && std::wstring(lpFileName).find(L"maindata/file.db") != std::string::npos) {
checked_hooking = true;
std::call_once(hooking_once_flag, []() {
DoSuspendThread(GetCurrentProcessId(), GetCurrentThreadId());
events.DoHooking();
DoResumeThreads(GetCurrentProcessId());
});
}
return CreateFileW(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes,
dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);
}
HWND WINAPI CreateWindowExW_S(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName,
_In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X,
_In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent,
_In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
{
spdlog::debug("Create Window");
auto r = CreateWindowExW(dwExStyle, lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight,
hWndParent, hMenu, hInstance, lpParam);
return r;
}
FARPROC GetProcAddress_S(HMODULE hModule, LPCSTR lpProcName)
{
// A call to GetProcAddres indicates that all the copy protection is done
// and we started loading all the dynamic imports
// those would have usually been in the import table.
// This means we are ready to do some hooking
// But only do hooking once.
std::call_once(hooking_once_flag, []() {
DoSuspendThread(GetCurrentProcessId(), GetCurrentThreadId());
events.DoHooking();
DoResumeThreads(GetCurrentProcessId());
});
if ((uintptr_t)lpProcName > 0x1000) {
if (lpProcName == std::string("CreateFileW")) {
return (FARPROC)CreateFileW_S;
}
if (lpProcName == std::string("CreateWindowExW")) {
//
return (FARPROC)CreateWindowExW_S;
}
spdlog::debug("GetProcAddress {}", lpProcName);
auto procs = events.GetProcAddress(lpProcName);
for (auto& proc : procs) {
if (proc > 0) {
return (FARPROC)proc;
}
}
}
return GetProcAddress(hModule, lpProcName);
}
bool set_import(const std::string& name, uintptr_t func);
bool set_import(const std::string& name, uintptr_t func)
{
static uint64_t image_base = 0;
if (image_base == 0) {
image_base = uint64_t(GetModuleHandleA(NULL));
}
bool result = false;
auto dosHeader = (PIMAGE_DOS_HEADER)(image_base);
if (dosHeader->e_magic != IMAGE_DOS_SIGNATURE) {
throw std::runtime_error("Invalid DOS Signature");
}
auto header = (PIMAGE_NT_HEADERS)((image_base + (dosHeader->e_lfanew * sizeof(char))));
if (header->Signature != IMAGE_NT_SIGNATURE) {
throw std::runtime_error("Invalid NT Signature");
}
// BuildImportTable
PIMAGE_DATA_DIRECTORY directory =
&header->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT];
if (directory->Size > 0) {
auto importDesc = (PIMAGE_IMPORT_DESCRIPTOR)(header->OptionalHeader.ImageBase
+ directory->VirtualAddress);
for (; !IsBadReadPtr(importDesc, sizeof(IMAGE_IMPORT_DESCRIPTOR)) && importDesc->Name;
importDesc++) {
wchar_t buf[0xFFF] = {};
auto name2 = (LPCSTR)(header->OptionalHeader.ImageBase + importDesc->Name);
std::wstring sname;
size_t converted;
mbstowcs_s(&converted, buf, name2, sizeof(buf));
sname = buf;
auto csname = sname.c_str();
HMODULE handle = LoadLibraryW(csname);
if (handle == nullptr) {
SetLastError(ERROR_MOD_NOT_FOUND);
break;
}
auto* thunkRef =
(uintptr_t*)(header->OptionalHeader.ImageBase + importDesc->OriginalFirstThunk);
auto* funcRef = (FARPROC*)(header->OptionalHeader.ImageBase + importDesc->FirstThunk);
if (!importDesc->OriginalFirstThunk) // no hint table
{
thunkRef = (uintptr_t*)(header->OptionalHeader.ImageBase + importDesc->FirstThunk);
}
for (; *thunkRef, *funcRef; thunkRef++, (void)funcRef++) {
if (!IMAGE_SNAP_BY_ORDINAL(*thunkRef)) {
std::string import =
(LPCSTR)
& ((PIMAGE_IMPORT_BY_NAME)(header->OptionalHeader.ImageBase + (*thunkRef)))
->Name;
if (import == name) {
DWORD oldProtect;
VirtualProtect((void*)funcRef, sizeof(FARPROC), PAGE_EXECUTE_READWRITE,
&oldProtect);
*funcRef = (FARPROC)func;
VirtualProtect((void*)funcRef, sizeof(FARPROC), oldProtect, &oldProtect);
result = true;
}
}
}
}
}
return result;
}
HANDLE GetParentProcess()
{
HANDLE Snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
PROCESSENTRY32 ProcessEntry = {};
ProcessEntry.dwSize = sizeof(PROCESSENTRY32);
if (Process32First(Snapshot, &ProcessEntry)) {
DWORD CurrentProcessId = GetCurrentProcessId();
do {
if (ProcessEntry.th32ProcessID == CurrentProcessId)
break;
} while (Process32Next(Snapshot, &ProcessEntry));
}
CloseHandle(Snapshot);
return OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, ProcessEntry.th32ParentProcessID);
}
static void CheckVersion()
{
// Version Check
try {
auto body = GetLatestVersion();
const auto& data = nlohmann::json::parse(body);
const auto& version_str = data["version"].get<std::string>();
static int32_t current_version[3] = {VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION};
int32_t latest_version[3] = {0};
std::sscanf(version_str.c_str(), "%d.%d.%d", &latest_version[0], &latest_version[1],
&latest_version[2]);
if (std::lexicographical_compare(current_version, current_version + 3, latest_version,
latest_version + 3)) {
std::string msg = "Verion " + version_str + " of " + VER_FILE_DESCRIPTION_STR
+ " is available for download.\n\n";
msg.append("Do you want to go to the release page on GitHub?\n(THIS IS "
"HIGHLY RECOMMENDED!!!)");
if (MessageBoxA(NULL, msg.c_str(), VER_FILE_DESCRIPTION_STR,
MB_ICONQUESTION | MB_YESNO | MB_SYSTEMMODAL)
== IDYES) {
auto result =
ShellExecuteA(nullptr, "open",
"https://github.com/xforce/anno1800-mod-loader/releases/latest",
nullptr, nullptr, SW_SHOWNORMAL);
result = result;
TerminateProcess(GetCurrentProcess(), 0);
}
}
} catch (...) {
// TODO(alexander): Logging
}
}
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call) {
case DLL_PROCESS_ATTACH: {
DisableThreadLibraryCalls(hModule);
{
auto parent_handle = GetParentProcess();
wchar_t process_name[1024] = {0};
DWORD process_name_size = 1024;
QueryFullProcessImageNameW(parent_handle, 0, process_name, &process_name_size);
std::filesystem::path process_file_path(process_name);
if (_wcsicmp(process_file_path.filename().wstring().c_str(),
L"UbisoftGameLauncher.exe")
!= 0
&& _wcsicmp(process_file_path.filename().wstring().c_str(),
L"UbisoftGameLauncher64.exe")
!= 0
&& _wcsicmp(process_file_path.filename().wstring().c_str(),
L"Anno1800_plus.exe")
!= 0
&& _wcsicmp(process_file_path.filename().wstring().c_str(),
L"Anno1800.exe")
!= 0) {
return TRUE;
}
}
#if defined(INTERNAL_ENABLED)
EnableDebugging(events);
#endif
std::wstring command_line(GetCommandLineW());
if (command_line.find(L"gamelauncher_wait_handle") != std::wstring::npos
&& command_line.find(L"upc_uplay_id") != std::wstring::npos) {
return TRUE;
}
{
wchar_t process_name[1024] = {0};
DWORD process_name_size = 1024;
QueryFullProcessImageNameW(GetCurrentProcess(), 0, process_name, &process_name_size);
std::filesystem::path process_file_path(process_name);
if (_wcsicmp(process_file_path.filename().wstring().c_str(),
L"Anno1800_plus.exe")
!= 0
&& _wcsicmp(process_file_path.filename().wstring().c_str(),
L"Anno1800.exe")
!= 0) {
return TRUE;
}
}
events.DoHooking.connect([]() {
CheckVersion();
// Let's start loading the list of files we want to have
HMODULE module;
if (GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
| GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
(LPWSTR)&EnableExtenalFileLoading, &module)) {
WCHAR path[0x7FFF] = {}; // Support for long paths, in theory
GetModuleFileNameW(module, path, sizeof(path));
fs::path dll_file(path);
try {
auto logs_parent = fs::canonical(dll_file.parent_path() / ".." / "..");
auto logs_directory = logs_parent / "logs";
fs::create_directories(logs_directory);
// Set the default logger to file logger
auto file_logger = spdlog::basic_logger_mt(
"default", (logs_directory / "mod-loader.log").wstring());
spdlog::set_default_logger(file_logger);
file_logger->sinks().push_back(
std::make_shared<spdlog::sinks::stdout_color_sink_mt>());
#if defined(INTERNAL_ENABLED)
spdlog::set_level(spdlog::level::debug);
spdlog::flush_on(spdlog::level::debug);
#else
spdlog::set_level(spdlog::level::info);
spdlog::flush_on(spdlog::level::info);
#endif
spdlog::set_pattern("[%Y-%m-%d %T.%e] [%^%l%$] %v");
} catch (const fs::filesystem_error& e) {
// TODO(alexander): Logs
return;
}
} else {
spdlog::error("Failed to get current module directory {}", GetLastError());
return;
}
});
EnableExtenalFileLoading(events);
// TODO(alexander): Add code that can load other dll libraries here
// that offer more features later on
set_import("GetProcAddress", (uintptr_t)GetProcAddress_S);
}
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH: {
FreeConsole();
ModManager::instance().Shutdown();
} break;
}
return TRUE;
}
| [
"alexander@guettler.io"
] | alexander@guettler.io |
1ce22123e5d5a0c334beaf163c1f6f90bf5bc126 | 6f286be4a4e16867cc6e488080b8e3eced1dcd62 | /src/TsvInfo/main.cpp | 6a239b6077e0276a3a4184045a3c6cc785dc6777 | [
"MIT"
] | permissive | imgag/ngs-bits | 3587404be01687d52c5a77b933874ca77faf8e6b | 0597c96f6bc09067598c2364877d11091350bed8 | refs/heads/master | 2023-09-03T20:20:16.975954 | 2023-09-01T13:17:35 | 2023-09-01T13:17:35 | 38,034,492 | 110 | 36 | MIT | 2023-09-12T14:21:59 | 2015-06-25T07:23:55 | C++ | UTF-8 | C++ | false | false | 1,675 | cpp | #include "ToolBase.h"
#include "TSVFileStream.h"
#include "Helper.h"
#include "BasicStatistics.h"
#include <QFileInfo>
#include <QBitArray>
class ConcreteTool
: public ToolBase
{
Q_OBJECT
public:
ConcreteTool(int& argc, char *argv[])
: ToolBase(argc, argv)
{
}
virtual void setup()
{
setDescription("Prints general information about a TSV file.");
//optional
addInfile("in", "Input TSV file. If unset, reads from STDIN.", true);
addOutfile("out", "Output file. If unset, writes to STDOUT.", true);
}
virtual void main()
{
QString in = getInfile("in");
TSVFileStream instream(in);
//process
int rows = 0;
QBitArray numeric(instream.columns(), true);
while(!instream.atEnd())
{
QList<QByteArray> parts = instream.readLine();
if (parts.count()==0) continue;
++rows;
for (int i=0; i<numeric.count(); ++i)
{
if (!numeric[i]) continue;
numeric[i] = BasicStatistics::isValidFloat(parts[i]);
}
}
//header
QSharedPointer<QFile> out = Helper::openFileForWriting(getOutfile("out"), true);
out->write("File : " + QFileInfo(in).fileName().toUtf8() + "\n");
out->write("Columns: " + QByteArray::number(instream.columns()) + "\n");
out->write("Rows : " + QByteArray::number(rows) + "\n");
out->write("\n");
//columns
out->write("Column details:\n");
for(int i=0; i<instream.columns(); ++i)
{
QByteArray num_info;
if (numeric[i]) num_info = " (N)";
out->write(QByteArray::number(i).rightJustified(2, ' ') + ": " + instream.header().at(i) + num_info + "\n");
}
}
};
#include "main.moc"
int main(int argc, char *argv[])
{
ConcreteTool tool(argc, argv);
return tool.execute();
}
| [
"marc.sturm@med.uni-tuebingen.de"
] | marc.sturm@med.uni-tuebingen.de |
1e6119f6c7c6f2cd70f33af9a926f3729187d435 | 90047daeb462598a924d76ddf4288e832e86417c | /components/sync/base/immutable_unittest.cc | 6c8d2a89674ba008d277cb2aba41b0271a1c1001 | [
"BSD-3-Clause"
] | permissive | massbrowser/android | 99b8c21fa4552a13c06bbedd0f9c88dd4a4ad080 | a9c4371682c9443d6e1d66005d4db61a24a9617c | refs/heads/master | 2022-11-04T21:15:50.656802 | 2017-06-08T12:31:39 | 2017-06-08T12:31:39 | 93,747,579 | 2 | 2 | BSD-3-Clause | 2022-10-31T10:34:25 | 2017-06-08T12:36:07 | null | UTF-8 | C++ | false | false | 5,979 | cc | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/sync/base/immutable.h"
#include <cstddef>
#include <deque>
#include <list>
#include <set>
#include <string>
#include <vector>
#include "testing/gtest/include/gtest/gtest.h"
namespace syncer {
// Helper class that keeps track of the token passed in at
// construction and how many times that token is copied.
class TokenCore : public base::RefCounted<TokenCore> {
public:
explicit TokenCore(const char* token) : token_(token), copy_count_(0) {}
const char* GetToken() const { return token_; }
void RecordCopy() { ++copy_count_; }
int GetCopyCount() const { return copy_count_; }
private:
friend class base::RefCounted<TokenCore>;
~TokenCore() {}
const char* const token_;
int copy_count_;
};
enum SwapBehavior {
USE_DEFAULT_SWAP,
USE_FAST_SWAP_VIA_ADL,
USE_FAST_SWAP_VIA_SPECIALIZATION
};
const char kEmptyToken[] = "<empty token>";
// Base class for various token classes, differing in swap behavior.
template <SwapBehavior>
class TokenBase {
public:
TokenBase() : core_(new TokenCore(kEmptyToken)) {}
explicit TokenBase(const char* token) : core_(new TokenCore(token)) {}
TokenBase(const TokenBase& other) : core_(other.core_) {
core_->RecordCopy();
}
TokenBase& operator=(const TokenBase& other) {
core_ = other.core_;
core_->RecordCopy();
return *this;
}
const char* GetToken() const { return core_->GetToken(); }
int GetCopyCount() const { return core_->GetCopyCount(); }
// For associative containers.
bool operator<(const TokenBase& other) const {
return std::string(GetToken()) < std::string(other.GetToken());
}
// STL-style swap.
void swap(TokenBase& other) {
using std::swap;
swap(other.core_, core_);
}
// Google-style swap.
void Swap(TokenBase* other) {
using std::swap;
swap(other->core_, core_);
}
private:
scoped_refptr<TokenCore> core_;
};
using Token = TokenBase<USE_DEFAULT_SWAP>;
using ADLToken = TokenBase<USE_FAST_SWAP_VIA_ADL>;
using SpecializationToken = TokenBase<USE_FAST_SWAP_VIA_SPECIALIZATION>;
void swap(ADLToken& t1, ADLToken& t2) {
t1.Swap(&t2);
}
} // namespace syncer
// Allowed by the standard (17.4.3.1/1).
namespace std {
template <>
void swap(syncer::SpecializationToken& t1, syncer::SpecializationToken& t2) {
t1.Swap(&t2);
}
} // namespace std
namespace syncer {
namespace {
class ImmutableTest : public ::testing::Test {};
TEST_F(ImmutableTest, Int) {
int x = 5;
Immutable<int> ix(&x);
EXPECT_EQ(5, ix.Get());
EXPECT_EQ(0, x);
}
TEST_F(ImmutableTest, IntCopy) {
int x = 5;
Immutable<int> ix = Immutable<int>(&x);
EXPECT_EQ(5, ix.Get());
EXPECT_EQ(0, x);
}
TEST_F(ImmutableTest, IntAssign) {
int x = 5;
Immutable<int> ix;
EXPECT_EQ(0, ix.Get());
ix = Immutable<int>(&x);
EXPECT_EQ(5, ix.Get());
EXPECT_EQ(0, x);
}
TEST_F(ImmutableTest, IntMakeImmutable) {
int x = 5;
Immutable<int> ix = MakeImmutable(&x);
EXPECT_EQ(5, ix.Get());
EXPECT_EQ(0, x);
}
template <typename T, typename ImmutableT>
void RunTokenTest(const char* token, bool expect_copies) {
SCOPED_TRACE(token);
T t(token);
EXPECT_EQ(token, t.GetToken());
EXPECT_EQ(0, t.GetCopyCount());
ImmutableT immutable_t(&t);
EXPECT_EQ(token, immutable_t.Get().GetToken());
EXPECT_EQ(kEmptyToken, t.GetToken());
EXPECT_EQ(expect_copies, immutable_t.Get().GetCopyCount() > 0);
EXPECT_EQ(expect_copies, t.GetCopyCount() > 0);
}
TEST_F(ImmutableTest, Token) {
RunTokenTest<Token, Immutable<Token>>("Token", true /* expect_copies */);
}
TEST_F(ImmutableTest, TokenSwapMemFnByRef) {
RunTokenTest<Token, Immutable<Token, HasSwapMemFnByRef<Token>>>(
"TokenSwapMemFnByRef", false /* expect_copies */);
}
TEST_F(ImmutableTest, TokenSwapMemFnByPtr) {
RunTokenTest<Token, Immutable<Token, HasSwapMemFnByPtr<Token>>>(
"TokenSwapMemFnByPtr", false /* expect_copies */);
}
TEST_F(ImmutableTest, ADLToken) {
RunTokenTest<ADLToken, Immutable<ADLToken>>("ADLToken",
false /* expect_copies */);
}
TEST_F(ImmutableTest, SpecializationToken) {
RunTokenTest<SpecializationToken, Immutable<SpecializationToken>>(
"SpecializationToken", false /* expect_copies */);
}
template <typename C, typename ImmutableC>
void RunTokenContainerTest(const char* token) {
SCOPED_TRACE(token);
const Token tokens[] = {Token(), Token(token)};
const size_t token_count = arraysize(tokens);
C c(tokens, tokens + token_count);
const int copy_count = c.begin()->GetCopyCount();
EXPECT_GT(copy_count, 0);
for (typename C::const_iterator it = c.begin(); it != c.end(); ++it) {
EXPECT_EQ(copy_count, it->GetCopyCount());
}
// Make sure that making the container immutable doesn't incur any
// copies of the tokens.
ImmutableC immutable_c(&c);
EXPECT_TRUE(c.empty());
ASSERT_EQ(token_count, immutable_c.Get().size());
int i = 0;
for (typename C::const_iterator it = c.begin(); it != c.end(); ++it) {
EXPECT_EQ(tokens[i].GetToken(), it->GetToken());
EXPECT_EQ(copy_count, it->GetCopyCount());
++i;
}
}
TEST_F(ImmutableTest, Vector) {
RunTokenContainerTest<std::vector<Token>, Immutable<std::vector<Token>>>(
"Vector");
}
TEST_F(ImmutableTest, VectorSwapMemFnByRef) {
RunTokenContainerTest<
std::vector<Token>,
Immutable<std::vector<Token>, HasSwapMemFnByRef<std::vector<Token>>>>(
"VectorSwapMemFnByRef");
}
TEST_F(ImmutableTest, Deque) {
RunTokenContainerTest<std::deque<Token>, Immutable<std::deque<Token>>>(
"Deque");
}
TEST_F(ImmutableTest, List) {
RunTokenContainerTest<std::list<Token>, Immutable<std::list<Token>>>("List");
}
TEST_F(ImmutableTest, Set) {
RunTokenContainerTest<std::set<Token>, Immutable<std::set<Token>>>("Set");
}
} // namespace
} // namespace syncer
| [
"xElvis89x@gmail.com"
] | xElvis89x@gmail.com |
adda1afe2a6f1d699f7ae8206d5060a928b2a795 | 76f7769dc73de95f01fd06f739c3436238ab8e9b | /ConsoleApplication2GLES/angle/include/GLES2/gl2ext_explicit_context_autogen.inc | 8d4ca29379fc486ea89e267ad6604c193f9903c8 | [] | no_license | commshare/testAngleES | 720548aa5a2103d47721d8eb1e47aecdaa119a39 | 628025e64a4ce2034e1a941cd9124aa41f46f90e | refs/heads/master | 2020-04-25T22:49:49.580473 | 2019-06-18T04:27:10 | 2019-06-18T04:27:10 | 173,124,373 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 96,131 | inc | // GENERATED FILE - DO NOT EDIT.
// Generated by generate_entry_points.py using data from gl.xml and gl_angle_ext.xml.
//
// Copyright 2019 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// gl2ext_explicit_context_autogen.inc:
// Function declarations for the EGL_ANGLE_explicit_context extension
typedef void (GL_APIENTRYP PFNGLACTIVETEXTURECONTEXTANGLEPROC)(GLeglContext ctx, GLenum texture);
typedef void (GL_APIENTRYP PFNGLATTACHSHADERCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLuint shader);
typedef void (GL_APIENTRYP PFNGLBINDATTRIBLOCATIONCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLuint index, const GLchar *name);
typedef void (GL_APIENTRYP PFNGLBINDBUFFERCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLuint buffer);
typedef void (GL_APIENTRYP PFNGLBINDFRAMEBUFFERCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLuint framebuffer);
typedef void (GL_APIENTRYP PFNGLBINDRENDERBUFFERCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLuint renderbuffer);
typedef void (GL_APIENTRYP PFNGLBINDTEXTURECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLuint texture);
typedef void (GL_APIENTRYP PFNGLBLENDCOLORCONTEXTANGLEPROC)(GLeglContext ctx, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONCONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode);
typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATECONTEXTANGLEPROC)(GLeglContext ctx, GLenum modeRGB, GLenum modeAlpha);
typedef void (GL_APIENTRYP PFNGLBLENDFUNCCONTEXTANGLEPROC)(GLeglContext ctx, GLenum sfactor, GLenum dfactor);
typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATECONTEXTANGLEPROC)(GLeglContext ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
typedef void (GL_APIENTRYP PFNGLBUFFERDATACONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizeiptr size, const void *data, GLenum usage);
typedef void (GL_APIENTRYP PFNGLBUFFERSUBDATACONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
typedef GLenum (GL_APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target);
typedef void (GL_APIENTRYP PFNGLCLEARCONTEXTANGLEPROC)(GLeglContext ctx, GLbitfield mask);
typedef void (GL_APIENTRYP PFNGLCLEARCOLORCONTEXTANGLEPROC)(GLeglContext ctx, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
typedef void (GL_APIENTRYP PFNGLCLEARDEPTHFCONTEXTANGLEPROC)(GLeglContext ctx, GLfloat d);
typedef void (GL_APIENTRYP PFNGLCLEARSTENCILCONTEXTANGLEPROC)(GLeglContext ctx, GLint s);
typedef void (GL_APIENTRYP PFNGLCOLORMASKCONTEXTANGLEPROC)(GLeglContext ctx, GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
typedef void (GL_APIENTRYP PFNGLCOMPILESHADERCONTEXTANGLEPROC)(GLeglContext ctx, GLuint shader);
typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
typedef void (GL_APIENTRYP PFNGLCOPYTEXIMAGE2DCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE2DCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
typedef GLuint (GL_APIENTRYP PFNGLCREATEPROGRAMCONTEXTANGLEPROC)(GLeglContext ctx);
typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERCONTEXTANGLEPROC)(GLeglContext ctx, GLenum type);
typedef void (GL_APIENTRYP PFNGLCULLFACECONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode);
typedef void (GL_APIENTRYP PFNGLDELETEBUFFERSCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, const GLuint *buffers);
typedef void (GL_APIENTRYP PFNGLDELETEFRAMEBUFFERSCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, const GLuint *framebuffers);
typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program);
typedef void (GL_APIENTRYP PFNGLDELETERENDERBUFFERSCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, const GLuint *renderbuffers);
typedef void (GL_APIENTRYP PFNGLDELETESHADERCONTEXTANGLEPROC)(GLeglContext ctx, GLuint shader);
typedef void (GL_APIENTRYP PFNGLDELETETEXTURESCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, const GLuint *textures);
typedef void (GL_APIENTRYP PFNGLDEPTHFUNCCONTEXTANGLEPROC)(GLeglContext ctx, GLenum func);
typedef void (GL_APIENTRYP PFNGLDEPTHMASKCONTEXTANGLEPROC)(GLeglContext ctx, GLboolean flag);
typedef void (GL_APIENTRYP PFNGLDEPTHRANGEFCONTEXTANGLEPROC)(GLeglContext ctx, GLfloat n, GLfloat f);
typedef void (GL_APIENTRYP PFNGLDETACHSHADERCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLuint shader);
typedef void (GL_APIENTRYP PFNGLDISABLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum cap);
typedef void (GL_APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index);
typedef void (GL_APIENTRYP PFNGLDRAWARRAYSCONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode, GLint first, GLsizei count);
typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSCONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode, GLsizei count, GLenum type, const void *indices);
typedef void (GL_APIENTRYP PFNGLENABLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum cap);
typedef void (GL_APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index);
typedef void (GL_APIENTRYP PFNGLFINISHCONTEXTANGLEPROC)(GLeglContext ctx);
typedef void (GL_APIENTRYP PFNGLFLUSHCONTEXTANGLEPROC)(GLeglContext ctx);
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
typedef void (GL_APIENTRYP PFNGLFRONTFACECONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode);
typedef void (GL_APIENTRYP PFNGLGENBUFFERSCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, GLuint *buffers);
typedef void (GL_APIENTRYP PFNGLGENFRAMEBUFFERSCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, GLuint *framebuffers);
typedef void (GL_APIENTRYP PFNGLGENRENDERBUFFERSCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, GLuint *renderbuffers);
typedef void (GL_APIENTRYP PFNGLGENTEXTURESCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, GLuint *textures);
typedef void (GL_APIENTRYP PFNGLGENERATEMIPMAPCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target);
typedef void (GL_APIENTRYP PFNGLGETACTIVEATTRIBCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
typedef void (GL_APIENTRYP PFNGLGETATTACHEDSHADERSCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
typedef GLint (GL_APIENTRYP PFNGLGETATTRIBLOCATIONCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, const GLchar *name);
typedef void (GL_APIENTRYP PFNGLGETBOOLEANVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLboolean *data);
typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERIVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLint *params);
typedef GLenum (GL_APIENTRYP PFNGLGETERRORCONTEXTANGLEPROC)(GLeglContext ctx);
typedef void (GL_APIENTRYP PFNGLGETFLOATVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLfloat *data);
typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum attachment, GLenum pname, GLint *params);
typedef void (GL_APIENTRYP PFNGLGETINTEGERVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLint *data);
typedef void (GL_APIENTRYP PFNGLGETPROGRAMINFOLOGCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
typedef void (GL_APIENTRYP PFNGLGETPROGRAMIVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLenum pname, GLint *params);
typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLint *params);
typedef void (GL_APIENTRYP PFNGLGETSHADERINFOLOGCONTEXTANGLEPROC)(GLeglContext ctx, GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
typedef void (GL_APIENTRYP PFNGLGETSHADERPRECISIONFORMATCONTEXTANGLEPROC)(GLeglContext ctx, GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
typedef void (GL_APIENTRYP PFNGLGETSHADERSOURCECONTEXTANGLEPROC)(GLeglContext ctx, GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
typedef void (GL_APIENTRYP PFNGLGETSHADERIVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint shader, GLenum pname, GLint *params);
typedef const GLubyte *(GL_APIENTRYP PFNGLGETSTRINGCONTEXTANGLEPROC)(GLeglContext ctx, GLenum name);
typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERFVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLfloat *params);
typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLint *params);
typedef GLint (GL_APIENTRYP PFNGLGETUNIFORMLOCATIONCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, const GLchar *name);
typedef void (GL_APIENTRYP PFNGLGETUNIFORMFVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLfloat *params);
typedef void (GL_APIENTRYP PFNGLGETUNIFORMIVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLint *params);
typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLenum pname, void **pointer);
typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBFVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLenum pname, GLfloat *params);
typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLenum pname, GLint *params);
typedef void (GL_APIENTRYP PFNGLHINTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum mode);
typedef GLboolean (GL_APIENTRYP PFNGLISBUFFERCONTEXTANGLEPROC)(GLeglContext ctx, GLuint buffer);
typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDCONTEXTANGLEPROC)(GLeglContext ctx, GLenum cap);
typedef GLboolean (GL_APIENTRYP PFNGLISFRAMEBUFFERCONTEXTANGLEPROC)(GLeglContext ctx, GLuint framebuffer);
typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program);
typedef GLboolean (GL_APIENTRYP PFNGLISRENDERBUFFERCONTEXTANGLEPROC)(GLeglContext ctx, GLuint renderbuffer);
typedef GLboolean (GL_APIENTRYP PFNGLISSHADERCONTEXTANGLEPROC)(GLeglContext ctx, GLuint shader);
typedef GLboolean (GL_APIENTRYP PFNGLISTEXTURECONTEXTANGLEPROC)(GLeglContext ctx, GLuint texture);
typedef void (GL_APIENTRYP PFNGLLINEWIDTHCONTEXTANGLEPROC)(GLeglContext ctx, GLfloat width);
typedef void (GL_APIENTRYP PFNGLLINKPROGRAMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program);
typedef void (GL_APIENTRYP PFNGLPIXELSTOREICONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLint param);
typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETCONTEXTANGLEPROC)(GLeglContext ctx, GLfloat factor, GLfloat units);
typedef void (GL_APIENTRYP PFNGLREADPIXELSCONTEXTANGLEPROC)(GLeglContext ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
typedef void (GL_APIENTRYP PFNGLRELEASESHADERCOMPILERCONTEXTANGLEPROC)(GLeglContext ctx);
typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
typedef void (GL_APIENTRYP PFNGLSAMPLECOVERAGECONTEXTANGLEPROC)(GLeglContext ctx, GLfloat value, GLboolean invert);
typedef void (GL_APIENTRYP PFNGLSCISSORCONTEXTANGLEPROC)(GLeglContext ctx, GLint x, GLint y, GLsizei width, GLsizei height);
typedef void (GL_APIENTRYP PFNGLSHADERBINARYCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
typedef void (GL_APIENTRYP PFNGLSHADERSOURCECONTEXTANGLEPROC)(GLeglContext ctx, GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
typedef void (GL_APIENTRYP PFNGLSTENCILFUNCCONTEXTANGLEPROC)(GLeglContext ctx, GLenum func, GLint ref, GLuint mask);
typedef void (GL_APIENTRYP PFNGLSTENCILFUNCSEPARATECONTEXTANGLEPROC)(GLeglContext ctx, GLenum face, GLenum func, GLint ref, GLuint mask);
typedef void (GL_APIENTRYP PFNGLSTENCILMASKCONTEXTANGLEPROC)(GLeglContext ctx, GLuint mask);
typedef void (GL_APIENTRYP PFNGLSTENCILMASKSEPARATECONTEXTANGLEPROC)(GLeglContext ctx, GLenum face, GLuint mask);
typedef void (GL_APIENTRYP PFNGLSTENCILOPCONTEXTANGLEPROC)(GLeglContext ctx, GLenum fail, GLenum zfail, GLenum zpass);
typedef void (GL_APIENTRYP PFNGLSTENCILOPSEPARATECONTEXTANGLEPROC)(GLeglContext ctx, GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
typedef void (GL_APIENTRYP PFNGLTEXIMAGE2DCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLfloat param);
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, const GLfloat *params);
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERICONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLint param);
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, const GLint *params);
typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE2DCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
typedef void (GL_APIENTRYP PFNGLUNIFORM1FCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLfloat v0);
typedef void (GL_APIENTRYP PFNGLUNIFORM1FVCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLsizei count, const GLfloat *value);
typedef void (GL_APIENTRYP PFNGLUNIFORM1ICONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLint v0);
typedef void (GL_APIENTRYP PFNGLUNIFORM1IVCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLsizei count, const GLint *value);
typedef void (GL_APIENTRYP PFNGLUNIFORM2FCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLfloat v0, GLfloat v1);
typedef void (GL_APIENTRYP PFNGLUNIFORM2FVCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLsizei count, const GLfloat *value);
typedef void (GL_APIENTRYP PFNGLUNIFORM2ICONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLint v0, GLint v1);
typedef void (GL_APIENTRYP PFNGLUNIFORM2IVCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLsizei count, const GLint *value);
typedef void (GL_APIENTRYP PFNGLUNIFORM3FCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
typedef void (GL_APIENTRYP PFNGLUNIFORM3FVCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLsizei count, const GLfloat *value);
typedef void (GL_APIENTRYP PFNGLUNIFORM3ICONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLint v0, GLint v1, GLint v2);
typedef void (GL_APIENTRYP PFNGLUNIFORM3IVCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLsizei count, const GLint *value);
typedef void (GL_APIENTRYP PFNGLUNIFORM4FCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
typedef void (GL_APIENTRYP PFNGLUNIFORM4FVCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLsizei count, const GLfloat *value);
typedef void (GL_APIENTRYP PFNGLUNIFORM4ICONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
typedef void (GL_APIENTRYP PFNGLUNIFORM4IVCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLsizei count, const GLint *value);
typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2FVCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3FVCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4FVCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
typedef void (GL_APIENTRYP PFNGLUSEPROGRAMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program);
typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program);
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB1FCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLfloat x);
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB1FVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, const GLfloat *v);
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB2FCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLfloat x, GLfloat y);
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB2FVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, const GLfloat *v);
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB3FCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLfloat x, GLfloat y, GLfloat z);
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB3FVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, const GLfloat *v);
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB4FCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB4FVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, const GLfloat *v);
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBPOINTERCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
typedef void (GL_APIENTRYP PFNGLVIEWPORTCONTEXTANGLEPROC)(GLeglContext ctx, GLint x, GLint y, GLsizei width, GLsizei height);
typedef void (GL_APIENTRYP PFNGLBEGINQUERYEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLuint id);
typedef void (GL_APIENTRYP PFNGLBINDFRAGDATALOCATIONEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLuint color, const GLchar *name);
typedef void (GL_APIENTRYP PFNGLBINDFRAGDATALOCATIONINDEXEDEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESCONTEXTANGLEPROC)(GLeglContext ctx, GLuint array);
typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECALLBACKKHRCONTEXTANGLEPROC)(GLeglContext ctx, GLDEBUGPROCKHR callback, const void *userParam);
typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECONTROLKHRCONTEXTANGLEPROC)(GLeglContext ctx, GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGEINSERTKHRCONTEXTANGLEPROC)(GLeglContext ctx, GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, const GLuint *fences);
typedef void (GL_APIENTRYP PFNGLDELETEQUERIESEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, const GLuint *ids);
typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, const GLuint *arrays);
typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei numAttachments, const GLenum *attachments);
typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode, GLint first, GLsizei count, GLsizei primcount);
typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode, GLint start, GLsizei count, GLsizei primcount);
typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, const GLenum *bufs);
typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLeglImageOES image);
typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLeglImageOES image);
typedef void (GL_APIENTRYP PFNGLENDQUERYEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target);
typedef void (GL_APIENTRYP PFNGLFINISHFENCENVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint fence);
typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLintptr offset, GLsizeiptr length);
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum attachment, GLuint texture, GLint level);
typedef void (GL_APIENTRYP PFNGLGENFENCESNVCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, GLuint *fences);
typedef void (GL_APIENTRYP PFNGLGENQUERIESEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, GLuint *ids);
typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, GLuint *arrays);
typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, void **params);
typedef GLuint (GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGKHRCONTEXTANGLEPROC)(GLeglContext ctx, GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint fence, GLenum pname, GLint *params);
typedef GLint (GL_APIENTRYP PFNGLGETFRAGDATAINDEXEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, const GLchar *name);
typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTCONTEXTANGLEPROC)(GLeglContext ctx);
typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELKHRCONTEXTANGLEPROC)(GLeglContext ctx, GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
typedef void (GL_APIENTRYP PFNGLGETOBJECTPTRLABELKHRCONTEXTANGLEPROC)(GLeglContext ctx, const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
typedef void (GL_APIENTRYP PFNGLGETPOINTERVKHRCONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, void **params);
typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
typedef GLint (GL_APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLenum programInterface, const GLchar *name);
typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTI64VEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint id, GLenum pname, GLint64 *params);
typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTIVEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint id, GLenum pname, GLint *params);
typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint id, GLenum pname, GLuint64 *params);
typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint id, GLenum pname, GLuint *params);
typedef void (GL_APIENTRYP PFNGLGETQUERYIVEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLint *params);
typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIIVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, GLint *params);
typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, GLuint *params);
typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIIVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLint *params);
typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIUIVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLuint *params);
typedef void (GL_APIENTRYP PFNGLGETTRANSLATEDSHADERSOURCEANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source);
typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLint *params);
typedef void (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei length, const GLchar *marker);
typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint fence);
typedef GLboolean (GL_APIENTRYP PFNGLISQUERYEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint id);
typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESCONTEXTANGLEPROC)(GLeglContext ctx, GLuint array);
typedef void *(GL_APIENTRYP PFNGLMAPBUFFEROESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum access);
typedef void *(GL_APIENTRYP PFNGLMAPBUFFERRANGEEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
typedef void (GL_APIENTRYP PFNGLMAXSHADERCOMPILERTHREADSKHRCONTEXTANGLEPROC)(GLeglContext ctx, GLuint count);
typedef void (GL_APIENTRYP PFNGLOBJECTLABELKHRCONTEXTANGLEPROC)(GLeglContext ctx, GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
typedef void (GL_APIENTRYP PFNGLOBJECTPTRLABELKHRCONTEXTANGLEPROC)(GLeglContext ctx, const void *ptr, GLsizei length, const GLchar *label);
typedef void (GL_APIENTRYP PFNGLPOPDEBUGGROUPKHRCONTEXTANGLEPROC)(GLeglContext ctx);
typedef void (GL_APIENTRYP PFNGLPOPGROUPMARKEREXTCONTEXTANGLEPROC)(GLeglContext ctx);
typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLenum binaryFormat, const void *binary, GLint length);
typedef void (GL_APIENTRYP PFNGLPUSHDEBUGGROUPKHRCONTEXTANGLEPROC)(GLeglContext ctx, GLenum source, GLuint id, GLsizei length, const GLchar *message);
typedef void (GL_APIENTRYP PFNGLPUSHGROUPMARKEREXTCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei length, const GLchar *marker);
typedef void (GL_APIENTRYP PFNGLQUERYCOUNTEREXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint id, GLenum target);
typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIIVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, const GLint *param);
typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIUIVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, const GLuint *param);
typedef void (GL_APIENTRYP PFNGLSETFENCENVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint fence, GLenum condition);
typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint fence);
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIIVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, const GLint *params);
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIUIVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, const GLuint *params);
typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target);
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLuint divisor);
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISOREXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLuint divisor);
typedef void (GL_APIENTRYP PFNGLBINDUNIFORMLOCATIONCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, const GLchar* name);
typedef void (GL_APIENTRYP PFNGLCOVERAGEMODULATIONCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLenum components);
typedef void (GL_APIENTRYP PFNGLMATRIXLOADFCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLenum matrixMode, const GLfloat * matrix);
typedef void (GL_APIENTRYP PFNGLMATRIXLOADIDENTITYCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLenum matrixMode);
typedef GLuint (GL_APIENTRYP PFNGLGENPATHSCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei range);
typedef void (GL_APIENTRYP PFNGLDELETEPATHSCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint first, GLsizei range);
typedef GLboolean (GL_APIENTRYP PFNGLISPATHCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint path);
typedef void (GL_APIENTRYP PFNGLPATHCOMMANDSCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint path, GLsizei numCommands, const GLubyte * commands, GLsizei numCoords, GLenum coordType, const void* coords);
typedef void (GL_APIENTRYP PFNGLPATHPARAMETERFCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint path, GLenum pname, GLfloat value);
typedef void (GL_APIENTRYP PFNGLPATHPARAMETERICHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint path, GLenum pname, GLint value);
typedef void (GL_APIENTRYP PFNGLGETPATHPARAMETERFVCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint path, GLenum pname, GLfloat * value);
typedef void (GL_APIENTRYP PFNGLGETPATHPARAMETERIVCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint path, GLenum pname, GLint * value);
typedef void (GL_APIENTRYP PFNGLPATHSTENCILFUNCCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLenum func, GLint ref, GLuint mask);
typedef void (GL_APIENTRYP PFNGLSTENCILFILLPATHCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint path, GLenum fillMode, GLuint mask);
typedef void (GL_APIENTRYP PFNGLSTENCILSTROKEPATHCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint path, GLint reference, GLuint mask);
typedef void (GL_APIENTRYP PFNGLCOVERFILLPATHCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint path, GLenum coverMode);
typedef void (GL_APIENTRYP PFNGLCOVERSTROKEPATHCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint path, GLenum coverMode);
typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode);
typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint path, GLint reference, GLuint mask, GLenum coverMode);
typedef void (GL_APIENTRYP PFNGLCOVERFILLPATHINSTANCEDCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei numPath, GLenum pathNameType, const void * paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat * transformValues);
typedef void (GL_APIENTRYP PFNGLCOVERSTROKEPATHINSTANCEDCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei numPath, GLenum pathNameType, const void * paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat * transformValues);
typedef void (GL_APIENTRYP PFNGLSTENCILSTROKEPATHINSTANCEDCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei numPath, GLenum pathNameType, const void * paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat * transformValues);
typedef void (GL_APIENTRYP PFNGLSTENCILFILLPATHINSTANCEDCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei numPaths, GLenum pathNameType, const void * paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat * transformValues);
typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei numPaths, GLenum pathNameType, const void * paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat * transformValues);
typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei numPaths, GLenum pathNameType, const void * paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat * transformValues);
typedef void (GL_APIENTRYP PFNGLBINDFRAGMENTINPUTLOCATIONCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint programs, GLint location, const GLchar * name);
typedef void (GL_APIENTRYP PFNGLPROGRAMPATHFRAGMENTINPUTGENCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat * coeffs);
typedef void (GL_APIENTRYP PFNGLCOPYTEXTURECHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint sourceId, GLint sourceLevel, GLenum destTarget, GLuint destId, GLint destLevel, GLint internalFormat, GLenum destType, GLboolean unpackFlipY, GLboolean unpackPremultiplyAlpha, GLboolean unpackUnmultiplyAlpha);
typedef void (GL_APIENTRYP PFNGLCOPYSUBTEXTURECHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint sourceId, GLint sourceLevel, GLenum destTarget, GLuint destId, GLint destLevel, GLint xoffset, GLint yoffset, GLint x, GLint y, GLint width, GLint height, GLboolean unpackFlipY, GLboolean unpackPremultiplyAlpha, GLboolean unpackUnmultiplyAlpha);
typedef void (GL_APIENTRYP PFNGLCOMPRESSEDCOPYTEXTURECHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint sourceId, GLuint destId);
typedef void (GL_APIENTRYP PFNGLREQUESTEXTENSIONANGLECONTEXTANGLEPROC)(GLeglContext ctx, const GLchar * name);
typedef void (GL_APIENTRYP PFNGLGETBOOLEANVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLsizei bufSize, GLsizei * length, GLboolean * params);
typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
typedef void (GL_APIENTRYP PFNGLGETFLOATVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLsizei bufSize, GLsizei * length, GLfloat * params);
typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum attachment, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
typedef void (GL_APIENTRYP PFNGLGETINTEGERVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * data);
typedef void (GL_APIENTRYP PFNGLGETPROGRAMIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
typedef void (GL_APIENTRYP PFNGLGETSHADERIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint shader, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERFVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, GLfloat * params);
typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
typedef void (GL_APIENTRYP PFNGLGETUNIFORMFVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLsizei * length, GLfloat * params);
typedef void (GL_APIENTRYP PFNGLGETUNIFORMIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLsizei * length, GLint * params);
typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBFVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLenum pname, GLsizei bufSize, GLsizei * length, GLfloat * params);
typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLenum pname, GLsizei bufSize, GLsizei * length, void ** pointer);
typedef void (GL_APIENTRYP PFNGLREADPIXELSROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLsizei * length, GLsizei * columns, GLsizei * rows, void * pixels);
typedef void (GL_APIENTRYP PFNGLTEXIMAGE2DROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLsizei bufSize, const void * pixels);
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, const GLfloat * params);
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, const GLint * params);
typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE2DROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, const void * pixels);
typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLsizei bufSize, const void * pixels);
typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, const void * pixels);
typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, GLsizei dataSize, const GLvoid * data);
typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLsizei xoffset, GLsizei yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, GLsizei dataSize, const GLvoid * data);
typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, GLsizei dataSize, const GLvoid * data);
typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, GLsizei dataSize, const GLvoid * data);
typedef void (GL_APIENTRYP PFNGLGETQUERYIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint id, GLenum pname, GLsizei bufSize, GLsizei * length, GLuint * params);
typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, void ** params);
typedef void (GL_APIENTRYP PFNGLGETINTEGERI_VROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLuint index, GLsizei bufSize, GLsizei * length, GLint * data);
typedef void (GL_APIENTRYP PFNGLGETINTERNALFORMATIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIUIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLenum pname, GLsizei bufSize, GLsizei * length, GLuint * params);
typedef void (GL_APIENTRYP PFNGLGETUNIFORMUIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLsizei * length, GLuint * params);
typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLuint uniformBlockIndex, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
typedef void (GL_APIENTRYP PFNGLGETINTEGER64VROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLsizei bufSize, GLsizei * length, GLint64 * data);
typedef void (GL_APIENTRYP PFNGLGETINTEGER64I_VROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLuint index, GLsizei bufSize, GLsizei * length, GLint64 * data);
typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERI64VROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, GLint64 * params);
typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLuint pname, GLsizei bufSize, const GLint * param);
typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERFVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, GLsizei bufSize, const GLfloat * param);
typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERFVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei * length, GLfloat * params);
typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
typedef void (GL_APIENTRYP PFNGLGETPROGRAMINTERFACEIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLenum programInterface, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
typedef void (GL_APIENTRYP PFNGLGETBOOLEANI_VROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLuint index, GLsizei bufSize, GLsizei * length, GLboolean * data);
typedef void (GL_APIENTRYP PFNGLGETMULTISAMPLEFVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLuint index, GLsizei bufSize, GLsizei * length, GLfloat * val);
typedef void (GL_APIENTRYP PFNGLGETTEXLEVELPARAMETERIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
typedef void (GL_APIENTRYP PFNGLGETTEXLEVELPARAMETERFVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLenum pname, GLsizei bufSize, GLsizei * length, GLfloat * params);
typedef void (GL_APIENTRYP PFNGLGETPOINTERVROBUSTANGLEROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLsizei bufSize, GLsizei * length, void ** params);
typedef void (GL_APIENTRYP PFNGLREADNPIXELSROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLsizei * length, GLsizei * columns, GLsizei * rows, void * data);
typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLsizei * length, GLfloat * params);
typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLsizei * length, GLint * params);
typedef void (GL_APIENTRYP PFNGLGETNUNIFORMUIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLsizei * length, GLuint * params);
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, const GLint * params);
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIUIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, const GLuint * params);
typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIUIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, GLuint * params);
typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, GLsizei bufSize, const GLint * param);
typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIUIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, GLsizei bufSize, const GLuint * param);
typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei * length, GLuint * params);
typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint id, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTI64VROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint id, GLenum pname, GLsizei bufSize, GLsizei * length, GLint64 * params);
typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUI64VROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint id, GLenum pname, GLsizei bufSize, GLsizei * length, GLuint64 * params);
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREMULTIVIEWLAYEREDANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews);
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREMULTIVIEWSIDEBYSIDEANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum attachment, GLuint texture, GLint level, GLsizei numViews, const GLint * viewportOffsets);
typedef void (GL_APIENTRYP PFNGLCOPYTEXTURE3DANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint sourceId, GLint sourceLevel, GLenum destTarget, GLuint destId, GLint destLevel, GLint internalFormat, GLenum destType, GLboolean unpackFlipY, GLboolean unpackPremultiplyAlpha, GLboolean unpackUnmultiplyAlpha);
typedef void (GL_APIENTRYP PFNGLCOPYSUBTEXTURE3DANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint sourceId, GLint sourceLevel, GLenum destTarget, GLuint destId, GLint destLevel, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLint z, GLint width, GLint height, GLint depth, GLboolean unpackFlipY, GLboolean unpackPremultiplyAlpha, GLboolean unpackUnmultiplyAlpha);
typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DMULTISAMPLEANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
typedef void (GL_APIENTRYP PFNGLGETTEXLEVELPARAMETERIVANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLenum pname, GLint * params);
typedef void (GL_APIENTRYP PFNGLGETTEXLEVELPARAMETERFVANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLenum pname, GLfloat * params);
typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode, const GLint *firsts, const GLsizei *counts, GLsizei drawcount);
typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSINSTANCEDANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode, const GLint *firsts, const GLsizei *counts, const GLsizei *instanceCounts, GLsizei drawcount);
typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode, const GLsizei *counts, GLenum type, const GLvoid *const*indices, GLsizei drawcount);
typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSINSTANCEDANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode, const GLsizei *counts, GLenum type, const GLvoid *const*indices, const GLsizei*instanceCounts, GLsizei drawcount);
typedef void (GL_APIENTRYP PFNGLGETMULTISAMPLEFVANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLuint index, GLfloat * val);
typedef void (GL_APIENTRYP PFNGLSAMPLEMASKIANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint maskNumber, GLbitfield mask);
typedef void (GL_APIENTRYP PFNGLPROVOKINGVERTEXANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode);
#ifdef GL_GLEXT_PROTOTYPES
GL_APICALL void GL_APIENTRY glActiveTextureContextANGLE(GLeglContext ctx, GLenum texture);
GL_APICALL void GL_APIENTRY glAttachShaderContextANGLE(GLeglContext ctx, GLuint program, GLuint shader);
GL_APICALL void GL_APIENTRY glBindAttribLocationContextANGLE(GLeglContext ctx, GLuint program, GLuint index, const GLchar *name);
GL_APICALL void GL_APIENTRY glBindBufferContextANGLE(GLeglContext ctx, GLenum target, GLuint buffer);
GL_APICALL void GL_APIENTRY glBindFramebufferContextANGLE(GLeglContext ctx, GLenum target, GLuint framebuffer);
GL_APICALL void GL_APIENTRY glBindRenderbufferContextANGLE(GLeglContext ctx, GLenum target, GLuint renderbuffer);
GL_APICALL void GL_APIENTRY glBindTextureContextANGLE(GLeglContext ctx, GLenum target, GLuint texture);
GL_APICALL void GL_APIENTRY glBlendColorContextANGLE(GLeglContext ctx, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
GL_APICALL void GL_APIENTRY glBlendEquationContextANGLE(GLeglContext ctx, GLenum mode);
GL_APICALL void GL_APIENTRY glBlendEquationSeparateContextANGLE(GLeglContext ctx, GLenum modeRGB, GLenum modeAlpha);
GL_APICALL void GL_APIENTRY glBlendFuncContextANGLE(GLeglContext ctx, GLenum sfactor, GLenum dfactor);
GL_APICALL void GL_APIENTRY glBlendFuncSeparateContextANGLE(GLeglContext ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
GL_APICALL void GL_APIENTRY glBufferDataContextANGLE(GLeglContext ctx, GLenum target, GLsizeiptr size, const void *data, GLenum usage);
GL_APICALL void GL_APIENTRY glBufferSubDataContextANGLE(GLeglContext ctx, GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatusContextANGLE(GLeglContext ctx, GLenum target);
GL_APICALL void GL_APIENTRY glClearContextANGLE(GLeglContext ctx, GLbitfield mask);
GL_APICALL void GL_APIENTRY glClearColorContextANGLE(GLeglContext ctx, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
GL_APICALL void GL_APIENTRY glClearDepthfContextANGLE(GLeglContext ctx, GLfloat d);
GL_APICALL void GL_APIENTRY glClearStencilContextANGLE(GLeglContext ctx, GLint s);
GL_APICALL void GL_APIENTRY glColorMaskContextANGLE(GLeglContext ctx, GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
GL_APICALL void GL_APIENTRY glCompileShaderContextANGLE(GLeglContext ctx, GLuint shader);
GL_APICALL void GL_APIENTRY glCompressedTexImage2DContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
GL_APICALL void GL_APIENTRY glCompressedTexSubImage2DContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
GL_APICALL void GL_APIENTRY glCopyTexImage2DContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
GL_APICALL void GL_APIENTRY glCopyTexSubImage2DContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
GL_APICALL GLuint GL_APIENTRY glCreateProgramContextANGLE(GLeglContext ctx);
GL_APICALL GLuint GL_APIENTRY glCreateShaderContextANGLE(GLeglContext ctx, GLenum type);
GL_APICALL void GL_APIENTRY glCullFaceContextANGLE(GLeglContext ctx, GLenum mode);
GL_APICALL void GL_APIENTRY glDeleteBuffersContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *buffers);
GL_APICALL void GL_APIENTRY glDeleteFramebuffersContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *framebuffers);
GL_APICALL void GL_APIENTRY glDeleteProgramContextANGLE(GLeglContext ctx, GLuint program);
GL_APICALL void GL_APIENTRY glDeleteRenderbuffersContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *renderbuffers);
GL_APICALL void GL_APIENTRY glDeleteShaderContextANGLE(GLeglContext ctx, GLuint shader);
GL_APICALL void GL_APIENTRY glDeleteTexturesContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *textures);
GL_APICALL void GL_APIENTRY glDepthFuncContextANGLE(GLeglContext ctx, GLenum func);
GL_APICALL void GL_APIENTRY glDepthMaskContextANGLE(GLeglContext ctx, GLboolean flag);
GL_APICALL void GL_APIENTRY glDepthRangefContextANGLE(GLeglContext ctx, GLfloat n, GLfloat f);
GL_APICALL void GL_APIENTRY glDetachShaderContextANGLE(GLeglContext ctx, GLuint program, GLuint shader);
GL_APICALL void GL_APIENTRY glDisableContextANGLE(GLeglContext ctx, GLenum cap);
GL_APICALL void GL_APIENTRY glDisableVertexAttribArrayContextANGLE(GLeglContext ctx, GLuint index);
GL_APICALL void GL_APIENTRY glDrawArraysContextANGLE(GLeglContext ctx, GLenum mode, GLint first, GLsizei count);
GL_APICALL void GL_APIENTRY glDrawElementsContextANGLE(GLeglContext ctx, GLenum mode, GLsizei count, GLenum type, const void *indices);
GL_APICALL void GL_APIENTRY glEnableContextANGLE(GLeglContext ctx, GLenum cap);
GL_APICALL void GL_APIENTRY glEnableVertexAttribArrayContextANGLE(GLeglContext ctx, GLuint index);
GL_APICALL void GL_APIENTRY glFinishContextANGLE(GLeglContext ctx);
GL_APICALL void GL_APIENTRY glFlushContextANGLE(GLeglContext ctx);
GL_APICALL void GL_APIENTRY glFramebufferRenderbufferContextANGLE(GLeglContext ctx, GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
GL_APICALL void GL_APIENTRY glFramebufferTexture2DContextANGLE(GLeglContext ctx, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
GL_APICALL void GL_APIENTRY glFrontFaceContextANGLE(GLeglContext ctx, GLenum mode);
GL_APICALL void GL_APIENTRY glGenBuffersContextANGLE(GLeglContext ctx, GLsizei n, GLuint *buffers);
GL_APICALL void GL_APIENTRY glGenFramebuffersContextANGLE(GLeglContext ctx, GLsizei n, GLuint *framebuffers);
GL_APICALL void GL_APIENTRY glGenRenderbuffersContextANGLE(GLeglContext ctx, GLsizei n, GLuint *renderbuffers);
GL_APICALL void GL_APIENTRY glGenTexturesContextANGLE(GLeglContext ctx, GLsizei n, GLuint *textures);
GL_APICALL void GL_APIENTRY glGenerateMipmapContextANGLE(GLeglContext ctx, GLenum target);
GL_APICALL void GL_APIENTRY glGetActiveAttribContextANGLE(GLeglContext ctx, GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
GL_APICALL void GL_APIENTRY glGetActiveUniformContextANGLE(GLeglContext ctx, GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
GL_APICALL void GL_APIENTRY glGetAttachedShadersContextANGLE(GLeglContext ctx, GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
GL_APICALL GLint GL_APIENTRY glGetAttribLocationContextANGLE(GLeglContext ctx, GLuint program, const GLchar *name);
GL_APICALL void GL_APIENTRY glGetBooleanvContextANGLE(GLeglContext ctx, GLenum pname, GLboolean *data);
GL_APICALL void GL_APIENTRY glGetBufferParameterivContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLint *params);
GL_APICALL GLenum GL_APIENTRY glGetErrorContextANGLE(GLeglContext ctx);
GL_APICALL void GL_APIENTRY glGetFloatvContextANGLE(GLeglContext ctx, GLenum pname, GLfloat *data);
GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameterivContextANGLE(GLeglContext ctx, GLenum target, GLenum attachment, GLenum pname, GLint *params);
GL_APICALL void GL_APIENTRY glGetIntegervContextANGLE(GLeglContext ctx, GLenum pname, GLint *data);
GL_APICALL void GL_APIENTRY glGetProgramInfoLogContextANGLE(GLeglContext ctx, GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
GL_APICALL void GL_APIENTRY glGetProgramivContextANGLE(GLeglContext ctx, GLuint program, GLenum pname, GLint *params);
GL_APICALL void GL_APIENTRY glGetRenderbufferParameterivContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLint *params);
GL_APICALL void GL_APIENTRY glGetShaderInfoLogContextANGLE(GLeglContext ctx, GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormatContextANGLE(GLeglContext ctx, GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
GL_APICALL void GL_APIENTRY glGetShaderSourceContextANGLE(GLeglContext ctx, GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
GL_APICALL void GL_APIENTRY glGetShaderivContextANGLE(GLeglContext ctx, GLuint shader, GLenum pname, GLint *params);
GL_APICALL const GLubyte *GL_APIENTRY glGetStringContextANGLE(GLeglContext ctx, GLenum name);
GL_APICALL void GL_APIENTRY glGetTexParameterfvContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLfloat *params);
GL_APICALL void GL_APIENTRY glGetTexParameterivContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLint *params);
GL_APICALL GLint GL_APIENTRY glGetUniformLocationContextANGLE(GLeglContext ctx, GLuint program, const GLchar *name);
GL_APICALL void GL_APIENTRY glGetUniformfvContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLfloat *params);
GL_APICALL void GL_APIENTRY glGetUniformivContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLint *params);
GL_APICALL void GL_APIENTRY glGetVertexAttribPointervContextANGLE(GLeglContext ctx, GLuint index, GLenum pname, void **pointer);
GL_APICALL void GL_APIENTRY glGetVertexAttribfvContextANGLE(GLeglContext ctx, GLuint index, GLenum pname, GLfloat *params);
GL_APICALL void GL_APIENTRY glGetVertexAttribivContextANGLE(GLeglContext ctx, GLuint index, GLenum pname, GLint *params);
GL_APICALL void GL_APIENTRY glHintContextANGLE(GLeglContext ctx, GLenum target, GLenum mode);
GL_APICALL GLboolean GL_APIENTRY glIsBufferContextANGLE(GLeglContext ctx, GLuint buffer);
GL_APICALL GLboolean GL_APIENTRY glIsEnabledContextANGLE(GLeglContext ctx, GLenum cap);
GL_APICALL GLboolean GL_APIENTRY glIsFramebufferContextANGLE(GLeglContext ctx, GLuint framebuffer);
GL_APICALL GLboolean GL_APIENTRY glIsProgramContextANGLE(GLeglContext ctx, GLuint program);
GL_APICALL GLboolean GL_APIENTRY glIsRenderbufferContextANGLE(GLeglContext ctx, GLuint renderbuffer);
GL_APICALL GLboolean GL_APIENTRY glIsShaderContextANGLE(GLeglContext ctx, GLuint shader);
GL_APICALL GLboolean GL_APIENTRY glIsTextureContextANGLE(GLeglContext ctx, GLuint texture);
GL_APICALL void GL_APIENTRY glLineWidthContextANGLE(GLeglContext ctx, GLfloat width);
GL_APICALL void GL_APIENTRY glLinkProgramContextANGLE(GLeglContext ctx, GLuint program);
GL_APICALL void GL_APIENTRY glPixelStoreiContextANGLE(GLeglContext ctx, GLenum pname, GLint param);
GL_APICALL void GL_APIENTRY glPolygonOffsetContextANGLE(GLeglContext ctx, GLfloat factor, GLfloat units);
GL_APICALL void GL_APIENTRY glReadPixelsContextANGLE(GLeglContext ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
GL_APICALL void GL_APIENTRY glReleaseShaderCompilerContextANGLE(GLeglContext ctx);
GL_APICALL void GL_APIENTRY glRenderbufferStorageContextANGLE(GLeglContext ctx, GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
GL_APICALL void GL_APIENTRY glSampleCoverageContextANGLE(GLeglContext ctx, GLfloat value, GLboolean invert);
GL_APICALL void GL_APIENTRY glScissorContextANGLE(GLeglContext ctx, GLint x, GLint y, GLsizei width, GLsizei height);
GL_APICALL void GL_APIENTRY glShaderBinaryContextANGLE(GLeglContext ctx, GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
GL_APICALL void GL_APIENTRY glShaderSourceContextANGLE(GLeglContext ctx, GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
GL_APICALL void GL_APIENTRY glStencilFuncContextANGLE(GLeglContext ctx, GLenum func, GLint ref, GLuint mask);
GL_APICALL void GL_APIENTRY glStencilFuncSeparateContextANGLE(GLeglContext ctx, GLenum face, GLenum func, GLint ref, GLuint mask);
GL_APICALL void GL_APIENTRY glStencilMaskContextANGLE(GLeglContext ctx, GLuint mask);
GL_APICALL void GL_APIENTRY glStencilMaskSeparateContextANGLE(GLeglContext ctx, GLenum face, GLuint mask);
GL_APICALL void GL_APIENTRY glStencilOpContextANGLE(GLeglContext ctx, GLenum fail, GLenum zfail, GLenum zpass);
GL_APICALL void GL_APIENTRY glStencilOpSeparateContextANGLE(GLeglContext ctx, GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
GL_APICALL void GL_APIENTRY glTexImage2DContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
GL_APICALL void GL_APIENTRY glTexParameterfContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLfloat param);
GL_APICALL void GL_APIENTRY glTexParameterfvContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, const GLfloat *params);
GL_APICALL void GL_APIENTRY glTexParameteriContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLint param);
GL_APICALL void GL_APIENTRY glTexParameterivContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, const GLint *params);
GL_APICALL void GL_APIENTRY glTexSubImage2DContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
GL_APICALL void GL_APIENTRY glUniform1fContextANGLE(GLeglContext ctx, GLint location, GLfloat v0);
GL_APICALL void GL_APIENTRY glUniform1fvContextANGLE(GLeglContext ctx, GLint location, GLsizei count, const GLfloat *value);
GL_APICALL void GL_APIENTRY glUniform1iContextANGLE(GLeglContext ctx, GLint location, GLint v0);
GL_APICALL void GL_APIENTRY glUniform1ivContextANGLE(GLeglContext ctx, GLint location, GLsizei count, const GLint *value);
GL_APICALL void GL_APIENTRY glUniform2fContextANGLE(GLeglContext ctx, GLint location, GLfloat v0, GLfloat v1);
GL_APICALL void GL_APIENTRY glUniform2fvContextANGLE(GLeglContext ctx, GLint location, GLsizei count, const GLfloat *value);
GL_APICALL void GL_APIENTRY glUniform2iContextANGLE(GLeglContext ctx, GLint location, GLint v0, GLint v1);
GL_APICALL void GL_APIENTRY glUniform2ivContextANGLE(GLeglContext ctx, GLint location, GLsizei count, const GLint *value);
GL_APICALL void GL_APIENTRY glUniform3fContextANGLE(GLeglContext ctx, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
GL_APICALL void GL_APIENTRY glUniform3fvContextANGLE(GLeglContext ctx, GLint location, GLsizei count, const GLfloat *value);
GL_APICALL void GL_APIENTRY glUniform3iContextANGLE(GLeglContext ctx, GLint location, GLint v0, GLint v1, GLint v2);
GL_APICALL void GL_APIENTRY glUniform3ivContextANGLE(GLeglContext ctx, GLint location, GLsizei count, const GLint *value);
GL_APICALL void GL_APIENTRY glUniform4fContextANGLE(GLeglContext ctx, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
GL_APICALL void GL_APIENTRY glUniform4fvContextANGLE(GLeglContext ctx, GLint location, GLsizei count, const GLfloat *value);
GL_APICALL void GL_APIENTRY glUniform4iContextANGLE(GLeglContext ctx, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
GL_APICALL void GL_APIENTRY glUniform4ivContextANGLE(GLeglContext ctx, GLint location, GLsizei count, const GLint *value);
GL_APICALL void GL_APIENTRY glUniformMatrix2fvContextANGLE(GLeglContext ctx, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
GL_APICALL void GL_APIENTRY glUniformMatrix3fvContextANGLE(GLeglContext ctx, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
GL_APICALL void GL_APIENTRY glUniformMatrix4fvContextANGLE(GLeglContext ctx, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
GL_APICALL void GL_APIENTRY glUseProgramContextANGLE(GLeglContext ctx, GLuint program);
GL_APICALL void GL_APIENTRY glValidateProgramContextANGLE(GLeglContext ctx, GLuint program);
GL_APICALL void GL_APIENTRY glVertexAttrib1fContextANGLE(GLeglContext ctx, GLuint index, GLfloat x);
GL_APICALL void GL_APIENTRY glVertexAttrib1fvContextANGLE(GLeglContext ctx, GLuint index, const GLfloat *v);
GL_APICALL void GL_APIENTRY glVertexAttrib2fContextANGLE(GLeglContext ctx, GLuint index, GLfloat x, GLfloat y);
GL_APICALL void GL_APIENTRY glVertexAttrib2fvContextANGLE(GLeglContext ctx, GLuint index, const GLfloat *v);
GL_APICALL void GL_APIENTRY glVertexAttrib3fContextANGLE(GLeglContext ctx, GLuint index, GLfloat x, GLfloat y, GLfloat z);
GL_APICALL void GL_APIENTRY glVertexAttrib3fvContextANGLE(GLeglContext ctx, GLuint index, const GLfloat *v);
GL_APICALL void GL_APIENTRY glVertexAttrib4fContextANGLE(GLeglContext ctx, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
GL_APICALL void GL_APIENTRY glVertexAttrib4fvContextANGLE(GLeglContext ctx, GLuint index, const GLfloat *v);
GL_APICALL void GL_APIENTRY glVertexAttribPointerContextANGLE(GLeglContext ctx, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
GL_APICALL void GL_APIENTRY glViewportContextANGLE(GLeglContext ctx, GLint x, GLint y, GLsizei width, GLsizei height);
GL_APICALL void GL_APIENTRY glBeginQueryEXTContextANGLE(GLeglContext ctx, GLenum target, GLuint id);
GL_APICALL void GL_APIENTRY glBindFragDataLocationEXTContextANGLE(GLeglContext ctx, GLuint program, GLuint color, const GLchar *name);
GL_APICALL void GL_APIENTRY glBindFragDataLocationIndexedEXTContextANGLE(GLeglContext ctx, GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
GL_APICALL void GL_APIENTRY glBindVertexArrayOESContextANGLE(GLeglContext ctx, GLuint array);
GL_APICALL void GL_APIENTRY glBlitFramebufferANGLEContextANGLE(GLeglContext ctx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
GL_APICALL void GL_APIENTRY glDebugMessageCallbackKHRContextANGLE(GLeglContext ctx, GLDEBUGPROCKHR callback, const void *userParam);
GL_APICALL void GL_APIENTRY glDebugMessageControlKHRContextANGLE(GLeglContext ctx, GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
GL_APICALL void GL_APIENTRY glDebugMessageInsertKHRContextANGLE(GLeglContext ctx, GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
GL_APICALL void GL_APIENTRY glDeleteFencesNVContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *fences);
GL_APICALL void GL_APIENTRY glDeleteQueriesEXTContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *ids);
GL_APICALL void GL_APIENTRY glDeleteVertexArraysOESContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *arrays);
GL_APICALL void GL_APIENTRY glDiscardFramebufferEXTContextANGLE(GLeglContext ctx, GLenum target, GLsizei numAttachments, const GLenum *attachments);
GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLEContextANGLE(GLeglContext ctx, GLenum mode, GLint first, GLsizei count, GLsizei primcount);
GL_APICALL void GL_APIENTRY glDrawArraysInstancedEXTContextANGLE(GLeglContext ctx, GLenum mode, GLint start, GLsizei count, GLsizei primcount);
GL_APICALL void GL_APIENTRY glDrawBuffersEXTContextANGLE(GLeglContext ctx, GLsizei n, const GLenum *bufs);
GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLEContextANGLE(GLeglContext ctx, GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
GL_APICALL void GL_APIENTRY glDrawElementsInstancedEXTContextANGLE(GLeglContext ctx, GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOESContextANGLE(GLeglContext ctx, GLenum target, GLeglImageOES image);
GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOESContextANGLE(GLeglContext ctx, GLenum target, GLeglImageOES image);
GL_APICALL void GL_APIENTRY glEndQueryEXTContextANGLE(GLeglContext ctx, GLenum target);
GL_APICALL void GL_APIENTRY glFinishFenceNVContextANGLE(GLeglContext ctx, GLuint fence);
GL_APICALL void GL_APIENTRY glFlushMappedBufferRangeEXTContextANGLE(GLeglContext ctx, GLenum target, GLintptr offset, GLsizeiptr length);
GL_APICALL void GL_APIENTRY glFramebufferTextureEXTContextANGLE(GLeglContext ctx, GLenum target, GLenum attachment, GLuint texture, GLint level);
GL_APICALL void GL_APIENTRY glGenFencesNVContextANGLE(GLeglContext ctx, GLsizei n, GLuint *fences);
GL_APICALL void GL_APIENTRY glGenQueriesEXTContextANGLE(GLeglContext ctx, GLsizei n, GLuint *ids);
GL_APICALL void GL_APIENTRY glGenVertexArraysOESContextANGLE(GLeglContext ctx, GLsizei n, GLuint *arrays);
GL_APICALL void GL_APIENTRY glGetBufferPointervOESContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, void **params);
GL_APICALL GLuint GL_APIENTRY glGetDebugMessageLogKHRContextANGLE(GLeglContext ctx, GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
GL_APICALL void GL_APIENTRY glGetFenceivNVContextANGLE(GLeglContext ctx, GLuint fence, GLenum pname, GLint *params);
GL_APICALL GLint GL_APIENTRY glGetFragDataIndexEXTContextANGLE(GLeglContext ctx, GLuint program, const GLchar *name);
GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusEXTContextANGLE(GLeglContext ctx);
GL_APICALL void GL_APIENTRY glGetObjectLabelKHRContextANGLE(GLeglContext ctx, GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
GL_APICALL void GL_APIENTRY glGetObjectPtrLabelKHRContextANGLE(GLeglContext ctx, const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
GL_APICALL void GL_APIENTRY glGetPointervKHRContextANGLE(GLeglContext ctx, GLenum pname, void **params);
GL_APICALL void GL_APIENTRY glGetProgramBinaryOESContextANGLE(GLeglContext ctx, GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
GL_APICALL GLint GL_APIENTRY glGetProgramResourceLocationIndexEXTContextANGLE(GLeglContext ctx, GLuint program, GLenum programInterface, const GLchar *name);
GL_APICALL void GL_APIENTRY glGetQueryObjecti64vEXTContextANGLE(GLeglContext ctx, GLuint id, GLenum pname, GLint64 *params);
GL_APICALL void GL_APIENTRY glGetQueryObjectivEXTContextANGLE(GLeglContext ctx, GLuint id, GLenum pname, GLint *params);
GL_APICALL void GL_APIENTRY glGetQueryObjectui64vEXTContextANGLE(GLeglContext ctx, GLuint id, GLenum pname, GLuint64 *params);
GL_APICALL void GL_APIENTRY glGetQueryObjectuivEXTContextANGLE(GLeglContext ctx, GLuint id, GLenum pname, GLuint *params);
GL_APICALL void GL_APIENTRY glGetQueryivEXTContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLint *params);
GL_APICALL void GL_APIENTRY glGetSamplerParameterIivOESContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, GLint *params);
GL_APICALL void GL_APIENTRY glGetSamplerParameterIuivOESContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, GLuint *params);
GL_APICALL void GL_APIENTRY glGetTexParameterIivOESContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLint *params);
GL_APICALL void GL_APIENTRY glGetTexParameterIuivOESContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLuint *params);
GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLEContextANGLE(GLeglContext ctx, GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source);
GL_APICALL void GL_APIENTRY glGetnUniformfvEXTContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
GL_APICALL void GL_APIENTRY glGetnUniformivEXTContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLint *params);
GL_APICALL void GL_APIENTRY glInsertEventMarkerEXTContextANGLE(GLeglContext ctx, GLsizei length, const GLchar *marker);
GL_APICALL GLboolean GL_APIENTRY glIsFenceNVContextANGLE(GLeglContext ctx, GLuint fence);
GL_APICALL GLboolean GL_APIENTRY glIsQueryEXTContextANGLE(GLeglContext ctx, GLuint id);
GL_APICALL GLboolean GL_APIENTRY glIsVertexArrayOESContextANGLE(GLeglContext ctx, GLuint array);
GL_APICALL void *GL_APIENTRY glMapBufferOESContextANGLE(GLeglContext ctx, GLenum target, GLenum access);
GL_APICALL void *GL_APIENTRY glMapBufferRangeEXTContextANGLE(GLeglContext ctx, GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
GL_APICALL void GL_APIENTRY glMaxShaderCompilerThreadsKHRContextANGLE(GLeglContext ctx, GLuint count);
GL_APICALL void GL_APIENTRY glObjectLabelKHRContextANGLE(GLeglContext ctx, GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
GL_APICALL void GL_APIENTRY glObjectPtrLabelKHRContextANGLE(GLeglContext ctx, const void *ptr, GLsizei length, const GLchar *label);
GL_APICALL void GL_APIENTRY glPopDebugGroupKHRContextANGLE(GLeglContext ctx);
GL_APICALL void GL_APIENTRY glPopGroupMarkerEXTContextANGLE(GLeglContext ctx);
GL_APICALL void GL_APIENTRY glProgramBinaryOESContextANGLE(GLeglContext ctx, GLuint program, GLenum binaryFormat, const void *binary, GLint length);
GL_APICALL void GL_APIENTRY glPushDebugGroupKHRContextANGLE(GLeglContext ctx, GLenum source, GLuint id, GLsizei length, const GLchar *message);
GL_APICALL void GL_APIENTRY glPushGroupMarkerEXTContextANGLE(GLeglContext ctx, GLsizei length, const GLchar *marker);
GL_APICALL void GL_APIENTRY glQueryCounterEXTContextANGLE(GLeglContext ctx, GLuint id, GLenum target);
GL_APICALL void GL_APIENTRY glReadnPixelsEXTContextANGLE(GLeglContext ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleANGLEContextANGLE(GLeglContext ctx, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
GL_APICALL void GL_APIENTRY glSamplerParameterIivOESContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, const GLint *param);
GL_APICALL void GL_APIENTRY glSamplerParameterIuivOESContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, const GLuint *param);
GL_APICALL void GL_APIENTRY glSetFenceNVContextANGLE(GLeglContext ctx, GLuint fence, GLenum condition);
GL_APICALL GLboolean GL_APIENTRY glTestFenceNVContextANGLE(GLeglContext ctx, GLuint fence);
GL_APICALL void GL_APIENTRY glTexParameterIivOESContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, const GLint *params);
GL_APICALL void GL_APIENTRY glTexParameterIuivOESContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, const GLuint *params);
GL_APICALL void GL_APIENTRY glTexStorage1DEXTContextANGLE(GLeglContext ctx, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
GL_APICALL void GL_APIENTRY glTexStorage2DEXTContextANGLE(GLeglContext ctx, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
GL_APICALL void GL_APIENTRY glTexStorage3DEXTContextANGLE(GLeglContext ctx, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
GL_APICALL void GL_APIENTRY glTexStorage3DMultisampleOESContextANGLE(GLeglContext ctx, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
GL_APICALL GLboolean GL_APIENTRY glUnmapBufferOESContextANGLE(GLeglContext ctx, GLenum target);
GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLEContextANGLE(GLeglContext ctx, GLuint index, GLuint divisor);
GL_APICALL void GL_APIENTRY glVertexAttribDivisorEXTContextANGLE(GLeglContext ctx, GLuint index, GLuint divisor);
GL_APICALL void GL_APIENTRY glBindUniformLocationCHROMIUMContextANGLE(GLeglContext ctx, GLuint program, GLint location, const GLchar* name);
GL_APICALL void GL_APIENTRY glCoverageModulationCHROMIUMContextANGLE(GLeglContext ctx, GLenum components);
GL_APICALL void GL_APIENTRY glMatrixLoadfCHROMIUMContextANGLE(GLeglContext ctx, GLenum matrixMode, const GLfloat * matrix);
GL_APICALL void GL_APIENTRY glMatrixLoadIdentityCHROMIUMContextANGLE(GLeglContext ctx, GLenum matrixMode);
GL_APICALL GLuint GL_APIENTRY glGenPathsCHROMIUMContextANGLE(GLeglContext ctx, GLsizei range);
GL_APICALL void GL_APIENTRY glDeletePathsCHROMIUMContextANGLE(GLeglContext ctx, GLuint first, GLsizei range);
GL_APICALL GLboolean GL_APIENTRY glIsPathCHROMIUMContextANGLE(GLeglContext ctx, GLuint path);
GL_APICALL void GL_APIENTRY glPathCommandsCHROMIUMContextANGLE(GLeglContext ctx, GLuint path, GLsizei numCommands, const GLubyte * commands, GLsizei numCoords, GLenum coordType, const void* coords);
GL_APICALL void GL_APIENTRY glPathParameterfCHROMIUMContextANGLE(GLeglContext ctx, GLuint path, GLenum pname, GLfloat value);
GL_APICALL void GL_APIENTRY glPathParameteriCHROMIUMContextANGLE(GLeglContext ctx, GLuint path, GLenum pname, GLint value);
GL_APICALL void GL_APIENTRY glGetPathParameterfvCHROMIUMContextANGLE(GLeglContext ctx, GLuint path, GLenum pname, GLfloat * value);
GL_APICALL void GL_APIENTRY glGetPathParameterivCHROMIUMContextANGLE(GLeglContext ctx, GLuint path, GLenum pname, GLint * value);
GL_APICALL void GL_APIENTRY glPathStencilFuncCHROMIUMContextANGLE(GLeglContext ctx, GLenum func, GLint ref, GLuint mask);
GL_APICALL void GL_APIENTRY glStencilFillPathCHROMIUMContextANGLE(GLeglContext ctx, GLuint path, GLenum fillMode, GLuint mask);
GL_APICALL void GL_APIENTRY glStencilStrokePathCHROMIUMContextANGLE(GLeglContext ctx, GLuint path, GLint reference, GLuint mask);
GL_APICALL void GL_APIENTRY glCoverFillPathCHROMIUMContextANGLE(GLeglContext ctx, GLuint path, GLenum coverMode);
GL_APICALL void GL_APIENTRY glCoverStrokePathCHROMIUMContextANGLE(GLeglContext ctx, GLuint path, GLenum coverMode);
GL_APICALL void GL_APIENTRY glStencilThenCoverFillPathCHROMIUMContextANGLE(GLeglContext ctx, GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode);
GL_APICALL void GL_APIENTRY glStencilThenCoverStrokePathCHROMIUMContextANGLE(GLeglContext ctx, GLuint path, GLint reference, GLuint mask, GLenum coverMode);
GL_APICALL void GL_APIENTRY glCoverFillPathInstancedCHROMIUMContextANGLE(GLeglContext ctx, GLsizei numPath, GLenum pathNameType, const void * paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat * transformValues);
GL_APICALL void GL_APIENTRY glCoverStrokePathInstancedCHROMIUMContextANGLE(GLeglContext ctx, GLsizei numPath, GLenum pathNameType, const void * paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat * transformValues);
GL_APICALL void GL_APIENTRY glStencilStrokePathInstancedCHROMIUMContextANGLE(GLeglContext ctx, GLsizei numPath, GLenum pathNameType, const void * paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat * transformValues);
GL_APICALL void GL_APIENTRY glStencilFillPathInstancedCHROMIUMContextANGLE(GLeglContext ctx, GLsizei numPaths, GLenum pathNameType, const void * paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat * transformValues);
GL_APICALL void GL_APIENTRY glStencilThenCoverFillPathInstancedCHROMIUMContextANGLE(GLeglContext ctx, GLsizei numPaths, GLenum pathNameType, const void * paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat * transformValues);
GL_APICALL void GL_APIENTRY glStencilThenCoverStrokePathInstancedCHROMIUMContextANGLE(GLeglContext ctx, GLsizei numPaths, GLenum pathNameType, const void * paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat * transformValues);
GL_APICALL void GL_APIENTRY glBindFragmentInputLocationCHROMIUMContextANGLE(GLeglContext ctx, GLuint programs, GLint location, const GLchar * name);
GL_APICALL void GL_APIENTRY glProgramPathFragmentInputGenCHROMIUMContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat * coeffs);
GL_APICALL void GL_APIENTRY glCopyTextureCHROMIUMContextANGLE(GLeglContext ctx, GLuint sourceId, GLint sourceLevel, GLenum destTarget, GLuint destId, GLint destLevel, GLint internalFormat, GLenum destType, GLboolean unpackFlipY, GLboolean unpackPremultiplyAlpha, GLboolean unpackUnmultiplyAlpha);
GL_APICALL void GL_APIENTRY glCopySubTextureCHROMIUMContextANGLE(GLeglContext ctx, GLuint sourceId, GLint sourceLevel, GLenum destTarget, GLuint destId, GLint destLevel, GLint xoffset, GLint yoffset, GLint x, GLint y, GLint width, GLint height, GLboolean unpackFlipY, GLboolean unpackPremultiplyAlpha, GLboolean unpackUnmultiplyAlpha);
GL_APICALL void GL_APIENTRY glCompressedCopyTextureCHROMIUMContextANGLE(GLeglContext ctx, GLuint sourceId, GLuint destId);
GL_APICALL void GL_APIENTRY glRequestExtensionANGLEContextANGLE(GLeglContext ctx, const GLchar * name);
GL_APICALL void GL_APIENTRY glGetBooleanvRobustANGLEContextANGLE(GLeglContext ctx, GLenum pname, GLsizei bufSize, GLsizei * length, GLboolean * params);
GL_APICALL void GL_APIENTRY glGetBufferParameterivRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
GL_APICALL void GL_APIENTRY glGetFloatvRobustANGLEContextANGLE(GLeglContext ctx, GLenum pname, GLsizei bufSize, GLsizei * length, GLfloat * params);
GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameterivRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLenum attachment, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
GL_APICALL void GL_APIENTRY glGetIntegervRobustANGLEContextANGLE(GLeglContext ctx, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * data);
GL_APICALL void GL_APIENTRY glGetProgramivRobustANGLEContextANGLE(GLeglContext ctx, GLuint program, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
GL_APICALL void GL_APIENTRY glGetRenderbufferParameterivRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
GL_APICALL void GL_APIENTRY glGetShaderivRobustANGLEContextANGLE(GLeglContext ctx, GLuint shader, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
GL_APICALL void GL_APIENTRY glGetTexParameterfvRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, GLfloat * params);
GL_APICALL void GL_APIENTRY glGetTexParameterivRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
GL_APICALL void GL_APIENTRY glGetUniformfvRobustANGLEContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLsizei * length, GLfloat * params);
GL_APICALL void GL_APIENTRY glGetUniformivRobustANGLEContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLsizei * length, GLint * params);
GL_APICALL void GL_APIENTRY glGetVertexAttribfvRobustANGLEContextANGLE(GLeglContext ctx, GLuint index, GLenum pname, GLsizei bufSize, GLsizei * length, GLfloat * params);
GL_APICALL void GL_APIENTRY glGetVertexAttribivRobustANGLEContextANGLE(GLeglContext ctx, GLuint index, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
GL_APICALL void GL_APIENTRY glGetVertexAttribPointervRobustANGLEContextANGLE(GLeglContext ctx, GLuint index, GLenum pname, GLsizei bufSize, GLsizei * length, void ** pointer);
GL_APICALL void GL_APIENTRY glReadPixelsRobustANGLEContextANGLE(GLeglContext ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLsizei * length, GLsizei * columns, GLsizei * rows, void * pixels);
GL_APICALL void GL_APIENTRY glTexImage2DRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLsizei bufSize, const void * pixels);
GL_APICALL void GL_APIENTRY glTexParameterfvRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, const GLfloat * params);
GL_APICALL void GL_APIENTRY glTexParameterivRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, const GLint * params);
GL_APICALL void GL_APIENTRY glTexSubImage2DRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, const void * pixels);
GL_APICALL void GL_APIENTRY glTexImage3DRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLsizei bufSize, const void * pixels);
GL_APICALL void GL_APIENTRY glTexSubImage3DRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, const void * pixels);
GL_APICALL void GL_APIENTRY glCompressedTexImage2DRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, GLsizei dataSize, const GLvoid * data);
GL_APICALL void GL_APIENTRY glCompressedTexSubImage2DRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLsizei xoffset, GLsizei yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, GLsizei dataSize, const GLvoid * data);
GL_APICALL void GL_APIENTRY glCompressedTexImage3DRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, GLsizei dataSize, const GLvoid * data);
GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, GLsizei dataSize, const GLvoid * data);
GL_APICALL void GL_APIENTRY glGetQueryivRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
GL_APICALL void GL_APIENTRY glGetQueryObjectuivRobustANGLEContextANGLE(GLeglContext ctx, GLuint id, GLenum pname, GLsizei bufSize, GLsizei * length, GLuint * params);
GL_APICALL void GL_APIENTRY glGetBufferPointervRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, void ** params);
GL_APICALL void GL_APIENTRY glGetIntegeri_vRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLuint index, GLsizei bufSize, GLsizei * length, GLint * data);
GL_APICALL void GL_APIENTRY glGetInternalformativRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
GL_APICALL void GL_APIENTRY glGetVertexAttribIivRobustANGLEContextANGLE(GLeglContext ctx, GLuint index, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
GL_APICALL void GL_APIENTRY glGetVertexAttribIuivRobustANGLEContextANGLE(GLeglContext ctx, GLuint index, GLenum pname, GLsizei bufSize, GLsizei * length, GLuint * params);
GL_APICALL void GL_APIENTRY glGetUniformuivRobustANGLEContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLsizei * length, GLuint * params);
GL_APICALL void GL_APIENTRY glGetActiveUniformBlockivRobustANGLEContextANGLE(GLeglContext ctx, GLuint program, GLuint uniformBlockIndex, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
GL_APICALL void GL_APIENTRY glGetInteger64vRobustANGLEContextANGLE(GLeglContext ctx, GLenum pname, GLsizei bufSize, GLsizei * length, GLint64 * data);
GL_APICALL void GL_APIENTRY glGetInteger64i_vRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLuint index, GLsizei bufSize, GLsizei * length, GLint64 * data);
GL_APICALL void GL_APIENTRY glGetBufferParameteri64vRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, GLint64 * params);
GL_APICALL void GL_APIENTRY glSamplerParameterivRobustANGLEContextANGLE(GLeglContext ctx, GLuint sampler, GLuint pname, GLsizei bufSize, const GLint * param);
GL_APICALL void GL_APIENTRY glSamplerParameterfvRobustANGLEContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, GLsizei bufSize, const GLfloat * param);
GL_APICALL void GL_APIENTRY glGetSamplerParameterivRobustANGLEContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
GL_APICALL void GL_APIENTRY glGetSamplerParameterfvRobustANGLEContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei * length, GLfloat * params);
GL_APICALL void GL_APIENTRY glGetFramebufferParameterivRobustANGLEContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
GL_APICALL void GL_APIENTRY glGetProgramInterfaceivRobustANGLEContextANGLE(GLeglContext ctx, GLuint program, GLenum programInterface, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
GL_APICALL void GL_APIENTRY glGetBooleani_vRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLuint index, GLsizei bufSize, GLsizei * length, GLboolean * data);
GL_APICALL void GL_APIENTRY glGetMultisamplefvRobustANGLEContextANGLE(GLeglContext ctx, GLenum pname, GLuint index, GLsizei bufSize, GLsizei * length, GLfloat * val);
GL_APICALL void GL_APIENTRY glGetTexLevelParameterivRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
GL_APICALL void GL_APIENTRY glGetTexLevelParameterfvRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLenum pname, GLsizei bufSize, GLsizei * length, GLfloat * params);
GL_APICALL void GL_APIENTRY glGetPointervRobustANGLERobustANGLEContextANGLE(GLeglContext ctx, GLenum pname, GLsizei bufSize, GLsizei * length, void ** params);
GL_APICALL void GL_APIENTRY glReadnPixelsRobustANGLEContextANGLE(GLeglContext ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLsizei * length, GLsizei * columns, GLsizei * rows, void * data);
GL_APICALL void GL_APIENTRY glGetnUniformfvRobustANGLEContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLsizei * length, GLfloat * params);
GL_APICALL void GL_APIENTRY glGetnUniformivRobustANGLEContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLsizei * length, GLint * params);
GL_APICALL void GL_APIENTRY glGetnUniformuivRobustANGLEContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLsizei * length, GLuint * params);
GL_APICALL void GL_APIENTRY glTexParameterIivRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, const GLint * params);
GL_APICALL void GL_APIENTRY glTexParameterIuivRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, const GLuint * params);
GL_APICALL void GL_APIENTRY glGetTexParameterIivRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
GL_APICALL void GL_APIENTRY glGetTexParameterIuivRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, GLuint * params);
GL_APICALL void GL_APIENTRY glSamplerParameterIivRobustANGLEContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, GLsizei bufSize, const GLint * param);
GL_APICALL void GL_APIENTRY glSamplerParameterIuivRobustANGLEContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, GLsizei bufSize, const GLuint * param);
GL_APICALL void GL_APIENTRY glGetSamplerParameterIivRobustANGLEContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
GL_APICALL void GL_APIENTRY glGetSamplerParameterIuivRobustANGLEContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei * length, GLuint * params);
GL_APICALL void GL_APIENTRY glGetQueryObjectivRobustANGLEContextANGLE(GLeglContext ctx, GLuint id, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
GL_APICALL void GL_APIENTRY glGetQueryObjecti64vRobustANGLEContextANGLE(GLeglContext ctx, GLuint id, GLenum pname, GLsizei bufSize, GLsizei * length, GLint64 * params);
GL_APICALL void GL_APIENTRY glGetQueryObjectui64vRobustANGLEContextANGLE(GLeglContext ctx, GLuint id, GLenum pname, GLsizei bufSize, GLsizei * length, GLuint64 * params);
GL_APICALL void GL_APIENTRY glFramebufferTextureMultiviewLayeredANGLEContextANGLE(GLeglContext ctx, GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews);
GL_APICALL void GL_APIENTRY glFramebufferTextureMultiviewSideBySideANGLEContextANGLE(GLeglContext ctx, GLenum target, GLenum attachment, GLuint texture, GLint level, GLsizei numViews, const GLint * viewportOffsets);
GL_APICALL void GL_APIENTRY glCopyTexture3DANGLEContextANGLE(GLeglContext ctx, GLuint sourceId, GLint sourceLevel, GLenum destTarget, GLuint destId, GLint destLevel, GLint internalFormat, GLenum destType, GLboolean unpackFlipY, GLboolean unpackPremultiplyAlpha, GLboolean unpackUnmultiplyAlpha);
GL_APICALL void GL_APIENTRY glCopySubTexture3DANGLEContextANGLE(GLeglContext ctx, GLuint sourceId, GLint sourceLevel, GLenum destTarget, GLuint destId, GLint destLevel, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLint z, GLint width, GLint height, GLint depth, GLboolean unpackFlipY, GLboolean unpackPremultiplyAlpha, GLboolean unpackUnmultiplyAlpha);
GL_APICALL void GL_APIENTRY glTexStorage2DMultisampleANGLEContextANGLE(GLeglContext ctx, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
GL_APICALL void GL_APIENTRY glGetTexLevelParameterivANGLEContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLenum pname, GLint * params);
GL_APICALL void GL_APIENTRY glGetTexLevelParameterfvANGLEContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLenum pname, GLfloat * params);
GL_APICALL void GL_APIENTRY glMultiDrawArraysANGLEContextANGLE(GLeglContext ctx, GLenum mode, const GLint *firsts, const GLsizei *counts, GLsizei drawcount);
GL_APICALL void GL_APIENTRY glMultiDrawArraysInstancedANGLEContextANGLE(GLeglContext ctx, GLenum mode, const GLint *firsts, const GLsizei *counts, const GLsizei *instanceCounts, GLsizei drawcount);
GL_APICALL void GL_APIENTRY glMultiDrawElementsANGLEContextANGLE(GLeglContext ctx, GLenum mode, const GLsizei *counts, GLenum type, const GLvoid *const*indices, GLsizei drawcount);
GL_APICALL void GL_APIENTRY glMultiDrawElementsInstancedANGLEContextANGLE(GLeglContext ctx, GLenum mode, const GLsizei *counts, GLenum type, const GLvoid *const*indices, const GLsizei*instanceCounts, GLsizei drawcount);
GL_APICALL void GL_APIENTRY glGetMultisamplefvANGLEContextANGLE(GLeglContext ctx, GLenum pname, GLuint index, GLfloat * val);
GL_APICALL void GL_APIENTRY glSampleMaskiANGLEContextANGLE(GLeglContext ctx, GLuint maskNumber, GLbitfield mask);
GL_APICALL void GL_APIENTRY glProvokingVertexANGLEContextANGLE(GLeglContext ctx, GLenum mode);
#endif
| [
"ixiaomo@betofly.cn"
] | ixiaomo@betofly.cn |
6258f1834edd8b15fdec13beae63556e1c68fd02 | 5e1f5f2090013041b13d1e280f747aa9f914caa4 | /src/lib/storage/vfs/cpp/paging_test.cc | 989eee1720416a39887ede6c9c9ce1b1240addf9 | [
"BSD-2-Clause"
] | permissive | mvanotti/fuchsia-mirror | 477b7d51ae6818e456d5803eea68df35d0d0af88 | 7fb60ae374573299dcb1cc73f950b4f5f981f95c | refs/heads/main | 2022-11-29T08:52:01.817638 | 2021-10-06T05:37:42 | 2021-10-06T05:37:42 | 224,297,435 | 0 | 1 | BSD-2-Clause | 2022-11-21T01:19:37 | 2019-11-26T22:28:11 | C++ | UTF-8 | C++ | false | false | 12,503 | cc | // Copyright 2021 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 <fcntl.h>
#include <lib/async-loop/cpp/loop.h>
#include <lib/async-loop/default.h>
#include <lib/fdio/fd.h>
#include <lib/sync/completion.h>
#include <lib/zx/vmar.h>
#include <condition_variable>
#include <iostream>
#include <mutex>
#include <optional>
#include <fbl/auto_lock.h>
#include <fbl/condition_variable.h>
#include <fbl/unique_fd.h>
#include <zxtest/zxtest.h>
#include "src/lib/storage/vfs/cpp/connection.h"
#include "src/lib/storage/vfs/cpp/paged_vfs.h"
#include "src/lib/storage/vfs/cpp/paged_vnode.h"
#include "src/lib/storage/vfs/cpp/pseudo_dir.h"
namespace fs {
namespace {
// This structure tracks the mapped state of the paging test file across the test thread and the
// paging thread.
class SharedFileState {
public:
// Called by the PagedVnode when the VMO is mapped or unmapped.
void SignalVmoPresenceChanged(bool present) {
{
std::lock_guard lock(mutex_);
vmo_present_changed_ = true;
vmo_present_ = present;
}
cond_var_.notify_one();
}
// Returns the current state of the mapped flag.
bool GetVmoPresent() {
std::lock_guard lock(mutex_);
return vmo_present_;
}
// Waits for the vmo presence to be marked changed and returns the presence flag.
//
// Called by the test to get the [un]mapped event.
bool WaitForChangedVmoPresence() {
std::unique_lock<std::mutex> lock(mutex_);
while (!vmo_present_changed_)
cond_var_.wait(lock);
vmo_present_changed_ = false;
return vmo_present_;
}
private:
std::mutex mutex_;
std::condition_variable cond_var_;
bool vmo_present_changed_ = false;
bool vmo_present_ = false;
};
class PagingTestFile : public PagedVnode {
public:
// Controls the success or failure that VmoRead() will report. Defaults to success (ZX_OK).
void set_read_status(zx_status_t status) { vmo_read_status_ = status; }
// Public locked version of PagedVnode::has_clones().
bool HasClones() const {
std::lock_guard lock(mutex_);
return has_clones();
}
// PagedVnode implementation:
void VmoRead(uint64_t offset, uint64_t length) override {
std::lock_guard lock(mutex_);
if (vmo_read_status_ != ZX_OK) {
// We're supposed to report errors.
EXPECT_TRUE(paged_vfs()
->ReportPagerError(paged_vmo(), offset, length, ZX_ERR_IO_DATA_INTEGRITY)
.is_ok());
return;
}
zx::vmo transfer;
if (zx::vmo::create(length, 0, &transfer) != ZX_OK) {
ASSERT_TRUE(
paged_vfs()->ReportPagerError(paged_vmo(), offset, length, ZX_ERR_BAD_STATE).is_ok());
return;
}
transfer.write(&data_[offset], 0, std::min(data_.size() - offset, length));
ASSERT_TRUE(paged_vfs()->SupplyPages(paged_vmo(), offset, length, transfer, 0).is_ok());
}
// Vnode implementation:
VnodeProtocolSet GetProtocols() const override { return fs::VnodeProtocol::kFile; }
zx_status_t GetNodeInfoForProtocol(fs::VnodeProtocol protocol, fs::Rights,
fs::VnodeRepresentation* info) final {
if (protocol == fs::VnodeProtocol::kFile) {
*info = fs::VnodeRepresentation::File();
return ZX_OK;
}
return ZX_ERR_NOT_SUPPORTED;
}
zx_status_t GetVmo(int flags, zx::vmo* out_vmo, size_t* out_size) override {
std::lock_guard lock(mutex_);
// We need to signal after the VMO was mapped that it changed.
bool becoming_mapped = !paged_vmo();
if (auto result = EnsureCreatePagedVmo(data_.size()); result.is_error())
return result.error_value();
if (zx_status_t status = paged_vmo().create_child(ZX_VMO_CHILD_SNAPSHOT_AT_LEAST_ON_WRITE, 0,
data_.size(), out_vmo);
status != ZX_OK)
return status;
DidClonePagedVmo();
if (becoming_mapped)
shared_->SignalVmoPresenceChanged(true);
return ZX_OK;
}
// Allows tests to force-free the underlying VMO, even if it has mappings.
void ForceFreePagedVmo() {
// Free pager_ref outside the lock.
fbl::RefPtr<fs::Vnode> pager_ref;
{
std::lock_guard lock(mutex_);
if (!shared_->GetVmoPresent())
return; // Already gone, nothing to do.
pager_ref = FreePagedVmo();
shared_->SignalVmoPresenceChanged(false);
}
}
protected:
void OnNoPagedVmoClones() override __TA_REQUIRES(mutex_) {
PagedVnode::OnNoPagedVmoClones(); // Do normal behavior of releasing the VMO.
shared_->SignalVmoPresenceChanged(false);
}
private:
friend fbl::RefPtr<PagingTestFile>;
friend fbl::internal::MakeRefCountedHelper<PagingTestFile>;
PagingTestFile(PagedVfs* vfs, std::shared_ptr<SharedFileState> shared, std::vector<uint8_t> data)
: PagedVnode(vfs), shared_(std::move(shared)), data_(data) {}
~PagingTestFile() override {}
std::shared_ptr<SharedFileState> shared_;
std::vector<uint8_t> data_;
zx_status_t vmo_read_status_ = ZX_OK;
};
// This file has many pages and end in a non-page-boundary.
const char kFile1Name[] = "file1";
constexpr size_t kFile1Size = 4096 * 17 + 87;
// This file is the one that always reports errors.
const char kFileErrName[] = "file_err";
class PagingTest : public zxtest::Test {
public:
PagingTest()
: main_loop_(&kAsyncLoopConfigNoAttachToCurrentThread),
vfs_loop_(&kAsyncLoopConfigNoAttachToCurrentThread) {
// Generate contents for the canned file. This uses a repeating pattern of an odd number of
// bytes so we don't get a page-aligned pattern.
file1_contents_.resize(kFile1Size);
constexpr uint8_t kMaxByte = 253;
uint8_t cur = 4;
for (size_t i = 0; i < kFile1Size; i++) {
if (cur >= kMaxByte)
cur = 0;
file1_contents_[i] = cur;
cur++;
}
}
~PagingTest() {
// Tear down the VFS asynchronously.
if (vfs_) {
sync_completion_t completion;
vfs_->Shutdown([&completion](zx_status_t status) {
EXPECT_EQ(status, ZX_OK);
sync_completion_signal(&completion);
});
sync_completion_wait(&completion, zx::time::infinite().get());
}
if (vfs_thread_) {
vfs_loop_.Quit();
vfs_thread_->join();
}
}
// Creates the VFS and returns an FD to the root directory.
int CreateVfs(int num_pager_threads) {
// Start the VFS worker thread.
vfs_thread_ = std::make_unique<std::thread>([this]() { VfsThreadProc(); });
// Start the VFS and pager objects.
vfs_ = std::make_unique<PagedVfs>(vfs_loop_.dispatcher(), num_pager_threads);
EXPECT_TRUE(vfs_->Init().is_ok());
// Set up the directory hierarchy.
root_ = fbl::MakeRefCounted<PseudoDir>();
file1_shared_ = std::make_shared<SharedFileState>();
file1_ = fbl::MakeRefCounted<PagingTestFile>(vfs_.get(), file1_shared_, file1_contents_);
root_->AddEntry(kFile1Name, file1_);
file_err_shared_ = std::make_shared<SharedFileState>();
file_err_ = fbl::MakeRefCounted<PagingTestFile>(vfs_.get(), file_err_shared_, file1_contents_);
file_err_->set_read_status(ZX_ERR_IO_DATA_INTEGRITY);
root_->AddEntry(kFileErrName, file_err_);
// Connect to the root.
zx::channel client_end, server_end;
EXPECT_OK(zx::channel::create(0u, &client_end, &server_end));
vfs_->ServeDirectory(root_, std::move(server_end));
// Convert to an FD.
int root_dir_fd = -1;
EXPECT_OK(fdio_fd_create(client_end.release(), &root_dir_fd));
return root_dir_fd;
}
protected:
std::unique_ptr<PagedVfs> vfs_;
std::shared_ptr<SharedFileState> file1_shared_;
std::shared_ptr<SharedFileState> file_err_shared_;
std::vector<uint8_t> file1_contents_;
fbl::RefPtr<PagingTestFile> file1_;
fbl::RefPtr<PagingTestFile> file_err_;
private:
// The VFS needs to run on a separate thread to handle the FIDL requests from the test because
// the FDIO calls from the main thread are blocking.
void VfsThreadProc() { vfs_loop_.Run(); }
// This test requires two threads because the main thread needs to make blocking calls that are
// serviced by the VFS on the background thread.
async::Loop main_loop_;
std::unique_ptr<std::thread> vfs_thread_;
async::Loop vfs_loop_;
fbl::RefPtr<PseudoDir> root_;
};
template <typename T>
T RoundUp(T value, T multiple) {
return (value + multiple - 1) / multiple * multiple;
}
} // namespace
TEST_F(PagingTest, Read) {
fbl::unique_fd root_dir_fd(CreateVfs(1));
ASSERT_TRUE(root_dir_fd);
fbl::unique_fd file1_fd(openat(root_dir_fd.get(), kFile1Name, 0, S_IRWXU));
ASSERT_TRUE(file1_fd);
// With no VMO requests, there should be no mappings of the VMO in the file.
ASSERT_FALSE(file1_shared_->GetVmoPresent());
EXPECT_FALSE(file1_->HasClones());
EXPECT_EQ(0u, vfs_->GetRegisteredPagedVmoCount());
// Gets the VMO for file1, it should now have a VMO.
zx::vmo vmo;
ASSERT_EQ(ZX_OK, fdio_get_vmo_exact(file1_fd.get(), vmo.reset_and_get_address()));
ASSERT_TRUE(file1_shared_->WaitForChangedVmoPresence());
EXPECT_TRUE(file1_->HasClones());
EXPECT_EQ(1u, vfs_->GetRegisteredPagedVmoCount());
// Map the data and validate the result can be read.
zx_vaddr_t mapped_addr = 0;
size_t mapped_len = RoundUp<uint64_t>(kFile1Size, zx_system_get_page_size());
ASSERT_EQ(ZX_OK,
zx::vmar::root_self()->map(ZX_VM_PERM_READ, 0, vmo, 0, mapped_len, &mapped_addr));
ASSERT_TRUE(mapped_addr);
// Clear the VMO so the code below also validates that the mapped memory works even when the
// VMO is freed. The mapping stores an implicit reference to the vmo.
vmo.reset();
const uint8_t* mapped = reinterpret_cast<const uint8_t*>(mapped_addr);
for (size_t i = 0; i < kFile1Size; i++) {
ASSERT_EQ(mapped[i], file1_contents_[i]);
}
// The vmo should still be valid.
ASSERT_TRUE(file1_shared_->GetVmoPresent());
EXPECT_TRUE(file1_->HasClones());
// Unmap the memory. This should notify the vnode which should free its vmo_ reference.
ASSERT_EQ(ZX_OK, zx::vmar::root_self()->unmap(mapped_addr, mapped_len));
ASSERT_FALSE(file1_shared_->WaitForChangedVmoPresence());
EXPECT_FALSE(file1_->HasClones());
EXPECT_EQ(0u, vfs_->GetRegisteredPagedVmoCount());
}
TEST_F(PagingTest, VmoRead) {
fbl::unique_fd root_dir_fd(CreateVfs(1));
ASSERT_TRUE(root_dir_fd);
// Open file1 and get the VMO.
fbl::unique_fd file1_fd(openat(root_dir_fd.get(), kFile1Name, 0, S_IRWXU));
ASSERT_TRUE(file1_fd);
zx::vmo vmo;
ASSERT_EQ(ZX_OK, fdio_get_vmo_exact(file1_fd.get(), vmo.reset_and_get_address()));
// Test that zx_vmo_read works on the file's VMO.
std::vector<uint8_t> read;
read.resize(kFile1Size);
ASSERT_EQ(ZX_OK, vmo.read(&read[0], 0, kFile1Size));
for (size_t i = 0; i < kFile1Size; i++) {
ASSERT_EQ(read[i], file1_contents_[i]);
}
}
// Tests that read errors are propagated. This uses zx_vmo_read so we can get the error without
// segfaulting. Since we're not actually trying to test the kernel's delivery of paging errors, this
// is enough for the VFS paging behavior.
TEST_F(PagingTest, ReadError) {
fbl::unique_fd root_dir_fd(CreateVfs(1));
ASSERT_TRUE(root_dir_fd);
// Open the "error" file and get the VMO.
fbl::unique_fd file_err_fd(openat(root_dir_fd.get(), kFileErrName, 0, S_IRWXU));
ASSERT_TRUE(file_err_fd);
zx::vmo vmo;
ASSERT_EQ(ZX_OK, fdio_get_vmo_exact(file_err_fd.get(), vmo.reset_and_get_address()));
// All reads should be errors.
uint8_t buf[8];
EXPECT_EQ(ZX_ERR_IO_DATA_INTEGRITY, vmo.read(buf, 0, std::size(buf)));
}
TEST_F(PagingTest, FreeWhileClonesExist) {
fbl::unique_fd root_dir_fd(CreateVfs(1));
ASSERT_TRUE(root_dir_fd);
// Open file1 and get the VMO.
fbl::unique_fd file1_fd(openat(root_dir_fd.get(), kFile1Name, 0, S_IRWXU));
ASSERT_TRUE(file1_fd);
zx::vmo vmo;
ASSERT_EQ(ZX_OK, fdio_get_vmo_exact(file1_fd.get(), vmo.reset_and_get_address()));
// Force releasing the VMO even though a clone still exists.
file1_->ForceFreePagedVmo();
// After detaching the VMO, it should report there is no VMO and reads from it should fail.
EXPECT_FALSE(file1_->HasClones());
uint8_t read_byte;
ASSERT_EQ(ZX_ERR_BAD_STATE, vmo.read(&read_byte, 0, 1));
}
// TODO(bug 51111):
// - Test closing a file frees the PagedVnode object.
// - Test multiple threads (deliberately hang one to make sure we can service another request).
} // namespace fs
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
10050d6519aa2c127ae563ab50075366b1d79328 | 6b712eda6ced44a993d1f16f203d643c8a0cf0b5 | /work/SimPack/SimApp.h | e1e97902fcb768825d06f0346337a87e976ce5f5 | [] | no_license | Liima/cplusplus | 5b1dadfc0b03fd005270168829444dd361d733fb | dd3524cd77deac85233eaa79c6834807bebb38a7 | refs/heads/master | 2021-01-01T10:37:40.182550 | 2015-04-16T06:54:12 | 2015-04-16T06:54:12 | 33,733,565 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 840 | h |
#ifndef SIMAPP_H
#define SIMAPP_H
#include <gtkmm.h>
#include <string>
#include <iostream>
#include "RoguePlayground.h"
#include "TimeKeeper.h"
#include "ZoomWindow.h"
class SimApp : public Gtk::Application, public TimeKeeper
{
public:
SimApp(int argc, char *argv[], string title, int w, int h);
virtual ~SimApp() { cout << "Sim Window Destroyed" << endl; }
virtual void tick(long t) { m_playground.tick(t); }
static double getSecPerTick() { return s_secPerTick; }
static double getMetersPerPixel() {return s_metersPerPixel; }
static void setSecPerTick(double s) { s_secPerTick = s; }
static void setMetersPerPixel(double m) { s_metersPerPixel = m; }
private:
static double s_secPerTick;
static double s_metersPerPixel;
RoguePlayground m_playground;
Glib::RefPtr<Gtk::Application> m_app;
ZoomWindow m_window;
};
#endif
| [
"nards8@gmail.com"
] | nards8@gmail.com |
a3408658d0968fc61866f3a7a59738a5dab012b2 | 31e50c93e19fc0f0408e64e0bccb53eb09a08215 | /Recursion/rev_stack.cpp | 0a368fd21356ce1ba8f6d856fbf940365df30cc7 | [] | no_license | goyalmayank522/Recursion-Stack-Heap | 056f3ab2901e4aa96377d4f3b572906bba408807 | ea491ffdc91ad1c3820ce7379011a9e7477c44b5 | refs/heads/master | 2022-12-09T03:42:03.480009 | 2020-09-18T18:34:26 | 2020-09-18T18:34:26 | 295,805,317 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 698 | cpp | #include<iostream>
#include<stack>
using namespace std;
void insert(stack<int> &arr,int temp){
if(arr.empty()){
arr.push(temp);
return;
}
int val=arr.top();
arr.pop();
insert(arr,temp);
arr.push(val);
return;
}
void rev_arr(stack<int> &arr, int temp){
if(arr.size()==1 || arr.empty()){
return;
}
temp=arr.top();
arr.pop();
rev_arr(arr,temp);
insert(arr,temp);
}
int main(){
stack <int> arr;
arr.push(5);
arr.push(4);
arr.push(3);
arr.push(2);
arr.push(1);
rev_arr(arr, arr.top());
//cout << arr.top();
while(!arr.empty()){
cout << arr.top() <<endl;
arr.pop();
}
} | [
"goyalmayank522@gmail.com"
] | goyalmayank522@gmail.com |
5f6bedda5f6386e9e98406103e07381f31e892d0 | 0c338278efe932234fd1c49e882d258017041515 | /psx/octoshock/psx/input/justifier.h | 735878a1dc35bd2dd5a89c1259511817ff111d42 | [] | no_license | cyndyishida/BizHawkEmulator | 49b9e50760664d6364a1e1c2b0e41b9d227ccc39 | c03dc523a5e616ca3427955be4801ca866ba8ac5 | refs/heads/master | 2021-01-11T18:54:19.176608 | 2017-05-11T18:42:52 | 2017-05-11T18:42:52 | 79,653,122 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 165 | h | #ifndef __MDFN_PSX_INPUT_JUSTIFIER_H
#define __MDFN_PSX_INPUT_JUSTIFIER_H
namespace MDFN_IEN_PSX
{
InputDevice *Device_Justifier_Create(void);
}
#endif
| [
"ishidacy@msu.edu"
] | ishidacy@msu.edu |
caeb331dcede25eaa60bd10b65d065adceb49eff | 49f394ccd6c3729e9c382a3fe09415344ca98874 | /automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-color-controller.cpp | f24bc44c111bd5e1ede051dc106d7ad3c3940c0f | [
"Apache-2.0",
"BSD-3-Clause"
] | permissive | dalihub/dali-toolkit | 69ccb4c71904fdc9f1d88e0a1fedeaa2691213f8 | 4dec2735f5e5b5ed74f70a402c9a008d6c21af05 | refs/heads/master | 2023-09-03T05:02:34.534108 | 2023-09-01T14:02:39 | 2023-09-01T14:02:39 | 70,086,454 | 8 | 12 | NOASSERTION | 2020-08-28T14:04:59 | 2016-10-05T18:13:51 | C++ | UTF-8 | C++ | false | false | 2,437 | cpp | /*
* Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* 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 <dali/devel-api/adaptor-framework/color-controller.h>
#include <dali/public-api/object/base-object.h>
using namespace Dali;
namespace Dali
{
namespace Internal
{
namespace Adaptor
{
class ColorController : public BaseObject
{
public:
ColorController(){}
static Dali::ColorController Get()
{
return Dali::ColorController( new ColorController() );
}
bool RetrieveColor( const std::string& colorCode, Vector4& colorValue )
{
return false;
}
bool RetrieveColor( const std::string& colorCode ,
Vector4& textColor,
Vector4& textOutlineColor,
Vector4& textShadowColor)
{
return false;
}
protected:
virtual ~ColorController(){}
};
} // Adaptor
} // Internal
inline Internal::Adaptor::ColorController& GetImplementation(Dali::ColorController& controller)
{
DALI_ASSERT_ALWAYS(controller && "ColorController handle is empty");
BaseObject& handle = controller.GetBaseObject();
return static_cast<Internal::Adaptor::ColorController&>(handle);
}
inline const Internal::Adaptor::ColorController& GetImplementation(const Dali::ColorController& controller)
{
DALI_ASSERT_ALWAYS(controller && "ColorController handle is empty");
const BaseObject& handle = controller.GetBaseObject();
return static_cast<const Internal::Adaptor::ColorController&>(handle);
}
ColorController ColorController::Get()
{
return Internal::Adaptor::ColorController::Get();
}
ColorController::ColorController(Internal::Adaptor::ColorController* internal)
: BaseHandle(internal)
{
}
ColorController::~ColorController()
{
}
bool ColorController::RetrieveColor( const std::string& colorCode, Vector4& colorValue )
{
return GetImplementation(*this).RetrieveColor( colorCode, colorValue );
}
} // Dali
| [
"david.steele@samsung.com"
] | david.steele@samsung.com |
0f79a0a616d31aee6e3fb17d017a4bbb607e793c | c9b2a1b6cf254273cc4705f31916c4942fd6f47f | /matt_daemon/Common/common.hpp | 2f5420cb392fc27744e233baee78c26e8d91c601 | [] | no_license | gbourgeo/42projects | cb4141026a2572c04a6e9820fe2d1a7319ac3225 | 3127c9e74ff8ec6d00be3f7d449f3469d56bdb86 | refs/heads/master | 2021-01-17T02:58:20.156155 | 2020-09-08T12:00:52 | 2020-09-08T12:00:52 | 58,766,253 | 1 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 1,302 | hpp | // ************************************************************************** //
// //
// ::: :::::::: //
// common.hpp :+: :+: :+: //
// +:+ +:+ +:+ //
// By: root </var/mail/root> +#+ +:+ +#+ //
// +#+#+#+#+#+ +#+ //
// Created: 2017/11/05 20:39:17 by root #+# #+# //
// Updated: 2017/11/11 17:53:05 by root ### ########.fr //
// //
// ************************************************************************** //
#ifndef COMMON_HPP
# define COMMON_HPP
# define DAEMON_BUFF 512
# define DAEMON_MAGIC 0xDAE1
typedef struct s_hdr
{
int magic;
int crypted;
size_t datalen;
char data[DAEMON_BUFF];
} t_hdr;
int Base64decode_len(const char *bufcoded);
int Base64decode(char *bufplain, const char *bufcoded);
int Base64encode_len(int len);
int Base64encode(char *encoded, const char *string, int len);
#endif
| [
"gillesbourgeoi@gmail.com"
] | gillesbourgeoi@gmail.com |
34dbb91ade86f8103b11b5421318ef7f4b287f2c | 1ac579bd595d847af499dcd5a7200738016336ff | /src/editor/linux/platform_interface.cpp | 4b6126839c30ff9a8c1d79d842278e5ade0a7c07 | [
"MIT"
] | permissive | PeaceSells50/LumixEngine | 33b6f5932b6566dc1b08e7c92f1886c1185fdc98 | 80ae4eb7e9e0522fffd7357c795cf81c26729965 | refs/heads/master | 2021-01-18T12:53:38.937823 | 2016-06-01T08:37:57 | 2016-06-01T08:37:57 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,939 | cpp | #include "platform_interface.h"
#include "engine/command_line_parser.h"
#include "engine/iallocator.h"
#include "engine/string.h"
#include "imgui/imgui.h"
#include <cerrno>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <dirent.h>
#include <fcntl.h>
#include <sys/sendfile.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <unistd.h>
#include <X11/Xlib.h>
namespace PlatformInterface
{
struct FileIterator
{
};
FileIterator* createFileIterator(const char* path, Lumix::IAllocator& allocator)
{
return (FileIterator*)opendir(path);
}
void destroyFileIterator(FileIterator* iterator)
{
closedir((DIR*)iterator);
}
bool getNextFile(FileIterator* iterator, FileInfo* info)
{
if(!iterator) return false;
auto* dir = (DIR*)iterator;
auto* dir_ent = readdir(dir);
if (!dir_ent) return false;
info->is_directory = dir_ent->d_type == DT_DIR;
Lumix::copyString(info->filename, dir_ent->d_name);
return true;
}
void getCurrentDirectory(char* buffer, int buffer_size)
{
getcwd(buffer, buffer_size);
}
struct Process
{
explicit Process(Lumix::IAllocator& allocator)
: allocator(allocator)
{
}
Lumix::IAllocator& allocator;
pid_t handle;
int pipes[2];
int exit_code;
};
bool isProcessFinished(Process& process)
{
if (process.handle == -1) return true;
int status;
int success = waitpid(process.handle, &status, WNOHANG);
if (success == 0) return false;
process.exit_code = WEXITSTATUS(status);
process.handle = -1;
return true;
}
int getProcessExitCode(Process& process)
{
if (process.handle != -1)
{
int status;
int success = waitpid(process.handle, &status, WNOHANG);
ASSERT (success != -1 && success != 0);
process.exit_code = WEXITSTATUS(status);
process.handle = -1;
}
return process.exit_code;
}
void destroyProcess(Process& process)
{
if (process.handle != -1)
{
kill(process.handle, SIGKILL);
int status;
waitpid(process.handle, &status, 0);
}
LUMIX_DELETE(process.allocator, &process);
}
Process* createProcess(const char* cmd, const char* args, Lumix::IAllocator& allocator)
{
auto* process = LUMIX_NEW(allocator, Process)(allocator);
int res = pipe(process->pipes);
ASSERT(res == 0);
process->handle = fork();
ASSERT(process->handle != -1);
if(process->handle == 0)
{
close(process->pipes[0]);
dup2(process->pipes[1], STDOUT_FILENO);
dup2(process->pipes[1], STDERR_FILENO);
Lumix::CommandLineParser parser(args);
char* args_array[256];
char** i = args_array;
*i = (char*)cmd;
++i;
while(i - args_array < Lumix::lengthOf(args_array) - 2 && parser.next())
{
char tmp[1024];
parser.getCurrent(tmp, Lumix::lengthOf(tmp));
int len = Lumix::stringLength(tmp) + 1;
auto* copy = (char*)malloc(len);
Lumix::copyString(copy, len, tmp);
*i = copy;
++i;
}
*i = nullptr;
execv(cmd, args_array);
}
else
{
close(process->pipes[1]);
}
return process;
}
int getProcessOutput(Process& process, char* buf, int buf_size)
{
size_t ret = read(process.pipes[0], buf, buf_size);
return (int)ret;
}
bool getSaveFilename(char* out, int max_size, const char* filter, const char* default_extension)
{
/*OPENFILENAME ofn;
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = NULL;
ofn.lpstrFile = out;
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = max_size;
ofn.lpstrFilter = filter;
ofn.nFilterIndex = 1;
ofn.lpstrDefExt = default_extension;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_OVERWRITEPROMPT | OFN_NOCHANGEDIR | OFN_NONETWORKBUTTON;
return GetSaveFileName(&ofn) == TRUE;*/
return false;
}
bool getOpenFilename(char* out, int max_size, const char* filter, const char* starting_file)
{
/*OPENFILENAME ofn;
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = NULL;
if (starting_file)
{
char* to = out;
for (const char* from = starting_file; *from; ++from, ++to)
{
if (to - out > max_size - 1) break;
*to = *to == '/' ? '\\' : *from;
}
*to = '\0';
}
else
{
out[0] = '\0';
}
ofn.lpstrFile = out;
ofn.nMaxFile = max_size;
ofn.lpstrFilter = filter;
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = nullptr;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR | OFN_NONETWORKBUTTON;
return GetOpenFileName(&ofn) == TRUE;*/
return false;
}
bool getOpenDirectory(char* out, int max_size, const char* starting_dir)
{
/*bool ret = false;
IFileDialog *pfd;
if (SUCCEEDED(CoCreateInstance(
CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pfd))))
{
if (starting_dir)
{
PIDLIST_ABSOLUTE pidl;
WCHAR wstarting_dir[MAX_PATH];
WCHAR* wc = wstarting_dir;
for (const char* c = starting_dir; *c && wc - wstarting_dir < MAX_PATH - 1; ++c, ++wc)
{
*wc = *c == '/' ? '\\' : *c;
}
*wc = 0;
HRESULT hresult = ::SHParseDisplayName(wstarting_dir, 0, &pidl, SFGAO_FOLDER, 0);
if (SUCCEEDED(hresult))
{
IShellItem *psi;
hresult = ::SHCreateShellItem(NULL, NULL, pidl, &psi);
if (SUCCEEDED(hresult))
{
pfd->SetFolder(psi);
}
ILFree(pidl);
}
}
DWORD dwOptions;
if (SUCCEEDED(pfd->GetOptions(&dwOptions)))
{
pfd->SetOptions(dwOptions | FOS_PICKFOLDERS);
}
if (SUCCEEDED(pfd->Show(NULL)))
{
IShellItem* psi;
if (SUCCEEDED(pfd->GetResult(&psi)))
{
WCHAR* tmp;
if (SUCCEEDED(psi->GetDisplayName(SIGDN_DESKTOPABSOLUTEPARSING, &tmp)))
{
char* c = out;
while (*tmp && c - out < max_size - 1)
{
*c = (char)*tmp;
++c;
++tmp;
}
*c = '\0';
ret = true;
}
psi->Release();
}
}
pfd->Release();
}
return ret;*/
return false;
}
bool shellExecuteOpen(const char* path)
{
return system(path) == 0;
}
bool deleteFile(const char* path)
{
return unlink(path) == 0;
}
bool moveFile(const char* from, const char* to)
{
return rename(from, to) == 0;
}
size_t getFileSize(const char* path)
{
struct stat tmp;
stat(path, &tmp);
return tmp.st_size;
}
bool fileExists(const char* path)
{
struct stat tmp;
return ((stat(path, &tmp) == 0) && (((tmp.st_mode) & S_IFMT) != S_IFDIR));
}
bool dirExists(const char* path)
{
struct stat tmp;
return ((stat(path, &tmp) == 0) && (((tmp.st_mode) & S_IFMT) == S_IFDIR));
}
Lumix::uint64 getLastModified(const char* file)
{
struct stat tmp;
Lumix::uint64 ret = 0;
ret = tmp.st_mtim.tv_sec * 1000 + Lumix::uint64(tmp.st_mtim.tv_nsec / 1000000);
return ret;
}
bool makePath(const char* path)
{
return mkdir(path, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) == 0;
}
} // namespace PlatformInterface
| [
"mikulas.florek@gamedev.sk"
] | mikulas.florek@gamedev.sk |
ecd26f3a2ab9d78422fb18a0fab3f234aebbc6a4 | af0ecafb5428bd556d49575da2a72f6f80d3d14b | /CodeJamCrawler/dataset/10_9650_76.cpp | 4fcd42ae068d0c29de9d1792521c31cbb3beab0c | [] | no_license | gbrlas/AVSP | 0a2a08be5661c1b4a2238e875b6cdc88b4ee0997 | e259090bf282694676b2568023745f9ffb6d73fd | refs/heads/master | 2021-06-16T22:25:41.585830 | 2017-06-09T06:32:01 | 2017-06-09T06:32:01 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,514 | cpp | def euclid_gcd(a,b):
while True:
if a > b:
c = a
a = b
b = c
while b >= a:
if a == 0:
return b
b = b % a
if b == 0:
return a
def main():
fname = 'B-small-attempt0'
outfile = open(fname + '.out','w')
infile = open(fname + '.in','r')
cases_str = infile.readline()
cases_str.strip()
cases_count = int(cases_str)
for case_num in range(cases_count):
case_line = infile.readline()
case_line = case_line.strip()
case_list = case_line.split(' ')
num_great_events = case_list[0]
num_great_events = int(num_great_events)
event_list = []
for i in range(num_great_events):
event_list.append(int(case_list[i + 1]))
diff_list = []
dl_size = 0
for i in range(num_great_events - 1):
for j in range(i + 1,num_great_events):
dx = abs(event_list[i] - event_list[j])
diff_list.append(dx)
dl_size = dl_size + 1
if dl_size == 1:
my_gcd = diff_list[0]
else:
my_gcd = euclid_gcd(diff_list[0],diff_list[1])
if dl_size > 2:
for i in range(2,dl_size):
my_gcd = euclid_gcd(my_gcd,diff_list[i])
min_of_events = event_list[0]
for i in range(1,num_great_events):
if event_list[i] < min_of_events:
min_of_events = event_list[i]
remd = min_of_events % my_gcd
if remd == 0:
need_to_add = 0
else:
need_to_add = my_gcd - remd
this_case = case_num + 1
outfile.write('Case #' + str(this_case) + ': ' + str(need_to_add) + "\n")
infile.close()
outfile.close()
main()
| [
"nikola.mrzljak@fer.hr"
] | nikola.mrzljak@fer.hr |
a4a95d8f04c2c1bc0cc4af0b85f1623263f75969 | ca920e25a81c87623af1a2e3936733796d9c9cd0 | /include/operation_panel/master_slave_panel.h | 1988ed86cec8fecfad39f02a8095372e02b4e11c | [] | no_license | svyatoslavdm/operation_panel | 6cb6feec443643089bb4d3eb0327eb8af5f44099 | 83055bad86f5d9226884c0b478f534cbc06d07ae | refs/heads/master | 2020-12-25T09:57:34.498769 | 2016-06-24T12:12:44 | 2016-06-24T12:12:44 | 61,882,202 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 947 | h | #ifndef MASTER_SLAVE_PANEL_H
#define MASTER_SLAVE_PANEL_H
#include <sstream>
#include <fstream>
#include <iostream>
#include <string.h>
#include <thread>
#include <ros/ros.h>
#include <rviz/panel.h>
#include <stdio.h>
#include <operation_panel/GUI/MasterSlaveGUI.h>
#include <operation_panel/ActionClients/ActionMasterSlaveClient.h>
#include <QShowEvent>
namespace rviz
{
class MasterSlavePanel: public rviz::Panel
{
Q_OBJECT
public:
MasterSlavePanel( QWidget* parent = 0 );
virtual void load( const rviz::Config& config );
virtual void save( rviz::Config config ) const;
private:
ros::NodeHandle nh;
GuiMasterSlave* masterSlaveGUI;
ActionMasterSlaveClient* masterSlaveClient;
protected:
};
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
} //end namespace rviz
#endif
| [
"svyatoslavdm@gmail.com"
] | svyatoslavdm@gmail.com |
a6cdefca2d561f6be625f98a4ba1ed66f66d2c9c | 21a55f7b2d3b264296b0cd3ad8baabee600e2680 | /lib/logxchecker/state_machine/TxTransitions.h | 7e96e57d96d4515cd723562bbe52cb26e3003b33 | [
"MIT"
] | permissive | epfl-vlsc/NVMOrdering | 1fba4a670c44f152c59eb45d7c3ae6591f7c73a4 | 09ca83b9efbf4eedcef9cb1f42645ae0965f291a | refs/heads/master | 2022-01-30T11:22:20.985854 | 2019-06-18T20:50:25 | 2019-06-18T20:50:25 | 174,121,447 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 976 | h | #pragma once
#include "Common.h"
#include "LogState.h"
#include "StateInfo.h"
namespace clang::ento::nvm::TxSpace {
bool inTx(ProgramStateRef& State) {
unsigned txCount = State->get<TxCounter>();
DBG("inTx:" << txCount)
return txCount > 0;
}
void checkTx(StateInfo& SI) {
ProgramStateRef& State = SI.State;
unsigned txCount = State->get<TxCounter>();
if (txCount < 1) {
// more tx end
SI.reportAccessOutsideTxBug();
}
DBG("checkTx txCount:" << txCount)
}
void begTx(ProgramStateRef& State, CheckerContext& C) {
unsigned txCount = State->get<TxCounter>();
txCount += 1;
State = State->set<TxCounter>(txCount);
C.addTransition(State);
DBG("begTx txCount:" << txCount)
}
void endTx(ProgramStateRef& State, CheckerContext& C) {
unsigned txCount = State->get<TxCounter>();
txCount -= 1;
State = State->set<TxCounter>(txCount);
C.addTransition(State);
DBG("endTx txCount:" << txCount)
}
} // namespace clang::ento::nvm::TxSpace | [
"davidteksenaksun@gmail.com"
] | davidteksenaksun@gmail.com |
0c92fd7b3beaaf0ecb030377184d7b026c7e637a | 3afbf5e6f8875bbf36e63828f7ee482715392e08 | /ui/ozone/platform/drm/gpu/hardware_display_plane_manager_legacy.cc | 5e3f0a1f59b3d466b87b4827e8434b1c5ce6f1ea | [
"BSD-3-Clause"
] | permissive | afuhrtrumpet/chromium | fc5320c7fb8923e835f519c1de1e77bfa791ae1f | 4526729e425b7a90c2725586dbd61e1c397cc308 | refs/heads/master | 2021-01-24T17:16:29.980646 | 2015-09-01T20:26:17 | 2015-09-01T20:26:54 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,281 | cc | // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager_legacy.h"
#include "base/bind.h"
#include "ui/ozone/platform/drm/gpu/crtc_controller.h"
#include "ui/ozone/platform/drm/gpu/drm_device.h"
#include "ui/ozone/platform/drm/gpu/scanout_buffer.h"
namespace ui {
HardwareDisplayPlaneManagerLegacy::HardwareDisplayPlaneManagerLegacy() {
}
HardwareDisplayPlaneManagerLegacy::~HardwareDisplayPlaneManagerLegacy() {
}
bool HardwareDisplayPlaneManagerLegacy::Commit(
HardwareDisplayPlaneList* plane_list,
bool is_sync,
bool test_only) {
if (test_only) {
for (HardwareDisplayPlane* plane : plane_list->plane_list) {
plane->set_in_use(false);
}
plane_list->plane_list.clear();
plane_list->legacy_page_flips.clear();
return true;
}
if (plane_list->plane_list.empty()) // No assigned planes, nothing to do.
return true;
bool ret = true;
// The order of operations here (set new planes, pageflip, clear old planes)
// is designed to minimze the chance of a significant artifact occurring.
// The planes must be updated first because the main plane no longer contains
// their content. The old planes are removed last because the previous primary
// plane used them as overlays and thus didn't contain their content, so we
// must first flip to the new primary plane, which does. The error here will
// be the delta of (new contents, old contents), but it should be barely
// noticeable.
for (const auto& flip : plane_list->legacy_page_flips) {
// Permission Denied is a legitimate error
for (const auto& plane : flip.planes) {
if (!drm_->PageFlipOverlay(flip.crtc_id, plane.framebuffer, plane.bounds,
plane.src_rect, plane.plane)) {
PLOG(ERROR) << "Cannot display plane on overlay: crtc=" << flip.crtc
<< " plane=" << plane.plane;
ret = false;
flip.crtc->PageFlipFailed();
break;
}
}
if (!drm_->PageFlip(flip.crtc_id, flip.framebuffer, is_sync,
base::Bind(&CrtcController::OnPageFlipEvent,
flip.crtc->AsWeakPtr()))) {
if (errno != EACCES) {
PLOG(ERROR) << "Cannot page flip: crtc=" << flip.crtc_id
<< " framebuffer=" << flip.framebuffer
<< " is_sync=" << is_sync;
ret = false;
}
flip.crtc->PageFlipFailed();
}
}
// For each element in |old_plane_list|, if it hasn't been reclaimed (by
// this or any other HDPL), clear the overlay contents.
for (HardwareDisplayPlane* plane : plane_list->old_plane_list) {
if (!plane->in_use() && (plane->type() != HardwareDisplayPlane::kDummy)) {
// This plane is being released, so we need to zero it.
if (!drm_->PageFlipOverlay(plane->owning_crtc(), 0, gfx::Rect(),
gfx::Rect(), plane->plane_id())) {
PLOG(ERROR) << "Cannot free overlay: crtc=" << plane->owning_crtc()
<< " plane=" << plane->plane_id();
ret = false;
break;
}
}
}
plane_list->plane_list.swap(plane_list->old_plane_list);
plane_list->plane_list.clear();
plane_list->legacy_page_flips.clear();
return ret;
}
bool HardwareDisplayPlaneManagerLegacy::SetPlaneData(
HardwareDisplayPlaneList* plane_list,
HardwareDisplayPlane* hw_plane,
const OverlayPlane& overlay,
uint32_t crtc_id,
const gfx::Rect& src_rect,
CrtcController* crtc) {
if ((hw_plane->type() == HardwareDisplayPlane::kDummy) ||
plane_list->legacy_page_flips.empty() ||
plane_list->legacy_page_flips.back().crtc_id != crtc_id) {
plane_list->legacy_page_flips.push_back(
HardwareDisplayPlaneList::PageFlipInfo(
crtc_id, overlay.buffer->GetFramebufferId(), crtc));
} else {
plane_list->legacy_page_flips.back().planes.push_back(
HardwareDisplayPlaneList::PageFlipInfo::Plane(
hw_plane->plane_id(), overlay.buffer->GetFramebufferId(),
overlay.display_bounds, src_rect));
}
return true;
}
} // namespace ui
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
32394264fadc2fce71d5c2a6fe8aa42a0884361d | 270dfd65d4cf9c27cc5acb16e741e6e36b7d6a41 | /source/steering.cpp | 13511d7e84e9c9d510a09d04ed102e361aa19459 | [] | no_license | sshedbalkar/ZhengGame | e93fcd42a9e4b3f36fb652366454414fad81b462 | 0488645f48718182c64209a02ad5faf4487fc830 | refs/heads/main | 2022-12-28T15:48:14.726521 | 2020-10-10T15:40:04 | 2020-10-10T15:40:04 | 302,932,347 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 820 | cpp | #include "steering.h"
#include "transform.h"
#include "composition.h"
#include "movement.h"
//===========================================
Steering::Steering() : Component( CT_Steering )
{
velocity.x = 0.0f;
velocity.y = 0.0f;
accel.x = 0.0f;
accel.y = 0.0f;
rotation = 0.0f;
max_speed = 4.0f;
}
//===========================================
Steering::~Steering()
{
}
//===========================================
void Steering::Serialize( Json::Value& root )
{
max_speed = static_cast<float>(root["MaxSpeed"].asDouble());
max_accel = static_cast<float>(root["MaxAccel"].asDouble());
}
//===========================================
void Steering::Initialize()
{
}
//===========================================
Component* Steering::Clone()
{
return new Steering( *this );
}
| [
"sanoysyg@gmail.com"
] | sanoysyg@gmail.com |
623900237edf75a6a3e98fa7926bb173f942f668 | 0577a46d8d28e1fd8636893bbdd2b18270bb8eb8 | /update_notifier/thirdparty/wxWidgets/src/generic/mask.cpp | 06bc53d9b18590dae21b44d1f40b34a271ea082f | [
"BSD-3-Clause"
] | permissive | ric2b/Vivaldi-browser | 388a328b4cb838a4c3822357a5529642f86316a5 | 87244f4ee50062e59667bf8b9ca4d5291b6818d7 | refs/heads/master | 2022-12-21T04:44:13.804535 | 2022-12-17T16:30:35 | 2022-12-17T16:30:35 | 86,637,416 | 166 | 41 | BSD-3-Clause | 2021-03-31T18:49:30 | 2017-03-29T23:09:05 | null | UTF-8 | C++ | false | false | 2,073 | cpp | ///////////////////////////////////////////////////////////////////////////////
// Name: src/generic/mask.cpp
// Purpose: generic wxMask implementation
// Author: Vadim Zeitlin
// Created: 2006-09-28
// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
// for compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/bitmap.h"
#include "wx/image.h"
#endif // WX_PRECOMP
#if wxUSE_GENERIC_MASK
// ============================================================================
// wxMask implementation
// ============================================================================
wxIMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject);
void wxMask::FreeData()
{
m_bitmap = wxNullBitmap;
}
bool wxMask::InitFromColour(const wxBitmap& bitmap, const wxColour& colour)
{
#if wxUSE_IMAGE
const wxColour clr(bitmap.QuantizeColour(colour));
wxImage imgSrc(bitmap.ConvertToImage());
imgSrc.SetMask(false);
wxImage image(imgSrc.ConvertToMono(clr.Red(), clr.Green(), clr.Blue()));
if ( !image.IsOk() )
return false;
m_bitmap = wxBitmap(image, 1);
return m_bitmap.IsOk();
#else // !wxUSE_IMAGE
wxUnusedVar(bitmap);
wxUnusedVar(colour);
return false;
#endif // wxUSE_IMAGE/!wxUSE_IMAGE
}
bool wxMask::InitFromMonoBitmap(const wxBitmap& bitmap)
{
wxCHECK_MSG( bitmap.IsOk(), false, wxT("Invalid bitmap") );
wxCHECK_MSG( bitmap.GetDepth() == 1, false, wxT("Cannot create mask from colour bitmap") );
m_bitmap = bitmap;
return true;
}
#endif // wxUSE_GENERIC_MASK
| [
"mathieu.caroff@free.fr"
] | mathieu.caroff@free.fr |
8dc7719780698e6465a6dc1d0de8ba5a49c55366 | 704a3d1a8bfe45d5295a35088ccb47d024f61383 | /code/TweeZcodeCompiler/main/test/Test.cpp | d70d8fe40e4bab5537df85109f9930923f689095 | [
"MIT"
] | permissive | TweeZcodeCompiler/twee_zcode_compiler | 8e4593fca25a3b43848ef24917b33775139847e3 | 4932fd07d5aadc5ea38afcdc4019586bbb9fa696 | refs/heads/master | 2021-05-01T13:46:33.990199 | 2015-07-17T02:54:56 | 2015-07-17T02:54:56 | 34,463,574 | 5 | 0 | null | 2015-07-17T01:25:47 | 2015-04-23T15:08:06 | HTML | UTF-8 | C++ | false | false | 3,540 | cpp | // for specification see Test.h
// Created by philip on 31.05.15.
//
#include "Test.h"
#include <iostream>
#include <sstream>
using std::cout;
using std::string;
std::vector<Test *> Test::tests = std::vector<Test *>();
std::vector<string> Test::names = std::vector<string>();
int Test::numberOfFailedTests = 0;
int Test::numberOfSuccessedTests = 0;
int Test::numberOfOtherTests = 0;
bool Test::runIgnoredTests = false;
void Test::addTest(string name, Test *t) {
tests.push_back(t);
names.push_back(name);
}
void Test::executeAllTests(bool runIgnoredTests) {
Test::numberOfFailedTests = 0;
Test::numberOfSuccessedTests = 0;
Test::runIgnoredTests = runIgnoredTests;
cout << "Run " << tests.size() << " tests:\n";
for (int i = 0; i < tests.size(); i++) {
Test *t = tests[i];
string name = names[i];
cout << "\n\n>>> Run '" << name << "' :";
try {
t->runTest();
cout << "\n>>> SUCCESSFUL";
Test::numberOfSuccessedTests++;
} catch (string s) {
if (s == "ignoreTestResult") {
Test::numberOfOtherTests++;
cout << "\n>>> IGNORED";
} else if (s == "fail") {
Test::numberOfFailedTests++;
cout << "\n>>> FAILED";
} else {
Test::numberOfOtherTests++;
cout << "\n>>> CUSTOM [" << s << "]";
}
}
}
cout << "\n\nTest execution finished:\nTotal:\t\t" << (Test::tests.size()) << "\n"
<< "Okay:\t\t" << Test::numberOfSuccessedTests << "\n"
<< "Failed:\t\t" << Test::numberOfFailedTests << "\n" <<
"Other:\t\t" << Test::numberOfOtherTests << "\nEND";
}
void Test::deleteTests() {
for (Test *t: tests) {
delete t;
}
}
void Test::assertsEquals(int expected, int value) {
if (expected != value) {
cout << "\nexpects <" << expected << "> but found <" << value << ">";
throw string("fail");
}
}
void Test::assertsEquals(std::string expected, std::string value) {
if (expected != value) {
cout << "\nexpects <" << expected << ">, but found <" << value << ">";
throw string("fail");
}
}
void Test::assertsEquals(std::vector<std::bitset<8>> expected, std::vector<std::bitset<8>> value) {
if (expected.size() != expected.size()) {
cout << "\nexpects vector size <" << expected.size() << ">, but found size <" << value.size() << ">";
throw "fail";
}
for (int i = 0; i < expected.size(); i++) {
if (expected[i] != value[i]) {
cout << "\n expects value <" << bitsetToFormString(expected[i]) << ">, but found <" <<
bitsetToFormString(value[i]) <<
"> at " << i;
throw string("fail");
}
}
}
void Test::assertsEquals(bool expected, bool value) {
if (expected != value) {
cout << "\nexpects <" << expected << ">, but found <" << value << ">";
throw string("fail");
}
}
std::string Test::bitsetToFormString(std::bitset<8> bitset) {
std::ostringstream o;
o << "[";
for (int i = 7; i >= 0; i--) {
o << bitset[i];
}
o << "] (";
o << bitset.to_ullong() << ")";
return o.str();
}
void Test::fail(std::string message) {
cout << "\n" << message;
throw string("fail");
}
void Test::ignoreTestResult() {
if (!Test::runIgnoredTests) {
throw string("ignoreTestResult");
}
}
void Test::customTestResult(std::string message) {
throw string(message);
} | [
"philip.schmiel@fu-berlin.de"
] | philip.schmiel@fu-berlin.de |
39251c46683ecbd6b3789982c86c064fdab32027 | 7c61d537b17477851776c4f4a43ac1e0f764c348 | /src/caffe/test/test_convolution_layer.cpp | 67d41fff844b2bba65927fe666f17224a91b13ae | [
"LicenseRef-scancode-generic-cla",
"BSD-2-Clause"
] | permissive | s9xie/hed | 2cd0ceac80e8cfdfdba36d0bdbee162827141a38 | 912632b986acc6dd6cc33b95603b2f279d7bd9f2 | refs/heads/master | 2023-04-09T23:08:28.872410 | 2023-03-27T20:39:10 | 2023-03-27T20:39:10 | 43,477,752 | 1,832 | 632 | NOASSERTION | 2019-05-24T16:16:59 | 2015-10-01T04:07:31 | C++ | UTF-8 | C++ | false | false | 27,169 | cpp | #include <cstring>
#include <vector>
#include "gtest/gtest.h"
#include "caffe/blob.hpp"
#include "caffe/common.hpp"
#include "caffe/filler.hpp"
#include "caffe/vision_layers.hpp"
#include "caffe/test/test_caffe_main.hpp"
#include "caffe/test/test_gradient_check_util.hpp"
namespace caffe {
// Reference convolution for checking results:
// accumulate through explicit loops over input, output, and filters.
template <typename Dtype>
void caffe_conv(const Blob<Dtype>* in, ConvolutionParameter* conv_param,
const vector<shared_ptr<Blob<Dtype> > >& weights,
Blob<Dtype>* out) {
// Kernel size, stride, and pad
int kernel_h, kernel_w;
if (conv_param->has_kernel_size()) {
kernel_h = kernel_w = conv_param->kernel_size();
} else {
kernel_h = conv_param->kernel_h();
kernel_w = conv_param->kernel_w();
}
int pad_h, pad_w;
if (!conv_param->has_pad_h()) {
pad_h = pad_w = conv_param->pad();
} else {
pad_h = conv_param->pad_h();
pad_w = conv_param->pad_w();
}
int stride_h, stride_w;
if (!conv_param->has_stride_h()) {
stride_h = stride_w = conv_param->stride();
} else {
stride_h = conv_param->stride_h();
stride_w = conv_param->stride_w();
}
// Groups
int groups = conv_param->group();
int o_g = out->channels() / groups;
int k_g = in->channels() / groups;
int o_head, k_head;
// Convolution
const Dtype* in_data = in->cpu_data();
const Dtype* weight_data = weights[0]->cpu_data();
Dtype* out_data = out->mutable_cpu_data();
for (int n = 0; n < out->num(); n++) {
for (int g = 0; g < groups; g++) {
o_head = o_g * g;
k_head = k_g * g;
for (int o = 0; o < o_g; o++) {
for (int k = 0; k < k_g; k++) {
for (int y = 0; y < out->height(); y++) {
for (int x = 0; x < out->width(); x++) {
for (int p = 0; p < kernel_h; p++) {
for (int q = 0; q < kernel_w; q++) {
int in_y = y * stride_h - pad_h + p;
int in_x = x * stride_w - pad_w + q;
if (in_y >= 0 && in_y < in->height()
&& in_x >= 0 && in_x < in->width()) {
out_data[out->offset(n, o + o_head, y, x)] +=
in_data[in->offset(n, k + k_head, in_y, in_x)]
* weight_data[weights[0]->offset(o + o_head, k, p, q)];
}
}
}
}
}
}
}
}
}
// Bias
if (conv_param->bias_term()) {
const Dtype* bias_data = weights[1]->cpu_data();
for (int n = 0; n < out->num(); n++) {
for (int o = 0; o < out->channels(); o++) {
for (int y = 0; y < out->height(); y++) {
for (int x = 0; x < out->width(); x++) {
out_data[out->offset(n, o, y, x)] += bias_data[o];
}
}
}
}
}
}
template void caffe_conv(const Blob<float>* in,
ConvolutionParameter* conv_param,
const vector<shared_ptr<Blob<float> > >& weights,
Blob<float>* out);
template void caffe_conv(const Blob<double>* in,
ConvolutionParameter* conv_param,
const vector<shared_ptr<Blob<double> > >& weights,
Blob<double>* out);
template <typename TypeParam>
class ConvolutionLayerTest : public MultiDeviceTest<TypeParam> {
typedef typename TypeParam::Dtype Dtype;
protected:
ConvolutionLayerTest()
: blob_bottom_(new Blob<Dtype>(2, 3, 6, 4)),
blob_bottom_2_(new Blob<Dtype>(2, 3, 6, 4)),
blob_top_(new Blob<Dtype>()),
blob_top_2_(new Blob<Dtype>()) {}
virtual void SetUp() {
// fill the values
FillerParameter filler_param;
filler_param.set_value(1.);
GaussianFiller<Dtype> filler(filler_param);
filler.Fill(this->blob_bottom_);
filler.Fill(this->blob_bottom_2_);
blob_bottom_vec_.push_back(blob_bottom_);
blob_top_vec_.push_back(blob_top_);
}
virtual ~ConvolutionLayerTest() {
delete blob_bottom_;
delete blob_bottom_2_;
delete blob_top_;
delete blob_top_2_;
}
virtual Blob<Dtype>* MakeReferenceTop(Blob<Dtype>* top) {
this->ref_blob_top_.reset(new Blob<Dtype>());
this->ref_blob_top_->ReshapeLike(*top);
return this->ref_blob_top_.get();
}
Blob<Dtype>* const blob_bottom_;
Blob<Dtype>* const blob_bottom_2_;
Blob<Dtype>* const blob_top_;
Blob<Dtype>* const blob_top_2_;
shared_ptr<Blob<Dtype> > ref_blob_top_;
vector<Blob<Dtype>*> blob_bottom_vec_;
vector<Blob<Dtype>*> blob_top_vec_;
};
TYPED_TEST_CASE(ConvolutionLayerTest, TestDtypesAndDevices);
TYPED_TEST(ConvolutionLayerTest, TestSetup) {
typedef typename TypeParam::Dtype Dtype;
LayerParameter layer_param;
ConvolutionParameter* convolution_param =
layer_param.mutable_convolution_param();
convolution_param->set_kernel_size(3);
convolution_param->set_stride(2);
convolution_param->set_num_output(4);
this->blob_bottom_vec_.push_back(this->blob_bottom_2_);
this->blob_top_vec_.push_back(this->blob_top_2_);
shared_ptr<Layer<Dtype> > layer(
new ConvolutionLayer<Dtype>(layer_param));
layer->SetUp(this->blob_bottom_vec_, this->blob_top_vec_);
EXPECT_EQ(this->blob_top_->num(), 2);
EXPECT_EQ(this->blob_top_->channels(), 4);
EXPECT_EQ(this->blob_top_->height(), 2);
EXPECT_EQ(this->blob_top_->width(), 1);
EXPECT_EQ(this->blob_top_2_->num(), 2);
EXPECT_EQ(this->blob_top_2_->channels(), 4);
EXPECT_EQ(this->blob_top_2_->height(), 2);
EXPECT_EQ(this->blob_top_2_->width(), 1);
// setting group should not change the shape
convolution_param->set_num_output(3);
convolution_param->set_group(3);
layer.reset(new ConvolutionLayer<Dtype>(layer_param));
layer->SetUp(this->blob_bottom_vec_, this->blob_top_vec_);
EXPECT_EQ(this->blob_top_->num(), 2);
EXPECT_EQ(this->blob_top_->channels(), 3);
EXPECT_EQ(this->blob_top_->height(), 2);
EXPECT_EQ(this->blob_top_->width(), 1);
EXPECT_EQ(this->blob_top_2_->num(), 2);
EXPECT_EQ(this->blob_top_2_->channels(), 3);
EXPECT_EQ(this->blob_top_2_->height(), 2);
EXPECT_EQ(this->blob_top_2_->width(), 1);
}
TYPED_TEST(ConvolutionLayerTest, TestSimpleConvolution) {
typedef typename TypeParam::Dtype Dtype;
this->blob_bottom_vec_.push_back(this->blob_bottom_2_);
this->blob_top_vec_.push_back(this->blob_top_2_);
LayerParameter layer_param;
ConvolutionParameter* convolution_param =
layer_param.mutable_convolution_param();
convolution_param->set_kernel_size(3);
convolution_param->set_stride(2);
convolution_param->set_num_output(4);
convolution_param->mutable_weight_filler()->set_type("gaussian");
convolution_param->mutable_bias_filler()->set_type("constant");
convolution_param->mutable_bias_filler()->set_value(0.1);
shared_ptr<Layer<Dtype> > layer(
new ConvolutionLayer<Dtype>(layer_param));
layer->SetUp(this->blob_bottom_vec_, this->blob_top_vec_);
layer->Forward(this->blob_bottom_vec_, this->blob_top_vec_);
// Check against reference convolution.
const Dtype* top_data;
const Dtype* ref_top_data;
caffe_conv(this->blob_bottom_, convolution_param, layer->blobs(),
this->MakeReferenceTop(this->blob_top_));
top_data = this->blob_top_->cpu_data();
ref_top_data = this->ref_blob_top_->cpu_data();
for (int i = 0; i < this->blob_top_->count(); ++i) {
EXPECT_NEAR(top_data[i], ref_top_data[i], 1e-4);
}
caffe_conv(this->blob_bottom_2_, convolution_param, layer->blobs(),
this->MakeReferenceTop(this->blob_top_2_));
top_data = this->blob_top_2_->cpu_data();
ref_top_data = this->ref_blob_top_->cpu_data();
for (int i = 0; i < this->blob_top_->count(); ++i) {
EXPECT_NEAR(top_data[i], ref_top_data[i], 1e-4);
}
}
TYPED_TEST(ConvolutionLayerTest, Test1x1Convolution) {
typedef typename TypeParam::Dtype Dtype;
LayerParameter layer_param;
ConvolutionParameter* convolution_param =
layer_param.mutable_convolution_param();
convolution_param->set_kernel_size(1);
convolution_param->set_stride(1);
convolution_param->set_num_output(4);
convolution_param->mutable_weight_filler()->set_type("gaussian");
convolution_param->mutable_bias_filler()->set_type("constant");
convolution_param->mutable_bias_filler()->set_value(0.1);
shared_ptr<Layer<Dtype> > layer(
new ConvolutionLayer<Dtype>(layer_param));
layer->SetUp(this->blob_bottom_vec_, this->blob_top_vec_);
layer->Forward(this->blob_bottom_vec_, this->blob_top_vec_);
// Check against reference convolution.
const Dtype* top_data;
const Dtype* ref_top_data;
caffe_conv(this->blob_bottom_, convolution_param, layer->blobs(),
this->MakeReferenceTop(this->blob_top_));
top_data = this->blob_top_->cpu_data();
ref_top_data = this->ref_blob_top_->cpu_data();
for (int i = 0; i < this->blob_top_->count(); ++i) {
EXPECT_NEAR(top_data[i], ref_top_data[i], 1e-4);
}
}
TYPED_TEST(ConvolutionLayerTest, TestSimpleConvolutionGroup) {
typedef typename TypeParam::Dtype Dtype;
LayerParameter layer_param;
ConvolutionParameter* convolution_param =
layer_param.mutable_convolution_param();
convolution_param->set_kernel_size(3);
convolution_param->set_stride(2);
convolution_param->set_num_output(3);
convolution_param->set_group(3);
convolution_param->mutable_weight_filler()->set_type("gaussian");
convolution_param->mutable_bias_filler()->set_type("constant");
convolution_param->mutable_bias_filler()->set_value(0.1);
shared_ptr<Layer<Dtype> > layer(
new ConvolutionLayer<Dtype>(layer_param));
layer->SetUp(this->blob_bottom_vec_, this->blob_top_vec_);
layer->Forward(this->blob_bottom_vec_, this->blob_top_vec_);
// Check against reference convolution.
const Dtype* top_data;
const Dtype* ref_top_data;
caffe_conv(this->blob_bottom_, convolution_param, layer->blobs(),
this->MakeReferenceTop(this->blob_top_));
top_data = this->blob_top_->cpu_data();
ref_top_data = this->ref_blob_top_->cpu_data();
for (int i = 0; i < this->blob_top_->count(); ++i) {
EXPECT_NEAR(top_data[i], ref_top_data[i], 1e-4);
}
}
TYPED_TEST(ConvolutionLayerTest, TestSobelConvolution) {
// Test separable convolution by computing the Sobel operator
// as a single filter then comparing the result
// as the convolution of two rectangular filters.
typedef typename TypeParam::Dtype Dtype;
// Fill bottoms with identical Gaussian noise.
shared_ptr<GaussianFiller<Dtype> > filler;
FillerParameter filler_param;
filler_param.set_value(1.);
filler.reset(new GaussianFiller<Dtype>(filler_param));
filler->Fill(this->blob_bottom_);
this->blob_bottom_2_->CopyFrom(*this->blob_bottom_);
// Compute Sobel G_x operator as 3 x 3 convolution.
LayerParameter layer_param;
ConvolutionParameter* convolution_param =
layer_param.mutable_convolution_param();
convolution_param->set_kernel_size(3);
convolution_param->set_stride(2);
convolution_param->set_num_output(1);
convolution_param->set_bias_term(false);
shared_ptr<Layer<Dtype> > layer(
new ConvolutionLayer<Dtype>(layer_param));
layer->blobs().resize(1);
layer->blobs()[0].reset(new Blob<Dtype>(1, 3, 3, 3));
Dtype* weights = layer->blobs()[0]->mutable_cpu_data();
for (int c = 0; c < 3; ++c) {
int i = c * 9; // 3 x 3 filter
weights[i + 0] = -1;
weights[i + 1] = 0;
weights[i + 2] = 1;
weights[i + 3] = -2;
weights[i + 4] = 0;
weights[i + 5] = 2;
weights[i + 6] = -1;
weights[i + 7] = 0;
weights[i + 8] = 1;
}
layer->SetUp(this->blob_bottom_vec_, this->blob_top_vec_);
layer->Forward(this->blob_bottom_vec_, this->blob_top_vec_);
// Compute Sobel G_x operator as separable 3 x 1 and 1 x 3 convolutions.
// (1) the [1 2 1] column filter
vector<Blob<Dtype>*> sep_blob_bottom_vec;
vector<Blob<Dtype>*> sep_blob_top_vec;
shared_ptr<Blob<Dtype> > blob_sep(new Blob<Dtype>());
sep_blob_bottom_vec.push_back(this->blob_bottom_2_);
sep_blob_top_vec.push_back(this->blob_top_2_);
convolution_param->clear_kernel_size();
convolution_param->clear_stride();
convolution_param->set_kernel_h(3);
convolution_param->set_kernel_w(1);
convolution_param->set_stride_h(2);
convolution_param->set_stride_w(1);
convolution_param->set_num_output(1);
convolution_param->set_bias_term(false);
layer.reset(new ConvolutionLayer<Dtype>(layer_param));
layer->blobs().resize(1);
layer->blobs()[0].reset(new Blob<Dtype>(1, 3, 3, 1));
Dtype* weights_1 = layer->blobs()[0]->mutable_cpu_data();
for (int c = 0; c < 3; ++c) {
int i = c * 3; // 3 x 1 filter
weights_1[i + 0] = 1;
weights_1[i + 1] = 2;
weights_1[i + 2] = 1;
}
layer->SetUp(sep_blob_bottom_vec, sep_blob_top_vec);
layer->Forward(sep_blob_bottom_vec, sep_blob_top_vec);
// (2) the [-1 0 1] row filter
blob_sep->CopyFrom(*this->blob_top_2_, false, true);
sep_blob_bottom_vec.clear();
sep_blob_bottom_vec.push_back(blob_sep.get());
convolution_param->set_kernel_h(1);
convolution_param->set_kernel_w(3);
convolution_param->set_stride_h(1);
convolution_param->set_stride_w(2);
convolution_param->set_num_output(1);
convolution_param->set_bias_term(false);
layer.reset(new ConvolutionLayer<Dtype>(layer_param));
layer->blobs().resize(1);
layer->blobs()[0].reset(new Blob<Dtype>(1, 3, 1, 3));
Dtype* weights_2 = layer->blobs()[0]->mutable_cpu_data();
for (int c = 0; c < 3; ++c) {
int i = c * 3; // 1 x 3 filter
weights_2[i + 0] = -1;
weights_2[i + 1] = 0;
weights_2[i + 2] = 1;
}
layer->SetUp(sep_blob_bottom_vec, sep_blob_top_vec);
layer->Forward(sep_blob_bottom_vec, sep_blob_top_vec);
// Test equivalence of full and separable filters.
const Dtype* top_data = this->blob_top_->cpu_data();
const Dtype* sep_top_data = this->blob_top_2_->cpu_data();
for (int i = 0; i < this->blob_top_->count(); ++i) {
EXPECT_NEAR(top_data[i], sep_top_data[i], 1e-4);
}
}
TYPED_TEST(ConvolutionLayerTest, TestGradient) {
typedef typename TypeParam::Dtype Dtype;
LayerParameter layer_param;
ConvolutionParameter* convolution_param =
layer_param.mutable_convolution_param();
this->blob_bottom_vec_.push_back(this->blob_bottom_2_);
this->blob_top_vec_.push_back(this->blob_top_2_);
convolution_param->set_kernel_size(3);
convolution_param->set_stride(2);
convolution_param->set_num_output(2);
convolution_param->mutable_weight_filler()->set_type("gaussian");
convolution_param->mutable_bias_filler()->set_type("gaussian");
ConvolutionLayer<Dtype> layer(layer_param);
GradientChecker<Dtype> checker(1e-2, 1e-3);
checker.CheckGradientExhaustive(&layer, this->blob_bottom_vec_,
this->blob_top_vec_);
}
TYPED_TEST(ConvolutionLayerTest, Test1x1Gradient) {
typedef typename TypeParam::Dtype Dtype;
LayerParameter layer_param;
ConvolutionParameter* convolution_param =
layer_param.mutable_convolution_param();
this->blob_bottom_vec_.push_back(this->blob_bottom_2_);
this->blob_top_vec_.push_back(this->blob_top_2_);
convolution_param->set_kernel_size(1);
convolution_param->set_stride(1);
convolution_param->set_num_output(2);
convolution_param->mutable_weight_filler()->set_type("gaussian");
convolution_param->mutable_bias_filler()->set_type("gaussian");
ConvolutionLayer<Dtype> layer(layer_param);
GradientChecker<Dtype> checker(1e-2, 1e-3);
checker.CheckGradientExhaustive(&layer, this->blob_bottom_vec_,
this->blob_top_vec_);
}
TYPED_TEST(ConvolutionLayerTest, TestGradientGroup) {
typedef typename TypeParam::Dtype Dtype;
LayerParameter layer_param;
ConvolutionParameter* convolution_param =
layer_param.mutable_convolution_param();
convolution_param->set_kernel_size(3);
convolution_param->set_stride(2);
convolution_param->set_num_output(3);
convolution_param->set_group(3);
convolution_param->mutable_weight_filler()->set_type("gaussian");
convolution_param->mutable_bias_filler()->set_type("gaussian");
ConvolutionLayer<Dtype> layer(layer_param);
GradientChecker<Dtype> checker(1e-2, 1e-3);
checker.CheckGradientExhaustive(&layer, this->blob_bottom_vec_,
this->blob_top_vec_);
}
#ifdef USE_CUDNN
template <typename Dtype>
class CuDNNConvolutionLayerTest : public GPUDeviceTest<Dtype> {
protected:
CuDNNConvolutionLayerTest()
: blob_bottom_(new Blob<Dtype>(2, 3, 6, 4)),
blob_bottom_2_(new Blob<Dtype>(2, 3, 6, 4)),
blob_top_(new Blob<Dtype>()),
blob_top_2_(new Blob<Dtype>()) {}
virtual void SetUp() {
// fill the values
FillerParameter filler_param;
filler_param.set_value(1.);
GaussianFiller<Dtype> filler(filler_param);
filler.Fill(this->blob_bottom_);
filler.Fill(this->blob_bottom_2_);
blob_bottom_vec_.push_back(blob_bottom_);
blob_top_vec_.push_back(blob_top_);
}
virtual ~CuDNNConvolutionLayerTest() {
delete blob_bottom_;
delete blob_bottom_2_;
delete blob_top_;
delete blob_top_2_;
}
virtual Blob<Dtype>* MakeReferenceTop(Blob<Dtype>* top) {
this->ref_blob_top_.reset(new Blob<Dtype>());
this->ref_blob_top_->ReshapeLike(*top);
return this->ref_blob_top_.get();
}
Blob<Dtype>* const blob_bottom_;
Blob<Dtype>* const blob_bottom_2_;
Blob<Dtype>* const blob_top_;
Blob<Dtype>* const blob_top_2_;
shared_ptr<Blob<Dtype> > ref_blob_top_;
vector<Blob<Dtype>*> blob_bottom_vec_;
vector<Blob<Dtype>*> blob_top_vec_;
};
TYPED_TEST_CASE(CuDNNConvolutionLayerTest, TestDtypes);
TYPED_TEST(CuDNNConvolutionLayerTest, TestSetupCuDNN) {
this->blob_bottom_vec_.push_back(this->blob_bottom_2_);
this->blob_top_vec_.push_back(this->blob_top_2_);
LayerParameter layer_param;
ConvolutionParameter* convolution_param =
layer_param.mutable_convolution_param();
convolution_param->set_kernel_size(3);
convolution_param->set_stride(2);
convolution_param->set_num_output(4);
this->blob_bottom_vec_.push_back(this->blob_bottom_2_);
this->blob_top_vec_.push_back(this->blob_top_2_);
shared_ptr<Layer<TypeParam> > layer(
new CuDNNConvolutionLayer<TypeParam>(layer_param));
layer->SetUp(this->blob_bottom_vec_, this->blob_top_vec_);
EXPECT_EQ(this->blob_top_->num(), 2);
EXPECT_EQ(this->blob_top_->channels(), 4);
EXPECT_EQ(this->blob_top_->height(), 2);
EXPECT_EQ(this->blob_top_->width(), 1);
EXPECT_EQ(this->blob_top_2_->num(), 2);
EXPECT_EQ(this->blob_top_2_->channels(), 4);
EXPECT_EQ(this->blob_top_2_->height(), 2);
EXPECT_EQ(this->blob_top_2_->width(), 1);
// setting group should not change the shape
convolution_param->set_num_output(3);
convolution_param->set_group(3);
layer.reset(new CuDNNConvolutionLayer<TypeParam>(layer_param));
layer->SetUp(this->blob_bottom_vec_, this->blob_top_vec_);
EXPECT_EQ(this->blob_top_->num(), 2);
EXPECT_EQ(this->blob_top_->channels(), 3);
EXPECT_EQ(this->blob_top_->height(), 2);
EXPECT_EQ(this->blob_top_->width(), 1);
EXPECT_EQ(this->blob_top_2_->num(), 2);
EXPECT_EQ(this->blob_top_2_->channels(), 3);
EXPECT_EQ(this->blob_top_2_->height(), 2);
EXPECT_EQ(this->blob_top_2_->width(), 1);
}
TYPED_TEST(CuDNNConvolutionLayerTest, TestSimpleConvolutionCuDNN) {
this->blob_bottom_vec_.push_back(this->blob_bottom_2_);
this->blob_top_vec_.push_back(this->blob_top_2_);
LayerParameter layer_param;
ConvolutionParameter* convolution_param =
layer_param.mutable_convolution_param();
convolution_param->set_kernel_size(3);
convolution_param->set_stride(2);
convolution_param->set_num_output(4);
convolution_param->mutable_weight_filler()->set_type("gaussian");
convolution_param->mutable_bias_filler()->set_type("constant");
convolution_param->mutable_bias_filler()->set_value(0.1);
shared_ptr<Layer<TypeParam> > layer(
new CuDNNConvolutionLayer<TypeParam>(layer_param));
layer->SetUp(this->blob_bottom_vec_, this->blob_top_vec_);
layer->Forward(this->blob_bottom_vec_, this->blob_top_vec_);
// Check against reference convolution.
const TypeParam* top_data;
const TypeParam* ref_top_data;
caffe_conv(this->blob_bottom_, convolution_param, layer->blobs(),
this->MakeReferenceTop(this->blob_top_));
top_data = this->blob_top_->cpu_data();
ref_top_data = this->ref_blob_top_->cpu_data();
for (int i = 0; i < this->blob_top_->count(); ++i) {
EXPECT_NEAR(top_data[i], ref_top_data[i], 1e-4);
}
caffe_conv(this->blob_bottom_2_, convolution_param, layer->blobs(),
this->MakeReferenceTop(this->blob_top_2_));
top_data = this->blob_top_2_->cpu_data();
ref_top_data = this->ref_blob_top_->cpu_data();
for (int i = 0; i < this->blob_top_->count(); ++i) {
EXPECT_NEAR(top_data[i], ref_top_data[i], 1e-4);
}
}
TYPED_TEST(CuDNNConvolutionLayerTest, TestSimpleConvolutionGroupCuDNN) {
LayerParameter layer_param;
ConvolutionParameter* convolution_param =
layer_param.mutable_convolution_param();
convolution_param->set_kernel_size(3);
convolution_param->set_stride(2);
convolution_param->set_num_output(3);
convolution_param->set_group(3);
convolution_param->mutable_weight_filler()->set_type("gaussian");
convolution_param->mutable_bias_filler()->set_type("constant");
convolution_param->mutable_bias_filler()->set_value(0.1);
shared_ptr<Layer<TypeParam> > layer(
new CuDNNConvolutionLayer<TypeParam>(layer_param));
layer->SetUp(this->blob_bottom_vec_, this->blob_top_vec_);
layer->Forward(this->blob_bottom_vec_, this->blob_top_vec_);
// Check against reference convolution.
const TypeParam* top_data;
const TypeParam* ref_top_data;
caffe_conv(this->blob_bottom_, convolution_param, layer->blobs(),
this->MakeReferenceTop(this->blob_top_));
top_data = this->blob_top_->cpu_data();
ref_top_data = this->ref_blob_top_->cpu_data();
for (int i = 0; i < this->blob_top_->count(); ++i) {
EXPECT_NEAR(top_data[i], ref_top_data[i], 1e-4);
}
}
TYPED_TEST(CuDNNConvolutionLayerTest, TestSobelConvolutionCuDNN) {
// Test separable convolution by computing the Sobel operator
// as a single filter then comparing the result
// as the convolution of two rectangular filters.
// Fill bottoms with identical Gaussian noise.
shared_ptr<GaussianFiller<TypeParam> > filler;
FillerParameter filler_param;
filler_param.set_value(1.);
filler.reset(new GaussianFiller<TypeParam>(filler_param));
filler->Fill(this->blob_bottom_);
this->blob_bottom_2_->CopyFrom(*this->blob_bottom_);
// Compute Sobel G_x operator as 3 x 3 convolution.
LayerParameter layer_param;
ConvolutionParameter* convolution_param =
layer_param.mutable_convolution_param();
convolution_param->set_kernel_size(3);
convolution_param->set_stride(2);
convolution_param->set_num_output(1);
convolution_param->set_bias_term(false);
shared_ptr<Layer<TypeParam> > layer(
new CuDNNConvolutionLayer<TypeParam>(layer_param));
layer->blobs().resize(1);
layer->blobs()[0].reset(new Blob<TypeParam>(1, 3, 3, 3));
TypeParam* weights = layer->blobs()[0]->mutable_cpu_data();
for (int c = 0; c < 3; ++c) {
int i = c * 9; // 3 x 3 filter
weights[i + 0] = -1;
weights[i + 1] = 0;
weights[i + 2] = 1;
weights[i + 3] = -2;
weights[i + 4] = 0;
weights[i + 5] = 2;
weights[i + 6] = -1;
weights[i + 7] = 0;
weights[i + 8] = 1;
}
layer->SetUp(this->blob_bottom_vec_, this->blob_top_vec_);
layer->Forward(this->blob_bottom_vec_, this->blob_top_vec_);
// Compute Sobel G_x operator as separable 3 x 1 and 1 x 3 convolutions.
// (1) the [1 2 1] column filter
vector<Blob<TypeParam>*> sep_blob_bottom_vec;
vector<Blob<TypeParam>*> sep_blob_top_vec;
shared_ptr<Blob<TypeParam> > blob_sep(new Blob<TypeParam>());
sep_blob_bottom_vec.push_back(this->blob_bottom_2_);
sep_blob_top_vec.push_back(this->blob_top_2_);
convolution_param->clear_kernel_size();
convolution_param->clear_stride();
convolution_param->set_kernel_h(3);
convolution_param->set_kernel_w(1);
convolution_param->set_stride_h(2);
convolution_param->set_stride_w(1);
convolution_param->set_num_output(1);
convolution_param->set_bias_term(false);
layer.reset(new CuDNNConvolutionLayer<TypeParam>(layer_param));
layer->blobs().resize(1);
layer->blobs()[0].reset(new Blob<TypeParam>(1, 3, 3, 1));
TypeParam* weights_1 = layer->blobs()[0]->mutable_cpu_data();
for (int c = 0; c < 3; ++c) {
int i = c * 3; // 3 x 1 filter
weights_1[i + 0] = 1;
weights_1[i + 1] = 2;
weights_1[i + 2] = 1;
}
layer->SetUp(sep_blob_bottom_vec, sep_blob_top_vec);
layer->Forward(sep_blob_bottom_vec, sep_blob_top_vec);
// (2) the [-1 0 1] row filter
blob_sep->CopyFrom(*this->blob_top_2_, false, true);
sep_blob_bottom_vec.clear();
sep_blob_bottom_vec.push_back(blob_sep.get());
convolution_param->set_kernel_h(1);
convolution_param->set_kernel_w(3);
convolution_param->set_stride_h(1);
convolution_param->set_stride_w(2);
convolution_param->set_num_output(1);
convolution_param->set_bias_term(false);
layer.reset(new CuDNNConvolutionLayer<TypeParam>(layer_param));
layer->blobs().resize(1);
layer->blobs()[0].reset(new Blob<TypeParam>(1, 3, 1, 3));
TypeParam* weights_2 = layer->blobs()[0]->mutable_cpu_data();
for (int c = 0; c < 3; ++c) {
int i = c * 3; // 1 x 3 filter
weights_2[i + 0] = -1;
weights_2[i + 1] = 0;
weights_2[i + 2] = 1;
}
layer->SetUp(sep_blob_bottom_vec, sep_blob_top_vec);
layer->Forward(sep_blob_bottom_vec, sep_blob_top_vec);
// Test equivalence of full and separable filters.
const TypeParam* top_data = this->blob_top_->cpu_data();
const TypeParam* sep_top_data = this->blob_top_2_->cpu_data();
for (int i = 0; i < this->blob_top_->count(); ++i) {
EXPECT_NEAR(top_data[i], sep_top_data[i], 1e-4);
}
}
TYPED_TEST(CuDNNConvolutionLayerTest, TestGradientCuDNN) {
LayerParameter layer_param;
ConvolutionParameter* convolution_param =
layer_param.mutable_convolution_param();
this->blob_bottom_vec_.push_back(this->blob_bottom_2_);
this->blob_top_vec_.push_back(this->blob_top_2_);
convolution_param->set_kernel_size(3);
convolution_param->set_stride(2);
convolution_param->set_num_output(2);
convolution_param->mutable_weight_filler()->set_type("gaussian");
convolution_param->mutable_bias_filler()->set_type("gaussian");
CuDNNConvolutionLayer<TypeParam> layer(layer_param);
GradientChecker<TypeParam> checker(1e-2, 1e-3);
checker.CheckGradientExhaustive(&layer, this->blob_bottom_vec_,
this->blob_top_vec_);
}
TYPED_TEST(CuDNNConvolutionLayerTest, TestGradientGroupCuDNN) {
LayerParameter layer_param;
ConvolutionParameter* convolution_param =
layer_param.mutable_convolution_param();
convolution_param->set_kernel_size(3);
convolution_param->set_stride(2);
convolution_param->set_num_output(3);
convolution_param->set_group(3);
convolution_param->mutable_weight_filler()->set_type("gaussian");
convolution_param->mutable_bias_filler()->set_type("gaussian");
CuDNNConvolutionLayer<TypeParam> layer(layer_param);
GradientChecker<TypeParam> checker(1e-2, 1e-3);
checker.CheckGradientExhaustive(&layer, this->blob_bottom_vec_,
this->blob_top_vec_);
}
#endif
} // namespace caffe
| [
"s9xie@eng.ucsd.edu"
] | s9xie@eng.ucsd.edu |
77dd233e6886cead045beb4d009189df6ac6a5fc | 4cd32ca72816504c5e00769cf8e6fc38b64081bd | /BaseProject/Game/Paddle.hpp | a3ad9e9313dba57716a24eeee7e3161178d767fe | [] | no_license | Millsy242/Pong | bdebf6eb22ed614e4e183e87506bb3e5e89dea88 | adb58ee775a7d5eab78c8abd4c13be6a40d0df41 | refs/heads/master | 2020-12-20T09:18:19.570470 | 2020-02-04T18:00:23 | 2020-02-04T18:00:23 | 236,025,670 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,584 | hpp | //
// Paddle.hpp
// Pong
//
// Created by Daniel Harvey on 12/01/2020.
// Copyright © 2020 Daniel Harvey. All rights reserved.
//
#ifndef Paddle_hpp
#define Paddle_hpp
#include "Base.hpp"
class Ball;
class Paddle : public Base
{
public:
Paddle();
~Paddle();
void Start() override;
void Update() override;
void Exit() override;
void Render(std::shared_ptr<Window> window) override;
virtual void Input(std::queue<sf::Event> &events, float dt) override = 0;
void SetSize(sf::Vector2f size);
void SetPosition(sf::Vector2f Pos, bool SetStart = false);
void Move(float dt);
void Move(float moveX, float moveY, float dt);
void SetVelocity(sf::Vector2f vel);
void ResetPosition();
void SetSide(bool isleft);
bool CollwithBall(Ball *b);
virtual void Giveballdetails(sf::Vector2f bPos, sf::Vector2f bVel){};
virtual void GiveGameArea(sf::IntRect GameArea);
void setlastTouched(bool lt);
bool getOnLeft();
virtual void SetAIDifficulty(int difficulty){};
void SetPaddleSpeed(float speed);
sf::Vector2f GetVelocity();
sf::Vector2f GetPosition();
sf::Vector2f GetSize();
int score = 0;
bool isAI = false;
protected:
float PaddleSpeed = 400.f;
sf::IntRect WindowSize;
bool lastTouched = false;
bool onLeft = false;
sf::Vector2f StartPosition ={0,0};
sf::RectangleShape paddle_shape;
private:
sf::Vector2f Velocity; //speed X and speed Y
float maxVelocity = 2.f;
float friction = 0.01;
};
#endif /* Paddle_hpp */
| [
"dhmillsy6@gmail.com"
] | dhmillsy6@gmail.com |
08b46bd51dbd5b05b0ef57954b027ef8dbd6ef62 | ec90c91f17d5520a67e1fdd41ecc228877e0c5aa | /test/good/redeclare_after_if.cc | e7434cbc16947a9904bc41a1891cc3be361dde48 | [] | no_license | RyanMillares/Assignment4 | 56fa4524e75616730fe42a6f00d104c7cccd2389 | d2f5f1590a735763d8701e58eecb27ab1ce0be6f | refs/heads/master | 2023-04-30T11:59:52.051655 | 2021-05-18T10:25:39 | 2021-05-18T10:25:39 | 368,359,293 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 107 | cc | int main () {
if (0 <= 2) bool x0 = true ;
else 0 ;
int x0 = 0 ;
printInt(1);
return 0;
}
| [
"rmillares@chapman.edu"
] | rmillares@chapman.edu |
2fc3ac89f6d0ae7fdabd8e9afbb9acf196e93d2b | 084070f46fa046014d3dae7372d50f786dfd4721 | /tests/QwNodePool_test.cpp | 6ed3f29bbec665deae767e8b7a2862e2adebfa98 | [
"MIT"
] | permissive | gmh5225/message-QueueWorld | d5fa2bada5001e89b42c7ee26f5cbd6b32d93154 | 140b82c017521d13fd4292ccd5616ed7fc631bb8 | refs/heads/master | 2023-03-17T05:42:22.644476 | 2019-02-06T03:53:10 | 2019-02-06T03:53:10 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,369 | cpp | /*
Queue World is copyright (c) 2014-2018 Ross Bencina
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 "QwNodePool.h"
#include "QwSList.h"
#include "catch.hpp"
namespace {
struct TestNode{
TestNode *links_[2];
enum { LINK_INDEX_1, LINK_COUNT };
int value;
TestNode()
: value(0)
{
for (int i=0; i < LINK_COUNT; ++i)
links_[i] = nullptr;
}
};
typedef QwSList<TestNode*, TestNode::LINK_INDEX_1> TestSList;
} // end anonymous namespace
TEST_CASE("qw/node_pool", "QwNodePool single threaded test") {
size_t maxNodes = 21;
QwNodePool<TestNode> pool(maxNodes);
TestSList allocatedNodes;
for (size_t i=0; i < maxNodes; ++i) {
TestNode *n = pool.allocate();
REQUIRE(n != (TestNode*)nullptr);
allocatedNodes.push_front(n);
}
REQUIRE(pool.allocate() == (TestNode*)nullptr);
while (!allocatedNodes.empty())
pool.deallocate(allocatedNodes.pop_front());
}
/* -----------------------------------------------------------------------
Last reviewed: April 22, 2014
Last reviewed by: Ross B.
Status: OK
Comments: could add concurrent access tests, tests for ABA counter wrap-around
-------------------------------------------------------------------------- */
| [
"rossb@audiomulch.com"
] | rossb@audiomulch.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.