blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 2
247
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
57
| license_type
stringclasses 2
values | repo_name
stringlengths 4
111
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
58
| visit_date
timestamp[ns]date 2015-07-25 18:16:41
2023-09-06 10:45:08
| revision_date
timestamp[ns]date 1970-01-14 14:03:36
2023-09-06 06:22:19
| committer_date
timestamp[ns]date 1970-01-14 14:03:36
2023-09-06 06:22:19
| github_id
int64 3.89k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 25
values | gha_event_created_at
timestamp[ns]date 2012-06-07 00:51:45
2023-09-14 21:58:52
⌀ | gha_created_at
timestamp[ns]date 2008-03-27 23:40:48
2023-08-24 19:49:39
⌀ | gha_language
stringclasses 159
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 7
10.5M
| extension
stringclasses 111
values | filename
stringlengths 1
195
| text
stringlengths 7
10.5M
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b92a38327b331c2db1b029747cd566c977d3a074
|
98641c8825d8f01888aef5396a14b8583cef657d
|
/MaxOfN/MaxOfN/main.cpp
|
c96a9f317c784afc18f448c07bfc77d7c58b9d40
|
[] |
no_license
|
EvilPluto/Algorithm
|
b52c781aa62dfd9c0a521af1bd97c938b69611c3
|
1cac79299c672613874af02670bb3fd19ab2f18a
|
refs/heads/master
| 2021-01-23T04:34:19.057906
| 2017-04-30T01:31:20
| 2017-04-30T01:31:20
| 86,210,729
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,071
|
cpp
|
main.cpp
|
//
// main.cpp
// MaxOfN
//
// Created by 修海锟 on 2017/3/5.
// Copyright © 2017年 修海锟. All rights reserved.
//
#include <iostream>
using namespace std;
bool Increment(char *number) {
bool isOverflow = false;
int nLength = (int)strlen(number);
int nTakeOver = 0;
for (int i=nLength - 1; i>=0; i--) {
int nSum = number[i] - '0' + nTakeOver;
if (i == nLength - 1) {
nSum++;
}
if (nSum >= 10) {
if (i == 0) {
isOverflow = true;
break;
} else {
nSum -= 10;
nTakeOver = 1;
number[i] = '0' + nSum;
}
} else {
number[i] = '0' + nSum;
break;
}
}
return isOverflow;
}
void PrintNumber(char *number) {
bool isZero = true;
int nLength = (int)strlen(number);
for (int i=0; i<nLength; i++) {
if (isZero && number[i] != '0') {
isZero = false;
}
if (!isZero) {
printf("%c", number[i]);
}
}
printf("\t");
}
void printToNMax(int n) {
if (n <= 0) {
return;
}
char *numberChar = new char[n + 1];
memset(numberChar, '0', n);
numberChar[n] = '\0';
while (!Increment(numberChar)) {
PrintNumber(numberChar);
}
delete []numberChar;
}
void PrintToMaxRecursively(char *number, int length, int index) {
if (index == length - 1) {
PrintNumber(number);
return;
}
for (int i=0; i<10; i++) {
number[index + 1] = i + '0';
PrintToMaxRecursively(number, length, index + 1);
}
}
void PrintToMaxOfN(int n) {
if (n <= 0) {
return;
}
char *number = new char [n + 1];
number[n] = '\0';
for (int i=0; i<10; i++) {
number[0] = '0' + i;
PrintToMaxRecursively(number, n, 0);
}
}
int main(int argc, const char * argv[]) {
printToNMax(3);
PrintToMaxOfN(2);
return 0;
}
|
79518c9302db5ff1e85e5e871ce8ed13b1b986c5
|
3b38bc90f9865f2798033c9058283a730b878839
|
/db_common/db_client.h
|
1656158930e9db0e5e1746dec991cf2f28cf05ca
|
[] |
no_license
|
touseit/db_service
|
33387c0057485493c0a9df339cae15ce7498c4a4
|
8f760d710c4c83be82233ec1e55547bc57001fd7
|
refs/heads/master
| 2020-12-30T14:46:22.681372
| 2017-06-10T04:32:47
| 2017-06-10T04:32:47
| 91,091,293
| 0
| 1
| null | 2017-05-12T12:53:00
| 2017-05-12T12:53:00
| null |
UTF-8
|
C++
| false
| false
| 1,633
|
h
|
db_client.h
|
#pragma once
#include <stdint.h>
#include <string>
#include <vector>
#include "google/protobuf/message.h"
#include "db_proxy.h"
#include "db_variant.h"
namespace db
{
class CDbClient
{
public:
CDbClient(CDbProxy* pDbProxy);
virtual ~CDbClient();
bool select(uint64_t nID, const std::string& szTableName, uint32_t nTimeout, uint64_t nContext, const DbCallback& callback);
bool update(const google::protobuf::Message* pMessage);
bool update_r(const google::protobuf::Message* pMessage, uint32_t nTimeout, uint64_t nContext, const DbCallback& callback);
bool remove(uint64_t nID, const std::string& szTableName);
bool remove_r(uint64_t nID, const std::string& szTableName, uint32_t nTimeout, uint64_t nContext, const DbCallback& callback);
bool insert(const google::protobuf::Message* pMessage);
bool insert_r(const google::protobuf::Message* pMessage, uint32_t nTimeout, uint64_t nContext, const DbCallback& callback);
bool query(uint32_t nAssociateID, const std::string& szTableName, const std::string& szWhereClause, const std::vector<CDbVariant>& vecArg, uint32_t nTimeout, uint64_t nContext, const DbCallback& callback);
bool call(uint32_t nAssociateID, const std::string& szSQL, const std::vector<CDbVariant>& vecArg);
bool call_r(uint32_t nAssociateID, const std::string& szSQL, const std::vector<CDbVariant>& vecArg, uint32_t nTimeout, uint64_t nContext, const DbCallback& callback);
bool nop(uint32_t nAssociateID, uint64_t nContext, const DbCallback& callback);
bool flush(uint64_t nID, EFlushCacheType eType);
private:
CDbProxy* m_pDbProxy;
};
}
|
84ca710308e751bf34129bb6330981609a1f797e
|
28dc26683526f97a93557e58def30abb5fcdb2ba
|
/BattleTank/Source/BattleTank/Private/TankAIController.cpp
|
a7e575196f55cb5329beda5d4c21ab88e2f6be9d
|
[] |
no_license
|
geotype/04_BattleTank
|
9a34361a59806fbe6b4cce0767575e58b28a0600
|
37151ff9e574c368145d0feeb6538389bf63e95a
|
refs/heads/master
| 2021-09-01T04:44:51.515866
| 2017-12-24T22:02:56
| 2017-12-24T22:02:56
| 112,867,670
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,205
|
cpp
|
TankAIController.cpp
|
// Fill out your copyright notice in the Description page of Project Settings.
#include "TankAIController.h"
#include "Runtime/Engine/Classes/GameFramework/Actor.h"
#include "Runtime/Engine/Classes/Engine/World.h"
#include "Tank.h"
void ATankAIController::BeginPlay()
{
Super::BeginPlay();
auto AIControlledTank = Cast<ATank>(GetPawn());
if (!AIControlledTank) { UE_LOG(LogTemp, Warning, TEXT("no Tank is controlled by AI")) }
else { UE_LOG(LogTemp, Warning, TEXT("%s is controlled by AI"), *AIControlledTank->GetName()) }
auto PlayerControlledTank = GetPlayerControlledTank();
if (!PlayerControlledTank) { UE_LOG(LogTemp, Warning, TEXT("no Tank is controlled by Player")) }
else { UE_LOG(LogTemp, Warning, TEXT("%s is controlled by Player"), *PlayerControlledTank->GetName()) }
}
void ATankAIController::Tick(float DeltaTime)
{
if (GetPlayerControlledTank())
{
auto HitLocation = GetPlayerControlledTank()->GetActorLocation();
Cast<ATank>(GetPawn())->AimAt(HitLocation);
}
}
ATank* ATankAIController::GetPlayerControlledTank() const
{
auto PlayerPawn = GetWorld()->GetFirstPlayerController()->GetPawn();
if (!PlayerPawn) { return nullptr; }
return Cast<ATank>(PlayerPawn);
}
|
9e2186560980060ef21de167346e1abb22ac88f8
|
c420961cf4a9cfd5bc27380caff7938aa12d2600
|
/ICG-code/far/src/libs/scene/sampling.h
|
682a72971598f64b6298e0d1372eb0dd940712cc
|
[] |
no_license
|
ema0j/cs482-icg-pj
|
a7b2e55563279b9234168d1bd2eb63d62ac2776b
|
1e2f7e3837227069690c639abd628bec1b5b8061
|
refs/heads/master
| 2021-01-10T12:34:05.898496
| 2016-01-10T14:55:14
| 2016-01-10T14:55:14
| 49,371,122
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 5,854
|
h
|
sampling.h
|
#ifndef _SAMPLING_H_
#define _SAMPLING_H_
#include "smath.h"
#include <misc/arrays.h>
#define SAMPLINGEPSILON 0.0000001f
class Sampling {
public:
static void ConcentricDisk(const Vec2f &s, float &x, float &y) {
float r, theta;
float sx = 2*s[0] - 1;
float sy = 2*s[1] - 1;
if(sx >= -sy){
if(sx > sy){
//region 1 (7pi/4,pi/4)
r = sx;
if(sy > 0)
theta = sy/r;
else
theta = 8.0f + sy/r;
} else {
//region 2 (pi/4,3pi/4)
r = sy;
if(sx > 0)
theta = 2.0f - sx/r;
else
theta = 2.0f - sx/r;
}
} else {
if(sx <= sy){
//region 3 (3pi/4,5pi/4)
r = -sx;
if(sy > 0)
theta = 4.0f - sy/r;
else
theta = 4.0f - sy/r;
} else {
//region 4 (5pi/4,7pi/4)
r = -sy;
if(sx > 0)
theta = 6.0f - sx/r;
else
theta = 6.0f - sx/r;
}
}
theta *= (PIf/4.0f);
x = r*cosf(theta);
y = r*sinf(theta);
}
static Vec2f ConcentricDisk(const Vec2f &s) {
Vec2f uv;
ConcentricDisk(s, uv.x, uv.y);
return uv;
}
static Vec2f UniformTriangle(const Vec2f &s) {
Vec2f uv;
float su1 = sqrtf(s.x);
uv.x = 1.f - su1;
uv.y = s.y * su1;
}
static Vec3f HemisphericalDirection(const Vec2f& s, float* pdf) {
float z = s[1];
float r = sqrtf(1-z*z);
float phi = 2 * PIf * s[0];
Vec3f d(r * cosf(phi), r * sinf(phi), z);
*pdf = 1 / (2*PIf);
return d;
}
static Direction3f HemisphericalDirectionD(const Vec2f& s, float* pdf) {
float z = s[1];
float r = sqrtf(1-z*z);
float phi = 2 * PIf * s[0];
Direction3f d(r * cosf(phi), r * sinf(phi), z);
*pdf = 1 / (2*PIf);
return d;
}
static float HemisphericalDirectionPdf() {
return 1 / (2*PIf);
}
static Vec3f HemisphericalDirectionCos(const Vec2f& s, float* pdf) {
float z = sqrtf(s[1]);
float r = sqrtf(1-z*z);
float phi = 2 * PIf * s[0];
Vec3f d(r * cosf(phi), r * sinf(phi), z);
*pdf = (d[2]+SAMPLINGEPSILON) / PIf; // check for zero probability
return d;
}
static float HemisphericalDirectionCosPdf(const Vec3f& d) {
return (d[2]+SAMPLINGEPSILON) / PIf;
}
static Vec3f HemisphericalDirectionCosPower(float n, const Vec2f& s, float* pdf) {
float z = sqrtf(powf(s[1],2/(n+1)));
float r = sqrtf(1-z*z);
float phi = 2 * PIf * s[0];
Vec3f d(r * cosf(phi), r * sinf(phi), z);
*pdf = HemisphericalDirectionCosPowerPdf(n,d);
return d;
}
static float HemisphericalDirectionCosPowerPdf(float n, const Vec3f& d) {
return (n+1)*pow(d[2]+SAMPLINGEPSILON,n) / (2*PIf);
}
static float HemisphericalDirectionCosPowerPdf(float n, float cosine) {
return (n+1)*pow(cosine+SAMPLINGEPSILON,n) / (2*PIf);
}
static Direction3f HemisphericalDirectionCosD(const Vec2f& s, float* pdf) {
float z = sqrtf(s[1]);
float r = sqrtf(1-z*z);
float phi = 2 * PIf * s[0];
Direction3f d(r * cosf(phi), r * sinf(phi), z);
*pdf = (d[2]+SAMPLINGEPSILON) / PIf; // check for zero probability
return d;
}
static float HemisphericalDirectionCosPdfD(const Direction3f& d) {
return (d[2]+SAMPLINGEPSILON) / PIf;
}
static float SphericalDirectionPdf() {
return 1 / (4*PIf);
}
static Vec3f SphericalDirection(const Vec2f& s, float* pdf) {
float z = 1 - 2 * s[1];
float r = sqrtf(1-z*z);
float phi = 2 * PIf * s[0];
Vec3f d(r * cosf(phi), r * sinf(phi), z);
*pdf = 1 / (4*PIf);
return d;
}
static Direction3f SphericalDirectionD(const Vec2f& s, float* pdf) {
float z = 1 - 2 * s[1];
float r = sqrtf(1-z*z);
float phi = 2 * PIf * s[0];
Direction3f d(r * cosf(phi), r * sinf(phi), z);
*pdf = 1 / (4*PIf);
return d;
}
// this should be done outside
static Vec3f SphericalDirectionCos(const Vec3f &n, const Vec2f &s, float* pdf) {
float x, y, z;
ConcentricDisk(s,x,y);
z = sqrtf( max(0.0f, 1.0f-x*x-y*y) );
//compute pdf
Vec3f d(x,y,z);
*pdf = (fabsf(d[2])+SAMPLINGEPSILON) / (2*PIf);
//transform direction to world space
Vec3f v1,v2;
n.GetNormalized().GetXYFromZ(v1,v2);
d = Vec3f( v1.x*d.x + v2.x*d.y + n.x*d.z,
v1.y*d.x + v2.y*d.y + n.y*d.z,
v1.z*d.x + v2.z*d.y + n.z*d.z );
return d;
}
static Vec3f ConicalDirection(const Vec2f& s, float cosThetaMax, float* pdf) {
float z = 1 - s[1]*(1 - cosThetaMax);
float r = sqrtf(1-z*z);
float phi = 2 * PIf * s[0];
Vec3f d(r * cosf(phi), r * sinf(phi), z);
*pdf = 1 / (2 * PIf * (1 - cosThetaMax));
return d;
}
static Direction3f ConicalDirectionD(const Vec2f& s, float cosThetaMax, float* pdf) {
float z = 1 - s[1]*(1 - cosThetaMax);
float r = sqrtf(1-z*z);
float phi = 2 * PIf * s[0];
Direction3f d(r * cosf(phi), r * sinf(phi), z);
*pdf = 1 / (2 * PIf * (1 - cosThetaMax));
return d;
}
// from pbrt
static carray<float> ComputeStepCDF(const carray<float>& func, float* integral) {
carray<float> cdf(func.size()+1);
cdf[0] = 0;
for (uint32_t i = 1; i < cdf.size(); i++) {
cdf[i] = cdf[i-1] + func[i-1] / func.size();
}
// Transform step function integral into cdf
*integral = cdf[cdf.size()-1];
for (uint32_t i = 1; i < cdf.size(); i ++) {
cdf[i] /= *integral;
}
return cdf;
}
static float BalanceHeuristic(int nf, float fPdf, int ng, float gPdf) {
return (nf * fPdf) / (nf * fPdf + ng * gPdf);
}
static float PowerHeuristic(int nf, float fPdf, int ng, float gPdf) {
float f = nf * fPdf; float g = ng * gPdf;
return (f*f) / (f*f + g*g);
}
};
#endif
|
ab1b8239467385048858cd7ba92f5c957e701bfe
|
67a1a8e0d3f1abefd2c04e734a012a7850909c14
|
/src/communication/writer_thread.cpp
|
6b745d613d62de39dafba749f83a2e2ba2ec5ac1
|
[
"MIT"
] |
permissive
|
OSURoboticsClub/aerial_control
|
38e537016d9415ebbbfd82b78e6575e078064918
|
7139d8a00a4803e9918bb361f7a02cc48cd1c444
|
refs/heads/master
| 2021-01-17T09:15:38.852752
| 2016-06-04T02:31:19
| 2016-06-04T02:31:19
| 25,657,953
| 1
| 4
| null | 2016-04-28T05:50:56
| 2014-10-23T21:06:11
|
C++
|
UTF-8
|
C++
| false
| false
| 530
|
cpp
|
writer_thread.cpp
|
#include "communication/writer_thread.hpp"
#include "hal.h"
WriterThread::WriterThread(chibios_rt::BaseSequentialStreamInterface& stream)
: stream(stream) {
}
msg_t WriterThread::main() {
while(true) {
// Check if there is data in the buffer that has not yet been written.
while(bottom != top) {
stream.put(buffer[bottom++]);
// Wrap if the end of the buffer is reached.
if(bottom >= buffer.size()) {
bottom = 0;
}
}
// TODO(kyle): Just yield, or sleep?
yield();
}
}
|
9a3fd3ec634581f29d2a1d4983bc2486e7181965
|
7da24497832d8afafefa36db391d644e7fceef40
|
/ABC/174_E_Logs.cpp
|
c241f3f0094f076a185877e3fdb6df0684c18971
|
[] |
no_license
|
shugo256/AtCoder
|
864e70a54cb5cb8a3dddd038cb425a96aacb54bf
|
57c81746c83b11bd1373cfff8a0358af3ba67f65
|
refs/heads/master
| 2021-06-12T14:46:54.073135
| 2021-04-25T08:09:15
| 2021-04-25T08:09:15
| 180,904,626
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 597
|
cpp
|
174_E_Logs.cpp
|
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
using ll = long long;
using namespace std;
int main() {
int n;
ll k;
cin >> n >> k;
ll best = 0, a[n];
for (auto &ai:a) {
cin >> ai;
best = max(best, ai);
}
ll l = 0, r = best;
while (r - l > 1) {
ll m = (l + r + 1) / 2;
ll sum = 0;
for (auto &ai:a) {
sum += (ai - 1) / m;
}
if (sum <= k) {
r = m;
} else {
l = m;
}
}
cout << r << '\n';
return 0;
}
|
da201a9d01bf4e6f1d72751122eab663fd2a7f10
|
25297d20127cfd61cb0a8006d5e45a3b3bcf3e36
|
/homework/assignment_4/Savitch_9thEd_ch4_prob2_ModifyProb1_twoCar/main.cpp
|
e86086c0f0ecbd3f50c7f84a5fc5d46eb2824f23
|
[] |
no_license
|
pockymonsta/OmaiyeLeah_CIS5_42641
|
0e40e17529ddbaa2622ae5f7beb80db36029690c
|
d650b7987692f1751a0d49d0a0ae72736c6a4fac
|
refs/heads/master
| 2020-04-15T00:13:27.907747
| 2017-06-02T22:41:26
| 2017-06-02T22:41:26
| 83,382,367
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,815
|
cpp
|
main.cpp
|
/*
* File: main.cpp
* Author: Leah Omaiye
* Created on March 30, 2017 1:12 PM
* Purpose: Convert liters to gallons for 2 cars
*/
//System Libraries
#include <iostream> //Input - Output Library
using namespace std; //Name-space under which system libraries exist
//User Libraries
//Global Constants
const double conversion = 0.264179;
//Declare and initialize variables
char repeat;
//Function Prototypes
double mpgConvert(double litersUsed, double milesTraveled);
//Execution begins here
int main(int argc, char** argv) {
do {
double liters, miles, mpg, mpg2;
//Input data
cout << "(Car 1) How many liters of gas did you use? \n";
cin >> liters;
cout << "(Car 1) How many miles did you travel?\n";
cin >> miles;
mpg = mpgConvert(liters, miles);
//Output the transformed data
cout << "" << mpg << " miles per gallon\n" << endl;
//Input data of the 2nd car
cout << "(Car 2) How many liters of gas did you use? \n";
cin >> liters;
cout << "(Car 2) How many miles did you travel?\n";
cin >> miles;
mpg2 = mpgConvert(liters, miles);
//Output the transformed data
cout << "" << mpg2 << " miles per gallon\n" << endl;
if (mpg > mpg2) {
cout << "Car 1 had the best fuel efficiency!\n";
} else if (mpg2 < mpg) {
cout << "Car 2 had the best fuel efficiency!\n";
}
cout << "Perform calculation again? (y / n) \n";
cin >> repeat;
} while (repeat == 'y');
cout << "Exiting... \n";
//Exit stage right!
return 0;
}
double mpgConvert(double litersUsed, double milesTraveled){
double gal, mpg;
//Map inputs to outputs or process the data
gal = litersUsed * conversion;
mpg = milesTraveled / gal;
return mpg;
}
|
0b0a39415b69cff97cc1fd740d58199a2d6c1250
|
98b1e51f55fe389379b0db00365402359309186a
|
/homework_3/case_2/56/phi
|
07d15e7776d54134a747ca46effc4cbc2ad4508c
|
[] |
no_license
|
taddyb/597-009
|
f14c0e75a03ae2fd741905c4c0bc92440d10adda
|
5f67e7d3910e3ec115fb3f3dc89a21dcc9a1b927
|
refs/heads/main
| 2023-01-23T08:14:47.028429
| 2020-12-03T13:24:27
| 2020-12-03T13:24:27
| 311,713,551
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 12,050
|
phi
|
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class surfaceScalarField;
location "56";
object phi;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 3 -1 0 0 0 0];
internalField nonuniform List<scalar>
880
(
-1.82688e-05
1.82688e-05
-3.86055e-05
2.03368e-05
-5.83917e-05
1.97862e-05
-7.72453e-05
1.88537e-05
-9.48354e-05
1.75901e-05
-0.000110827
1.59918e-05
-0.000124986
1.41591e-05
-0.000136768
1.17816e-05
-0.000146506
9.73803e-06
-0.00015255
6.0439e-06
-0.000157929
5.37957e-06
3.12651e-06
-0.000161056
-2.09947e-05
3.92635e-05
-4.42429e-05
4.35849e-05
-6.68926e-05
4.24359e-05
-8.85336e-05
4.04946e-05
-0.000108791
3.78476e-05
-0.000127284
3.44849e-05
-0.000143738
3.06128e-05
-0.00015767
2.57134e-05
-0.000169448
2.15163e-05
-0.000177981
1.45769e-05
-0.000185901
1.32997e-05
2.9678e-06
-0.000185742
-2.16662e-05
6.09298e-05
-4.56431e-05
6.75617e-05
-6.88862e-05
6.56791e-05
-9.09213e-05
6.25297e-05
-0.000111357
5.82833e-05
-0.000129835
5.29627e-05
-0.000145943
4.67207e-05
-0.000159382
3.91531e-05
-0.000169514
3.16475e-05
-0.000176282
2.13456e-05
-0.000177969
1.49858e-05
1.06974e-06
-0.00017607
-2.26684e-05
8.35982e-05
-4.78838e-05
9.27771e-05
-7.25749e-05
9.03702e-05
-9.63209e-05
8.62757e-05
-0.000118673
8.06356e-05
-0.000139192
7.34816e-05
-0.000157377
6.49053e-05
-0.000172864
5.46404e-05
-0.000184799
4.35824e-05
-0.000193032
2.95792e-05
-0.000195271
1.72239e-05
-1.90146e-06
-0.000192299
-2.38294e-05
0.000107428
-5.0263e-05
0.000119211
-7.5816e-05
0.000115923
-0.000100167
0.000110627
-0.000122856
0.000103325
-0.000143578
9.42028e-05
-0.000161909
8.32369e-05
-0.000177551
7.02819e-05
-0.000189811
5.5843e-05
-0.00019888
3.86478e-05
-0.000203152
2.14959e-05
-8.10404e-07
-0.000204243
-2.56933e-05
0.000133121
-5.44716e-05
0.000147989
-8.27648e-05
0.000144216
-0.000110079
0.000137941
-0.000136028
0.000129274
-0.000160107
0.000118282
-0.000181866
0.000104996
-0.000200776
8.91916e-05
-0.000216018
7.10856e-05
-0.000227234
4.98636e-05
-0.0002327
2.69615e-05
-1.79737e-06
-0.000231713
-2.6949e-05
0.00016007
-5.73104e-05
0.00017835
-8.65065e-05
0.000173412
-0.000115011
0.000166445
-0.000141519
0.000155783
-0.000166306
0.000143068
-0.000188698
0.000127388
-0.000208456
0.000108949
-0.000225299
8.79294e-05
-0.000238657
6.32209e-05
-0.000249113
3.74182e-05
3.89275e-06
-0.000254804
-3.03569e-05
0.000190427
-6.43215e-05
0.000212315
-9.79603e-05
0.000207051
-0.000130277
0.000198762
-0.000161516
0.000187022
-0.000190776
0.000172328
-0.000218073
0.000154685
-0.000242536
0.000133412
-0.000264066
0.00010946
-0.000280943
8.00971e-05
-0.000293894
5.03697e-05
8.21483e-06
-0.000298216
-3.08456e-05
0.000221272
-6.69804e-05
0.00024845
-0.000100845
0.000240916
-0.000135732
0.000233649
-0.000167289
0.000218579
-0.000198184
0.000203223
-0.000226068
0.000182569
-0.00025158
0.000158924
-0.000275008
0.000132888
-0.000294505
9.95946e-05
-0.000313711
6.95757e-05
2.14531e-05
-0.00032695
-3.68103e-05
0.000258083
-7.70952e-05
0.000288735
-0.000118246
0.000282066
-0.000156338
0.000271741
-0.000194716
0.000256958
-0.000230176
0.000238682
-0.000265115
0.000217509
-0.000296666
0.000190475
-0.00032746
0.000163681
-0.000352869
0.000125003
-0.000377926
9.4633e-05
3.62018e-05
-0.000392675
-3.42951e-05
0.000292378
-7.88586e-05
0.000333298
-0.000118118
0.000321326
-0.000162568
0.00031619
-0.000200372
0.000294761
-0.000239453
0.000277764
-0.00027358
0.000251636
-0.000305902
0.000222796
-0.000336503
0.000194283
-0.00036362
0.00015212
-0.000393129
0.000124142
6.08976e-05
-0.000417825
-4.67157e-05
0.000339093
-9.35486e-05
0.000380131
-0.000144182
0.000371959
-0.000187755
0.000359764
-0.000234154
0.00034116
-0.00027623
0.00031984
-0.000319951
0.000295357
-0.000359686
0.000262531
-0.00040158
0.000236176
-0.000437901
0.000188441
-0.000479124
0.000165365
9.21221e-05
-0.000510348
-3.16061e-05
0.0003707
-9.04817e-05
0.000439007
-0.000136097
0.000417575
-0.000196391
0.000420058
-0.000242571
0.00038734
-0.000291892
0.000369161
-0.000332141
0.000335606
-0.000370378
0.000300768
-0.000406068
0.000271867
-0.000438974
0.000221347
-0.000477018
0.000203409
0.000129049
-0.000513945
-6.87184e-05
0.000439418
-0.000117707
0.000487995
-0.000178824
0.000478692
-0.000224726
0.00046596
-0.000277406
0.00044002
-0.000326259
0.000418015
-0.000377785
0.000387132
-0.000426224
0.000349206
-0.000478224
0.000323867
-0.000526003
0.000269126
-0.000582803
0.000260209
0.000180887
-0.000634641
4.9096e-06
0.000434508
-8.9511e-05
0.000582416
-0.000149943
0.000539123
-0.000241035
0.000557052
-0.000302313
0.000501298
-0.000362924
0.000478625
-0.000407998
0.000432206
-0.000446792
0.000387999
-0.000480818
0.000357894
-0.000510828
0.000299136
-0.000544564
0.000293945
0.000219597
-0.000583274
-0.000139814
0.000574323
-0.00016096
0.000603562
-0.00022408
0.000602244
-0.000266382
0.000599354
-0.000317676
0.000552592
-0.0003763
0.000537249
-0.000433381
0.000489288
-0.000490534
0.000445153
-0.000548381
0.000415741
-0.000603182
0.000353937
-0.000665178
0.00035594
0.000283688
-0.000729269
0.000116155
0.000458167
-8.45651e-05
0.000804282
-0.000203336
0.000721014
-0.000334369
0.000730387
-0.000418405
0.000636628
-0.000477022
0.000595866
-0.000520128
0.000532394
-0.000545786
0.00047081
-0.000567121
0.000437077
-0.000578543
0.000365359
-0.000581458
0.000358856
0.00029513
-0.000592901
0.000149356
0.000308811
0.000153021
0.000800618
6.31267e-05
0.000810908
-0.000125873
0.000919387
-0.000227274
0.000738028
-0.000359715
0.000728308
-0.00045531
0.000627988
-0.000539073
0.000554574
-0.000608588
0.000506591
-0.000665065
0.000421836
-0.000718308
0.000412099
0.000350382
-0.000773559
-0.001422
0.00173081
-0.00155918
0.000937798
-0.001704
0.000955726
-0.00155293
0.000768316
-0.00147492
0.000660014
-0.00129747
0.000550866
-0.0011745
0.000505011
-0.0010194
0.000399477
-0.000893101
0.000380292
-0.000766249
0.000294985
-0.000630963
0.000276812
0.000248689
-0.000529271
0.00173081
0.00266861
0.00362434
0.00439265
0.00505267
0.00560353
0.00610855
0.00650802
0.00688831
0.0071833
0.00746011
0.0077088
-0.000130589
5.72879e-05
-8.77546e-05
-0.000103371
2.59224e-05
-5.31402e-05
-8.64469e-05
-1.89699e-06
-1.50276e-05
-6.96113e-05
-2.36272e-05
6.7915e-06
-5.31667e-05
-4.11512e-05
2.47067e-05
-3.54039e-05
-5.43599e-05
3.6597e-05
-1.70868e-05
-6.28479e-05
4.45309e-05
-6.03831e-05
4.32963e-05
-0.000148079
1.96245e-05
-0.000117695
-4.46095e-06
-9.8116e-05
-2.14764e-05
-7.87699e-05
-4.29733e-05
-6.02675e-05
-5.96536e-05
-4.02014e-05
-7.4426e-05
-1.94349e-05
-8.36144e-05
-7.98181e-05
-0.000159293
2.84659e-06
-0.000142043
-2.171e-05
-0.000123324
-4.01963e-05
-0.000102209
-6.40879e-05
-7.91923e-05
-8.26704e-05
-5.32087e-05
-0.00010041
-2.59033e-05
-0.00011092
-0.000105721
-0.000176016
-1.34364e-05
-0.000158911
-3.88158e-05
-0.000139012
-6.00946e-05
-0.000116156
-8.69445e-05
-9.07691e-05
-0.000108057
-6.12999e-05
-0.000129879
-3.00581e-05
-0.000142162
-0.000135779
-0.000197209
-2.047e-05
-0.000184533
-5.14924e-05
-0.000167436
-7.71917e-05
-0.000142549
-0.000111831
-0.000114289
-0.000136317
-7.76411e-05
-0.000166526
-3.89682e-05
-0.000180834
-0.000174748
-0.000224218
-2.79653e-05
-0.000211035
-6.46747e-05
-0.000193083
-9.51441e-05
-0.00016601
-0.000138903
-0.000134632
-0.000167696
-9.22419e-05
-0.000208917
-4.69526e-05
-0.000226124
-0.0002217
-0.0002562
-2.6569e-05
-0.000246616
-7.42587e-05
-0.00023349
-0.00010827
-0.000204459
-0.000167935
-0.000171423
-0.000200732
-0.000118696
-0.000261643
-6.27922e-05
-0.000282027
-0.000284492
-0.00029909
-2.56947e-05
-0.000289824
-8.35247e-05
-0.000276746
-0.000121349
-0.000245874
-0.000198807
-0.000209462
-0.000237143
-0.000147471
-0.000323635
-8.02981e-05
-0.0003492
-0.00036479
-0.000340699
-1.1945e-05
-0.000338817
-8.54069e-05
-0.000336697
-0.000123469
-0.000307268
-0.000228235
-0.000274795
-0.000269617
-0.00019832
-0.000400109
-0.00011615
-0.000431371
-0.00048094
-0.000407368
2.74825e-06
-0.000408092
-8.46832e-05
-0.000409733
-0.000121828
-0.000382143
-0.000255825
-0.000349978
-0.000301782
-0.000261869
-0.000488218
-0.000162767
-0.000530473
-0.000643707
-0.000450153
3.50759e-05
-0.000467247
-6.7589e-05
-0.000493573
-9.55011e-05
-0.000481442
-0.000267957
-0.000474131
-0.000309093
-0.000376306
-0.000586043
-0.000265528
-0.00064125
-0.000909235
-0.000550992
7.57192e-05
-0.000574561
-4.40192e-05
-0.000613268
-5.67948e-05
-0.000615694
-0.000265531
-0.000628034
-0.000296753
-0.000537401
-0.000676676
-0.000424596
-0.000754055
-0.00133383
-0.000567503
0.000129277
-0.000619356
7.83369e-06
-0.000704542
2.83912e-05
-0.000759652
-0.000210421
-0.000862331
-0.000194074
-0.00082839
-0.000710617
-0.000796594
-0.000785851
-0.00213043
-0.00070687
0.000201507
-0.000770889
7.18522e-05
-0.000879637
0.00013714
-0.000973098
-0.00011696
-0.00115119
-1.59852e-05
-0.00123669
-0.00062511
-0.00137456
-0.000647986
-0.00350498
-0.000641014
0.000259246
-0.000724087
0.000154925
-0.000873975
0.000287028
-0.0010721
8.11626e-05
-0.00143284
0.000344761
-0.00172718
-0.000330778
-0.00194443
-0.000430733
-0.00544941
-0.000810506
0.000340483
-0.000911283
0.000255702
-0.00105074
0.000426485
-0.00125221
0.000282638
-0.00148941
0.000581956
-0.0017603
-5.98904e-05
-0.00142503
-0.000766
-0.00687444
-0.000578441
0.000326024
-0.000623525
0.000300786
-0.000667537
0.000470497
-0.000884974
0.000500075
-0.00115797
0.000854952
-0.00153709
0.000319234
-0.00058106
-0.00172203
-0.0074555
-0.000825692
0.000378157
-0.000911669
0.000386763
-0.000984491
0.000543318
-0.00113588
0.000651463
-0.0010727
0.00079177
-0.00119198
0.000438519
-0.000175075
-0.00273894
-0.00763058
-0.000320966
0.000169852
-0.000204063
0.00026986
0.000236904
0.000102351
0.000642074
0.000246293
0.00142926
4.58559e-06
0.00227642
-0.000408641
0.00196136
-0.00242388
-0.00566922
0.00787865
0.00814851
0.00825086
0.00849716
0.00850174
0.0080931
0.00566922
-2.11343e-06
2.11343e-06
-4.06213e-06
1.94871e-06
-5.24332e-06
1.18119e-06
-5.57933e-06
3.36013e-07
-5.00896e-06
-5.70377e-07
-3.70717e-06
-1.30179e-06
-1.86703e-06
-1.84013e-06
-1.86703e-06
-2.51941e-06
4.63284e-06
-4.79944e-06
4.22873e-06
-6.14183e-06
2.52358e-06
-6.4261e-06
6.20284e-07
-5.71586e-06
-1.28062e-06
-4.21192e-06
-2.80573e-06
-2.11905e-06
-3.933e-06
-3.98609e-06
-3.79753e-06
8.43037e-06
-7.09323e-06
7.52443e-06
-8.9245e-06
4.35485e-06
-9.3683e-06
1.06409e-06
-8.29289e-06
-2.35603e-06
-6.07625e-06
-5.02237e-06
-3.04967e-06
-6.95958e-06
-7.03576e-06
-4.60067e-06
1.3031e-05
-8.44798e-06
1.13717e-05
-1.04239e-05
6.33082e-06
-1.0552e-05
1.19217e-06
-9.1645e-06
-3.74356e-06
-6.6506e-06
-7.53627e-06
-3.31652e-06
-1.02937e-05
-1.03523e-05
-8.69275e-06
2.17238e-05
-1.52172e-05
1.78961e-05
-1.79997e-05
9.11331e-06
-1.80881e-05
1.2806e-06
-1.54641e-05
-6.3675e-06
-1.10648e-05
-1.19356e-05
-5.48911e-06
-1.58694e-05
-1.58414e-05
-1.08627e-05
3.25865e-05
-1.85446e-05
2.5578e-05
-2.14451e-05
1.20138e-05
-2.07391e-05
5.74631e-07
-1.74439e-05
-9.66273e-06
-1.23934e-05
-1.69861e-05
-6.11383e-06
-2.21489e-05
-2.19552e-05
-2.41413e-05
5.67278e-05
-3.74638e-05
3.89005e-05
-3.94256e-05
1.39756e-05
-3.65786e-05
-2.27246e-06
-2.97002e-05
-1.65411e-05
-2.05379e-05
-2.61484e-05
-1.00388e-05
-3.2648e-05
-3.1994e-05
-3.10268e-05
-4.52665e-05
-4.63184e-05
-4.17994e-05
-3.36338e-05
-2.31852e-05
-1.13023e-05
)
;
boundaryField
{
movingWall
{
type calculated;
value uniform 0;
}
fixedWalls
{
type calculated;
value uniform 0;
}
frontAndBack
{
type empty;
value nonuniform List<scalar> 0();
}
}
// ************************************************************************* //
|
|
0f5a685e858a56edcb55e34c29573892bb9f9673
|
61b774358c73aa15211b1efa08d839d385fd1023
|
/Player Loadouts/Raw Loadouts/WIP_Toas_MidnightOil_blufor/config.hpp
|
fc0a15519957fe6b03b58499d4e2828bf565fe9a
|
[] |
no_license
|
ARCOMM/Loadouts
|
da9f50b44c92dcd0f4508033f0b4cfd8400ab4f9
|
26b85c1b80215edc08bb4f0d228011d464efad36
|
refs/heads/loadout_rework
| 2021-05-04T01:05:10.982434
| 2020-02-10T10:39:46
| 2020-02-10T10:39:46
| 71,139,986
| 2
| 4
| null | 2016-12-23T19:44:53
| 2016-10-17T13:11:22
|
SQF
|
UTF-8
|
C++
| false
| false
| 16,043
|
hpp
|
config.hpp
|
class CfgARCMF {
/*
-----------------------------------------------------------------------------------------------------------------
GENERAL CONFIGURATION
Description: This is the section where you can define general settings for the mission.
-----------------------------------------------------------------------------------------------------------------
*/
class General {
// 0: Time is not frozen
// 1: Time is frozen indefinitely
// 2: Time is frozen only during briefing stage
freezeTime = 0;
};
/*
-----------------------------------------------------------------------------------------------------------------
BRIEFING CONFIGURATION
Description: This is the section where you define the text content for the briefing on each team.
Note: Each text element gets placed on its own line.
Warning: You must wrap every line in quotes, eg. mission[] = {"This is your mission"};
-----------------------------------------------------------------------------------------------------------------
*/
class Briefing {
class BLUFOR {
situation[] = {
"-- BULWARK PRIORITY RECORD : 03825B-02 --",
"|| ENCRYPTION CODE: OASIS",
"|| PUBLIC KEY: N/A",
"|| REPORTED LOCATION: USS Valor",
"|| SUBJECT: Retreat Order: //REDACTED//",
"|| CLASSIFICATION: Rear Admiral Carter's situation report ",
"-----------------------RECORD START------------------------",
"Ladies and Gentleman this is Captain Andrew Carter. I am only going to say this once so listen up. A lot has happened within the last 48 hours. We have fire damage on multiple decks, most of our electronic systems are completely fried and we are now officially dead in the water. Our strike group is in shambles and we are missing 4 destroyers. We are on the backfoot here. As of two hours ago we lost contact with ground teams as we were sounding a general retreat. What have no way to confirm the message was received, or the location of any ground teams. From what we can tell they are scattered with short range radios at their disposal. We can only hope they are safe and still combat effective.",
"With teams active in the AO, our fight is not over. As of right now I am launching a light airborne QRF to find and support our ground teams. Once our airborne units are in contact with the ground teams, we can move onto the operation at hand. Ground teams are to regroup and assault a Bulwark staging area. This staging area is set up in an abandoned FOB left behind by the islands previous government. Recon shows that the staging area should be home to useful supplies for both the ground team and the USS Valor. Teams should resupply and support the logistics helo as they lift any useful containers they can find. Engineering is telling me we only need two. Once the first crate away, ground teams are free to move on to the next objective as soon as they are resupplied.",
"Moving farther south, we have gotten reports that the USS Fortune has run aground. We had scattered radio contact from the crew 30 or so minutes ago. Several deck crews have survived the impact and have made landfall down the coast. We fear they have been captured by Bulwark. To our knowledge they have been taken to a local villa in the area. We believe that Bulwark soldiers are held up in this villa awaiting extract. It would seem that this anomaly has done just as much damage to them, as its done to us. Neutralize all contacts in the compound and get that deck crew out of there.",
"Now the last objective is fairly simple. From the villa we are to move to our primary extract point. We are staging our extraction at a hospital to the south. We expect there is heavy Bulwark contact in the area holding some civilians at the local hospital. If we can clear it, we will be able to extract our ground teams to the Valor, taking with us any captured or wounded civilians.",
"Before we launch this mission, I think it is worth noting that Bulwark still has a strong grip on the island. The artifact did some damage to their command structure, but they are very quickly mobilizing. We believe they will be attempting to pull their northern forces south; regrouping at the Selatan military base to the south. We can expect convoys being routed from this northern airfield, so move as quick as we can. A MH-60 knighthawk and a AH-6 littlebird will be escorting our logistics birds, to keep them off our ass. Supply is limited to all aircraft so make good use of any resources we find. ROE is full open here people, but take any prisoners if we can. We need intel, and I want Bulwark to answer for the loss of half our carrier group. Between the Villa and extraction point, there seems to be a downed Bulwark bird. Take any prisoners and any important crates we can find.",
"That is all I have for now. I want all hands on deck and everyone at their assigned post. This is not a drill gentleman… We are at war.",
" -----------------------RECORD END------------------------ "
};
mission[] = {
"- Rally all friendly ground forces (2 minute briefing stage)",
"- Rearm and sling load any useful cargo containers (2 out of 3 required)(Will effect resupply of aircraft)",
"- Find and extract USS Fortune deck crew",
"- Secure Bulwark crashsite and extract survivors/cargo",
"- Extract previously captured citizens",
"- Search for additional civilians and extract at Primary Extraction point"
};
friendlyForces[] = {
"CBRN Ground teams",
"USS Valor support helicopters"
};
enemyForces[] = {
"- Bulwarks core PMC (Stark black NBC suit)",
};
commandersIntent[] = {};
movementPlan[] = {};
fireSupportPlan[] = {};
specialTasks[] = {
"As of right now we are at war with Bulwark. That being said we are in no fighting condition. Collect the nessesary supplies to repair the valor. If possible, we need to capture any surrendered forces, and rescue any wounded ground teams.",
};
logistics[] = {
"-- Alpha --",
"x1 M1165 GMV (M134)",
"x1 HEMTT Transport",
"-- Bravo --",
"x3 M1151 (Unarmed)",
"x1 M1151 (M2)",
"-- Charlie --",
"x1 M1151 (M2)",
"x1 HEMTT Transport",
"-- Pilots --",
"x1 CH-53 (To be used for sling loading)",
"x1 MH-47 (Backup transport for Phantom or Raptor)",
"x1 MH-60S 'Knighthawk' x4 Pylons (x36 HERockets, 2400 30mm) (Unlocked after first container arrives at Valor + Pilot and copilot required)",
"x1 AH-6M (325/2000* 50. BMG, and 5/19* HE Rockets) (To be used as replacement for MH-60 if uncrewed)",
"*Vehicle Resupply at the USS Valor will be based on conatiners secured by Phantom. (Ammo container = Vehicle ammo truck, Fuel container = Fuel truck, Cargo container = Repair truck)"
};
};
class OPFOR {
situation[] = {};
mission[] = {};
friendlyForces[] = {};
enemyForces[] = {};
commandersIntent[] = {};
movementPlan[] = {};
fireSupportPlan[] = {};
specialTasks[] = {};
logistics[] = {};
};
class INDFOR {
situation[] = {};
mission[] = {};
friendlyForces[] = {};
enemyForces[] = {};
commandersIntent[] = {};
movementPlan[] = {};
fireSupportPlan[] = {};
specialTasks[] = {};
logistics[] = {};
};
class CIVILIAN {
situation[] = {};
mission[] = {};
friendlyForces[] = {};
enemyForces[] = {};
commandersIntent[] = {};
movementPlan[] = {};
fireSupportPlan[] = {};
specialTasks[] = {};
logistics[] = {};
};
class GAME_MASTER {
situation[] = {};
mission[] = {};
friendlyForces[] = {};
enemyForces[] = {};
commandersIntent[] = {};
movementPlan[] = {};
fireSupportPlan[] = {};
specialTasks[] = {};
logistics[] = {};
};
};
/*
-----------------------------------------------------------------------------------------------------------------
MARKER CONFIGURATION
Description: This is the section where you define the settings for group map markers.
-----------------------------------------------------------------------------------------------------------------
*/
class Markers {
class BLUFOR {
enableGroupMarkers = false;
};
class OPFOR {
enableGroupMarkers = true;
};
class INDFOR {
enableGroupMarkers = true;
};
};
/*
-----------------------------------------------------------------------------------------------------------------
ACRE RADIO CONFIGURATION
Description: This is the section where you define which radios particular loadouts get for each side.
Notes:
1. If you want a radio to be assigned to all units, put "all".
2. Possible language values are "english", "greek" and "russian".
-----------------------------------------------------------------------------------------------------------------
*/
class ACRE {
class BLUFOR {
languages[] = {"english","russian","greek"};
AN_PRC_343[] = {"co", "dc", "ftl", "vc", "mmgl", "matl", "m", "cp", "p"};
AN_PRC_148[] = {};
AN_PRC_152[] = {"cp", "p", "fac"};
AN_PRC_117F[] = {};
AN_PRC_77[] = {};
};
class OPFOR {
languages[] = {"english","russian","greek"};
AN_PRC_343[] = {"all"};
AN_PRC_148[] = {"co", "dc", "ftl", "vc", "mmgl", "matl", "fac", "m"};
AN_PRC_152[] = {"co", "dc", "cp", "p", "vc", "mmgl", "matl", "mtrl", "fac"};
AN_PRC_117F[] = {};
AN_PRC_77[] = {};
};
class INDFOR {
languages[] = {"english","russian","greek"};
AN_PRC_343[] = {"all"};
AN_PRC_148[] = {"co", "dc", "ftl", "vc", "mmgl", "matl", "fac", "m"};
AN_PRC_152[] = {"co", "dc", "cp", "p", "vc", "mmgl", "matl", "mtrl", "fac"};
AN_PRC_117F[] = {};
AN_PRC_77[] = {};
};
};
/*
-----------------------------------------------------------------------------------------------------------------
AI GEAR CONFIGURATION
Description: This is the section where you define loadouts for the AI teams.
Notes:
1. AI loadouts are randomized based on their probability settings.
a. Probability between 0 and 1 (0 = 0%, 1 = 100%).
b. If array elements don't add up to 1 then ranges are recalculated proportionally.
c. To remove a default item use an empty string.
2. This is an array of classnames.
3. ARC_AI disables the use of grenades and grenade launchers for AI units.
4. This handles any spawning of units whether it's Zeus, MCC or script.
5. prioritizeTracerMags - true will only add tracer magazines if available (reverts to standard if none).
6. removeMedicalItems - true will remove all ACE medical items.
7. removeNightVision - true will remove all night vision goggles
8. enabled - true will enable the custom AI gear for the given team, false will not
Example:
headgear[] = {
{"H_HelmetSpecB_snakeskin", 0.8},
{"", 0.2} // 20% chance to remove all headgear
};
rifles[] = {
{"rhs_weap_m4a1_carryhandle", 0.75},
{"rhs_weap_m249_pip_L", 0.25}
};
-----------------------------------------------------------------------------------------------------------------
*/
class AI {
class Gear {
class BLUFOR {
enabled = false;
removeNightVision = true;
removeMedicalItems = true;
prioritizeTracerMags = true;
uniforms[] = {};
vests[] = {};
headgear[] = {};
goggles[] = {};
backpacks[] = {};
faces[] = {};
voices[] = {};
rifles[] = {};
launchers[] = {};
attachments[] = {};
};
class OPFOR {
enabled = true;
removeNightVision = true;
removeMedicalItems = false;
prioritizeTracerMags = true;
uniforms[] = {
{"skn_u_nbc_indep_blk", 1.0},
};
vests[] = {
{"CUP_V_B_Interceptor_Rifleman_Grey", 1.0},
};
headgear[] = {};
goggles[] = {
{"skn_m04_gas_mask_blk", 1.0},
};
backpacks[] = {
{"B_ViperLightHarness_blk_F", 0.48},
{"", 0.02},
{"B_AssaultPack_blk", 0.48},
};
faces[] = {};
voices[] = {};
rifles[] = {
{"", 0.01},
{"hlc_rifle_G36C", 0.88},
{"CUP_arifle_MG36", 0.11},
};
launchers[] = {
{"", 0.90},
{"CUP_launch_RPG18", 0.10},
};
attachments[] = {
{"CUP_acc_Flashlight", 0.49},
{"", 0.01},
{"CUP_acc_XM8_light_module", 0.48},
};
};
class INDFOR {
enabled = false;
removeNightVision = true;
removeMedicalItems = true;
prioritizeTracerMags = true;
uniforms[] = {};
vests[] = {};
headgear[] = {};
goggles[] = {};
backpacks[] = {};
faces[] = {};
voices[] = {};
rifles[] = {};
launchers[] = {};
attachments[] = {};
};
class CIVILIAN {
enabled = false;
removeNightVision = true;
removeMedicalItems = true;
prioritizeTracerMags = true;
uniforms[] = {};
vests[] = {};
headgear[] = {};
goggles[] = {};
backpacks[] = {};
faces[] = {};
voices[] = {};
rifles[] = {};
launchers[] = {};
attachments[] = {};
};
};
};
/*
-----------------------------------------------------------------------------------------------------------------
FORTIFY CONFIGURATION
Description: This is the section where you define fortification settings.
Notes:
1. Make sure to give units the fortify tool in their loadouts ("ACE_Fortify")
2. For no budget at all, use -1
3. Objects can only be placed while in briefing stage
Example:
budget = 5000;
objects[] = {
{"Land_BagFence_01_long_green_F", 50},
{"Land_HBarrier_01_tower_green_F", 500}
};
-----------------------------------------------------------------------------------------------------------------
*/
class Fortify {
class BLUFOR {
budget = -1;
objects[] = {};
};
class OPFOR {
budget = -1;
objects[] = {};
};
class INDFOR {
budget = -1;
objects[] = {};
};
class CIVILIAN {
budget = -1;
objects[] = {};
};
};
};
|
993d7c3bfdacff1995c2a584dbfa4293a1950af8
|
73f3fae4e8d7b0f6fc0c6720bbaf64d8fb54e7be
|
/tests/testdispatch.cpp
|
615e04314d69d067f53d22a8892705c3e7de4fbb
|
[
"BSL-1.0",
"MIT"
] |
permissive
|
tsurai/kern
|
499a2a014d3c98e924e43e3bc96a366eda86b40a
|
18d0ab3c2786a090b418d55daf0115f2335a04d9
|
refs/heads/master
| 2020-03-20T22:18:07.739209
| 2019-03-25T09:04:11
| 2019-03-25T09:04:11
| 137,790,462
| 4
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,432
|
cpp
|
testdispatch.cpp
|
#include <cstdio>
#include <cstring>
#include <stdio.h>
#include "catch.hpp"
#include "kern.h"
#include "utils.h"
using namespace kern;
const char *res_trace = "[trace] foobar";
const char *res_debug = "[debug] foobar";
const char *res_info = "[info] foobar";
const char *res_warning = "[warning] foobar";
const char *res_error = "[error] foobar";
const char *res_fatal = "[fatal] foobar";
TEST_CASE("Dispatch filters by level") {
char buf[16];
buf[0] = '\0';
const char *res = "[info] foobar";
DispatchBuilder()
.sink(std::make_unique<BufSink>(buf))
.level(LogLevel::Info)
.apply();
trace("foobar");
CHECK( buf[0] == '\0' );
debug("foobar");
CHECK( buf[0] == '\0' );
warning("foobar");
CHECK( buf[0] == '\0' );
error("foobar");
CHECK( buf[0] == '\0' );
fatal("foobar");
CHECK( buf[0] == '\0' );
info("foobar");
CHECK( strncmp(buf, res, strlen(res)) == 0 );
}
TEST_CASE("Dispatch filters by min_level") {
char buf[16];
buf[0] = '\0';
DispatchBuilder()
.sink(std::make_unique<BufSink>(buf))
.min_level(LogLevel::Info)
.apply();
trace("foobar");
CHECK( buf[0] == '\0' );
debug("foobar");
CHECK( buf[0] == '\0' );
info("foobar");
CHECK( strncmp(buf, res_info, strlen(res_info)) == 0 );
bzero((void *)buf, strlen(res_info));
warning("foobar");
CHECK( strncmp(buf, res_warning, strlen(res_warning)) == 0 );
bzero((void *)buf, strlen(res_warning));
error("foobar");
CHECK( strncmp(buf, res_error, strlen(res_error)) == 0 );
bzero((void *)buf, strlen(res_error));
fatal("foobar");
CHECK( strncmp(buf, res_fatal, strlen(res_fatal)) == 0 );
}
TEST_CASE("Dispatch filters by max_level") {
char buf[16];
buf[0] = '\0';
DispatchBuilder()
.sink(std::make_unique<BufSink>(buf))
.max_level(LogLevel::Info)
.apply();
trace("foobar");
CHECK( strncmp(buf, res_trace, strlen(res_trace)) == 0 );
bzero((void *)buf, strlen(res_trace));
debug("foobar");
CHECK( strncmp(buf, res_debug, strlen(res_debug)) == 0 );
bzero((void *)buf, strlen(res_debug));
info("foobar");
CHECK( strncmp(buf, res_info, strlen(res_info)) == 0 );
bzero((void *)buf, strlen(res_info));
warning("foobar");
CHECK( buf[0] == '\0' );
error("foobar");
CHECK( buf[0] == '\0' );
fatal("foobar");
CHECK( buf[0] == '\0' );
}
TEST_CASE("Dispatch filters by filter function") {
char buf[16];
buf[0] = '\0';
DispatchBuilder()
.sink(std::make_unique<BufSink>(buf))
.filter([](auto meta) {
return meta.level != LogLevel::Error;
})
.apply();
error("foobar");
CHECK( buf[0] == '\0' );
info("foobar");
CHECK( strncmp(buf, res_info, strlen(res_info)) == 0 );
}
TEST_CASE("Dispatch formats the output message") {
char buf[16];
const char *res = "Foo:foobar";
DispatchBuilder()
.sink(std::make_unique<BufSink>(buf))
.format([](auto, auto msg, auto buf) {
snprintf(buf, 16, "Foo:%s", msg);
})
.apply();
info("foobar");
CHECK( strncmp(buf, res, strlen(res)) == 0 );
}
TEST_CASE("Dispatch formats the input message") {
char buf[32];
const char *res = "[info] 42 4.2 foobar";
DispatchBuilder()
.sink(std::make_unique<BufSink>(buf))
.apply();
info("%d %.1f %s", 42, 4.2, "foobar");
CHECK( strncmp(buf, res, strlen(res)) == 0 );
}
TEST_CASE("Dispatch filters chained messages") {
char buf_debug[16];
buf_debug[0] = '\0';
char buf_info[16];
buf_info[0] = '\0';
DispatchBuilder()
.sink(std::make_unique<BufSink>(buf_info))
.chain(DispatchBuilder()
.level(LogLevel::Debug)
.sink(std::make_unique<BufSink>(buf_debug))
.build())
.filter_chains()
.apply();
debug("foobar");
CHECK( buf_info[0] == '\0' );
CHECK( strncmp(buf_debug, res_debug, strlen(res_debug)) == 0 );
info("foobar");
CHECK( strncmp(buf_info, res_info, strlen(res_info)) == 0 );
}
TEST_CASE("Prevent reads to uninitialized buffer memory") {
char buf[32];
DispatchBuilder()
.format([](auto, auto, auto) {})
.sink(std::make_unique<BufSink>(buf))
.apply();
info("foobar");
CHECK( buf[0] == '\0' );
}
|
7c2dad48b289589ef0f876f99ed2bfc0ce8c2d2d
|
bb8dfd19165f349d87d3b558050bc377d4da6449
|
/配套光盘/例题/0x50 动态规划/0x56 状态压缩DP/炮兵阵地/POJ1185_炮兵阵地_其他解法.cpp
|
68bda67a40bf453d56950bb5255dd38673046ba6
|
[] |
no_license
|
lydrainbowcat/tedukuri
|
4c3358e2e4d7f8e07152a79981535f0ead3372e7
|
b0471bb0bcf6216a45b818d6be2288e23a02347c
|
refs/heads/master
| 2023-08-17T14:02:02.847399
| 2023-08-07T23:25:35
| 2023-08-07T23:25:35
| 125,682,894
| 2,222
| 706
| null | 2023-08-07T23:25:37
| 2018-03-18T01:24:42
|
Roff
|
UTF-8
|
C++
| false
| false
| 1,052
|
cpp
|
POJ1185_炮兵阵地_其他解法.cpp
|
//Author:XuHt
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
const int N = 106, M = 12, X = 60000;
int n, m, f[N][X];
int p[] = {0,1,3,9,27,81,243,729,2187,6561,19683,59049,177147};
char s[N][M];
void dp(int x, int y, int now, int nxt, int cnt) {
if (y > m) {
if (x < n) {
dp(x + 1, 1, nxt, 0, 0);
f[x][now] = max(f[x][now], f[x+1][nxt] + cnt);
return;
}
f[x][now] = max(f[x][now], cnt);
return;
}
if (y == 1) {
if (f[x][now] != -1) return;
f[x][now] = 0;
}
int k = now / p[y] % 3;
if (k == 2) dp(x, y + 1, now, nxt + p[y], cnt);
else if (k || s[x][y] == 'H') dp(x, y + 1, now, nxt, cnt);
else {
dp(x, y + 1, now, nxt, cnt);
int num = p[y] << 1, w = now / p[y+1] % 3;;
if (w == 2) num += p[y+1];
w = now / p[y+2] % 3;
if (w == 2) num += p[y+2];
dp(x, y + 3, now, nxt + num, cnt + 1);
}
}
int main() {
cin >> n >> m;
for (int i = 1; i <= n; i++) scanf("%s", s[i] + 1);
memset(f, -1, sizeof(f));
dp(1, 1, 0, 0, 0);
cout << f[1][0] << endl;
return 0;
}
|
1c3ef5766669a1d738d1e39729cd72c92406ca1a
|
5444190e607189feab7eb8a606ed7cda4716a814
|
/auxlib/standalone_std/memory/static_alloc.h
|
97b5a6a153dc49e988cb8b0929e2b61d815ec991
|
[
"MIT"
] |
permissive
|
stmobo/Kraftwerk
|
f3bc2e278621db41f021b66e7deafc7d73423fcb
|
fb4ba74ce48b5c9941b391ad3c67c3461e0cae2d
|
refs/heads/master
| 2020-05-30T09:29:19.066380
| 2016-09-12T00:21:51
| 2016-09-12T00:21:51
| 42,925,446
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 367
|
h
|
static_alloc.h
|
// Static pool-based memory allocator
// for use when the usual memory allocation methods are unavailable
// (for example, during early boot and memory init)
template< size_t PoolSize >
class static_mem_pool {
uint8_t pool[PoolSize];
void* alloc( size_t num_bytes );
void free( void* ptr );
};
void* static_mem_pool::alloc( size_t num_bytes ) {
}
|
8a94304a313e13a14e3d678936568611684fd245
|
c804e678a44cafc47088dded86f4493a2401ed24
|
/Problem_Category.cpp
|
7847053d9f6159800c1ad4eb6b57e683f9c6f466
|
[] |
no_license
|
siddhantgupta385/leetcode
|
e300c1342a4fdb587564da476bca0b55a362320a
|
daadf7315dada6169dd4cf2094cbeb61485f7a13
|
refs/heads/main
| 2023-08-26T18:01:56.132614
| 2021-11-10T09:17:21
| 2021-11-10T09:17:21
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 473
|
cpp
|
Problem_Category.cpp
|
#include <bits/stdc++.h>
using namespace std;
#define long long int
void solve()
{
int n;
cin >> n;
// vector<int> ar(n);
// for (auto c : ar)
// {
// int x;
// cin >> x;
// ar.push_back(x);
// }
if(n<100 && n>=1) cout<<"EASY"<<endl;
else if(n>=100 && n<200) cout<<"MEDIUM"<<endl;
if(n>=200 && n<=300) cout<<"HARD"<<endl;
}
signed main()
{
int t;
cin >> t;
while (t--)
{
solve();
}
}
|
d9fd4f3a942db98fd5d1a5e1afaf22278c43ba90
|
7b3b44c8dfa18d13709c69a50a4a006c1f4e01b3
|
/ContactInfo/ContactInfo/ContactInfo.cpp
|
fb096b10d3cc3db91d219750231d2bac2f546be5
|
[] |
no_license
|
Blitzdude/ContactInformation_VS_project
|
b53a745af8f8c12734e6e7ddf1ddef9ed0d8e03c
|
c6992bea2f011ec5ec9849b1c3e1669e70d55da0
|
refs/heads/master
| 2021-01-09T05:42:53.550320
| 2017-02-05T15:50:06
| 2017-02-05T15:50:06
| 80,817,890
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 379
|
cpp
|
ContactInfo.cpp
|
#include "ContactInfo.h"
#include <map>
#include <iostream>
ContactInfo::ContactInfo
(std::string name, std::string phoneNum, std::string email) :
_name(name), _phoneNum(phoneNum), _email(email) {}
ContactInfo::~ContactInfo() {}
void ContactInfo::print() {
std::cout << "name: " << _name << ", Phone Number: "
<< _phoneNum << ", email: " << _email << std::endl;
}
|
ecb2c0ae9fcd4372dc4bd1ef025daae394776a1c
|
db8a418d28a6092afa09f6bc8fcf810e0464ab8c
|
/Object.h
|
dfd6e5539f6600c53561f08bc8cb2c0b4d6203e0
|
[] |
no_license
|
mbeom/AtomicCrops
|
08b0724e9e7a366d12f1a3d41d5fbc725dbda798
|
986bf195d16ae3cd76408687d573b023e6122cdb
|
refs/heads/master
| 2023-08-15T03:50:41.563559
| 2021-10-05T01:50:36
| 2021-10-05T01:50:36
| 406,583,529
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,186
|
h
|
Object.h
|
#pragma once
#include "gameNode.h"
enum class object_type
{
WELL,
FORGE,
FLAG,
PLANE,
NPC,
COPTER,
TYPE_NUM
};
class Object : public gameNode
{
protected:
float count;
float _x, _y;
float _playerX, _playerY;
float width, height;
int currentFrameX, currentFrameY;
int loopX, loopY;
image* _img;
image* _effectImg;
animation* ani;
animation* _effect;
object_type _type;
D2D1_RECT_F _rc;
bool is_touched;
bool is_ready;
public:
virtual HRESULT init();
virtual HRESULT init(float x, float y);
virtual HRESULT init(float x, float y, int num);
virtual void release();
virtual void update();
virtual void render();
inline void set_touched(bool val) { is_touched = val; }
inline bool get_touched() { return is_touched; }
inline void set_ready(bool val) { is_ready = val; }
inline bool get_ready() { return is_ready; }
inline void set_type(object_type type) { _type = type; }
inline object_type get_type() { return _type; }
inline D2D1_RECT_F get_rect() { return _rc; }
inline void set_x(float val) { _playerX = val; }
inline void set_y(float val) { _playerY = val; }
inline float get_x() { return _x; }
inline float get_y() { return _y; }
};
|
cc6321719b3424e2e7b3a336f55fab771d84f0df
|
f3242cb59c55e8b18db39ed7c7897bbab0ded90d
|
/Object Detection/people.h
|
e8483f36ab5dc0dded32d1474fe4da9d75eaaf9a
|
[
"Apache-2.0"
] |
permissive
|
MohammedRashad/FPGA-Based-Driver-Assistant
|
d83c03e9481c337fcc5acadfded4832943a18339
|
67a19ec525ec741b29968164eb77dbeb469f69db
|
refs/heads/master
| 2023-01-11T22:21:52.222990
| 2020-11-21T15:28:19
| 2020-11-21T15:28:19
| 270,260,235
| 5
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,649
|
h
|
people.h
|
#include<iostream>
#include<string>
#include<vector>
#include<opencv2/core/core.hpp>
#include<opencv2/imgproc/imgproc.hpp>
#include<opencv2/highgui/highgui.hpp>
#include<opencv2/objdetect/objdetect.hpp>
using namespace cv;
using namespace std;
class people{
private:
public:
Mat src1, src2;
void detec_pp(Mat &src)
{
Mat ROI;
Rect rect(160, 0, 320, 480);
src2 = src.clone();
//pyrDown(src, src1,Size(src.cols/2,src.rows/2) );
//src(rect).copyTo(ROI);
//HOGDescriptor hog(Size(48, 96), Size(16, 16), Size(8, 8), Size(8, 8), 9, 1, -1, 0, 0.2, true, 64);
//hog.setSVMDetector(HOGDescriptor::getDaimlerPeopleDetector());
HOGDescriptor hog;
hog.setSVMDetector(HOGDescriptor::getDefaultPeopleDetector());
vector<Rect>found, found_filter;
hog.detectMultiScale(src2, found, 0, Size(8, 8), Size(32, 32), 1.05, 2);
if (found.size()>0)
{
cout << "number of detected rectangles" << found.size() << endl;
for (int i = 0; i < found.size(); i++)
{
Rect r = found[i];
int j = 0;
for (; j < found.size(); j++)
{
if (j != i && (r&found[j]) == r)
{
break;
}
}
if (j == found.size())
{
found_filter.push_back(r);
}
}
cout << "number of people detected" << found_filter.size() << endl;
for (int i = 0; i < found_filter.size(); i++)
{
Rect r = found_filter[i];
r.x += cvRound(r.width*0.1);
r.y += cvRound(r.height*0.07);
r.width = cvRound(r.width*0.8);
r.height = cvRound(r.height*0.8);
rectangle(src2, r.tl(), r.br(), Scalar(255, 0, 0), 2, 8);
}
}
}
};
|
ece3f7b6cf035ed441b1e509b07f4c3363adb529
|
625a46bcc34374650f6fdb67c6bfd252e7911fc8
|
/Programming/C++/x Old Versions x/AI Boostrap Project 21 08 2017/AI_Project/source/controlsScreen.cpp
|
f74c2000a5b5cfda0294cc68f95022e12b867417
|
[
"MIT"
] |
permissive
|
balderdash117/All-programming
|
bbe208c5239d7a57ddc707c87324f95c4c28fedf
|
10508d4dbf38bf37c53dc85c120f52f0d056c1ec
|
refs/heads/master
| 2021-01-23T05:25:07.432951
| 2017-09-05T10:47:32
| 2017-09-05T10:47:32
| 102,467,018
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 451
|
cpp
|
controlsScreen.cpp
|
#include "controlsScreen.h"
#include <iostream>
#include "AI_ProjectApp.h"
#include "iGameState.h"
#include "GameStateManager.h"
controlsScreen::controlsScreen(AI_ProjectApp *pApp) :
iGameState(pApp)
{
}
controlsScreen::~controlsScreen()
{
}
void controlsScreen::update(float deltaTime)
{
m_app->getGameStateManager()->popState();
m_app->getGameStateManager()->pushState("play");
}
void controlsScreen::draw(aie::Renderer2D * renderer)
{
}
|
92daec43b2c927b8cdddefc25d8828efe36a1e0d
|
f96f0af3261efaeaf77dd79c02b33a830e5da305
|
/TrapSat.h
|
c4704dc4818a3ba77d3dfbf1abd8a1a7568da0b3
|
[] |
no_license
|
mikeaw/Trap_Sat
|
7a275e239bdd0801c3a0b5482738c666b0440473
|
d5b33360b526ce5725edf54d5c099185024dd53b
|
refs/heads/master
| 2021-01-21T06:11:26.501595
| 2014-08-21T04:30:45
| 2014-08-21T04:30:45
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 996
|
h
|
TrapSat.h
|
/*
Author: Zach Richard
Date: 05/19/2014
Project: Trap Sat: Capitol College
This library will be used to take and store pictures using the Arduino YUN and a USB webcam.
I've added a class for sensing and storing temperature values. -Mike
*/
#ifndef TrapSat_h
#define TrapSat_h
// Headers:
#include "Arduino.h"
class CameraMod
{
private:
String filename; // Name of the file.
String location; // Location to be saved
public:
CameraMod();
void SetName(String); // used to set the name of the picture
void SetDir(String); // used to set the directory where the file should be stored
void TakePic();
String GetPic(); // Will return the full directory path, including the name of the file
};
class TempSensor
{
public:
TempSensor(int pin); //TempSensor requires name of pin when declared
float getTemp(); //this reads temperature
void storeTemp(float TempF); //this stores temperature reading onto SD card
private:
int _pin;
};
#endif
|
75fa9a52816e3d4a6281750c2c2e1b48df4de6f3
|
6d55e0d51492c1e1df09192e1f740dade4ac35b5
|
/Laboratório/Aula7/Exercicio_7/main.cpp
|
1029af917071deb6a323092bdf47b378b12780fd
|
[
"MIT"
] |
permissive
|
Bernardo1411/Linguagem_de_programacao_ECT_UFRN
|
3c0a89b05f4ba2bf433da44470b849431a38cc6e
|
7f189c13e74200b0601f7b2a2dfadab5bc79735f
|
refs/heads/master
| 2022-06-18T13:05:39.851126
| 2020-05-08T02:48:19
| 2020-05-08T02:48:19
| 262,207,386
| 0
| 0
| null | null | null | null |
ISO-8859-1
|
C++
| false
| false
| 1,009
|
cpp
|
main.cpp
|
#include <iostream>
#define TAM 500
using namespace std;
void MMQ(float X[], float Y[], int num);
int main()
{
float V1[TAM];
float V2[TAM];
int n;
cout << "Insira o tamanho dos vetores: " << endl;
cin >> n;
for(int i=0; i<=n-1; i++){
cout << "Insira o " << i << " elemento do vetor X: " << endl;
cin >> V1[i];
}
for(int i=0; i<=n-1; i++){
cout << "Insira o " << i << " elemento do vetor Y: " << endl;
cin >> V2[i];
}
MMQ(V1, V2, n);
return 0;
}
void MMQ(float X[], float Y[], int num){
float a0, a1, sumx=0, sumy=0, sumxy=0, sumxx=0;
for(int i=0; i<=num-1; i++){
sumx = sumx + X[i];
sumxx = sumxx + X[i]*X[i];
sumy = sumy + Y[i];
sumxy = sumxy + X[i]*Y[i];
}
a0 = (sumxx*sumy - sumxy*sumx)/(num*sumxx - sumx*sumx);
a1 = (num*sumxy - sumx*sumy)/(num*sumxx - sumx*sumx);
cout << "A equação resultante eh: ";
cout << a1 << "x + " << a0 << endl;
}
|
aaa97cae60f5eccb37f488cde1bea9339cd0aadd
|
2c3d596da726a64759c6c27d131c87c33a4e0bf4
|
/Src/Qt/kwt/src/kthread.h
|
6b75b1015f94fe881eccef3070718277226ebb25
|
[
"MIT"
] |
permissive
|
iclosure/smartsoft
|
8edd8e5471d0e51b81fc1f6c09239cd8722000c0
|
62eaed49efd8306642b928ef4f2d96e36aca6527
|
refs/heads/master
| 2021-09-03T01:11:29.778290
| 2018-01-04T12:09:25
| 2018-01-04T12:09:25
| 116,255,998
| 0
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,690
|
h
|
kthread.h
|
#ifndef KTHREAD_H
#define KTHREAD_H
#include <QThread>
#include "kwt_global.h"
#include "kwaitcondition.h"
//
// KThread
//
class QMutex;
class ThreadPrivate;
class KWT_EXPORT KThread : public QObject
{
Q_OBJECT
public:
explicit KThread(QObject *parent = 0);
explicit KThread(QString name, QObject *parent = 0);
virtual ~KThread();
bool start(QThread::Priority = QThread::InheritPriority);
void stop(bool wait = true);
bool isRunning() const;
virtual bool work(void) = 0;
QMutex * mutex();
static void sleep(unsigned long secs);
static void msleep(unsigned long msecs);
static void usleep(unsigned long usecs);
private:
Q_DISABLE_COPY(KThread)
ThreadPrivate* d;
};
//
// KSuperThread
//
class SuperThreadPrivate;
class KWT_EXPORT KSuperThread : public QObject
{
Q_OBJECT
public:
explicit KSuperThread(QObject *parent = 0);
explicit KSuperThread(QString name, QObject *parent = 0);
virtual ~KSuperThread();
bool start(QThread::Priority = QThread::InheritPriority);
void stop(bool wait = true);
bool isRunning() const;
KWaitEvent::WaitResult waitObject(KWaitEvent *, unsigned long msecs = ~0UL);
KWaitEvent::WaitResult waitObject(KWaitEventQueue *, KWaitEventQueue::WaitMode mode = KWaitEventQueue::WaitAll,
unsigned long msecs = ~0UL);
virtual bool work(void) = 0;
private:
Q_DISABLE_COPY(KSuperThread)
SuperThreadPrivate* d;
};
//
// KPairThread
//
class PairThreadPrivate;
class KWT_EXPORT KPairThread : public QObject
{
Q_OBJECT
public:
enum WaitResult {
WaitObjectFirst = KWaitEvent::WaitInvalid - 2,
WaitObjectSecond = KWaitEvent::WaitInvalid - 1,
WaitInvalid = KWaitEvent::WaitInvalid,
WaitTimeout = KWaitEvent::WaitTimeout,
WaitFailed = KWaitEvent::WaitFailed,
WaitObject0 = KWaitEvent::WaitObject0,
};
enum PairType {
PairFirst,
PairSecond,
PairAll
};
public:
explicit KPairThread(QObject *parent = 0);
explicit KPairThread(QString name, QObject *parent = 0);
virtual ~KPairThread();
bool start(PairType = PairAll, QThread::Priority = QThread::InheritPriority);
void stop(PairType = PairAll, bool wait = true);
bool isRunning(PairType) const;
WaitResult waitObject(PairType, KWaitEvent *, unsigned long msecs = ~0UL);
WaitResult waitObject(PairType, KWaitEventQueue *, KWaitEventQueue::WaitMode mode = KWaitEventQueue::WaitAll,
unsigned long msecs = ~0UL);
virtual bool workFirst() = 0;
virtual bool workSecond() = 0;
private:
Q_DISABLE_COPY(KPairThread)
PairThreadPrivate* d;
};
#endif // KTHREAD_H
|
7b84c00405706f31a2bb2aaadb6f4ee54ab8dddb
|
eef5b8050802ea8fc2d8717379eac9e72637e202
|
/PanaEngine/fm_render/stencil_tex.cpp
|
7e7ad502203cd4295783d836989562d900e7fc84
|
[] |
no_license
|
abcdls0905/PanaEngine
|
0b06e649979559a59c84997ae79403a36c22c08e
|
12eb3081aab93271e6de62ddde499c5a7328a7f2
|
refs/heads/master
| 2020-07-16T23:00:31.163752
| 2019-09-26T15:56:40
| 2019-09-26T15:56:40
| 205,886,465
| 0
| 0
| null | null | null | null |
GB18030
|
C++
| false
| false
| 3,456
|
cpp
|
stencil_tex.cpp
|
#include "stencil_tex.h"
#include "render.h"
#include "../public/core_log.h"
#include "../public/core_mem.h"
#include "../visual/vis_utils.h"
CStencilTex::CStencilTex(Render* pRender,unsigned int width, unsigned int height, TEX_FORMAT format,int type)
{
m_nRenderTex = 0;
m_pRender = pRender;
m_nFormat = format;
m_nWidth = width;
m_nHeight = height;
if (type == RT_TYPE_DEVICE)
{
int dev_width = m_pRender->GetDeviceWidth();
int dev_height = m_pRender->GetDeviceHeight();
if ((width == dev_width) && (height == dev_height))
{
m_bDeviceSize = true;
m_dWidthRatio = 1.0;
m_dHeightRatio = 1.0;
}
else
{
m_dWidthRatio = double(width) / double(dev_width);
m_dHeightRatio = double(height) / double(dev_height);
}
}
else
{
m_dWidthRatio = 0.0;
m_dHeightRatio = 0.0;
}
}
CStencilTex::~CStencilTex()
{
if(m_nRenderTex)
{
glDeleteRenderbuffers(1, &m_nRenderTex);
}
}
// 释放
void CStencilTex::Release()
{
m_pRender->ReleaseResource(m_nIndex);
}
// 创建
bool CStencilTex::Create()
{
int width;
int height;
if (m_nType == RT_TYPE_DEVICE)
{
int dev_width = m_pRender->GetDeviceWidth();
int dev_height = m_pRender->GetDeviceHeight();
if (m_bDeviceSize)
{
// 使用当前设备的尺寸
width = dev_width;
height = dev_height;
}
else
{
// 保持与设备尺寸的比例
width = int(double(dev_width) * m_dWidthRatio);
height = int(double(dev_height) * m_dHeightRatio);
}
}
else
{
width = m_nWidth;
height = m_nHeight;
}
fm_int internalformat;
//根据类型创建模板格式
switch(m_nFormat)
{
case TEX_FORMAT_S_DEFAULT:
internalformat = GL_STENCIL_INDEX8;//一定支持的格式
break;
case TEX_FORMAT_S1_UINT:
if( !m_pRender->GetDeviceCaps()->IsStencil1Supported() )
{
CORE_TRACE("[Device Warning] Cann't support TEX_FORMAT_S1_UINT!");
return false;
}
#ifdef RENDER_ES_3_0
//internalformat = GL_STENCIL_INDEX;
return false;
#else
#ifdef FX_SYSTEM_IOS
// internalformat = GL_STENCIL_INDEX;
return false;
#else
internalformat = GL_STENCIL_INDEX1_OES;
#endif
#endif
break;
case TEX_FORMAT_S4_UINT:
if( !m_pRender->GetDeviceCaps()->IsStencil4Supported() )
{
CORE_TRACE("[Device Warning] Cann't support TEX_FORMAT_S1_UINT!");
return false;
}
#ifdef RENDER_ES_3_0
return false;
#else
#ifdef FX_SYSTEM_IOS
CORE_TRACE("IOS:[CStencilTex] Only Supported TEX_FORMAT_S_DEFAULT TEX_FORMAT_S1_UINT TEX_FORMAT_S8_UINT");
return false;
#else
internalformat = GL_STENCIL_INDEX4_OES;
#endif
#endif
break;
case TEX_FORMAT_S8_UINT:
internalformat = GL_STENCIL_INDEX8;
break;
default:
CORE_TRACE("[CStencilTex] Only Supported TEX_FORMAT_S_DEFAULT TEX_FORMAT_S1_UINT TEX_FORMAT_S4_UINT TEX_FORMAT_S8_UINT");
return false;
break;
};
//创建一张 模板
glGenRenderbuffers(1, &m_nRenderTex);
glBindRenderbuffer(GL_RENDERBUFFER, m_nRenderTex);
glRenderbufferStorage(GL_RENDERBUFFER, internalformat, m_nWidth,m_nHeight);
if(TestErr("CreateStencil Tex Failed!"))
{
return false;
}
return true;
}
// 销毁
void CStencilTex::Destroy()
{
CORE_DELETE(this);
}
// 设备就绪时的处理
bool CStencilTex::Restore()
{
return true;
}
// 设备丢失时的处理
bool CStencilTex::Invalidate()
{
return true;
}
|
d60b0293c2947f0992d41087b7b090cc8b8d2984
|
ac03c7a89ca6a7eb1889bf8f1c48182c0105beab
|
/lab/Lab 10/BT.h
|
f952cd1ccc508d6d9bbd7081834fdef20aa8a7fd
|
[] |
no_license
|
byter11/Data-Structures
|
25320e22a32c1958c0edfc0a1d722a3fe843d32d
|
4ba8fb600074ff1877771aef70cd0107df1edd34
|
refs/heads/master
| 2023-03-07T23:16:16.807445
| 2021-02-19T14:39:21
| 2021-02-19T14:39:21
| 297,045,585
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 854
|
h
|
BT.h
|
#include "Tree.h"
class BT : public Tree{
void insert(int d, Node* p){
if(root == NULL){
root = new Node(d);
return;
}
else if(!p->left){
p->left = new Node(d);
return;
}
else if(!p->right){
p->right = new Node(d);
return;
}
else{
if(p->left->left && p->left->right)
insert(d, p->right);
else
insert(d, p->left);
}
}
Node* search(int d, Node* p){
if(p==NULL)
return NULL;
if(p->d == d)
return p;
search(d, p->left);
search(d, p->right);
}
public:
void insert(int d){
insert(d, root);
}
Node* search(int d){
return search(d, root);
};
};
|
ee4ce09e6d982019abe5f35f8f57c45702719e16
|
75f9433ab8d43606129f80b5fa5a3452681cd763
|
/unindent.cpp
|
93dbc5ae4f656600d6672befd2f9dbb86ee17c3d
|
[] |
no_license
|
karenwuxz/spring-2021-135-lab-07-isabellaeng3313
|
ec256ce7282e830eec53acf8efb14f0a4a2d3f26
|
6834e98161c9663d0ac56bf1c975562779a603d5
|
refs/heads/main
| 2023-04-13T06:15:51.843946
| 2021-04-21T01:41:28
| 2021-04-21T01:41:28
| 351,641,322
| 0
| 0
| null | 2021-03-26T02:44:00
| 2021-03-26T02:43:59
| null |
UTF-8
|
C++
| false
| false
| 567
|
cpp
|
unindent.cpp
|
#include<iostream>
#include<cctype>
#include<sstream>
#include "unindent.h"
std::string removeLeadingSpaces(std::string line){
std::string sentence = "";
int spaces = 0;
while(isspace(line[spaces])){
spaces++;
}
for(int i = spaces; i < line.length(); i++){
sentence += line[i];
}
return sentence;
}
std::string unindent(){
std::string sentence = "";
std::string lines;
while(getline(std::cin, lines)){
sentence += removeLeadingSpaces(lines);
sentence += "\n";
}
return sentence;
}
|
2b21e49d8a6f6b1cdb5d98da2f08509cb438a5af
|
74212aa37999516a0aeba7ba1e71620a217f8e9d
|
/GameDemonstrator/ActionRepository.cpp
|
879093bf167c636d27b7b1192cb8c707f99a134b
|
[] |
no_license
|
raubwuerger/StrategicGameProject
|
21729192518baa541f2c74f35cb0558a64292c2b
|
ce3e4c31383c44809e970996091067b94602fd92
|
refs/heads/master
| 2022-04-30T18:31:55.283915
| 2021-11-08T19:14:43
| 2021-11-08T19:14:43
| 19,796,707
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 754
|
cpp
|
ActionRepository.cpp
|
#include "stdafx.h"
#include "ActionRepository.h"
ActionRepository* ActionRepository::Instance = nullptr;
ActionRepository* ActionRepository::GetInstanceFirstTimeInit(QObject *parent)
{
if( nullptr != Instance )
{
return Instance;
}
Instance = new ActionRepository(parent);
return Instance;
}
ActionRepository* ActionRepository::GetInstance()
{
if( nullptr != Instance )
{
return Instance;
}
//TODO: Fehlermeldung da nicht initialisiert
return nullptr;
}
ActionRepository::ActionRepository(QObject *parent)
: QObject(parent)
{
}
ActionRepository::~ActionRepository()
{
while( Actions.isEmpty() == false )
{
delete Actions.takeFirst();
}
}
void ActionRepository::AddAction( QAction* action )
{
Actions.push_back( action );
}
|
c19c99f57ab62784863852b72773a0879db81269
|
c8753b83f4cd7e5c3a9406356ac5e6f25d8288f6
|
/PREEMPTION/QButton.cpp
|
70729e10c36ccbf8b26ce166bf094798175c5447
|
[] |
no_license
|
btnkij/preemption
|
8087820abef4888e5b419a1e43fb0fe12dbab3d3
|
84d0176e4843c7021db7353a091b875caf5988c3
|
refs/heads/master
| 2020-04-10T15:40:32.345369
| 2018-12-10T04:49:12
| 2018-12-10T04:49:12
| 161,118,250
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 94
|
cpp
|
QButton.cpp
|
#include "QButton.h"
QButton::QButton(QQuickItem *button)
:QGameObject(button)
{
}
|
13be7b6128f2bc7e884ca66020f042b5223331c2
|
5e79319e32fa709508f7255b2ac453f296d81ac4
|
/src/FTPSession.cpp
|
49dc62dafd374e5ca2a25cd88f73405c17238e52
|
[
"MIT"
] |
permissive
|
zhb2000/Homework-FTPClient
|
92dea50ce22003c2241c1eae99147373ca4668ba
|
14661cfe22f26b215fbd0b28776891df90fbfe8c
|
refs/heads/master
| 2023-01-01T06:19:38.887628
| 2020-10-29T09:33:09
| 2020-10-29T09:33:09
| 278,780,517
| 7
| 1
| null | 2020-07-26T04:38:14
| 2020-07-11T03:31:41
|
C++
|
UTF-8
|
C++
| false
| false
| 10,595
|
cpp
|
FTPSession.cpp
|
#include "../include/FTPSession.h"
#include "../include/FTPFunction.h"
#include "../include/ListTask.h"
#include "../include/MyUtils.h"
#include "../include/RunAsyncAwait.h"
#include <QApplication>
#include <QFuture>
#include <QtConcurrent/QtConcurrent>
#include <cstring>
#include <memory>
namespace ftpclient
{
using LockGuard = std::lock_guard<std::mutex>;
const int FTPSession::SOCKET_SEND_TIMEOUT;
const int FTPSession::SOCKET_RECV_TIMEOUT;
const int FTPSession::SEND_NOOP_TIME;
FTPSession::FTPSession(const std::string &hostname,
const std::string &username,
const std::string password, int port,
bool autoKeepAlive)
: hostname(hostname),
port(port),
username(username),
password(password),
controlSock(INVALID_SOCKET),
isConnected(false),
autoKeepAlive(autoKeepAlive)
{
this->initialize();
}
void FTPSession::initialize()
{
//连接到服务器后,就登录进去
QObject::connect(this, &FTPSession::connectSucceeded,
[this]() { this->login(); });
//登录成功后
QObject::connect(this, &FTPSession::loginSucceeded, [this]() {
//切换成二进制传输模式
this->setTransferMode(true);
//间歇性发送 NOOP 命令
if (autoKeepAlive)
sendNoopTimer.start(SEND_NOOP_TIME);
});
if (autoKeepAlive)
{
//连接定时器的到时信号
QObject::connect(&sendNoopTimer, &QTimer::timeout, this,
&FTPSession::sendNoop);
}
}
void FTPSession::sendNoop()
{
if (isConnected)
{
utils::asyncAwait([this]() {
if (sockMutex.try_lock())
{
std::string noopCmd = "NOOP\r\n";
std::string recvMsg;
send(controlSock, noopCmd.c_str(), noopCmd.length(), 0);
//正常为"200 OK"
//不校验返回码,只是把收到的消息吃掉
utils::recvFtpMsg(controlSock, recvMsg);
sockMutex.unlock();
}
else //此时别的线程正在发命令,因此无需用 NOOP 保活
return;
});
sendNoopTimer.start(SEND_NOOP_TIME);
}
}
void FTPSession::connectAndLogin() { this->connect(); }
void FTPSession::connect()
{
//连接服务器
auto connectRes = utils::asyncAwait<ConnectToServerRes>([this]() {
LockGuard guard(sockMutex);
return connectToServer(controlSock, hostname, std::to_string(port),
SOCKET_SEND_TIMEOUT, SOCKET_RECV_TIMEOUT);
});
if (connectRes != ConnectToServerRes::SUCCEEDED)
{
if (connectRes == ConnectToServerRes::UNABLE_TO_CONNECT_TO_SERVER)
{
emit unableToConnectToServer(); //无法连接到服务器
return;
}
else
{
emit createSocketFailed(connectRes); //创建socket失败
return;
}
}
else
isConnected = true;
//接收服务器端的一些欢迎信息
std::string recvMsg;
auto res = utils::asyncAwait<RecvMultRes>([this, &recvMsg]() {
LockGuard guard(sockMutex);
return recvWelcomMsg(controlSock, recvMsg);
});
if (res == RecvMultRes::SUCCEEDED)
emit connectSucceeded(std::move(recvMsg));
else if (res == RecvMultRes::FAILED_WITH_MSG)
{
isConnected = false;
emit connectFailedWithMsg(std::move(recvMsg));
}
else // res == FAILED
{
isConnected = false;
emit connectFailed();
}
}
void FTPSession::login()
{
runProcedure(
[this](std::string &msg) {
LockGuard guard(sockMutex);
return loginToServer(controlSock, username, password, msg);
},
&FTPSession::loginSucceeded, &FTPSession::loginFailedWithMsg,
&FTPSession::loginFailed);
}
void FTPSession::getFilesize(const std::string &filename)
{
long long filesize;
std::string errorMsg;
auto res = utils::asyncAwait<CmdToServerRet>(
[this, &filename, &filesize, &errorMsg]() {
LockGuard guard(sockMutex);
return getFilesizeOnServer(controlSock, filename, filesize,
errorMsg);
});
if (res == CmdToServerRet::SUCCEEDED)
emit getFilesizeSucceeded(filesize);
else if (res == CmdToServerRet::FAILED_WITH_MSG)
emit getFilesizeFailedWithMsg(std::move(errorMsg));
else
{
emit getFilesizeFailed();
if (res == CmdToServerRet::SEND_FAILED)
emit sendFailed();
else
emit recvFailed();
}
}
void FTPSession::getDir()
{
std::string dir;
std::string errorMsg;
auto res = utils::asyncAwait<CmdToServerRet>([this, &dir, &errorMsg]() {
LockGuard guard(sockMutex);
return getWorkingDirectory(controlSock, dir, errorMsg);
});
if (res == CmdToServerRet::SUCCEEDED)
emit getDirSucceeded(std::move(dir));
else if (res == CmdToServerRet::FAILED_WITH_MSG)
emit getDirFailedWithMsg(std::move(errorMsg));
else
{
emit getDirFailed();
if (res == CmdToServerRet::SEND_FAILED)
emit sendFailed();
else
emit recvFailed();
}
}
void FTPSession::changeDir(const std::string &dir)
{
runProcedure(
[this, &dir](std::string &msg) {
LockGuard guard(sockMutex);
return changeWorkingDirectory(controlSock, dir, msg);
},
&FTPSession::changeDirSucceeded,
&FTPSession::changeDirFailedWithMsg, &FTPSession::changeDirFailed);
}
void FTPSession::setTransferMode(bool binaryMode)
{
std::string errorMsg;
auto res =
utils::asyncAwait<CmdToServerRet>([this, binaryMode, &errorMsg]() {
LockGuard guard(sockMutex);
return setBinaryOrAsciiTransferMode(controlSock, binaryMode,
errorMsg);
});
if (res == CmdToServerRet::SUCCEEDED)
emit setTransferModeSucceeded(binaryMode);
else if (res == CmdToServerRet::FAILED_WITH_MSG)
emit setTransferModeFailedWithMsg(std::move(errorMsg));
else
{
emit setTransferModeFailed();
if (res == CmdToServerRet::SEND_FAILED)
emit sendFailed();
else
emit recvFailed();
}
}
void FTPSession::deleteFile(const std::string &filename)
{
runProcedure(
[this, &filename](std::string &msg) {
LockGuard guard(sockMutex);
return deleteFileOnServer(controlSock, filename, msg);
},
&FTPSession::deleteFileSucceeded,
&FTPSession::deleteFileFailedWithMsg,
&FTPSession::deleteFileFailed);
}
void FTPSession::makeDir(const std::string &dir)
{
runProcedure(
[this, &dir](std::string &msg) {
LockGuard guard(sockMutex);
return makeDirectoryOnServer(controlSock, dir, msg);
},
&FTPSession::makeDirSucceeded, &FTPSession::makeDirFailedWithMsg,
&FTPSession::makeDirFailed);
}
void FTPSession::removeDir(const std::string &dir)
{
runProcedure(
[this, &dir](std::string &msg) {
LockGuard guard(sockMutex);
return removeDirectoryOnServer(controlSock, dir, msg);
},
&FTPSession::removeDirSucceeded,
&FTPSession::removeDirFailedWithMsg, &FTPSession::removeDirFailed);
}
void FTPSession::renameFile(const std::string &oldName,
const std::string &newName)
{
runProcedure(
[this, &oldName, &newName](std::string &msg) {
LockGuard guard(sockMutex);
return renameFileOnServer(controlSock, oldName, newName, msg);
},
&FTPSession::renameFileSucceeded,
&FTPSession::renameFileFailedWithMsg,
&FTPSession::renameFileFailed);
}
void FTPSession::listWorkingDir(bool isNameList)
{
std::string errorMsg;
std::vector<std::string> listStrings;
auto res = utils::asyncAwait<ListTask::Res>(
[this, isNameList, &errorMsg, &listStrings]() {
LockGuard guard(sockMutex);
ListTask task(*this, ".", isNameList);
return task.getListStrings(listStrings, errorMsg);
});
if (res == ListTask::Res::SUCCEEDED)
emit listDirSucceeded(std::move(listStrings));
else if (res == ListTask::Res::FAILED_WITH_MSG)
emit listDirFailedWithMsg(std::move(errorMsg));
else
emit listDirFailed();
}
void FTPSession::quit()
{
// 把控制连接关闭
if (this->isConnected)
closesocket(controlSock);
isConnected = false;
controlSock = INVALID_SOCKET;
}
void FTPSession::runProcedure(
std::function<CmdToServerRet(std::string &)> func,
void (FTPSession::*succeededSignal)(),
void (FTPSession::*failedWithMsgSignal)(std::string),
void (FTPSession::*failedSignal)())
{
std::string errorMsg;
auto res = utils::asyncAwait<CmdToServerRet>(func, errorMsg);
if (res == CmdToServerRet::SUCCEEDED)
emit(this->*succeededSignal)();
else if (res == CmdToServerRet::FAILED_WITH_MSG)
emit(this->*failedWithMsgSignal)(std::move(errorMsg));
else
{
emit(this->*failedSignal)();
if (res == CmdToServerRet::SEND_FAILED)
emit sendFailed();
else
emit recvFailed();
}
}
} // namespace ftpclient
|
68c2241ea91a5057bb2ba352997c698e9fafb364
|
e6b0e80ab22f5ec913c6419febf9485eeefd3c76
|
/src/db/db_cell.cpp
|
38de2285a15604784f1faa3890e9a761f8b70f28
|
[
"BSD-3-Clause"
] |
permissive
|
Xingquan-Li/ripple
|
c6811f7d58cad7c4dde04c5f72bd7183ec3ad97a
|
330522a61bcf1cf290c100ce4686ed62dcdc5cab
|
refs/heads/main
| 2023-03-11T19:02:27.518964
| 2021-02-26T05:40:25
| 2021-02-26T05:40:25
| 395,174,545
| 1
| 0
|
NOASSERTION
| 2021-08-12T02:45:12
| 2021-08-12T02:45:12
| null |
UTF-8
|
C++
| false
| false
| 3,055
|
cpp
|
db_cell.cpp
|
#include "db.h"
using namespace db;
#include "../ut/utils.h"
/***** Cell *****/
Cell::~Cell() {
for (Pin* pin : _pins) {
delete pin;
}
}
Pin* Cell::pin(const string& name) const {
for (Pin* pin : _pins) {
if (pin->type->name() == name) {
return pin;
}
}
return nullptr;
}
void Cell::ctype(CellType* t) {
if (!t) {
return;
}
if (_type) {
printlog(LOG_ERROR, "type of cell %s already set", _name.c_str());
return;
}
_type = t;
++(_type->usedCount);
_pins.resize(_type->pins.size(), nullptr);
for (unsigned i = 0; i != _pins.size(); ++i) {
_pins[i] = new Pin(this, i);
}
}
int Cell::lx() const { return database.placement().x(const_cast<Cell*>(this)); }
int Cell::ly() const { return database.placement().y(const_cast<Cell*>(this)); }
bool Cell::flipX() const { return database.placement().flipX(const_cast<Cell*>(this)); }
bool Cell::flipY() const { return database.placement().flipY(const_cast<Cell*>(this)); }
int Cell::siteWidth() const { return width() / database.siteW; }
int Cell::siteHeight() const { return height() / database.siteH; }
bool Cell::placed() const { return database.placement().placed(const_cast<Cell*>(this)); }
void Cell::place(int x, int y) {
if (_fixed) {
printlog(LOG_WARN, "moving fixed cell %s to (%d,%d)", _name.c_str(), x, y);
}
database.placement().place(this, x, y);
}
void Cell::place(int x, int y, bool flipX, bool flipY) {
if (_fixed) {
printlog(LOG_WARN, "moving fixed cell %s to (%d,%d)", _name.c_str(), x, y);
}
database.placement().place(this, x, y, flipX, flipY);
}
void Cell::unplace() {
if (_fixed) {
printlog(LOG_WARN, "unplace fixed cell %s", _name.c_str());
}
database.placement().place(this);
}
/***** Cell Type *****/
CellType::~CellType() {
for (PinType* pin : pins) {
delete pin;
}
}
PinType* CellType::addPin(const string& name, const char direction, const char type) {
PinType* newpintype = new PinType(name, direction, type);
pins.push_back(newpintype);
return newpintype;
}
PinType* CellType::getPin(string& name) {
for (int i = 0; i < (int)pins.size(); i++) {
if (pins[i]->name() == name) {
return pins[i];
}
}
return nullptr;
}
void CellType::setOrigin(int x, int y) {
_originX = x;
_originY = y;
}
bool CellType::operator==(const CellType& r) const {
if (width != r.width || height != r.height) {
return false;
} else if (_originX != r.originX() || _originY != r.originY() || _symmetry != r.symmetry() ||
pins.size() != r.pins.size()) {
return false;
} else if (edgetypeL != r.edgetypeL || edgetypeR != r.edgetypeR) {
return false;
} else {
// return PinType::comparePin(pins, r.pins);
for (unsigned i = 0; i != pins.size(); ++i) {
if (*pins[i] != *r.pins[i]) {
return false;
}
}
}
return true;
}
|
44ee6c29e151ad97471eddb38456ba7261309cb5
|
a06515f4697a3dbcbae4e3c05de2f8632f8d5f46
|
/corpus/taken_from_cppcheck_tests/stolen_15806.cpp
|
7d600fa1bd17bbdf4b0fd8adb0932e2a8b4363b6
|
[] |
no_license
|
pauldreik/fuzzcppcheck
|
12d9c11bcc182cc1f1bb4893e0925dc05fcaf711
|
794ba352af45971ff1f76d665b52adeb42dcab5f
|
refs/heads/master
| 2020-05-01T01:55:04.280076
| 2019-03-22T21:05:28
| 2019-03-22T21:05:28
| 177,206,313
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 89
|
cpp
|
stolen_15806.cpp
|
void f(std::list<int> ints) {
ints.front();
ints.pop_back();
if (ints.empty()) {}
}
|
c6aaffb5ec97ef77fbd63f546c40c2f9ca298d49
|
972cb450bcd41b358bfa11626e6106e4305fc8bd
|
/viennacl-frontend/moa-frontend-lib/viennacl/ml/opencl/distance.hpp
|
380ca2540a2416c0e9ddb67ef4e29b1d5f85f9aa
|
[] |
no_license
|
vpa1977/hsa_jni
|
0d0e161dd172b4474ceff3eb9abbef38c3314a01
|
2fd116df759eb49ee43ad4e0f4666b2d804292ba
|
refs/heads/master
| 2021-01-13T01:31:22.613111
| 2015-11-01T22:58:57
| 2015-11-01T22:58:57
| 25,964,396
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 20,040
|
hpp
|
distance.hpp
|
#ifndef VIENNACL_ML_OPENCL_DISTANCE_HPP_
#define VIENNACL_ML_OPENCL_DISTANCE_HPP_
#include <viennacl/ocl/context.hpp>
namespace viennacl
{
namespace ml
{
namespace opencl
{
template <typename NumericT, class context_class>
struct distance_kernel
{
static std::string program_name()
{
return "knn_distance";
}
static void init(context_class& ctx)
{
static bool done = false; // TODO : multiple hsa contexts. At the moment there can be only one
if (done)
return;
done = true;
std::string code;
std::string numeric_string = viennacl::ocl::type_to_string<NumericT>::apply();
code.append("#define VALUE_TYPE ");
code.append(numeric_string);
code.append("\n");
code.append("__kernel void update_bounds(int len, __global const VALUE_TYPE* min_values, __global const VALUE_TYPE* max_values, __global VALUE_TYPE *sample, __global VALUE_TYPE* min_values_upd, __global VALUE_TYPE* max_values_upd)");
code.append("{");
code.append("int id = get_global_id(0);");
code.append("if (id > len) return;");
code.append("VALUE_TYPE val = sample[id];");
code.append("max_values_upd[id] = val > max_values[id] ? sample[id] : max_values[id];");
code.append("min_values_upd[id] = val < min_values[id] ? sample[id] : min_values[id];");
code.append("}");
code.append("\n");
/* from euclidean_distance.cl*/
unsigned char euclidian_distance_cl[] = {
0x0d, 0x0a, 0x0d, 0x0a, 0x2f, 0x2f, 0x20, 0x23, 0x64, 0x65, 0x66, 0x69,
0x6e, 0x65, 0x20, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x5f, 0x54, 0x59, 0x50,
0x45, 0x20, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x0d, 0x0a, 0x65, 0x6e,
0x75, 0x6d, 0x20, 0x20, 0x20, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75,
0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x0d, 0x0a, 0x7b, 0x0d, 0x0a, 0x09,
0x09, 0x61, 0x74, 0x4e, 0x55, 0x4d, 0x45, 0x52, 0x49, 0x43, 0x2c, 0x20,
0x0d, 0x0a, 0x09, 0x09, 0x61, 0x74, 0x4e, 0x4f, 0x4d, 0x49, 0x4e, 0x41,
0x4c, 0x0d, 0x0a, 0x7d, 0x3b, 0x0d, 0x0a, 0x2f, 0x2a, 0x0d, 0x0a, 0x20,
0x20, 0x20, 0x64, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x20, 0x6b,
0x65, 0x72, 0x6e, 0x65, 0x6c, 0x20, 0x6f, 0x6e, 0x65, 0x0d, 0x0a, 0x2a,
0x2f, 0x0d, 0x0a, 0x5f, 0x5f, 0x6b, 0x65, 0x72, 0x6e, 0x65, 0x6c, 0x20,
0x76, 0x6f, 0x69, 0x64, 0x20, 0x73, 0x71, 0x75, 0x61, 0x72, 0x65, 0x5f,
0x64, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x28, 0x5f, 0x5f, 0x67,
0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x20,
0x56, 0x41, 0x4c, 0x55, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x2a, 0x20,
0x69, 0x6e, 0x70, 0x75, 0x74, 0x2c, 0x0d, 0x0a, 0x09, 0x09, 0x09, 0x09,
0x09, 0x09, 0x5f, 0x5f, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x20, 0x63,
0x6f, 0x6e, 0x73, 0x74, 0x20, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x5f, 0x54,
0x59, 0x50, 0x45, 0x2a, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73,
0x2c, 0x0d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x5f, 0x5f, 0x67,
0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x20,
0x56, 0x41, 0x4c, 0x55, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x2a, 0x20,
0x72, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x2c, 0x0d, 0x0a,
0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x5f, 0x5f, 0x67, 0x6c, 0x6f, 0x62,
0x61, 0x6c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x20, 0x56, 0x41, 0x4c,
0x55, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x2a, 0x20, 0x72, 0x61, 0x6e,
0x67, 0x65, 0x5f, 0x6d, 0x61, 0x78, 0x2c, 0x0d, 0x0a, 0x09, 0x09, 0x09,
0x09, 0x09, 0x09, 0x5f, 0x5f, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x20,
0x63, 0x6f, 0x6e, 0x73, 0x74, 0x20, 0x69, 0x6e, 0x74, 0x2a, 0x20, 0x61,
0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5f, 0x74, 0x79, 0x70,
0x65, 0x2c, 0x0d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x5f, 0x5f,
0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x20, 0x56, 0x41, 0x4c, 0x55, 0x45,
0x5f, 0x54, 0x59, 0x50, 0x45, 0x2a, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c,
0x74, 0x2c, 0x0d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x63, 0x6f,
0x6e, 0x73, 0x74, 0x20, 0x69, 0x6e, 0x74, 0x20, 0x6c, 0x65, 0x6e, 0x67,
0x74, 0x68, 0x2c, 0x20, 0x0d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
0x63, 0x6f, 0x6e, 0x73, 0x74, 0x20, 0x69, 0x6e, 0x74, 0x20, 0x61, 0x74,
0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65,
0x29, 0x0d, 0x0a, 0x7b, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0d, 0x0a, 0x09,
0x20, 0x20, 0x20, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x74, 0x20, 0x72, 0x65,
0x73, 0x75, 0x6c, 0x74, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x20,
0x3d, 0x20, 0x67, 0x65, 0x74, 0x5f, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c,
0x5f, 0x69, 0x64, 0x28, 0x30, 0x29, 0x3b, 0x0d, 0x0a, 0x09, 0x69, 0x66,
0x20, 0x28, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x6f, 0x66, 0x66,
0x73, 0x65, 0x74, 0x20, 0x3e, 0x3d, 0x20, 0x6c, 0x65, 0x6e, 0x67, 0x74,
0x68, 0x29, 0x20, 0x2f, 0x2f, 0x20, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65,
0x20, 0x6c, 0x61, 0x73, 0x74, 0x20, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x0d,
0x0a, 0x09, 0x09, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x3b, 0x0d, 0x0a,
0x09, 0x09, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x74, 0x20, 0x76, 0x65, 0x63,
0x74, 0x6f, 0x72, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x20, 0x3d,
0x20, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5f, 0x73,
0x69, 0x7a, 0x65, 0x20, 0x2a, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74,
0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x3b, 0x0d, 0x0a, 0x09, 0x56,
0x41, 0x4c, 0x55, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x20, 0x70, 0x6f,
0x69, 0x6e, 0x74, 0x5f, 0x64, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65,
0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0d, 0x0a, 0x09, 0x56, 0x41, 0x4c, 0x55,
0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x20, 0x76, 0x61, 0x6c, 0x3b, 0x0d,
0x0a, 0x09, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45,
0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3b, 0x0d, 0x0a, 0x09, 0x69, 0x6e,
0x74, 0x20, 0x69, 0x3b, 0x0d, 0x0a, 0x09, 0x66, 0x6f, 0x72, 0x20, 0x28,
0x69, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x20, 0x69, 0x20, 0x3c, 0x20, 0x61,
0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5f, 0x73, 0x69, 0x7a,
0x65, 0x20, 0x3b, 0x20, 0x69, 0x20, 0x2b, 0x2b, 0x20, 0x29, 0x20, 0x0d,
0x0a, 0x09, 0x7b, 0x0d, 0x0a, 0x09, 0x09, 0x69, 0x66, 0x20, 0x28, 0x61,
0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5f, 0x74, 0x79, 0x70,
0x65, 0x5b, 0x69, 0x5d, 0x20, 0x3d, 0x3d, 0x20, 0x61, 0x74, 0x4e, 0x55,
0x4d, 0x45, 0x52, 0x49, 0x43, 0x29, 0x20, 0x0d, 0x0a, 0x09, 0x09, 0x7b,
0x0d, 0x0a, 0x09, 0x09, 0x09, 0x77, 0x69, 0x64, 0x74, 0x68, 0x20, 0x3d,
0x20, 0x28, 0x20, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x6d, 0x61, 0x78,
0x5b, 0x69, 0x5d, 0x20, 0x2d, 0x20, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x5f,
0x6d, 0x69, 0x6e, 0x5b, 0x69, 0x5d, 0x29, 0x3b, 0x0d, 0x0a, 0x09, 0x09,
0x09, 0x76, 0x61, 0x6c, 0x20, 0x3d, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68,
0x20, 0x3e, 0x20, 0x30, 0x20, 0x3f, 0x20, 0x28, 0x69, 0x6e, 0x70, 0x75,
0x74, 0x5b, 0x69, 0x5d, 0x20, 0x2d, 0x20, 0x72, 0x61, 0x6e, 0x67, 0x65,
0x5f, 0x6d, 0x69, 0x6e, 0x5b, 0x69, 0x5d, 0x29, 0x20, 0x2f, 0x20, 0x77,
0x69, 0x64, 0x74, 0x68, 0x20, 0x20, 0x2d, 0x20, 0x28, 0x73, 0x61, 0x6d,
0x70, 0x6c, 0x65, 0x73, 0x5b, 0x20, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72,
0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x20, 0x2b, 0x20, 0x69, 0x5d,
0x20, 0x2d, 0x20, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x6d, 0x69, 0x6e,
0x5b, 0x69, 0x5d, 0x29, 0x2f, 0x77, 0x69, 0x64, 0x74, 0x68, 0x20, 0x3a,
0x20, 0x30, 0x3b, 0x0d, 0x0a, 0x09, 0x09, 0x09, 0x70, 0x6f, 0x69, 0x6e,
0x74, 0x5f, 0x64, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x20, 0x2b,
0x3d, 0x20, 0x76, 0x61, 0x6c, 0x2a, 0x76, 0x61, 0x6c, 0x3b, 0x20, 0x0d,
0x0a, 0x09, 0x09, 0x7d, 0x0d, 0x0a, 0x09, 0x09, 0x65, 0x6c, 0x73, 0x65,
0x0d, 0x0a, 0x09, 0x09, 0x7b, 0x0d, 0x0a, 0x09, 0x09, 0x09, 0x70, 0x6f,
0x69, 0x6e, 0x74, 0x5f, 0x64, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65,
0x20, 0x2b, 0x3d, 0x20, 0x69, 0x73, 0x6e, 0x6f, 0x74, 0x65, 0x71, 0x75,
0x61, 0x6c, 0x28, 0x20, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5b, 0x69, 0x5d,
0x20, 0x2c, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x5b, 0x76,
0x65, 0x63, 0x74, 0x6f, 0x72, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74,
0x20, 0x2b, 0x20, 0x69, 0x5d, 0x29, 0x3b, 0x0d, 0x0a, 0x09, 0x09, 0x7d,
0x0d, 0x0a, 0x09, 0x7d, 0x0d, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x75, 0x6c,
0x74, 0x5b, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x6f, 0x66, 0x66,
0x73, 0x65, 0x74, 0x5d, 0x20, 0x3d, 0x20, 0x70, 0x6f, 0x69, 0x6e, 0x74,
0x5f, 0x64, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x3b, 0x0d, 0x0a,
0x7d, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0d, 0x0a,
0x0d, 0x0a, 0x0d, 0x0a, 0x0d, 0x0a,0x0
};
unsigned int euclidian_distance_cl_len = 1158;
unsigned char euclidian_distance_wg_cl[] = {
0x0d, 0x0a, 0x0d, 0x0a, 0x2f, 0x2f, 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e,
0x65, 0x20, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45,
0x20, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x0d, 0x0a, 0x2f, 0x2f, 0x65,
0x6e, 0x75, 0x6d, 0x20, 0x20, 0x20, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62,
0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x0d, 0x0a, 0x2f, 0x2f, 0x7b,
0x0d, 0x0a, 0x2f, 0x2f, 0x09, 0x09, 0x61, 0x74, 0x4e, 0x55, 0x4d, 0x45,
0x52, 0x49, 0x43, 0x2c, 0x20, 0x0d, 0x0a, 0x2f, 0x2f, 0x09, 0x09, 0x61,
0x74, 0x4e, 0x4f, 0x4d, 0x49, 0x4e, 0x41, 0x4c, 0x0d, 0x0a, 0x2f, 0x2f,
0x7d, 0x3b, 0x0d, 0x0a, 0x0d, 0x0a, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65,
0x20, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x77, 0x6f, 0x72, 0x6b, 0x67, 0x72,
0x6f, 0x75, 0x70, 0x5f, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x28, 0x5f,
0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x56, 0x41, 0x4c, 0x55, 0x45,
0x5f, 0x54, 0x59, 0x50, 0x45, 0x2a, 0x20, 0x64, 0x61, 0x74, 0x61, 0x29,
0x20, 0x0d, 0x0a, 0x7b, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x74, 0x20, 0x6c,
0x69, 0x64, 0x20, 0x3d, 0x20, 0x67, 0x65, 0x74, 0x5f, 0x6c, 0x6f, 0x63,
0x61, 0x6c, 0x5f, 0x69, 0x64, 0x28, 0x30, 0x29, 0x3b, 0x0d, 0x0a, 0x09,
0x69, 0x6e, 0x74, 0x20, 0x73, 0x69, 0x7a, 0x65, 0x20, 0x3d, 0x20, 0x67,
0x65, 0x74, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x73, 0x69, 0x7a,
0x65, 0x28, 0x30, 0x29, 0x3b, 0x0d, 0x0a, 0x09, 0x66, 0x6f, 0x72, 0x20,
0x28, 0x69, 0x6e, 0x74, 0x20, 0x64, 0x20, 0x3d, 0x20, 0x73, 0x69, 0x7a,
0x65, 0x20, 0x3e, 0x3e, 0x31, 0x20, 0x3b, 0x64, 0x20, 0x3e, 0x20, 0x30,
0x20, 0x3b, 0x20, 0x64, 0x20, 0x3e, 0x3e, 0x3d, 0x31, 0x29, 0x0d, 0x0a,
0x09, 0x7b, 0x0d, 0x0a, 0x09, 0x09, 0x62, 0x61, 0x72, 0x72, 0x69, 0x65,
0x72, 0x28, 0x43, 0x4c, 0x4b, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x5f,
0x4d, 0x45, 0x4d, 0x5f, 0x46, 0x45, 0x4e, 0x43, 0x45, 0x29, 0x3b, 0x20,
0x0d, 0x0a, 0x09, 0x20, 0x09, 0x69, 0x66, 0x20, 0x28, 0x6c, 0x69, 0x64,
0x20, 0x3c, 0x20, 0x64, 0x29, 0x20, 0x0d, 0x0a, 0x09, 0x20, 0x09, 0x7b,
0x0d, 0x0a, 0x09, 0x20, 0x09, 0x09, 0x64, 0x61, 0x74, 0x61, 0x5b, 0x6c,
0x69, 0x64, 0x5d, 0x20, 0x2b, 0x3d, 0x20, 0x64, 0x61, 0x74, 0x61, 0x5b,
0x6c, 0x69, 0x64, 0x20, 0x2b, 0x20, 0x64, 0x5d, 0x3b, 0x0d, 0x0a, 0x09,
0x20, 0x09, 0x7d, 0x0d, 0x0a, 0x09, 0x20, 0x7d, 0x0d, 0x0a, 0x09, 0x20,
0x62, 0x61, 0x72, 0x72, 0x69, 0x65, 0x72, 0x28, 0x43, 0x4c, 0x4b, 0x5f,
0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x5f, 0x4d, 0x45, 0x4d, 0x5f, 0x46, 0x45,
0x4e, 0x43, 0x45, 0x29, 0x3b, 0x20, 0x0d, 0x0a, 0x7d, 0x0d, 0x0a, 0x0d,
0x0a, 0x2f, 0x2a, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x64, 0x69, 0x73, 0x74,
0x61, 0x6e, 0x63, 0x65, 0x20, 0x6b, 0x65, 0x72, 0x6e, 0x65, 0x6c, 0x20,
0x74, 0x77, 0x6f, 0x20, 0x2d, 0x20, 0x31, 0x20, 0x69, 0x6e, 0x73, 0x74,
0x61, 0x6e, 0x63, 0x65, 0x20, 0x70, 0x65, 0x72, 0x20, 0x77, 0x6f, 0x72,
0x6b, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x0d, 0x0a, 0x2a, 0x2f, 0x0d, 0x0a,
0x5f, 0x5f, 0x6b, 0x65, 0x72, 0x6e, 0x65, 0x6c, 0x20, 0x76, 0x6f, 0x69,
0x64, 0x20, 0x73, 0x71, 0x75, 0x61, 0x72, 0x65, 0x5f, 0x64, 0x69, 0x73,
0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x6f, 0x6e, 0x65, 0x5f, 0x77, 0x67,
0x28, 0x5f, 0x5f, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x20, 0x63, 0x6f,
0x6e, 0x73, 0x74, 0x20, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x5f, 0x54, 0x59,
0x50, 0x45, 0x2a, 0x20, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x2c, 0x0d, 0x0a,
0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x5f, 0x5f, 0x67, 0x6c, 0x6f, 0x62,
0x61, 0x6c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x20, 0x56, 0x41, 0x4c,
0x55, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x2a, 0x20, 0x73, 0x61, 0x6d,
0x70, 0x6c, 0x65, 0x73, 0x2c, 0x0d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09,
0x09, 0x5f, 0x5f, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x20, 0x63, 0x6f,
0x6e, 0x73, 0x74, 0x20, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x5f, 0x54, 0x59,
0x50, 0x45, 0x2a, 0x20, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x6d, 0x69,
0x6e, 0x2c, 0x0d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x5f, 0x5f,
0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74,
0x20, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x2a,
0x20, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x6d, 0x61, 0x78, 0x2c, 0x0d,
0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x5f, 0x5f, 0x67, 0x6c, 0x6f,
0x62, 0x61, 0x6c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x20, 0x69, 0x6e,
0x74, 0x2a, 0x20, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65,
0x5f, 0x74, 0x79, 0x70, 0x65, 0x2c, 0x0d, 0x0a, 0x09, 0x09, 0x09, 0x09,
0x09, 0x09, 0x5f, 0x5f, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x20, 0x56,
0x41, 0x4c, 0x55, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x2a, 0x20, 0x72,
0x65, 0x73, 0x75, 0x6c, 0x74, 0x2c, 0x0d, 0x0a, 0x09, 0x09, 0x09, 0x09,
0x09, 0x09, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x20, 0x69, 0x6e, 0x74, 0x20,
0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x2c, 0x20, 0x0d, 0x0a, 0x09, 0x09,
0x09, 0x09, 0x09, 0x09, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x20, 0x69, 0x6e,
0x74, 0x20, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5f,
0x73, 0x69, 0x7a, 0x65, 0x2c, 0x20, 0x0d, 0x0a, 0x09, 0x09, 0x09, 0x09,
0x09, 0x09, 0x5f, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x56, 0x41,
0x4c, 0x55, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x2a, 0x20, 0x73, 0x63,
0x72, 0x61, 0x74, 0x63, 0x68, 0x29, 0x0d, 0x0a, 0x7b, 0x20, 0x0d, 0x0a,
0x09, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x20,
0x61, 0x63, 0x63, 0x75, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x6f, 0x72, 0x20,
0x3d, 0x20, 0x30, 0x3b, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x74, 0x20, 0x76,
0x65, 0x63, 0x74, 0x6f, 0x72, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74,
0x20, 0x3d, 0x20, 0x67, 0x65, 0x74, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70,
0x5f, 0x69, 0x64, 0x28, 0x30, 0x29, 0x20, 0x2a, 0x20, 0x61, 0x74, 0x74,
0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x3b,
0x0d, 0x0a, 0x09, 0x66, 0x6f, 0x72, 0x20, 0x28, 0x69, 0x6e, 0x74, 0x20,
0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5f, 0x69, 0x64,
0x20, 0x3d, 0x20, 0x67, 0x65, 0x74, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x6c,
0x5f, 0x69, 0x64, 0x28, 0x30, 0x29, 0x3b, 0x20, 0x61, 0x74, 0x74, 0x72,
0x69, 0x62, 0x75, 0x74, 0x65, 0x5f, 0x69, 0x64, 0x20, 0x3c, 0x20, 0x61,
0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5f, 0x73, 0x69, 0x7a,
0x65, 0x3b, 0x20, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65,
0x5f, 0x69, 0x64, 0x20, 0x2b, 0x3d, 0x20, 0x67, 0x65, 0x74, 0x5f, 0x6c,
0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x28, 0x30, 0x29,
0x20, 0x29, 0x0d, 0x0a, 0x09, 0x7b, 0x0d, 0x0a, 0x09, 0x09, 0x0d, 0x0a,
0x09, 0x09, 0x69, 0x66, 0x20, 0x28, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62,
0x75, 0x74, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5b, 0x61, 0x74, 0x74,
0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5f, 0x69, 0x64, 0x5d, 0x20, 0x3d,
0x3d, 0x20, 0x61, 0x74, 0x4e, 0x55, 0x4d, 0x45, 0x52, 0x49, 0x43, 0x29,
0x20, 0x0d, 0x0a, 0x09, 0x09, 0x7b, 0x0d, 0x0a, 0x09, 0x09, 0x09, 0x56,
0x41, 0x4c, 0x55, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x20, 0x77, 0x69,
0x64, 0x74, 0x68, 0x20, 0x3d, 0x20, 0x28, 0x20, 0x72, 0x61, 0x6e, 0x67,
0x65, 0x5f, 0x6d, 0x61, 0x78, 0x5b, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62,
0x75, 0x74, 0x65, 0x5f, 0x69, 0x64, 0x5d, 0x20, 0x2d, 0x20, 0x72, 0x61,
0x6e, 0x67, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x5b, 0x61, 0x74, 0x74, 0x72,
0x69, 0x62, 0x75, 0x74, 0x65, 0x5f, 0x69, 0x64, 0x5d, 0x29, 0x3b, 0x0d,
0x0a, 0x09, 0x09, 0x09, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x5f, 0x54, 0x59,
0x50, 0x45, 0x20, 0x76, 0x61, 0x6c, 0x20, 0x3d, 0x20, 0x77, 0x69, 0x64,
0x74, 0x68, 0x20, 0x3e, 0x20, 0x30, 0x20, 0x3f, 0x20, 0x28, 0x69, 0x6e,
0x70, 0x75, 0x74, 0x5b, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74,
0x65, 0x5f, 0x69, 0x64, 0x5d, 0x20, 0x2d, 0x20, 0x72, 0x61, 0x6e, 0x67,
0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x5b, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62,
0x75, 0x74, 0x65, 0x5f, 0x69, 0x64, 0x5d, 0x29, 0x20, 0x2f, 0x20, 0x77,
0x69, 0x64, 0x74, 0x68, 0x20, 0x20, 0x2d, 0x20, 0x28, 0x73, 0x61, 0x6d,
0x70, 0x6c, 0x65, 0x73, 0x5b, 0x20, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72,
0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x20, 0x2b, 0x20, 0x61, 0x74,
0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5f, 0x69, 0x64, 0x5d, 0x20,
0x2d, 0x20, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x5b,
0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5f, 0x69, 0x64,
0x5d, 0x29, 0x2f, 0x77, 0x69, 0x64, 0x74, 0x68, 0x20, 0x3a, 0x20, 0x30,
0x3b, 0x0d, 0x0a, 0x09, 0x09, 0x09, 0x61, 0x63, 0x63, 0x75, 0x6d, 0x75,
0x6c, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x2b, 0x3d, 0x20, 0x76, 0x61, 0x6c,
0x2a, 0x76, 0x61, 0x6c, 0x3b, 0x20, 0x0d, 0x0a, 0x09, 0x09, 0x7d, 0x0d,
0x0a, 0x09, 0x09, 0x65, 0x6c, 0x73, 0x65, 0x0d, 0x0a, 0x09, 0x09, 0x7b,
0x0d, 0x0a, 0x09, 0x09, 0x09, 0x61, 0x63, 0x63, 0x75, 0x6d, 0x75, 0x6c,
0x61, 0x74, 0x6f, 0x72, 0x20, 0x2b, 0x3d, 0x20, 0x69, 0x73, 0x6e, 0x6f,
0x74, 0x65, 0x71, 0x75, 0x61, 0x6c, 0x28, 0x20, 0x69, 0x6e, 0x70, 0x75,
0x74, 0x5b, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5f,
0x69, 0x64, 0x5d, 0x20, 0x2c, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65,
0x73, 0x5b, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x5f, 0x6f, 0x66, 0x66,
0x73, 0x65, 0x74, 0x20, 0x2b, 0x20, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62,
0x75, 0x74, 0x65, 0x5f, 0x69, 0x64, 0x5d, 0x29, 0x3b, 0x0d, 0x0a, 0x09,
0x09, 0x7d, 0x0d, 0x0a, 0x09, 0x7d, 0x0d, 0x0a, 0x09, 0x73, 0x63, 0x72,
0x61, 0x74, 0x63, 0x68, 0x5b, 0x67, 0x65, 0x74, 0x5f, 0x6c, 0x6f, 0x63,
0x61, 0x6c, 0x5f, 0x69, 0x64, 0x28, 0x30, 0x29, 0x5d, 0x20, 0x3d, 0x20,
0x61, 0x63, 0x63, 0x75, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x6f, 0x72, 0x3b,
0x0d, 0x0a, 0x09, 0x77, 0x6f, 0x72, 0x6b, 0x67, 0x72, 0x6f, 0x75, 0x70,
0x5f, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x28, 0x73, 0x63, 0x72, 0x61,
0x74, 0x63, 0x68, 0x29, 0x3b, 0x0d, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x75,
0x6c, 0x74, 0x5b, 0x67, 0x65, 0x74, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70,
0x5f, 0x69, 0x64, 0x28, 0x30, 0x29, 0x5d, 0x20, 0x3d, 0x20, 0x73, 0x63,
0x72, 0x61, 0x74, 0x63, 0x68, 0x5b, 0x30, 0x5d, 0x3b, 0x09, 0x09, 0x0d,
0x0a, 0x7d, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0d,
0x0a, 0x0d, 0x0a, 0x0d, 0x0a, 0x0d, 0x0a,0x0
};
unsigned int euclidian_distance_wg_cl_len = 1639;
code.append((const char*)euclidian_distance_cl);
code.append((const char*)euclidian_distance_wg_cl);
ctx.add_program(code, program_name());
}
};
}
}
}
#endif
|
3f54c0d880b779e25518e3e99f29cb2bf314035a
|
5fd214ad737974f864ec2c055495e9696bbf24eb
|
/modules/mbsimFlexibleBody/mbsimFlexibleBody/contours/contour_1s_neutral_factory.cc
|
3b51470ef1330acc92ab610515ed0069f213a5e0
|
[] |
no_license
|
tsschindler/mbsim
|
28ede3f2035592532738b833fefe6a8755dfd59e
|
97fdb10cfe9e22fb962b7522a9b758d1cdc571ce
|
refs/heads/master
| 2021-01-15T10:18:44.245224
| 2015-06-05T11:37:17
| 2015-06-05T11:37:17
| 36,926,919
| 1
| 0
| null | 2015-06-05T11:37:18
| 2015-06-05T10:29:23
|
C++
|
UTF-8
|
C++
| false
| false
| 493
|
cc
|
contour_1s_neutral_factory.cc
|
/*
* contour_1s_neutral_factory.h
*
* Created on: 25.10.2013
* Author: zwang
*/
#include <config.h>
#include "contour_1s_neutral_factory.h"
#include <mbsim/utils/rotarymatrices.h>
namespace MBSimFlexibleBody {
Contour1sNeutralFactory::Contour1sNeutralFactory(const std::string &name) :
MBSim::Contour1s(name), uMin(0.), uMax(1.), degU(3), openStructure(false)
{
}
Contour1sNeutralFactory::~Contour1sNeutralFactory() {
}
} /* namespace MBSimFlexibleBody */
|
0c62ea330bc960b683b2a871dbf2dd15e4e12e92
|
899e293884d1ed1896414d46e3b46a1a9bfdc490
|
/ACM/Codes/Vjudge/20150831/C.cpp
|
f2809061a644a674f462b6f2a9ef0d20d4369d38
|
[] |
no_license
|
py100/University
|
d936dd071cca6c7db83551f15a952ffce2f4764c
|
45906ae95c22597b834aaf153730196541b45e06
|
refs/heads/master
| 2021-06-09T05:49:23.656824
| 2016-10-27T08:22:52
| 2016-10-27T08:22:52
| 53,556,979
| 1
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,440
|
cpp
|
C.cpp
|
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
using namespace std;
int sg[10001][10001];
int main()
{
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
#endif
for(int i = 1; i <= 2000; i ++)
{
for(int j = i; j <= 2000; j++)
{
sg[i][j] = 1;
if(j % i == 0) continue;
for(int k = 1; k * i <= j; k++)
{
sg[i][j] = min(sg[i][j], sg[min(i, j - k * i)][max(i, j - k * i)]);
}
if(sg[i][j] == 0) sg[i][j] = 1;
else sg[i][j] = 0;
}
}
for(int i = 1; i <= 30; i++)
for(int j = 1; j <= 30; j++)
{
printf("%d%c", sg[i][j], j == 30? '\n' : ' ');
}
int cnt[1200] = {0};
for(int i = 1; i <= 1000; i++)
for(int j = i; j <= 2000; j++)
{
// printf("%d%c", sg[i][j], j == 30? '\n' : ' ');
if(sg[i][j] == 0) cnt[i]++;
}
for(int i = 1; i <= 1000; i++)
{
int tmp = i * (1 + sqrt(5.0))/2.0;
printf("cnt %d\n", cnt[i]);
if(i + cnt[i] != tmp) {printf("%d %d\n%d %d\n%d\n",i+1, tmp,i+1,i+cnt[i], i);return 0;}
}
printf("after check\n");
// int n, m;
// while(scanf("%d%d",&n,&m) != EOF)
// {
// if(n + m == 0) break;
// if(n > m) swap(n, m);
// int tmp = n * (1 + sqrt(5.0))/2;
// if(m <= tmp) printf("Ollie wins\n");
// else printf("Stan wins\n");
// }
return 0;
}
|
3558e1f9606bbe8662be620a859bb97a1a4c5a36
|
e8580d1e5b8d7cb5eea3d9e3a77a166cdb4162f0
|
/base/include/System/FailableForward.hpp
|
0d35a7bb73d808c97149b37c5a502f61ab889fe7
|
[
"Apache-2.0"
] |
permissive
|
djdron/gamesparks-cpp-base
|
ea149f88eddd34b4a942ecb5181fafd960821eb3
|
00b8af5dc2b58b7954cfa5d99c5ea7ded7115af8
|
refs/heads/master
| 2020-12-21T20:36:59.789667
| 2019-02-19T11:25:03
| 2019-02-19T11:25:03
| 236,551,142
| 0
| 0
|
Apache-2.0
| 2020-01-27T17:36:19
| 2020-01-27T17:36:18
| null |
UTF-8
|
C++
| false
| false
| 568
|
hpp
|
FailableForward.hpp
|
#ifndef _SYSTEM_FAILABLE_FORWARD_HPP_INCLUDED_
#define _SYSTEM_FAILABLE_FORWARD_HPP_INCLUDED_
#if (defined(__clang__) || (defined(__GNUC__) && __GNUC__ >= 5))
# if __has_attribute(warn_unused_result)
# define GS_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__))
# endif
#elif defined(_MSC_VER) && !defined(IW_SDK)
# define GS_WARN_UNUSED_RESULT //_Check_return_
#else
# define GS_WARN_UNUSED_RESULT
#endif
namespace System
{
template <typename T>
class GS_WARN_UNUSED_RESULT Failable;
}
#endif /* _SYSTEM_FAILABLE_FORWARD_HPP_INCLUDED_ */
|
28f52002407d892985f7c1f329e468268c4569f2
|
1d8484881e4433d6a7436d0d3467fd99ed266362
|
/include/bit/stl/memory/detail/clone_ptr.inl
|
e0933dba07e12cdf1f5087099c5cd46a0e8841cd
|
[
"MIT",
"LicenseRef-scancode-free-unknown"
] |
permissive
|
bitwizeshift/bit-stl
|
a8497a46abc0d104aa10ed3e8d00739301bbe05a
|
cec555fbda2ea1b6e126fa719637dde8d3f2ddd3
|
refs/heads/develop
| 2021-01-11T14:56:30.998822
| 2018-08-15T21:22:28
| 2018-08-15T21:22:28
| 80,256,758
| 8
| 1
|
MIT
| 2019-04-11T17:22:15
| 2017-01-28T00:10:46
|
C++
|
UTF-8
|
C++
| false
| false
| 16,207
|
inl
|
clone_ptr.inl
|
#ifndef BIT_STL_MEMORY_DETAIL_CLONE_PTR_INL
#define BIT_STL_MEMORY_DETAIL_CLONE_PTR_INL
//============================================================================
// detail::clone_ptr_pointer
//============================================================================
//----------------------------------------------------------------------------
// Constructor
//----------------------------------------------------------------------------
template<typename T, typename Deleter, typename Allocator>
bit::stl::detail::clone_ptr_pointer<T,Deleter,Allocator>
::clone_ptr_pointer( T* pointer, const Deleter& deleter, const Allocator& allocator )
: m_storage( pointer, deleter, allocator )
{
}
//----------------------------------------------------------------------------
//
//----------------------------------------------------------------------------
template<typename T, typename Deleter, typename Allocator>
void* bit::stl::detail::clone_ptr_pointer<T,Deleter,Allocator>
::get_deleter( const std::type_info& info )
noexcept
{
if( typeid(Deleter) == info ) {
return std::addressof(m_storage.second().second());
}
return nullptr;
}
template<typename T, typename Deleter, typename Allocator>
bit::stl::detail::clone_ptr_base*
bit::stl::detail::clone_ptr_pointer<T,Deleter,Allocator>::clone()
{
using control_block = detail::clone_ptr_emplace<T,Allocator>;
using alloc_traits = typename std::allocator_traits<Allocator>::template rebind_traits<control_block>;
using allocator = typename alloc_traits::allocator_type;
using destructor = allocator_deleter<allocator>;
auto& alloc = m_storage.second().first();
auto alloc2 = allocator();
auto d = destructor{alloc2,1};
std::unique_ptr<control_block,destructor> hold( alloc2.allocate(1), d );
alloc_traits::construct( alloc, hold.get(), alloc, *m_storage.first() );
return hold.release();
}
template<typename T, typename Deleter, typename Allocator>
void bit::stl::detail::clone_ptr_pointer<T,Deleter,Allocator>::destroy()
{
using control_block = clone_ptr_pointer<T,Deleter,Allocator>;
using atraits = typename std::allocator_traits<Allocator>::template rebind_traits<control_block>;
using ptraits = std::pointer_traits<typename atraits::pointer>;
using allocator = typename atraits::allocator_type;
// Delete the underlying type, the allocator, and this control block
allocator alloc(m_storage.second());
m_storage.first().second()(m_storage.first().first());
m_storage.first().second().~Deleter();
m_storage.second().~Allocator();
alloc.deallocate( ptraits::pointer_to(*this), 1);
}
//============================================================================
// detail::clone_ptr_emplace
//============================================================================
//----------------------------------------------------------------------------
// Contructor
//----------------------------------------------------------------------------
template<typename T, typename Allocator>
template<typename...Args>
bit::stl::detail::clone_ptr_emplace<T,Allocator>
::clone_ptr_emplace( Allocator alloc, Args&&...args )
: m_storage( std::piecewise_construct,
std::forward_as_tuple(alloc),
std::forward_as_tuple(std::forward<Args>(args)...) )
{
}
//----------------------------------------------------------------------------
//
//----------------------------------------------------------------------------
template<typename T, typename Allocator>
void* bit::stl::detail::clone_ptr_emplace<T,Allocator>
::get_deleter( const std::type_info& info )
noexcept
{
return nullptr;
}
template<typename T, typename Allocator>
bit::stl::detail::clone_ptr_base*
bit::stl::detail::clone_ptr_emplace<T,Allocator>::clone()
{
using control_block = detail::clone_ptr_emplace<T,Allocator>;
using alloc_traits = typename std::allocator_traits<Allocator>::template rebind_traits<control_block>;
using allocator = typename alloc_traits::allocator_type;
using destructor = allocator_deleter<allocator>;
auto& alloc = m_storage.first();
auto alloc2 = allocator();
auto d = destructor{alloc2,1};
std::unique_ptr<control_block,destructor> hold( alloc2.allocate(1), d );
alloc_traits::construct( alloc2, hold.get(), alloc2, m_storage.second() );
return hold.release();
}
template<typename T, typename Allocator>
void bit::stl::detail::clone_ptr_emplace<T,Allocator>::destroy()
{
using control_block = clone_ptr_emplace<T,Allocator>;
using atraits = typename std::allocator_traits<Allocator>::template rebind_traits<control_block>;
using ptraits = std::pointer_traits<typename atraits::pointer>;
using allocator = typename atraits::allocator_type;
// Destruct the underlying type, the allocator, and this control block
auto alloc = allocator(m_storage.first());
m_storage.first().~Allocator();
m_storage.second().~T();
alloc.deallocate( ptraits::pointer_to(*this), 1);
}
template<typename T, typename Allocator>
T* bit::stl::detail::clone_ptr_emplace<T,Allocator>::get()
noexcept
{
return std::addressof(m_storage.second());
}
//============================================================================
// clone_ptr<T>
//============================================================================
//----------------------------------------------------------------------------
// Constructors / Destructor / Assignment
//----------------------------------------------------------------------------
template<typename T>
bit::stl::clone_ptr<T>::clone_ptr()
noexcept
: m_control_block( nullptr ),
m_ptr( nullptr )
{
}
template<typename T>
bit::stl::clone_ptr<T>::clone_ptr( std::nullptr_t )
noexcept
: clone_ptr()
{
}
template<typename T>
template<typename U, typename>
bit::stl::clone_ptr<T>::clone_ptr( U* ptr )
noexcept
: clone_ptr( ptr, std::default_delete<U>{} )
{
}
template<typename T>
template<typename U, typename Deleter, typename>
bit::stl::clone_ptr<T>::clone_ptr( U* ptr, Deleter deleter )
: clone_ptr( ptr, deleter, std::allocator<void>{} )
{
}
template<typename T>
template<typename Deleter, typename Allocator>
bit::stl::clone_ptr<T>::clone_ptr( std::nullptr_t, Deleter deleter )
: clone_ptr( nullptr, deleter, std::allocator<void>{} )
{
}
template<typename T>
template<typename U, typename Deleter, typename Allocator, typename>
bit::stl::clone_ptr<T>::clone_ptr( U* ptr, Deleter deleter, Allocator alloc )
: m_control_block(nullptr),
m_ptr(ptr)
{
reset( ptr, deleter, alloc );
}
template<typename T>
template<typename Deleter, typename Allocator>
bit::stl::clone_ptr<T>::clone_ptr( std::nullptr_t, Deleter, Allocator )
: m_control_block(nullptr),
m_ptr(nullptr)
{
}
template<typename T>
bit::stl::clone_ptr<T>::clone_ptr( const clone_ptr& other )
: m_control_block( other.m_control_block->clone() ),
m_ptr(nullptr)
{
// TODO: Adjust m_ptr
}
template<typename T>
template<typename U, typename>
bit::stl::clone_ptr<T>::clone_ptr( const clone_ptr<U>& other )
: m_control_block( other.m_control_block->clone() ),
m_ptr(nullptr)
{
// TODO: Adjust m_ptr
}
template<typename T>
bit::stl::clone_ptr<T>::clone_ptr( clone_ptr&& other )
noexcept
: m_control_block( other.m_control_block ),
m_ptr( other.m_ptr )
{
// TODO: Adjust m_ptr
other.m_control_block = nullptr;
other.m_ptr = nullptr;
}
template<typename T>
template<typename U, typename>
bit::stl::clone_ptr<T>::clone_ptr( clone_ptr<U>&& other )
noexcept
: m_control_block( other.m_control_block ),
m_ptr( other.m_ptr )
{
// TODO: Adjust m_ptr
other.m_control_block = nullptr;
other.m_ptr = nullptr;
}
template<typename T>
template<typename U, typename Deleter, typename>
bit::stl::clone_ptr<T>::clone_ptr( std::unique_ptr<U,Deleter>&& other )
noexcept
: clone_ptr( other.release(), other.get_deleter() )
{
}
//----------------------------------------------------------------------------
template<typename T>
bit::stl::clone_ptr<T>::~clone_ptr()
{
destroy();
}
//----------------------------------------------------------------------------
template<typename T>
bit::stl::clone_ptr<T>&
bit::stl::clone_ptr<T>::operator=( const clone_ptr& other )
{
destroy();
return (*this);
}
template<typename T>
template<typename U, typename>
bit::stl::clone_ptr<T>&
bit::stl::clone_ptr<T>::operator=( const clone_ptr<U>& other )
{
destroy();
return (*this);
}
template<typename T>
bit::stl::clone_ptr<T>&
bit::stl::clone_ptr<T>::operator=( clone_ptr&& other )
noexcept
{
destroy();
m_control_block = other.m_control_block;
m_ptr = other.m_ptr;
other.m_control_block = nullptr;
other.m_ptr = nullptr;
return (*this);
}
template<typename T>
template<typename U, typename>
bit::stl::clone_ptr<T>&
bit::stl::clone_ptr<T>::operator=( clone_ptr<U>&& other )
noexcept
{
destroy();
m_control_block = other.m_control_block;
m_ptr = other.m_ptr;
other.m_control_block = nullptr;
other.m_ptr = nullptr;
return (*this);
}
template<typename T>
template<typename U, typename Deleter, typename>
bit::stl::clone_ptr<T>&
bit::stl::clone_ptr<T>::operator=( std::unique_ptr<U,Deleter>&& other )
{
reset( other.release(), other.get_deleter() );
return (*this);
}
//----------------------------------------------------------------------------
// Modifiers
//----------------------------------------------------------------------------
template<typename T>
void bit::stl::clone_ptr<T>::reset()
noexcept
{
if( m_control_block ) {
m_control_block->destroy();
}
m_control_block = nullptr;
m_ptr = nullptr;
}
template<typename T>
template<typename U, typename>
void bit::stl::clone_ptr<T>::reset( U* ptr )
{
reset( ptr, std::default_delete<T>{} );
}
template<typename T>
template<typename U, typename Deleter, typename>
void bit::stl::clone_ptr<T>::reset( U* ptr, Deleter deleter )
{
reset( ptr, deleter, std::allocator<T>{} );
}
template<typename T>
template<typename U, typename Deleter, typename Allocator, typename>
void bit::stl::clone_ptr<T>::reset( U* ptr, Deleter deleter, Allocator alloc )
{
reset();
if(ptr) {
using control_block = detail::clone_ptr_pointer<T,Deleter,Allocator>;
using alloc_traits = typename std::allocator_traits<Allocator>::template rebind_traits<control_block>;
using allocator = typename alloc_traits::allocator_type;
using destructor = allocator_deleter<allocator>;
allocator alloc2(alloc);
destructor d{alloc2,1};
std::unique_ptr<control_block,destructor> hold( alloc2.allocate(1), d );
alloc_traits::construct( alloc2, hold.get(), ptr, deleter, alloc );
m_ptr = ptr;
m_control_block = hold.release();
}
}
//----------------------------------------------------------------------------
template<typename T>
void bit::stl::clone_ptr<T>::swap( clone_ptr<T>& other ) noexcept
{
using std::swap;
swap( m_ptr, other.m_ptr );
swap( m_control_block, other.m_control_block );
}
//----------------------------------------------------------------------------
// Observers
//----------------------------------------------------------------------------
template<typename T>
typename bit::stl::clone_ptr<T>::element_type*
bit::stl::clone_ptr<T>::get()
const noexcept
{
return m_ptr;
}
template<typename T>
bit::stl::clone_ptr<T>::operator bool()
const noexcept
{
return static_cast<bool>(m_ptr);
}
template<typename T>
std::add_lvalue_reference_t<T> bit::stl::clone_ptr<T>::operator*()
const noexcept
{
return *m_ptr;
}
template<typename T>
T* bit::stl::clone_ptr<T>::operator->()
const noexcept
{
return m_ptr;
}
//----------------------------------------------------------------------------
// Private Constructor
//----------------------------------------------------------------------------
template<typename T>
bit::stl::clone_ptr<T>::clone_ptr( ctor_tag,
detail::clone_ptr_base* control_block,
T* ptr )
noexcept
: m_control_block(control_block),
m_ptr(ptr)
{
}
//----------------------------------------------------------------------------
// Private Utilities
//----------------------------------------------------------------------------
template<typename T>
void* bit::stl::clone_ptr<T>::get_deleter( const std::type_info& info )
const noexcept
{
return m_control_block->get_deleter( info );
}
template<typename T>
void bit::stl::clone_ptr<T>::destroy()
{
if( m_control_block ) {
m_control_block->destroy();
}
}
//
//
//
template<typename T>
void bit::stl::swap( clone_ptr<T>& lhs, clone_ptr<T>& rhs )
noexcept
{
lhs.swap(rhs);
}
template<typename T, typename...Args>
bit::stl::clone_ptr<T> bit::stl::make_clone( Args&&...args )
{
using tag_type = typename clone_ptr<T>::ctor_tag;
using control_block = detail::clone_ptr_emplace<T,std::allocator<T>>;
using allocator = std::allocator<control_block>;
using alloc_traits = std::allocator_traits<allocator>;
using destructor = allocator_deleter<allocator>;
allocator alloc;
destructor d{alloc,1};
std::unique_ptr<control_block,destructor> hold( alloc.allocate(1), d );
alloc_traits::construct( alloc, hold.get(), alloc, std::forward<Args>(args)... );
auto* ptr = hold.get()->get();
auto* block = hold.release();
return { tag_type{}, block, ptr };
}
template<typename T, typename Allocator, typename...Args>
bit::stl::clone_ptr<T>
bit::stl::allocate_clone( const Allocator& alloc, Args&&...args )
{
using tag_type = typename clone_ptr<T>::ctor_tag;
using control_block = detail::clone_ptr_emplace<T,Allocator>;
using alloc_traits = typename std::allocator_traits<Allocator>::template rebind_traits<control_block>;
using allocator = typename alloc_traits::allocator_type;
using destructor = allocator_deleter<allocator>;
allocator alloc2(alloc);
destructor d{alloc2,1};
std::unique_ptr<control_block,destructor> hold( alloc2.allocate(1), d );
alloc_traits::construct( alloc, hold.get(), alloc, std::forward<Args>(args)... );
auto* ptr = hold.get()->get();
auto* block = hold.release();
return { tag_type{}, block, ptr };
}
template<typename Deleter, typename T>
Deleter* bit::stl::get_deleter( const clone_ptr<T>& p )
noexcept
{
return static_cast<Deleter*>( p.get_deleter( typeid(Deleter) ) );
}
//----------------------------------------------------------------------------
// Casts
//----------------------------------------------------------------------------
template<typename To, typename From>
bit::stl::clone_ptr<To>
bit::stl::casts::static_pointer_cast( clone_ptr<From>&& other )
{
using tag_type = typename clone_ptr<To>::ctor_tag;
auto* ptr = static_cast<To*>(other.get());
auto* block = other.m_control_block;
other.m_ptr = nullptr;
other.m_control_block = nullptr;
return { tag_type{}, block, ptr };
}
template<typename To, typename From>
bit::stl::clone_ptr<To>
bit::stl::casts::dynamic_pointer_cast( clone_ptr<From>&& other )
{
using tag_type = typename clone_ptr<To>::ctor_tag;
auto* ptr = dynamic_cast<To*>(other.get());
if( ptr ) {
auto* block = other.m_control_block;
other.m_ptr = nullptr;
other.m_control_block = nullptr;
return { tag_type{}, block, ptr };
}
return {};
}
template<typename To, typename From>
bit::stl::clone_ptr<To>
bit::stl::casts::const_pointer_cast( clone_ptr<From>&& other )
{
using tag_type = typename clone_ptr<To>::ctor_tag;
auto* ptr = const_cast<To*>(other.get());
auto* block = other.m_control_block;
other.m_ptr = nullptr;
other.m_control_block = nullptr;
return { tag_type{}, block, ptr };
}
template<typename To, typename From>
bit::stl::clone_ptr<To>
bit::stl::casts::reinterpret_pointer_cast( clone_ptr<From>&& other )
{
using tag_type = typename clone_ptr<To>::ctor_tag;
auto* ptr = reinterpret_cast<To*>(other.get());
auto* block = other.m_control_block;
other.m_ptr = nullptr;
other.m_control_block = nullptr;
return { tag_type{}, block, ptr };
}
#endif /* BIT_STL_MEMORY_DETAIL_CLONE_PTR_INL */
|
6c348cd9dcdb86e27e472ed83a47db11e2f15e06
|
6e05188324e022c145f35e9abb393e2d5f69b35a
|
/src/framework/crypt/declarations.h
|
744100da389143c8d6d6a1613b79bfd848ba3762
|
[] |
no_license
|
Pioryd/framework
|
53ca71dd6f966e1bafb0792dcf3b1f0cb904646e
|
b72d87a51fe2627d233b3422a304495406db6a08
|
refs/heads/master
| 2021-06-15T14:11:28.978378
| 2019-09-28T09:15:27
| 2019-09-28T09:15:27
| 200,518,669
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 188
|
h
|
declarations.h
|
#ifndef FW_CRYPT_DECLARATIONS_H
#define FW_CRYPT_DECLARATIONS_H
#include "../pch.h"
namespace FW::Crypt {
class Rsa;
} // namespace FW::Crypt
#endif // #ifndef FW_CRYPT_DECLARATIONS_H
|
862930773cc2ff4ccab6afbdb52a445769b75bdb
|
0af5f0cf42c45876acc531b1fb51544166ec43ae
|
/includes/acl/compression/impl/compact_constant_streams.h
|
df541e32443dd88047e7e53f855d68819fd7cf37
|
[
"MIT"
] |
permissive
|
nfrechette/acl
|
8cda80428ab81260d59611f2bf6848b2847897b5
|
427b948f87d43f666ac9983073790621c3848ae3
|
refs/heads/develop
| 2023-08-31T09:14:10.347985
| 2023-08-26T02:18:40
| 2023-08-26T11:16:11
| 91,615,309
| 1,172
| 89
|
MIT
| 2023-09-09T13:39:44
| 2017-05-17T20:02:25
|
C++
|
UTF-8
|
C++
| false
| false
| 34,614
|
h
|
compact_constant_streams.h
|
#pragma once
////////////////////////////////////////////////////////////////////////////////
// The MIT License (MIT)
//
// Copyright (c) 2017 Nicholas Frechette & Animation Compression Library contributors
//
// 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 "acl/version.h"
#include "acl/core/iallocator.h"
#include "acl/core/track_formats.h"
#include "acl/core/impl/compiler_utils.h"
#include "acl/core/error.h"
#include "acl/compression/impl/clip_context.h"
#include "acl/compression/impl/rigid_shell_utils.h"
#include "acl/compression/transform_error_metrics.h"
#include <rtm/qvvf.h>
#include <cstdint>
//////////////////////////////////////////////////////////////////////////
// Apply error correction after constant and default tracks are processed.
// Notes:
// - original code was adapted and cleaned up a bit, but largely as contributed
// - zero scale isn't properly handled and needs to be guarded against
// - regression testing over large data sets shows that it is sometimes a win, sometimes not
// - overall, it seems to be a net loss over the memory footprint and quality does not
// measurably improve to justify the loss
// - I tried various tweaks and failed to make the code a consistent win, see https://github.com/nfrechette/acl/issues/353
//#define ACL_IMPL_ENABLE_CONSTANT_ERROR_CORRECTION
#ifdef ACL_IMPL_ENABLE_CONSTANT_ERROR_CORRECTION
#include "acl/compression/impl/normalize_streams.h"
#endif
ACL_IMPL_FILE_PRAGMA_PUSH
namespace acl
{
ACL_IMPL_VERSION_NAMESPACE_BEGIN
namespace acl_impl
{
// To detect if a sub-track is constant, we grab the first sample as our reference.
// We then measure the object space error using the qvv error metric and our
// dominant shell distance. If the error remains within our dominant precision
// then the sub-track is constant. We perform the same test using the default
// sub-track value to determine if it is a default sub-track.
inline bool RTM_SIMD_CALL are_samples_constant(const compression_settings& settings,
const clip_context& lossy_clip_context, const clip_context& additive_base_clip_context,
rtm::vector4f_arg0 reference, uint32_t transform_index, animation_track_type8 sub_track_type)
{
const segment_context& lossy_segment = lossy_clip_context.segments[0];
const transform_streams& raw_transform_stream = lossy_segment.bone_streams[transform_index];
const rigid_shell_metadata_t& shell = lossy_clip_context.clip_shell_metadata[transform_index];
const itransform_error_metric& error_metric = *settings.error_metric;
const bool has_additive_base = lossy_clip_context.has_additive_base;
const bool needs_conversion = error_metric.needs_conversion(lossy_clip_context.has_scale);
const uint32_t dirty_transform_indices[2] = { 0, 1 };
rtm::qvvf local_transforms[2];
rtm::qvvf base_transforms[2];
alignas(16) uint8_t local_transforms_converted[1024]; // Big enough for 2 transforms for sure
alignas(16) uint8_t base_transforms_converted[1024]; // Big enough for 2 transforms for sure
const size_t metric_transform_size = error_metric.get_transform_size(lossy_clip_context.has_scale);
ACL_ASSERT(metric_transform_size * 2 <= sizeof(local_transforms_converted), "Transform size is too large");
itransform_error_metric::convert_transforms_args convert_transforms_args_local;
convert_transforms_args_local.dirty_transform_indices = &dirty_transform_indices[0];
convert_transforms_args_local.num_dirty_transforms = 1;
convert_transforms_args_local.num_transforms = 1;
convert_transforms_args_local.is_additive_base = false;
itransform_error_metric::convert_transforms_args convert_transforms_args_base;
convert_transforms_args_base.dirty_transform_indices = &dirty_transform_indices[0];
convert_transforms_args_base.num_dirty_transforms = 2;
convert_transforms_args_base.num_transforms = 2;
convert_transforms_args_base.transforms = &base_transforms[0];
convert_transforms_args_base.is_additive_base = true;
convert_transforms_args_base.is_lossy = false;
itransform_error_metric::apply_additive_to_base_args apply_additive_to_base_args;
apply_additive_to_base_args.dirty_transform_indices = &dirty_transform_indices[0];
apply_additive_to_base_args.num_dirty_transforms = 2;
apply_additive_to_base_args.base_transforms = needs_conversion ? (const void*)&base_transforms_converted[0] : (const void*)&base_transforms[0];
apply_additive_to_base_args.local_transforms = needs_conversion ? (const void*)&local_transforms_converted[0] : (const void*)&local_transforms[0];
apply_additive_to_base_args.num_transforms = 2;
qvvf_transform_error_metric::calculate_error_args calculate_error_args;
calculate_error_args.construct_sphere_shell(shell.local_shell_distance);
calculate_error_args.transform0 = &local_transforms_converted[metric_transform_size * 0];
calculate_error_args.transform1 = &local_transforms_converted[metric_transform_size * 1];
const rtm::scalarf precision = rtm::scalar_set(shell.precision);
const uint32_t num_samples = lossy_clip_context.num_samples;
for (uint32_t sample_index = 0; sample_index < num_samples; ++sample_index)
{
const rtm::quatf raw_rotation = raw_transform_stream.rotations.get_sample_clamped(sample_index);
const rtm::vector4f raw_translation = raw_transform_stream.translations.get_sample_clamped(sample_index);
const rtm::vector4f raw_scale = raw_transform_stream.scales.get_sample_clamped(sample_index);
rtm::qvvf raw_transform = rtm::qvv_set(raw_rotation, raw_translation, raw_scale);
rtm::qvvf lossy_transform = raw_transform; // Copy the raw transform
// Fix up our lossy transform with the reference value
switch (sub_track_type)
{
case animation_track_type8::rotation:
default:
lossy_transform.rotation = rtm::vector_to_quat(reference);
break;
case animation_track_type8::translation:
lossy_transform.translation = reference;
break;
case animation_track_type8::scale:
lossy_transform.scale = reference;
break;
}
local_transforms[0] = raw_transform;
local_transforms[1] = lossy_transform;
if (needs_conversion)
{
convert_transforms_args_local.sample_index = sample_index;
convert_transforms_args_local.transforms = &local_transforms[0];
convert_transforms_args_local.is_lossy = false;
error_metric.convert_transforms(convert_transforms_args_local, &local_transforms_converted[metric_transform_size * 0]);
convert_transforms_args_local.transforms = &local_transforms[1];
convert_transforms_args_local.is_lossy = true;
error_metric.convert_transforms(convert_transforms_args_local, &local_transforms_converted[metric_transform_size * 1]);
}
else
std::memcpy(&local_transforms_converted[0], &local_transforms[0], metric_transform_size * 2);
if (has_additive_base)
{
const segment_context& additive_base_segment = additive_base_clip_context.segments[0];
const transform_streams& additive_base_bone_stream = additive_base_segment.bone_streams[transform_index];
// The sample time is calculated from the full clip duration to be consistent with decompression
const float sample_time = rtm::scalar_min(float(sample_index) / lossy_clip_context.sample_rate, lossy_clip_context.duration);
const float normalized_sample_time = additive_base_segment.num_samples > 1 ? (sample_time / lossy_clip_context.duration) : 0.0F;
const float additive_sample_time = additive_base_segment.num_samples > 1 ? (normalized_sample_time * additive_base_clip_context.duration) : 0.0F;
// With uniform sample distributions, we do not interpolate.
const uint32_t base_sample_index = get_uniform_sample_key(additive_base_segment, additive_sample_time);
const rtm::quatf base_rotation = additive_base_bone_stream.rotations.get_sample_clamped(base_sample_index);
const rtm::vector4f base_translation = additive_base_bone_stream.translations.get_sample_clamped(base_sample_index);
const rtm::vector4f base_scale = additive_base_bone_stream.scales.get_sample_clamped(base_sample_index);
const rtm::qvvf base_transform = rtm::qvv_set(base_rotation, base_translation, base_scale);
base_transforms[0] = base_transform;
base_transforms[1] = base_transform;
if (needs_conversion)
{
convert_transforms_args_base.sample_index = base_sample_index;
error_metric.convert_transforms(convert_transforms_args_base, &base_transforms_converted[0]);
}
else
std::memcpy(&base_transforms_converted[0], &base_transforms[0], metric_transform_size * 2);
error_metric.apply_additive_to_base(apply_additive_to_base_args, &local_transforms_converted[0]);
}
const rtm::scalarf vtx_error = error_metric.calculate_error(calculate_error_args);
// If our error exceeds the desired precision, we are not constant
if (rtm::scalar_greater_than(vtx_error, precision))
return false;
}
// All samples were tested against the reference value and the error remained within tolerance
return true;
}
inline bool are_rotations_constant(const compression_settings& settings, const clip_context& lossy_clip_context, const clip_context& additive_base_clip_context, uint32_t transform_index)
{
if (lossy_clip_context.num_samples == 0)
return true; // We are constant if we have no samples
// When we are using full precision, we are only constant if range.min == range.max, meaning
// we have a single unique and repeating sample
// We want to test if we are binary exact
// This is used by raw clips, we must preserve the original values
if (settings.rotation_format == rotation_format8::quatf_full)
return lossy_clip_context.ranges[transform_index].rotation.is_constant(0.0F);
const segment_context& segment = lossy_clip_context.segments[0];
const transform_streams& raw_transform_stream = segment.bone_streams[transform_index];
// Otherwise check every sample to make sure we fall within the desired tolerance
return are_samples_constant(settings, lossy_clip_context, additive_base_clip_context, rtm::quat_to_vector(raw_transform_stream.rotations.get_sample(0)), transform_index, animation_track_type8::rotation);
}
inline bool are_rotations_default(const compression_settings& settings, const clip_context& lossy_clip_context, const clip_context& additive_base_clip_context, const track_desc_transformf& desc, uint32_t transform_index)
{
if (lossy_clip_context.num_samples == 0)
return true; // We are default if we have no samples
const rtm::vector4f default_bind_rotation = rtm::quat_to_vector(desc.default_value.rotation);
// When we are using full precision, we are only default if (sample 0 == default value), meaning
// we have a single unique and repeating default sample
// We want to test if we are binary exact
// This is used by raw clips, we must preserve the original values
if (settings.rotation_format == rotation_format8::quatf_full)
{
const segment_context& segment = lossy_clip_context.segments[0];
const transform_streams& raw_transform_stream = segment.bone_streams[transform_index];
const rtm::vector4f rotation = raw_transform_stream.rotations.get_raw_sample<rtm::vector4f>(0);
return rtm::vector_all_equal(rotation, default_bind_rotation);
}
// Otherwise check every sample to make sure we fall within the desired tolerance
return are_samples_constant(settings, lossy_clip_context, additive_base_clip_context, default_bind_rotation, transform_index, animation_track_type8::rotation);
}
inline bool are_translations_constant(const compression_settings& settings, const clip_context& lossy_clip_context, const clip_context& additive_base_clip_context, uint32_t transform_index)
{
if (lossy_clip_context.num_samples == 0)
return true; // We are constant if we have no samples
// When we are using full precision, we are only constant if range.min == range.max, meaning
// we have a single unique and repeating sample
// We want to test if we are binary exact
// This is used by raw clips, we must preserve the original values
if (settings.translation_format == vector_format8::vector3f_full)
return lossy_clip_context.ranges[transform_index].translation.is_constant(0.0F);
const segment_context& segment = lossy_clip_context.segments[0];
const transform_streams& raw_transform_stream = segment.bone_streams[transform_index];
// Otherwise check every sample to make sure we fall within the desired tolerance
return are_samples_constant(settings, lossy_clip_context, additive_base_clip_context, raw_transform_stream.translations.get_sample(0), transform_index, animation_track_type8::translation);
}
inline bool are_translations_default(const compression_settings& settings, const clip_context& lossy_clip_context, const clip_context& additive_base_clip_context, const track_desc_transformf& desc, uint32_t transform_index)
{
if (lossy_clip_context.num_samples == 0)
return true; // We are default if we have no samples
const rtm::vector4f default_bind_translation = desc.default_value.translation;
// When we are using full precision, we are only default if (sample 0 == default value), meaning
// we have a single unique and repeating default sample
// We want to test if we are binary exact
// This is used by raw clips, we must preserve the original values
if (settings.translation_format == vector_format8::vector3f_full)
{
const segment_context& segment = lossy_clip_context.segments[0];
const transform_streams& raw_transform_stream = segment.bone_streams[transform_index];
const rtm::vector4f translation = raw_transform_stream.translations.get_raw_sample<rtm::vector4f>(0);
return rtm::vector_all_equal(translation, default_bind_translation);
}
// Otherwise check every sample to make sure we fall within the desired tolerance
return are_samples_constant(settings, lossy_clip_context, additive_base_clip_context, default_bind_translation, transform_index, animation_track_type8::translation);
}
inline bool are_scales_constant(const compression_settings& settings, const clip_context& lossy_clip_context, const clip_context& additive_base_clip_context, uint32_t transform_index)
{
if (lossy_clip_context.num_samples == 0)
return true; // We are constant if we have no samples
if (!lossy_clip_context.has_scale)
return true; // We are constant if we have no scale
// When we are using full precision, we are only constant if range.min == range.max, meaning
// we have a single unique and repeating sample
// We want to test if we are binary exact
// This is used by raw clips, we must preserve the original values
if (settings.scale_format == vector_format8::vector3f_full)
return lossy_clip_context.ranges[transform_index].scale.is_constant(0.0F);
const segment_context& segment = lossy_clip_context.segments[0];
const transform_streams& raw_transform_stream = segment.bone_streams[transform_index];
// Otherwise check every sample to make sure we fall within the desired tolerance
return are_samples_constant(settings, lossy_clip_context, additive_base_clip_context, raw_transform_stream.scales.get_sample(0), transform_index, animation_track_type8::scale);
}
inline bool are_scales_default(const compression_settings& settings, const clip_context& lossy_clip_context, const clip_context& additive_base_clip_context, const track_desc_transformf& desc, uint32_t transform_index)
{
if (lossy_clip_context.num_samples == 0)
return true; // We are default if we have no samples
if (!lossy_clip_context.has_scale)
return true; // We are default if we have no scale
const rtm::vector4f default_bind_scale = desc.default_value.scale;
// When we are using full precision, we are only default if (sample 0 == default value), meaning
// we have a single unique and repeating default sample
// We want to test if we are binary exact
// This is used by raw clips, we must preserve the original values
if (settings.scale_format == vector_format8::vector3f_full)
{
const segment_context& segment = lossy_clip_context.segments[0];
const transform_streams& raw_transform_stream = segment.bone_streams[transform_index];
const rtm::vector4f scale = raw_transform_stream.scales.get_raw_sample<rtm::vector4f>(0);
return rtm::vector_all_equal(scale, default_bind_scale);
}
// Otherwise check every sample to make sure we fall within the desired tolerance
return are_samples_constant(settings, lossy_clip_context, additive_base_clip_context, default_bind_scale, transform_index, animation_track_type8::scale);
}
// Compacts constant sub-tracks
// A sub-track is constant if every sample can be replaced by a single unique sample without exceeding
// our error threshold.
// By default, constant sub-tracks will retain the first sample.
// A constant sub-track is a default sub-track if its unique sample can be replaced by the default value
// without exceeding our error threshold.
inline void compact_constant_streams(iallocator& allocator, clip_context& context, const clip_context& additive_base_clip_context, const track_array_qvvf& track_list, const compression_settings& settings)
{
ACL_ASSERT(context.num_segments == 1, "context must contain a single segment!");
segment_context& segment = context.segments[0];
const uint32_t num_transforms = context.num_bones;
const uint32_t num_samples = context.num_samples;
uint32_t num_default_bone_scales = 0;
#ifdef ACL_IMPL_ENABLE_CONSTANT_ERROR_CORRECTION
bool has_constant_bone_rotations = false;
bool has_constant_bone_translations = false;
bool has_constant_bone_scales = false;
#endif
// Iterate in any order, doesn't matter
for (uint32_t transform_index = 0; transform_index < num_transforms; ++transform_index)
{
const track_desc_transformf& desc = track_list[transform_index].get_description();
transform_streams& bone_stream = segment.bone_streams[transform_index];
transform_range& bone_range = context.ranges[transform_index];
ACL_ASSERT(bone_stream.rotations.get_num_samples() == num_samples, "Rotation sample mismatch!");
ACL_ASSERT(bone_stream.translations.get_num_samples() == num_samples, "Translation sample mismatch!");
ACL_ASSERT(bone_stream.scales.get_num_samples() == num_samples, "Scale sample mismatch!");
// We expect all our samples to have the same width of sizeof(rtm::vector4f)
ACL_ASSERT(bone_stream.rotations.get_sample_size() == sizeof(rtm::vector4f), "Unexpected rotation sample size. %u != %zu", bone_stream.rotations.get_sample_size(), sizeof(rtm::vector4f));
ACL_ASSERT(bone_stream.translations.get_sample_size() == sizeof(rtm::vector4f), "Unexpected translation sample size. %u != %zu", bone_stream.translations.get_sample_size(), sizeof(rtm::vector4f));
ACL_ASSERT(bone_stream.scales.get_sample_size() == sizeof(rtm::vector4f), "Unexpected scale sample size. %u != %zu", bone_stream.scales.get_sample_size(), sizeof(rtm::vector4f));
if (are_rotations_constant(settings, context, additive_base_clip_context, transform_index))
{
rotation_track_stream constant_stream(allocator, 1, bone_stream.rotations.get_sample_size(), bone_stream.rotations.get_sample_rate(), bone_stream.rotations.get_rotation_format());
const rtm::vector4f default_bind_rotation = rtm::quat_to_vector(desc.default_value.rotation);
rtm::vector4f rotation = num_samples != 0 ? bone_stream.rotations.get_raw_sample<rtm::vector4f>(0) : default_bind_rotation;
bone_stream.is_rotation_constant = true;
if (are_rotations_default(settings, context, additive_base_clip_context, desc, transform_index))
{
bone_stream.is_rotation_default = true;
rotation = default_bind_rotation;
}
constant_stream.set_raw_sample(0, rotation);
bone_stream.rotations = std::move(constant_stream);
bone_range.rotation = track_stream_range::from_min_extent(rotation, rtm::vector_zero());
#ifdef ACL_IMPL_ENABLE_CONSTANT_ERROR_CORRECTION
has_constant_bone_rotations = true;
#endif
}
if (are_translations_constant(settings, context, additive_base_clip_context, transform_index))
{
translation_track_stream constant_stream(allocator, 1, bone_stream.translations.get_sample_size(), bone_stream.translations.get_sample_rate(), bone_stream.translations.get_vector_format());
const rtm::vector4f default_bind_translation = desc.default_value.translation;
rtm::vector4f translation = num_samples != 0 ? bone_stream.translations.get_raw_sample<rtm::vector4f>(0) : default_bind_translation;
bone_stream.is_translation_constant = true;
if (are_translations_default(settings, context, additive_base_clip_context, desc, transform_index))
{
bone_stream.is_translation_default = true;
translation = default_bind_translation;
}
constant_stream.set_raw_sample(0, translation);
bone_stream.translations = std::move(constant_stream);
// Zero out W, could be garbage
bone_range.translation = track_stream_range::from_min_extent(rtm::vector_set_w(translation, 0.0F), rtm::vector_zero());
#ifdef ACL_IMPL_ENABLE_CONSTANT_ERROR_CORRECTION
has_constant_bone_translations = true;
#endif
}
if (are_scales_constant(settings, context, additive_base_clip_context, transform_index))
{
scale_track_stream constant_stream(allocator, 1, bone_stream.scales.get_sample_size(), bone_stream.scales.get_sample_rate(), bone_stream.scales.get_vector_format());
const rtm::vector4f default_bind_scale = desc.default_value.scale;
rtm::vector4f scale = (context.has_scale && num_samples != 0) ? bone_stream.scales.get_raw_sample<rtm::vector4f>(0) : default_bind_scale;
bone_stream.is_scale_constant = true;
if (are_scales_default(settings, context, additive_base_clip_context, desc, transform_index))
{
bone_stream.is_scale_default = true;
scale = default_bind_scale;
}
constant_stream.set_raw_sample(0, scale);
bone_stream.scales = std::move(constant_stream);
// Zero out W, could be garbage
bone_range.scale = track_stream_range::from_min_extent(rtm::vector_set_w(scale, 0.0F), rtm::vector_zero());
num_default_bone_scales += bone_stream.is_scale_default ? 1 : 0;
#ifdef ACL_IMPL_ENABLE_CONSTANT_ERROR_CORRECTION
has_constant_bone_scales = true;
#endif
}
}
const bool has_scale = num_default_bone_scales != num_transforms;
context.has_scale = has_scale;
#ifdef ACL_IMPL_ENABLE_CONSTANT_ERROR_CORRECTION
// Only perform error compensation if our format isn't raw
const bool is_raw = settings.rotation_format == rotation_format8::quatf_full || settings.translation_format == vector_format8::vector3f_full || settings.scale_format == vector_format8::vector3f_full;
// Only perform error compensation if we are lossy due to constant sub-tracks
// In practice, even if we have no constant sub-tracks, we could be lossy if our rotations drop W
const bool is_lossy = has_constant_bone_rotations || has_constant_bone_translations || (has_scale && has_constant_bone_scales);
if (!context.has_additive_base && !is_raw && is_lossy)
{
// Apply error correction after constant and default tracks are processed.
// We use object space of the original data as ground truth, and only deviate for 2 reasons, and as briefly as possible.
// -Replace an original local value with a new constant value.
// -Correct for the manipulation of an original local value by an ancestor ASAP.
// We aren't modifying raw data here. We're modifying the raw channels generated from the raw data.
// The raw data is left alone, and is still used at the end of the process to do regression testing.
struct dirty_state_t
{
bool rotation = false;
bool translation = false;
bool scale = false;
};
dirty_state_t any_constant_changed;
dirty_state_t* dirty_states = allocate_type_array<dirty_state_t>(allocator, num_transforms);
rtm::qvvf* original_object_pose = allocate_type_array<rtm::qvvf>(allocator, num_transforms);
rtm::qvvf* adjusted_object_pose = allocate_type_array<rtm::qvvf>(allocator, num_transforms);
for (uint32_t sample_index = 0; sample_index < num_samples; ++sample_index)
{
// Iterate over parent transforms first
for (uint32_t bone_index : make_iterator(context.sorted_transforms_parent_first, num_transforms))
{
rtm::qvvf& original_object_transform = original_object_pose[bone_index];
const transform_range& bone_range = context.ranges[bone_index];
transform_streams& bone_stream = segment.bone_streams[bone_index];
transform_streams& raw_bone_stream = raw_segment.bone_streams[bone_index];
const track_desc_transformf& desc = track_list[bone_index].get_description();
const uint32_t parent_bone_index = desc.parent_index;
const rtm::qvvf original_local_transform = rtm::qvv_set(
raw_bone_stream.rotations.get_raw_sample<rtm::quatf>(sample_index),
raw_bone_stream.translations.get_raw_sample<rtm::vector4f>(sample_index),
raw_bone_stream.scales.get_raw_sample<rtm::vector4f>(sample_index));
if (parent_bone_index == k_invalid_track_index)
original_object_transform = original_local_transform; // Just copy the root as-is, it has no parent and thus local and object space transforms are equal
else if (!has_scale)
original_object_transform = rtm::qvv_normalize(rtm::qvv_mul_no_scale(original_local_transform, original_object_pose[parent_bone_index]));
else
original_object_transform = rtm::qvv_normalize(rtm::qvv_mul(original_local_transform, original_object_pose[parent_bone_index]));
rtm::qvvf adjusted_local_transform = original_local_transform;
dirty_state_t& constant_changed = dirty_states[bone_index];
constant_changed.rotation = false;
constant_changed.translation = false;
constant_changed.scale = false;
if (bone_stream.is_rotation_constant)
{
const rtm::quatf constant_rotation = rtm::vector_to_quat(bone_range.rotation.get_min());
if (!rtm::vector_all_near_equal(rtm::quat_to_vector(adjusted_local_transform.rotation), rtm::quat_to_vector(constant_rotation), 0.0F))
{
any_constant_changed.rotation = true;
constant_changed.rotation = true;
adjusted_local_transform.rotation = constant_rotation;
raw_bone_stream.rotations.set_raw_sample(sample_index, constant_rotation);
}
ACL_ASSERT(bone_stream.rotations.get_num_samples() == 1, "Constant rotation stream mismatch!");
ACL_ASSERT(rtm::vector_all_near_equal(bone_stream.rotations.get_raw_sample<rtm::vector4f>(0), rtm::quat_to_vector(constant_rotation), 0.0F), "Constant rotation mismatch!");
}
if (bone_stream.is_translation_constant)
{
const rtm::vector4f constant_translation = bone_range.translation.get_min();
if (!rtm::vector_all_near_equal3(adjusted_local_transform.translation, constant_translation, 0.0F))
{
any_constant_changed.translation = true;
constant_changed.translation = true;
adjusted_local_transform.translation = constant_translation;
raw_bone_stream.translations.set_raw_sample(sample_index, constant_translation);
}
ACL_ASSERT(bone_stream.translations.get_num_samples() == 1, "Constant translation stream mismatch!");
ACL_ASSERT(rtm::vector_all_near_equal3(bone_stream.translations.get_raw_sample<rtm::vector4f>(0), constant_translation, 0.0F), "Constant translation mismatch!");
}
if (has_scale && bone_stream.is_scale_constant)
{
const rtm::vector4f constant_scale = bone_range.scale.get_min();
if (!rtm::vector_all_near_equal3(adjusted_local_transform.scale, constant_scale, 0.0F))
{
any_constant_changed.scale = true;
constant_changed.scale = true;
adjusted_local_transform.scale = constant_scale;
raw_bone_stream.scales.set_raw_sample(sample_index, constant_scale);
}
ACL_ASSERT(bone_stream.scales.get_num_samples() == 1, "Constant scale stream mismatch!");
ACL_ASSERT(rtm::vector_all_near_equal3(bone_stream.scales.get_raw_sample<rtm::vector4f>(0), constant_scale, 0.0F), "Constant scale mismatch!");
}
rtm::qvvf& adjusted_object_transform = adjusted_object_pose[bone_index];
if (parent_bone_index == k_invalid_track_index)
{
adjusted_object_transform = adjusted_local_transform; // Just copy the root as-is, it has no parent and thus local and object space transforms are equal
}
else
{
const dirty_state_t& parent_constant_changed = dirty_states[parent_bone_index];
const rtm::qvvf& parent_adjusted_object_transform = adjusted_object_pose[parent_bone_index];
if (bone_stream.is_rotation_constant && !constant_changed.rotation)
constant_changed.rotation = parent_constant_changed.rotation;
if (bone_stream.is_translation_constant && !constant_changed.translation)
constant_changed.translation = parent_constant_changed.translation;
if (has_scale && bone_stream.is_scale_constant && !constant_changed.scale)
constant_changed.scale = parent_constant_changed.scale;
// Compensate for the constant changes in your ancestors.
if (!bone_stream.is_rotation_constant && parent_constant_changed.rotation)
{
ACL_ASSERT(any_constant_changed.rotation, "No rotations have changed!");
adjusted_local_transform.rotation = rtm::quat_normalize(rtm::quat_mul(original_object_transform.rotation, rtm::quat_conjugate(parent_adjusted_object_transform.rotation)));
raw_bone_stream.rotations.set_raw_sample(sample_index, adjusted_local_transform.rotation);
bone_stream.rotations.set_raw_sample(sample_index, adjusted_local_transform.rotation);
}
if (has_scale)
{
if (!bone_stream.is_translation_constant && (parent_constant_changed.rotation || parent_constant_changed.translation || parent_constant_changed.scale))
{
ACL_ASSERT(any_constant_changed.rotation || any_constant_changed.translation || any_constant_changed.scale, "No channels have changed!");
const rtm::quatf inv_rotation = rtm::quat_conjugate(parent_adjusted_object_transform.rotation);
const rtm::vector4f inv_scale = rtm::vector_reciprocal(parent_adjusted_object_transform.scale);
adjusted_local_transform.translation = rtm::vector_mul(rtm::quat_mul_vector3(rtm::vector_sub(original_object_transform.translation, parent_adjusted_object_transform.translation), inv_rotation), inv_scale);
raw_bone_stream.translations.set_raw_sample(sample_index, adjusted_local_transform.translation);
bone_stream.translations.set_raw_sample(sample_index, adjusted_local_transform.translation);
}
if (!bone_stream.is_scale_constant && parent_constant_changed.scale)
{
ACL_ASSERT(any_constant_changed.scale, "No scales have changed!");
adjusted_local_transform.scale = rtm::vector_mul(original_object_transform.scale, rtm::vector_reciprocal(parent_adjusted_object_transform.scale));
raw_bone_stream.scales.set_raw_sample(sample_index, adjusted_local_transform.scale);
bone_stream.scales.set_raw_sample(sample_index, adjusted_local_transform.scale);
}
adjusted_object_transform = rtm::qvv_normalize(rtm::qvv_mul(adjusted_local_transform, parent_adjusted_object_transform));
}
else
{
if (!bone_stream.is_translation_constant && (parent_constant_changed.rotation || parent_constant_changed.translation))
{
ACL_ASSERT(any_constant_changed.rotation || any_constant_changed.translation, "No channels have changed!");
const rtm::quatf inv_rotation = rtm::quat_conjugate(parent_adjusted_object_transform.rotation);
adjusted_local_transform.translation = rtm::quat_mul_vector3(rtm::vector_sub(original_object_transform.translation, parent_adjusted_object_transform.translation), inv_rotation);
raw_bone_stream.translations.set_raw_sample(sample_index, adjusted_local_transform.translation);
bone_stream.translations.set_raw_sample(sample_index, adjusted_local_transform.translation);
}
adjusted_object_transform = rtm::qvv_normalize(rtm::qvv_mul_no_scale(adjusted_local_transform, parent_adjusted_object_transform));
}
}
}
}
deallocate_type_array(allocator, adjusted_object_pose, num_transforms);
deallocate_type_array(allocator, original_object_pose, num_transforms);
deallocate_type_array(allocator, dirty_states, num_transforms);
// We need to do these again, to account for error correction.
if(any_constant_changed.rotation)
{
convert_rotation_streams(allocator, context, settings.rotation_format);
}
if (any_constant_changed.rotation || any_constant_changed.translation || any_constant_changed.scale)
{
deallocate_type_array(allocator, context.ranges, num_transforms);
extract_clip_bone_ranges(allocator, context);
}
}
#endif
}
}
ACL_IMPL_VERSION_NAMESPACE_END
}
ACL_IMPL_FILE_PRAGMA_POP
|
a7ccf5316ccf1e95940290d1b6a2ee4c4618ffc0
|
d32a86b54095bbf7886350932d5173493a1c8dd3
|
/Chapter8.2#8J_Branson.cpp
|
baa0b729dcd0316854bc1be422aec8971cfbe60f
|
[] |
no_license
|
Jbranson85/Cplusplus-ERG-126
|
01ba685dd35683f35816d88a7b7ba097ed6f8f67
|
254da0479516726bebddbf9dcdc8fa00a3ef4f3f
|
refs/heads/master
| 2020-03-15T22:22:34.580121
| 2018-05-06T20:13:22
| 2018-05-06T20:13:22
| 132,371,969
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,405
|
cpp
|
Chapter8.2#8J_Branson.cpp
|
/*
Jonathan Branson - Chapter8.2#8J_Branson.cpp
This program will get input from a file and output the data, and
will also find the MPG for each vehicle.
*/
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <string>
#include <iomanip>
using namespace std;
int main()
{
//File and variables
string fileName = "info.txt";
int car_Num, miles, gallons;
double mpg = 0.0;
//ifstream object
ifstream inFile;
//open file
inFile.open(fileName.c_str());
//File not found
if (inFile.fail()){
cout << "ERROR COULD NOT FIND FILE";
exit(1);
}
cout << "Car #" << setw(22) << "Miles Driven" << setw(21) << "Gallons Used"
<< setw(20) << "Average MPG" << '\n';
cout << "--------------------------------------------------------------------\n";
//Getting input from file and outputting
while(inFile >> car_Num >> miles >> gallons){
//Calculation for MPG
mpg = static_cast<double> (miles) / static_cast<double> (gallons);
cout << car_Num << setw(20) << miles << setw(21) << gallons << setw(20)
<< fixed << showpoint << setprecision(2) << mpg
<<'\n';
cout << "--------------------------------------------------------------------\n";
}
//close file
inFile.close();
return 0;
}
|
d994117d2e16f07f368cb4ed4b34a8a012842816
|
c13c121d96fdd8682982854f43e50be011863aa1
|
/Code/Editor/TamyEditor/DRSkeletonEntity.cpp
|
60a4053ca2bc89daa3fa22e2830a8e5a7ea74cdd
|
[] |
no_license
|
paksas/Tamy
|
14fe8e2ff5633ced9b24c855c6e06776bf221c10
|
6e4bd2f14d54cc718ed12734a3ae0ad52337cf40
|
refs/heads/master
| 2020-06-03T08:06:09.511028
| 2015-03-21T20:37:03
| 2015-03-21T20:37:03
| 25,319,755
| 0
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,425
|
cpp
|
DRSkeletonEntity.cpp
|
#include "DRSkeletonEntity.h"
#include "core-AI\SkeletonComponent.h"
#include "core-AI\Skeleton.h"
#include "core-Renderer\TriangleMesh.h"
#include "core-Renderer\GeometryComponent.h"
#include "core-Renderer\RenderState.h"
#include "core-Renderer\Material.h"
#include "DebugGeometryBuilder.h"
///////////////////////////////////////////////////////////////////////////////
BEGIN_ABSTRACT_OBJECT( DRSkeletonEntity )
PARENT( DebugGeometry )
END_OBJECT()
///////////////////////////////////////////////////////////////////////////////
DRSkeletonEntity::DRSkeletonEntity( SkeletonComponent& skeletonComponent )
: DebugGeometry( skeletonComponent.getParent() )
, m_skeletonComponent( skeletonComponent )
, m_boneMesh( NULL )
, m_boneRepresentationsCount( 0 )
, m_boneRepresentations( NULL )
{
m_skeletonComponent.attachListener( *this );
m_boneMesh = DebugGeometryBuilder::createBone();
initialize();
}
///////////////////////////////////////////////////////////////////////////////
DRSkeletonEntity::~DRSkeletonEntity()
{
m_skeletonComponent.detachListener( *this );
deinitialize();
m_boneMesh->removeReference();
m_boneMesh = NULL;
}
///////////////////////////////////////////////////////////////////////////////
void DRSkeletonEntity::initialize()
{
if ( m_skeletonComponent.m_skeleton )
{
ResourcesManager& resMgr = TSingleton< ResourcesManager >::getInstance();
Material* material = resMgr.create< Material >( FilePath( "/Editor/Materials/Bone.tmat" ), false );
m_boneRepresentationsCount = m_skeletonComponent.m_skeleton->getBoneCount();
m_boneRepresentations = new GeometryPtr[m_boneRepresentationsCount];
for ( uint boneIdx = 0; boneIdx < m_boneRepresentationsCount; ++boneIdx )
{
DebugGeometryComponent* boneGeometry = new DebugGeometryComponent( *m_boneMesh );
m_boneRepresentations[boneIdx] = boneGeometry;
boneGeometry->setMaterial( material );
addChild( boneGeometry );
}
}
}
///////////////////////////////////////////////////////////////////////////////
void DRSkeletonEntity::deinitialize()
{
if ( m_boneRepresentationsCount > 0 )
{
for ( uint boneIdx = 0; boneIdx < m_boneRepresentationsCount; ++boneIdx )
{
GeometryComponent* boneGeometry = m_boneRepresentations[boneIdx];
boneGeometry->remove();
}
}
m_boneRepresentationsCount = 0;
delete [] m_boneRepresentations;
m_boneRepresentations = NULL;
}
///////////////////////////////////////////////////////////////////////////////
void DRSkeletonEntity::updateDebugData( float timeElapsed )
{
if ( !m_skeletonComponent.m_skeleton )
{
return;
}
const Matrix& entityWorldMtx = this->getGlobalMtx();
Vector boneDir;
for ( uint boneIdx = 0; boneIdx < m_boneRepresentationsCount; ++boneIdx )
{
ASSERT( m_boneRepresentationsCount == m_skeletonComponent.m_skeleton->getBoneCount() );
Matrix scaleMtx;
scaleMtx.scaleUniform( m_skeletonComponent.m_skeleton->m_boneLengths[boneIdx] );
Matrix boneRepModelMtx;
boneRepModelMtx.setMul( scaleMtx, m_skeletonComponent.m_boneModelMtx[boneIdx] );
Matrix boneRepWorldMtx;
boneRepWorldMtx.setMul( boneRepModelMtx, entityWorldMtx );
m_boneRepresentations[boneIdx]->setExtraTransform( boneRepWorldMtx );
}
}
///////////////////////////////////////////////////////////////////////////////
void DRSkeletonEntity::enableBoundingBox( bool enable )
{
// nothing to do here
}
///////////////////////////////////////////////////////////////////////////////
void DRSkeletonEntity::enableDebugShape( bool enable )
{
for ( uint boneIdx = 0; boneIdx < m_boneRepresentationsCount; ++boneIdx )
{
m_boneRepresentations[boneIdx]->enableRendering( enable );
}
}
///////////////////////////////////////////////////////////////////////////////
void DRSkeletonEntity::onObservedPropertyChanged( ReflectionProperty& property )
{
// switch the skeleton representation
if ( property.getName() == "m_skeleton" )
{
deinitialize();
initialize();
}
}
///////////////////////////////////////////////////////////////////////////////
void DRSkeletonEntity::onObservedObjectDeleted( ReflectionObject* deletedObject )
{
// nothing to do here
}
///////////////////////////////////////////////////////////////////////////////
|
16c4a4ad8ebfa03f467984d3a9c822a694beb26a
|
7cf248711e6c4bb6be73fe4623bc45accc755dd9
|
/classification/mnist-hidden-probabilities.cpp
|
4387e83f72aa92117bbd1cffeca16aa574605c5d
|
[] |
no_license
|
arn4/colloquio
|
165be13963a3ae8d58c6f60c045595c1f2fa56de
|
fc67c50947c791a1b4f4b642660cd12d98f0ac02
|
refs/heads/main
| 2023-05-30T21:40:08.827883
| 2021-06-10T15:51:06
| 2021-06-10T15:51:06
| 347,947,693
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,501
|
cpp
|
mnist-hidden-probabilities.cpp
|
#include <iostream>
#include <fstream>
#include <random>
#include <cstdlib>
#include <iomanip>
#include <cassert>
#include <BernoulliRBM.hpp>
using namespace std;
using namespace rbm;
const size_t DIGITS = 10;
const size_t PIXELS = 28*28;
const unsigned HIDDEN_SIZE = 500;
const unsigned TEST_SET_SIZE = 10000;
const size_t TRAIN_SET_SIZE = 60000;
//const unsigned EPOCHS = 50;
//const unsigned RBM_EVERY = 10;
using real_value = double;
const vector<string> trained = {"cd-1", "pcd-1", "mf-3", "pmf-3", "tap2-3", "tap3-3", "pmf-3", "ptap2-3", "ptap3-3"};
int main(int argc, char *argv[]) {
unsigned seed = 0;
if (argc > 1) {
seed = strtoul(argv[1], nullptr, 10);
} else {
clog << "Specify the trained machines" << endl;
}
clog << "Using seed = " << seed << endl << endl;
mt19937 rng(seed);
// Load RBM
clog << "Loading the RBM... ";
vector<BernoulliRBM<real_value>> rbms(trained.size(), BernoulliRBM<real_value>(PIXELS, HIDDEN_SIZE, rng));
for (unsigned r = 0; r < trained.size(); r++) {
rbms[r].load_from_file(to_string(seed)+"/"+trained[r]+".rbm.txt");
}
clog << "Done!" << endl << endl;
// Process the train set
clog << "Loading the train set...";
vector<vector<bool>> train_set;
vector<unsigned> train_label;
ifstream mnist_train("./mnist-train.txt");
for (unsigned i = 1; i <= TRAIN_SET_SIZE; i++) {
unsigned label;
mnist_train >> label;
vector<bool> tmp(PIXELS);
for (unsigned q = 0; q < PIXELS; q++) {
unsigned c;
mnist_train >> c;
tmp[q] = (c==1);
}
train_label.push_back(label);
train_set.push_back(tmp);
}
clog << endl << endl;
// Load the test set
clog << "Loading the test set...";
vector<vector<bool>> test_set;
vector<unsigned> test_label;
ifstream mnist_test("./mnist-test.txt");
for (unsigned i = 1; i <= TEST_SET_SIZE; i++) {
unsigned label;
mnist_test >> label;
vector<bool> tmp(PIXELS);
for (unsigned q = 0; q < PIXELS; q++) {
unsigned c;
mnist_test >> c;
tmp[q] = (c==1);
}
test_label.push_back(label);
test_set.push_back(tmp);
}
clog << endl << endl;
//Write labels
ofstream train_label_out(to_string(seed)+"/hidden-magnetization/train-label.txt");
for (unsigned u: train_label) {
train_label_out << u << endl;
}
ofstream test_label_out(to_string(seed)+"/hidden-magnetization/test-label.txt");
for (unsigned u: test_label) {
test_label_out << u << endl;
}
// Compute Magnetizations
clog << "Computing magnetization... " << endl;
for (unsigned r = 0; r < trained.size(); r++) {
clog << r << '/' << trained.size() << endl;
// Train
ofstream train_magn_out(to_string(seed)+"/hidden-magnetization/train-"+trained[r]+".txt");
train_magn_out << fixed << setprecision(10);
for (auto& v: train_set) {
auto prob_h = rbms[r].vec_prob_h(v.begin());
for (real_value mhj: prob_h) {
train_magn_out << mhj << ' ';
}
train_magn_out << endl;
}
train_magn_out.close();
// Test
ofstream test_magn_out(to_string(seed)+"/hidden-magnetization/test-"+trained[r]+".txt");
test_magn_out << fixed << setprecision(10);
for (auto& v: test_set) {
auto prob_h = rbms[r].vec_prob_h(v.begin());
for (real_value mhj: prob_h) {
test_magn_out << mhj << ' ';
}
test_magn_out << endl;
}
test_magn_out.close();
}
clog << trained.size() << '/' << trained.size() << endl;
return 0;
}
|
912b6dd0147552a107d83ecb2a8566cb57cd63c7
|
5b0a72955052f458969486f790dfdd6d3a9ec9cd
|
/debug/my_debug.h
|
8995486fcb629364ba78546bd2620e16c7792d01
|
[] |
no_license
|
hikaru-ida/procon_lib
|
00442da14bacd3e51e711131e927f92e0abd251c
|
e6895e8f03401a8de02b7b59028339a4d2ad9929
|
refs/heads/master
| 2021-07-07T23:14:58.614194
| 2017-10-04T19:50:12
| 2017-10-04T19:50:12
| 104,731,296
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,425
|
h
|
my_debug.h
|
#include <iostream>
#include <vector>
#include <string>
#include <iomanip>
#define TO_STRING(VariableName) # VariableName
void show_list2d(const std::vector< std::vector<int> > & v, int k);
void show_list2d(const std::vector< std::vector<int> > & v, int k=4) {
for(int i=0;i<v.size();i++) {
for(int j=0;j<v[i].size();j++) {
std::cout << "[" << i << "]";
std::cout << "[" << j << "]";
std::cout << std::setw(k) << v[i][j] << std::endl;
}
}
}
void show_matrix(const std::vector<int> & v, int k=4) {
for(int i=0;i<v.size();i++) {
std::cout << "[" << i << "]";
std::cout << std::setw(k) << v[i] << std::endl;
}
}
/* 多次元のvectorを表示
* v: 多次元vector
* k: 最小出力桁数
*/
void show_matrix(const std::vector< std::vector<int> > & v, int k=4) {
int keta=0;
int vsize = v.size();
while(vsize) {
vsize /= 10;
keta++;
}
std::cout << std::setw(keta+2) << " ";
// 列番号の表示
for(int i=0;i<v.size();i++) {
std::string col_ix = "["+ std::to_string(i) + "]";
std::cout << std::setw(k) << col_ix;
}
std::cout << std::endl;
for(int i=0;i<v.size();i++) {
// 行番号の表示
std::string row_ix = "["+std::to_string(i)+"]";
std::cout << std::setw(keta) << row_ix;
// 行列の表示
for(int j=0;j<v[0].size();j++) {
std::cout << std::setw(k) << v[i][j];
}
std::cout << std::endl;
}
}
|
129451859392107d6b4549ba52c824dc4a203d6a
|
85f151fb68fcc237a3a100ea4bf3dfe1d6a38b5b
|
/citationKNN.cpp
|
96bcacf7d5008f838ecfca2e7f0ebd353112f6af
|
[
"MIT"
] |
permissive
|
YMYTZSQF/FALCON
|
e17c384a6bbbf9e2a7a269eb10ffb96949b8140c
|
4eb78d3db3d287308a33828042c39cc4ba9132bd
|
refs/heads/master
| 2020-04-14T03:47:05.493938
| 2018-12-30T21:11:45
| 2018-12-30T21:11:45
| 163,616,642
| 0
| 0
|
MIT
| 2018-12-30T20:48:21
| 2018-12-30T20:48:20
| null |
UTF-8
|
C++
| false
| false
| 28,523
|
cpp
|
citationKNN.cpp
|
#include "citationKNN.h"
#include <fstream>
#include <algorithm>
//#include <windows.h>
//#include "psapi.h"
long long countDistComp = 0;
long long countDistComp2 = 0;
long long countDistComp3 = 0;
long long countDistComp4 = 0;
long long countDistComp5 = 0;
int hDistType; //indicate which type of hausdorff dist used: max or min corresponding to 1 or 0
bool isOriginal; //if currently use original one, isOriginal = true, otherwise false;
double distSum = 0;
int distCount = 0;
double distCurBagToCiter;
void citationKNN::readData(string path)
{
ifstream inFile;
inFile.open(path);
string line;
int instIndex = 0;
while(getline(inFile, line))
{
instance ins;
ins.gIdx = instIndex++;
string bagName;
int pos = line.find(",");
bagName = line.substr(0, pos);
ins.bagName = bagName;
string insName;
int pos2 = line.find(",", pos + 1);
insName = line.substr(pos + 1, pos2 - pos - 1);
ins.name = insName;
do //extract attribute f1 to f166
{
pos = pos2;
pos2 = line.find(",", pos + 1);
if(pos2 == -1)
break;
string valStr = line.substr(pos + 1, pos2 - pos - 1);
ins.attribute.push_back(stod(valStr));
}while(true);
pos2 = line.find(".", pos + 1); //extract the label of the instance, which ends with '.'
string labelStr = line.substr(pos + 1, pos2 - pos - 1);
ins.label = stoi(labelStr);
if(hash.find(ins.bagName) != hash.end()) //bag has been created
dataset[hash[ins.bagName]].ins.push_back(ins);
else //create bag instance
{
dataset.push_back(bag()); //create a new bag instance and add to dataset
dataset.rbegin()->index = dataset.size() - 1;
dataset.rbegin()->name = ins.bagName; //name of new bag instance is from the instance's bagName
hash[ins.bagName] = dataset.size() - 1; //build the map for the new bag
dataset[hash[ins.bagName]].ins.push_back(ins);
dataset[hash[ins.bagName]].label = ins.label;
}
//cout<<insName<<endl;
}
numInstances = instIndex;
}
bool isSame(vector<double> &a, vector<double> &b)
{
for(int i = 0; i < a.size(); i++)
{
if(abs(a[i] - b[i]) > 1e-6)
//if(abs(a[i] - b[i]) != 0)
return false;
}
return true;
}
double dist2(vector<double> &a, vector<double> &b)
{
double sum = 0;
countDistComp2++;
for(int i = 0; i < a.size(); i++)
sum += (a[i] - b[i]) * (a[i] - b[i]);
return sqrt(sum);
}
double dist3(vector<double> &a, vector<double> &b)
{
double sum = 0;
countDistComp3++;
for(int i = 0; i < a.size(); i++)
sum += (a[i] - b[i]) * (a[i] - b[i]);
return sqrt(sum);
}
double dist4(vector<double> &a, vector<double> &b)
{
double sum = 0;
countDistComp4++;
for(int i = 0; i < a.size(); i++)
sum += (a[i] - b[i]) * (a[i] - b[i]);
return sqrt(sum);
}
double dist5(vector<double> &a, vector<double> &b)
{
double sum = 0;
countDistComp5++;
for(int i = 0; i < a.size(); i++)
sum += (a[i] - b[i]) * (a[i] - b[i]);
return sqrt(sum);
}
void citationKNN::kpp(int bagIdx, int k, int &cntGrpIdx)
{
int nInst = dataset[bagIdx].ins.size();
int nGrp = 0;
double sum;
vector<double> nrsDist(nInst, DBL_MAX);
vector<int> nrsCtrIdx(nInst); //the index of nearest ctr
group g;
g.bagName = dataset[bagIdx].name;
g.grpIdx = 0;
int rdmIdx = rand() / (RAND_MAX - 1.) * nInst;
g.center = dataset[bagIdx].ins[rdmIdx].attribute;
g.gGrpIdx = cntGrpIdx++;
g.ctrInsIdx = rdmIdx;
dataset[bagIdx].grp.push_back(g);
for(nGrp = 1; nGrp < k + 1; nGrp++)
{
sum = 0;
double maxDist = -DBL_MAX;
for(int i = 0; i < nInst; i++)
{
double ctrInsDist = dist(dataset[bagIdx].grp[nGrp - 1].center, dataset[bagIdx].ins[i].attribute);
if(maxDist < ctrInsDist)
maxDist = ctrInsDist;
//dataset[bagIdx].ins[i].bagGrpCtrDist.push_back(make_pair(ctrInsDist, nGrp - 1));
if(nrsDist[i] > ctrInsDist)
{
nrsDist[i] = ctrInsDist;
nrsCtrIdx[i] = nGrp - 1;
}
sum += nrsDist[i];
}
int ctrInsIdx = dataset[bagIdx].grp[nGrp - 1].ctrInsIdx;
dataset[bagIdx].ins[ctrInsIdx].furstInsDist = maxDist;
if(nGrp == k) //last iteration, no need to get a new center
break;
sum = rand() / (RAND_MAX - 1.) * sum; //get a rdm num between 0 - sum
for(int i = 0; i < nInst; i++)
{
if((sum -= nrsDist[i]) > 0)
continue;
group g;
g.bagName = dataset[bagIdx].name;
g.grpIdx = nGrp;
g.center = dataset[bagIdx].ins[i].attribute; //use the instance's position of the first instance of every sizePerGrp instances as center
g.gGrpIdx = cntGrpIdx++;
g.ctrInsIdx = i;
dataset[bagIdx].grp.push_back(g);
break;
}
}
for(int i1 = 0; i1 < nInst; i1++)
{
dataset[bagIdx].ins[i1].grpIdx = nrsCtrIdx[i1];
dataset[bagIdx].ins[i1].grpCtrDist = nrsDist[i1];
dataset[bagIdx].grp[nrsCtrIdx[i1]].grpInsIdx.push_back(make_pair(bagIdx, i1));
}
}
void citationKNN::grouping(int numIter) //numIter: number of iteration
{
int n = dataset.size();
int cntGrpIdx = 0;
for(int i = 0; i < n; i++)
{
int nInst = dataset[i].ins.size(); //number of instance in bag i
int k;
if(nInst % 10 == 0)
k = nInst / 10;
else
k = nInst / 10 + 1;
kpp(i, k, cntGrpIdx);
}
numGroups = cntGrpIdx;
}
void citationKNN::init()
{
int n = dataset.size();
distBtwBag = vector<vector<double>>(n, vector<double>(n, -1));
curDistBtwBag = vector<vector<double>>(n, vector<double>(n, -1));
//skpIns = vector<vector<vector<pair<pair<int, int>, double>>>>(n, vector<vector<pair<pair<int, int>, double>>>(n));
//if(!isOriginal)
//initBagInnerDist();
}
/*void citationKNN::initBagInnerDist()
{
double maxDist;
int furstInsIdx;
for(int i = 0; i < dataset.size(); i++)
{
maxDist = 0;
furstInsIdx = 0; //initialize as 0, because there could be only one instance in a bag
for(int j = 1; j < dataset[i].ins.size(); j++) //cal distance between every instance (except the first one) to the first instance in the same bag
{
int d = dist3(dataset[i].ins[0].attribute, dataset[i].ins[j].attribute);
if(d > maxDist)
{
maxDist = d;
furstInsIdx = j;
}
}
dataset[i].ins[0].furstInsIdx = furstInsIdx;
dataset[i].ins[0].furstInsDist = maxDist;
}
}*/
double citationKNN::hausdorffDist(bag A, bag B, vector<vector<double>> &bagAInsBagBIns, vector<vector<double>> &distALmToBLm)
{
vector<vector<double>> bagAGrpCtrBagBIns(A.grp.size(), vector<double>(B.ins.size(), -1));
vector<vector<double>> bagBGrpCtrBagAIns(B.grp.size(), vector<double>(A.ins.size(), -1));
if(hDistType == 0)
return hxMin(A, B, 1, bagAGrpCtrBagBIns, bagBGrpCtrBagAIns, bagAInsBagBIns, distALmToBLm);
else //hDistType == 1
return hxMax(A, B, A.ins.size(), bagAGrpCtrBagBIns, bagBGrpCtrBagAIns, bagAInsBagBIns, distALmToBLm);
}
double citationKNN::hxMax(bag A, bag B, int k, vector<vector<double>> &bagAGrpCtrBagBIns, vector<vector<double>> &bagBGrpCtrBagAIns,
vector<vector<double>> &bagAInsBagBIns, vector<vector<double>> &distALmToBLm)
{
//multiset<double> minAtoB;
double maxMinAtoB;
if(curDistBtwBag[A.index][B.index] != -1)
maxMinAtoB = curDistBtwBag[A.index][B.index];
else
maxMinAtoB = -DBL_MAX;
for(int i = 0; i < A.ins.size(); i++)
{
double minInsToBag = DBL_MAX;
bool overlook = false; //overlook is true means that current ins in B will not change the res finally returned, thus overlook this ins
for(int j = 0; j < B.ins.size(); j++)
{
if(bagAInsBagBIns[i][j] == -1)
{
double lBound = -DBL_MAX;
double uBound = DBL_MAX;
double distBtwLm;
double distToGrpCtr = A.ins[i].grpCtrDist;
double distToGrpCtr2 = B.ins[j].grpCtrDist;
int ctrInsIdx = A.grp[A.ins[i].grpIdx].ctrInsIdx; //get which ins the grp ctr is
int ctrInsIdx2 = B.grp[B.ins[j].grpIdx].ctrInsIdx; //get which ins the grp ctr is
if(bagAInsBagBIns[ctrInsIdx][ctrInsIdx2] != -1)
distALmToBLm[A.ins[i].grpIdx][B.ins[j].grpIdx] = bagAInsBagBIns[ctrInsIdx][ctrInsIdx2];
if(distALmToBLm[A.ins[i].grpIdx][B.ins[j].grpIdx] != -1)
distBtwLm = distALmToBLm[A.ins[i].grpIdx][B.ins[j].grpIdx];
else
distBtwLm = bagAInsBagBIns[ctrInsIdx][ctrInsIdx2] = distALmToBLm[A.ins[i].grpIdx][B.ins[j].grpIdx] = dist4(A.grp[A.ins[i].grpIdx].center, B.grp[B.ins[j].grpIdx].center);
lBound = max(lBound, distBtwLm - distToGrpCtr - distToGrpCtr2);
uBound = min(uBound, distBtwLm + distToGrpCtr + distToGrpCtr2);
if(uBound <= maxMinAtoB) //no need to cal, since it will not update the maxMinAtoB.
{
overlook = true;
break;
}
if(lBound >= minInsToBag) //no need to cal dist between A.ins[i] and B.ins[j], since it will not update minInsToBag
continue;
double distBtwCtrIns;
if(bagAInsBagBIns[ctrInsIdx][j] != -1)
bagAGrpCtrBagBIns[A.ins[i].grpIdx][j] = bagAInsBagBIns[ctrInsIdx][j];
if(bagAGrpCtrBagBIns[A.ins[i].grpIdx][j] != -1)
distBtwCtrIns = bagAGrpCtrBagBIns[A.ins[i].grpIdx][j];
else
distBtwCtrIns = bagAInsBagBIns[ctrInsIdx][j] = bagAGrpCtrBagBIns[A.ins[i].grpIdx][j] = dist4(A.grp[A.ins[i].grpIdx].center, B.ins[j].attribute);
lBound = max(lBound, abs(distBtwCtrIns - distToGrpCtr));
uBound = min(uBound, distBtwCtrIns + distToGrpCtr);
if(uBound <= maxMinAtoB) //no need to cal, since it will not update the maxMinAtoB.
{
overlook = true;
break;
}
if(lBound >= minInsToBag) //no need to cal dist between A.ins[i] and B.ins[j], since it will not update minInsToBag
continue;
double distBtwCtrIns2;
if(bagAInsBagBIns[i][ctrInsIdx2] != -1)
bagBGrpCtrBagAIns[B.ins[j].grpIdx][i] = bagAInsBagBIns[i][ctrInsIdx2];
if(bagBGrpCtrBagAIns[B.ins[j].grpIdx][i] != -1)
distBtwCtrIns2 = bagBGrpCtrBagAIns[B.ins[j].grpIdx][i];
else
distBtwCtrIns2 = bagAInsBagBIns[i][ctrInsIdx2] = bagBGrpCtrBagAIns[B.ins[j].grpIdx][i] = dist4(B.grp[B.ins[j].grpIdx].center, A.ins[i].attribute);
lBound = max(lBound, abs(distBtwCtrIns2 - distToGrpCtr2));
uBound = min(uBound, distBtwCtrIns2 + distToGrpCtr2);
if(uBound <= maxMinAtoB) //no need to cal, since it will not update the maxMinAtoB.
{
overlook = true;
break;
}
if(lBound >= minInsToBag) //no need to cal dist between A.ins[i] and B.ins[j], since it will not update minInsToBag
continue;
}
double insDist;
if(bagAInsBagBIns[i][j] != -1)
insDist = bagAInsBagBIns[i][j];
else //no existing value
insDist = bagAInsBagBIns[i][j] = dist5(A.ins[i].attribute, B.ins[j].attribute);
if(insDist <= maxMinAtoB)
{
overlook = true;
break;
}
minInsToBag = min(minInsToBag, insDist);
}
if(overlook)
continue;
maxMinAtoB = max(maxMinAtoB, minInsToBag);
if(maxMinAtoB != DBL_MAX && maxMinAtoB >= distCurBagToCiter)
{
curDistBtwBag[A.index][B.index] = curDistBtwBag[B.index][A.index] = maxMinAtoB;
return -1;
}
}
for(int i = 0; i < B.ins.size(); i++)
{
double res = maxMinAtoB;
double minInsToBag = DBL_MAX;
bool overlook = false; //overlook is true means that current ins in B will not change the res finally returned, thus overlook this ins
for(int j = 0; j < A.ins.size(); j++)
{
if(bagAInsBagBIns[j][i] != -1) //has been cal
{
if(bagAInsBagBIns[j][i] <= res)
{
overlook = true;
break;
}
minInsToBag = min(minInsToBag, bagAInsBagBIns[j][i]);
}
}
if(overlook)
continue;
for(int j = 0; j < A.ins.size(); j++)
{
if(bagAInsBagBIns[j][i] == -1) //has not been cal
{
double lBound = -DBL_MAX;
double uBound = DBL_MAX;
double distBtwLm;
double distToGrpCtr = B.ins[i].grpCtrDist;
double distToGrpCtr2 = A.ins[j].grpCtrDist;
int ctrInsIdx = B.grp[B.ins[i].grpIdx].ctrInsIdx; //get which ins the grp ctr is
int ctrInsIdx2 = A.grp[A.ins[j].grpIdx].ctrInsIdx; //get which ins the grp ctr is
if(bagAInsBagBIns[ctrInsIdx2][ctrInsIdx] != -1)
distALmToBLm[A.ins[j].grpIdx][B.ins[i].grpIdx] = bagAInsBagBIns[ctrInsIdx2][ctrInsIdx];
if(distALmToBLm[A.ins[j].grpIdx][B.ins[i].grpIdx] != -1)
distBtwLm = distALmToBLm[A.ins[j].grpIdx][B.ins[i].grpIdx];
else
distBtwLm = bagAInsBagBIns[ctrInsIdx2][ctrInsIdx] = distALmToBLm[A.ins[j].grpIdx][B.ins[i].grpIdx] = dist4(A.grp[A.ins[j].grpIdx].center, B.grp[B.ins[i].grpIdx].center);
lBound = max(lBound, distBtwLm - distToGrpCtr - distToGrpCtr2);
uBound = min(uBound, distBtwLm + distToGrpCtr + distToGrpCtr2);
if(uBound <= res)
{
overlook = true;
break;
}
if(lBound >= minInsToBag) //no need to cal dist between A.ins[i] and B.ins[j], since it will not update minInsToBag
continue;
double distBtwCtrIns;
if(bagBGrpCtrBagAIns[B.ins[i].grpIdx][j] != -1)
distBtwCtrIns = bagBGrpCtrBagAIns[B.ins[i].grpIdx][j];
else
distBtwCtrIns = bagBGrpCtrBagAIns[B.ins[i].grpIdx][j] = dist4(B.grp[B.ins[i].grpIdx].center, A.ins[j].attribute);
bagAInsBagBIns[j][ctrInsIdx] = distBtwCtrIns;
lBound = max(lBound, abs(distBtwCtrIns - distToGrpCtr));
uBound = min(uBound, distBtwCtrIns + distToGrpCtr);
if(uBound <= res)
{
overlook = true;
break;
}
if(lBound >= minInsToBag) //no need to cal dist between A.ins[i] and B.ins[j], since it will not update minInsToBag
continue;
double distBtwCtrIns2;
if(bagAGrpCtrBagBIns[A.ins[j].grpIdx][i] != -1)
distBtwCtrIns2 = bagAGrpCtrBagBIns[A.ins[j].grpIdx][i];
else
distBtwCtrIns2 = bagAGrpCtrBagBIns[A.ins[j].grpIdx][i] = dist4(A.grp[A.ins[j].grpIdx].center, B.ins[i].attribute);
bagAInsBagBIns[ctrInsIdx2][i] = distBtwCtrIns2;
lBound = max(lBound, abs(distBtwCtrIns2 - distToGrpCtr2));
uBound = min(uBound, distBtwCtrIns2 + distToGrpCtr2);
if(uBound <= res)
{
overlook = true;
break;
}
if(lBound >= minInsToBag) //no need to cal dist between A.ins[i] and B.ins[j], since it will not update minInsToBag
continue;
}
double insDist;
if(bagAInsBagBIns[j][i] != -1)
insDist = bagAInsBagBIns[j][i];
else
insDist = bagAInsBagBIns[j][i] = dist5(B.ins[i].attribute, A.ins[j].attribute);
if(insDist <= res)
{
overlook = true;
break;
}
minInsToBag = min(minInsToBag, insDist);
}
if(overlook)
continue;
maxMinAtoB = max(maxMinAtoB, minInsToBag);
if(maxMinAtoB != DBL_MAX && maxMinAtoB >= distCurBagToCiter)
{
curDistBtwBag[A.index][B.index] = curDistBtwBag[B.index][A.index] = maxMinAtoB;
return -1;
}
}
return maxMinAtoB;
}
double citationKNN::hxMin(bag A, bag B, int k, vector<vector<double>> &bagAGrpCtrBagBIns, vector<vector<double>> &bagBGrpCtrBagAIns,
vector<vector<double>> &bagAInsBagBIns, vector<vector<double>> &distALmToBLm) //k is the k-th ranked distance
{
priority_queue<double> h_minAtoB;
if(curDistBtwBag[A.index][B.index] != -1)
{
if(distCurBagToCiter != DBL_MAX && curDistBtwBag[A.index][B.index] < distCurBagToCiter)
return -2;
h_minAtoB.push(curDistBtwBag[A.index][B.index]);
}
else
{
h_minAtoB.push(DBL_MAX);
}
bool realDist = true;
for(int i = 0; i < A.ins.size(); i++)
{
double minInsToBag = DBL_MAX;
for(int j = 0; j < B.ins.size(); j++)
{
if(bagAInsBagBIns[i][j] == -1)
{
double lBound = -DBL_MAX;
double uBound = DBL_MAX;
double distBtwLm;
double distToGrpCtr = A.ins[i].grpCtrDist;
double distToGrpCtr2 = B.ins[j].grpCtrDist;
int ctrInsIdx = A.grp[A.ins[i].grpIdx].ctrInsIdx; //get which ins the grp ctr is;
int ctrInsIdx2 = B.grp[B.ins[j].grpIdx].ctrInsIdx; //get which ins the grp ctr is
if(bagAInsBagBIns[ctrInsIdx][ctrInsIdx2] != -1)
distALmToBLm[A.ins[i].grpIdx][B.ins[j].grpIdx] = bagAInsBagBIns[ctrInsIdx][ctrInsIdx2];
if(distALmToBLm[A.ins[i].grpIdx][B.ins[j].grpIdx] != -1)
distBtwLm = distALmToBLm[A.ins[i].grpIdx][B.ins[j].grpIdx];
else
distBtwLm = bagAInsBagBIns[ctrInsIdx][ctrInsIdx2] = distALmToBLm[A.ins[i].grpIdx][B.ins[j].grpIdx] = dist4(A.grp[A.ins[i].grpIdx].center, B.grp[B.ins[j].grpIdx].center);
lBound = max(lBound, distBtwLm - distToGrpCtr - distToGrpCtr2);
uBound = distBtwLm + distToGrpCtr + distToGrpCtr2;
if(distCurBagToCiter != DBL_MAX && uBound < distCurBagToCiter)
{
curDistBtwBag[A.index][B.index] = curDistBtwBag[B.index][A.index] = h_minAtoB.top();
return -2;
}
if(lBound >= minInsToBag) //no need to cal dist between A.ins[i] and B.ins[j], since it will not update minInsToBag
continue;
if(h_minAtoB.size() == k && lBound >= h_minAtoB.top()) //no need to cal, since it will not update the kth element in minAtoB.
continue;
double distBtwCtrIns;
if(bagAInsBagBIns[ctrInsIdx][j] != -1)
bagAGrpCtrBagBIns[A.ins[i].grpIdx][j] = bagAInsBagBIns[ctrInsIdx][j];
if(bagAGrpCtrBagBIns[A.ins[i].grpIdx][j] !=-1)
distBtwCtrIns = bagAGrpCtrBagBIns[A.ins[i].grpIdx][j];
else
distBtwCtrIns = bagAInsBagBIns[ctrInsIdx][j] = bagAGrpCtrBagBIns[A.ins[i].grpIdx][j] = dist4(A.grp[A.ins[i].grpIdx].center, B.ins[j].attribute);
lBound = abs(distBtwCtrIns - distToGrpCtr);
uBound = distBtwCtrIns + distToGrpCtr;
if(distCurBagToCiter != DBL_MAX && uBound < distCurBagToCiter)
{
curDistBtwBag[A.index][B.index] = curDistBtwBag[B.index][A.index] = h_minAtoB.top();
return -2;
}
if(lBound >= minInsToBag) //no need to cal dist between A.ins[i] and B.ins[j], since it will not update minInsToBag
continue;
if(h_minAtoB.size() == k && lBound >= h_minAtoB.top()) //no need to cal, since it will not update the kth element in minAtoB.
continue;
double distBtwCtrIns2;
if(bagAInsBagBIns[i][ctrInsIdx2] != -1)
bagBGrpCtrBagAIns[B.ins[j].grpIdx][i] = bagAInsBagBIns[i][ctrInsIdx2];
if(bagBGrpCtrBagAIns[B.ins[j].grpIdx][i] != -1)
distBtwCtrIns2 = bagBGrpCtrBagAIns[B.ins[j].grpIdx][i];
else
distBtwCtrIns2 = bagAInsBagBIns[i][ctrInsIdx2] = bagBGrpCtrBagAIns[B.ins[j].grpIdx][i] = dist4(B.grp[B.ins[j].grpIdx].center, A.ins[i].attribute);
lBound = max(lBound, abs(distBtwCtrIns2 - distToGrpCtr2));
uBound = min(uBound, distBtwCtrIns2 + distToGrpCtr2);
if(distCurBagToCiter != DBL_MAX && uBound < distCurBagToCiter)
{
curDistBtwBag[A.index][B.index] = curDistBtwBag[B.index][A.index] = h_minAtoB.top();
return -2;
}
if(lBound >= minInsToBag) //no need to cal dist between A.ins[i] and B.ins[j], since it will not update minInsToBag
continue;
if(h_minAtoB.size() == k && lBound >= h_minAtoB.top()) //no need to cal, since it will not update the kth element in minAtoB.
continue;
if(lBound >= distCurBagToCiter)
{
//skpIns[A.index][B.index].push_back(make_pair(make_pair(i, j), lBound));
realDist = false;
continue;
}
}
double insDist;
if(bagAInsBagBIns[i][j] != -1)
insDist = bagAInsBagBIns[i][j];
else //no existing value
insDist = bagAInsBagBIns[i][j] = dist5(A.ins[i].attribute, B.ins[j].attribute);
if(distCurBagToCiter != DBL_MAX && insDist < distCurBagToCiter)
return -2;
minInsToBag = min(minInsToBag, insDist);
}
h_minAtoB.push(minInsToBag);
if(h_minAtoB.size() > k)
h_minAtoB.pop();
}
if(h_minAtoB.top() > distCurBagToCiter && !realDist) //has skipped some ins, and min dis < distCurBagToCiter, thus skipped ins could have real min dis
{
curDistBtwBag[A.index][B.index] = curDistBtwBag[B.index][A.index] = h_minAtoB.top();
return -1;
}
return h_minAtoB.top();
}
double citationKNN::dist(vector<double> &a, vector<double> &b)
{
double sum = 0;
countDistComp++;
for(int i = 0; i < a.size(); i++)
sum += (a[i] - b[i]) * (a[i] - b[i]);
return sqrt(sum);
}
bool cmp(const pair<double, string> &a, const pair<double, string> &b)
{
if(a.first <= b.first)
return true;
return false;
}
void citationKNN::clean(int bagIdx)
{
int n = dataset.size();
for(int i = 0; i < n; i++)
{
distBtwBag[i][bagIdx] = distBtwBag[bagIdx][i] = -1;
for(int j = 0; j < n; j++)
{
curDistBtwBag[i][j] = -1;
//skpIns[i][j].clear();
}
}
}
int citationKNN::predict(int curBagIdx, int R, int C) //predict the label of test bag (curBagIdx), R is the number of reference, C is the C in C-nearest citer
{
vector<int> vote; //labels of all reference and citers.
int n = dataset.size();
for(int i = 0; i < dataset.size(); i++)
{
//cout<<i<<endl;
vector<int> bagOrder;
for(int j = 0; j < dataset.size(); j++)
bagOrder.push_back(j);
swap(bagOrder[0], bagOrder[curBagIdx]);
int i1 = 0;
for(int i2 = 1; i2 < n; i2++)
{
if(distBtwBag[i][bagOrder[i2]] != -1)
swap(bagOrder[++i1], bagOrder[i2]);
}
priority_queue<pair<double, int>> h_distBag; //double is for the Hausdorff dist, int is the index of bag
bool skip = false; //if skip is true, current bag will not be citer
distCurBagToCiter = DBL_MAX;
for(auto j : bagOrder)
{
if(i == j)
continue;
vector<vector<double>> bagAInsBagBIns(dataset[i].ins.size(), vector<double>(dataset[j].ins.size(), -1)); //hash table for instance dist between bagA and bagB
vector<vector<double>> distALmToBLm(dataset[i].grp.size(), vector<double>(dataset[j].grp.size(), -1)); //dist btw landmarks in A and B
double hDist;
if(distBtwBag[i][j] != -1)
hDist = distBtwBag[i][j];
else
{
double lBound = 0.0, uBound = DBL_MAX;
if(hDistType == 0)
{
int ctrInsIdx1 = dataset[i].grp[0].ctrInsIdx;
int ctrInsIdx2 = dataset[j].grp[0].ctrInsIdx;
distALmToBLm[0][0] = dist3(dataset[i].ins[ctrInsIdx1].attribute, dataset[j].ins[ctrInsIdx2].attribute);
//distBtwLm = dist3(dataset[i].ins[ctrInsIdx1].attribute, dataset[j].ins[ctrInsIdx2].attribute);
bagAInsBagBIns[ctrInsIdx1][ctrInsIdx2] = distALmToBLm[0][0];
lBound = max(lBound, distALmToBLm[0][0] - dataset[i].ins[ctrInsIdx1].furstInsDist - dataset[j].ins[ctrInsIdx2].furstInsDist);
uBound = min(uBound, distALmToBLm[0][0] + dataset[i].ins[ctrInsIdx1].furstInsDist + dataset[j].ins[ctrInsIdx2].furstInsDist);
/*for(int k1 = 0; k1 < dataset[i].grp.size(); k1++)
{
int ctrInsIdx1 = dataset[i].grp[k1].ctrInsIdx;
for(int t = 0; t < min((int)dataset[j].grp.size(), 2); t++)
{
int k2 = (k1 + t) % dataset[j].grp.size();
int ctrInsIdx2 = dataset[j].grp[k2].ctrInsIdx;
distALmToBLm[k1][k2] = dist3(dataset[i].ins[ctrInsIdx1].attribute, dataset[j].ins[ctrInsIdx2].attribute);
bagAInsBagBIns[ctrInsIdx1][ctrInsIdx2] = distALmToBLm[k1][k2];
lBound = max(lBound, distALmToBLm[k1][k2] - dataset[i].ins[ctrInsIdx1].furstInsDist - dataset[j].ins[ctrInsIdx2].furstInsDist);
uBound = min(uBound, distALmToBLm[k1][k2] + dataset[i].ins[ctrInsIdx1].furstInsDist + dataset[j].ins[ctrInsIdx2].furstInsDist);
}
}*/
/*for(int k1 = 0; k1 < min(dataset[i].grp.size(), dataset[j].grp.size()); k1++)
{
int ctrInsIdx1 = dataset[i].grp[k1].ctrInsIdx;vim
int ctrInsIdx2 = dataset[j].grp[k1].ctrInsIdx;
distALmToBLm[k1][k1] = dist3(dataset[i].ins[ctrInsIdx1].attribute, dataset[j].ins[ctrInsIdx2].attribute);
bagAInsBagBIns[ctrInsIdx1][ctrInsIdx2] = distALmToBLm[k1][k1];
lBound = max(lBound, distALmToBLm[k1][k1] - dataset[i].ins[ctrInsIdx1].furstInsDist - dataset[j].ins[ctrInsIdx2].furstInsDist);
uBound = min(uBound, distALmToBLm[k1][k1] + dataset[i].ins[ctrInsIdx1].furstInsDist + dataset[j].ins[ctrInsIdx2].furstInsDist);
}*/
/*for(int k1 = 0; k1 < dataset[i].grp.size(); k1++)
{
int ctrInsIdx1 = dataset[i].grp[k1].ctrInsIdx;
for(int k2 = 0; k2 <dataset[j].grp.size(); k2++)
{
int ctrInsIdx2 = dataset[j].grp[k2].ctrInsIdx;
distALmToBLm[k1][k2] = dist3(dataset[i].ins[ctrInsIdx1].attribute, dataset[j].ins[ctrInsIdx2].attribute);
bagAInsBagBIns[ctrInsIdx1][ctrInsIdx2] = distALmToBLm[k1][k2];
lBound = max(lBound, distALmToBLm[k1][k2] - dataset[i].ins[ctrInsIdx1].furstInsDist - dataset[j].ins[ctrInsIdx2].furstInsDist);
uBound = min(uBound, distALmToBLm[k1][k2] + dataset[i].ins[ctrInsIdx1].furstInsDist + dataset[j].ins[ctrInsIdx2].furstInsDist);
}
}*/
}
else
{
int ctrInsIdx1 = dataset[i].grp[0].ctrInsIdx;
int ctrInsIdx2 = dataset[j].grp[0].ctrInsIdx;
distALmToBLm[0][0] = dist3(dataset[i].ins[ctrInsIdx1].attribute, dataset[j].ins[ctrInsIdx2].attribute);
bagAInsBagBIns[ctrInsIdx1][ctrInsIdx2] = distALmToBLm[0][0];
lBound = max(lBound, distALmToBLm[0][0] - min(dataset[i].ins[ctrInsIdx1].furstInsDist, dataset[j].ins[ctrInsIdx2].furstInsDist));
/*for(int k1 = 0; k1 < dataset[i].grp.size(); k1++)
{
int ctrInsIdx1 = dataset[i].grp[k1].ctrInsIdx;
for(int k2 = 0; k2 <dataset[j].grp.size(); k2++)
{
int ctrInsIdx2 = dataset[j].grp[k2].ctrInsIdx;
distALmToBLm[k1][k2] = dist3(dataset[i].ins[ctrInsIdx1].attribute, dataset[j].ins[ctrInsIdx2].attribute);
bagAInsBagBIns[ctrInsIdx1][ctrInsIdx2] =distALmToBLm[k1][k2];
lBound = max(lBound, distALmToBLm[k1][k2] - min(dataset[i].ins[ctrInsIdx1].furstInsDist, dataset[j].ins[ctrInsIdx2].furstInsDist));
}
}*/
/*for(int k1 = 0; k1 < dataset[i].grp.size(); k1++)
{
int ctrInsIdx1 = dataset[i].grp[k1].ctrInsIdx;
for(int t = 0; t < min((int)dataset[j].grp.size(), 2); t++)
{
int k2 = (k1 + t) % dataset[j].grp.size();
int ctrInsIdx2 = dataset[j].grp[k2].ctrInsIdx;
distALmToBLm[k1][k2] = dist3(dataset[i].ins[ctrInsIdx1].attribute, dataset[j].ins[ctrInsIdx2].attribute);
bagAInsBagBIns[ctrInsIdx1][ctrInsIdx2] = distALmToBLm[k1][k2];
lBound = max(lBound, distALmToBLm[k1][k2] - min(dataset[i].ins[ctrInsIdx1].furstInsDist, dataset[j].ins[ctrInsIdx2].furstInsDist));
}
}*/
/*for(int k1 = 0; k1 < min(dataset[i].grp.size(), dataset[j].grp.size()); k1++)
{
int ctrInsIdx1 = dataset[i].grp[k1].ctrInsIdx;
int ctrInsIdx2 = dataset[j].grp[k1].ctrInsIdx;
distALmToBLm[k1][k1] = dist3(dataset[i].ins[ctrInsIdx1].attribute, dataset[j].ins[ctrInsIdx2].attribute);
bagAInsBagBIns[ctrInsIdx1][ctrInsIdx2] = distALmToBLm[k1][k1];
lBound = max(lBound, distALmToBLm[k1][k1] - min(dataset[i].ins[ctrInsIdx1].furstInsDist, dataset[j].ins[ctrInsIdx2].furstInsDist));
}*/
}
if(i == curBagIdx && (R == 0 || h_distBag.size() == R && lBound >= (h_distBag.top()).first))
continue;
if(i != curBagIdx && (C == 0 || h_distBag.size() == C && lBound >= (h_distBag.top()).first))
continue;
//if(i != curBagIdx && (C == 0 || lBound > distCurBagToCiter))
//continue;
hDist = distBtwBag[i][j] = distBtwBag[j][i] = hausdorffDist(dataset[i], dataset[j], bagAInsBagBIns, distALmToBLm);
if(hDist == -1) //go to next ins directly
continue;
if(hDist == -2) //dist btw i and j is uncertain, but we know this bag will be in front of curBag (curBagIdx)
{
distBtwBag[i][j] = distBtwBag[j][i] = -1;
hDist = 0;
}
}
if(j == curBagIdx)
distCurBagToCiter = hDist; //dist between curbag (curBagIdx) and bag i
h_distBag.push(make_pair(hDist, j));
if((i == curBagIdx && h_distBag.size() > R) || (i != curBagIdx && h_distBag.size() > C))
{
if(h_distBag.top().second == curBagIdx)
{
skip = true;
break;
}
h_distBag.pop();
}
}
if(!skip)
{
while(h_distBag.size() > 0)
{
auto k = h_distBag.top();
h_distBag.pop();
if(i == curBagIdx) //current bag is the query bag
{
vote.push_back(dataset[k.second].label);
}
else if(k.second == curBagIdx) //bag of bagIdx is in the C-nearest neighbors of bag of i
{
vote.push_back(dataset[i].label);
break;
}
}
}
}
int voteMusk = 0;
for(int i = 0; i < vote.size(); i++)
{
if(vote[i] == 1)
voteMusk++;
}
return voteMusk > (vote.size() / 2); //if tie, return 0*/
}
|
ea2a83ef9e6f5b7fde57bef7bda11aa0a3519219
|
0d0f882afd8a21aa3ab9a05da69318b77877be97
|
/Game/GameEngine/Obstacles.h
|
4173ff04ee08288f1cb681b20e2ad9109ed3513e
|
[] |
no_license
|
sara53/Sphere-of-fury-Game-
|
9161164d22bd9bb60940270eabd60ad6b6843649
|
26d01cc071014348de17d79479685656355cad19
|
refs/heads/master
| 2020-07-01T08:38:31.401617
| 2019-08-07T18:59:20
| 2019-08-07T18:59:20
| 201,111,008
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 115
|
h
|
Obstacles.h
|
#pragma once
#include "_Entity.h"
class Obstacles : public _Entity
{
public:
Obstacles(float x, float y);
};
|
503c732d30270fd10a3cefcf5818a619aea83226
|
a4e15f38ae1f82dfe0f81ad57b2abef99ec4c50f
|
/htparse_tests/src/path_test.cpp
|
76d9d0002522e23f204699b9cb24d5343e57bef2
|
[] |
no_license
|
josendf/material-cpp-1209
|
37167a1e7d9b815bb4d0b425a070b99dd418d26c
|
64db0d57b03d235761a4b8eff0bc57a67b77adb9
|
refs/heads/master
| 2016-09-06T07:32:46.950191
| 2013-01-16T15:02:15
| 2013-01-16T15:02:15
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,648
|
cpp
|
path_test.cpp
|
#include "precompiled.h"
#include "test_config.hpp"
#include <htparse/backends/testing.hpp>
BOOST_AUTO_TEST_SUITE( path_test )
BOOST_AUTO_TEST_CASE( match )
{
using htparse::context;
using htparse::context_ptr;
using htparse::message;
using htparse::request;
using htparse::parser;
using htparse::expr;
using htparse::fail;
using htparse::path;
context_ptr ctx = context::make();
request& req = ctx->request();
message m1(ctx);
parser p1(m1);
req.path() = "/a";
{
expr e = path("^/a$");
parser p = p1 >= e;
message m = p.message();
BOOST_CHECK( !p.failed() );
BOOST_CHECK( !p.complete() );
}
req.path() = "/a/b/c";
{
expr e = path("^/a/b/c$");
parser p = p1 >= e;
message m = p.message();
BOOST_CHECK( !p.failed() );
BOOST_CHECK( !p.complete() );
}
}
BOOST_AUTO_TEST_CASE( no_match )
{
using htparse::context;
using htparse::context_ptr;
using htparse::message;
using htparse::request;
using htparse::parser;
using htparse::expr;
using htparse::fail;
using htparse::path;
context_ptr ctx = context::make();
request& req = ctx->request();
message m1(ctx);
parser p1(m1);
req.path() = "";
{
expr e = path("^/a/b/c$");
parser p = p1 >= e;
message m = p.message();
BOOST_CHECK( p.failed() );
BOOST_CHECK( !p.complete() );
}
req.path() = "/a";
{
expr e = path("^/a/b/c$");
parser p = p1 >= e;
message m = p.message();
BOOST_CHECK( p.failed() );
BOOST_CHECK( !p.complete() );
}
}
BOOST_AUTO_TEST_CASE( parts )
{
using htparse::context;
using htparse::context_ptr;
using htparse::message;
using htparse::request;
using htparse::parser;
using htparse::expr;
using htparse::fail;
using htparse::path;
typedef htparse::path::part part;
context_ptr ctx = context::make();
request& req = ctx->request();
message m1(ctx);
parser p1(m1);
req.path() = "/a/b/c";
{
expr e = path("^/a", "/(\\w+)", "/(\\w+)$",
[](const message& msg,
const part& p0,
const part& p1,
const part& p2)
{
BOOST_REQUIRE( p0 );
BOOST_CHECK( p0.get() == "/a/b/c" );
BOOST_REQUIRE( p1 );
BOOST_CHECK( p1.get() == "b" );
BOOST_REQUIRE( p2 );
BOOST_CHECK( p2.get() == "c" );
return parse(msg);
});
parser p = p1 >= e;
message m = p.message();
BOOST_CHECK( !p.failed() );
BOOST_CHECK( !p.complete() );
}
req.path() = "/a/b";
{
expr e = path("^/a", "/(\\w+)", "/(\\w+)$",
[](const message& msg,
const part& p0,
const part& p1,
const part& p2)
{
BOOST_CHECK( false );
return parse(msg);
});
parser p = p1 >= e;
message m = p.message();
BOOST_CHECK( p.failed() );
BOOST_CHECK( !p.complete() );
}
req.path() = "/a";
{
expr e = path("^/a", "/(\\w+)", "/(\\w+)$",
[](const message& msg,
const part& p0,
const part& p1,
const part& p2)
{
BOOST_CHECK( false );
return parse(msg);
});
parser p = p1 >= e;
message m = p.message();
BOOST_CHECK( p.failed() );
BOOST_CHECK( !p.complete() );
}
}
BOOST_AUTO_TEST_SUITE_END()
|
7e6bc6766afd0b01cc0309fd7f3057d94bf73fdb
|
f3c7922be1ffaec7c894168b8e3cf82a43c79894
|
/examples/example-demo/src/ofApp.h
|
e1ef5c297346c13bd9a01155f9bf34bacc07f7b6
|
[
"MIT"
] |
permissive
|
adcox/ofxPlots
|
cd33e51dd292cf5ffb5fb959fca895e415f10989
|
ef8ef7268820a49ef7ac13065d089d611905e50a
|
refs/heads/master
| 2021-01-19T01:04:57.463502
| 2016-07-11T22:17:48
| 2016-07-11T22:17:48
| 62,679,711
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,789
|
h
|
ofApp.h
|
/**
* @file ofApp.h
*
* @author Andrew Cox
* @version July 5, 2016
*
* Copyright (c) 2016 Andrew Cox
*
* 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.
*/
#pragma once
#include "ofMain.h"
#include "ofxPlot.hpp"
class ofApp : public ofBaseApp{
public:
void setup();
void update();
void draw();
void keyPressed(int key);
void keyReleased(int key);
void mouseMoved(int x, int y );
void mouseDragged(int x, int y, int button);
void mousePressed(int x, int y, int button);
void mouseReleased(int x, int y, int button);
void mouseEntered(int x, int y);
void mouseExited(int x, int y);
void windowResized(int w, int h);
void dragEvent(ofDragInfo dragInfo);
void gotMessage(ofMessage msg);
protected:
ofxPlot plot;
};
|
4a1e17301ceb611162c550928f5e04194c0ea632
|
9f9660f318732124b8a5154e6670e1cfc372acc4
|
/Case_save/Case40/Case/case4/1400/T
|
fb716c72b5e5a7bcb7eebb3f04775dba6208ce53
|
[] |
no_license
|
mamitsu2/aircond5
|
9a6857f4190caec15823cb3f975cdddb7cfec80b
|
20a6408fb10c3ba7081923b61e44454a8f09e2be
|
refs/heads/master
| 2020-04-10T22:41:47.782141
| 2019-09-02T03:42:37
| 2019-09-02T03:42:37
| 161,329,638
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 7,220
|
T
|
// -*- C++ -*-
// File generated by PyFoam - sorry for the ugliness
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "1400";
object T;
}
dimensions [ 0 0 0 1 0 0 0 ];
internalField nonuniform List<scalar> 459
(
303.56
303.302
303.288
303.285
303.281
303.277
303.272
303.267
303.258
303.247
303.235
303.224
303.216
303.212
303.213
303.304
303.283
303.275
303.277
303.281
303.285
303.288
303.292
303.296
303.3
303.303
303.307
303.311
303.314
303.318
303.322
303.326
303.331
303.35
303.734
303.344
303.321
303.323
303.327
303.327
303.325
303.319
303.304
303.281
303.256
303.231
303.213
303.202
303.197
303.194
303.192
303.304
303.267
303.261
303.264
303.268
303.272
303.274
303.276
303.278
303.279
303.28
303.282
303.283
303.285
303.287
303.291
303.297
303.305
303.334
303.916
303.395
303.356
303.367
303.381
303.391
303.396
303.391
303.368
303.33
303.285
303.245
303.215
303.198
303.193
303.193
303.194
303.247
303.246
303.253
303.262
303.272
303.279
303.279
303.28
303.28
303.28
303.28
303.28
303.281
303.281
303.282
303.285
303.289
303.297
303.328
304.1
303.458
303.392
303.409
303.436
303.463
303.482
303.48
303.445
303.384
303.315
303.256
303.214
303.193
303.188
303.191
303.197
303.208
303.221
303.24
303.259
303.277
303.292
303.304
303.314
303.323
303.33
303.338
303.343
303.348
303.352
303.355
303.356
303.333
303.313
303.304
303.327
304.279
303.537
303.435
303.445
303.484
303.528
303.567
303.566
303.514
303.425
303.331
303.256
303.207
303.184
303.181
303.19
303.204
303.221
303.242
303.265
303.289
303.31
303.328
303.343
303.357
303.367
303.377
303.384
303.389
303.391
303.39
303.387
303.38
303.362
303.337
303.317
303.325
303.396
303.443
303.449
304.44
303.639
303.507
303.496
303.533
303.589
303.64
303.621
303.543
303.434
303.326
303.24
303.188
303.168
303.173
303.192
303.218
303.246
303.275
303.304
303.331
303.354
303.373
303.387
303.4
303.41
303.417
303.423
303.426
303.425
303.42
303.413
303.402
303.384
303.359
303.334
303.329
303.359
303.376
303.41
304.588
303.802
303.671
303.641
303.658
303.705
303.71
303.642
303.523
303.389
303.27
303.187
303.147
303.143
303.166
303.204
303.246
303.286
303.323
303.355
303.381
303.403
303.419
303.431
303.441
303.448
303.454
303.457
303.457
303.454
303.446
303.435
303.421
303.403
303.381
303.356
303.344
303.352
303.362
303.39
304.802
304.215
304.07
303.983
303.941
303.883
303.758
303.585
303.402
303.246
303.139
303.088
303.088
303.122
303.177
303.24
303.298
303.346
303.384
303.412
303.433
303.449
303.461
303.47
303.476
303.48
303.483
303.483
303.481
303.476
303.469
303.457
303.443
303.428
303.41
303.393
303.386
303.398
303.416
303.538
305.109
304.832
304.576
304.341
304.113
303.817
303.488
303.208
303.02
302.929
302.918
302.966
303.051
303.142
303.232
303.32
303.377
303.415
303.442
303.462
303.477
303.488
303.495
303.5
303.504
303.505
303.505
303.504
303.501
303.498
303.496
303.496
303.497
303.503
303.516
303.538
303.569
303.6
303.622
303.674
296.355
298.233
299.435
300.271
300.982
301.585
302.077
302.46
302.749
302.979
303.172
303.285
303.362
303.415
303.45
303.474
303.491
303.502
303.511
303.517
303.521
303.524
303.525
303.526
303.527
303.527
303.528
303.528
303.53
303.531
303.536
303.543
303.556
303.574
303.597
303.619
303.638
303.659
297.008
298.844
300.283
301.25
301.861
302.312
302.656
302.913
303.1
303.233
303.334
303.402
303.447
303.477
303.498
303.512
303.522
303.529
303.534
303.537
303.54
303.541
303.543
303.544
303.545
303.546
303.547
303.548
303.549
303.551
303.554
303.56
303.568
303.581
303.596
303.614
303.612
303.641
299.715
299.637
299.632
301.466
302.277
302.667
302.895
303.063
303.192
303.29
303.363
303.417
303.456
303.483
303.501
303.513
303.521
303.526
303.53
303.532
303.535
303.537
303.539
303.541
303.543
303.545
303.547
303.549
303.55
303.552
303.554
303.557
303.559
303.563
303.568
303.577
303.586
303.592
303.594
303.633
)
;
boundaryField
{
floor
{
type wallHeatTransfer;
Tinf uniform 305.2;
alphaWall uniform 0.24;
value nonuniform List<scalar> 29
(
303.406
303.663
303.6
303.569
303.572
303.582
303.596
303.613
303.631
303.649
303.667
303.684
303.7
303.716
303.731
303.746
303.762
303.779
303.794
303.833
303.833
303.75
303.708
303.684
303.406
303.663
303.645
303.462
303.374
)
;
}
ceiling
{
type wallHeatTransfer;
Tinf uniform 303.2;
alphaWall uniform 0.24;
value nonuniform List<scalar> 43
(
299.963
299.879
299.867
301.573
302.336
302.702
302.916
303.073
303.193
303.283
303.349
303.397
303.43
303.451
303.464
303.472
303.476
303.479
303.481
303.482
303.483
303.485
303.486
303.488
303.49
303.493
303.495
303.498
303.501
303.505
303.508
303.512
303.516
303.521
303.528
303.538
303.547
303.551
303.551
303.584
305.021
304.767
297.407
)
;
}
sWall
{
type wallHeatTransfer;
Tinf uniform 315.2;
alphaWall uniform 0.36;
value uniform 301.313;
}
nWall
{
type wallHeatTransfer;
Tinf uniform 307.2;
alphaWall uniform 0.36;
value nonuniform List<scalar> 6
(
304.153
304.101
304.025
304.171
304.149
304.213
)
;
}
sideWalls
{
type empty;
}
glass1
{
type wallHeatTransfer;
Tinf uniform 315.2;
alphaWall uniform 4.3;
value nonuniform List<scalar> 9
(
311.517
310.887
310.489
310.187
309.934
309.706
309.537
309.609
309.834
)
;
}
glass2
{
type wallHeatTransfer;
Tinf uniform 307.2;
alphaWall uniform 4.3;
value nonuniform List<scalar> 2
(
305.816
305.911
)
;
}
sun
{
type wallHeatTransfer;
Tinf uniform 305.2;
alphaWall uniform 0.24;
value nonuniform List<scalar> 14
(
303.733
303.489
303.474
303.464
303.455
303.447
303.438
303.429
303.418
303.407
303.396
303.39
303.388
303.393
)
;
}
heatsource1
{
type fixedGradient;
gradient uniform 0;
}
heatsource2
{
type fixedGradient;
gradient uniform 0;
}
Table_master
{
type zeroGradient;
}
Table_slave
{
type zeroGradient;
}
inlet
{
type fixedValue;
value uniform 293.15;
}
outlet
{
type zeroGradient;
}
} // ************************************************************************* //
|
|
3ef25141c19060d89bb1e18a069a589937490480
|
00fd373a5673e5b3a21798cbf0b3c961f3be8b20
|
/src/Session.cpp
|
ab79ac061c09070a859a3f076095b923d80f3fba
|
[] |
no_license
|
Yairzdr/ASS1
|
3888778bd7c7c7d2bee55650e21a8510fc8e41c3
|
a5a5d441358fe08f231cdf4b954bd835746bc049
|
refs/heads/master
| 2023-01-10T07:49:10.513094
| 2020-11-15T17:17:54
| 2020-11-15T17:17:54
| 309,748,616
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 5,873
|
cpp
|
Session.cpp
|
//
// Created by Yairzdr on 01/11/2020.
//
#include "../include/Session.h"
#include "../include/json.hpp"
#include "fstream"
#include "../include/Agent.h"
using json=nlohmann::json;
using namespace std;
/*
* Session constructor.
*reads the input json file, and initialize the TreeType, AgentList and the Graph edges.
*/
Session::Session(const std::string &path):currentCycleNum(0), g(std::vector<std::vector<int>>()), treeType(), agents(), infectedQueue(){
std::ifstream i(path);
json j;
i >> j;
string Ttype =(string)j["tree"];//Reads the input for the treetype from the json file
if (Ttype == "M")
treeType=MaxRank;
else if (Ttype == "C")
treeType=Cycle;
else
treeType=Root;
g=Graph(j["graph"]);
for(int i =0;i<(int)j["agents"].size();++i)
{
Agent* newAgent;
if(j["agents"][i][0]=="V") {
newAgent = new Virus((int) j["agents"][i][1]);
g.infectNode(j["agents"][i][1]);//Create a new virus on node i
}
else
newAgent = new ContactTracer();
agents.push_back(newAgent);
}
}
/*
* Triggers the session, runs the cycles loop and terminates when the conditions are satisfied.
*/
void Session::simulate()
{
bool terminated=false;
while(!terminated)//The conditions are not satesfied yet
{
int listSize=(int)agents.size();
for(int i=0;i<listSize;i++)
agents[i]->act(*this);
terminated=(listSize==(int)agents.size());//If the agents vector did not grew up during the cycle, the termination conditions are satisfied.
currentCycleNum++;
}
//Creating the output json file.
json output;
output["graph"]=g.getEdges();
output["infected"]=g.getInfected();
std::ofstream file("./output.json");
file << output;
}
/*
* Removes the edges of J on the graph.
*/
void Session::removeEdges(int j)
{
g.removeEdges(j);
}
void Session::addAgent(const Agent &agent) {
Agent* cloned = agent.clone();
agents.push_back(cloned);
}
void Session::setGraph(const Graph &graph) {//Setter
g = graph;
}
/*
* Finds the next available node to infect (that is not infected yet, and connected to the node the virus occupies)
* Creates a new Virus on the found node, and adds it to the Agent list.
*/
int Session::findNotInfected(int nodeID) {
for (int i = 0; i <(int)g.getSize(); i++)
if(g.getEdge(nodeID,i)==1&&!g.isInfected(i))
{
g.infectNode(i);
Agent* newAgent=new Virus(i);
agents.push_back(newAgent);
return i;
}
return -1;
}
/*
*Pushing the given node index to the end of the infected queue vector, and changing it's value on InfectedNodeList to 2 (that represents a node that is SICK and not only infected(1).
*/
void Session::enqueueInfected(int nodeInd) {
infectedQueue.push_back(nodeInd);
g.setinfectedNodesList(nodeInd,2);//=2 means that a node is SICK (red according to the logic on the instructions).
}
/*
* Poping the first node in the queue and removing it (if there is one).
*/
int Session::dequeueInfected() {
if(infectedQueue.empty())
return -1;
int pop = infectedQueue[0];
infectedQueue.erase(infectedQueue.begin());//removes the first element.
return pop;
}
/*
* Returns the TreeType Cycle/MaxRank/Root
*/
TreeType Session::getTreeType() const{
return treeType;
}
/*
* //'attacks' the node - changes a node status to SICK (infected) by using enqueInfected.
*/
void Session::attack(int nodeID) {
if(g.getinfectedNodesList()[nodeID]==1)//=1 means that the node is Infected but not SICK yet. (so it should get SICK now, and inserted to the infected queue).
enqueueInfected(nodeID);
}
/*
* Calls Graph::neighboorsOfNode which returns a list of all nodes that still has an edge with the given node.
*/
std::vector<int> Session::neighboorsOfNode(int i) {
return g.neighboorsOfNode(i);
}
/*
* //Returns the size of the graph (amount of nodes in the session).
*/
int Session::getSize() {
return g.getSize();
}
/*
* Destructor. deletes all the agents from the agents list
*/
Session::~Session()
{
Agent* agentToRemove;
while(!agents.empty())
{
agentToRemove = agents.front();
agents.erase(agents.begin());
delete agentToRemove;
}
}
//Move constructor
Session::Session(Session &&other):currentCycleNum(other.currentCycleNum), g(other.g), treeType(other.treeType), agents(std::vector<Agent*>()), infectedQueue(other.infectedQueue) {
for(int i=0;i<(int)other.agents.size();i++)
{
agents.push_back(other.agents[i]);
other.agents[i]= nullptr;
}
}
//Move Assignment
Session &Session::operator=(Session &&other) {
if (this!=&other){
this->clear();
g=other.g;
treeType=other.treeType;
infectedQueue=other.infectedQueue;
currentCycleNum=other.currentCycleNum;
agents=move(other.agents);
}
return *this;
}
//clear func (delete agent list)
void Session::clear() {
for(int i=0;i<(int)agents.size();i++)
{
delete(agents[i]);
agents.clear();
}
}
//Copy Constructor
Session::Session(const Session &other):currentCycleNum(other.currentCycleNum),g(other.g), treeType(other.treeType),agents(), infectedQueue(other.infectedQueue) {
for(int i=0;i<(int)other.agents.size();i++)
{
agents.push_back(other.agents[i]->clone());
}
}
//Copy Assignment
Session &Session::operator=(const Session &other) {
if (this!=&other){
this->clear();
g=other.g;
treeType=other.treeType;
infectedQueue=other.infectedQueue;
for(int i=0;i<(int)other.agents.size();i++)
{
agents.push_back(other.agents[i]->clone());
}
}
return *this;
}
int Session::getcurrentCycleNum() const{
return currentCycleNum;
}
|
6c400261eb8ad1ffa84e5f633e73d0470ff5c543
|
bc997f47b4cffef395f0ce85d72f113ceb1466e6
|
/Croatia/coi14_css.cpp
|
a969994e57c58340ae30ad93cd4d02fd45e15d9e
|
[
"LicenseRef-scancode-public-domain"
] |
permissive
|
koosaga/olympiad
|
1f069dd480004c9df033b73d87004b765d77d622
|
fcb87b58dc8b5715b3ae2fac788bd1b7cac9bffe
|
refs/heads/master
| 2023-09-01T07:37:45.168803
| 2023-08-31T14:18:03
| 2023-08-31T14:18:03
| 45,691,895
| 246
| 49
| null | 2020-10-20T16:52:45
| 2015-11-06T16:01:57
|
C++
|
UTF-8
|
C++
| false
| false
| 3,118
|
cpp
|
coi14_css.cpp
|
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef pair<int, int> pi;
char buf[5005];
vector<string> readline_split(){
fgets(buf, 5005, stdin);
int n = strlen(buf);
while(n > 0 && (isspace(buf[n-1]) || !isprint(buf[n-1]))) n--;
buf[n] = 0;
vector<string> ret;
string cur;
for(int i=0; i<n; i++){
if(buf[i] == ' '){
if(!cur.empty()) ret.push_back(cur);
cur.clear();
}
else cur.push_back(buf[i]);
}
if(!cur.empty()) ret.push_back(cur);
return ret;
}
struct docline{
int is_end;
string name;
vector<string> classes;
};
int n;
docline read_docline(){
n--;
auto l = readline_split();
docline ret;
if(l.size() == 1){
assert(l[0] == "</div>");
ret.is_end = 1;
return ret;
}
ret.is_end = 0;
ret.name = l[1].substr(4, l[1].size() - 5);
if(l.size() == 3){
ret.classes.push_back(l[2].substr(7, l[2].size() - 9));
}
else{
ret.classes.push_back(l[2].substr(7, l[2].size() - 7));
for(int i=3; i+1<l.size(); i++) ret.classes.push_back(l[i]);
ret.classes.push_back(l.back().substr(0, l.back().size() - 2));
}
return ret;
}
map<string, int> class_to_num;
string num_to_name[5005];
vector<int> class_node[100005];
int tree_nodes, class_count, par[5005], dout[5005];
void make_tree(){
stack<int> stk;
stk.push(0);
while(n && !stk.empty()){
int x = stk.top();
docline in = read_docline();
if(in.is_end == 1){
dout[x] = tree_nodes;
stk.pop();
}
else{
tree_nodes++;
for(auto &i : in.classes){
if(class_to_num.find(i) == class_to_num.end()){
class_to_num[i] = ++class_count;
}
class_node[class_to_num[i]].push_back(tree_nodes);
}
par[tree_nodes] = x;
num_to_name[tree_nodes] = in.name;
stk.push(tree_nodes);
}
}
assert(class_count <= 100000);
assert(tree_nodes <= 5000);
assert(n == 0);
}
vector<int> parse_brj(string s){
vector<int> v;
int ok = 0;
for(int i=0; i<s.size(); ){
int nxt = i+1;
while(nxt < s.size() && s[nxt] != '.') nxt++;
int x = class_to_num[s.substr(i + 1, nxt - i - 1)];
ok++;
for(auto &j : class_node[x]){
v.push_back(j);
}
i = nxt;
}
sort(v.begin(), v.end());
vector<int> ans;
for(int i=0; i<v.size(); ){
int e = i;
while(e < v.size() && v[e] == v[i]) e++;
if(e - i == ok) ans.push_back(v[i]);
i = e;
}
return ans;
}
vector<int> query(vector<string> &s){
auto v = parse_brj(s[0]);
for(int i=1; i<s.size(); i++){
if(s[i] == ">"){
auto r = parse_brj(s[++i]);
vector<int> ans;
for(auto &i : r){
if(binary_search(v.begin(), v.end(), par[i])) ans.push_back(i);
}
v = ans;
}
else{
auto r = parse_brj(s[i]);
vector<int> ans;
int pnt = 0;
for(auto &i : v){
pnt = max(pnt, (int)(upper_bound(r.begin(), r.end(), i) - r.begin()));
while(pnt < r.size() && r[pnt] <= dout[i]){
ans.push_back(r[pnt++]);
}
}
v = ans;
}
}
return v;
}
int main(){
scanf("%d\n",&n);
make_tree();
int m;
scanf("%d\n", &m);
while(m--){
auto in = readline_split();
auto ret = query(in);
printf("%d ", ret.size());
for(auto &i : ret){
printf("%s ", num_to_name[i].c_str());
}
puts("");
}
}
|
9050334549478da8295d992d701e6a47f37be1b9
|
d0c06ff202d77ccd30b8a8dce4cbbf9da252d234
|
/PkTex-Atlas/jni/MPACK/Graphics/Graphics.hpp
|
90e880b9acbdbff3de1a52909e70d8e487929222
|
[
"Apache-2.0"
] |
permissive
|
links234/PkTex
|
e5aa1a42d296129b93f271047e875beed82b43b1
|
8f2d33e0794e57c33305c2eceab11f6f53f0aeee
|
refs/heads/master
| 2020-04-02T22:51:38.006299
| 2015-12-01T02:54:36
| 2015-12-01T02:54:36
| 60,978,430
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 134
|
hpp
|
Graphics.hpp
|
#ifndef MPACK_GRAPHICS_HPP
#define MPACK_GRAPHICS_HPP
#include "Image.hpp"
#include "PNGImage.hpp"
#include "TargaImage.hpp"
#endif
|
3ec7fa0a9353cc40ff1b5c8d647b4e371b518f14
|
50f50760539f1619a1194c8df0af5e45cf0b226a
|
/src/type_fundamental.cpp
|
5b54f220b4e7ac343a63b06343db0ac6c67443a2
|
[] |
no_license
|
CaoKha/cpp_course
|
ee87462e6d52f4b45c0144358bcbcd199845f0d5
|
6d85468693fc715a181bc9c1c73e1cca785a2b0e
|
refs/heads/master
| 2023-04-12T20:44:09.583266
| 2021-05-12T06:27:52
| 2021-05-12T06:27:52
| 344,757,469
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,102
|
cpp
|
type_fundamental.cpp
|
#include <iostream>
using namespace std;
int main()
{
char c = 'c'; // 1octet = 8bits
wchar_t wc = 'c';
short s = 4; //16bits
int i = 5;
long l = 6;
long long ll = 7;
float f = 6.7;
double d = 6.7;
long double ld = 6.7;
bool b = true;
/*
1 <= sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long) <= sizeof(long long)
1 <= sizeof(bool) <= sizeof(long)
1 <= sizeof(char) <= sizeof(wchar_t) <= sizeof(long)
1 <= sizeof(N) = sizeof(signed N) = sizeof(unsigned N)
*/
//errors appear before warning
cout << "Size of char : " << sizeof(char) << endl;
cout << "Size of wchar_t : " << sizeof(wchar_t) << endl;
cout << "Size of short : " << sizeof(short) << endl;
cout << "Size of long : " << sizeof(long) << endl;
cout << "Size of long long: " << sizeof(long long) << endl;
cout << "Size of float : " << sizeof(float) << endl;
cout << "Size of double : " << sizeof(double) << endl;
cout << "Size of long double : " << sizeof(long double) << endl;
cout << "Size of bool : " << sizeof(bool) << endl;
}
|
291b52f36ff59599e8f268ade39411e73a5e6812
|
a61870fdad1bd541c97807988b7be68d95a1bbce
|
/Zia/ApiTaMere-1.0/ziatamer-1.0/include/api/defines.hpp
|
d4c114a8a7833948763ca28e6249368df150c22f
|
[] |
no_license
|
BGCX261/zia-tools-svn-to-git
|
9bc8632afeb6b6d0bae1048d1c679b48065bbba0
|
428fa2bbbc047eb41c7fd6223c4f0db97618764a
|
refs/heads/master
| 2016-09-10T04:21:57.737390
| 2015-08-25T15:49:37
| 2015-08-25T15:49:37
| 42,317,660
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 304
|
hpp
|
defines.hpp
|
#ifndef _ZIA_API_DEFINES_H_
#define _ZIA_API_DEFINES_H_
#define _BOF_ZIA_API_ namespace zia { namespace api {
#define _EOF_ZIA_API_ } }
_BOF_ZIA_API_
enum {
ZIA_ERR = -1,
ZIA_OK = 0,
ZIA_FAIL = 1,
ZIA_STOP = 2
};
_EOF_ZIA_API_
#endif /* _ZIA_API_DEFINES_H_ */
|
173a76fab81d0068eda9c715b807dc39d8a14938
|
b1d310b155bb695b00278544d28f52976f7b12b5
|
/clt/CmdControlLightColor.cpp
|
7b1a02b012c6abb033d915035e7b49d8ead9c996
|
[] |
no_license
|
erdoukki/deltadore_smart_router
|
cf62a6ad95cad496947446278cc210cfb540dd91
|
3ad4f35491fceecf36ecaf481b7ac68df88dc2cc
|
refs/heads/master
| 2021-01-11T17:46:39.543626
| 2016-11-07T00:41:01
| 2016-11-07T00:41:01
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 805
|
cpp
|
CmdControlLightColor.cpp
|
#include "CmdControlLightColor.h"
CmdControlLightColor::CmdControlLightColor()
{
//ctor
}
CmdControlLightColor::~CmdControlLightColor()
{
//dtor
}
void CmdControlLightColor::handle(const char* pCmd, DeltaDoreX2Driver* pDriver)
{
cJSON* pResponse = NULL;
char option[20];
int network, node, red, blue, green;
scanf("%d %d %d %d %d", &network, &node, &red, &green, &blue);
pResponse = pDriver->setLightColor(network, node, red, green, blue);
printf("%s\n", cJSON_Print(pResponse));
cJSON_Delete(pResponse);
}
const char* CmdControlLightColor::getSummary()
{
return "controlLightColor <network> <node> <red> <green> <blue>\n[help]\t\tred, green, blue: are integer between 0~255";
}
const char* CmdControlLightColor::getCmdKey()
{
return "controlLightColor";
}
|
279e9918f77a42f0694cb423d37d47ed4f1d4de9
|
3802c5a3e2af8cce63d9586d996a64df25e6656f
|
/XAMPPbase/XAMPPbase/SUSYTriggerTool.h
|
062e56f9882a60ac7b7b266921fd2a130a0fc0cf
|
[] |
no_license
|
jonipham/XAMPP_HeavyIon_TagnProbe_June18
|
c6494b99f6142014ea1cb1f3260f80c205f115a1
|
f26403a9552b9327d253c8d6e994bbed6fe36f60
|
refs/heads/master
| 2020-03-19T13:49:58.746547
| 2018-06-08T08:48:02
| 2018-06-08T08:48:02
| 136,596,998
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 7,256
|
h
|
SUSYTriggerTool.h
|
#ifndef XAMPPbase_SUSYTriggerTool_H
#define XAMPPbase_SUSYTriggerTool_H
#include <AsgTools/AsgTool.h>
#include <AsgTools/ToolHandle.h>
#include <AsgTools/AnaToolHandle.h>
#include <XAMPPbase/ITriggerTool.h>
#include <xAODBase/IParticleHelpers.h>
namespace ST {
class ISUSYObjDef_xAODTool;
}
namespace XAMPP {
class SUSYTriggerTool;
class TriggerInterface {
public:
TriggerInterface(const std::string &Name, SUSYTriggerTool*);
static void SetMatchingThreshold(float Thresh);
static void SaveTriggerPrescaling(bool B);
StatusCode initialize(XAMPP::EventInfo* Info);
bool isTriggerPassed() const;
std::string name() const;
std::string MatchStoreName() const;
std::string StoreName() const;
enum TriggerType {
UnDefined = 0, MET, SingleLepton, DiLepton, TriLepton, Photon, Tau
};
void NewEvent();
bool PassTrigger() const;
bool PassTriggerMatching();
bool NeedsTriggerMatching() const;
bool NeedsElectronMatching() const;
bool NeedsMuonMatching() const;
bool NeedsTauMatching() const;
bool NeedsPhotonMatching() const;
std::string PrintMatchingThresholds() const;
private:
template<typename Container, typename ElementLink> bool FillLinkVector(Container* Particles, XAMPP::Storage<ElementLink>* LinkStore);
template<typename ElementLink> unsigned int GetCalibMatches(XAMPP::Storage<ElementLink>* Store);
void PerformUncalibratedMatching(const xAOD::IParticleContainer* UnCalibrated);
bool IsTriggerMatched(const xAOD::IParticle* Particle) const;
void ResetObjectMatching();
//Methods needed during initialization
void GetMatchingThresholds();
int ExtractPtThreshold(std::string &TriggerString, int &M, xAOD::Type::ObjectType &T);
void SortThresholds();
bool AssignMatching(xAOD::Type::ObjectType T) const;
std::string m_name;
TriggerType m_Type;
SUSYTriggerTool* m_TriggerTool;
XAMPP::EventInfo* m_XAMPPInfo;
ToolHandle<ST::ISUSYObjDef_xAODTool> m_susytools;
XAMPP::Storage<char>* m_TriggerStore;
XAMPP::Storage<char>* m_MatchingStore;
XAMPP::Storage<float>* m_PreScalingStore;
SG::AuxElement::Decorator<char> m_MatchingDecorator;
SG::AuxElement::ConstAccessor<char> m_MatchingAccessor;
bool m_MatchEle;
bool m_MatchMuo;
bool m_MatchTau;
bool m_MatchPho;
XAMPP::Storage<MatchedEl>* m_CalibEleStore;
XAMPP::Storage<MatchedMuo>* m_CalibMuoStore;
XAMPP::Storage<MatchedTau>* m_CalibTauStore;
XAMPP::Storage<MatchedPho>* m_CalibPhoStore;
struct OfflineMatching {
float PtThreshold = 0.;
xAOD::Type::ObjectType Object = xAOD::Type::ObjectType::Other;
bool ObjectMatched = false;
};
std::vector<OfflineMatching> m_Thresholds;
static int m_AddOffThreshold;
static bool m_SavePrescaling;
};
class SUSYTriggerTool: public asg::AsgTool, virtual public ITriggerTool {
public:
virtual ~SUSYTriggerTool();
SUSYTriggerTool(std::string myname);
// Create a proper constructor for Athena
ASG_TOOL_CLASS(SUSYTriggerTool, XAMPP::ITriggerTool)
virtual StatusCode initialize();
//Checks the triggers at the beginning of the event
virtual bool CheckTrigger();
virtual bool CheckTriggerMatching();
//These functions can be called after the Trigger matching has been performed
virtual bool IsMatchedObject(const xAOD::Electron* el, const std::string& Trig);
virtual bool IsMatchedObject(const xAOD::Muon* mu, const std::string & Trig);
virtual bool IsMatchedObject(const xAOD::Photon* ph, const std::string & Trig);
virtual bool CheckTrigger(const std::string &trigger_name);
virtual StatusCode SaveObjectMatching(ParticleStorage* Storage, xAOD::Type::ObjectType Type);
virtual const xAOD::ElectronContainer* UnCalibElectrons() const;
virtual const xAOD::MuonContainer* UnCalibMuons() const;
virtual const xAOD::PhotonContainer* UnCalibPhotons() const;
virtual const xAOD::TauJetContainer* UnCalibTaus() const;
virtual xAOD::ElectronContainer* CalibElectrons() const;
virtual xAOD::MuonContainer* CalibMuons() const;
virtual xAOD::PhotonContainer* CalibPhotons() const;
virtual xAOD::TauJetContainer* CalibTaus() const;
EleLink GetLink(const xAOD::Electron* el);
MuoLink GetLink(const xAOD::Muon* mu);
PhoLink GetLink(const xAOD::Photon* ph);
TauLink GetLink(const xAOD::TauJet* tau);
protected:
bool isData() const;
StatusCode MetTriggerEmulation();
StatusCode GetHLTMet(float &met, const std::string &containerName, bool &doContainer);
StatusCode FillTriggerVector(std::vector<std::string> &triggers_vector);
XAMPP::EventInfo* m_XAMPPInfo;
private:
asg::AnaToolHandle<XAMPP::IEventInfo> m_XAMPPInfoHandle;
ToolHandle <XAMPP::ISystematics> m_systematics;
protected:
asg::AnaToolHandle<ST::ISUSYObjDef_xAODTool> m_susytools;
#ifdef XAOD_STANDALONE
int m_output_level;
#endif
ToolHandle<XAMPP::IElectronSelector> m_elec_selection;
ToolHandle<XAMPP::IMuonSelector> m_muon_selection;
ToolHandle<XAMPP::IPhotonSelector> m_phot_selection;
ToolHandle<XAMPP::ITauSelector> m_tau_selection;
std::vector<TriggerInterface*> m_triggers;
std::vector<std::string> m_met_triggers;
std::vector<std::string> m_1lep_triggers;
std::vector<std::string> m_2lep_triggers;
std::vector<std::string> m_3lep_triggers;
std::vector<std::string> m_phot_triggers;
#ifdef XAOD_STANDALONE
// also set single string as property for RC python config
std::string m_met_triggers_string;
std::string m_1lep_triggers_string;
std::string m_2lep_triggers_string;
std::string m_3lep_triggers_string;
std::string m_phot_triggers_string;
#endif
std::string m_PreName;
bool m_init;
bool m_Pass;
bool m_NoCut;
int m_OfflineThrs;
bool m_StoreObjectMatching;
bool m_StorePreScaling;
bool m_MetTrigEmulation;
bool m_doLVL1Met;
bool m_doCellMet;
bool m_doMhtMet;
bool m_doTopoClMet;
bool m_doTopoClPufitMet;
bool m_doTopoClPuetaMet;
XAMPP::Storage<char>* m_DecTrigger;
XAMPP::Storage<char>* m_DecMatching;
};
}
#endif
|
bec2b6e90c1a73144e72e56cd44e6204b548eba5
|
4ad2ec9e00f59c0e47d0de95110775a8a987cec2
|
/_Atcoder/ARC 076/C/main.cpp
|
fe21654d24deee6d4720be64bc0f8c66d0127d25
|
[] |
no_license
|
atatomir/work
|
2f13cfd328e00275672e077bba1e84328fccf42f
|
e8444d2e48325476cfbf0d4cfe5a5aa1efbedce9
|
refs/heads/master
| 2021-01-23T10:03:44.821372
| 2021-01-17T18:07:15
| 2021-01-17T18:07:15
| 33,084,680
| 2
| 1
| null | 2015-08-02T20:16:02
| 2015-03-29T18:54:24
|
C++
|
UTF-8
|
C++
| false
| false
| 647
|
cpp
|
main.cpp
|
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
#define mp make_pair
#define pb push_back
#define ll long long
#define mod 1000000007
int n, m, i;
ll ans;
int main()
{
freopen("test.in","r",stdin);
scanf("%d%d", &n, &m);
if (n > m) swap(n, m);
if (m - n > 1) {
printf("0");
return 0;
}
ans = 1;
for (i = 1; i <= n; i++) ans = (ans * i) % mod;
for (i = 1; i <= m; i++) ans = (ans * i) % mod;
if (m == n)
printf("%lld", (ans * 2) % mod);
else
printf("%lld", ans);
return 0;
}
|
2bc15f5ec2833bee5b7e61050d79879c0207443f
|
9b6e2f34b211b1e5ceecd575ee66faca039dd350
|
/app/src/main/cpp/JavaCallHelperCopy.h
|
e46902fa021bfe6eb42b19f93d6e77c83a8344bd
|
[] |
no_license
|
iChunzhen/FFJNIPlayer
|
09974248a4dadf23ee93e50f031d454d6c8c12c7
|
4ff73995fcfb8e3b56c3f1e9ac0fddd51d8c3e7a
|
refs/heads/master
| 2022-12-12T01:58:09.167227
| 2020-09-09T06:13:24
| 2020-09-09T06:13:24
| 289,184,853
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 201
|
h
|
JavaCallHelperCopy.h
|
//
// Created by yuancz on 2020/8/20.
//
#ifndef FFJNIPLAYER_JAVACALLHELPERCOPY_H
#define FFJNIPLAYER_JAVACALLHELPERCOPY_H
class JavaCallHelperCopy {
};
#endif //FFJNIPLAYER_JAVACALLHELPERCOPY_H
|
317cb9a217924c9a02b5b7dce81b606af972cac4
|
eda03521b87da8bdbef6339b5b252472a5be8d23
|
/Userland/Libraries/LibCore/SessionManagement.cpp
|
a12fef8210a4ecaafc9ab836b90b72aabf5f218f
|
[
"BSD-2-Clause"
] |
permissive
|
SerenityOS/serenity
|
6ba3ffb242ed76c9f335bd2c3b9a928329cd7d98
|
ef9b6c25fafcf4ef0b44a562ee07f6412aeb8561
|
refs/heads/master
| 2023-09-01T13:04:30.262106
| 2023-09-01T08:06:28
| 2023-09-01T10:45:38
| 160,083,795
| 27,256
| 3,929
|
BSD-2-Clause
| 2023-09-14T21:00:04
| 2018-12-02T19:28:41
|
C++
|
UTF-8
|
C++
| false
| false
| 1,556
|
cpp
|
SessionManagement.cpp
|
/*
* Copyright (c) 2022, Peter Elliott <pelliott@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibCore/Directory.h>
#include <LibCore/SessionManagement.h>
#include <LibCore/System.h>
#ifdef AK_OS_SERENITY
# include <LibSystem/syscall.h>
#endif
namespace Core::SessionManagement {
ErrorOr<pid_t> root_session_id([[maybe_unused]] Optional<pid_t> force_sid)
{
#ifdef AK_OS_SERENITY
int rc = syscall(SC_get_root_session_id, force_sid.value_or(-1));
if (rc < 0) {
return Error::from_syscall("get_root_session_id"sv, rc);
}
return static_cast<pid_t>(rc);
#else
return 0;
#endif
}
ErrorOr<void> logout(Optional<pid_t> force_sid)
{
pid_t sid = TRY(root_session_id(force_sid));
TRY(System::kill(-sid, SIGTERM));
return {};
}
ErrorOr<DeprecatedString> parse_path_with_sid(StringView general_path, Optional<pid_t> force_sid)
{
if (general_path.contains("%sid"sv)) {
pid_t sid = TRY(root_session_id(force_sid));
return general_path.replace("%sid"sv, DeprecatedString::number(sid), ReplaceMode::All);
}
return DeprecatedString(general_path);
}
ErrorOr<void> create_session_temporary_directory_if_needed(uid_t uid, gid_t gid, Optional<pid_t> force_sid)
{
pid_t sid = TRY(root_session_id(force_sid));
auto const temporary_directory = DeprecatedString::formatted("/tmp/session/{}", sid);
auto directory = TRY(Core::Directory::create(temporary_directory, Core::Directory::CreateDirectories::Yes));
TRY(directory.chown(uid, gid));
return {};
}
}
|
0b3d2dc3786d5dcdf94bbf671537ade6e86cab42
|
72852e07bb30adbee608275d6048b2121a5b9d82
|
/algorithms/problem_0759/other2.cpp
|
a984270c5fb9a16ef14f2849147bb8f0bbe22b2f
|
[] |
no_license
|
drlongle/leetcode
|
e172ae29ea63911ccc3afb815f6dbff041609939
|
8e61ddf06fb3a4fb4a4e3d8466f3367ee1f27e13
|
refs/heads/master
| 2023-01-08T16:26:12.370098
| 2023-01-03T09:08:24
| 2023-01-03T09:08:24
| 81,335,609
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 957
|
cpp
|
other2.cpp
|
class Solution {
public:
vector<Interval> employeeFreeTime(vector<vector<Interval>> schedule) {
priority_queue<Interval, vector<Interval>, cmp> q;
for (auto &intervals : schedule)
for (auto &interval : intervals)
q.push(interval);
vector<Interval> res;
Interval pre = q.top();
q.pop();
while (!q.empty()) {
Interval cur = q.top();
q.pop();
if (cur.start > pre.end) {
res.push_back(Interval(pre.end, cur.start));
pre = cur;
} else {
pre.end = max(pre.end, cur.end);
}
}
return res;
}
struct cmp {
bool operator()(Interval &interval1, Interval &interval2) {
if (interval1.start == interval2.start)
return interval1.end > interval2.end;
return interval1.start > interval2.start;
}
};
};
|
ab06e3e7762abb71e37b5740b9c52a13e7b7a0f0
|
0364bdde2c7386f38dc84e6791697c9413f51443
|
/Source/Maps/EndCredits.h
|
fc75502c73d47fe0e4c4e23aa0a1ed2b12dcd1ce
|
[
"MIT"
] |
permissive
|
DrStrangelove42/DreamOfaRidiculousMan
|
0cd088375851bc68b1f1b958a69ddcee3b3ec23c
|
a19af08c0a044ed4a30194ffdfac912475618b14
|
refs/heads/main
| 2023-06-17T19:21:53.341035
| 2021-07-14T09:39:05
| 2021-07-14T09:39:05
| 304,332,780
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,686
|
h
|
EndCredits.h
|
#ifndef ENDCREDITS_H
#define ENDCREDITS_H
#include <string>
#include "Menu.h"
#include "../Base/game.h"
#include "../Base/Entity.h"
#include "../Base/config.h"
#include "../Base/utils.h"
#include "../Characters/Player.h"
#include "../Interactions/Button.h"
#include <iostream>
#include <fstream>
#include "../Objects/Object.h"
#include "../Objects/Chest.h"
#include "../Objects/Door.h"
#include "../Objects/Key.h"
#include "../Objects/Warp.h"
#include "../Maps/Map.h"
#include "../Interactions/Story.h"
using namespace std;
/// <summary>
/// The EndCredits is a type of Menu used to greet the user when they start the game.
/// </summary>
class EndCredits : public Menu
{
protected:
/*Two labels whose pointers are saved here to move them in the tick() function.*/
/// <summary>
/// The current Label of the animation in EndCredits.
/// </summary>
Label* animation;
/// <summary>
/// Labels telling devs names.
/// </summary>
Label* names;
public:
/// <summary>
/// Constructor.
/// </summary>
/// <param name="p"></param>
/// <param name="g"></param>
EndCredits(Player& p, GAME* g);
/// <summary>
/// Destructor.
/// </summary>
virtual ~EndCredits();
/// <summary>
/// Called when the user clicks on the Play Button.
/// </summary>
/// <param name="id"></param>
void onPlayClick(int id);
/// <summary>
/// Event system when a <see cref="GAME::key">key</see> is pressed on the keyboard.
/// </summary>
/// <param name="game"></param>
virtual void onKeyDown(GAME* game);
/// <summary>
/// Time management
/// </summary>
/// <param name="time"></param>
/// <param name="game"></param>
virtual void tick(int time, GAME* game);
};
#endif
|
3cdcbe63d5c0c9a9e5ccb8f5fae6571f24f85779
|
d7056e97a0ec957a075c3727dabc34c5111942d5
|
/app/PathPlanningModule.cpp
|
5f3f577e2ac06a0f16aa441e7f3919de4da17983
|
[
"MIT"
] |
permissive
|
likhitam/robot-butler-enpm808x
|
53366771f460b0ef2d8c492151098a74f7f2bbae
|
ce7bf43378b6be8720b39b0954169d04dec2eccf
|
refs/heads/master
| 2020-04-01T16:14:49.019573
| 2017-10-17T13:50:39
| 2017-10-17T13:50:39
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,641
|
cpp
|
PathPlanningModule.cpp
|
/**
* @file PathPlanningModule.cpp
* @author Karan Vivek Bhargava
* @copyright MIT License
*
* @brief ENPM808X, Midsemester project
*
* @section DESCRIPTION
*
* This program is controlling a robot's heading direction
* using sensor fusion.
*
*/
#include <algorithm>
#include <vector>
#include "PathPlanningModule.hpp"
/**
* @brief Constructs the object.
*/
PathPlanningModule::PathPlanningModule() {
diagnostic_ = true; // Set the diagnostics value
}
/**
* @brief Destroys the object.
*/
PathPlanningModule::~PathPlanningModule() {}
/**
* @brief Sets the heading direction.
*
* @param[in] input The input
*/
void PathPlanningModule::setHeadingDirection(int input) {
currentHeadingDirection_ = input; // Set the direction
}
/**
* @brief Gets the diagnostic.
*
* @return The diagnostic truth value.
*/
bool PathPlanningModule::getDiagnostic() {
return diagnostic_; // returns the direction
}
/**
* @brief Gets the heading direction.
*
* @return The heading direction.
*/
int PathPlanningModule::getHeadingDirection() {
return currentHeadingDirection_; // returns the heading direction
}
/**
* @brief Modify the heading direction
*
* @param[in] probabilities The probabilities
*/
void PathPlanningModule::modifyHeadingDirection(
std::vector<float> probabilities) {
// Find the minimum probability
auto i = std::min_element(probabilities.begin(), probabilities.end());
// Get the index of the minimum probability
auto itr = std::distance(probabilities.begin(), i);
// Set the heading direction
setHeadingDirection(itr);
}
|
ba21b6bedccea507c71869bf4bf67d79ff04315b
|
ca43354b0d4fe919476d2bbe3549ba01c058a07b
|
/DrawingBot.ino
|
9978be9dbabf3026c5842da76c6b39ea5b82b8f9
|
[] |
no_license
|
nejo0017/DrawingBot-1
|
89b3cece1daeffe2afb0f6bd143e80d315088fac
|
4cd2b16c6b78e377e6e17a935a9f0ed9e5454d81
|
refs/heads/master
| 2021-01-16T01:07:19.562762
| 2015-02-04T11:40:56
| 2015-02-04T11:40:56
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,003
|
ino
|
DrawingBot.ino
|
#include <ADNS2610.h>
#define OPTIMOUSE_SCLK 2 // Serial clock pin on the Arduino
#define OPTIMOUSE_SDIO 3 // Serial data (I/O) pin on the Arduino
#define MOTOR_RIGHT_FWD 6
#define MOTOR_RIGHT_BCK 5
#define MOTOR_LEFT_FWD 10
#define MOTOR_LEFT_BCK 9
#define STATE_IDLE 0
#define STATE_DRIVING 1
#define STATE_TURNING 2
int state;
int currentX, currentY;
int targetX, targetY;
ADNS2610 optiMouse = ADNS2610(OPTIMOUSE_SCLK, OPTIMOUSE_SDIO);
void setup(){
Serial.begin(9600);
optiMouse.begin();
optiMouse.setSleepEnabled(false);
state = STATE_IDLE;
}
void setMotors(int right, int left){
if(right>0){
analogWrite(MOTOR_RIGHT_FWD, constrain(right, 0, 255));
digitalWrite(MOTOR_RIGHT_BCK, LOW);
}
else{
analogWrite(MOTOR_RIGHT_BCK, constrain(abs(right), 0, 255));
digitalWrite(MOTOR_RIGHT_FWD, LOW);
}
if(left>0){
analogWrite(MOTOR_LEFT_FWD, constrain(left, 0, 255));
digitalWrite(MOTOR_LEFT_BCK, LOW);
}
else{
analogWrite(MOTOR_LEFT_BCK, constrain(abs(left), 0, 255));
digitalWrite(MOTOR_LEFT_FWD, LOW);
}
}
void loop(){
updateMouse();
switch(state){
case STATE_IDLE:
break;
case STATE_DRIVING:
if(currentY >= targetY){
// stop motors
setMotors(0,0);
state = STATE_IDLE;
} else {
int deltaX = currentX - targetX;
int correction = 0;
Serial.println(deltaX);
// super-simpel-regler
correction = map(deltaX, -10, 10, -100, 100);
setMotors(200 + correction, 200 - correction);
}
break;
case STATE_TURNING:
break;
}
if(state == STATE_IDLE){
delay(500);
drive(5000);
}
}
void drive(int distance){
state = STATE_DRIVING;
targetY = currentY + distance;
targetX = currentX;
}
void turn(int angle){
// not implemented, yet
}
void updateMouse(){
if (!optiMouse.verifyPID()) {
Serial.println("fl");
Serial.flush();
optiMouse.begin();
return;
}
currentX += optiMouse.dy();
currentY -= optiMouse.dx();
}
|
cb3634f58c4b66b12597a912ad3458c4e84705ef
|
b926bfd92aec87f47e9189d070f21544cd938d06
|
/Dynamic Programming/Easy/Longest Increasing Subsequence/source.cpp
|
8b8d1751c271747ca1235859a392940673c3ceb5
|
[
"MIT"
] |
permissive
|
algoholics-ntua/algorithms
|
f48559a5c10367223061d2f13094d192c01d8e50
|
2306db43192c598cb8ec431cc6c6e564699619f0
|
refs/heads/master
| 2021-06-26T11:46:35.640458
| 2020-10-02T14:20:55
| 2020-10-02T14:20:55
| 144,731,150
| 52
| 21
|
MIT
| 2020-10-04T00:09:28
| 2018-08-14T14:24:45
|
C++
|
UTF-8
|
C++
| false
| false
| 895
|
cpp
|
source.cpp
|
#include <iostream>
#include <string>
#include <cstring>
#define MAX_N 1000
using namespace std;
int N,T;
int a[MAX_N],memo[MAX_N];
int LIS(int k){
// Longest Increasing Subsequence that ends at index k
if(memo[k]!=0) return memo[k];
int result = 1;
for(int i=0;i<k;i++){
if(a[i]<a[k]){
result = max(result, 1 + LIS(i));
}
}
memo[k] = result;
return result;
}
void initialize(int n){
memset(memo,0,sizeof(memo[0])*n);
// we initialize to 0, because 0 is not a valid answer
//each lis(i) is at least 1.
}
int main(){
ios_base::sync_with_stdio(false);
cin>>T;
while(T--){
cin>>N;
for(int i=0;i<N;i++) cin>>a[i];
if(N==0){
cout<<"0\n"; //geeksforgeeks have test cases with N=0...
continue;
}
initialize(N);
int result = 1;
for(int i=0;i<N;i++) result = max(result,LIS(i));
cout<<result<<"\n";
}
}
|
da293f712260fbb3ad211d25730fa5730b5b9070
|
2d9a39e04d03ffb8002d1c788c9e5726a90ea343
|
/src/property/dialogs/bytearrayeditdialog.cpp
|
1dcde2acac56df7668a1026982062094d3755c7d
|
[] |
no_license
|
Gris87/ObjectController
|
099d5c7598d4b96cf9950de6d60fd270354d4eef
|
02dd66a0d212f2203e3ffc3562ee712c293a7ab2
|
refs/heads/master
| 2021-01-17T17:04:36.070839
| 2013-04-19T11:55:14
| 2013-04-19T11:55:14
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,551
|
cpp
|
bytearrayeditdialog.cpp
|
#include "bytearrayeditdialog.h"
#include "ui_bytearrayeditdialog.h"
ByteArrayEditDialog::ByteArrayEditDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::ByteArrayEditDialog)
{
init(QByteArray(), 0);
}
ByteArrayEditDialog::ByteArrayEditDialog(QByteArray aValue, QWidget *parent) :
QDialog(parent),
ui(new Ui::ByteArrayEditDialog)
{
init(aValue, 0);
}
ByteArrayEditDialog::ByteArrayEditDialog(const PropertyAttributes *aAttributes, QWidget *parent) :
QDialog(parent),
ui(new Ui::ByteArrayEditDialog)
{
init(QByteArray(), aAttributes);
}
ByteArrayEditDialog::ByteArrayEditDialog(QByteArray aValue, const PropertyAttributes *aAttributes, QWidget *parent) :
QDialog(parent),
ui(new Ui::ByteArrayEditDialog)
{
init(aValue, aAttributes);
}
void ByteArrayEditDialog::init(QByteArray aValue, const PropertyAttributes *aAttributes)
{
ui->setupUi(this);
mHexEditor=new HexEditor(this);
mHexEditor->setData(aValue);
QPalette aPalette=mHexEditor->palette();
aPalette.setColor(QPalette::AlternateBase, QColor(10, 200, 90));
mHexEditor->setPalette(aPalette);
if (aAttributes)
{
aAttributes->applyToWidget(mHexEditor);
}
ui->mainLayout->insertWidget(0, mHexEditor);
}
ByteArrayEditDialog::~ByteArrayEditDialog()
{
delete ui;
}
QByteArray ByteArrayEditDialog::resultValue() const
{
return mHexEditor->data();
}
void ByteArrayEditDialog::on_okButton_clicked()
{
accept();
}
void ByteArrayEditDialog::on_cancelButton_clicked()
{
reject();
}
|
ab582e2f820ac44cb83d3fca93ae1dbf5e28915e
|
c1a0cd44fe37298430d5d60f95d9e155dfda61a5
|
/week6/26.cpp
|
12e0c818f3c496e30ac9e0fc19c280e1e66c059b
|
[] |
no_license
|
SriyaNelluri/Prep
|
4ff25c59d795dfd3b260a1984423d592157af21e
|
705d7355e60bcc9bdf2c2cb44394707b078de4b4
|
refs/heads/main
| 2023-06-04T11:52:32.326038
| 2021-06-26T12:42:13
| 2021-06-26T12:42:13
| 351,981,767
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 170
|
cpp
|
26.cpp
|
int minValue(Node* root)
{
// Code here
struct Node* current = root;
while (current->left != NULL) {
current = current->left;
}
return(current->data);
}
|
9768d03008b1cd7d479f3ee0746e437394ed5a73
|
66de603a043048334bfd9d8f4f5b7bd83d1ef1ce
|
/mainwindow.cpp
|
5ee2a675f0ebbdb0880cbabf5b61e89a4e54d791
|
[] |
no_license
|
BUAASoftEngineering/PairProgrammingHWGui
|
821d01b8675e22fa654475522f2e51cc13a51990
|
ef1e0ce4a68015aec42e28df6e2de28401b637d6
|
refs/heads/master
| 2021-04-11T12:51:00.449881
| 2020-03-24T10:48:38
| 2020-03-24T10:48:38
| 249,022,656
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 10,381
|
cpp
|
mainwindow.cpp
|
#include "mainwindow.h"
#include "./ui_mainwindow.h"
#include "qcpitemhalfline.h"
#include "QFileDialog"
#include <QDebug>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
auto customPlot = ui->plot;
customPlot->setInteraction(QCP::iSelectItems, true);
customPlot->setInteraction(QCP::iMultiSelect, true);
// give the axes some labels:
customPlot->xAxis->setLabel("x");
customPlot->yAxis->setLabel("y");
// set axes ranges, so we see all data:
rescale();
customPlot->replot();
ui->shapeListView->setModel(&shapeListModel);
connect(ui->plot, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(on_plot_mouseWheel(QWheelEvent*)));
connect(ui->plot, SIGNAL(mouseMove(QMouseEvent*)), this, SLOT(on_plot_mouseMove(QMouseEvent*)));
connect(ui->plot, SIGNAL(mousePress(QMouseEvent*)), this, SLOT(on_plot_mousePress(QMouseEvent*)));
// QT connects the below signal-slot pairs automaticly
// so DO NOT repeat it
// connect(ui->addShapeButton, &QPushButton::clicked, this, &MainWindow::on_addShapeButton_clicked);
// connect(ui->shapeTypeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(on_shapeTypeComboBox_currentIndexChanged(int)));
}
MainWindow::~MainWindow()
{
delete ui;
if(gmgr) {
deleteFigure(gmgr);
}
}
void MainWindow::keyPressEvent(QKeyEvent * event) {
if(event->key() == Qt::Key_Delete){
qDebug()<<"key delete pressed";
auto items = ui->plot->selectedItems();
qDebug()<<items;
for(auto& item: items){
auto name = item->objectName();
qDebug()<<name;
ui->plot->removeItem(item);
auto shape = shapes.find(name);
if(shape!=shapes.end()){
shapeListModel.removeRow(shape->index.row());
}
shapes.remove(name);
}
cleanFigure(gmgr);
for(const auto &shapeItem: shapes.values()) {
auto & shape = shapeItem.gshape;
addShapeToFigure(gmgr, {shape.type, shape.x1, shape.y1, shape.x2, shape.y2});
}
if(getShapesCount(gmgr) == 0){
nextGraphId = 0; //reset;
}
replotPoints();
ui->plot->replot();
}
}
void MainWindow::on_actionOpen_triggered()
{
// slot handling file open
auto fname = QFileDialog::getOpenFileName(this, "Select a file to open", ".", "*.txt;*.in");
qDebug()<<fname;
if (!fname.isEmpty()) {
cleanFigure(gmgr);
ui->plot->clearItems();
shapes.clear();
shapeListModel.removeRows(0,shapeListModel.rowCount());
nextGraphId = 0; // reset id
ERROR_INFO err = addShapesToFigureFile(gmgr, fname.toStdString().c_str());
if(err.code==ERROR_CODE::SUCCESS){
updateShapes(gmgr);
int nShape = getShapesCount(gmgr);
for(int i = 0; i<nShape; ++i) {
auto &shape = gmgr->shapes[i];
qDebug() << shape.type;
QString id = plotShape(shape.type, shape.x1, shape.y1, shape.x2, shape.y2);
}
replotPoints();
} else {
cleanFigure(gmgr);
QMessageBox::warning(this, "批量导入失败", err.messages+QString("\n At line ")+QString::number(err.lineNoStartedWithZero));
}
ui->plot->replot();
}
}
QCPAbstractItem * MainWindow::drawCircle(const QString &id, int x, int y, int r) {
auto circle = new QCPItemEllipse(ui->plot);
QPoint topLeft(x-r, y+r);
QPoint bottomRight(x+r, y-r);
QPen pen;
pen.setColor(QColor(0xff0000));
pen.setWidth(2);
circle->setPen(pen);
circle->topLeft->setCoords(topLeft);
circle->bottomRight->setCoords(bottomRight);
circle->setObjectName(id);
return circle;
}
QCPAbstractItem * MainWindow::drawLine(const QString &id, int x1, int y1, int x2, int y2) {
auto line = new QCPItemStraightLine(ui->plot);
QPoint start(x1, y1);
QPoint end(x2, y2);
QPen pen;
pen.setColor(QColor(0x00ff00));
pen.setWidth(2);
line->setPen(pen);
line->point1->setCoords(start);
line->point2->setCoords(end);
line->setObjectName(id);
return line;
}
QString MainWindow::plotShape(char type, int x1, int y1, int x2, int y2)
{
QString id = QString::number(getAndIncrementNextGraphId());
QCPAbstractItem * item;
qDebug()<<"plot shape:"<<type<<x1<<y1<<x2<<y2;
switch(type) {
case 'L':
item = drawLine(id, x1, y1, x2, y2);
break;
case 'R':
item = drawHalfLine(id, x1, y1, x2, y2);
break;
case 'S':
item = drawSegmentLine(id, x1, y1, x2, y2);
break;
case 'C':
item = drawCircle(id, x1, y1, x2);
break;
}
QString visName = id+": "+type+" "+QString::number(x1)+","+QString::number(y1)+","+QString::number(x2);
if(type!='C'){
visName += "," + QString::number(y2);
}
shapeListModel.insertRow(shapeListModel.rowCount());
auto lastRowind=shapeListModel.index(shapeListModel.rowCount()-1,0);
shapeListModel.setData(lastRowind,visName,Qt::DisplayRole);
shapes.insert(id, {{type, x1, y1, x2, y2}, item, lastRowind});
// TODO introduce movable center
double ltx = gmgr->upperleft.x;
double lty = gmgr->upperleft.y;
double rbx = gmgr->lowerright.x;
double rby = gmgr->lowerright.y;
centerX = (ltx+rbx) / 2;
centerY = (lty+rby) / 2;
qDebug()<<"cx-cy-r:"<<centerX<<centerY<<range;
range = std::max(std::abs(ltx-centerX), std::abs(lty-centerY));
range += 3; // margin
rescale();
return id;
}
QCPAbstractItem * MainWindow::drawHalfLine(const QString &id, int x1, int y1, int x2, int y2) {
auto line = new QCPItemHalfLine(ui->plot);
QPoint start(x1, y1);
QPoint end(x2, y2);
QPen pen;
pen.setColor(QColor(0x003333));
pen.setWidth(2);
line->setPen(pen);
line->point1->setCoords(start);
line->point2->setCoords(end);
line->setObjectName(id);
return line;
}
QCPAbstractItem * MainWindow::drawSegmentLine(const QString &id, int x1, int y1, int x2, int y2) {
auto line = new QCPItemLine(ui->plot);
QPoint start(x1, y1);
QPoint end(x2, y2);
QPen pen;
pen.setColor(QColor(0x666666));
pen.setWidth(2);
line->setPen(pen);
line->start->setCoords(start);
line->end->setCoords(end);
line->setObjectName(id);
return line;
}
void MainWindow::replotPoints() {
updatePoints(gmgr);
ui->plot->clearGraphs();
int nPoint = getPointsCount(gmgr);
qDebug()<<"n point:"<<nPoint;
for(int i = 0;i <nPoint; ++i){
drawPoint(gmgr->points[i].x, gmgr->points[i].y);
}
}
void MainWindow::drawPoint(double x, double y) {
QPen pen;
pen.setWidth(6);
auto graph = ui->plot->addGraph();
graph->setData({x}, {y});
graph->setPen(pen);
graph->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssDot, 2));
}
void MainWindow::on_shapeTypeComboBox_currentIndexChanged(int index)
{
// int index = ui->shapeTypeComboBox->currentIndex();
if (index == 3) {
// index 3: circle
ui->spinBoxY2->setEnabled(false);
} else {
ui->spinBoxY2->setEnabled(true);
}
}
void MainWindow::on_addShapeButton_clicked()
{
qDebug() << "clicked";
int shapeTypeInd = ui->shapeTypeComboBox->currentIndex();
char shapeType = "LRSC"[shapeTypeInd];
int x1 = ui->spinBoxX1->value();
int y1 = ui->spinBoxY1->value();
int x2 = ui->spinBoxX2->value();
int y2 = ui->spinBoxY2->value();
auto err = addShapeToFigure(gmgr, {shapeType, x1, y1, x2, y2});
if(err.code == ERROR_CODE::SUCCESS){
auto id = plotShape(shapeType, x1, y1, x2, y2);
replotPoints();
ui->plot->replot();
} else {
QMessageBox::warning(this, "添加形状失败", err.messages);
}
}
void MainWindow::on_plot_mouseWheel(QWheelEvent* event)
{
double delta = (double)event->delta();
double factor = delta>0 ? 3.3 : (3./1.1);
range = range * (factor * abs(delta) / 360);
qDebug()<<range;
rescale();
ui->plot->replot();
}
void MainWindow::on_plot_mousePress(QMouseEvent* event) {
mouseOriX = ui->plot->xAxis->pixelToCoord(event->x());
mouseOriY = ui->plot->xAxis->pixelToCoord(event->y());
qDebug()<<"mouse down"<<mouseOriX<<mouseOriY;
}
void MainWindow::on_plot_mouseMove(QMouseEvent* event) {
if(event->buttons() & Qt::LeftButton) {
// TODO: fix it
// double xCoord = ui->plot->xAxis->pixelToCoord(event->x());
// double yCoord = ui->plot->yAxis->pixelToCoord(event->y());
// double deltaX = xCoord - mouseOriX;
// double deltaY = yCoord - mouseOriY;
// centerX-=deltaX;
// centerY-=deltaY;
// qDebug()<<mouseOriX<<mouseOriY<<centerX<<centerY;
// ui->plot->xAxis->setRange(centerX-range, centerX+range);
// ui->plot->yAxis->setRange(centerY-range, centerY+range);
// mouseOriX = ui->plot->xAxis->pixelToCoord(event->x());;
// mouseOriY = ui->plot->xAxis->pixelToCoord(event->y());;
// ui->plot->replot();
}
}
void MainWindow::on_deleteButton_clicked()
{
// delete selected shapes in list view
auto selected = ui->shapeListView->selectionModel()->selectedIndexes();
QVector<QPersistentModelIndex> selectedPers;
for (auto index: selected) {
auto data = shapeListModel.data(index).toString();
auto id = data.section(QChar(':'), 0, 0);
qDebug() << data<<id;
auto shape = shapes.find(id);
if(shape!=shapes.end()){
ui->plot->removeItem(shape->item);
}
shapes.remove(id);
selectedPers.append(index);
}
for(auto index: selectedPers) {
shapeListModel.removeRow(index.row());
}
qDebug() << shapes.size();
cleanFigure(gmgr);
// shapeListModel.removeRows(0, shapeListModel.rowCount());
// ui->plot->clearItems();
for(auto &item: shapes.values()){
auto &gshape = item.gshape;
addShapeToFigure(gmgr, gshape);
}
if(getShapesCount(gmgr) == 0){
nextGraphId = 0; //reset;
}
replotPoints();
ui->plot->replot();
}
void MainWindow::rescale(){
ui->plot->xAxis->setRange(centerX-range,centerX+range);
ui->plot->yAxis->setRange(centerY-range,centerY+range);
}
|
f17f2e810f4a1f8c9815141adf1eb25d41660988
|
9d88bcceccfa1f7fd1b7b2a856cb1da45a20d2ec
|
/Safe Travels/src/Date.cpp
|
0373913b1c9f06d6edcf44a06d3c3bdfde9a2612
|
[] |
no_license
|
jro0100/Safe-Travels
|
5e582a10b6da56db0519527d4d1d90636de7c9a9
|
8f457a2ff130891db821bb0b8c01a3d7b7c1e659
|
refs/heads/master
| 2021-02-09T06:20:08.540475
| 2020-05-10T00:41:33
| 2020-05-10T00:41:33
| 244,238,140
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,395
|
cpp
|
Date.cpp
|
#include "Date.h"
//Increases m_week by one
void Date::increaseDate()
{
//Increment the week count
if (m_week <= 4)
m_week++;
//If the m_week hits five, increment the month and reset m_week to one
if (m_week > 4)
{
int temp = m_month;
temp++;
m_month = static_cast<Month>(temp);
m_week = 1;
}
//If the month of the year exceeds twelve, increment the year and reset the month count
if (static_cast<int>(m_month) > DECEMBER)
{
m_year++;
m_month = JANUARY;
}
}
//Returns m_month
std::string Date::getMonth() const
{
switch (m_month)
{
case(JANUARY):
return "January";
case(FEBRUARY):
return "February";
case(MARCH):
return "March";
case(APRIL):
return "April";
case(MAY):
return "May";
case(JUNE):
return "June";
case(JULY):
return "July";
case(AUGUST):
return "August";
case(SEPTEMBER):
return "September";
case(OCTOBER):
return "October";
case(NOVEMBER):
return "November";
case(DECEMBER):
return "December";
default:
return "???"; //This should never be executed
}
}
//Return the current week
int Date::getWeek() const { return m_week; }
//Return the current year
int Date::getYear() const { return m_year; }
//Overloaded operator<<. Prints the date
std::ostream& operator<<(std::ostream &out, const Date &date)
{
out << date.getMonth() << "\n\tWeek: "<< date.getWeek() << "\n\tYear: " << date.getYear();
return out;
}
|
e1cf08e437b51803e6e20bc9868e7a3bbb757b9d
|
6687a5a53cb371d6f1274081fda28ce5fe7a3232
|
/Leetcode Weekly Contest/Weekly Contest 155/C.cpp
|
6fee6b85fea08dadae750c7729de4f88637caed2
|
[] |
no_license
|
kugwzk/ACcode
|
40488bb7c20e5ad9dfeb4eb3a07c29b0acfee7d9
|
e3e0fe7cb3a9e1a871e769b5ccd7b8f9f78d0ea3
|
refs/heads/master
| 2021-01-17T12:59:53.003559
| 2020-08-17T07:48:28
| 2020-08-17T07:48:28
| 65,424,503
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,239
|
cpp
|
C.cpp
|
typedef pair<int,int> pii;
vector<int>e[100010];
int vis[100010];
vector<int>kuai[100010];
vector<char>fuck[100010];
int cnt;
void dfs(int rt,int col,string& s) {
vis[rt]=1;
kuai[col].push_back(rt);
fuck[col].push_back(s[rt]);
for(int i=0;i<e[rt].size();i++) {
if(vis[e[rt][i]]) continue;
dfs(e[rt][i], col, s);
}
}
class Solution {
public:
string smallestStringWithSwaps(string s, vector<vector<int>>& pairs) {
memset(vis,0,sizeof(vis));
memset(e,0,sizeof(e));
cnt = 0;
for(int i=0;i<pairs.size();i++){
int u=pairs[i][0];
int v=pairs[i][1];
e[u].push_back(v);
e[v].push_back(u);
}
for(int i=0;i<s.length();i++) {
if(vis[i]) continue;
kuai[++cnt].clear();
fuck[cnt].clear();
dfs(i,cnt,s);
}
string ans = s;
for(int i=1;i<=cnt;i++) {
sort(kuai[i].begin(),kuai[i].end());
sort(fuck[i].begin(),fuck[i].end());
for(int j=0;j<kuai[i].size();j++) {
//cout<<kuai[j]<<" "<<fuck[j]<<endl;
ans[kuai[i][j]] = fuck[i][j];
}
}
return ans;
}
};
|
b2c626e973133d11f35c828554023d655eb48d1e
|
16ac897be05248ae9af45b6f93077c7d80e32e9c
|
/source/main.cpp
|
fafea5d2bad5e3487725a8f54c78d8aadee1796c
|
[] |
no_license
|
n-paukov/MiP-Interpreter
|
9bce6c6e89b5a7d45ec89304930df5dc0696c5a1
|
248f1e7cae1a9c76a99c88372b06fc74222f2dcc
|
refs/heads/master
| 2020-03-12T15:34:16.998616
| 2018-04-23T12:49:19
| 2018-04-23T13:00:51
| 130,693,279
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 934
|
cpp
|
main.cpp
|
#include <iostream>
#include <fstream>
#include <conio.h>
#include <iomanip>
#include "Tokenizer.h"
#include "SyntaxAnalyzer.h"
void interprete(const std::string& code) {
try {
Tokenizer tokenizer;
SyntaxAnalyzer analyzer;
auto tokens = tokenizer.getTokensList(code);
auto programNode = analyzer.parse(tokens);
programNode->execute();
delete programNode;
}
catch (std::exception e) {
std::cerr << e.what() << std::endl;
}
}
int main(int argc, char* argv[]) {
std::cout << std::fixed << std::setprecision(3);
if (argc == 3) {
if (std::string(argv[1]) == "-p") {
std::ifstream t(argv[2]);
std::string str((std::istreambuf_iterator<char>(t)),
std::istreambuf_iterator<char>());
interprete(str);
return 0;
}
}
std::string code;
Tokenizer tokenizer;
SyntaxAnalyzer analyzer;
while (true) {
std::cout << "> ";
std::getline(std::cin, code);
interprete(code);
}
return 0;
}
|
88b18c1ba1ec6c8f067948e1e6faa06343e4af0c
|
fa8f6815d4dd86d7b9930f6ee66af95db2103e78
|
/Trunk/Pulse-Tec/Source/Engine/Include/Shader.h
|
44a27cf5b5a35fe3f6e29c99edc342602043c636
|
[
"LicenseRef-scancode-warranty-disclaimer"
] |
no_license
|
indygames/Pulse-Tec
|
b2ffe45cbc3b27399d46b9d084582ca9e7ab2dc3
|
6df21bfd871cc52ef24e9d8a56424004ffda34cc
|
refs/heads/master
| 2021-01-18T00:11:51.644426
| 2012-06-15T00:27:11
| 2012-06-15T00:27:11
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 7,644
|
h
|
Shader.h
|
/**************************************************************************************
*
* Copyright (C) 2009 - 2012 Brent Andrew O. Chua - See LICENSE.txt for more info.
*
* Filename - Shader.h
*
* Description -
*
* Comments -
*
* Modification History:
* Name Date Description
* MrCodeSushi - 12/06/2011 - Creation of this file
**************************************************************************************/
#ifndef _PSX_SHADER_H_
#define _PSX_SHADER_H_
#include "PulseSTD.h"
#include "GraphicsInfrastructure.h"
#include "GraphicsTypes.h"
#include "ResourcePoolItem.h"
#include "GraphicsBuffer.h"
#include "String.h"
#include "Array.h"
namespace Pulse
{
struct ShaderDesc : public BaseResDesc
{
public:
ShaderDesc( void );
void SetAsVertexShader( const CHAR *pFilename, const CHAR *pFunction = PSX_String("Main") );
void SetAsHullShader( const CHAR *pFilename, const CHAR *pFunction = PSX_String("Main") );
void SetAsDomainShader( const CHAR *pFilename, const CHAR *pFunction = PSX_String("Main") );
void SetAsGeometryShader( const CHAR *pFilename, const CHAR *pFunction = PSX_String("Main") );
void SetAsPixelShader( const CHAR *pFilename, const CHAR *pFunction = PSX_String("Main") );
void SetAsComputeShader( const CHAR *pFilename, const CHAR *pFunction, const CHAR *pProfile ) { SetDescription( EShaderType::COMPUTE, pFilename, pFunction, pProfile ); }
void SetDescription( EShaderType::Type shaderType, const CHAR *pFilename, const CHAR *pFunction, const CHAR *pProfile );
virtual EResDescType::Type GetDescType( void ) { return EResDescType::SHADER; }
EShaderType::Type type; // Shader type
String filename; // file name
String function; // Function it'll look for in the file
String profile; // Shader profile(version) it will compile against
};
struct SignatureParameterDesc
{
SignatureParameterDesc( const CHAR *pSemanticName = PSX_String(""), UINT _semanticIndex = 0,
UINT _registerIndex = 0, ESystemValueType::Type _sysValType = ESystemValueType::UNDEFINED,
ERegisterComponentType::Type _componentType = ERegisterComponentType::UNKNOWN,
BYTE _mask = 0, BYTE _readWriteMask = 0 )
{
Set( pSemanticName, _semanticIndex, _registerIndex, _sysValType, _componentType, _mask, _readWriteMask );
}
void Set( const CHAR *pSemanticName, UINT _semanticIndex, UINT _registerIndex,
ESystemValueType::Type _sysValType, ERegisterComponentType::Type _componentType, BYTE _mask, BYTE _readWriteMask )
{
semanticName = pSemanticName;
semanticIndex = _semanticIndex;
registerIndex = _registerIndex;
systemValueType = _sysValType;
componentType = _componentType;
mask = _mask;
readWriteMask = _readWriteMask;
}
String semanticName;
UINT semanticIndex;
UINT registerIndex;
ESystemValueType::Type systemValueType;
ERegisterComponentType::Type componentType;
BYTE mask;
BYTE readWriteMask;
};
// Shader variable description
struct ShaderVariableDesc
{
ShaderVariableDesc( void )
{
offset = 0;
size = 0;
flags = 0;
defaultValue = 0;
startTexture = -1;
textureSize = 0;
startSampler = -1;
samplerSize = 0;
}
void Set( const CHAR *pName, UINT _offset, SIZE_T _size, UINT _flags, PVOID _defaultValue,
UINT _startTexture, SIZE_T _textureSize, UINT _startSampler, UINT _samplerSize )
{
name = pName;
offset = _offset;
size = _size;
flags = _flags;
defaultValue = _defaultValue;
startTexture = _startTexture;
textureSize = _textureSize;
startSampler = _startSampler;
samplerSize = _samplerSize;
}
String name; // Name of the variable
UINT offset; // Offset in constant buffer's backing store
SIZE_T size; // Size of variable (in bytes)
UINT flags; // Variable flags
PVOID defaultValue; // Raw pointer to default value
UINT startTexture; // First texture index (or -1 if no textures used)
SIZE_T textureSize; // Number of texture slots possibly used.
UINT startSampler; // First sampler index (or -1 if no textures used)
UINT samplerSize; // Number of sampler slots possibly used.
};
// Shader variable's type
struct ShaderVariableType
{
ShaderVariableType( void )
{
classType = EShaderVariableClass::SCALAR;
variableType = EShaderVariableType::_VOID;
numRows = 0;
numColumns = 0;
numElements = 0;
numMembers = 0;
offset = 0;
}
void Set( EShaderVariableClass::Type _classType, EShaderVariableType::Type _varType, UINT _numRows,
UINT _numColumns, UINT _numElements, UINT _numMembers, UINT _offset, const CHAR *pName )
{
classType = _classType;
variableType = _varType;
numRows = _numRows;
numColumns = _numColumns;
numElements = _numElements;
numMembers = _numMembers;
offset = _offset;
name = pName;
}
EShaderVariableClass::Type classType; // identifies the variable class as one of scalar, vector, matrix or object.
EShaderVariableType::Type variableType; // The variable type
UINT numRows; // Number of rows (for matrices, 1 for other numeric, 0 if not applicable)
UINT numColumns; // Number of columns (for vectors & matrices, 1 for other numeric, 0 if not applicable)
UINT numElements; // Number of elements (0 if not an array)
UINT numMembers; // Number of members (0 if not a structure)
UINT offset; // Offset from the start of structure (0 if not a structure member)
String name; // Name of type, can be NULL
};
struct ShaderVariable
{
ShaderVariableDesc desc; // Variable desciption
ShaderVariableType type; // Type description
};
// Shader buffer description
struct ShaderBufferDesc
{
ShaderBufferDesc()
{
bufferType = EShaderBufferType::CONSTANT_BUFFER;
numVariables = 0;
bufferSize = 0;
flags = 0;
}
void Set( const CHAR *pName, EShaderBufferType::Type _bufferType, SIZE_T _numVars, SIZE_T _bufferSize, UINT _flags )
{
name = pName;
bufferType = _bufferType;
numVariables = _numVars;
bufferSize = _bufferSize;
flags = _flags;
}
String name; // The name of the buffer.
EShaderBufferType::Type bufferType; // The intended use of the constant data.
SIZE_T numVariables; // Number of unique variables.
SIZE_T bufferSize; // Buffer size in bytes.
UINT flags; // Shader buffer properties.
};
struct ConstantBufferLayout
{
typedef Array<ShaderVariable> VariableList;
ShaderBufferDesc desc;
VariableList variables;
// TODO: Variable params
};
class Shader : public IResourcePoolItem, public GraphicsBuffer
{
public:
virtual ~Shader( void );
// These defines the base interface for all derived resources
virtual BOOL CreateResource( BaseResDesc *pDesc );
virtual BOOL DestroyResource( void );
virtual BOOL DisableResource( void );
virtual BOOL RestoreResource( void );
virtual EShaderType::Type GetType( void ) = 0;
void * GetCompiledShader( void ) { return (void*)m_pCompiledShader; }
virtual void * GetNakedShader( void ) = 0;
protected:
Shader( void );
EErrorCode::Type CompileShader( void );
EErrorCode::Type QueryParameters( void );
virtual EErrorCode::Type OnInitialize( void ) { return EErrorCode::OKAY; }
virtual void OnCleanup( void ) { }
private:
EErrorCode::Type Initialize( void );
void Cleanup( void );
protected:
typedef Array<SignatureParameterDesc> SignatureParameters;
ShaderDesc m_desc;
D3D11_SHADER_DESC m_d3dShaderDesc;
ID3DBlob *m_pCompiledShader;
SignatureParameters m_inputSignature;
SignatureParameters m_outputSignature;
};
}
#endif /* _PSX_SHADER_H_ */
|
5fa827589f22a08ac70c94b8f770713cb2992240
|
d8e69f3deb2403211dbbcd919170966bb9fe6f88
|
/include/axis_interface.hpp
|
b316e88055c5ecbca16e6b7fec22173ec9173e60
|
[
"Apache-2.0"
] |
permissive
|
ipsch/kielflow
|
dd793fa0ddbc7c1684f70197e87ceeaf9b70ad29
|
54f3ac1903b17bb3f14e67c3cbba341dff55158a
|
refs/heads/master
| 2020-04-06T13:55:09.347213
| 2016-11-23T02:09:04
| 2016-11-23T02:09:04
| 49,132,639
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 571
|
hpp
|
axis_interface.hpp
|
#ifndef AXIS_INTERFACE_HPP_
#define AXIS_INTERFACE_HPP_
class axis_interface
{
public :
virtual ~axis_interface() { };
// unsecure access
virtual double val_at(const int &index) const = 0;
virtual int index_at(const double &val) const = 0;
virtual double k_val_at(const int &index) const = 0;
virtual int k_index_at(const double &val) const = 0;
// secure access
//virtual double operator() (const int &i) const = 0;
//virtual int operator() (const double &x) const = 0;
//virtual int operator() (const double &x, double &lambda) const = 0;
};
#endif
|
32f0af83bee78ce804271e22a3ddb9226aae9e46
|
6d5b4c0d6d846b5d7182d8e894319b54e9ae04b9
|
/src/copy-move-forgery-mpi/MPISettings.cpp
|
c35142387c4b66f8a53fcf0006971e298d585bda
|
[] |
no_license
|
filincowsky/copy_forgery_detect
|
655e03f317dfff510c45e3c8c57cd5a864a7760b
|
fdee9ae10e2677aa5a9cb014e6f132eb8ca9633c
|
refs/heads/master
| 2022-01-29T10:43:16.205155
| 2015-07-07T17:54:26
| 2015-07-07T17:54:26
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 522
|
cpp
|
MPISettings.cpp
|
#include "MPISettings.h"
#include <mpi/mpi.h>
MPISettings::MPISettings() :
PROC_SIZE_(0),
PROC_ID_(0)
{
MPI_Comm_size(MPI_COMM_WORLD, &PROC_SIZE_);
MPI_Comm_rank(MPI_COMM_WORLD, &PROC_ID_);
}
MPISettings& MPISettings::instance()
{
static MPISettings inst;
return inst;
}
int MPISettings::PROC_SIZE()
{
return instance().PROC_SIZE_;
}
int MPISettings::PROC_ID()
{
return instance().PROC_ID_;
}
bool MPISettings::IS_PROC_ID_MASTER()
{
return instance().PROC_ID_ == PROC_MASTER;
}
|
f72e6a238baa4b19b9b3da42bbfdf1b5a5ebd819
|
27da0cc89da83446c328f37a3fceec9e920764fa
|
/3-MoreOOP/Inheritance/src/Person.cpp
|
695276b90238f431019f98bb792dd8e38c474469
|
[] |
no_license
|
eborghi10/DEV210.2x_edX
|
1006ae597f68921f3e8019216055fa9e944f6140
|
ac8e53f8871cd436a68d80ea138c22209e09739f
|
refs/heads/master
| 2021-01-13T08:43:08.946054
| 2017-02-23T10:46:14
| 2017-02-23T10:46:14
| 81,825,703
| 3
| 2
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 717
|
cpp
|
Person.cpp
|
/*
* Person.cpp
*
* Created on: 15 Feb 2017
* Author: emiliano
*/
#include <iostream>
#include "Person.h"
Person::Person() : firstName("John"), lastName("Doe"), age(0) {
}
Person::Person(std::string fName, std::string lName) :
firstName(fName), lastName(lName), age(0) {
}
Person::Person(std::string fName, std::string lName, int age) :
firstName(fName), lastName(lName), age(age) {
}
Person::~Person() {
std::cout << "Destructor called" << std::endl;
}
void Person::SayHello() {
std::cout << "Hello!" << std::endl;
}
void Person::displayNameAge() const {
std::cout << "\nName: " << this->firstName << " " << this->lastName << std::endl;
std::cout << "Age: " << this->age << std::endl;
}
|
bfc3806ccd1930f3edd9ae841d9ca72ff2eb02d4
|
b417bacdcf8d4cda0333a0d2a757af42960a0757
|
/Simple Game Engine/Bob.cpp
|
9ee4000ebe9905b5e3d684224d79d398c4b8d5ba
|
[] |
no_license
|
kschmanski/Simple-Game-Engine
|
61176cd54bd20ed276db3f5bbdd5b08d4d9ddf60
|
81e6d427681ccd80bbd40cca5394da5b3ee01ad7
|
refs/heads/master
| 2020-06-07T05:39:42.133097
| 2019-06-20T20:05:58
| 2019-06-20T20:05:58
| 192,937,423
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,566
|
cpp
|
Bob.cpp
|
#include "stdafx.h"
#include "Bob.h"
#include "Engine.h"
Bob::Bob() {
//how fast does Bob move?
m_Speed = 400; //pixels per second
m_Texture.loadFromFile("newCharacter.png");
m_Sprite.setTexture(m_Texture);
m_Sprite.setTextureRect(IntRect(50, 1500, 130, 300)); //standing character
m_MovingSprite.setTexture(m_Texture);
m_MovingSprite.setTextureRect(IntRect(0, 0, 160, 300)); //moving character
m_Sprite.setScale(0.6, 0.6);
m_MovingSprite.setScale(0.5, 0.5);
//set Bob's starting position
m_Position.x = 500;
m_Position.y = 800;
}
Sprite Bob::getSprite() {
return m_Sprite;
}
Sprite Bob::getMovingSprite() {
return m_MovingSprite;
}
bool Bob::isMoving() {
return m_LeftPressed || m_RightPressed || m_UpPressed || m_DownPressed;
}
void Bob::moveLeft() {
m_LeftPressed = true;
}
void Bob::moveRight() {
m_RightPressed = true;
}
void Bob::moveUp() {
m_UpPressed = true;
}
void Bob::moveDown() {
m_DownPressed = true;
}
void Bob::stopLeft() {
m_LeftPressed = false;
}
void Bob::stopRight() {
m_RightPressed = false;
}
void Bob::stopUp() {
m_UpPressed = false;
}
void Bob::stopDown() {
m_DownPressed = false;
}
void Bob::update(float elapsedTime) {
if (m_RightPressed) {
m_Position.x += m_Speed * elapsedTime;
}
if (m_LeftPressed) {
m_Position.x -= m_Speed * elapsedTime;
}
if (m_UpPressed) {
m_Position.y -= m_Speed * elapsedTime;
}
if (m_DownPressed) {
m_Position.y += m_Speed * elapsedTime;
}
m_Sprite.setPosition(m_Position);
m_MovingSprite.setPosition(m_Position); //test - might delete this
}
|
c7d8569b516aaff4017f37b0bf8d27099fe7462c
|
58748e6da9052a63539cf8c53ac78e859c13dbb2
|
/src/Tools/Tool_RBF_HeightMap.cpp
|
bb4ad4e881a2b2c5c5afe1666cc52867eeb90c25
|
[] |
no_license
|
JulesFouchy/IMACUBES
|
eb2b6a2f6720b44f78882cde472c9d70c86012f1
|
c5c64577f179eed3ca86e4913f965ce17e6f77d0
|
refs/heads/master
| 2021-12-09T00:40:00.548058
| 2021-12-05T14:49:36
| 2021-12-05T14:49:36
| 220,300,221
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,834
|
cpp
|
Tool_RBF_HeightMap.cpp
|
#include "Tool_RBF_HeightMap.hpp"
#include "RBF/RBF.hpp"
Tool_RBF_HeightMap::Tool_RBF_HeightMap()
{
m_bSurfaceMode = false;
m_modulingFunction = &m_inverse;
m_modulingFunctionID = 1;
}
void Tool_RBF_HeightMap::addAnchorPoint(const glm::ivec3& pos) {
m_anchorPts.push_back(glm::ivec2(pos.x, pos.z));
m_valuesAtAnchorPts.conservativeResize(m_valuesAtAnchorPts.size() + 1);
m_valuesAtAnchorPts(m_valuesAtAnchorPts.size() - 1) = pos.y;
}
void Tool_RBF_HeightMap::evaluateRBFOnWorld(std::function<void(const glm::ivec3 & pos)> whatToDoWithPos) {
RBF<glm::ivec2> rbf = RBF<glm::ivec2>(m_anchorPts, m_valuesAtAnchorPts, *m_modulingFunction);
BoundingBox worldBB;
for (const glm::ivec3& pos : worldBB) {
float d = rbf.eval(glm::vec2(pos.x, pos.z));
if ((!m_bInvertSelection && condition(d, pos)) || (m_bInvertSelection && !condition(d, pos))) {
whatToDoWithPos(pos);
}
}
}
bool Tool_RBF_HeightMap::condition(float h, const glm::ivec3& pos) {
if (m_bSurfaceMode)
return abs(h - pos.y) < m_threshhold;
else
return pos.y < h + m_threshhold;
}
void Tool_RBF_HeightMap::reset() {
Tool_RBF::reset();
m_anchorPts.clear();
}
void Tool_RBF_HeightMap::ImGui_Window() {
ImGui::Begin("RBF height map");
bool bComputePreview = false;
bComputePreview |= ImGui_ModulingFunction();
ImGui::Separator();
bComputePreview |= ImGui_Condition();
ImGui::Separator();
ImGui::Text("Anchor points");
for (size_t k = 0; k < m_anchorPts.size(); ++k) {
glm::ivec2& anchorPt = m_anchorPts[k];
float& value = m_valuesAtAnchorPts[k];
ImGui::PushID(k);
bComputePreview |= ImGui::DragInt2("Pos", &anchorPt.x);
bComputePreview |= ImGui::DragFloat("Val", &value);
ImGui::PopID();
ImGui::Separator();
}
ImGui_Finalize(bComputePreview);
ImGui::End();
}
|
9a777e27ff08d6287c27ce2d035135b96f9b42a5
|
01341bca679e9a907a1462e1bfad39572d91b5f0
|
/Beetle.NetPackage/Sources/Cpp/ByteArrayReader.h
|
12c90bee5902983e9c1121333b5b5741a8d840a1
|
[
"MIT"
] |
permissive
|
yonglehou/IKendeLib
|
cf2693ee322e072e8dff4489aa3b3cbcf500a407
|
8e0db3277a306da50922d67df6b3828ea4ad257c
|
refs/heads/master
| 2021-01-18T05:25:03.617900
| 2014-01-20T05:38:21
| 2014-01-20T05:38:21
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,032
|
h
|
ByteArrayReader.h
|
#pragma once
using namespace System;
using namespace System::Collections::Generic;
using namespace System::Linq;
using namespace System::Text;
/**
* Original author:
* Copyright © henryfan 2013
* Created by henryfan on 2013-7-30.
* C++.NET Version:
* Edit by ForeverACMer on 2013-09-07.
* homepage:www.ikende.com
* email:henryfan@msn.com & helibin822@gmail.com
*/
namespace Beetle
{
namespace NetPackage
{
public ref class ByteArrayReader
{
public:
ByteArrayReader(System::IO::Stream ^stream, Boolean littleEndian);
public:
property Boolean LittleEndian
{
Boolean get();
void set(Boolean value);
}
Byte Read();
Boolean ReadBool();
Int16 ReadInt16();
Int32 ReadInt32();
Int64 ReadInt64();
UInt16 ReadUInt16();
UInt32 ReadUInt32();
UInt64 ReadUInt64();
Char ReadChar();
float ReadFloat();
double ReadDouble();
String ^ReadUTF();
array<Byte> ^ReadBytes(int count);
private:
System::IO::BinaryReader ^m_Reader;
Boolean m_IsLittleEndian;
};
}
}
|
e555ced9101591996cd4560d3ffbe3ad7d5d45e3
|
a8127e945b4c719037866e1ec2eb42cd238687e1
|
/magicalstring.cpp
|
2b315d38a3bd0a4e5b1ea4ee81abf190de7c3c52
|
[] |
no_license
|
darrinmwiley/Kattis-Solutions
|
efd638ad286582968dbad6cd7463783e8cf4ae1d
|
4ef7402e7e667a12400d2167c1a9a585b173fbe8
|
refs/heads/master
| 2021-07-31T20:51:48.617983
| 2021-07-29T22:41:20
| 2021-07-29T22:41:20
| 80,001,676
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 12,550
|
cpp
|
magicalstring.cpp
|
#include "bits/stdc++.h"
#include <algorithm>
using namespace std;
#define pb push_back
#define boolean bool
#define li long long int
string chars;
char become[1001];
int N;
int K;
bool canSpecialProp(char previous, int start)
{
if(start >= chars.length())
return false;
return become[start] != previous && become[start] != ' ';
}
char whatBecome(int start)
{
if(start >= chars.length() - 2)
return ' ';
char ch1 = chars[start];
char ch2 = ' ';
int occ1 = 1;
int occ2 = 0;
for(int i = start+1;i<chars.length();i++)
{
if(chars[i] == ch1)
{
occ1++;
}else if(ch2 == ' ')
{
ch2 = chars[i];
occ2++;
}else if(ch2 == chars[i])
{
occ2++;
}else {
if(i-start < 3)
return ' ';
if(occ1 > occ2)
return ch1;
if(occ2 > occ1)
return ch2;
}
if(occ1 >= 2 && occ2 >= 2)
{
if(chars[i] == ch1)
return ch2;
return ch1;
}
}
if(occ1 == 1)
return ch2;
return ch1;
}
int solve()
{
int L1 = chars.length() + 1;
int L2 = K+1;
int L3 = 2;
int dp[chars.length()+1][K+1][2];//location, K, flag
for(int i = 0;i<L1;i++)
{
for(int j = 0;j<L2;j++)
{
for(int k = 0;k<2;k++)
dp[i][j][k] = 0;
}
}
for(int loc = L1 - 1;loc>=0;loc--)
{
loop:
for(int k = 0;k<L2;k++)
{
if(k == 0 || chars.length() - loc < 3)//no swaps left or not enough chars
{
dp[loc][k][0] = 0;//if not forced replacement, you just don't do anything
dp[loc][k][1] = -1001;//if forced replacement, being here is illegal so -inf
}else {
boolean cont = false;
boolean flag = false;//have you seen second char
char ch1 = chars[loc];//first char
char ch2 = ' ';//second char
int origNum = 1;//how many of first you have seen
int newNum = 0;//how many of second
for(int i = loc+1;i<chars.length();i++)//from start+1..end, look at chars
{
if(cont)
break;
//if(loc == 0 && k == )
if(chars[i] == ch1)//if it's original, just bump count
{
//adaaddada
origNum++;
if(i - loc >= 2 && newNum != 2 && canSpecialProp(chars[i], i+1))//if you have seen at least 2 of first character, you can do special propogation
{
dp[loc][k][0] = max(dp[loc][k][0], i-loc+1+dp[i+1][k-1][1]);//replace
dp[loc][k][1] = max(dp[loc][k][1], i-loc+1+dp[i+1][k-1][1]);//replace
}
}else {//not original character
if(!flag)//if you haven't seen second char yet
{
flag = true;//you've now seen second char
ch2 = chars[i];
if(i - loc >= 2 && canSpecialProp(chars[i], i+1)){//if you have seen at least 2 of first character, you can do special propogation
dp[loc][k][0] = max(dp[loc][k][0], i-loc+1+dp[i+1][k-1][1]);//replace
dp[loc][k][1] = max(dp[loc][k][1], i-loc+1+dp[i+1][k-1][1]);//replace
}
newNum = 1;
}else if(chars[i]==ch2)
{
newNum++;
}else{//you've seen some new character that is not ch1 or ch2
if(i - loc >=3) {//if you've look at at least 3 characters before this, you can replace them
dp[loc][k][0] = max(dp[loc][k][0], (i-loc) + dp[i][k-1][0]);//replace
dp[loc][k][1] = max(dp[loc][k][1], (i-loc) + dp[i][k-1][0]);//replace
}
else//
{//
dp[loc][k][1] = -1001;
}//
//if not forced, you can throw away 1 char
dp[loc][k][0] = max(dp[loc+1][k][0], dp[loc][k][0]);//throw 1 away
cont = true;
}
}
//if you've seen a second anomaly, make replacement
if(origNum >= 2 && newNum >= 2)
{
//System.out.println(loc+" "+k+" "+i+" "+dp[loc][k][0]);
dp[loc][k][0] = max(dp[loc][k][0], i-loc + dp[i][k-1][0]);//replace
dp[loc][k][1] = max(dp[loc][k][1], i-loc + dp[i][k-1][0]);//replace
dp[loc][k][0] = max(dp[loc][k][0], dp[loc+1][k][0]);//throw 1 away
cont = true;
}
}
if(!cont)
{
dp[loc][k][0] = max(dp[loc][k][0], (int)(chars.length() - loc));//replace
dp[loc][k][1] = max(dp[loc][k][1], (int)(chars.length() - loc));//replace
}
}
}
}
return dp[0][K][0];
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> N;
for(int z = 0;z<N;z++)
{
cin >> chars;
for(int i = 0;i<chars.length();i++)
become[i] = whatBecome(i);
cin >> K;
int solution = solve();
cout << solution << endl;
}
}
/*public static void main(String[] args) throws Exception
{
new magicalstring4().run();
}
public void run() throws Exception{
file = new BufferedReader(new InputStreamReader(System.in));
pout = new PrintWriter(System.out);
int N = Integer.parseInt(file.readLine());
for(int i = 0;i<N;i++)
{
st = new StringTokenizer(file.readLine());
chars = st.nextToken().toCharArray();
become = new char[chars.length];
Arrays.fill(become, ' ');
for(int j = 0;j<become.length-2;j++)
{
become[j] = this.whatBecome(chars, j);
}
int K = Integer.parseInt(st.nextToken());
pout.println(solve(K, chars));
}
pout.flush();
}
public boolean canSpecialProp(char[] chars, char previous, int start)
{
if(start >= become.length)
return false;
return become[start] != previous && become[start] != ' ';
}
public char whatBecome(char[] chars, int start)
{
if(start >= chars.length - 2)
return ' ';
char ch1 = chars[start];
char ch2 = ' ';
int occ1 = 1;
int occ2 = 0;
for(int i = start+1;i<chars.length;i++)
{
if(chars[i] == ch1)
{
occ1++;
}else if(ch2 == ' ')
{
ch2 = chars[i];
occ2++;
}else if(ch2 == chars[i])
{
occ2++;
}else {
if(i-start < 3)
return ' ';
if(occ1 > occ2)
return ch1;
if(occ2 > occ1)
return ch2;
}
if(occ1 >= 2 && occ2 >= 2)
{
if(chars[i] == ch1)
return ch2;
return ch1;
}
}
if(occ1 == 1)
return ch2;
return ch1;
}
public int solve(int K, char[] chars)
{
int[][][] dp = new int[chars.length+1][K+1][2];//location, K, flag
for(int loc = dp.length - 1;loc>=0;loc--)
{
loop:
for(int k = 0;k<dp[loc].length;k++)
{
if(k == 0 || chars.length - loc < 3)//no swaps left or not enough chars
{
dp[loc][k][0] = 0;//if not forced replacement, you just don't do anything
dp[loc][k][1] = -1001;//if forced replacement, being here is illegal so -inf
continue loop;
}else {
boolean flag = false;//have you seen second char
char ch1 = chars[loc];//first char
char ch2 = ' ';//second char
int origNum = 1;//how many of first you have seen
int newNum = 0;//how many of second
for(int i = loc+1;i<chars.length;i++)//from start+1..end, look at chars
{
//if(loc == 0 && k == )
if(chars[i] == ch1)//if it's original, just bump count
{
//adaaddada
origNum++;
if(i - loc >= 2 && newNum != 2 && canSpecialProp(chars, chars[i], i+1))//if you have seen at least 2 of first character, you can do special propogation
{
dp[loc][k][0] = Math.max(dp[loc][k][0], i-loc+1+dp[i+1][k-1][1]);//replace
dp[loc][k][1] = Math.max(dp[loc][k][1], i-loc+1+dp[i+1][k-1][1]);//replace
}
}else {//not original character
if(!flag)//if you haven't seen second char yet
{
flag = true;//you've now seen second char
ch2 = chars[i];
if(i - loc >= 2 && canSpecialProp(chars, chars[i], i+1)){//if you have seen at least 2 of first character, you can do special propogation
dp[loc][k][0] = Math.max(dp[loc][k][0], i-loc+1+dp[i+1][k-1][1]);//replace
dp[loc][k][1] = Math.max(dp[loc][k][1], i-loc+1+dp[i+1][k-1][1]);//replace
}
newNum = 1;
}else if(chars[i]==ch2)
{
newNum++;
}else{//you've seen some new character that is not ch1 or ch2
if(i - loc >=3) {//if you've look at at least 3 characters before this, you can replace them
dp[loc][k][0] = Math.max(dp[loc][k][0], (i-loc) + dp[i][k-1][0]);//replace
dp[loc][k][1] = Math.max(dp[loc][k][1], (i-loc) + dp[i][k-1][0]);//replace
}
else//
{//
dp[loc][k][1] = -1001;
}//
//if not forced, you can throw away 1 char
dp[loc][k][0] = Math.max(dp[loc+1][k][0], dp[loc][k][0]);//throw 1 away
continue loop;
}
}
//if you've seen a second anomaly, make replacement
if(origNum >= 2 && newNum >= 2)
{
//System.out.println(loc+" "+k+" "+i+" "+dp[loc][k][0]);
dp[loc][k][0] = Math.max(dp[loc][k][0], i-loc + dp[i][k-1][0]);//replace
dp[loc][k][1] = Math.max(dp[loc][k][1], i-loc + dp[i][k-1][0]);//replace
dp[loc][k][0] = Math.max(dp[loc][k][0], dp[loc+1][k][0]);//throw 1 away
continue loop;
}
}
dp[loc][k][0] = Math.max(dp[loc][k][0], chars.length - loc);//replace
dp[loc][k][1] = Math.max(dp[loc][k][1], chars.length - loc);//replace
}
}
}
return dp[0][K][0];
}
}*/
|
15b9becfe7268fd278e732a86d1b31e45badb07e
|
1cfd20fa175e1751d1441f32f990ece5423c484a
|
/algorithms/0079_WordSearch/0079_WordSearch.cpp
|
17d810f6fbeb59f039c96fd2afe1d990fc6d4be2
|
[
"MIT"
] |
permissive
|
243468234/leetcode-question
|
9cdfc0db329d8b7b380674b1ebad8e05d624c6b8
|
35aad4065401018414de63d1a983ceacb51732a6
|
refs/heads/master
| 2022-11-25T13:30:42.650593
| 2020-08-02T07:43:48
| 2020-08-02T07:43:48
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,803
|
cpp
|
0079_WordSearch.cpp
|
class Solution {
public:
bool exist(vector<vector<char>>& board, string word) {
if (board.size() == 0 || board[0].size() == 0){
return false;
}
vector<vector<bool>> used(board.size(), vector<bool>(board[0].size(), false));
for (int i = 0 ; i < board.size(); i++){
for (int j = 0; j < board[i].size(); ++j){
if (dfs( board, i, j, word, 0, used)){
return true;
}
}
}
return false;
}
bool dfs(const vector<vector<char>>& board, int row, int column,
const string &word, int index, vector<vector<bool>> &used){
if (board[row][column] != word[index]){
return false;
}
if (index == word.length() - 1){
return true;
}
int height = board.size();
int width = board[0].size();
used[row ][column] = true;
// 上
if (row > 0 && !used[row - 1][column] ){
if (dfs( board, row - 1, column, word, index + 1, used)){
return true;
}
}
// 左
if (column > 0 && !used[row][column - 1] ){
if (dfs( board, row, column - 1, word, index + 1, used)){
return true;
}
}
// 下
if (row + 1 < height && !used[row + 1][column]){
if (dfs( board, row + 1, column, word, index + 1, used)){
return true;
}
}
// 右
if (column + 1 < width && !used[row][column + 1]){
if (dfs( board, row, column+ 1, word, index + 1, used)){
return true;
}
}
used[row][column] = false;
return false;
}
};
|
f14a5072d144fb820fe7a76e8ab3c472336aaff2
|
c1c21dcb86d029ca0ea20f68a8a5144c0ffaeaf2
|
/src/cylinder.cpp
|
63215a9ebf0079c5ad5951daef13542cdf93b4e0
|
[] |
no_license
|
chrols/helios
|
b29d20ecbc887e423c265c937ef0c14720b1ad7e
|
3c051971d25aa1e5d86bce7293d351918661f7cd
|
refs/heads/master
| 2021-08-07T07:03:04.076532
| 2020-05-05T21:24:32
| 2020-05-05T21:27:36
| 169,152,098
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,517
|
cpp
|
cylinder.cpp
|
#include "cylinder.hpp"
#include "common.hpp"
#include <limits>
Cylinder::Cylinder()
: m_minimum(-std::numeric_limits<double>::infinity()),
m_maximum(std::numeric_limits<double>::infinity()) {}
std::vector<Intersection> Cylinder::localIntersect(const Ray &r) const {
auto a = r.direction.x * r.direction.x + r.direction.z * r.direction.z;
if (almostEqual(a, 0.0))
return {};
auto b = 2 * r.origin.x * r.direction.x + 2 * r.origin.z * r.direction.z;
auto c = r.origin.x * r.origin.x + r.origin.z * r.origin.z - 1;
auto disc = b * b - 4 * a * c;
if (disc < 0)
return {};
auto t0 = (-b - std::sqrt(disc)) / (2 * a);
auto t1 = (-b + std::sqrt(disc)) / (2 * a);
if (t0 > t1)
std::swap(t0, t1);
auto xs = std::vector<Intersection>();
auto y0 = r.origin.y + t0 * r.direction.y;
if (m_minimum < y0 and y0 < m_maximum) {
xs.emplace_back(Intersection(t0, shared_from_this()));
}
auto y1 = r.origin.y + t1 * r.direction.y;
if (m_minimum < y1 and y1 < m_maximum) {
xs.emplace_back(Intersection(t1, shared_from_this()));
}
return xs;
}
Optional<Vector> Cylinder::localNormal(const Point &p) const {
return Vector(p.x, 0, p.z);
}
double Cylinder::minimum() const {
return m_minimum;
}
void Cylinder::setMinimum(double minimum) {
m_minimum = minimum;
}
double Cylinder::maximum() const {
return m_maximum;
}
void Cylinder::setMaximum(double maximum) {
m_maximum = maximum;
}
|
a6c5e9f1a0918fe7a3b4f0a70e7d48e4c923b5f7
|
60a15a584b00895e47628c5a485bd1f14cfeebbe
|
/comps/docs/ImageDoc/color.cpp
|
64681cc44447335ac1f0e12c974792ec7bc07503
|
[] |
no_license
|
fcccode/vt5
|
ce4c1d8fe819715f2580586c8113cfedf2ab44ac
|
c88049949ebb999304f0fc7648f3d03f6501c65b
|
refs/heads/master
| 2020-09-27T22:56:55.348501
| 2019-06-17T20:39:46
| 2019-06-17T20:39:46
| null | 0
| 0
| null | null | null | null |
WINDOWS-1251
|
C++
| false
| false
| 60,074
|
cpp
|
color.cpp
|
#include "stdafx.h"
#include "color.h"
#include <math.h>
#include "resource.h"
#include "ccmacro.h"
int nInterpolationMethod=-1; //метод интерполяции при увеличении
// 0 - по ближайшим соседям, 1 - билинейная
// -1 - прочитать значение из shell.data
int nMaskInterpolationMethod=-1; //метод интерполяции масок при увеличении
// 0 - квадратами, 1 - под углами 90 и 45 градусов
#define NotUsed 0
/////
#define ScaleDoubleToColor(clr) ((color)max( 0, min( 65535,(((clr)+0.5)*65535) ) ))
#define ScaleDoubleToByte(clr) ((byte)max(0, min(255,(((clr)+0.5)*255))))
//#define ScaleDoubleToColor(clr) ((color) (((clr)+0.5)*65535))
//#define ScaleDoubleToByte(clr) ((byte)(((clr)+0.5)*255))
#define ScaleColorToDouble(clr) ((double)(((clr)/65535.0)-0.5))
#define ScaleByteToDouble(clr) ((double)(((clr)/255.0)-0.5))
inline double HueToRGB(double n1,double n2,double hue)
{
/* range check: note values passed add/subtract thirds of range */
if (hue < 0)
hue += 1.0;
if (hue > 1.0)
hue -= 1.0;
/* return r,g, or b value from this tridrant */
if (hue < (1.0/6))
return ( n1 + (((n2-n1)*hue)/(1.0/6)) );
if (hue < (1.0/2))
return ( n2 );
if (hue < (2.0/3))
return ( n1 + (((n2-n1)*((2.0/3)-hue))/(1.0/6)));
else
return ( n1 );
}
IMPLEMENT_DYNCREATE(CColorConvertorRGB, CCmdTargetEx);
IMPLEMENT_DYNCREATE(CColorConvertorYUV, CCmdTargetEx);
IMPLEMENT_DYNCREATE(CColorConvertorYIQ, CCmdTargetEx);
IMPLEMENT_DYNCREATE(CColorConvertorHSB, CCmdTargetEx);
IMPLEMENT_DYNCREATE(CColorConvertorGRAY, CCmdTargetEx);
// {19C18618-43F4-11d3-A611-0090275995FE}
GUARD_IMPLEMENT_OLECREATE(CColorConvertorRGB, "ImageDoc.ColorConvertorRGB",
0x19c18618, 0x43f4, 0x11d3, 0xa6, 0x11, 0x0, 0x90, 0x27, 0x59, 0x95, 0xfe);
// {7D146711-678B-11d3-A4EB-0000B493A187}
GUARD_IMPLEMENT_OLECREATE(CColorConvertorYUV, "ImageDoc.ColorConvertorYUV",
0x7d146711, 0x678b, 0x11d3, 0xa4, 0xeb, 0x0, 0x0, 0xb4, 0x93, 0xa1, 0x87);
// {444CB4F7-B48C-11d3-A558-0000B493A187}
GUARD_IMPLEMENT_OLECREATE(CColorConvertorYIQ, "ImageDoc.ColorConvertorYIQ",
0x444cb4f7, 0xb48c, 0x11d3, 0xa5, 0x58, 0x0, 0x0, 0xb4, 0x93, 0xa1, 0x87);
// {7FA4AA51-6ABB-11d3-A4ED-0000B493A187}
GUARD_IMPLEMENT_OLECREATE(CColorConvertorHSB, "ImageDoc.ColorConvertorHSB",
0x7fa4aa51, 0x6abb, 0x11d3, 0xa4, 0xed, 0x0, 0x0, 0xb4, 0x93, 0xa1, 0x87);
// {56350D42-F999-11d3-A0C1-0000B493A187}
GUARD_IMPLEMENT_OLECREATE(CColorConvertorGRAY, "ImageDoc.ColorConvertorGRAY",
0x56350d42, 0xf999, 0x11d3, 0xa0, 0xc1, 0x0, 0x0, 0xb4, 0x93, 0xa1, 0x87);
/////////////////////////////////////////////////////////////////
//color convertor RGB
/////////////////////////////////////////////////////////////////
BEGIN_INTERFACE_MAP(CColorConvertorRGB, CColorConvertorBase)
INTERFACE_PART(CColorConvertorRGB, IID_IColorConvertorEx, CnvEx)
INTERFACE_PART(CColorConvertorRGB, IID_IColorConvertorEx2, CnvEx)
INTERFACE_PART(CColorConvertorRGB, IID_IProvideHistColors, Hist)
END_INTERFACE_MAP()
IMPLEMENT_UNKNOWN(CColorConvertorRGB, CnvEx)
IMPLEMENT_UNKNOWN(CColorConvertorRGB, Hist)
HRESULT CColorConvertorRGB::XHist::GetHistColors( int nPaneNo, COLORREF *pcrArray, COLORREF *pcrCurve )
{
METHOD_PROLOGUE_EX(CColorConvertorRGB, Hist);
byte r = 0, g = 0, b = 0;
if( nPaneNo == 0 )
*pcrCurve = RGB( 255, 0, 0 );
else if( nPaneNo == 1 )
*pcrCurve = RGB( 0, 255, 0 );
else if( nPaneNo == 2 )
*pcrCurve = RGB( 0, 0, 255 );
for( int i = 0; i < 256; i++, pcrArray++ )
{
if( nPaneNo == 0 )r = i;
else if( nPaneNo == 1 )g= i;
else if( nPaneNo == 2 )b= i;
*pcrArray = RGB( r, g, b );
}
return S_OK;
}
HRESULT CColorConvertorRGB::XCnvEx::ConvertImageToDIBRect( BITMAPINFOHEADER *pbi, BYTE *pdibBits, POINT ptBmpOfs, IImage2 *pimage, RECT rectDest, POINT pointImageOffest, double fZoom, POINT ptScroll, DWORD dwFillColor, DWORD dwFlags, IUnknown *ppunkParams)
{
METHOD_PROLOGUE_EX(CColorConvertorRGB, CnvEx);
byte *pLookupTableR = pThis->m_pLookupTableR;
byte *pLookupTableG = pThis->m_pLookupTableG;
byte *pLookupTableB = pThis->m_pLookupTableB;
byte *ptemp = 0;
if( dwFlags & cidrHilight )
{
ptemp = new byte[65536];
memset( ptemp, 255, 65536 );
byte fillR = GetRValue(dwFillColor); \
byte fillG = GetGValue(dwFillColor); \
byte fillB = GetBValue(dwFillColor); \
if( fillR )pLookupTableR = ptemp;
if( fillG )pLookupTableG = ptemp;
if( fillB )pLookupTableB = ptemp;
}
if(nInterpolationMethod==-1 || nMaskInterpolationMethod==-1)
{
nInterpolationMethod = GetValueInt(GetAppUnknown(), "\\General", "ImageInterpolationMethod", 0);
nMaskInterpolationMethod = GetValueInt(GetAppUnknown(), "\\General", "ImageMaskInterpolationMethod", 0);
}
if(nInterpolationMethod==1 && fZoom>1.1)
{
CONVERTTODIB_PART1_BILINEAR
Rbyte = pLookupTableR?pLookupTableR[R]:(R>>8);
Gbyte = pLookupTableG?pLookupTableG[G]:(G>>8);
Bbyte = pLookupTableB?pLookupTableB[B]:(B>>8);
CONVERTTODIB_PART2_BILINEAR
}
else
{
CONVERTTODIB_PART1
Rbyte = pLookupTableR?pLookupTableR[R]:(R>>8);
Gbyte = pLookupTableG?pLookupTableG[G]:(G>>8);
Bbyte = pLookupTableB?pLookupTableB[B]:(B>>8);
CONVERTTODIB_PART2
}
if( ptemp )delete ptemp;
return S_OK;
}
HRESULT CColorConvertorRGB::XCnvEx::ConvertImageToDIBRect2( BITMAPINFOHEADER *pbi, BYTE *pdibBits, WORD *pDistBits, POINT ptBmpOfs, IImage2 *pimage, RECT rectDest, POINT pointImageOffest, double fZoom, POINT ptScroll, DWORD dwFillColor, DWORD dwFlags, IDistanceMap *pDistMap, IUnknown *ppunkParams)
{
METHOD_PROLOGUE_EX(CColorConvertorRGB, CnvEx);
byte *pLookupTableR = pThis->m_pLookupTableR;
byte *pLookupTableG = pThis->m_pLookupTableG;
byte *pLookupTableB = pThis->m_pLookupTableB;
byte *ptemp = 0;
if( dwFlags & cidrHilight )
{
ptemp = new byte[65536];
memset( ptemp, 255, 65536 );
byte fillR = GetRValue(dwFillColor); \
byte fillG = GetGValue(dwFillColor); \
byte fillB = GetBValue(dwFillColor); \
if( fillR )pLookupTableR = ptemp;
if( fillG )pLookupTableG = ptemp;
if( fillB )pLookupTableB = ptemp;
}
if(nInterpolationMethod==-1 || nMaskInterpolationMethod==-1)
{
nInterpolationMethod = GetValueInt(GetAppUnknown(), "\\General", "ImageInterpolationMethod", 0);
nMaskInterpolationMethod = GetValueInt(GetAppUnknown(), "\\General", "ImageMaskInterpolationMethod", 0);
}
if(nInterpolationMethod==1 && fZoom>1.1)
{
CONVERTTODIB_PART1_BILINEAR
Rbyte = pLookupTableR?pLookupTableR[R]:(R>>8);
Gbyte = pLookupTableG?pLookupTableG[G]:(G>>8);
Bbyte = pLookupTableB?pLookupTableB[B]:(B>>8);
CONVERTTODIB_PART2_BILINEAR
}
else
{
CONVERTTODIB_PART1_TRANSP
Rbyte = pLookupTableR?pLookupTableR[R]:(R>>8);
Gbyte = pLookupTableG?pLookupTableG[G]:(G>>8);
Bbyte = pLookupTableB?pLookupTableB[B]:(B>>8);
CONVERTTODIB_PART2_TRANSP
}
if( ptemp )delete ptemp;
return S_OK;
}
CColorConvertorRGB::CColorConvertorRGB()
{
_OleLockApp( this );
}
CColorConvertorRGB::~CColorConvertorRGB()
{
_OleUnlockApp( this );
}
const char *CColorConvertorRGB::GetCnvName()
{
return _T("RGB");
}
int CColorConvertorRGB::GetColorPanesCount()
{
return 3;
}
const char *CColorConvertorRGB::GetPaneName(int numPane)
{
if (numPane == 0)
return _T("Red");
else if (numPane == 1)
return _T("Green");
else if (numPane == 2)
return _T("Blue");
return _T("");
}
const char *CColorConvertorRGB::GetPaneShortName( int numPane )
{
if (numPane == 0)
return _T("R");
else if (numPane == 1)
return _T("G");
else if (numPane == 2)
return _T("B");
return _T("");
}
color CColorConvertorRGB::ConvertToHumanValue( color colorInternal, int numPane )
{
return color( double(colorInternal) * 256.0 / double(colorMax) );
}
DWORD CColorConvertorRGB::GetPaneFlags(int numPane)
{
return pfOrdinary|pfGray;
}
void CColorConvertorRGB::ConvertRGBToImage( byte *_pRGB, color **_ppColor, int _cx )
{
color *p0, *p1, *p2;
p0 = _ppColor[0];
p1 = _ppColor[1];
p2 = _ppColor[2];
byte *pRGB = _pRGB;
for( long n = 0, c = 0; n < _cx; n++ )
{
p2[n] = ByteAsColor( _pRGB[c++] );
p1[n] = ByteAsColor( _pRGB[c++] );
p0[n] = ByteAsColor( _pRGB[c++] );
}
// __asm
// {
// mov ebx, _pRGB
// mov eax, _ppColor
// mov ecx, _cx
//
//
// push ebp
// push esi
// push edi
//
// mov ebp, DWORD PTR [eax+0] //_ppColor[0]
// mov esi, DWORD PTR [eax+4] //_ppColor[0]
// mov edi, DWORD PTR [eax+8] //_ppColor[0]
// xor eax, eax
//$loop:
// mov ah, BYTE PTR [ebx]
// mov WORD PTR [edi], ax
// inc ebx
// mov ah, BYTE PTR [ebx]
// mov WORD PTR [esi], ax
// inc ebx
// mov ah, BYTE PTR [ebx]
// mov WORD PTR [ebp], ax
// inc ebx
//
// add ebp, 2
// add esi, 2
// add edi, 2
//
// dec ecx
// jne $loop
//
// pop edi
// pop esi
// pop ebp
//
// }
}
void CColorConvertorRGB::ConvertImageToRGB( color **_ppColor, byte *_pRGB, int _cx )
{
color *p0, *p1, *p2;
p0 = _ppColor[0];
p1 = _ppColor[1];
p2 = _ppColor[2];
for( long n = 0, c = 0; n < _cx; n++ )
{
_pRGB[c++] = ColorAsByte( p2[n] );
_pRGB[c++] = ColorAsByte( p1[n] );
_pRGB[c++] = ColorAsByte( p0[n] );
}
// __asm
// {
// mov ebx, _pRGB
// mov eax, _ppColor
// mov ecx, _cx
//
//
// push ebp
// push esi
// push edi
//
// mov ebp, DWORD PTR [eax+0] //_ppColor[0]
// mov esi, DWORD PTR [eax+4] //_ppColor[1]
// mov edi, DWORD PTR [eax+8] //_ppColor[2]
// xor eax, eax
// xor edx, edx
//$loop:
// mov ax, WORD PTR [edi]
// mov BYTE PTR [ebx], ah
// inc ebx
// mov ax, WORD PTR [esi]
// mov BYTE PTR [ebx], ah
// inc ebx
// mov ax, WORD PTR [ebp]
// mov BYTE PTR [ebx], ah
// inc ebx
//
// inc ebp
// inc ebp
// inc esi
// inc esi
// inc edi
// inc edi
//
// dec ecx
// jne $loop
//
// pop edi
// pop esi
// pop ebp
//
// }
}
void CColorConvertorRGB::ConvertGrayToImage( byte *pGray, color **ppColor, int cx )
{
color *p0, *p1, *p2;
p0 = ppColor[0];
p1 = ppColor[1];
p2 = ppColor[2];
for( long n = 0; n < cx; n++ )
{
p2[n] = ByteAsColor( pGray[n] );
p1[n] = ByteAsColor( pGray[n] );
p0[n] = ByteAsColor( pGray[n] );
}
}
void CColorConvertorRGB::ConvertImageToGray( color **ppColor, byte *pGray, int cx )
{
color *p0, *p1, *p2;
p0 = ppColor[0];
p1 = ppColor[1];
p2 = ppColor[2];
for( long n = 0; n < cx; n++ )
{
// [vanek] : порядок пан : r, g, b - 05.11.2004
pGray[n] = Bright( ColorAsByte( p2[n] ),
ColorAsByte( p1[n] ),
ColorAsByte( p0[n] ) );
}
}
void CColorConvertorRGB::GetConvertorIcon( HICON *phIcon )
{
if(phIcon)
*phIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_ICON_RGB));
}
void CColorConvertorRGB::ConvertLABToImage( double *pLab, color **ppColor, int cx )
{
color *p0, *p1, *p2;
p0 = ppColor[0];
p1 = ppColor[1];
p2 = ppColor[2];
double X, Y, Z, fX, fY, fZ;
double RR, GG, BB;
double L, a, b;
for( long n = 0, c = 0; n < cx; n++ )
{
L = pLab[c++];
a = pLab[c++];
b = pLab[c++];
fY = pow((L + 16.0) / 116.0, 3.0);
if (fY < 0.008856)
fY = L / 903.3;
Y = fY;
if (fY > 0.008856)
fY = pow(fY, 1.0/3.0);
else
fY = 7.787 * fY + 16.0/116.0;
fX = a / 500.0 + fY;
if (fX > 0.206893)
X = pow(fX, 3.0);
else
X = (fX - 16.0/116.0) / 7.787;
fZ = fY - b /200.0;
if (fZ > 0.206893)
Z = pow(fZ, 3.0);
else
Z = (fZ - 16.0/116.0) / 7.787;
X *= 0.950456;
Y *= 1;
Z *= 1.088754;
RR = (3.240479*X - 1.537150*Y - 0.498535*Z);
GG = (-0.969256*X + 1.875992*Y + 0.041556*Z);
BB = (0.055648*X - 0.204043*Y + 1.057311*Z);
p0[n] = ScaleDoubleToColor(RR);
p1[n] = ScaleDoubleToColor(GG);
p2[n] = ScaleDoubleToColor(BB);
}
}
void CColorConvertorRGB::ConvertImageToLAB( color **ppColor, double *pLab, int cx )
{
color *p0, *p1, *p2;
p0 = ppColor[0];
p1 = ppColor[1];
p2 = ppColor[2];
double X, Y, Z, fX, fY, fZ;
double R, G, B;
double L, a, b;
for( long n = 0, c = 0; n < cx; n++ )
{
R = ScaleColorToDouble(p0[n]);
G = ScaleColorToDouble(p1[n]);
B = ScaleColorToDouble(p2[n]);
X = (0.412453*R + 0.357580*G + 0.180423*B)/0.950456;
Y = (0.212671*R + 0.715160*G + 0.072169*B);
Z = (0.019334*R + 0.119193*G + 0.950227*B)/1.088754;
if (Y > 0.008856)
{
fY = pow(Y, 1.0/3.0);
L = 116.0*fY - 16.0;
}
else
{
fY = 7.787*Y + 16.0/116.0;
L = 903.3*Y;
}
if (X > 0.008856)
fX = pow(X, 1.0/3.0);
else
fX = 7.787*X + 16.0/116.0;
if (Z > 0.008856)
fZ = pow(Z, 1.0/3.0);
else
fZ = 7.787*Z + 16.0/116.0;
a = 500.0*(fX - fY);
b = 200.0*(fY - fZ);
pLab[c++] = L;
pLab[c++] = a;
pLab[c++] = b;
}
}
void CColorConvertorRGB::GetPaneColor(int numPane, DWORD* pdwColor)
{
if(pdwColor == 0) return;
switch(numPane)
{
case 0:
*pdwColor = RGB(255, 0, 0);
break;
case 1:
*pdwColor = RGB(0, 255, 0);
break;
case 2:
*pdwColor = RGB(0, 0, 255);
break;
default:
*pdwColor = 0;
}
}
void CColorConvertorRGB::GetCorrespondPanesColorValues(int numPane, DWORD* pdwColorValues)
{
if(pdwColorValues == 0) return;
switch(numPane)
{
case 0:
*pdwColorValues = RGB(NotUsed, 0, 0);
break;
case 1:
*pdwColorValues = RGB(0, NotUsed, 0);
break;
case 2:
*pdwColorValues = RGB(0, 0, NotUsed);
break;
default:
*pdwColorValues = 0;
}
}
/////////////////////////////////////////////////////////////////
//color convertor YUV
/////////////////////////////////////////////////////////////////
BEGIN_INTERFACE_MAP(CColorConvertorYUV, CColorConvertorBase)
INTERFACE_PART(CColorConvertorYUV, IID_IColorConvertorEx, CnvEx)
INTERFACE_PART(CColorConvertorYUV, IID_IProvideHistColors, Hist)
END_INTERFACE_MAP()
IMPLEMENT_UNKNOWN(CColorConvertorYUV, CnvEx)
IMPLEMENT_UNKNOWN(CColorConvertorYUV, Hist)
HRESULT CColorConvertorYUV::XHist::GetHistColors( int nPaneNo, COLORREF *pcrArray, COLORREF *pcrCurve )
{
double Y, U, V, R, G, B;
byte Rbyte, Gbyte, Bbyte;
if( nPaneNo == 0 )
{
V = ScaleColorToDouble(ByteAsColor(128))*2;
U = ScaleColorToDouble(ByteAsColor(128))*2;
Y = ScaleColorToDouble(ByteAsColor(128))*2;
*pcrCurve = RGB( 0, 0, 0 );
}
else if( nPaneNo == 1 )
{
V = ScaleColorToDouble(ByteAsColor(128))*2;
U = ScaleColorToDouble(ByteAsColor(128))*2;
Y = ScaleColorToDouble(ByteAsColor(128))*2;
*pcrCurve = RGB( 255, 255, 0 );
}
else if( nPaneNo == 2 )
{
V = ScaleColorToDouble(ByteAsColor(128))*2;
U = ScaleColorToDouble(ByteAsColor(128))*2;
Y = ScaleColorToDouble(ByteAsColor(128))*2;
*pcrCurve = RGB( 0, 0, 255 );
}
for( int i = 0; i < 256; i++, pcrArray++ )
{
if( nPaneNo == 0 )Y = ScaleColorToDouble(ByteAsColor(i))*2;
else if( nPaneNo == 1 )U = ScaleColorToDouble(ByteAsColor(i))*2;
else if( nPaneNo == 2 )V = ScaleColorToDouble(ByteAsColor(i))*2;
B = Y + 2.0279*U;
G = Y - 0.3938*U - 0.5805*V;
R = Y + 1.1398*V;
Rbyte = ScaleDoubleToByte(R);
Gbyte = ScaleDoubleToByte(G);
Bbyte = ScaleDoubleToByte(B);
*pcrArray = RGB( Rbyte, Gbyte, Bbyte );
}
return S_OK;
}
HRESULT CColorConvertorYUV::XCnvEx::ConvertImageToDIBRect( BITMAPINFOHEADER *pbi, BYTE *pdibBits, POINT ptBmpOfs, IImage2 *pimage, RECT rectDest, POINT pointImageOffest, double fZoom, POINT ptScroll, DWORD dwFillColor, DWORD dwFlags, IUnknown *ppunkParams)
{
METHOD_PROLOGUE_EX(CColorConvertorYUV, CnvEx);
if(nInterpolationMethod==-1 || nMaskInterpolationMethod==-1)
{
nInterpolationMethod = GetValueInt(GetAppUnknown(), "\\General", "ImageInterpolationMethod", 0);
nMaskInterpolationMethod = GetValueInt(GetAppUnknown(), "\\General", "ImageMaskInterpolationMethod", 0);
}
if(nInterpolationMethod==1 && fZoom>1.1)
{
CONVERTTODIB_PART1_BILINEAR
double Y, U, V, dR, dG, dB;
V = ScaleColorToDouble(B)*2;
U = ScaleColorToDouble(G)*2;
Y = ScaleColorToDouble(R)*2;
dB = Y + 2.0279*U;
dG = Y - 0.3938*U - 0.5805*V;
dR = Y + 1.1398*V;
byte *pLookupTableR = pThis->m_pLookupTableR;
byte *pLookupTableG = pThis->m_pLookupTableG;
byte *pLookupTableB = pThis->m_pLookupTableB;
if( pLookupTableR && pLookupTableG && pLookupTableB )
{
Rbyte = ScaleDoubleToByte(dR);
Gbyte = ScaleDoubleToByte(dG);
Bbyte = ScaleDoubleToByte(dB);
Rbyte = pLookupTableR[Rbyte*255];
Gbyte = pLookupTableG[Gbyte*255];
Bbyte = pLookupTableB[Bbyte*255];
}
else
{
Rbyte = ScaleDoubleToByte(dR);
Gbyte = ScaleDoubleToByte(dG);
Bbyte = ScaleDoubleToByte(dB);
}
CONVERTTODIB_PART2_BILINEAR
}
else
{
CONVERTTODIB_PART1
double Y, U, V, dR, dG, dB;
V = ScaleColorToDouble(B)*2;
U = ScaleColorToDouble(G)*2;
Y = ScaleColorToDouble(R)*2;
dB = Y + 2.0279*U;
dG = Y - 0.3938*U - 0.5805*V;
dR = Y + 1.1398*V;
byte *pLookupTableR = pThis->m_pLookupTableR;
byte *pLookupTableG = pThis->m_pLookupTableG;
byte *pLookupTableB = pThis->m_pLookupTableB;
if( pLookupTableR && pLookupTableG && pLookupTableB )
{
Rbyte = ScaleDoubleToByte(dR);
Gbyte = ScaleDoubleToByte(dG);
Bbyte = ScaleDoubleToByte(dB);
Rbyte = pLookupTableR[Rbyte*255];
Gbyte = pLookupTableG[Gbyte*255];
Bbyte = pLookupTableB[Bbyte*255];
}
else
{
Rbyte = ScaleDoubleToByte(dR);
Gbyte = ScaleDoubleToByte(dG);
Bbyte = ScaleDoubleToByte(dB);
}
CONVERTTODIB_PART2
}
//_catch_nested
return S_OK;
}
CColorConvertorYUV::CColorConvertorYUV()
{
_OleLockApp( this );
}
CColorConvertorYUV::~CColorConvertorYUV()
{
_OleUnlockApp( this );
}
const char *CColorConvertorYUV::GetCnvName()
{
return _T("YUV");
}
int CColorConvertorYUV::GetColorPanesCount()
{
return 3;
}
const char *CColorConvertorYUV::GetPaneName(int numPane)
{
if (numPane == 0)
return _T("Y");
else if (numPane == 1)
return _T("U");
else if (numPane == 2)
return _T("V");
return _T("");
}
const char *CColorConvertorYUV::GetPaneShortName( int numPane )
{
return GetPaneName( numPane );
}
color CColorConvertorYUV::ConvertToHumanValue( color colorInternal, int numPane )
{
return colorInternal * 255 / colorMax;
}
DWORD CColorConvertorYUV::GetPaneFlags(int numPane)
{
if( numPane == 0 )return pfOrdinary|pfGray;
return pfOrdinary;
}
void CColorConvertorYUV::ConvertRGBToImage( byte *pRGB, color **ppColor, int cx )
{
if (ppColor==NULL || pRGB==NULL)
return;
// Y = 0.29900*R+0.58700*G+0.11400*B
// U = -0.14740*R-0.28950*G+0.43690*B
// V = 0.61500*R-0.51500*G-0.10000*B
double r, g, b, Y, U, V;
for( long n = 0, c = 0; n < cx; n++ )
{
b = ScaleByteToDouble(pRGB[c++]);
g = ScaleByteToDouble(pRGB[c++]);
r = ScaleByteToDouble(pRGB[c++]);
Y = 0.2990*r + 0.5870*g + 0.1140*b;
U = -0.1474*r - 0.2895*g + 0.4369*b;
V = 0.6150*r - 0.5150*g - 0.1000*b;
ppColor[0][n] = ScaleDoubleToColor(Y/2); // Y
ppColor[1][n] = ScaleDoubleToColor(U/2); // U
ppColor[2][n] = ScaleDoubleToColor(V/2); // V
}
}
void CColorConvertorYUV::ConvertImageToRGB( color **ppColor, byte *pRGB, int cx )
{
if (ppColor==NULL || pRGB==NULL)
return;
// R = Y +1.13980*V
// G = Y-0.39380*U-0.58050*V
// B = Y+2.02790*U
double y, u, v, R, G, B;
for( long n = 0, c = 0; n < cx; n++ )
{
y = ScaleColorToDouble(ppColor[0][n])*2;
u = ScaleColorToDouble(ppColor[1][n])*2;
v = ScaleColorToDouble(ppColor[2][n])*2;
B = y + 2.0279*u;
G = y - 0.3938*u - 0.5805*v;
R = y + 1.1398*v;
pRGB[c++] = ScaleDoubleToByte(B); // B
pRGB[c++] = ScaleDoubleToByte(G); // G
pRGB[c++] = ScaleDoubleToByte(R); // R
}
}
void CColorConvertorYUV::ConvertGrayToImage( byte *pGray, color **ppColor, int cx )
{
if (ppColor==NULL || pGray==NULL)
return;
for( long n = 0; n < cx; n++ )
{
ppColor[2][n] = ByteAsColor( pGray[n] );
ppColor[1][n] = ByteAsColor( pGray[n] );
ppColor[0][n] = ByteAsColor( pGray[n] );
}
}
void CColorConvertorYUV::ConvertImageToGray( color **ppColor, byte *pGray, int cx )
{
if (ppColor==NULL || pGray==NULL)
return;
double y, u, v;
for( long n = 0; n < cx; n++ )
{
y = ScaleColorToDouble(ppColor[0][n])*2;
u = ScaleColorToDouble(ppColor[1][n])*2;
v = ScaleColorToDouble(ppColor[2][n])*2;
pGray[n] = Bright( ScaleDoubleToByte(y + 2.0279*u),
ScaleDoubleToByte(y - 0.3938*u - 0.5805*v),
ScaleDoubleToByte(y + 1.1398*v));
}
}
void CColorConvertorYUV::GetConvertorIcon( HICON *phIcon )
{
if(phIcon)
*phIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_ICON_YUV));
}
void CColorConvertorYUV::ConvertLABToImage( double *pLab, color **ppColor, int cx )
{
color *p0, *p1, *p2;
p0 = ppColor[0];
p1 = ppColor[1];
p2 = ppColor[2];
double X, Y, Z, fX, fY, fZ, U, V;
double RR, GG, BB;
double L, a, b;
for( long n = 0, c = 0; n < cx; n++ )
{
L = pLab[c++];
a = pLab[c++];
b = pLab[c++];
fY = pow((L + 16.0) / 116.0, 3.0);
if (fY < 0.008856)
fY = L / 903.3;
Y = fY;
if (fY > 0.008856)
fY = pow(fY, 1.0/3.0);
else
fY = 7.787 * fY + 16.0/116.0;
fX = a / 500.0 + fY;
if (fX > 0.206893)
X = pow(fX, 3.0);
else
X = (fX - 16.0/116.0) / 7.787;
fZ = fY - b /200.0;
if (fZ > 0.206893)
Z = pow(fZ, 3.0);
else
Z = (fZ - 16.0/116.0) / 7.787;
X *= 0.950456;
Y *= 1;
Z *= 1.088754;
RR = ( 3.240479*X - 1.537150*Y - 0.498535*Z);
GG = (-0.969256*X + 1.875992*Y + 0.041556*Z);
BB = ( 0.055648*X - 0.204043*Y + 1.057311*Z);
Y = 0.2990*RR + 0.5870*GG + 0.1140*BB;
U = -0.1474*RR - 0.2895*GG + 0.4369*BB;
V = 0.6150*RR - 0.5150*GG - 0.1000*BB;
p0[n] = ScaleDoubleToColor( Y/2 ); // Y
p1[n] = ScaleDoubleToColor( U/2 ); // U
p2[n] = ScaleDoubleToColor( V/2 ); // V
}
}
void CColorConvertorYUV::ConvertImageToLAB( color **ppColor, double *pLab, int cx )
{
color *p0, *p1, *p2;
p0 = ppColor[0];
p1 = ppColor[1];
p2 = ppColor[2];
double X, Y, Z, fX, fY, fZ;
double R, G, B, y, u, v;
double L, a, b;
for( long n = 0, c = 0; n < cx; n++ )
{
y = ScaleColorToDouble(p0[n])*2;
u = ScaleColorToDouble(p1[n])*2;
v = ScaleColorToDouble(p2[n])*2;
B = y + 2.0279*u;
G = y - 0.3938*u - 0.5805*v;
R = y + 1.1398*v;
X = (0.412453*R + 0.357580*G + 0.180423*B)/0.950456;
Y = (0.212671*R + 0.715160*G + 0.072169*B);
Z = (0.019334*R + 0.119193*G + 0.950227*B)/1.088754;
if (Y > 0.008856)
{
fY = pow(Y, 1.0/3.0);
L = 116.0*fY - 16.0;
}
else
{
fY = 7.787*Y + 16.0/116.0;
L = 903.3*Y;
}
if (X > 0.008856)
fX = pow(X, 1.0/3.0);
else
fX = 7.787*X + 16.0/116.0;
if (Z > 0.008856)
fZ = pow(Z, 1.0/3.0);
else
fZ = 7.787*Z + 16.0/116.0;
a = 500.0*(fX - fY);
b = 200.0*(fY - fZ);
pLab[c++] = L;
pLab[c++] = a;
pLab[c++] = b;
}
}
void CColorConvertorYUV::GetPaneColor(int numPane, DWORD* pdwColor)
{
if(pdwColor == 0) return;
switch(numPane)
{
case 0:
*pdwColor = RGB(0, 0, 0); //need to correct!!!
break;
case 1:
*pdwColor = RGB(0, 0, 0); //need to correct!!!
break;
case 2:
*pdwColor = RGB(0, 0, 0); //need to correct!!!
break;
default:
*pdwColor = 0;
}
}
void CColorConvertorYUV::GetCorrespondPanesColorValues(int numPane, DWORD* pdwColorValues)
{
if(pdwColorValues == 0) return;
switch(numPane)
{
case 0:
*pdwColorValues = RGB(NotUsed, 0, 0);
break;
case 1:
*pdwColorValues = RGB(0, NotUsed, 0);
break;
case 2:
*pdwColorValues = RGB(0, 0, NotUsed);
break;
default:
*pdwColorValues = 0;
}
}
/////////////////////////////////////////////////////////////////
//color convertor YIQ
/////////////////////////////////////////////////////////////////
BEGIN_INTERFACE_MAP(CColorConvertorYIQ, CColorConvertorBase)
INTERFACE_PART(CColorConvertorYIQ, IID_IColorConvertorEx, CnvEx)
INTERFACE_PART(CColorConvertorYIQ, IID_IProvideHistColors, Hist)
END_INTERFACE_MAP()
IMPLEMENT_UNKNOWN(CColorConvertorYIQ, CnvEx)
IMPLEMENT_UNKNOWN(CColorConvertorYIQ, Hist)
HRESULT CColorConvertorYIQ::XHist::GetHistColors( int nPaneNo, COLORREF *pcrArray, COLORREF *pcrCurve )
{
METHOD_PROLOGUE_EX(CColorConvertorYIQ, Hist);
byte r = 0, g = 0, b = 0;
if( nPaneNo == 0 )
*pcrCurve = RGB( 255, 0, 0 );
else if( nPaneNo == 1 )
*pcrCurve = RGB( 0, 255, 0 );
else if( nPaneNo == 2 )
*pcrCurve = RGB( 0, 0, 255 );
for( int i = 0; i < 256; i++, pcrArray++ )
{
if( nPaneNo == 0 )r = i;
else if( nPaneNo == 1 )g= i;
else if( nPaneNo == 2 )b= i;
*pcrArray = RGB( r, g, b );
}
return S_OK;
}
HRESULT CColorConvertorYIQ::XCnvEx::ConvertImageToDIBRect( BITMAPINFOHEADER *pbi, BYTE *pdibBits, POINT ptBmpOfs, IImage2 *pimage, RECT rectDest, POINT pointImageOffest, double fZoom, POINT ptScroll, DWORD dwFillColor, DWORD dwFlags, IUnknown *ppunkParams)
{
METHOD_PROLOGUE_EX(CColorConvertorYIQ, CnvEx)
if(nInterpolationMethod==-1 || nMaskInterpolationMethod==-1)
{
nInterpolationMethod = GetValueInt(GetAppUnknown(), "\\General", "ImageInterpolationMethod", 0);
nMaskInterpolationMethod = GetValueInt(GetAppUnknown(), "\\General", "ImageMaskInterpolationMethod", 0);
}
if(nInterpolationMethod==1 && fZoom>1.1)
{
CONVERTTODIB_PART1_BILINEAR
double Y, I, Q, dR, dG, dB;
Y = ScaleColorToDouble(R)*2;
I = ScaleColorToDouble(G)*2;
Q = ScaleColorToDouble(B)*2;
dB = Y-1.10370*I+1.70060*Q;
dG = Y-0.27270*I-0.64680*Q;
dR = Y+0.95620*I+0.62140*Q;
byte *pLookupTableR = pThis->m_pLookupTableR;
byte *pLookupTableG = pThis->m_pLookupTableG;
byte *pLookupTableB = pThis->m_pLookupTableB;
if( pLookupTableR && pLookupTableG && pLookupTableB )
{
Rbyte = ScaleDoubleToByte(dR);
Gbyte = ScaleDoubleToByte(dG);
Bbyte = ScaleDoubleToByte(dB);
Rbyte = pLookupTableR[Rbyte*255];
Gbyte = pLookupTableG[Gbyte*255];
Bbyte = pLookupTableB[Bbyte*255];
}
else
{
Rbyte = ScaleDoubleToByte(dR);
Gbyte = ScaleDoubleToByte(dG);
Bbyte = ScaleDoubleToByte(dB);
}
CONVERTTODIB_PART2_BILINEAR
}
else
{
CONVERTTODIB_PART1
double Y, I, Q, dR, dG, dB;
Y = ScaleColorToDouble(R)*2;
I = ScaleColorToDouble(G)*2;
Q = ScaleColorToDouble(B)*2;
dB = Y-1.10370*I+1.70060*Q;
dG = Y-0.27270*I-0.64680*Q;
dR = Y+0.95620*I+0.62140*Q;
byte *pLookupTableR = pThis->m_pLookupTableR;
byte *pLookupTableG = pThis->m_pLookupTableG;
byte *pLookupTableB = pThis->m_pLookupTableB;
if( pLookupTableR && pLookupTableG && pLookupTableB )
{
Rbyte = ScaleDoubleToByte(dR);
Gbyte = ScaleDoubleToByte(dG);
Bbyte = ScaleDoubleToByte(dB);
Rbyte = pLookupTableR[Rbyte*255];
Gbyte = pLookupTableG[Gbyte*255];
Bbyte = pLookupTableB[Bbyte*255];
}
else
{
Rbyte = ScaleDoubleToByte(dR);
Gbyte = ScaleDoubleToByte(dG);
Bbyte = ScaleDoubleToByte(dB);
}
CONVERTTODIB_PART2
}
//_catch_nested
return S_OK;
}
CColorConvertorYIQ::CColorConvertorYIQ()
{
_OleLockApp( this );
}
CColorConvertorYIQ::~CColorConvertorYIQ()
{
_OleUnlockApp( this );
}
const char *CColorConvertorYIQ::GetCnvName()
{
return _T("YIQ");
}
int CColorConvertorYIQ::GetColorPanesCount()
{
return 3;
}
const char *CColorConvertorYIQ::GetPaneName(int numPane)
{
if (numPane == 0)
return _T("Y");
else if (numPane == 1)
return _T("I");
else if (numPane == 2)
return _T("Q");
return _T("");
}
const char *CColorConvertorYIQ::GetPaneShortName( int numPane )
{
return GetPaneName( numPane );
}
color CColorConvertorYIQ::ConvertToHumanValue( color colorInternal, int numPane )
{
return colorInternal * 255 / colorMax;
}
DWORD CColorConvertorYIQ::GetPaneFlags(int numPane)
{
if( numPane == 0 )return pfOrdinary|pfGray;
return pfOrdinary;
}
void CColorConvertorYIQ::ConvertRGBToImage( byte *pRGB, color **ppColor, int cx )
{
if (ppColor==NULL || pRGB==NULL)
return;
// Y = 0.299*R+0.587*G+0.114*B
// I = 0.596*R-0.274*G-0.322*B
// Q = 0.211*R-0.523*G+0.312*B
double R, G, B, Y, I, Q;
for( long n = 0, c = 0; n < cx; n++ )
{
B = ScaleByteToDouble(pRGB[c++]);
G = ScaleByteToDouble(pRGB[c++]);
R = ScaleByteToDouble(pRGB[c++]);
Y = 0.299*R+0.587*G+0.114*B;
I = 0.596*R-0.274*G-0.322*B;
Q = 0.211*R-0.523*G+0.312*B;
ppColor[0][n] = ScaleDoubleToColor( Y/2 ); // Y
ppColor[1][n] = ScaleDoubleToColor( I/2 ); // I
ppColor[2][n] = ScaleDoubleToColor( Q/2 ); // Q
}
}
void CColorConvertorYIQ::ConvertImageToRGB( color **ppColor, byte *pRGB, int cx )
{
if (ppColor==NULL || pRGB==NULL)
return;
// R = Y+0.95620*I+0.62140*Q
// G = Y-0.27270*I-0.64680*Q
// B = Y-1.10370*I+1.70060*Q
double Y, I, Q;
for( long n = 0, c = 0; n < cx; n++ )
{
Y = ScaleColorToDouble(ppColor[0][n])*2;
I = ScaleColorToDouble(ppColor[1][n])*2;
Q = ScaleColorToDouble(ppColor[2][n])*2;
pRGB[c++] = ScaleDoubleToByte(Y-1.10370*I+1.70060*Q); // B
pRGB[c++] = ScaleDoubleToByte(Y-0.27270*I-0.64680*Q); // G
pRGB[c++] = ScaleDoubleToByte(Y+0.95620*I+0.62140*Q); // R
}
}
void CColorConvertorYIQ::ConvertGrayToImage( byte *pGray, color **ppColor, int cx )
{
if (ppColor==NULL || pGray==NULL)
return;
for( long n = 0; n < cx; n++ )
{
ppColor[2][n] = ByteAsColor( pGray[n] );
ppColor[1][n] = ByteAsColor( pGray[n] );
ppColor[0][n] = ByteAsColor( pGray[n] );
}
}
void CColorConvertorYIQ::ConvertImageToGray( color **ppColor, byte *pGray, int cx )
{
if (ppColor==NULL || pGray==NULL)
return;
double Y, I, Q;
for( long n = 0; n < cx; n++ )
{
Y = ScaleColorToDouble(ppColor[0][n])*2;
I = ScaleColorToDouble(ppColor[1][n])*2;
Q = ScaleColorToDouble(ppColor[2][n])*2;
pGray[n] = Bright( ScaleDoubleToByte(Y-1.10370*I+1.70060*Q),
ScaleDoubleToByte(Y-0.27270*I-0.64680*Q),
ScaleDoubleToByte(Y+0.95620*I+0.62140*Q));
}
}
void CColorConvertorYIQ::GetConvertorIcon( HICON *phIcon )
{
if(phIcon)
*phIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_ICON_YIQ));
}
void CColorConvertorYIQ::ConvertLABToImage( double *pLab, color **ppColor, int cx )
{
color *p0, *p1, *p2;
p0 = ppColor[0];
p1 = ppColor[1];
p2 = ppColor[2];
double X, Y, Z, fX, fY, fZ, I, Q;
double RR, GG, BB;
double L, a, b;
for( long n = 0, c = 0; n < cx; n++ )
{
L = pLab[c++];
a = pLab[c++];
b = pLab[c++];
fY = pow((L + 16.0) / 116.0, 3.0);
if (fY < 0.008856)
fY = L / 903.3;
Y = fY;
if (fY > 0.008856)
fY = pow(fY, 1.0/3.0);
else
fY = 7.787 * fY + 16.0/116.0;
fX = a / 500.0 + fY;
if (fX > 0.206893)
X = pow(fX, 3.0);
else
X = (fX - 16.0/116.0) / 7.787;
fZ = fY - b /200.0;
if (fZ > 0.206893)
Z = pow(fZ, 3.0);
else
Z = (fZ - 16.0/116.0) / 7.787;
X *= 0.950456;
Y *= 1;
Z *= 1.088754;
RR = (3.240479*X - 1.537150*Y - 0.498535*Z);
GG = (-0.969256*X + 1.875992*Y + 0.041556*Z);
BB = (0.055648*X - 0.204043*Y + 1.057311*Z);
Y = 0.299*RR+0.587*GG+0.114*BB;
I = 0.596*RR-0.274*GG-0.322*BB;
Q = 0.211*RR-0.523*GG+0.312*BB;
p0[n] = ScaleDoubleToColor( Y/2 ); // Y
p1[n] = ScaleDoubleToColor( I/2 ); // I
p2[n] = ScaleDoubleToColor( Q/2 ); // Q
}
}
void CColorConvertorYIQ::ConvertImageToLAB( color **ppColor, double *pLab, int cx )
{
color *p0, *p1, *p2;
p0 = ppColor[0];
p1 = ppColor[1];
p2 = ppColor[2];
double X, Y, Z, fX, fY, fZ;
double R, G, B, y, i, q;
double L, a, b;
for( long n = 0, c = 0; n < cx; n++ )
{
y = ScaleColorToDouble(p0[n])*2;
i = ScaleColorToDouble(p1[n])*2;
q = ScaleColorToDouble(p2[n])*2;
R = y+0.95620*i+0.62140*q;
G = y-0.27270*i-0.64680*q;
B = y-1.10370*i+1.70060*q;
X = (0.412453*R + 0.357580*G + 0.180423*B)/0.950456;
Y = (0.212671*R + 0.715160*G + 0.072169*B);
Z = (0.019334*R + 0.119193*G + 0.950227*B)/1.088754;
if (Y > 0.008856)
{
fY = pow(Y, 1.0/3.0);
L = 116.0*fY - 16.0;
}
else
{
fY = 7.787*Y + 16.0/116.0;
L = 903.3*Y;
}
if (X > 0.008856)
fX = pow(X, 1.0/3.0);
else
fX = 7.787*X + 16.0/116.0;
if (Z > 0.008856)
fZ = pow(Z, 1.0/3.0);
else
fZ = 7.787*Z + 16.0/116.0;
a = 500.0*(fX - fY);
b = 200.0*(fY - fZ);
pLab[c++] = L;
pLab[c++] = a;
pLab[c++] = b;
}
}
void CColorConvertorYIQ::GetPaneColor(int numPane, DWORD* pdwColor)
{
if(pdwColor == 0) return;
switch(numPane)
{
case 0:
*pdwColor = RGB(0, 0, 0); //need to correct!!!
break;
case 1:
*pdwColor = RGB(0, 0, 0); //need to correct!!!
break;
case 2:
*pdwColor = RGB(0, 0, 0); //need to correct!!!
break;
default:
*pdwColor = 0;
}
}
void CColorConvertorYIQ::GetCorrespondPanesColorValues(int numPane, DWORD* pdwColorValues)
{
if(pdwColorValues == 0) return;
switch(numPane)
{
case 0:
*pdwColorValues = RGB(NotUsed, 0, 0);
break;
case 1:
*pdwColorValues = RGB(0, NotUsed, 0);
break;
case 2:
*pdwColorValues = RGB(0, 0, NotUsed);
break;
default:
*pdwColorValues = 0;
}
}
/////////////////////////////////////////////////////////////////
//color convertor HSB
/////////////////////////////////////////////////////////////////
BEGIN_INTERFACE_MAP(CColorConvertorHSB, CColorConvertorBase)
INTERFACE_PART(CColorConvertorHSB, IID_IColorConvertorEx, CnvEx)
INTERFACE_PART(CColorConvertorHSB, IID_IProvideHistColors, Hist)
END_INTERFACE_MAP()
IMPLEMENT_UNKNOWN(CColorConvertorHSB, CnvEx)
IMPLEMENT_UNKNOWN(CColorConvertorHSB, Hist)
HRESULT CColorConvertorHSB::XHist::GetHistColors( int nPaneNo, COLORREF *pcrArray, COLORREF *pcrCurve )
{
METHOD_PROLOGUE_EX(CColorConvertorHSB, Hist);
byte bgr[3];
color H = colorMax/2;
color S = colorMax;
color L = colorMax/2;
if( nPaneNo == 2 )
S = 0;
if( nPaneNo == 0 )
*pcrCurve = RGB( 255, 255, 255 );
else if( nPaneNo == 1 )
*pcrCurve = RGB( 0, 0, 255 );
else if( nPaneNo == 2 )
*pcrCurve = RGB( 0, 0, 0 );
color *ppcolors[3];
ppcolors[0] = &H;
ppcolors[1] = &S;
ppcolors[2] = &L;
for( int i = 0; i < 256; i++, pcrArray++ )
{
if( nPaneNo == 0 )H = ByteAsColor( i );
else if( nPaneNo == 1 )S = ByteAsColor( i );
else if( nPaneNo == 2 )L = ByteAsColor( i );
pThis->ConvertImageToRGB( ppcolors, bgr, 1 );
*pcrArray = RGB( bgr[2], bgr[1], bgr[0] );
}
return S_OK;
}
HRESULT CColorConvertorHSB::XCnvEx::ConvertImageToDIBRect( BITMAPINFOHEADER *pbi, BYTE *pdibBits, POINT ptBmpOfs, IImage2 *pimage, RECT rectDest, POINT pointImageOffest, double fZoom, POINT ptScroll, DWORD dwFillColor, DWORD dwFlags, IUnknown *ppunkParams)
{
METHOD_PROLOGUE_EX(CColorConvertorHSB, CnvEx);
double fltR, fltG, fltB, H, S, L;
if(nInterpolationMethod==-1 || nMaskInterpolationMethod==-1)
{
nInterpolationMethod = GetValueInt(GetAppUnknown(), "\\General", "ImageInterpolationMethod", 0);
nMaskInterpolationMethod = GetValueInt(GetAppUnknown(), "\\General", "ImageMaskInterpolationMethod", 0);
}
if(nInterpolationMethod==1 && fZoom>1.1)
{
CONVERTTODIB_PART1_BILINEAR
H = ScaleColorToDouble(R);
S = ScaleColorToDouble(G);
L = ScaleColorToDouble(B);
H+=.5;
S+=.5;
L+=.5;
double Magic1, Magic2;
if (S == 0)
{ /* achromatic case */
fltR=fltG=fltB=L;
}
else
{ /* chromatic case */
/* set up magic numbers */
if (L <= (1.0/2))
Magic2 = (L*(1.0 + S));
else
Magic2 = L + S - ((L*S));
Magic1 = 2*L-Magic2;
/* get RGB, change units from HLSMAX to RGBMAX */
fltR = (HueToRGB(Magic1,Magic2,H+(1.0/3)));
fltG = (HueToRGB(Magic1,Magic2,H));
fltB = (HueToRGB(Magic1,Magic2,H-(1.0/3)));
}
fltR-=.5;
fltG-=.5;
fltB-=.5;
byte *pLookupTableR = pThis->m_pLookupTableR;
byte *pLookupTableG = pThis->m_pLookupTableG;
byte *pLookupTableB = pThis->m_pLookupTableB;
if( pLookupTableR && pLookupTableG && pLookupTableB )
{
Rbyte = ScaleDoubleToByte(fltR);
Gbyte = ScaleDoubleToByte(fltG);
Bbyte = ScaleDoubleToByte(fltB);
Rbyte = pLookupTableR[Rbyte*255];
Gbyte = pLookupTableG[Gbyte*255];
Bbyte = pLookupTableB[Bbyte*255];
}
else
{
Bbyte = ScaleDoubleToByte(fltB);
Gbyte = ScaleDoubleToByte(fltG);
Rbyte = ScaleDoubleToByte(fltR);
}
CONVERTTODIB_PART2_BILINEAR
}
else
{
CONVERTTODIB_PART1
H = ScaleColorToDouble(R);
S = ScaleColorToDouble(G);
L = ScaleColorToDouble(B);
H+=.5;
S+=.5;
L+=.5;
double Magic1, Magic2;
if (S == 0)
{ /* achromatic case */
fltR=fltG=fltB=L;
}
else
{ /* chromatic case */
/* set up magic numbers */
if (L <= (1.0/2))
Magic2 = (L*(1.0 + S));
else
Magic2 = L + S - ((L*S));
Magic1 = 2*L-Magic2;
/* get RGB, change units from HLSMAX to RGBMAX */
fltR = (HueToRGB(Magic1,Magic2,H+(1.0/3)));
fltG = (HueToRGB(Magic1,Magic2,H));
fltB = (HueToRGB(Magic1,Magic2,H-(1.0/3)));
}
fltR-=.5;
fltG-=.5;
fltB-=.5;
byte *pLookupTableR = pThis->m_pLookupTableR;
byte *pLookupTableG = pThis->m_pLookupTableG;
byte *pLookupTableB = pThis->m_pLookupTableB;
if( pLookupTableR && pLookupTableG && pLookupTableB )
{
Rbyte = ScaleDoubleToByte(fltR);
Gbyte = ScaleDoubleToByte(fltG);
Bbyte = ScaleDoubleToByte(fltB);
Rbyte = pLookupTableR[Rbyte*255];
Gbyte = pLookupTableG[Gbyte*255];
Bbyte = pLookupTableB[Bbyte*255];
}
else
{
Bbyte = ScaleDoubleToByte(fltB);
Gbyte = ScaleDoubleToByte(fltG);
Rbyte = ScaleDoubleToByte(fltR);
}
CONVERTTODIB_PART2
}
return S_OK;
}
CColorConvertorHSB::CColorConvertorHSB()
{
_OleLockApp( this );
}
CColorConvertorHSB::~CColorConvertorHSB()
{
_OleUnlockApp( this );
}
const char *CColorConvertorHSB::GetCnvName()
{
return _T("HSB");
}
int CColorConvertorHSB::GetColorPanesCount()
{
return 3;
}
const char *CColorConvertorHSB::GetPaneName(int numPane)
{
if (numPane == 0)
return _T("Hue");
else if (numPane == 1)
return _T("Saturation");
else if (numPane == 2)
return _T("Brightness");
return _T("");
}
const char *CColorConvertorHSB::GetPaneShortName( int numPane )
{
if (numPane == 0)
return _T("H");
else if (numPane == 1)
return _T("S");
else if (numPane == 2)
return _T("B");
return _T("");
}
color CColorConvertorHSB::ConvertToHumanValue( color colorInternal, int numPane )
{
if( numPane == 0 )//H
{
color H;
H = ( colorInternal - 65535 + 65535/3);
H = -color( ( ( (double)H * 360.0 /65535 - 360.0 ) ) );
return H;
}
else
if( numPane == 1 )//S
{
color S = color(( (double)colorInternal * 100.0 / double(colorMax) ));
return S;
}
else
if( numPane == 2 )//L
{
color L = color(( (double)colorInternal * 100.0 / double(colorMax) ));
return L;
}
return colorInternal * 255 / colorMax;
}
DWORD CColorConvertorHSB::GetPaneFlags(int numPane)
{
if( numPane == 0 )return pfOrdinary|pfCycled;
else if( numPane == 2 )return pfOrdinary|pfGray;
else return pfOrdinary;
}
void CColorConvertorHSB::ConvertRGBToImage( byte *pRGB, color **ppColor, int cx )
{
color *p0, *p1, *p2;
p0 = ppColor[0];
p1 = ppColor[1];
p2 = ppColor[2];
double BB, GG, RR, H, S, B;//, u, v;
//Convert RGB to HSL colorspace.
for( long n = 0, c = 0; n < cx; n++ )
{
BB = ScaleByteToDouble(pRGB[c++]);
GG = ScaleByteToDouble(pRGB[c++]);
RR = ScaleByteToDouble(pRGB[c++]);
RR+=0.5;
GG+=0.5;
BB+=0.5;
//RR*=RGBMAX;
//GG*=RGBMAX;
//BB*=RGBMAX;
if(RR<0)RR=0;
if(RR>1.0)RR=1.0;
if(GG<0)GG=0;
if(GG>1.0)GG=1.0;
if(BB<0)BB=0;
if(BB>1.0)BB=1.0;
double cMax, cMin, Rdelta, Gdelta, Bdelta;
cMax = max( max(RR,GG), BB);
cMin = min( min(RR,GG), BB);
B = (cMax+cMin)/2.0;
if (cMax == cMin)
{ /* r=g=b --> achromatic case */
S = 0; /* saturation */
H = 0; /* hue */
}
else
{ /* chromatic case */
/* saturation */
if (B <= (1.0/2))
S= (cMax-cMin ) / (cMax+cMin);
else
S = ( (cMax-cMin)) / (2.0-cMax-cMin);
/* hue */
Rdelta = ( ((cMax-RR)*(1.0/6))) / (cMax-cMin);
Gdelta = ( ((cMax-GG)*(1.0/6))) / (cMax-cMin);
Bdelta = ( ((cMax-BB)*(1.0/6))) / (cMax-cMin);
if (RR == cMax)
H = Bdelta - Gdelta;
else if (GG == cMax)
H = (1.0/3) + Rdelta - Bdelta;
else /* BB == cMax */
H = ((2*1.0)/3) + Gdelta - Rdelta;
if (H < 0)
H += 1.0;
if (H > 1.0)
H -= 1.0;
}
H -=.5;
S -=.5;
B -=.5;
//B = (r + g + b)/3.0;
/*B = (RR*60+GG*118+BB*22)/200;
u = 2.0/3.0*RR - 1.0/3.0*GG - 1.0/3.0*BB;
v = -1.0/3.0*RR + 2.0/3.0*GG - 1.0/3.0*BB;
H = atan2(v, u);
S = sqrt(v*v + u*u);
H/= (2*PI);
S/=4;
/*Max=max(RR,max(GG,BB));
Min=min(RR,min(GG,BB));
H=(-1.0);
S=0.0;
B=(Min+Max)/2.0;
delta=Max-Min;
if (delta == 0.0)
return;
S=delta/((B <= 0.5) ? (Min+Max) : (2.0-Max-Min));
if (RR == Max)
H=(GG == Min ? 5.0+(Max-BB)/delta : 1.0-(Max-GG)/delta);
else
if (GG == Max)
H=(BB == Min ? 1.0+(Max-RR)/delta : 3.0-(Max-BB)/delta);
else
H=(RR == Min ? 3.0+(Max-GG)/delta : 5.0-(Max-RR)/delta);
H/=12.0;
S/=16;
*/
p0[n] = ScaleDoubleToColor(H); // H
p1[n] = ScaleDoubleToColor(S); // S
p2[n] = ScaleDoubleToColor(B); // B
}
}
void CColorConvertorHSB::ConvertImageToRGB( color **ppColor, byte *pRGB, int cx )
{
color *p0, *p1, *p2;
p0 = ppColor[0];
p1 = ppColor[1];
p2 = ppColor[2];
double R, G, B, H, S, L;
for( long n = 0, c = 0; n < cx; n++ )
{
H = ScaleColorToDouble(p0[n]);
S = ScaleColorToDouble(p1[n]);
L = ScaleColorToDouble(p2[n]);
/*H*= 2*PI;
S*=2;
//if(H>PI)
// H-=PI;
tanH = tan(H);
u = sqrt(1/(1+tanH*tanH))*S;
v = u*tanH;
R = L + u;
G = L + v;
B = L - u - v;
*/
//S *= 8;
H+=.5;
S+=.5;
L+=.5;
double Magic1, Magic2;
if (S == 0)
{ /* achromatic case */
R=G=B=L;
}
else
{ /* chromatic case */
/* set up magic numbers */
if (L <= (1.0/2))
Magic2 = (L*(1.0 + S));
else
Magic2 = L + S - ((L*S));
Magic1 = 2*L-Magic2;
/* get RGB, change units from HLSMAX to RGBMAX */
R = (HueToRGB(Magic1,Magic2,H+(1.0/3)));
G = (HueToRGB(Magic1,Magic2,H));
B = (HueToRGB(Magic1,Magic2,H-(1.0/3)));
}
//pRGB[c++] = byte(B);
//pRGB[c++] = byte(G);
//pRGB[c++] = byte(R);
//R/=RGBMAX;
//G/=RGBMAX;
//B/=RGBMAX;
R-=.5;
G-=.5;
B-=.5;
pRGB[c++]=ScaleDoubleToByte(B);
pRGB[c++]=ScaleDoubleToByte(G);
pRGB[c++]=ScaleDoubleToByte(R);
}
//Convert HSL to RGB colorspace.
/* double hue, saturation, luminosity, r, g, b;
for( long n = 0, c = 0; n < cx; n++ )
{
hue = ScaleColorToDouble(p0[n])*2;
saturation = ScaleColorToDouble(p1[n])*16;
luminosity = ScaleColorToDouble(p2[n]);
v=(luminosity <= 0.5) ? (luminosity*(1.0+saturation)) : (luminosity+saturation-luminosity*saturation);
if ((saturation == 0.0) || (hue == -1.0))
{
pRGB[c++] =ScaleDoubleToByte(luminosity);
pRGB[c++] =ScaleDoubleToByte(luminosity);
pRGB[c++] =ScaleDoubleToByte(luminosity);
continue;
}
y=2*luminosity-v;
x=y+(v-y)*(6.0*hue-(int) (6.0*hue));
z=v-(v-y)*(6.0*hue-(int) (6.0*hue));
switch ((int) (6.0*hue))
{
default: r=v; g=x; b=y; break;
case 0: r=v; g=x; b=y; break;
case 1: r=z; g=v; b=y; break;
case 2: r=y; g=v; b=x; break;
case 3: r=y; g=z; b=v; break;
case 4: r=x; g=y; b=v; break;
case 5: r=v; g=y; b=z; break;
}
pRGB[c++]=ScaleDoubleToByte(b);
pRGB[c++]=ScaleDoubleToByte(g);
pRGB[c++]=ScaleDoubleToByte(r);
}*/
}
void CColorConvertorHSB::ConvertGrayToImage( byte *pGray, color **ppColor, int cx )
{
for( long n = 0; n < cx; n++ )
{
ppColor[2][n] = ByteAsColor( pGray[n] );
ppColor[1][n] = ByteAsColor( pGray[n] );
ppColor[0][n] = ByteAsColor( pGray[n] );
}
}
void CColorConvertorHSB::ConvertImageToGray( color **ppColor, byte *pGray, int cx )
{
/*for( long n = 0; n < cx; n++ )
pGray[n] = Bright( ScaleDoubleToByte(ppColor[2][n] + 1.1398*ppColor[0][n]),
ScaleDoubleToByte(ppColor[2][n] - 0.3938*ppColor[1][n] - 0.5805*ppColor[0][n]),
ScaleDoubleToByte(ppColor[2][n] + 2.0279*ppColor[1][n]));
*/
}
void CColorConvertorHSB::GetConvertorIcon( HICON *phIcon )
{
if(phIcon)
*phIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_ICON_HSB));
}
void CColorConvertorHSB::ConvertLABToImage( double *pLab, color **ppColor, int cx )
{
color *p0, *p1, *p2;
p0 = ppColor[0];
p1 = ppColor[1];
p2 = ppColor[2];
//int MaxRGB = 65535;
//double delta, Max, Min, Rdelta, Bdelta, Gdelta;
double X, Y, Z, fX, fY, fZ;
double RR, GG, BB;
double L, a, b, H, S, B;
//int nH;
for( long n = 0, c = 0; n < cx; n++ )
{
L = pLab[c++];
a = pLab[c++];
b = pLab[c++];
//B = L;
//H = atan2(b, a) - ;
//S = sqrt(a*a + b*b);
fY = pow((L + 16.0) / 116.0, 3.0);
if (fY < 0.008856)
fY = L / 903.3;
Y = fY;
if (fY > 0.008856)
fY = pow(fY, 1.0/3.0);
else
fY = 7.787 * fY + 16.0/116.0;
fX = a / 500.0 + fY;
if (fX > 0.206893)
X = pow(fX, 3.0);
else
X = (fX - 16.0/116.0) / 7.787;
fZ = fY - b /200.0;
if (fZ > 0.206893)
Z = pow(fZ, 3.0);
else
Z = (fZ - 16.0/116.0) / 7.787;
X *= 0.950456;
Y *= 1;
Z *= 1.088754;
RR = (3.240479*X - 1.537150*Y - 0.498535*Z);
GG = (-0.969256*X + 1.875992*Y + 0.041556*Z);
BB = (0.055648*X - 0.204043*Y + 1.057311*Z);
/*u = 2.0/3.0*RR - 1.0/3.0*GG - 1.0/3.0*BB;
v = -1.0/3.0*RR + 2.0/3.0*GG - 1.0/3.0*BB;
H = atan2(v, u);
B = (RR + GG + BB)/3.0;
//B = (RR*60+GG*118+BB*22)/200;
S = sqrt(v*v + u*u);
H /= (2*PI);
S /= 2;
*/
//ASSERT(S < .5);
//ASSERT(H < .5);
//ASSERT(H > -.5);
//ASSERT(B < .5);
//ASSERT(B > -.51);
//H+=PI;
//Convert RGB to HSL colorspace.
//RR+=0.5;
//GG+=0.5;
//BB+=0.5;
/*Max=max(RR,max(GG,BB));
Min=min(RR,min(GG,BB));
H=(-1.0);
S=0.0;
B=(Min+Max)/2.0;
delta=Max-Min;
if (delta == 0.0)
return;
S=delta/((B <= 0.5) ? (Min+Max) : (2.0-Max-Min));
if (RR == Max)
H=(GG == Min ? 5.0+(Max-BB)/delta : 1.0-(Max-GG)/delta);
else
if (GG == Max)
H=(BB == Min ? 1.0+(Max-RR)/delta : 3.0-(Max-BB)/delta);
else
H=(RR == Min ? 3.0+(Max-GG)/delta : 5.0-(Max-RR)/delta);
H/=12.0;
S/=16;
*/
/* get R, G, and B out of DWORD */
/* calculate lightness */
RR+=0.5;
GG+=0.5;
BB+=0.5;
//RR*=RGBMAX;
//GG*=RGBMAX;
//BB*=RGBMAX;
if(RR<0)RR=0;
if(RR>1.0)RR=1.0;
if(GG<0)GG=0;
if(GG>1.0)GG=1.0;
if(BB<0)BB=0;
if(BB>1.0)BB=1.0;
double cMax, cMin, Rdelta, Gdelta, Bdelta;
cMax = max( max(RR,GG), BB);
cMin = min( min(RR,GG), BB);
B = (cMax+cMin)/2.0;
if (cMax == cMin)
{ /* r=g=b --> achromatic case */
S = 0; /* saturation */
H = 0; /* hue */
}
else
{ /* chromatic case */
/* saturation */
if (B <= (1.0/2))
S= (cMax-cMin ) / (cMax+cMin);
else
S = ( (cMax-cMin)) / (2.0-cMax-cMin);
/* hue */
Rdelta = ( ((cMax-RR)*(1.0/6))) / (cMax-cMin);
Gdelta = ( ((cMax-GG)*(1.0/6))) / (cMax-cMin);
Bdelta = ( ((cMax-BB)*(1.0/6))) / (cMax-cMin);
if (RR == cMax)
H = Bdelta - Gdelta;
else if (GG == cMax)
H = (1.0/3) + Rdelta - Bdelta;
else /* BB == cMax */
H = ((2*1.0)/3) + Gdelta - Rdelta;
if (H < 0)
H += 1.0;
if (H > 1.0)
H -= 1.0;
}
H -=.5;
S -=.5;
B -=.5;
//ASSERT(S > -.5);
//ASSERT(S < .5);
//ASSERT(H < .5);
//ASSERT(H > -.5);
//ASSERT(B < .5);
//ASSERT(B > -.51);
p0[n] = ScaleDoubleToColor(H); // H
p1[n] = ScaleDoubleToColor(S); // S
p2[n] = ScaleDoubleToColor(B); // B
}
}
void CColorConvertorHSB::ConvertImageToLAB( color **ppColor, double *pLab, int cx )
{
color *p0, *p1, *p2;
p0 = ppColor[0];
p1 = ppColor[1];
p2 = ppColor[2];
double X, Y, Z, fX, fY, fZ;
double RR, GG, BB;
double L, a, b;
//double hue, saturation, luminosity;
double H, S, B;
//double v, u, tanH;
for( long n = 0, c = 0; n < cx; n++ )
{
H = ScaleColorToDouble(p0[n]);
S = ScaleColorToDouble(p1[n]);
B = ScaleColorToDouble(p2[n]);
H+=.5;
S+=.5;
B+=.5;
double Magic1, Magic2;
if (S == 0)
{ /* achromatic case */
RR=GG=BB=B;
}
else
{ /* chromatic case */
/* set up magic numbers */
if (B <= (1.0/2))
Magic2 = (B*(1.0 + S));
else
Magic2 = B + S - ((B*S));
Magic1 = 2*B-Magic2;
/* get RGB, change units from HLSMAX to RGBMAX */
RR = (HueToRGB(Magic1,Magic2,H+(1.0/3)));
GG = (HueToRGB(Magic1,Magic2,H));
BB = (HueToRGB(Magic1,Magic2,H-(1.0/3)));
}
RR-=.5;
GG-=.5;
BB-=.5;
/*if(RR<-.5)RR=-.5;
if(RR>.5)RR=.5;
if(GG<-.5)GG=-.5;
if(GG>.5)GG=.5;
if(BB<-.5)BB=-.5;
if(BB>.5)BB=.5;
*/
//hue = ScaleColorToDouble(p0[n])*2;
//saturation = ScaleColorToDouble(p1[n])*16;
//luminosity = ScaleColorToDouble(p2[n]);
/*v=(luminosity <= 0.5) ? (luminosity*(1.0+saturation)) : (luminosity+saturation-luminosity*saturation);
if ((saturation == 0.0) || (hue == -1.0))
{
R = luminosity;
G = luminosity;
B = luminosity;
continue;
}
y=2*luminosity-v;
x=y+(v-y)*(6.0*hue-(int) (6.0*hue));
z=v-(v-y)*(6.0*hue-(int) (6.0*hue));
switch ((int) (6.0*hue))
{
default: R=v; G=x; B=y; break;
case 0: R=v; G=x; B=y; break;
case 1: R=z; G=v; B=y; break;
case 2: R=y; G=v; B=x; break;
case 3: R=y; G=z; B=v; break;
case 4: R=x; G=y; B=v; break;
case 5: R=v; G=y; B=z; break;
}
*/
//hue *= PI;
//saturation*=4;
//tanH = tan(hue);
//u = sqrt(1/(1+tanH*tanH))*saturation;
//v = u*tanH;
//R = luminosity + u;
//G = luminosity + v;
//B = luminosity - u - v;
X = (0.412453*RR + 0.357580*GG + 0.180423*BB)/0.950456;
Y = (0.212671*RR + 0.715160*GG + 0.072169*BB);
Z = (0.019334*RR + 0.119193*GG + 0.950227*BB)/1.088754;
if (Y > 0.008856)
{
fY = pow(Y, 1.0/3.0);
L = 116.0*fY - 16.0;
}
else
{
fY = 7.787*Y + 16.0/116.0;
L = 903.3*Y;
}
if (X > 0.008856)
fX = pow(X, 1.0/3.0);
else
fX = 7.787*X + 16.0/116.0;
if (Z > 0.008856)
fZ = pow(Z, 1.0/3.0);
else
fZ = 7.787*Z + 16.0/116.0;
a = 500.0*(fX - fY);
b = 200.0*(fY - fZ);
pLab[c++] = L;
pLab[c++] = a;
pLab[c++] = b;
}
}
void CColorConvertorHSB::GetPaneColor(int numPane, DWORD* pdwColor)
{
if(pdwColor == 0) return;
switch(numPane)
{
case 0:
*pdwColor = RGB(0, 0, 0); //need to correct!!!
break;
case 1:
*pdwColor = RGB(0, 0, 0); //need to correct!!!
break;
case 2:
*pdwColor = RGB(0, 0, 0); //need to correct!!!
break;
default:
*pdwColor = 0;
}
}
void CColorConvertorHSB::GetCorrespondPanesColorValues(int numPane, DWORD* pdwColorValues)
{
if(pdwColorValues == 0) return;
switch(numPane)
{
case 0:
*pdwColorValues = RGB(NotUsed, 0, 0);
break;
case 1:
*pdwColorValues = RGB(0, NotUsed, 0);
break;
case 2:
*pdwColorValues = RGB(0, 0, NotUsed);
break;
default:
*pdwColorValues = 0;
}
}
/////////////////////////////////////////////////////////////////
//color convertor GRAY
/////////////////////////////////////////////////////////////////
BEGIN_INTERFACE_MAP(CColorConvertorGRAY, CColorConvertorBase)
INTERFACE_PART(CColorConvertorGRAY, IID_IColorConvertorEx, CnvEx)
INTERFACE_PART(CColorConvertorGRAY, IID_IColorConvertorEx2, CnvEx)
INTERFACE_PART(CColorConvertorGRAY, IID_IProvideHistColors, Hist)
END_INTERFACE_MAP()
IMPLEMENT_UNKNOWN(CColorConvertorGRAY, CnvEx)
IMPLEMENT_UNKNOWN(CColorConvertorGRAY, Hist)
HRESULT CColorConvertorGRAY::XHist::GetHistColors( int nPaneNo, COLORREF *pcrArray, COLORREF *pcrCurve )
{
METHOD_PROLOGUE_EX(CColorConvertorGRAY, Hist);
*pcrCurve = RGB( 0, 0, 0 );
for( int i = 0; i < 256; i++, pcrArray++ )
*pcrArray = RGB( i, i, i );
return S_OK;
}
HRESULT CColorConvertorGRAY::XCnvEx::ConvertImageToDIBRect( BITMAPINFOHEADER *pbi, BYTE *pdibBits, POINT ptBmpOfs, IImage2 *pimage, RECT rectDest, POINT pointImageOffest, double fZoom, POINT ptScroll, DWORD dwFillColor, DWORD dwFlags, IUnknown *ppunkParams)
{
METHOD_PROLOGUE_EX(CColorConvertorGRAY, CnvEx)
byte *pLookupTableR = pThis->m_pLookupTableR;
byte *pLookupTableG = pThis->m_pLookupTableG;
byte *pLookupTableB = pThis->m_pLookupTableB;
byte *ptemp = 0;
if( dwFlags & cidrHilight )
{
ptemp = new byte[65536];
memset( ptemp, 255, 65536 );
byte fillR = GetRValue(dwFillColor); \
byte fillG = GetGValue(dwFillColor); \
byte fillB = GetBValue(dwFillColor); \
if( fillR )pLookupTableR = ptemp;
if( fillG )pLookupTableG = ptemp;
if( fillB )pLookupTableB = ptemp;
}
if(nInterpolationMethod==-1 || nMaskInterpolationMethod==-1)
{
nInterpolationMethod = GetValueInt(GetAppUnknown(), "\\General", "ImageInterpolationMethod", 0);
nMaskInterpolationMethod = GetValueInt(GetAppUnknown(), "\\General", "ImageMaskInterpolationMethod", 0);
}
if(nInterpolationMethod==1 && fZoom>1.1)
{
CONVERTTODIB_PART1_BILINEAR
Rbyte = pLookupTableR?pLookupTableR[R]:(R>>8);
Gbyte = pLookupTableG?pLookupTableG[G]:(G>>8);
Bbyte = pLookupTableB?pLookupTableB[B]:(B>>8);
CONVERTTODIB_PART2_BILINEAR
}
else
{
CONVERTTODIB_PART1
Rbyte = pLookupTableR?pLookupTableR[R]:(R>>8);
Gbyte = pLookupTableG?pLookupTableG[G]:(G>>8);
Bbyte = pLookupTableB?pLookupTableB[B]:(B>>8);
CONVERTTODIB_PART2
}
if( ptemp )delete ptemp;
return S_OK;
}
HRESULT CColorConvertorGRAY::XCnvEx::ConvertImageToDIBRect2( BITMAPINFOHEADER *pbi, BYTE *pdibBits, WORD *pDistBits, POINT ptBmpOfs, IImage2 *pimage, RECT rectDest, POINT pointImageOffest, double fZoom, POINT ptScroll, DWORD dwFillColor, DWORD dwFlags, IDistanceMap *pDistMap, IUnknown *ppunkParams)
{
METHOD_PROLOGUE_EX(CColorConvertorGRAY, CnvEx)
byte *pLookupTableR = pThis->m_pLookupTableR;
byte *pLookupTableG = pThis->m_pLookupTableG;
byte *pLookupTableB = pThis->m_pLookupTableB;
byte *ptemp = 0;
if( dwFlags & cidrHilight )
{
ptemp = new byte[65536];
memset( ptemp, 255, 65536 );
byte fillR = GetRValue(dwFillColor); \
byte fillG = GetGValue(dwFillColor); \
byte fillB = GetBValue(dwFillColor); \
if( fillR )pLookupTableR = ptemp;
if( fillG )pLookupTableG = ptemp;
if( fillB )pLookupTableB = ptemp;
}
if(nInterpolationMethod==-1 || nMaskInterpolationMethod==-1)
{
nInterpolationMethod = GetValueInt(GetAppUnknown(), "\\General", "ImageInterpolationMethod", 0);
nMaskInterpolationMethod = GetValueInt(GetAppUnknown(), "\\General", "ImageMaskInterpolationMethod", 0);
}
if(nInterpolationMethod==1 && fZoom>1.1)
{
CONVERTTODIB_PART1_BILINEAR
Rbyte = pLookupTableR?pLookupTableR[R]:(R>>8);
Gbyte = pLookupTableG?pLookupTableG[G]:(G>>8);
Bbyte = pLookupTableB?pLookupTableB[B]:(B>>8);
CONVERTTODIB_PART2_BILINEAR
}
else
{
CONVERTTODIB_PART1_TRANSP
Rbyte = pLookupTableR?pLookupTableR[R]:(R>>8);
Gbyte = pLookupTableG?pLookupTableG[G]:(G>>8);
Bbyte = pLookupTableB?pLookupTableB[B]:(B>>8);
CONVERTTODIB_PART2_TRANSP
}
if( ptemp )delete ptemp;
return S_OK;
}
CColorConvertorGRAY::CColorConvertorGRAY()
{
_OleLockApp( this );
}
CColorConvertorGRAY::~CColorConvertorGRAY()
{
_OleUnlockApp( this );
}
const char *CColorConvertorGRAY::GetCnvName()
{
return _T("GRAY");
}
int CColorConvertorGRAY::GetColorPanesCount()
{
return 1;
}
const char *CColorConvertorGRAY::GetPaneName(int numPane)
{
if (numPane == 0)
return _T("Gray");
return _T("");
}
const char *CColorConvertorGRAY::GetPaneShortName( int numPane )
{
if (numPane == 0)
return _T("G");
return _T("");
}
color CColorConvertorGRAY::ConvertToHumanValue( color colorInternal, int numPane )
{
return colorInternal * 255 / colorMax;
}
DWORD CColorConvertorGRAY::GetPaneFlags(int numPane)
{
return pfOrdinary|pfGray;
}
void CColorConvertorGRAY::ConvertRGBToImage( byte *pRGB, color **ppColor, int cx )
{
if (ppColor == NULL || pRGB == NULL)
return;
byte r, g, b, byteC;
for( long n = 0, c = 0; n < cx; n++ )
{
b = pRGB[c++];
g = pRGB[c++];
r = pRGB[c++];
byteC = Bright(r, g, b);
ppColor[0][n] = ByteAsColor(byteC);
}
}
void CColorConvertorGRAY::ConvertImageToRGB( color **ppColor, byte *pRGB, int cx )
{
if (ppColor == NULL || pRGB == NULL)
return;
/*if(m_pLookupTable != 0)
{
//Extended convertor with usage lookup table
ASSERT(m_sizeLookupTable.cy >= 3);
ASSERT(m_sizeLookupTable.cx >= 256);
int CX = m_sizeLookupTable.cx;
for( long n = 0, c = 0; n < cx; n++ )
{
pRGB[c++] = m_pLookupTable[2*CX + ColorAsByte(ppColor[0][n])];
pRGB[c++] = m_pLookupTable[1*CX + ColorAsByte(ppColor[0][n])];
pRGB[c++] = m_pLookupTable[0*CX + ColorAsByte(ppColor[0][n])];
}
}
else
*/
{
for( long n = 0, c = 0; n < cx; n++ )
{
pRGB[c++] = ColorAsByte( ppColor[0][n] );
pRGB[c++] = ColorAsByte( ppColor[0][n] );
pRGB[c++] = ColorAsByte( ppColor[0][n] );
}
}
}
void CColorConvertorGRAY::ConvertGrayToImage( byte *pGray, color **ppColor, int cx )
{
if (ppColor == NULL || pGray == NULL)
return;
for( long n = 0; n < cx; n++ )
{
ppColor[0][n] = ByteAsColor( pGray[n] );
}
}
void CColorConvertorGRAY::ConvertImageToGray( color **ppColor, byte *pGray, int cx )
{
if (ppColor == NULL || pGray == NULL)
return;
/*if(m_pLookupTable != 0)
{
//Extended convertor with usage lookup table
ASSERT(m_sizeLookupTable.cy >= 3);
ASSERT(m_sizeLookupTable.cx >= 256);
for( long n = 0; n < cx; n++ )
{
pGray[n] = m_pLookupTable[ColorAsByte(ppColor[0][n])];
}
}
else*/
{
for( long n = 0; n < cx; n++ )
{
pGray[n] = ColorAsByte( ppColor[0][n] );
}
}
}
void CColorConvertorGRAY::GetConvertorIcon( HICON *phIcon )
{
if(phIcon)
*phIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_ICON_GRAY));
}
void CColorConvertorGRAY::ConvertLABToImage( double *pLab, color **ppColor, int cx )
{
color *p0, *p1, *p2;
p0 = ppColor[0];
p1 = ppColor[0];
p2 = ppColor[0];
double X, Y, Z, fX, fY, fZ;
double RR, GG, BB;
double L, a, b;
for( long n = 0, c = 0; n < cx; n++ )
{
L = pLab[c++];
a = pLab[c++];
b = pLab[c++];
fY = pow((L + 16.0) / 116.0, 3.0);
if (fY < 0.008856)
fY = L / 903.3;
Y = fY;
if (fY > 0.008856)
fY = pow(fY, 1.0/3.0);
else
fY = 7.787 * fY + 16.0/116.0;
fX = a / 500.0 + fY;
if (fX > 0.206893)
X = pow(fX, 3.0);
else
X = (fX - 16.0/116.0) / 7.787;
fZ = fY - b /200.0;
if (fZ > 0.206893)
Z = pow(fZ, 3.0);
else
Z = (fZ - 16.0/116.0) / 7.787;
X *= 0.950456;
Y *= 1;
Z *= 1.088754;
RR = (3.240479*X - 1.537150*Y - 0.498535*Z);
GG = (-0.969256*X + 1.875992*Y + 0.041556*Z);
BB = (0.055648*X - 0.204043*Y + 1.057311*Z);
p0[n] = p1[n] = p2[n] = ByteAsColor((byte)Bright(ScaleDoubleToByte(BB), ScaleDoubleToByte(GG), ScaleDoubleToByte(RR)));
}
}
void CColorConvertorGRAY::ConvertImageToLAB( color **ppColor, double *pLab, int cx )
{
color *p0, *p1, *p2;
p0 = ppColor[0];
p1 = ppColor[0];
p2 = ppColor[0];
double X, Y, Z, fX, fY, fZ;
double R, G, B;
double L, a, b;
for( long n = 0, c = 0; n < cx; n++ )
{
R = ScaleColorToDouble(p0[n]);
G = ScaleColorToDouble(p1[n]);
B = ScaleColorToDouble(p2[n]);
X = (0.412453*R + 0.357580*G + 0.180423*B)/0.950456;
Y = (0.212671*R + 0.715160*G + 0.072169*B);
Z = (0.019334*R + 0.119193*G + 0.950227*B)/1.088754;
if (Y > 0.008856)
{
fY = pow(Y, 1.0/3.0);
L = 116.0*fY - 16.0;
}
else
{
fY = 7.787*Y + 16.0/116.0;
L = 903.3*Y;
}
if (X > 0.008856)
fX = pow(X, 1.0/3.0);
else
fX = 7.787*X + 16.0/116.0;
if (Z > 0.008856)
fZ = pow(Z, 1.0/3.0);
else
fZ = 7.787*Z + 16.0/116.0;
a = 500.0*(fX - fY);
b = 200.0*(fY - fZ);
pLab[c++] = L;
pLab[c++] = a;
pLab[c++] = b;
}
}
void CColorConvertorGRAY::GetPaneColor(int numPane, DWORD* pdwColor)
{
if(pdwColor == 0) return;
switch(numPane)
{
case 0:
*pdwColor = RGB(128, 128, 128);
break;
default:
*pdwColor = 0;
}
}
void CColorConvertorGRAY::GetCorrespondPanesColorValues(int numPane, DWORD* pdwColorValues)
{
if(pdwColorValues == 0) return;
switch(numPane)
{
case 0:
*pdwColorValues = RGB(NotUsed, NotUsed, NotUsed);
break;
default:
*pdwColorValues = 0;
}
}
|
b7853b9c05408b6ac291249d1944e1a11d6b84ba
|
f06348a82c769832d06b522827649bab9bc463cb
|
/YHKim3_4/YHKim3_4.h
|
d6d87b41adcaccaf036c3bb2165be635e18e31a1
|
[] |
no_license
|
K-moovie/MFC
|
5ffb89cdaaf937ea69d193283e4fbaaf99b6ea57
|
d2b630021c5afc1b1631256f99faf89442c0f983
|
refs/heads/master
| 2020-08-07T16:19:11.051725
| 2019-12-16T14:16:05
| 2019-12-16T14:16:05
| 213,522,073
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 575
|
h
|
YHKim3_4.h
|
// YHKim3_4.h: PROJECT_NAME 응용 프로그램에 대한 주 헤더 파일입니다.
//
#pragma once
#ifndef __AFXWIN_H__
#error "PCH에 대해 이 파일을 포함하기 전에 'stdafx.h'를 포함합니다."
#endif
#include "resource.h" // 주 기호입니다.
// CYHKim34App:
// 이 클래스의 구현에 대해서는 YHKim3_4.cpp을(를) 참조하세요.
//
class CYHKim34App : public CWinApp
{
public:
CYHKim34App();
// 재정의입니다.
public:
virtual BOOL InitInstance();
// 구현입니다.
DECLARE_MESSAGE_MAP()
};
extern CYHKim34App theApp;
|
9aa99b3c68e351d1dfa121d6705b73d326e46b36
|
270337ba90758bb9155992a9cec8ec6d15d3ed43
|
/Catch/src/itemshopcell.cpp
|
ef40811ba5eb0964f596df1873db15eb6f23d219
|
[] |
no_license
|
zester/Mezzanine
|
cef3e309ee60f4e0d2ce4510ac81aed3e755260b
|
652ba585c681ef0420b50d1fcce5fe35733cf16d
|
refs/heads/master
| 2020-12-25T11:41:24.883154
| 2013-09-24T00:56:42
| 2013-09-24T00:56:42
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,989
|
cpp
|
itemshopcell.cpp
|
#ifndef _itemshopcell_cpp
#define _itemshopcell_cpp
#include "itemshopcell.h"
ItemShopCell::ItemShopCell(const String& name, const UI::RenderableRect& Rect, const String& ItemName, UI::Screen* parent)
: UI::Cell(name,parent)
{
Real LineHeight = Rect.Relative ? Rect.Size.Y * 0.25 : (Rect.Size.Y / ParentScreen->GetViewportDimensions().Y) * 0.25;
ItemCaption = ParentScreen->CreateCaption(name,Rect,LineHeight,ItemName);
AddSubRenderable(0,ItemCaption);
}
ItemShopCell::~ItemShopCell()
{
ParentScreen->DestroyBasicRenderable(ItemCaption);
}
void ItemShopCell::UpdateImpl(bool Force)
{
}
void ItemShopCell::SetVisibleImpl(bool visible)
{
ItemCaption->SetVisible(visible);
}
bool ItemShopCell::CheckMouseHoverImpl()
{
if(ItemCaption->CheckMouseHover()) return true;
else return false;
}
void ItemShopCell::SetPosition(const Vector2& Position)
{
RelSize = Position;
ItemCaption->SetPosition(Position);
}
void ItemShopCell::SetActualPosition(const Vector2& Position)
{
RelSize = Position / ParentScreen->GetViewportDimensions();
ItemCaption->SetActualPosition(Position);
}
void ItemShopCell::SetSize(const Vector2& Size)
{
RelSize = Size;
ItemCaption->SetSize(Size);
}
void ItemShopCell::SetActualSize(const Vector2& Size)
{
RelSize = Size / ParentScreen->GetViewportDimensions();
ItemCaption->SetActualSize(Size);
}
void ItemShopCell::UpdateDimensions()
{
UI::WidgetResult Result = UI::ViewportUpdateTool::UpdateWidget(this);
RelPosition = Result.first / UI::ViewportUpdateTool::GetNewSize();
RelSize = Result.second / UI::ViewportUpdateTool::GetNewSize();
ItemCaption->UpdateDimensions();
SetPosition(RelPosition);
}
UI::Caption* ItemShopCell::GetItemCaption()
{
return ItemCaption;
}
ItemShopCB::ItemShopCB()
{
}
ItemShopCB::~ItemShopCB()
{
}
void ItemShopCB::SetCaller(UI::Cell* Caller)
{
}
void ItemShopCB::DoSelectedItems()
{
}
void ItemShopCB::DoUnselectedItems()
{
}
#endif
|
57de1b6710448aa615cdcc80c3995c663e26b089
|
ae0247be1c758efb09b1a862cc85754c7ae95f23
|
/src/Include/DaliParser/rel_alg.h
|
0e539d6bf0dedcefe230365f37e473a4fea56df3
|
[] |
no_license
|
rathodsachin20/mubase
|
562680093dea13a5d0d2df71687be7e4cfa78c5f
|
91bad1d9666d6a6f4a01caad1021f633b83217d8
|
refs/heads/master
| 2021-01-10T05:00:12.792001
| 2016-03-03T05:01:23
| 2016-03-03T05:01:23
| 48,962,359
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 14,392
|
h
|
rel_alg.h
|
/* -*- c++ -*- */
#ifndef __REL_ALG_H__
#define __REL_ALG_H__
#include "ucbproto.h"
#include "list.h"
//#include "dali_rel_mgr.h"
//#include "dali_item_mgr.h"
class Memo_t;
class Project_t;
class SQLIterator;
class Equivalence_t;
class HashTable;
//bool GetRelInfo(const char *name_a, TransID &tid_a, TupleDef &result_a);
bool GetRelInfo(char *name_a, TupleDef &result_a);
class SQLStmt
/* Base class for all SQL operations, whether they evaluate
to tables or not. Therefore an $SQLStmt$ object should never
be the root of a query subtree. It should represent a full
SQL statement. */
{
protected:
enum SQLStmtOp
{
D_REL_EXPR,
D_NON_REL_EXPR
};
private:
SQLStmtOp op; /* Set when parsing */
protected:
TupleDef params; /* What all parameters are passed into this op
node when it is opened */
void Constructor(SQLStmtOp op_a)
{
op = op_a;
}
bool LocalPrint(FILE *file);
public:
TupleDef resultInfo; /* Set on type analysis. */
/* FIX: Add this
Alg method; Set after selecting evaluation plan. */
/* FIX: Need to convert pointers into Dali pointers */
bool print(FILE *file);
// bool typeCheck(TransID &tid_a);
bool typeCheck();
// bool optimize(TransID &tid_a);
bool rewrite();
// bool evaluate(TransID &tid_a);
Equivalence_t* PostOrder(Memo_t& memo);
};
class RelExpr : public SQLStmt
/* Base class for all those SQL operations whose result is a
table. */
{
protected:
enum RelExprOp
{
D_RELSCAN,
D_RENAME,
D_SELECT,
D_GEN_PROJECT,
D_JOIN,
D_DUPELIM,
D_SORT,
D_REL_VALUES
};
private:
RelExprOp op; /* Set when parsing */
protected:
int iterOffset;
void Constructor(RelExprOp op_a)
{
SQLStmt::Constructor(D_REL_EXPR);
op = op_a;
}
public:
bool print(FILE *file);
// int typeCheck(int, TransID &);
int typeCheck(int);
/* Performs type-checking of $Expr$s and $RelExpr$s. Dis-ambiguates
those $RelArgRef$s which have a null $relRef$ field. As a result
of these operations, it fills up the $resultInfo$ field, and also
sets $iterOffset$ for all the nodes in the query tree.
It makes only one assumption about the query tree, i.e. there
are no $LocalArgRef$s in it. If $resultInfo$ is already allocated
when this function is called, its previous contents are erased
and it is filled up newly.
The integer argument is the next free $iterOffset$ from which
$RelExpr$ objects belonging to the subtree rooted at $this$
object can be assigned.
Return value is the next free $iterOffset$ after $RelExpr$
objects belonging to the subtree rooted at $this$ object have
been assigned. -1 if $typeCheck$ fails for some reason.
The query tree nodes are assigned $iterOffset$s in post
order. */
// bool optimize(TransID &);
bool rewrite();
/* Replaces all $RelArgRef$s in the tree by $LocalArgRef$s. Assumes
that $typeCheck$ has already been called on the tree. */
// bool evaluate(TransID &tid_a);
bool push_down_preds(ClauseList *clauseList);
/* Pushes predicates as far down as possible. Removes empty
$SelectExpr$s which may be left behind as a consequence. This
function also makes two assumptions: 1) There are no
$LocalArgRef$s in the tree 2) $typeCheck$ has already been called,
before calling this function.
When a node X receives a predicate
from its parent, the predicate doesn't have $RelArgRef$s, but instead
it has $LocalArgRef$s of the form <RESULT, field no>. This
$LocalArgRef$ refers to X's $resultInfo$. Before pushing the
predicate to its child, it rewrites the $LocalArgRef$ in terms of
the child's $resultInfo$. If it cannot push the predicate to the
child, it reconverts the $LocalArgRef$s in it to $RelArgRef$s
and retains the predicate. */
SQLIterator *createIters();
/* Creates and returns a tree of iterators, which is a mirror
of the query tree. */
RelExprOp GetOpType(void) {
return op;
}
Equivalence_t* PostOrder(Memo_t& memo);
};
/*
class NonRelExpr : public SQLStmt
Base class for all those SQL operations whose result is not a
table, eg CREATE TABLE, INSERT TABLE, DELETE TABLE ...
{
protected:
enum NonRelExprOp
{
D_INSERT,
D_DELETE,
D_UPDATE,
D_CREATE_SCHEMA,
D_CREATE_DB,
D_CREATE_TS,
D_DROP_DB,
D_DROP_TS,
D_DROP_TABLE,
D_DROP_INDEX
};
private:
NonRelExprOp op; Set when parsing
protected:
void Constructor(NonRelExprOp op_a)
{
SQLStmt::Constructor(D_NON_REL_EXPR);
op = op_a;
}
public:
bool print(FILE *file);
bool typeCheck(TransID &);
bool typeCheck();
bool optimize(TransID &);
bool rewrite();
bool evaluate(TransID &tid_a);
Equivalence_t* PostOrder(Memo_t& memo);
};
*/
class RelScanExpr : public RelExpr
{
void Constructor(const char *name_a, Expr *cond_a);
bool addAndExpr(Expr *clause);
public:
char name[DALIMAXRELNAME];
Expr *cond;
/* NOTE: the $cond$ could be NULL. In fact it will usually be
NULL, unless push_down_preds has been called. */
// DaliSearchCriteria searchCrit;
/* This is set by $push_down_preds$ for now. Later maybe we
should have a separate function for this which
would be called after $optimize$ and before $rewrite$. */
static RelScanExpr *create(const char *name, Expr *cond = NULL);
bool print(FILE *out);
// int typeCheck(int, TransID &);
int typeCheck(int);
bool rewrite();
SQLIterator *createIters();
bool push_down_preds(ClauseList *clauseList);
Equivalence_t* PostOrder(Memo_t& memo);
};
class RenameExpr : public RelExpr {
struct AttrList
{
int numAttrs;
char **attrList;
};
char name[DALIMAXRELNAME];
AttrList attrList;
RelExpr *child;
public:
void Constructor(const char *name_a, List<char *> *attrList_a,
RelExpr *child_a);
static RenameExpr *create(const char *name, List<char *> *attrList_a,
RelExpr *child);
bool print(FILE *out);
// int typeCheck(int, TransID &);
int typeCheck(int);
bool rewrite() { return child->rewrite(); }
bool push_down_preds(ClauseList *clauseList)
{
return child->push_down_preds(clauseList);
}
SQLIterator *createIters();
Equivalence_t* PostOrder(Memo_t& memo);
friend class RenameIter;
};
class SelectExpr : public RelExpr {
public:
Expr *cond;
/* $cond$ could be NULL */
RelExpr *child;
void Constructor(Expr *cond_a, RelExpr *child_a);
static SelectExpr *create(Expr *condition, RelExpr *in);
bool print(FILE *out);
// int typeCheck(int, TransID &);
int typeCheck(int);
bool rewrite();
bool push_down_preds(ClauseList *clauseList);
SQLIterator *createIters();
Equivalence_t* PostOrder(Memo_t& memo);
};
class ProjectElem
// To store each projection attribute
{
bool rewrite(TupleDef &bindings_a, ArgSource source_a);
// $rewrite$ assumes that $typeCheck$ has been performed.
bool typeCheck(TupleDef &bindings_a, ArgDef &result_a);
// Type checks $projectionExpr$. Also sets the members of $result_a$.
bool print(FILE *);
friend class GeneralProjectExpr;
public:
char *newName; // introduced by the "AS" clause
Expr *projectionExpr;
};
typedef List<ProjectElem> ProjectElemList;
class GeneralProjectExpr : public RelExpr
// This is the immediate super-class of $ProjectExpr$ and $GroupAggExpr$
{
protected:
enum GeneralProjectExprOp
{
D_PROJECT, D_GROUP_AGG
};
private:
GeneralProjectExprOp op;
protected:
struct
{
int numProjectElems;
ProjectElem *projectElems;
} projList; /* In case of $GroupAggExpr$, each $Expr$ in
$projList$ should be single valued per
group. */
RelExpr *child;
void Constructor(GeneralProjectExprOp op_a, ProjectElemList *projList_a,
RelExpr *child_a);
// int LocalTypeCheck(int, TransID &);
int LocalTypeCheck(int);
/* This function typechecks the $projList$
member, and then sets the $resultInfo$ member. */
bool LocalRewrite();
int LocalPrint(FILE *out);
public:
bool print(FILE *out);
// int typeCheck(int, TransID &);
int typeCheck(int);
bool rewrite();
bool push_down_preds(ClauseList *clauseList);
SQLIterator *createIters();
Equivalence_t* PostOrder(Memo_t& memo);
// Added to Implement typeCheck method of InExpr
ProjectElem* GetProjList()
{
if ( projList.numProjectElems != 1 ) return (NULL);
// Not applicable to InExpr Class
// If Number of attribute projected is more then one
//
return(projList.projectElems);
}
// Project_t *MkProject_t();
};
class ProjectExpr : public GeneralProjectExpr {
void Constructor(ProjectElemList *pList_a, RelExpr *child_a);
public:
static ProjectExpr *create(ProjectElemList *projlist, RelExpr *child);
bool print(FILE *out);
// int typeCheck(int, TransID &);
int typeCheck(int);
bool rewrite();
SQLIterator *createIters();
Equivalence_t* PostOrder(Memo_t& memo);
friend class ProjectIter;
};
class JoinExpr : public RelExpr {
public:
Expr *cond;
/* The $cond$ could be NULL */
RelExpr *left;
RelExpr *right;
void Constructor(Expr *cond_a, RelExpr *left_a, RelExpr *right_a);
static JoinExpr *create(Expr *condition, RelExpr *left, RelExpr
*right);
void addAndExpr(Expr *clause);
bool print(FILE *out);
// int typeCheck(int, TransID &);
int typeCheck(int);
bool rewrite();
bool push_down_preds(ClauseList *clauseList);
SQLIterator *createIters();
Equivalence_t* PostOrder(Memo_t& memo);
};
class GroupAggExpr : public GeneralProjectExpr {
void Constructor(Tuple *gBAttrs_a, ProjectElemList *aggList_a,
RelExpr *child_a);
public:
Tuple *groupByAttrs; // self-suggestive
static GroupAggExpr *create(Tuple *groupByAttrs,
ProjectElemList *aggList, RelExpr *child);
bool print(FILE *out);
// int typeCheck(int, TransID &);
int typeCheck(int);
bool rewrite();
Equivalence_t* PostOrder(Memo_t& memo);
};
class DupelimExpr : public RelExpr {
public:
RelExpr *child;
void Constructor(RelExpr *child_a);
static DupelimExpr *create(RelExpr *child);
bool print(FILE *out);
// int typeCheck(int, TransID &);
int typeCheck(int);
bool rewrite() { return child->rewrite(); }
bool push_down_preds(ClauseList *clauseList)
{
return child->push_down_preds(clauseList);
}
Equivalence_t* PostOrder(Memo_t& memo);
};
class SortExpr : public RelExpr
{
public:
Tuple *sortAttrs;
int direction;
RelExpr *child;
void Constructor(Tuple *sortAttrs_a, int dir_a, RelExpr *child_a);
static SortExpr *create(Tuple *sortAttrs, int dir, RelExpr *child);
bool print(FILE *out);
// int typeCheck(int, TransID &);
int typeCheck(int);
bool rewrite();
bool push_down_preds(ClauseList *clauseList)
{
return child->push_down_preds(clauseList);
}
Equivalence_t* PostOrder(Memo_t& memo);
};
class RelValueExpr : public RelExpr {
public:
Tuple *value;
/* FIX: generalize to allow multiple rows */
void Constructor(Tuple *value_a);
static RelValueExpr *create(Tuple *value);
bool print(FILE *out);
// int typeCheck(int, TransID &);
int typeCheck(int);
bool rewrite() { return true; }
bool push_down_preds(ClauseList *) { return true; }
SQLIterator *createIters();
Equivalence_t* PostOrder(Memo_t& memo);
};
#endif // __REL_ALG_H__
|
b25a3ece3eea2d12b667ad772b0ab8ba4a7eea92
|
3c997c1f6e46c9b9a809e299a54b58956228d9e6
|
/S2Sim/TerraswarmLibrary/SystemVersionPrompt.h
|
2a083348b94221ebe7d6f296e77fffcb02f04a51
|
[] |
no_license
|
asakyurek/S2Sim
|
8897805034e4202d8d6650dc36d2533d1c36ee64
|
7d8fae8d89d327423847deb40ec7164716e53f66
|
refs/heads/master
| 2020-05-17T03:33:37.659916
| 2014-07-08T03:55:36
| 2014-07-08T03:55:36
| 17,011,994
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 6,323
|
h
|
SystemVersionPrompt.h
|
/**
* @file SystemVersionPrompt.h
* Defines the SystemVersionPrompt class.
* @date Apr 29, 2014
* @author: Alper Sinan Akyurek
*/
#ifndef SYSTEMVERSIONPROMPT_H_
#define SYSTEMVERSIONPROMPT_H_
#include "MessageHeader.h"
#include "MessageEnder.h"
namespace TerraSwarm
{
/**
* System Version Prompt message sent from the client to get the current system version.
*/
class SystemVersionPrompt
{
private:
/**
* Message header values.
*/
enum HeaderValues
{
MessageType = 0x0001,
MessageId = 0x0008
};
public:
/**
* Defines the message check result type.
*/
typedef bool TCheckResult;
/**
* Defines the values for TCheckResult.
*/
enum CheckResultValues
{
Success = ( TCheckResult )true, /**< Message is of correct type and id **/
Fail = ( TCheckResult )false /**< Message has incorrect type or id **/
};
private:
/**
* No use. Private constructor to force usage of the static creation method.
*/
SystemVersionPrompt( void );
public:
/**
* Deallocates the memory for the message.
*/
~SystemVersionPrompt( void );
/**
* Creates a new SystemVersionPrompt message and allocates memory for it. @warning Deallocation is the responsibility of the user.
*
* @param senderId Id of the sender.
* @param receiverId Id of the receiver.
*
* @return Returns a new allocated message.
*/
static SystemVersionPrompt*
GetNewSystemVersionPrompt( const MessageHeader::TSenderId senderId,
const MessageHeader::TReceiverId receiverId );
/**
* Checks whether the current memory contains a SystemVersionPrompt message.
*
* @return Result of the check.
*/
TCheckResult
CheckMessage( void ) const;
/**
* Returns the size of the message.
*
* @return Size of the current message.
*/
TDataSize
GetSize( void ) const;
};
/**
* System Version Response message sent from the controller in response to the time prompt.
*/
class SystemVersionResponse
{
private:
/**
* Message header values.
*/
enum HeaderValues
{
MessageType = 0x0001,
MessageId = 0x0009
};
public:
/**
* Defines the message check result type.
*/
typedef bool TCheckResult;
/**
* Defines the values for TCheckResult.
*/
enum CheckResultValues
{
Success = ( TCheckResult )true, /**< Message is of correct type and id **/
Fail = ( TCheckResult )false /**< Message has incorrect type or id **/
};
/**
* Defines the Major Revision value.
*/
typedef unsigned short TMajorVersion;
/**
* Defines the Minor Revision value.
*/
typedef unsigned short TMinorVersion;
private:
/**
* Size values for the data fields.
*/
enum FieldSizeValues
{
MajorVersionSize = sizeof( TMajorVersion ),
MinorVersionSize = sizeof( TMinorVersion )
};
/**
* Index values for the fata fields.
*/
enum FieldIndexValues
{
MajorVersionIndex = MessageHeader::MessageHeaderSize,
MinorVersionIndex = MajorVersionIndex + MajorVersionSize
};
/**
* Accessor helper for the Major Revision field.
*/
typedef NetworkByteAccessor<MajorVersionIndex, MajorVersionSize> TMajorVersionAccessor;
/**
* Accessor helper for the Minor Revision field.
*/
typedef NetworkByteAccessor<MinorVersionIndex, MinorVersionSize> TMinorVersionAccessor;
private:
/**
* No use. Private constructor to force usage of the static creation method.
*/
SystemVersionResponse( void );
public:
/**
* Deallocates the memory for the message.
*/
~SystemVersionResponse( void );
/**
* Creates a new SystemVersionResponse message and allocates memory for it. @warning Deallocation is the responsibility of the user.
*
* @param senderId Id of the sender.
* @param receiverId Id of the receiver.
* @param majorRevision Major Revision of the current software.
* @param minorRevision Minor Revision of the current software.
*
* @return Returns a new allocated message.
*/
static SystemVersionResponse*
GetNewSystemVersionResponse( const MessageHeader::TSenderId senderId,
const MessageHeader::TReceiverId receiverId,
const TMajorVersion majorRevision,
const TMinorVersion minorRevision );
/**
* Checks whether the current memory contains a SystemVersionResponse message.
*
* @return Result of the check.
*/
TCheckResult
CheckMessage( void ) const;
/**
* Reads the Major Revision field in the message.
*
* @return Value of Major Revision in the message.
*/
TMajorVersion
GetMajorVersion( void ) const;
/**
* Reads the Minor Revision field in the message.
*
* @return Value of Minor Revision in the message.
*/
TMinorVersion
GetMinorVersion( void ) const;
/**
* Returns the size of the message.
*
* @return Size of the current message.
*/
TDataSize
GetSize( void ) const;
};
} /* namespace TerraSwarm */
#endif /* SYSTEMVERSIONPROMPT_H_ */
|
39d83962cb196ab0db294c0cc5ad46862982aaeb
|
f86fccc62916a20151e396fb95c256fbb0bd056f
|
/rct_examples/src/tools/noise_qualification_2d.cpp
|
6a9568c59727ab9a8cc010239ee6a3aec930891d
|
[
"Apache-2.0"
] |
permissive
|
Jmeyer1292/robot_cal_tools
|
d43098f2dde224d61fe64492e3fe5dcb25a967ec
|
21d162720ec6902d6b0815adefb9b074e447f15a
|
refs/heads/master
| 2022-05-23T07:57:15.929625
| 2022-05-17T16:24:33
| 2022-05-17T16:24:33
| 133,738,404
| 130
| 37
|
Apache-2.0
| 2022-05-13T19:17:53
| 2018-05-17T00:43:03
|
C++
|
UTF-8
|
C++
| false
| false
| 4,215
|
cpp
|
noise_qualification_2d.cpp
|
#include <rct_optimizations/validation/noise_qualification.h>
#include <rct_ros_tools/data_set.h>
#include <rct_ros_tools/parameter_loaders.h>
#include <rct_ros_tools/target_finder_plugin.h>
#include <rct_ros_tools/loader_utils.h>
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#include <pluginlib/class_loader.h>
#include <ros/ros.h>
#include <yaml-cpp/yaml.h>
using namespace rct_optimizations;
using namespace rct_image_tools;
using namespace rct_ros_tools;
std::string WINDOW = "window";
template<typename T>
T get(const ros::NodeHandle &nh, const std::string &key)
{
T val;
if (!nh.getParam(key, val))
throw std::runtime_error("Failed to get '" + key + "' parameter");
return val;
}
int main(int argc, char** argv)
{
ros::init(argc, argv, "noise_qualification_2d");
ros::NodeHandle pnh("~");
try
{
// Parse parameters
std::string data_path = get<std::string>(pnh, "data_path");
std::string data_file = get<std::string>(pnh, "data_file");
// Load the target finder
auto target_finder_config = get<XmlRpc::XmlRpcValue>(pnh, "target_finder");
const std::string target_finder_type = static_cast<std::string>(target_finder_config["type"]);
pluginlib::ClassLoader<TargetFinderPlugin> loader("rct_ros_tools", "rct_ros_tools::TargetFinderPlugin");
boost::shared_ptr<TargetFinderPlugin> target_finder = loader.createInstance(target_finder_type);
target_finder->init(toYAML(target_finder_config));
// Load camera intrinsics
CameraIntrinsics camera = loadIntrinsics(pnh, "intrinsics");
// Load an initial guess for the camera to target transformation
Eigen::Isometry3d camera_to_target_guess = loadPose(pnh, "camera_to_target_guess");
// Load the data file which specifies the location of the images on which to perform the noise qualification
YAML::Node root = YAML::LoadFile(data_file);
cv::namedWindow(WINDOW, cv::WINDOW_NORMAL);
// Set up the noise qualification inputs
std::vector<PnPProblem> problem_set;
problem_set.reserve(root.size());
for (std::size_t i = 0; i < root.size(); ++i)
{
// Each entry should have an image path. This path is relative to the root_path directory!
const auto img_path = root[i]["image"].as<std::string>();
const std::string image_name = data_path + "/" + img_path;
static cv::Mat image = readImageOpenCV(image_name);
// Find the observations in the image
rct_image_tools::TargetFeatures target_features;
try
{
target_features = target_finder->findTargetFeatures(image);
if (target_features.empty())
throw std::runtime_error("Failed to find any target features");
ROS_INFO_STREAM("Found " << target_features.size() << " target features");
// Show the points we detected
cv::imshow(WINDOW, target_finder->drawTargetFeatures(image, target_features));
cv::waitKey();
}
catch (const std::runtime_error& ex)
{
ROS_WARN_STREAM("Image " << i << ": '" << ex.what() << "'");
cv::imshow(WINDOW, image);
cv::waitKey();
continue;
}
// Set up the PnP problem for this image
PnPProblem problem;
problem.intr = camera;
problem.camera_to_target_guess = camera_to_target_guess;
// Add the detected correspondences
problem.correspondences = target_finder->target().createCorrespondences(target_features);
problem_set.push_back(problem);
}
// Perform the noise qualification
PnPNoiseStat result = qualifyNoise2D(problem_set);
// Print the results
Eigen::IOFormat fmt(4, 0, ",", "\n", "[", "]");
ROS_INFO_STREAM("Camera to Target Noise Results");
ROS_INFO_STREAM("Position mean (m)\n" << result.p_stat.mean.transpose().format(fmt));
ROS_INFO_STREAM("Position standard deviation (m)\n" << result.p_stat.stdev.transpose().format(fmt));
ROS_INFO_STREAM("Quaternion mean (qx, qy, qz, qw)\n" << result.q_stat.mean.coeffs().transpose().format(fmt));
ROS_INFO_STREAM("Quaternion standard deviation\n" << result.q_stat.stdev);
}
catch (const std::exception &ex)
{
ROS_ERROR_STREAM(ex.what());
return -1;
}
return 0;
}
|
926edfabdb3ddbfba650cc87d403818cdfa06590
|
a7764174fb0351ea666faa9f3b5dfe304390a011
|
/src/Xw/Xw_isdefine_typemap.cxx
|
570f0ef1bf919ad49dd64fb22162613fa7332167
|
[] |
no_license
|
uel-dataexchange/Opencascade_uel
|
f7123943e9d8124f4fa67579e3cd3f85cfe52d91
|
06ec93d238d3e3ea2881ff44ba8c21cf870435cd
|
refs/heads/master
| 2022-11-16T07:40:30.837854
| 2020-07-08T01:56:37
| 2020-07-08T01:56:37
| 276,290,778
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 830
|
cxx
|
Xw_isdefine_typemap.cxx
|
#include <Xw_Extension.h>
/* ifdef then trace on */
#ifdef TRACE
#define TRACE_ISDEFINE_TYPEMAP
#endif
/*
XW_STATUS Xw_isdefine_typemap (atypemap):
XW_EXT_TYPEMAP *atypemap
Returns XW_ERROR if Extended Typemap address is not properly defined
Returns XW_SUCCESS if Successful
*/
#ifdef XW_PROTOTYPE
XW_STATUS Xw_isdefine_typemap (void *atypemap)
#else
XW_STATUS Xw_isdefine_typemap (atypemap)
void *atypemap;
#endif /*XW_PROTOTYPE*/
{
XW_EXT_TYPEMAP *ptypemap = (XW_EXT_TYPEMAP*)atypemap;
XW_STATUS status = XW_ERROR ;
if( ptypemap && (ptypemap->type == TYPEMAP_TYPE) ) {
status = XW_SUCCESS ;
}
#ifdef TRACE_ISDEFINE_TYPEMAP
if( Xw_get_trace() > 1 ) {
printf (" %d = Xw_isdefine_typemap(%lx)\n",status,(long ) ptypemap) ;
}
#endif
return (status);
}
|
8cf026a280e6cca63687d7a236feaab90ae0b629
|
3ec174d27d02ccd3102c0887430f5c7606d6f515
|
/3dPolygons+Lighting/src/fileIO.cpp
|
2c92b995b57a4ce58c2e4b3cd02a25376c90922b
|
[] |
no_license
|
awhelan-school/ECS175
|
494564482342c2a011effc57e64e4221da9ed58c
|
b09c0158ce87b6c6ac9325a51c53a4ef997ed561
|
refs/heads/master
| 2021-08-20T06:55:34.132813
| 2017-11-21T05:32:27
| 2017-11-21T05:32:27
| 109,771,644
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 6,182
|
cpp
|
fileIO.cpp
|
#include "fileIO.h"
vector<Material> Mat;
std::string inputFile("./input/test_objs.txt");
void readMaterials(vector<Material> &mat){
std::ifstream materials("./input/raw/raw_materials.txt", std::ios::in);
int token;
if(materials.is_open()){
// Get # of Materials
materials >> token;
Mat.resize(token);
mat.resize(token);
for(int k = 0; k < token; k++){
materials >> Mat[k].Ka.x >> Mat[k].Ka.y >> Mat[k].Ka.z;
materials >> Mat[k].Kd.x >> Mat[k].Kd.y >> Mat[k].Kd.z;
materials >> Mat[k].Ks.x >> Mat[k].Ks.y >> Mat[k].Ks.z;
materials >> Mat[k].n;
}
}
else{
cout << "Unable to Open File: Materials\n";
}
materials.close();
mat = Mat;
}
void readLight(Light &lfx){
std::ifstream lightfx("./input/raw/raw_light.txt", std::ios::in);
if(lightfx.is_open()){
lightfx >> lfx.src.x >> lfx.src.y >> lfx.src.z;
lightfx >> lfx.Ia.x >> lfx.Ia.y >> lfx.Ia.z;
lightfx >> lfx.Il.x >> lfx.Il.y >> lfx.Il.z;
lightfx >> lfx.f;
lightfx >> lfx.K;
}
else{
cout << "Unable to open File LightFX\n";
}
lightfx.close();
}
void readFile(std::vector<Object> &vec, Light &lfx, vector<Material> &mat) {
vec.clear();
getRaw();
std::ifstream infile("./input/raw/raw_test_objs.txt", std::ios::in);
readLight(lfx);
readMaterials(mat);
std::string token;
unsigned int objects = 0, vertices = 0, edges = 0;
unsigned int p1 = 0, p2 = 0, p3 = 0;
unsigned int i = 0, j = 0, k = 0;
if (infile.is_open()) {
infile >> token;
objects = std::stoi(token);
//Allocate for Objects
vec.resize(objects);
for (i = 0; i < objects; i++) {
//GET MaterialID
infile >> vec[i].materialID;
vec[i].mat = Mat[vec[i].materialID - 1];
infile >> vertices;
//Allocate Vertex List
vec[i].vertices = vertices;
vec[i].VList.resize(vertices);
//Allocate for Normal Vectors for Each Vertex
vec[i].NormVecList.resize(vertices);
//Allocate Intensity Vectors
vec[i].Ip0.resize(vertices);
vec[i].Ip1.resize(vertices);
vec[i].Ip2.resize(vertices);
vec[i].Ip3.resize(vertices);
for (j = 0; j < vertices; j++) {
infile >> vec[i].VList[j].xyz[0][0]; //x-coordinate
infile >> vec[i].VList[j].xyz[1][0]; //y-coordinate
infile >> vec[i].VList[j].xyz[2][0]; //z-coordinate
vec[i].VList[j].id = j;
}//ScanVertices
vec[i].center = calculateCenter(vec[i].VList);
//EdgeCount
infile >> edges;
vec[i].TList.resize(edges);
for (k = 0; k < edges; k++) {
infile >> p1 >> p2 >> p3;
vec[i].TList[k].p1 = vec[i].VList[p1 - 1];
vec[i].TList[k].p1.id = p1 - 1;
vec[i].TList[k].p2 = vec[i].VList[p2 - 1];
vec[i].TList[k].p2.id = p2 - 1;
vec[i].TList[k].p3 = vec[i].VList[p3 - 1];
vec[i].TList[k].p3.id = p3 - 1;
vec[i].TList[k].id = i;
}//Make_Edges
//Calculate Normals
calculateNormalV(vec[i]);
calculateIntensity(vec[i], lfx);
}//scanObjects
} else {
std::cout << "Unable to Open File " << inputFile << std::endl;
}
infile.close();
}//ReadData
void writeFile(std::vector<Object> &vec) {
std::ofstream outfile(inputFile, std::ios::trunc);
std::string token;
unsigned int i = 0, j = 0, k = 0;
if (outfile.is_open()) {
//Write Objects Count
outfile << vec.size() << "\n";
for (i = 0; i < vec.size(); i++) {
outfile << vec[i].VList.size() << "\n";
for (j = 0; j < vec[i].VList.size(); j++) {
outfile << vec[i].VList[j].xyz[0][0] << " "; //x-coordinate
outfile << vec[i].VList[j].xyz[1][0] << " "; //y-coordinate
outfile << vec[i].VList[j].xyz[2][0] << "\n"; //z-coordinate
}//ScanVertices
outfile << "\n";
//EdgeCount
outfile << vec[i].TList.size() << "\n";
for (k = 0; k < vec[i].TList.size(); k++) {
outfile << vec[i].TList[k].p1.id << " "
<< vec[i].TList[k].p2.id << " "
<< vec[i].TList[k].p3.id << "\n";
}//Make_Edges
outfile << "\n";
}//scanObjects
} else {
std::cout << "Unable to Open File " << inputFile << std::endl;
}
outfile.close();
}//WriteData
void getRaw() {
std::ofstream outfile("./input/raw/raw_test_objs.txt", std::ios::trunc);
std::ifstream infile(inputFile, std::ios::in);
std::string line;
while (std::getline(infile, line)) {
line.erase(std::find(line.begin(), line.end(), '#'), line.end());
outfile << line << "\n";
}//For All Lines in Object File Filter the Comments
std::ofstream outfile2("./input/raw/raw_light.txt", std::ios::trunc);
std::ifstream infile2("./input/light.txt", std::ios::in);
while (std::getline(infile2, line)) {
line.erase(std::find(line.begin(), line.end(), '#'), line.end());
outfile2 << line << "\n";
}//For All Lines in Light File Filter the Comments
std::ofstream outfile3("./input/raw/raw_materials.txt", std::ios::trunc);
std::ifstream infile3("./input/materials.txt", std::ios::in);
while (std::getline(infile3, line)) {
line.erase(std::find(line.begin(), line.end(), '#'), line.end());
outfile3 << line << "\n";
}//For All Lines in Light File Filter the Comments
}
|
ee1e26688b6276bcd40ee3471e09e6f82bf78a8e
|
b361b6a81e27f120d45aed8a6e46583a1b891a59
|
/Source/UnrealArena/Public/SCharacter.h
|
15b1109a59cdc74729a4d69e18dc012cb3a188a5
|
[] |
no_license
|
ZeroCoolX/UnrealArena
|
8b88b84f4425600530528dd6a00180f82cd9e606
|
4783ea3d17247981e0f99b1f9b0fd9d33e5a6995
|
refs/heads/master
| 2020-06-14T19:27:16.280022
| 2019-08-20T20:54:52
| 2019-08-20T20:54:52
| 195,103,354
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,118
|
h
|
SCharacter.h
|
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "SCharacter.generated.h"
class UCameraComponent;
class USpringArmComponent;
class ASWeapon;
class USHealthComponent;
UCLASS()
class UNREALARENA_API ASCharacter : public ACharacter
{
GENERATED_BODY()
public:
ASCharacter();
virtual void Tick(float DeltaTime) override;
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
virtual FVector GetPawnViewLocation() const override;
UFUNCTION(BlueprintCallable, Category = "Player")
void StartFire();
UFUNCTION(BlueprintCallable, Category = "Player")
void StopFire();
protected:
virtual void BeginPlay() override;
/******** Input /********/
// Movement
void MoveForward(float Direction);
void MoveRight(float Direction);
// Crouch
void BeginCrouch();
void EndCrouch();
// ADS
void BeginZoom();
void EndZoom();
bool bZooming;
UPROPERTY(EditDefaultsOnly, Category = "Player")
float ZoomedFOV;
UPROPERTY(EditDefaultsOnly, Category = "Player", meta = (ClampMin = 0.1f, ClampMax = 100.f))
float ZoomInterpSpeed;
float DefaultFOV;
/******** Weapon /********/
void Fire();
UPROPERTY(EditDefaultsOnly, Category = "Player")
TSubclassOf<ASWeapon> StarterWeaponClass;
UPROPERTY(Replicated)
ASWeapon* CurrentWeapon;
UPROPERTY(VisibleDefaultsOnly, Category = "Player")
FName WeaponAttachSocketName;
/******** Camera Control /********/
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components")
UCameraComponent* CameraComp;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components")
USpringArmComponent* SpringArmComp;
UPROPERTY(Replicated, BlueprintReadOnly, Category = "Player")
bool bDied;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components")
USHealthComponent* HealthComp;
UFUNCTION()
void OnHealthChanged(USHealthComponent* OwningHealthComp, float Health, float DeltaHealth, const class UDamageType* DamageType, class AController* InstigatedBy, AActor* DamageCauser);
};
|
12222557257df9ae345e97d7af0221db074fdc7e
|
0103454b52923519a02260ade79ded03d345efa9
|
/driver/port.build/module.numpy.testing.decorators.cpp
|
f9c7976dc885ab7adf2a8ec6a77ac78affe9217f
|
[] |
no_license
|
podema/echo3d
|
8c7722a942c187a1d9ee01fe3120439cdce7dd6b
|
42af02f01d56c49f0616289b1f601bd1e8dbc643
|
refs/heads/master
| 2016-09-06T16:22:13.043969
| 2015-03-24T10:39:19
| 2015-03-24T10:39:19
| 32,747,234
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 327,333
|
cpp
|
module.numpy.testing.decorators.cpp
|
// Generated code for Python source for module 'numpy.testing.decorators'
// created by Nuitka version 0.5.5.3
// This code is in part copyright 2014 Kay Hayen.
//
// 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 "nuitka/prelude.hpp"
#include "__helpers.hpp"
// The _module_numpy$testing$decorators is a Python object pointer of module type.
// Note: For full compatability with CPython, every module variable access
// needs to go through it except for cases where the module cannot possibly
// have changed in the mean time.
PyObject *module_numpy$testing$decorators;
PyDictObject *moduledict_numpy$testing$decorators;
// The module constants used
extern PyObject *const_int_0;
extern PyObject *const_int_pos_1;
extern PyObject *const_dict_empty;
extern PyObject *const_str_plain_f;
extern PyObject *const_str_plain_l;
extern PyObject *const_str_plain_t;
extern PyObject *const_str_plain_x;
extern PyObject *const_tuple_empty;
static PyObject *const_str_plain_tf;
extern PyObject *const_str_plain_msg;
extern PyObject *const_str_plain_out;
extern PyObject *const_str_plain_args;
extern PyObject *const_str_plain_cond;
extern PyObject *const_str_plain_func;
extern PyObject *const_str_plain_nose;
static PyObject *const_str_plain_slow;
extern PyObject *const_str_plain_util;
extern PyObject *const_str_plain_tools;
extern PyObject *const_str_angle_lambda;
extern PyObject *const_str_plain_always;
extern PyObject *const_str_plain_kwargs;
extern PyObject *const_str_plain_record;
static PyObject *const_str_plain_skipif;
extern PyObject *const_tuple_none_tuple;
extern PyObject *const_tuple_true_tuple;
extern PyObject *const_str_plain___doc__;
static PyObject *const_str_plain_get_msg;
static PyObject *const_str_plain_skipper;
extern PyObject *const_str_plain_Callable;
static PyObject *const_str_plain_SkipTest;
extern PyObject *const_str_plain___exit__;
extern PyObject *const_str_plain___file__;
extern PyObject *const_str_plain___name__;
static PyObject *const_str_plain___test__;
extern PyObject *const_str_plain_category;
extern PyObject *const_str_plain_division;
static PyObject *const_str_plain_fail_val;
static PyObject *const_str_plain_set_test;
static PyObject *const_str_plain_skip_val;
extern PyObject *const_str_plain_warnings;
extern PyObject *const_str_plain___enter__;
static PyObject *const_str_plain_setastest;
extern PyObject *const_str_plain___future__;
extern PyObject *const_str_plain_decorators;
static PyObject *const_str_plain_deprecated;
extern PyObject *const_str_plain_collections;
static PyObject *const_str_plain_conditional;
static PyObject *const_str_plain_isgenerator;
static PyObject *const_str_plain_knownfailer;
extern PyObject *const_str_plain_noseclasses;
static PyObject *const_str_plain_skipper_gen;
extern PyObject *const_str_plain_simplefilter;
static PyObject *const_str_plain_skipper_func;
extern PyObject *const_tuple_str_plain_f_tuple;
extern PyObject *const_tuple_str_plain_t_tuple;
extern PyObject *const_str_plain_catch_warnings;
static PyObject *const_str_plain_fail_condition;
static PyObject *const_str_plain_knownfailureif;
static PyObject *const_str_plain_make_decorator;
extern PyObject *const_str_plain_print_function;
static PyObject *const_str_plain_skip_condition;
static PyObject *const_str_plain_skip_decorator;
static PyObject *const_tuple_str_plain_tf_tuple;
static PyObject *const_str_plain__deprecated_imp;
extern PyObject *const_str_plain_absolute_import;
extern PyObject *const_str_plain_KnownFailureTest;
extern PyObject *const_str_plain_DeprecationWarning;
static PyObject *const_str_plain_deprecate_decorator;
static PyObject *const_str_plain_knownfail_decorator;
static PyObject *const_tuple_str_plain_conditional_tuple;
extern PyObject *const_dict_aae7649b9175b1ed5738500d56e46831;
static PyObject *const_tuple_str_plain_KnownFailureTest_tuple;
static PyObject *const_tuple_str_plain_func_str_plain_msg_tuple;
static PyObject *const_str_digest_07d346a90218147c85cc05f1870721e8;
static PyObject *const_str_digest_16fbe8beab858c2b480e70e3991f2cc7;
static PyObject *const_str_digest_1b5c108d861eb7efd57e6856f5d16339;
static PyObject *const_str_digest_2e61ca36e0ff07c5ae54128222305c14;
static PyObject *const_str_digest_4d4c69f2acb2c3b816bd167203c7e1ae;
static PyObject *const_str_digest_4d73e2f373477bbf3b6881800c9d7fcf;
static PyObject *const_str_digest_60d3a817b17570b5de0e234d358684fc;
static PyObject *const_str_digest_67d31ba9a58fac5a0d23edc7c539684e;
static PyObject *const_str_digest_77b93c11daedc95daaec5bf946942c57;
extern PyObject *const_str_digest_8f6c4ce8673a7969a1a7f3729b7f0ba0;
static PyObject *const_str_digest_aed9c6f05f8bd9ccbb222086ef95db4a;
static PyObject *const_str_digest_b538225c2c14046726b9e5abbec7bc7c;
static PyObject *const_str_digest_cce3eee55d61791558336fd1035509cd;
static PyObject *const_str_digest_da415a408a9e6922e5e2c4732fe86425;
static PyObject *const_str_digest_da8fa3b337a2e15d6c752cd258022f5e;
static PyObject *const_str_digest_f6cc025bc97cf7a68a860190810255ce;
extern PyObject *const_tuple_str_plain_args_str_plain_kwargs_tuple;
static PyObject *const_tuple_str_plain_tf_str_plain_set_test_tuple;
static PyObject *const_tuple_139a0a3a461127184e42b97db42f2fb1_tuple;
static PyObject *const_tuple_17752dca25d3c7aa1f42b9fa89e2895b_tuple;
static PyObject *const_tuple_4b2cc2d291b28955d2af109a0ac670dd_tuple;
static PyObject *const_tuple_4c2b9c8373d0ca89b0e4a6e2125f0112_tuple;
static PyObject *const_tuple_ae886f86fb8663e52cdf52f010f2dded_tuple;
extern PyObject *const_tuple_b3c114ff65e5229953139969fd8f9f4c_tuple;
static PyObject *const_tuple_e13e002de4b8548ee6014fd8954293aa_tuple;
static PyObject *const_tuple_fb387436f2a1aea4cfd01961068c89ba_tuple;
static PyObject *const_tuple_fc40fdad9c4f0652acc6c5c73080636f_tuple;
static PyObject *const_tuple_str_plain_fail_condition_str_plain_msg_tuple;
static PyObject *const_tuple_str_plain_skip_condition_str_plain_msg_tuple;
static PyObject *const_tuple_str_plain_func_str_plain_msg_str_plain_out_tuple;
static PyObject *const_tuple_str_plain_args_str_plain_kwargs_str_plain_l_tuple;
static PyObject *const_tuple_str_plain_conditional_str_plain_deprecate_decorator_tuple;
static void _initModuleConstants(void)
{
const_str_plain_tf = UNSTREAM_STRING( &constant_bin[ 40567 ], 2, 1 );
const_str_plain_slow = UNSTREAM_STRING( &constant_bin[ 61909 ], 4, 1 );
const_str_plain_skipif = UNSTREAM_STRING( &constant_bin[ 2005713 ], 6, 1 );
const_str_plain_get_msg = UNSTREAM_STRING( &constant_bin[ 210449 ], 7, 1 );
const_str_plain_skipper = UNSTREAM_STRING( &constant_bin[ 2005719 ], 7, 1 );
const_str_plain_SkipTest = UNSTREAM_STRING( &constant_bin[ 2005726 ], 8, 1 );
const_str_plain___test__ = UNSTREAM_STRING( &constant_bin[ 2005734 ], 8, 1 );
const_str_plain_fail_val = UNSTREAM_STRING( &constant_bin[ 210562 ], 8, 1 );
const_str_plain_set_test = UNSTREAM_STRING( &constant_bin[ 2005742 ], 8, 1 );
const_str_plain_skip_val = UNSTREAM_STRING( &constant_bin[ 210395 ], 8, 1 );
const_str_plain_setastest = UNSTREAM_STRING( &constant_bin[ 2005750 ], 9, 1 );
const_str_plain_deprecated = UNSTREAM_STRING( &constant_bin[ 336960 ], 10, 1 );
const_str_plain_conditional = UNSTREAM_STRING( &constant_bin[ 210678 ], 11, 1 );
const_str_plain_isgenerator = UNSTREAM_STRING( &constant_bin[ 2005759 ], 11, 1 );
const_str_plain_knownfailer = UNSTREAM_STRING( &constant_bin[ 2005770 ], 11, 1 );
const_str_plain_skipper_gen = UNSTREAM_STRING( &constant_bin[ 2005781 ], 11, 1 );
const_str_plain_skipper_func = UNSTREAM_STRING( &constant_bin[ 2005792 ], 12, 1 );
const_str_plain_fail_condition = UNSTREAM_STRING( &constant_bin[ 210502 ], 14, 1 );
const_str_plain_knownfailureif = UNSTREAM_STRING( &constant_bin[ 2005804 ], 14, 1 );
const_str_plain_make_decorator = UNSTREAM_STRING( &constant_bin[ 2005818 ], 14, 1 );
const_str_plain_skip_condition = UNSTREAM_STRING( &constant_bin[ 210285 ], 14, 1 );
const_str_plain_skip_decorator = UNSTREAM_STRING( &constant_bin[ 2005832 ], 14, 1 );
const_tuple_str_plain_tf_tuple = PyTuple_New( 1 );
PyTuple_SET_ITEM( const_tuple_str_plain_tf_tuple, 0, const_str_plain_tf ); Py_INCREF( const_str_plain_tf );
const_str_plain__deprecated_imp = UNSTREAM_STRING( &constant_bin[ 2005846 ], 15, 1 );
const_str_plain_deprecate_decorator = UNSTREAM_STRING( &constant_bin[ 2005861 ], 19, 1 );
const_str_plain_knownfail_decorator = UNSTREAM_STRING( &constant_bin[ 2005880 ], 19, 1 );
const_tuple_str_plain_conditional_tuple = PyTuple_New( 1 );
PyTuple_SET_ITEM( const_tuple_str_plain_conditional_tuple, 0, const_str_plain_conditional ); Py_INCREF( const_str_plain_conditional );
const_tuple_str_plain_KnownFailureTest_tuple = PyTuple_New( 1 );
PyTuple_SET_ITEM( const_tuple_str_plain_KnownFailureTest_tuple, 0, const_str_plain_KnownFailureTest ); Py_INCREF( const_str_plain_KnownFailureTest );
const_tuple_str_plain_func_str_plain_msg_tuple = PyTuple_New( 2 );
PyTuple_SET_ITEM( const_tuple_str_plain_func_str_plain_msg_tuple, 0, const_str_plain_func ); Py_INCREF( const_str_plain_func );
PyTuple_SET_ITEM( const_tuple_str_plain_func_str_plain_msg_tuple, 1, const_str_plain_msg ); Py_INCREF( const_str_plain_msg );
const_str_digest_07d346a90218147c85cc05f1870721e8 = UNSTREAM_STRING( &constant_bin[ 2005899 ], 60, 0 );
const_str_digest_16fbe8beab858c2b480e70e3991f2cc7 = UNSTREAM_STRING( &constant_bin[ 2005959 ], 665, 0 );
const_str_digest_1b5c108d861eb7efd57e6856f5d16339 = UNSTREAM_STRING( &constant_bin[ 2006624 ], 24, 0 );
const_str_digest_2e61ca36e0ff07c5ae54128222305c14 = UNSTREAM_STRING( &constant_bin[ 2006648 ], 673, 0 );
const_str_digest_4d4c69f2acb2c3b816bd167203c7e1ae = UNSTREAM_STRING( &constant_bin[ 2007321 ], 736, 0 );
const_str_digest_4d73e2f373477bbf3b6881800c9d7fcf = UNSTREAM_STRING( &constant_bin[ 2008057 ], 1010, 0 );
const_str_digest_60d3a817b17570b5de0e234d358684fc = UNSTREAM_STRING( &constant_bin[ 2009067 ], 56, 0 );
const_str_digest_67d31ba9a58fac5a0d23edc7c539684e = UNSTREAM_STRING( &constant_bin[ 2009123 ], 453, 0 );
const_str_digest_77b93c11daedc95daaec5bf946942c57 = UNSTREAM_STRING( &constant_bin[ 2009576 ], 34, 0 );
const_str_digest_aed9c6f05f8bd9ccbb222086ef95db4a = UNSTREAM_STRING( &constant_bin[ 2009610 ], 34, 0 );
const_str_digest_b538225c2c14046726b9e5abbec7bc7c = UNSTREAM_STRING( &constant_bin[ 2009644 ], 28, 0 );
const_str_digest_cce3eee55d61791558336fd1035509cd = UNSTREAM_STRING( &constant_bin[ 2009672 ], 21, 0 );
const_str_digest_da415a408a9e6922e5e2c4732fe86425 = UNSTREAM_STRING( &constant_bin[ 2009693 ], 59, 0 );
const_str_digest_da8fa3b337a2e15d6c752cd258022f5e = UNSTREAM_STRING( &constant_bin[ 2009752 ], 33, 0 );
const_str_digest_f6cc025bc97cf7a68a860190810255ce = UNSTREAM_STRING( &constant_bin[ 2009785 ], 932, 0 );
const_tuple_str_plain_tf_str_plain_set_test_tuple = PyTuple_New( 2 );
PyTuple_SET_ITEM( const_tuple_str_plain_tf_str_plain_set_test_tuple, 0, const_str_plain_tf ); Py_INCREF( const_str_plain_tf );
PyTuple_SET_ITEM( const_tuple_str_plain_tf_str_plain_set_test_tuple, 1, const_str_plain_set_test ); Py_INCREF( const_str_plain_set_test );
const_tuple_139a0a3a461127184e42b97db42f2fb1_tuple = PyTuple_New( 4 );
PyTuple_SET_ITEM( const_tuple_139a0a3a461127184e42b97db42f2fb1_tuple, 0, const_str_plain_args ); Py_INCREF( const_str_plain_args );
PyTuple_SET_ITEM( const_tuple_139a0a3a461127184e42b97db42f2fb1_tuple, 1, const_str_plain_kwargs ); Py_INCREF( const_str_plain_kwargs );
PyTuple_SET_ITEM( const_tuple_139a0a3a461127184e42b97db42f2fb1_tuple, 2, const_str_plain_fail_val ); Py_INCREF( const_str_plain_fail_val );
PyTuple_SET_ITEM( const_tuple_139a0a3a461127184e42b97db42f2fb1_tuple, 3, const_str_plain_KnownFailureTest ); Py_INCREF( const_str_plain_KnownFailureTest );
const_tuple_17752dca25d3c7aa1f42b9fa89e2895b_tuple = PyTuple_New( 5 );
PyTuple_SET_ITEM( const_tuple_17752dca25d3c7aa1f42b9fa89e2895b_tuple, 0, const_str_plain_args ); Py_INCREF( const_str_plain_args );
PyTuple_SET_ITEM( const_tuple_17752dca25d3c7aa1f42b9fa89e2895b_tuple, 1, const_str_plain_kwargs ); Py_INCREF( const_str_plain_kwargs );
PyTuple_SET_ITEM( const_tuple_17752dca25d3c7aa1f42b9fa89e2895b_tuple, 2, const_str_plain_skip_val ); Py_INCREF( const_str_plain_skip_val );
PyTuple_SET_ITEM( const_tuple_17752dca25d3c7aa1f42b9fa89e2895b_tuple, 3, const_str_plain_nose ); Py_INCREF( const_str_plain_nose );
PyTuple_SET_ITEM( const_tuple_17752dca25d3c7aa1f42b9fa89e2895b_tuple, 4, const_str_plain_get_msg ); Py_INCREF( const_str_plain_get_msg );
const_tuple_4b2cc2d291b28955d2af109a0ac670dd_tuple = PyTuple_New( 3 );
PyTuple_SET_ITEM( const_tuple_4b2cc2d291b28955d2af109a0ac670dd_tuple, 0, const_str_plain_skip_condition ); Py_INCREF( const_str_plain_skip_condition );
PyTuple_SET_ITEM( const_tuple_4b2cc2d291b28955d2af109a0ac670dd_tuple, 1, const_str_plain_msg ); Py_INCREF( const_str_plain_msg );
PyTuple_SET_ITEM( const_tuple_4b2cc2d291b28955d2af109a0ac670dd_tuple, 2, const_str_plain_skip_decorator ); Py_INCREF( const_str_plain_skip_decorator );
const_tuple_4c2b9c8373d0ca89b0e4a6e2125f0112_tuple = PyTuple_New( 4 );
PyTuple_SET_ITEM( const_tuple_4c2b9c8373d0ca89b0e4a6e2125f0112_tuple, 0, const_str_plain_f ); Py_INCREF( const_str_plain_f );
PyTuple_SET_ITEM( const_tuple_4c2b9c8373d0ca89b0e4a6e2125f0112_tuple, 1, const_str_plain_nose ); Py_INCREF( const_str_plain_nose );
PyTuple_SET_ITEM( const_tuple_4c2b9c8373d0ca89b0e4a6e2125f0112_tuple, 2, const_str_plain_KnownFailureTest ); Py_INCREF( const_str_plain_KnownFailureTest );
PyTuple_SET_ITEM( const_tuple_4c2b9c8373d0ca89b0e4a6e2125f0112_tuple, 3, const_str_plain_knownfailer ); Py_INCREF( const_str_plain_knownfailer );
const_tuple_ae886f86fb8663e52cdf52f010f2dded_tuple = PyTuple_New( 6 );
PyTuple_SET_ITEM( const_tuple_ae886f86fb8663e52cdf52f010f2dded_tuple, 0, const_str_plain_args ); Py_INCREF( const_str_plain_args );
PyTuple_SET_ITEM( const_tuple_ae886f86fb8663e52cdf52f010f2dded_tuple, 1, const_str_plain_kwargs ); Py_INCREF( const_str_plain_kwargs );
PyTuple_SET_ITEM( const_tuple_ae886f86fb8663e52cdf52f010f2dded_tuple, 2, const_str_plain_x ); Py_INCREF( const_str_plain_x );
PyTuple_SET_ITEM( const_tuple_ae886f86fb8663e52cdf52f010f2dded_tuple, 3, const_str_plain_skip_val ); Py_INCREF( const_str_plain_skip_val );
PyTuple_SET_ITEM( const_tuple_ae886f86fb8663e52cdf52f010f2dded_tuple, 4, const_str_plain_nose ); Py_INCREF( const_str_plain_nose );
PyTuple_SET_ITEM( const_tuple_ae886f86fb8663e52cdf52f010f2dded_tuple, 5, const_str_plain_get_msg ); Py_INCREF( const_str_plain_get_msg );
const_tuple_e13e002de4b8548ee6014fd8954293aa_tuple = PyTuple_New( 4 );
PyTuple_SET_ITEM( const_tuple_e13e002de4b8548ee6014fd8954293aa_tuple, 0, const_str_plain_fail_condition ); Py_INCREF( const_str_plain_fail_condition );
PyTuple_SET_ITEM( const_tuple_e13e002de4b8548ee6014fd8954293aa_tuple, 1, const_str_plain_msg ); Py_INCREF( const_str_plain_msg );
PyTuple_SET_ITEM( const_tuple_e13e002de4b8548ee6014fd8954293aa_tuple, 2, const_str_plain_fail_val ); Py_INCREF( const_str_plain_fail_val );
PyTuple_SET_ITEM( const_tuple_e13e002de4b8548ee6014fd8954293aa_tuple, 3, const_str_plain_knownfail_decorator ); Py_INCREF( const_str_plain_knownfail_decorator );
const_tuple_fb387436f2a1aea4cfd01961068c89ba_tuple = PyTuple_New( 7 );
PyTuple_SET_ITEM( const_tuple_fb387436f2a1aea4cfd01961068c89ba_tuple, 0, const_str_plain_f ); Py_INCREF( const_str_plain_f );
PyTuple_SET_ITEM( const_tuple_fb387436f2a1aea4cfd01961068c89ba_tuple, 1, const_str_plain_nose ); Py_INCREF( const_str_plain_nose );
PyTuple_SET_ITEM( const_tuple_fb387436f2a1aea4cfd01961068c89ba_tuple, 2, const_str_plain_skip_val ); Py_INCREF( const_str_plain_skip_val );
PyTuple_SET_ITEM( const_tuple_fb387436f2a1aea4cfd01961068c89ba_tuple, 3, const_str_plain_get_msg ); Py_INCREF( const_str_plain_get_msg );
PyTuple_SET_ITEM( const_tuple_fb387436f2a1aea4cfd01961068c89ba_tuple, 4, const_str_plain_skipper_func ); Py_INCREF( const_str_plain_skipper_func );
PyTuple_SET_ITEM( const_tuple_fb387436f2a1aea4cfd01961068c89ba_tuple, 5, const_str_plain_skipper_gen ); Py_INCREF( const_str_plain_skipper_gen );
PyTuple_SET_ITEM( const_tuple_fb387436f2a1aea4cfd01961068c89ba_tuple, 6, const_str_plain_skipper ); Py_INCREF( const_str_plain_skipper );
const_tuple_fc40fdad9c4f0652acc6c5c73080636f_tuple = PyTuple_New( 5 );
PyTuple_SET_ITEM( const_tuple_fc40fdad9c4f0652acc6c5c73080636f_tuple, 0, const_str_plain_f ); Py_INCREF( const_str_plain_f );
PyTuple_SET_ITEM( const_tuple_fc40fdad9c4f0652acc6c5c73080636f_tuple, 1, const_str_plain_nose ); Py_INCREF( const_str_plain_nose );
PyTuple_SET_ITEM( const_tuple_fc40fdad9c4f0652acc6c5c73080636f_tuple, 2, const_str_plain_KnownFailureTest ); Py_INCREF( const_str_plain_KnownFailureTest );
PyTuple_SET_ITEM( const_tuple_fc40fdad9c4f0652acc6c5c73080636f_tuple, 3, const_str_plain__deprecated_imp ); Py_INCREF( const_str_plain__deprecated_imp );
PyTuple_SET_ITEM( const_tuple_fc40fdad9c4f0652acc6c5c73080636f_tuple, 4, const_str_plain_cond ); Py_INCREF( const_str_plain_cond );
const_tuple_str_plain_fail_condition_str_plain_msg_tuple = PyTuple_New( 2 );
PyTuple_SET_ITEM( const_tuple_str_plain_fail_condition_str_plain_msg_tuple, 0, const_str_plain_fail_condition ); Py_INCREF( const_str_plain_fail_condition );
PyTuple_SET_ITEM( const_tuple_str_plain_fail_condition_str_plain_msg_tuple, 1, const_str_plain_msg ); Py_INCREF( const_str_plain_msg );
const_tuple_str_plain_skip_condition_str_plain_msg_tuple = PyTuple_New( 2 );
PyTuple_SET_ITEM( const_tuple_str_plain_skip_condition_str_plain_msg_tuple, 0, const_str_plain_skip_condition ); Py_INCREF( const_str_plain_skip_condition );
PyTuple_SET_ITEM( const_tuple_str_plain_skip_condition_str_plain_msg_tuple, 1, const_str_plain_msg ); Py_INCREF( const_str_plain_msg );
const_tuple_str_plain_func_str_plain_msg_str_plain_out_tuple = PyTuple_New( 3 );
PyTuple_SET_ITEM( const_tuple_str_plain_func_str_plain_msg_str_plain_out_tuple, 0, const_str_plain_func ); Py_INCREF( const_str_plain_func );
PyTuple_SET_ITEM( const_tuple_str_plain_func_str_plain_msg_str_plain_out_tuple, 1, const_str_plain_msg ); Py_INCREF( const_str_plain_msg );
PyTuple_SET_ITEM( const_tuple_str_plain_func_str_plain_msg_str_plain_out_tuple, 2, const_str_plain_out ); Py_INCREF( const_str_plain_out );
const_tuple_str_plain_args_str_plain_kwargs_str_plain_l_tuple = PyTuple_New( 3 );
PyTuple_SET_ITEM( const_tuple_str_plain_args_str_plain_kwargs_str_plain_l_tuple, 0, const_str_plain_args ); Py_INCREF( const_str_plain_args );
PyTuple_SET_ITEM( const_tuple_str_plain_args_str_plain_kwargs_str_plain_l_tuple, 1, const_str_plain_kwargs ); Py_INCREF( const_str_plain_kwargs );
PyTuple_SET_ITEM( const_tuple_str_plain_args_str_plain_kwargs_str_plain_l_tuple, 2, const_str_plain_l ); Py_INCREF( const_str_plain_l );
const_tuple_str_plain_conditional_str_plain_deprecate_decorator_tuple = PyTuple_New( 2 );
PyTuple_SET_ITEM( const_tuple_str_plain_conditional_str_plain_deprecate_decorator_tuple, 0, const_str_plain_conditional ); Py_INCREF( const_str_plain_conditional );
PyTuple_SET_ITEM( const_tuple_str_plain_conditional_str_plain_deprecate_decorator_tuple, 1, const_str_plain_deprecate_decorator ); Py_INCREF( const_str_plain_deprecate_decorator );
}
// The module code objects.
static PyCodeObject *codeobj_38d1a85c0c830f4f214d9ffc5eb9df27;
static PyCodeObject *codeobj_2b2ac8416d57591c0ed51a03292717a9;
static PyCodeObject *codeobj_309d7c4278ed80dc856b730b1d6b856c;
static PyCodeObject *codeobj_df08a236890a6fe25bd887010405ccbd;
static PyCodeObject *codeobj_c0a4b60f265895b23c38123a5039f46e;
static PyCodeObject *codeobj_4c8e788bd9c3c132dd9f7f669b296a0f;
static PyCodeObject *codeobj_9066537bf9ba3d43769ab81db6dcdbba;
static PyCodeObject *codeobj_af3bfc072ee41a616775b66edc349ae0;
static PyCodeObject *codeobj_971aa7347ecde98875db1a9d8bc6e4e2;
static PyCodeObject *codeobj_2f7a5b07a91aaba658b6bdb2664f75e6;
static PyCodeObject *codeobj_59de52f77071b586304ff5779949659a;
static PyCodeObject *codeobj_bd9304085c0017625f820777b98bc1c8;
static PyCodeObject *codeobj_78c9d7e35c39c80b20e65dadb516a29d;
static PyCodeObject *codeobj_b49401aaae2582f8d210111f5bd22faa;
static PyCodeObject *codeobj_fa648496dd5cde07493f4a4585e6ae2d;
static PyCodeObject *codeobj_3f988eaf18b4fc56137ae30ab67e55cc;
static PyCodeObject *codeobj_7fd5d8e86ca4426d24010b3b74ce6c24;
static PyCodeObject *codeobj_88f84882d8f39ca911b2ba4696dd2c39;
static PyCodeObject *codeobj_14d159542df56d28a0bc9125d5dd5ba0;
static PyCodeObject *codeobj_16b57bbb21d7fa07ad3a93de9c8978aa;
static PyCodeObject *codeobj_ce4b3a3c8f8b271bee9fa0bea5d018a3;
static PyCodeObject *codeobj_4bacfe779d09e9ef976dc08e12b002d7;
static PyCodeObject *codeobj_5b84598f122e664bc1e887c30127805c;
static PyCodeObject *codeobj_109b678cb9a869e39e079ab1653d3590;
static PyCodeObject *codeobj_c386b1dc36506b085af58ae4035185e9;
static PyCodeObject *codeobj_12d8f43c6102a74fc5c582620e35e8fb;
static PyCodeObject *codeobj_91afb59a1dc50640f8f2d44615c96cfe;
static PyCodeObject *codeobj_fa50ff54d73f9224f3e1637cacd081a7;
static PyCodeObject *codeobj_ede3fa1e264fb4431b96b88a61b0c0d1;
static PyCodeObject *codeobj_321d09f72fe480faec3a87df8a221548;
static PyCodeObject *codeobj_f5066506c1ce2528546e194440edfea6;
static PyCodeObject *codeobj_664e7a8feec95c848eceb654e1e3cd12;
static void _initModuleCodeObjects(void)
{
codeobj_38d1a85c0c830f4f214d9ffc5eb9df27 = MAKE_CODEOBJ( const_str_digest_07d346a90218147c85cc05f1870721e8, const_str_angle_lambda, 126, const_tuple_empty, 0, CO_NEWLOCALS | CO_OPTIMIZED | CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_PRINT_FUNCTION );
codeobj_2b2ac8416d57591c0ed51a03292717a9 = MAKE_CODEOBJ( const_str_digest_07d346a90218147c85cc05f1870721e8, const_str_angle_lambda, 128, const_tuple_empty, 0, CO_NEWLOCALS | CO_OPTIMIZED | CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_PRINT_FUNCTION );
codeobj_309d7c4278ed80dc856b730b1d6b856c = MAKE_CODEOBJ( const_str_digest_07d346a90218147c85cc05f1870721e8, const_str_angle_lambda, 202, const_tuple_empty, 0, CO_NEWLOCALS | CO_OPTIMIZED | CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_PRINT_FUNCTION );
codeobj_df08a236890a6fe25bd887010405ccbd = MAKE_CODEOBJ( const_str_digest_07d346a90218147c85cc05f1870721e8, const_str_angle_lambda, 204, const_tuple_empty, 0, CO_NEWLOCALS | CO_OPTIMIZED | CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_PRINT_FUNCTION );
codeobj_c0a4b60f265895b23c38123a5039f46e = MAKE_CODEOBJ( const_str_digest_07d346a90218147c85cc05f1870721e8, const_str_plain__deprecated_imp, 251, const_tuple_str_plain_args_str_plain_kwargs_tuple, 2, CO_NEWLOCALS | CO_OPTIMIZED | CO_VARARGS | CO_VARKEYWORDS | CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_PRINT_FUNCTION );
codeobj_4c8e788bd9c3c132dd9f7f669b296a0f = MAKE_CODEOBJ( const_str_digest_07d346a90218147c85cc05f1870721e8, const_str_plain__deprecated_imp, 251, const_tuple_str_plain_args_str_plain_kwargs_str_plain_l_tuple, 0, CO_NEWLOCALS | CO_OPTIMIZED | CO_VARARGS | CO_VARKEYWORDS | CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_PRINT_FUNCTION );
codeobj_9066537bf9ba3d43769ab81db6dcdbba = MAKE_CODEOBJ( const_str_digest_07d346a90218147c85cc05f1870721e8, const_str_plain_decorators, 0, const_tuple_empty, 0, CO_NOFREE | CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_PRINT_FUNCTION );
codeobj_af3bfc072ee41a616775b66edc349ae0 = MAKE_CODEOBJ( const_str_digest_07d346a90218147c85cc05f1870721e8, const_str_plain_deprecate_decorator, 245, const_tuple_str_plain_f_tuple, 1, CO_NEWLOCALS | CO_OPTIMIZED | CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_PRINT_FUNCTION );
codeobj_971aa7347ecde98875db1a9d8bc6e4e2 = MAKE_CODEOBJ( const_str_digest_07d346a90218147c85cc05f1870721e8, const_str_plain_deprecate_decorator, 245, const_tuple_fc40fdad9c4f0652acc6c5c73080636f_tuple, 1, CO_NEWLOCALS | CO_OPTIMIZED | CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_PRINT_FUNCTION );
codeobj_2f7a5b07a91aaba658b6bdb2664f75e6 = MAKE_CODEOBJ( const_str_digest_07d346a90218147c85cc05f1870721e8, const_str_plain_deprecated, 220, const_tuple_str_plain_conditional_tuple, 1, CO_NEWLOCALS | CO_OPTIMIZED | CO_NOFREE | CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_PRINT_FUNCTION );
codeobj_59de52f77071b586304ff5779949659a = MAKE_CODEOBJ( const_str_digest_07d346a90218147c85cc05f1870721e8, const_str_plain_deprecated, 220, const_tuple_str_plain_conditional_str_plain_deprecate_decorator_tuple, 1, CO_NEWLOCALS | CO_OPTIMIZED | CO_NOFREE | CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_PRINT_FUNCTION );
codeobj_bd9304085c0017625f820777b98bc1c8 = MAKE_CODEOBJ( const_str_digest_07d346a90218147c85cc05f1870721e8, const_str_plain_get_msg, 130, const_tuple_str_plain_func_str_plain_msg_tuple, 2, CO_NEWLOCALS | CO_OPTIMIZED | CO_NOFREE | CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_PRINT_FUNCTION );
codeobj_78c9d7e35c39c80b20e65dadb516a29d = MAKE_CODEOBJ( const_str_digest_07d346a90218147c85cc05f1870721e8, const_str_plain_get_msg, 130, const_tuple_str_plain_func_str_plain_msg_str_plain_out_tuple, 2, CO_NEWLOCALS | CO_OPTIMIZED | CO_NOFREE | CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_PRINT_FUNCTION );
codeobj_b49401aaae2582f8d210111f5bd22faa = MAKE_CODEOBJ( const_str_digest_07d346a90218147c85cc05f1870721e8, const_str_plain_knownfail_decorator, 206, const_tuple_str_plain_f_tuple, 1, CO_NEWLOCALS | CO_OPTIMIZED | CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_PRINT_FUNCTION );
codeobj_fa648496dd5cde07493f4a4585e6ae2d = MAKE_CODEOBJ( const_str_digest_07d346a90218147c85cc05f1870721e8, const_str_plain_knownfail_decorator, 206, const_tuple_4c2b9c8373d0ca89b0e4a6e2125f0112_tuple, 1, CO_NEWLOCALS | CO_OPTIMIZED | CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_PRINT_FUNCTION );
codeobj_3f988eaf18b4fc56137ae30ab67e55cc = MAKE_CODEOBJ( const_str_digest_07d346a90218147c85cc05f1870721e8, const_str_plain_knownfailer, 211, const_tuple_str_plain_args_str_plain_kwargs_tuple, 2, CO_NEWLOCALS | CO_OPTIMIZED | CO_VARARGS | CO_VARKEYWORDS | CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_PRINT_FUNCTION );
codeobj_7fd5d8e86ca4426d24010b3b74ce6c24 = MAKE_CODEOBJ( const_str_digest_07d346a90218147c85cc05f1870721e8, const_str_plain_knownfailer, 211, const_tuple_139a0a3a461127184e42b97db42f2fb1_tuple, 0, CO_NEWLOCALS | CO_OPTIMIZED | CO_VARARGS | CO_VARKEYWORDS | CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_PRINT_FUNCTION );
codeobj_88f84882d8f39ca911b2ba4696dd2c39 = MAKE_CODEOBJ( const_str_digest_07d346a90218147c85cc05f1870721e8, const_str_plain_knownfailureif, 167, const_tuple_str_plain_fail_condition_str_plain_msg_tuple, 2, CO_NEWLOCALS | CO_OPTIMIZED | CO_NOFREE | CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_PRINT_FUNCTION );
codeobj_14d159542df56d28a0bc9125d5dd5ba0 = MAKE_CODEOBJ( const_str_digest_07d346a90218147c85cc05f1870721e8, const_str_plain_knownfailureif, 167, const_tuple_e13e002de4b8548ee6014fd8954293aa_tuple, 2, CO_NEWLOCALS | CO_OPTIMIZED | CO_NOFREE | CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_PRINT_FUNCTION );
codeobj_16b57bbb21d7fa07ad3a93de9c8978aa = MAKE_CODEOBJ( const_str_digest_07d346a90218147c85cc05f1870721e8, const_str_plain_set_test, 85, const_tuple_str_plain_t_tuple, 1, CO_NEWLOCALS | CO_OPTIMIZED | CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_PRINT_FUNCTION );
codeobj_ce4b3a3c8f8b271bee9fa0bea5d018a3 = MAKE_CODEOBJ( const_str_digest_07d346a90218147c85cc05f1870721e8, const_str_plain_setastest, 57, const_tuple_str_plain_tf_tuple, 1, CO_NEWLOCALS | CO_OPTIMIZED | CO_NOFREE | CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_PRINT_FUNCTION );
codeobj_4bacfe779d09e9ef976dc08e12b002d7 = MAKE_CODEOBJ( const_str_digest_07d346a90218147c85cc05f1870721e8, const_str_plain_setastest, 57, const_tuple_str_plain_tf_str_plain_set_test_tuple, 1, CO_NEWLOCALS | CO_OPTIMIZED | CO_NOFREE | CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_PRINT_FUNCTION );
codeobj_5b84598f122e664bc1e887c30127805c = MAKE_CODEOBJ( const_str_digest_07d346a90218147c85cc05f1870721e8, const_str_plain_skip_decorator, 119, const_tuple_str_plain_f_tuple, 1, CO_NEWLOCALS | CO_OPTIMIZED | CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_PRINT_FUNCTION );
codeobj_109b678cb9a869e39e079ab1653d3590 = MAKE_CODEOBJ( const_str_digest_07d346a90218147c85cc05f1870721e8, const_str_plain_skip_decorator, 119, const_tuple_fb387436f2a1aea4cfd01961068c89ba_tuple, 1, CO_NEWLOCALS | CO_OPTIMIZED | CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_PRINT_FUNCTION );
codeobj_c386b1dc36506b085af58ae4035185e9 = MAKE_CODEOBJ( const_str_digest_07d346a90218147c85cc05f1870721e8, const_str_plain_skipif, 90, const_tuple_str_plain_skip_condition_str_plain_msg_tuple, 2, CO_NEWLOCALS | CO_OPTIMIZED | CO_NOFREE | CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_PRINT_FUNCTION );
codeobj_12d8f43c6102a74fc5c582620e35e8fb = MAKE_CODEOBJ( const_str_digest_07d346a90218147c85cc05f1870721e8, const_str_plain_skipif, 90, const_tuple_4b2cc2d291b28955d2af109a0ac670dd_tuple, 2, CO_NEWLOCALS | CO_OPTIMIZED | CO_NOFREE | CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_PRINT_FUNCTION );
codeobj_91afb59a1dc50640f8f2d44615c96cfe = MAKE_CODEOBJ( const_str_digest_07d346a90218147c85cc05f1870721e8, const_str_plain_skipper_func, 141, const_tuple_str_plain_args_str_plain_kwargs_tuple, 2, CO_NEWLOCALS | CO_OPTIMIZED | CO_VARARGS | CO_VARKEYWORDS | CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_PRINT_FUNCTION );
codeobj_fa50ff54d73f9224f3e1637cacd081a7 = MAKE_CODEOBJ( const_str_digest_07d346a90218147c85cc05f1870721e8, const_str_plain_skipper_func, 141, const_tuple_17752dca25d3c7aa1f42b9fa89e2895b_tuple, 0, CO_NEWLOCALS | CO_OPTIMIZED | CO_VARARGS | CO_VARKEYWORDS | CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_PRINT_FUNCTION );
codeobj_ede3fa1e264fb4431b96b88a61b0c0d1 = MAKE_CODEOBJ( const_str_digest_07d346a90218147c85cc05f1870721e8, const_str_plain_skipper_gen, 148, const_tuple_str_plain_args_str_plain_kwargs_tuple, 0, CO_NEWLOCALS | CO_GENERATOR | CO_OPTIMIZED | CO_VARARGS | CO_VARKEYWORDS | CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_PRINT_FUNCTION );
codeobj_321d09f72fe480faec3a87df8a221548 = MAKE_CODEOBJ( const_str_digest_07d346a90218147c85cc05f1870721e8, const_str_plain_skipper_gen, 148, const_tuple_str_plain_args_str_plain_kwargs_tuple, 2, CO_NEWLOCALS | CO_GENERATOR | CO_OPTIMIZED | CO_VARARGS | CO_VARKEYWORDS | CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_PRINT_FUNCTION );
codeobj_f5066506c1ce2528546e194440edfea6 = MAKE_CODEOBJ( const_str_digest_07d346a90218147c85cc05f1870721e8, const_str_plain_skipper_gen, 148, const_tuple_ae886f86fb8663e52cdf52f010f2dded_tuple, 0, CO_NEWLOCALS | CO_GENERATOR | CO_OPTIMIZED | CO_VARARGS | CO_VARKEYWORDS | CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_PRINT_FUNCTION );
codeobj_664e7a8feec95c848eceb654e1e3cd12 = MAKE_CODEOBJ( const_str_digest_07d346a90218147c85cc05f1870721e8, const_str_plain_slow, 22, const_tuple_str_plain_t_tuple, 1, CO_NEWLOCALS | CO_OPTIMIZED | CO_NOFREE | CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_PRINT_FUNCTION );
}
// The module function declarations.
NUITKA_CROSS_MODULE PyObject *impl_function_2_complex_call_helper_star_list_star_dict_of_module___internal__( PyObject *_python_par_called, PyObject *_python_par_star_arg_list, PyObject *_python_par_star_arg_dict );
static PyObject *MAKE_FUNCTION_function_1__deprecated_imp_of_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators( PyObjectSharedLocalVariable &closure_f );
// This structure is for attachment as self of function_1__deprecated_imp_of_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators.
// It is allocated at the time the function object is created.
struct _context_function_1__deprecated_imp_of_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators_t
{
// The function can access a read-only closure of the creator.
PyObjectSharedLocalVariable closure_f;
};
static void _context_function_1__deprecated_imp_of_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators_destructor( void *context_voidptr )
{
_context_function_1__deprecated_imp_of_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators_t *_python_context = (_context_function_1__deprecated_imp_of_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators_t *)context_voidptr;
delete _python_context;
}
static PyObject *MAKE_FUNCTION_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators( PyObjectSharedLocalVariable &closure_conditional );
// This structure is for attachment as self of function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators.
// It is allocated at the time the function object is created.
struct _context_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators_t
{
// The function can access a read-only closure of the creator.
PyObjectSharedLocalVariable closure_conditional;
};
static void _context_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators_destructor( void *context_voidptr )
{
_context_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators_t *_python_context = (_context_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators_t *)context_voidptr;
delete _python_context;
}
static PyObject *MAKE_FUNCTION_function_1_knownfailer_of_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators( PyObjectSharedLocalVariable &closure_KnownFailureTest, PyObjectSharedLocalVariable &closure_f, PyObjectSharedLocalVariable &closure_fail_val, PyObjectSharedLocalVariable &closure_msg );
// This structure is for attachment as self of function_1_knownfailer_of_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators.
// It is allocated at the time the function object is created.
struct _context_function_1_knownfailer_of_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators_t
{
// The function can access a read-only closure of the creator.
PyObjectSharedLocalVariable closure_KnownFailureTest;
PyObjectSharedLocalVariable closure_f;
PyObjectSharedLocalVariable closure_fail_val;
PyObjectSharedLocalVariable closure_msg;
};
static void _context_function_1_knownfailer_of_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators_destructor( void *context_voidptr )
{
_context_function_1_knownfailer_of_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators_t *_python_context = (_context_function_1_knownfailer_of_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators_t *)context_voidptr;
delete _python_context;
}
static PyObject *MAKE_FUNCTION_function_1_set_test_of_function_2_setastest_of_module_numpy$testing$decorators( PyObjectSharedLocalVariable &closure_tf );
// This structure is for attachment as self of function_1_set_test_of_function_2_setastest_of_module_numpy$testing$decorators.
// It is allocated at the time the function object is created.
struct _context_function_1_set_test_of_function_2_setastest_of_module_numpy$testing$decorators_t
{
// The function can access a read-only closure of the creator.
PyObjectSharedLocalVariable closure_tf;
};
static void _context_function_1_set_test_of_function_2_setastest_of_module_numpy$testing$decorators_destructor( void *context_voidptr )
{
_context_function_1_set_test_of_function_2_setastest_of_module_numpy$testing$decorators_t *_python_context = (_context_function_1_set_test_of_function_2_setastest_of_module_numpy$testing$decorators_t *)context_voidptr;
delete _python_context;
}
static PyObject *MAKE_FUNCTION_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( PyObjectSharedLocalVariable &closure_msg, PyObjectSharedLocalVariable &closure_skip_condition );
// This structure is for attachment as self of function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators.
// It is allocated at the time the function object is created.
struct _context_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t
{
// The function can access a read-only closure of the creator.
PyObjectSharedLocalVariable closure_msg;
PyObjectSharedLocalVariable closure_skip_condition;
};
static void _context_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_destructor( void *context_voidptr )
{
_context_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t *_python_context = (_context_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t *)context_voidptr;
delete _python_context;
}
static PyObject *MAKE_FUNCTION_function_1_slow_of_module_numpy$testing$decorators( );
static PyObject *MAKE_FUNCTION_function_2_setastest_of_module_numpy$testing$decorators( PyObject *defaults );
static PyObject *MAKE_FUNCTION_function_3_get_msg_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( PyObject *defaults );
static PyObject *MAKE_FUNCTION_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators( PyObjectSharedLocalVariable &closure_fail_val, PyObjectSharedLocalVariable &closure_msg );
// This structure is for attachment as self of function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators.
// It is allocated at the time the function object is created.
struct _context_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators_t
{
// The function can access a read-only closure of the creator.
PyObjectSharedLocalVariable closure_fail_val;
PyObjectSharedLocalVariable closure_msg;
};
static void _context_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators_destructor( void *context_voidptr )
{
_context_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators_t *_python_context = (_context_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators_t *)context_voidptr;
delete _python_context;
}
static PyObject *MAKE_FUNCTION_function_3_skipif_of_module_numpy$testing$decorators( PyObject *defaults );
static PyObject *MAKE_FUNCTION_function_4_knownfailureif_of_module_numpy$testing$decorators( PyObject *defaults );
static PyObject *MAKE_FUNCTION_function_4_skipper_func_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( PyObjectSharedLocalVariable &closure_f, PyObjectSharedLocalVariable &closure_get_msg, PyObjectSharedLocalVariable &closure_msg, PyObjectSharedLocalVariable &closure_nose, PyObjectSharedLocalVariable &closure_skip_val );
// This structure is for attachment as self of function_4_skipper_func_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators.
// It is allocated at the time the function object is created.
struct _context_function_4_skipper_func_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t
{
// The function can access a read-only closure of the creator.
PyObjectSharedLocalVariable closure_f;
PyObjectSharedLocalVariable closure_get_msg;
PyObjectSharedLocalVariable closure_msg;
PyObjectSharedLocalVariable closure_nose;
PyObjectSharedLocalVariable closure_skip_val;
};
static void _context_function_4_skipper_func_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_destructor( void *context_voidptr )
{
_context_function_4_skipper_func_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t *_python_context = (_context_function_4_skipper_func_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t *)context_voidptr;
delete _python_context;
}
static PyObject *MAKE_FUNCTION_function_5_deprecated_of_module_numpy$testing$decorators( PyObject *defaults );
static PyObject *MAKE_FUNCTION_function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( PyObjectSharedLocalVariable &closure_f, PyObjectSharedLocalVariable &closure_get_msg, PyObjectSharedLocalVariable &closure_msg, PyObjectSharedLocalVariable &closure_nose, PyObjectSharedLocalVariable &closure_skip_val );
static PyObject *MAKE_FUNCTION_lambda_1_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( PyObjectSharedLocalVariable &closure_skip_condition );
// This structure is for attachment as self of lambda_1_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators.
// It is allocated at the time the function object is created.
struct _context_lambda_1_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t
{
// The function can access a read-only closure of the creator.
PyObjectSharedLocalVariable closure_skip_condition;
};
static void _context_lambda_1_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_destructor( void *context_voidptr )
{
_context_lambda_1_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t *_python_context = (_context_lambda_1_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t *)context_voidptr;
delete _python_context;
}
static PyObject *MAKE_FUNCTION_lambda_1_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators( PyObjectSharedLocalVariable &closure_fail_condition );
// This structure is for attachment as self of lambda_1_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators.
// It is allocated at the time the function object is created.
struct _context_lambda_1_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators_t
{
// The function can access a read-only closure of the creator.
PyObjectSharedLocalVariable closure_fail_condition;
};
static void _context_lambda_1_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators_destructor( void *context_voidptr )
{
_context_lambda_1_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators_t *_python_context = (_context_lambda_1_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators_t *)context_voidptr;
delete _python_context;
}
static PyObject *MAKE_FUNCTION_lambda_2_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( PyObjectSharedLocalVariable &closure_skip_condition );
// This structure is for attachment as self of lambda_2_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators.
// It is allocated at the time the function object is created.
struct _context_lambda_2_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t
{
// The function can access a read-only closure of the creator.
PyObjectSharedLocalVariable closure_skip_condition;
};
static void _context_lambda_2_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_destructor( void *context_voidptr )
{
_context_lambda_2_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t *_python_context = (_context_lambda_2_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t *)context_voidptr;
delete _python_context;
}
static PyObject *MAKE_FUNCTION_lambda_2_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators( PyObjectSharedLocalVariable &closure_fail_condition );
// This structure is for attachment as self of lambda_2_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators.
// It is allocated at the time the function object is created.
struct _context_lambda_2_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators_t
{
// The function can access a read-only closure of the creator.
PyObjectSharedLocalVariable closure_fail_condition;
};
static void _context_lambda_2_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators_destructor( void *context_voidptr )
{
_context_lambda_2_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators_t *_python_context = (_context_lambda_2_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators_t *)context_voidptr;
delete _python_context;
}
// The module function definitions.
static PyObject *impl_function_1_slow_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject *_python_par_t )
{
// No context is used.
// Local variable declarations.
PyObjectLocalVariable par_t; par_t.object = _python_par_t;
PyObject *exception_type = NULL, *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
PyObject *tmp_assattr_name_1;
PyObject *tmp_assattr_target_1;
PyObject *tmp_frame_locals;
bool tmp_result;
PyObject *tmp_return_value;
tmp_return_value = NULL;
// Actual function code.
static PyFrameObject *cache_frame_function = NULL;
MAKE_OR_REUSE_FRAME( cache_frame_function, codeobj_664e7a8feec95c848eceb654e1e3cd12, module_numpy$testing$decorators );
PyFrameObject *frame_function = cache_frame_function;
// Push the new frame as the currently active one.
pushFrameStack( frame_function );
// Mark the frame object as in use, ref count 1 will be up for reuse.
Py_INCREF( frame_function );
assert( Py_REFCNT( frame_function ) == 2 ); // Frame stack
#if PYTHON_VERSION >= 340
frame_function->f_executing += 1;
#endif
// Framed code:
tmp_assattr_name_1 = Py_True;
tmp_assattr_target_1 = par_t.object;
if ( tmp_assattr_target_1 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 4881 ], 47, 0 );
exception_tb = NULL;
frame_function->f_lineno = 54;
goto frame_exception_exit_1;
}
tmp_result = SET_ATTRIBUTE( tmp_assattr_target_1, const_str_plain_slow, tmp_assattr_name_1 );
if ( tmp_result == false )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 54;
goto frame_exception_exit_1;
}
tmp_return_value = par_t.object;
if ( tmp_return_value == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 4881 ], 47, 0 );
exception_tb = NULL;
frame_function->f_lineno = 55;
goto frame_exception_exit_1;
}
Py_INCREF( tmp_return_value );
goto frame_return_exit_1;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
// Put the previous frame back on top.
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
goto frame_no_exception_1;
frame_return_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
goto function_return_exit;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
}
else if ( exception_tb->tb_frame != frame_function )
{
PyTracebackObject *traceback_new = (PyTracebackObject *)MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
traceback_new->tb_next = exception_tb;
exception_tb = traceback_new;
}
tmp_frame_locals = PyDict_New();
if ((par_t.object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_t,
par_t.object
);
}
detachFrame( exception_tb, tmp_frame_locals );
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
// Return the error.
goto function_exception_exit;
frame_no_exception_1:;
// Return statement must be present.
assert(false);
function_exception_exit:
assert( exception_type );
PyErr_Restore( exception_type, exception_value, (PyObject *)exception_tb );
return NULL;
function_return_exit:
return tmp_return_value;
}
static PyObject *fparse_function_1_slow_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, Py_ssize_t args_size, PyObject *kw )
{
assert( kw == NULL || PyDict_Check( kw ) );
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_size = kw ? PyDict_Size( kw ) : 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_found = 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_only_found = 0;
Py_ssize_t args_given = args_size;
PyObject *_python_par_t = NULL;
// Copy given dictionary values to the the respective variables:
if ( kw_size > 0 )
{
Py_ssize_t ppos = 0;
PyObject *key, *value;
while( PyDict_Next( kw, &ppos, &key, &value ) )
{
#if PYTHON_VERSION < 300
if (unlikely( !PyString_Check( key ) && !PyUnicode_Check( key ) ))
#else
if (unlikely( !PyUnicode_Check( key ) ))
#endif
{
PyErr_Format( PyExc_TypeError, "slow() keywords must be strings" );
goto error_exit;
}
NUITKA_MAY_BE_UNUSED bool found = false;
Py_INCREF( key );
Py_INCREF( value );
// Quick path, could be our value.
if ( found == false && const_str_plain_t == key )
{
assert( _python_par_t == NULL );
_python_par_t = value;
found = true;
kw_found += 1;
}
// Slow path, compare against all parameter names.
if ( found == false && RICH_COMPARE_BOOL_EQ( const_str_plain_t, key ) == 1 )
{
assert( _python_par_t == NULL );
_python_par_t = value;
found = true;
kw_found += 1;
}
Py_DECREF( key );
if ( found == false )
{
Py_DECREF( value );
PyErr_Format(
PyExc_TypeError,
"slow() got an unexpected keyword argument '%s'",
Nuitka_String_Check( key ) ? Nuitka_String_AsString( key ) : "<non-string>"
);
goto error_exit;
}
}
#if PYTHON_VERSION < 300
assert( kw_found == kw_size );
assert( kw_only_found == 0 );
#endif
}
// Check if too many arguments were given in case of non star args
if (unlikely( args_given > 1 ))
{
#if PYTHON_VERSION < 270
ERROR_TOO_MANY_ARGUMENTS( self, args_given, kw_size );
#elif PYTHON_VERSION < 330
ERROR_TOO_MANY_ARGUMENTS( self, args_given + kw_found );
#else
ERROR_TOO_MANY_ARGUMENTS( self, args_given, kw_only_found );
#endif
goto error_exit;
}
// Copy normal parameter values given as part of the args list to the respective variables:
if (likely( 0 < args_given ))
{
if (unlikely( _python_par_t != NULL ))
{
ERROR_MULTIPLE_VALUES( self, 0 );
goto error_exit;
}
_python_par_t = INCREASE_REFCOUNT( args[ 0 ] );
}
else if ( _python_par_t == NULL )
{
if ( 0 + self->m_defaults_given >= 1 )
{
_python_par_t = INCREASE_REFCOUNT( PyTuple_GET_ITEM( self->m_defaults, self->m_defaults_given + 0 - 1 ) );
}
#if PYTHON_VERSION < 330
else
{
#if PYTHON_VERSION < 270
ERROR_TOO_FEW_ARGUMENTS( self, kw_size, args_given + kw_found );
#elif PYTHON_VERSION < 300
ERROR_TOO_FEW_ARGUMENTS( self, args_given + kw_found );
#else
ERROR_TOO_FEW_ARGUMENTS( self, args_given + kw_found - kw_only_found );
#endif
goto error_exit;
}
#endif
}
#if PYTHON_VERSION >= 330
if (unlikely( _python_par_t == NULL ))
{
PyObject *values[] = { _python_par_t };
ERROR_TOO_FEW_ARGUMENTS( self, values );
goto error_exit;
}
#endif
return impl_function_1_slow_of_module_numpy$testing$decorators( self, _python_par_t );
error_exit:;
Py_XDECREF( _python_par_t );
return NULL;
}
static PyObject *dparse_function_1_slow_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, int size )
{
if ( size == 1 )
{
return impl_function_1_slow_of_module_numpy$testing$decorators( self, INCREASE_REFCOUNT( args[ 0 ] ) );
}
else
{
PyObject *result = fparse_function_1_slow_of_module_numpy$testing$decorators( self, args, size, NULL );
return result;
}
}
static PyObject *impl_function_2_setastest_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject *_python_par_tf )
{
// No context is used.
// Local variable declarations.
PyObjectSharedLocalVariable par_tf; par_tf.storage->object = _python_par_tf;
PyObjectLocalVariable var_set_test;
PyObject *exception_type = NULL, *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
PyObject *tmp_assign_source_1;
PyObject *tmp_frame_locals;
PyObject *tmp_return_value;
tmp_return_value = NULL;
// Actual function code.
static PyFrameObject *cache_frame_function = NULL;
MAKE_OR_REUSE_FRAME( cache_frame_function, codeobj_ce4b3a3c8f8b271bee9fa0bea5d018a3, module_numpy$testing$decorators );
PyFrameObject *frame_function = cache_frame_function;
// Push the new frame as the currently active one.
pushFrameStack( frame_function );
// Mark the frame object as in use, ref count 1 will be up for reuse.
Py_INCREF( frame_function );
assert( Py_REFCNT( frame_function ) == 2 ); // Frame stack
#if PYTHON_VERSION >= 340
frame_function->f_executing += 1;
#endif
// Framed code:
tmp_assign_source_1 = MAKE_FUNCTION_function_1_set_test_of_function_2_setastest_of_module_numpy$testing$decorators( par_tf );
if ( tmp_assign_source_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
Py_DECREF( tmp_assign_source_1 );
frame_function->f_lineno = 85;
goto frame_exception_exit_1;
}
assert( var_set_test.object == NULL );
var_set_test.object = tmp_assign_source_1;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
// Put the previous frame back on top.
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
goto frame_no_exception_1;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
}
else if ( exception_tb->tb_frame != frame_function )
{
PyTracebackObject *traceback_new = (PyTracebackObject *)MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
traceback_new->tb_next = exception_tb;
exception_tb = traceback_new;
}
tmp_frame_locals = PyDict_New();
if ((var_set_test.object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_set_test,
var_set_test.object
);
}
if ((par_tf.storage != NULL && par_tf.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_tf,
par_tf.storage->object
);
}
detachFrame( exception_tb, tmp_frame_locals );
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
// Return the error.
goto function_exception_exit;
frame_no_exception_1:;
tmp_return_value = var_set_test.object;
Py_INCREF( tmp_return_value );
goto function_return_exit;
// Return statement must be present.
assert(false);
function_exception_exit:
assert( exception_type );
PyErr_Restore( exception_type, exception_value, (PyObject *)exception_tb );
return NULL;
function_return_exit:
return tmp_return_value;
}
static PyObject *fparse_function_2_setastest_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, Py_ssize_t args_size, PyObject *kw )
{
assert( kw == NULL || PyDict_Check( kw ) );
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_size = kw ? PyDict_Size( kw ) : 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_found = 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_only_found = 0;
Py_ssize_t args_given = args_size;
PyObject *_python_par_tf = NULL;
// Copy given dictionary values to the the respective variables:
if ( kw_size > 0 )
{
Py_ssize_t ppos = 0;
PyObject *key, *value;
while( PyDict_Next( kw, &ppos, &key, &value ) )
{
#if PYTHON_VERSION < 300
if (unlikely( !PyString_Check( key ) && !PyUnicode_Check( key ) ))
#else
if (unlikely( !PyUnicode_Check( key ) ))
#endif
{
PyErr_Format( PyExc_TypeError, "setastest() keywords must be strings" );
goto error_exit;
}
NUITKA_MAY_BE_UNUSED bool found = false;
Py_INCREF( key );
Py_INCREF( value );
// Quick path, could be our value.
if ( found == false && const_str_plain_tf == key )
{
assert( _python_par_tf == NULL );
_python_par_tf = value;
found = true;
kw_found += 1;
}
// Slow path, compare against all parameter names.
if ( found == false && RICH_COMPARE_BOOL_EQ( const_str_plain_tf, key ) == 1 )
{
assert( _python_par_tf == NULL );
_python_par_tf = value;
found = true;
kw_found += 1;
}
Py_DECREF( key );
if ( found == false )
{
Py_DECREF( value );
PyErr_Format(
PyExc_TypeError,
"setastest() got an unexpected keyword argument '%s'",
Nuitka_String_Check( key ) ? Nuitka_String_AsString( key ) : "<non-string>"
);
goto error_exit;
}
}
#if PYTHON_VERSION < 300
assert( kw_found == kw_size );
assert( kw_only_found == 0 );
#endif
}
// Check if too many arguments were given in case of non star args
if (unlikely( args_given > 1 ))
{
#if PYTHON_VERSION < 270
ERROR_TOO_MANY_ARGUMENTS( self, args_given, kw_size );
#elif PYTHON_VERSION < 330
ERROR_TOO_MANY_ARGUMENTS( self, args_given + kw_found );
#else
ERROR_TOO_MANY_ARGUMENTS( self, args_given, kw_only_found );
#endif
goto error_exit;
}
// Copy normal parameter values given as part of the args list to the respective variables:
if (likely( 0 < args_given ))
{
if (unlikely( _python_par_tf != NULL ))
{
ERROR_MULTIPLE_VALUES( self, 0 );
goto error_exit;
}
_python_par_tf = INCREASE_REFCOUNT( args[ 0 ] );
}
else if ( _python_par_tf == NULL )
{
if ( 0 + self->m_defaults_given >= 1 )
{
_python_par_tf = INCREASE_REFCOUNT( PyTuple_GET_ITEM( self->m_defaults, self->m_defaults_given + 0 - 1 ) );
}
#if PYTHON_VERSION < 330
else
{
#if PYTHON_VERSION < 270
ERROR_TOO_FEW_ARGUMENTS( self, kw_size, args_given + kw_found );
#elif PYTHON_VERSION < 300
ERROR_TOO_FEW_ARGUMENTS( self, args_given + kw_found );
#else
ERROR_TOO_FEW_ARGUMENTS( self, args_given + kw_found - kw_only_found );
#endif
goto error_exit;
}
#endif
}
#if PYTHON_VERSION >= 330
if (unlikely( _python_par_tf == NULL ))
{
PyObject *values[] = { _python_par_tf };
ERROR_TOO_FEW_ARGUMENTS( self, values );
goto error_exit;
}
#endif
return impl_function_2_setastest_of_module_numpy$testing$decorators( self, _python_par_tf );
error_exit:;
Py_XDECREF( _python_par_tf );
return NULL;
}
static PyObject *dparse_function_2_setastest_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, int size )
{
if ( size == 1 )
{
return impl_function_2_setastest_of_module_numpy$testing$decorators( self, INCREASE_REFCOUNT( args[ 0 ] ) );
}
else
{
PyObject *result = fparse_function_2_setastest_of_module_numpy$testing$decorators( self, args, size, NULL );
return result;
}
}
static PyObject *impl_function_1_set_test_of_function_2_setastest_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject *_python_par_t )
{
// The context of the function.
struct _context_function_1_set_test_of_function_2_setastest_of_module_numpy$testing$decorators_t *_python_context = (struct _context_function_1_set_test_of_function_2_setastest_of_module_numpy$testing$decorators_t *)self->m_context;
// Local variable declarations.
PyObjectLocalVariable par_t; par_t.object = _python_par_t;
PyObject *exception_type = NULL, *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
PyObject *tmp_assattr_name_1;
PyObject *tmp_assattr_target_1;
PyObject *tmp_frame_locals;
bool tmp_result;
PyObject *tmp_return_value;
tmp_return_value = NULL;
// Actual function code.
static PyFrameObject *cache_frame_function = NULL;
MAKE_OR_REUSE_FRAME( cache_frame_function, codeobj_16b57bbb21d7fa07ad3a93de9c8978aa, module_numpy$testing$decorators );
PyFrameObject *frame_function = cache_frame_function;
// Push the new frame as the currently active one.
pushFrameStack( frame_function );
// Mark the frame object as in use, ref count 1 will be up for reuse.
Py_INCREF( frame_function );
assert( Py_REFCNT( frame_function ) == 2 ); // Frame stack
#if PYTHON_VERSION >= 340
frame_function->f_executing += 1;
#endif
// Framed code:
tmp_assattr_name_1 = _python_context->closure_tf.storage->object;
if ( tmp_assattr_name_1 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 210221 ], 48, 0 );
exception_tb = NULL;
frame_function->f_lineno = 86;
goto frame_exception_exit_1;
}
tmp_assattr_target_1 = par_t.object;
if ( tmp_assattr_target_1 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 4881 ], 47, 0 );
exception_tb = NULL;
frame_function->f_lineno = 86;
goto frame_exception_exit_1;
}
tmp_result = SET_ATTRIBUTE( tmp_assattr_target_1, const_str_plain___test__, tmp_assattr_name_1 );
if ( tmp_result == false )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 86;
goto frame_exception_exit_1;
}
tmp_return_value = par_t.object;
if ( tmp_return_value == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 4881 ], 47, 0 );
exception_tb = NULL;
frame_function->f_lineno = 87;
goto frame_exception_exit_1;
}
Py_INCREF( tmp_return_value );
goto frame_return_exit_1;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
// Put the previous frame back on top.
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
goto frame_no_exception_1;
frame_return_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
goto function_return_exit;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
}
else if ( exception_tb->tb_frame != frame_function )
{
PyTracebackObject *traceback_new = (PyTracebackObject *)MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
traceback_new->tb_next = exception_tb;
exception_tb = traceback_new;
}
tmp_frame_locals = PyDict_New();
if ((par_t.object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_t,
par_t.object
);
}
if ((_python_context->closure_tf.storage != NULL && _python_context->closure_tf.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_tf,
_python_context->closure_tf.storage->object
);
}
detachFrame( exception_tb, tmp_frame_locals );
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
// Return the error.
goto function_exception_exit;
frame_no_exception_1:;
// Return statement must be present.
assert(false);
function_exception_exit:
assert( exception_type );
PyErr_Restore( exception_type, exception_value, (PyObject *)exception_tb );
return NULL;
function_return_exit:
return tmp_return_value;
}
static PyObject *fparse_function_1_set_test_of_function_2_setastest_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, Py_ssize_t args_size, PyObject *kw )
{
assert( kw == NULL || PyDict_Check( kw ) );
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_size = kw ? PyDict_Size( kw ) : 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_found = 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_only_found = 0;
Py_ssize_t args_given = args_size;
PyObject *_python_par_t = NULL;
// Copy given dictionary values to the the respective variables:
if ( kw_size > 0 )
{
Py_ssize_t ppos = 0;
PyObject *key, *value;
while( PyDict_Next( kw, &ppos, &key, &value ) )
{
#if PYTHON_VERSION < 300
if (unlikely( !PyString_Check( key ) && !PyUnicode_Check( key ) ))
#else
if (unlikely( !PyUnicode_Check( key ) ))
#endif
{
PyErr_Format( PyExc_TypeError, "set_test() keywords must be strings" );
goto error_exit;
}
NUITKA_MAY_BE_UNUSED bool found = false;
Py_INCREF( key );
Py_INCREF( value );
// Quick path, could be our value.
if ( found == false && const_str_plain_t == key )
{
assert( _python_par_t == NULL );
_python_par_t = value;
found = true;
kw_found += 1;
}
// Slow path, compare against all parameter names.
if ( found == false && RICH_COMPARE_BOOL_EQ( const_str_plain_t, key ) == 1 )
{
assert( _python_par_t == NULL );
_python_par_t = value;
found = true;
kw_found += 1;
}
Py_DECREF( key );
if ( found == false )
{
Py_DECREF( value );
PyErr_Format(
PyExc_TypeError,
"set_test() got an unexpected keyword argument '%s'",
Nuitka_String_Check( key ) ? Nuitka_String_AsString( key ) : "<non-string>"
);
goto error_exit;
}
}
#if PYTHON_VERSION < 300
assert( kw_found == kw_size );
assert( kw_only_found == 0 );
#endif
}
// Check if too many arguments were given in case of non star args
if (unlikely( args_given > 1 ))
{
#if PYTHON_VERSION < 270
ERROR_TOO_MANY_ARGUMENTS( self, args_given, kw_size );
#elif PYTHON_VERSION < 330
ERROR_TOO_MANY_ARGUMENTS( self, args_given + kw_found );
#else
ERROR_TOO_MANY_ARGUMENTS( self, args_given, kw_only_found );
#endif
goto error_exit;
}
// Copy normal parameter values given as part of the args list to the respective variables:
if (likely( 0 < args_given ))
{
if (unlikely( _python_par_t != NULL ))
{
ERROR_MULTIPLE_VALUES( self, 0 );
goto error_exit;
}
_python_par_t = INCREASE_REFCOUNT( args[ 0 ] );
}
else if ( _python_par_t == NULL )
{
if ( 0 + self->m_defaults_given >= 1 )
{
_python_par_t = INCREASE_REFCOUNT( PyTuple_GET_ITEM( self->m_defaults, self->m_defaults_given + 0 - 1 ) );
}
#if PYTHON_VERSION < 330
else
{
#if PYTHON_VERSION < 270
ERROR_TOO_FEW_ARGUMENTS( self, kw_size, args_given + kw_found );
#elif PYTHON_VERSION < 300
ERROR_TOO_FEW_ARGUMENTS( self, args_given + kw_found );
#else
ERROR_TOO_FEW_ARGUMENTS( self, args_given + kw_found - kw_only_found );
#endif
goto error_exit;
}
#endif
}
#if PYTHON_VERSION >= 330
if (unlikely( _python_par_t == NULL ))
{
PyObject *values[] = { _python_par_t };
ERROR_TOO_FEW_ARGUMENTS( self, values );
goto error_exit;
}
#endif
return impl_function_1_set_test_of_function_2_setastest_of_module_numpy$testing$decorators( self, _python_par_t );
error_exit:;
Py_XDECREF( _python_par_t );
return NULL;
}
static PyObject *dparse_function_1_set_test_of_function_2_setastest_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, int size )
{
if ( size == 1 )
{
return impl_function_1_set_test_of_function_2_setastest_of_module_numpy$testing$decorators( self, INCREASE_REFCOUNT( args[ 0 ] ) );
}
else
{
PyObject *result = fparse_function_1_set_test_of_function_2_setastest_of_module_numpy$testing$decorators( self, args, size, NULL );
return result;
}
}
static PyObject *impl_function_3_skipif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject *_python_par_skip_condition, PyObject *_python_par_msg )
{
// No context is used.
// Local variable declarations.
PyObjectSharedLocalVariable par_skip_condition; par_skip_condition.storage->object = _python_par_skip_condition;
PyObjectSharedLocalVariable par_msg; par_msg.storage->object = _python_par_msg;
PyObjectLocalVariable var_skip_decorator;
PyObject *exception_type = NULL, *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
PyObject *tmp_assign_source_1;
PyObject *tmp_frame_locals;
PyObject *tmp_return_value;
tmp_return_value = NULL;
// Actual function code.
static PyFrameObject *cache_frame_function = NULL;
MAKE_OR_REUSE_FRAME( cache_frame_function, codeobj_c386b1dc36506b085af58ae4035185e9, module_numpy$testing$decorators );
PyFrameObject *frame_function = cache_frame_function;
// Push the new frame as the currently active one.
pushFrameStack( frame_function );
// Mark the frame object as in use, ref count 1 will be up for reuse.
Py_INCREF( frame_function );
assert( Py_REFCNT( frame_function ) == 2 ); // Frame stack
#if PYTHON_VERSION >= 340
frame_function->f_executing += 1;
#endif
// Framed code:
tmp_assign_source_1 = MAKE_FUNCTION_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( par_msg, par_skip_condition );
if ( tmp_assign_source_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
Py_DECREF( tmp_assign_source_1 );
frame_function->f_lineno = 119;
goto frame_exception_exit_1;
}
assert( var_skip_decorator.object == NULL );
var_skip_decorator.object = tmp_assign_source_1;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
// Put the previous frame back on top.
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
goto frame_no_exception_1;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
}
else if ( exception_tb->tb_frame != frame_function )
{
PyTracebackObject *traceback_new = (PyTracebackObject *)MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
traceback_new->tb_next = exception_tb;
exception_tb = traceback_new;
}
tmp_frame_locals = PyDict_New();
if ((var_skip_decorator.object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_skip_decorator,
var_skip_decorator.object
);
}
if ((par_skip_condition.storage != NULL && par_skip_condition.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_skip_condition,
par_skip_condition.storage->object
);
}
if ((par_msg.storage != NULL && par_msg.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_msg,
par_msg.storage->object
);
}
detachFrame( exception_tb, tmp_frame_locals );
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
// Return the error.
goto function_exception_exit;
frame_no_exception_1:;
tmp_return_value = var_skip_decorator.object;
Py_INCREF( tmp_return_value );
goto function_return_exit;
// Return statement must be present.
assert(false);
function_exception_exit:
assert( exception_type );
PyErr_Restore( exception_type, exception_value, (PyObject *)exception_tb );
return NULL;
function_return_exit:
return tmp_return_value;
}
static PyObject *fparse_function_3_skipif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, Py_ssize_t args_size, PyObject *kw )
{
assert( kw == NULL || PyDict_Check( kw ) );
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_size = kw ? PyDict_Size( kw ) : 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_found = 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_only_found = 0;
Py_ssize_t args_given = args_size;
PyObject *_python_par_skip_condition = NULL;
PyObject *_python_par_msg = NULL;
// Copy given dictionary values to the the respective variables:
if ( kw_size > 0 )
{
Py_ssize_t ppos = 0;
PyObject *key, *value;
while( PyDict_Next( kw, &ppos, &key, &value ) )
{
#if PYTHON_VERSION < 300
if (unlikely( !PyString_Check( key ) && !PyUnicode_Check( key ) ))
#else
if (unlikely( !PyUnicode_Check( key ) ))
#endif
{
PyErr_Format( PyExc_TypeError, "skipif() keywords must be strings" );
goto error_exit;
}
NUITKA_MAY_BE_UNUSED bool found = false;
Py_INCREF( key );
Py_INCREF( value );
// Quick path, could be our value.
if ( found == false && const_str_plain_skip_condition == key )
{
assert( _python_par_skip_condition == NULL );
_python_par_skip_condition = value;
found = true;
kw_found += 1;
}
if ( found == false && const_str_plain_msg == key )
{
assert( _python_par_msg == NULL );
_python_par_msg = value;
found = true;
kw_found += 1;
}
// Slow path, compare against all parameter names.
if ( found == false && RICH_COMPARE_BOOL_EQ( const_str_plain_skip_condition, key ) == 1 )
{
assert( _python_par_skip_condition == NULL );
_python_par_skip_condition = value;
found = true;
kw_found += 1;
}
if ( found == false && RICH_COMPARE_BOOL_EQ( const_str_plain_msg, key ) == 1 )
{
assert( _python_par_msg == NULL );
_python_par_msg = value;
found = true;
kw_found += 1;
}
Py_DECREF( key );
if ( found == false )
{
Py_DECREF( value );
PyErr_Format(
PyExc_TypeError,
"skipif() got an unexpected keyword argument '%s'",
Nuitka_String_Check( key ) ? Nuitka_String_AsString( key ) : "<non-string>"
);
goto error_exit;
}
}
#if PYTHON_VERSION < 300
assert( kw_found == kw_size );
assert( kw_only_found == 0 );
#endif
}
// Check if too many arguments were given in case of non star args
if (unlikely( args_given > 2 ))
{
#if PYTHON_VERSION < 270
ERROR_TOO_MANY_ARGUMENTS( self, args_given, kw_size );
#elif PYTHON_VERSION < 330
ERROR_TOO_MANY_ARGUMENTS( self, args_given + kw_found );
#else
ERROR_TOO_MANY_ARGUMENTS( self, args_given, kw_only_found );
#endif
goto error_exit;
}
// Copy normal parameter values given as part of the args list to the respective variables:
if (likely( 0 < args_given ))
{
if (unlikely( _python_par_skip_condition != NULL ))
{
ERROR_MULTIPLE_VALUES( self, 0 );
goto error_exit;
}
_python_par_skip_condition = INCREASE_REFCOUNT( args[ 0 ] );
}
else if ( _python_par_skip_condition == NULL )
{
if ( 0 + self->m_defaults_given >= 2 )
{
_python_par_skip_condition = INCREASE_REFCOUNT( PyTuple_GET_ITEM( self->m_defaults, self->m_defaults_given + 0 - 2 ) );
}
#if PYTHON_VERSION < 330
else
{
#if PYTHON_VERSION < 270
ERROR_TOO_FEW_ARGUMENTS( self, kw_size, args_given + kw_found );
#elif PYTHON_VERSION < 300
ERROR_TOO_FEW_ARGUMENTS( self, args_given + kw_found );
#else
ERROR_TOO_FEW_ARGUMENTS( self, args_given + kw_found - kw_only_found );
#endif
goto error_exit;
}
#endif
}
if (likely( 1 < args_given ))
{
if (unlikely( _python_par_msg != NULL ))
{
ERROR_MULTIPLE_VALUES( self, 1 );
goto error_exit;
}
_python_par_msg = INCREASE_REFCOUNT( args[ 1 ] );
}
else if ( _python_par_msg == NULL )
{
if ( 1 + self->m_defaults_given >= 2 )
{
_python_par_msg = INCREASE_REFCOUNT( PyTuple_GET_ITEM( self->m_defaults, self->m_defaults_given + 1 - 2 ) );
}
#if PYTHON_VERSION < 330
else
{
#if PYTHON_VERSION < 270
ERROR_TOO_FEW_ARGUMENTS( self, kw_size, args_given + kw_found );
#elif PYTHON_VERSION < 300
ERROR_TOO_FEW_ARGUMENTS( self, args_given + kw_found );
#else
ERROR_TOO_FEW_ARGUMENTS( self, args_given + kw_found - kw_only_found );
#endif
goto error_exit;
}
#endif
}
#if PYTHON_VERSION >= 330
if (unlikely( _python_par_skip_condition == NULL || _python_par_msg == NULL ))
{
PyObject *values[] = { _python_par_skip_condition, _python_par_msg };
ERROR_TOO_FEW_ARGUMENTS( self, values );
goto error_exit;
}
#endif
return impl_function_3_skipif_of_module_numpy$testing$decorators( self, _python_par_skip_condition, _python_par_msg );
error_exit:;
Py_XDECREF( _python_par_skip_condition );
Py_XDECREF( _python_par_msg );
return NULL;
}
static PyObject *dparse_function_3_skipif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, int size )
{
if ( size == 2 )
{
return impl_function_3_skipif_of_module_numpy$testing$decorators( self, INCREASE_REFCOUNT( args[ 0 ] ), INCREASE_REFCOUNT( args[ 1 ] ) );
}
else
{
PyObject *result = fparse_function_3_skipif_of_module_numpy$testing$decorators( self, args, size, NULL );
return result;
}
}
static PyObject *impl_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject *_python_par_f )
{
// The context of the function.
struct _context_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t *_python_context = (struct _context_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t *)self->m_context;
// Local variable declarations.
PyObjectSharedLocalVariable par_f; par_f.storage->object = _python_par_f;
PyObjectSharedLocalVariable var_nose;
PyObjectSharedLocalVariable var_skip_val;
PyObjectSharedLocalVariable var_get_msg;
PyObjectLocalVariable var_skipper_func;
PyObjectLocalVariable var_skipper_gen;
PyObjectLocalVariable var_skipper;
PyObject *exception_type = NULL, *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
PyObject *tmp_assign_source_1;
PyObject *tmp_assign_source_2;
PyObject *tmp_assign_source_3;
PyObject *tmp_assign_source_4;
PyObject *tmp_assign_source_5;
PyObject *tmp_assign_source_6;
PyObject *tmp_assign_source_7;
PyObject *tmp_assign_source_8;
PyObject *tmp_call_arg_element_1;
PyObject *tmp_call_arg_element_2;
PyObject *tmp_call_arg_element_3;
PyObject *tmp_called_1;
PyObject *tmp_called_2;
PyObject *tmp_called_3;
int tmp_cond_truth_1;
PyObject *tmp_cond_value_1;
PyObject *tmp_defaults_1;
PyObject *tmp_frame_locals;
PyObject *tmp_import_globals_1;
PyObject *tmp_import_locals_1;
PyObject *tmp_isinstance_cls_1;
PyObject *tmp_isinstance_inst_1;
int tmp_res;
PyObject *tmp_return_value;
PyObject *tmp_source_name_1;
PyObject *tmp_source_name_2;
PyObject *tmp_source_name_3;
PyObject *tmp_source_name_4;
PyObject *tmp_source_name_5;
tmp_return_value = NULL;
// Actual function code.
static PyFrameObject *cache_frame_function = NULL;
MAKE_OR_REUSE_FRAME( cache_frame_function, codeobj_5b84598f122e664bc1e887c30127805c, module_numpy$testing$decorators );
PyFrameObject *frame_function = cache_frame_function;
// Push the new frame as the currently active one.
pushFrameStack( frame_function );
// Mark the frame object as in use, ref count 1 will be up for reuse.
Py_INCREF( frame_function );
assert( Py_REFCNT( frame_function ) == 2 ); // Frame stack
#if PYTHON_VERSION >= 340
frame_function->f_executing += 1;
#endif
// Framed code:
tmp_import_globals_1 = ((PyModuleObject *)module_numpy$testing$decorators)->md_dict;
tmp_import_locals_1 = PyDict_New();
if ((var_nose.storage != NULL && var_nose.storage->object != NULL))
{
PyDict_SetItem(
tmp_import_locals_1,
const_str_plain_nose,
var_nose.storage->object
);
}
if ((var_skip_val.storage != NULL && var_skip_val.storage->object != NULL))
{
PyDict_SetItem(
tmp_import_locals_1,
const_str_plain_skip_val,
var_skip_val.storage->object
);
}
if ((var_get_msg.storage != NULL && var_get_msg.storage->object != NULL))
{
PyDict_SetItem(
tmp_import_locals_1,
const_str_plain_get_msg,
var_get_msg.storage->object
);
}
if ((var_skipper_func.object != NULL))
{
PyDict_SetItem(
tmp_import_locals_1,
const_str_plain_skipper_func,
var_skipper_func.object
);
}
if ((var_skipper_gen.object != NULL))
{
PyDict_SetItem(
tmp_import_locals_1,
const_str_plain_skipper_gen,
var_skipper_gen.object
);
}
if ((var_skipper.object != NULL))
{
PyDict_SetItem(
tmp_import_locals_1,
const_str_plain_skipper,
var_skipper.object
);
}
if ((par_f.storage != NULL && par_f.storage->object != NULL))
{
PyDict_SetItem(
tmp_import_locals_1,
const_str_plain_f,
par_f.storage->object
);
}
if ((_python_context->closure_skip_condition.storage != NULL && _python_context->closure_skip_condition.storage->object != NULL))
{
PyDict_SetItem(
tmp_import_locals_1,
const_str_plain_skip_condition,
_python_context->closure_skip_condition.storage->object
);
}
frame_function->f_lineno = 122;
tmp_assign_source_1 = IMPORT_MODULE( const_str_plain_nose, tmp_import_globals_1, tmp_import_locals_1, Py_None, const_int_0 );
Py_DECREF( tmp_import_locals_1 );
if ( tmp_assign_source_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 122;
goto frame_exception_exit_1;
}
if (var_nose.storage->object == NULL)
{
var_nose.storage->object = tmp_assign_source_1;
}
else
{
PyObject *old = var_nose.storage->object;
var_nose.storage->object = tmp_assign_source_1;
Py_DECREF( old );
}
tmp_isinstance_inst_1 = _python_context->closure_skip_condition.storage->object;
if ( tmp_isinstance_inst_1 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 210269 ], 60, 0 );
exception_tb = NULL;
frame_function->f_lineno = 125;
goto frame_exception_exit_1;
}
tmp_source_name_1 = GET_STRING_DICT_VALUE( moduledict_numpy$testing$decorators, (Nuitka_StringObject *)const_str_plain_collections );
if (unlikely( tmp_source_name_1 == NULL ))
{
tmp_source_name_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_collections );
}
if ( tmp_source_name_1 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_NameError );
exception_value = UNSTREAM_STRING( &constant_bin[ 7813 ], 40, 0 );
exception_tb = NULL;
frame_function->f_lineno = 125;
goto frame_exception_exit_1;
}
tmp_isinstance_cls_1 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_Callable );
if ( tmp_isinstance_cls_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 125;
goto frame_exception_exit_1;
}
tmp_res = Nuitka_IsInstance( tmp_isinstance_inst_1, tmp_isinstance_cls_1 );
Py_DECREF( tmp_isinstance_cls_1 );
if ( tmp_res == -1 )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 125;
goto frame_exception_exit_1;
}
if (tmp_res == 1)
{
goto branch_yes_1;
}
else
{
goto branch_no_1;
}
branch_yes_1:;
tmp_assign_source_2 = MAKE_FUNCTION_lambda_1_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( _python_context->closure_skip_condition );
if ( tmp_assign_source_2 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
Py_DECREF( tmp_assign_source_2 );
frame_function->f_lineno = 126;
goto frame_exception_exit_1;
}
if (var_skip_val.storage->object == NULL)
{
var_skip_val.storage->object = tmp_assign_source_2;
}
else
{
PyObject *old = var_skip_val.storage->object;
var_skip_val.storage->object = tmp_assign_source_2;
Py_DECREF( old );
}
goto branch_end_1;
branch_no_1:;
tmp_assign_source_3 = MAKE_FUNCTION_lambda_2_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( _python_context->closure_skip_condition );
if ( tmp_assign_source_3 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
Py_DECREF( tmp_assign_source_3 );
frame_function->f_lineno = 128;
goto frame_exception_exit_1;
}
if (var_skip_val.storage->object == NULL)
{
var_skip_val.storage->object = tmp_assign_source_3;
}
else
{
PyObject *old = var_skip_val.storage->object;
var_skip_val.storage->object = tmp_assign_source_3;
Py_DECREF( old );
}
branch_end_1:;
tmp_defaults_1 = const_tuple_none_tuple;
tmp_assign_source_4 = MAKE_FUNCTION_function_3_get_msg_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( INCREASE_REFCOUNT( tmp_defaults_1 ) );
if ( tmp_assign_source_4 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
Py_DECREF( tmp_assign_source_4 );
frame_function->f_lineno = 130;
goto frame_exception_exit_1;
}
if (var_get_msg.storage->object == NULL)
{
var_get_msg.storage->object = tmp_assign_source_4;
}
else
{
PyObject *old = var_get_msg.storage->object;
var_get_msg.storage->object = tmp_assign_source_4;
Py_DECREF( old );
}
tmp_assign_source_5 = MAKE_FUNCTION_function_4_skipper_func_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( par_f, var_get_msg, _python_context->closure_msg, var_nose, var_skip_val );
if ( tmp_assign_source_5 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
Py_DECREF( tmp_assign_source_5 );
frame_function->f_lineno = 141;
goto frame_exception_exit_1;
}
assert( var_skipper_func.object == NULL );
var_skipper_func.object = tmp_assign_source_5;
tmp_assign_source_6 = MAKE_FUNCTION_function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( par_f, var_get_msg, _python_context->closure_msg, var_nose, var_skip_val );
if ( tmp_assign_source_6 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
Py_DECREF( tmp_assign_source_6 );
frame_function->f_lineno = 148;
goto frame_exception_exit_1;
}
assert( var_skipper_gen.object == NULL );
var_skipper_gen.object = tmp_assign_source_6;
tmp_source_name_3 = var_nose.storage->object;
if ( tmp_source_name_3 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 210329 ], 50, 0 );
exception_tb = NULL;
frame_function->f_lineno = 157;
goto frame_exception_exit_1;
}
tmp_source_name_2 = LOOKUP_ATTRIBUTE( tmp_source_name_3, const_str_plain_util );
if ( tmp_source_name_2 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 157;
goto frame_exception_exit_1;
}
tmp_called_1 = LOOKUP_ATTRIBUTE( tmp_source_name_2, const_str_plain_isgenerator );
Py_DECREF( tmp_source_name_2 );
if ( tmp_called_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 157;
goto frame_exception_exit_1;
}
tmp_call_arg_element_1 = par_f.storage->object;
if ( tmp_call_arg_element_1 == NULL )
{
Py_DECREF( tmp_called_1 );
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 6491 ], 47, 0 );
exception_tb = NULL;
frame_function->f_lineno = 157;
goto frame_exception_exit_1;
}
frame_function->f_lineno = 157;
tmp_cond_value_1 = CALL_FUNCTION_WITH_ARGS1( tmp_called_1, tmp_call_arg_element_1 );
Py_DECREF( tmp_called_1 );
if ( tmp_cond_value_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 157;
goto frame_exception_exit_1;
}
tmp_cond_truth_1 = CHECK_IF_TRUE( tmp_cond_value_1 );
if ( tmp_cond_truth_1 == -1 )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
Py_DECREF( tmp_cond_value_1 );
frame_function->f_lineno = 157;
goto frame_exception_exit_1;
}
Py_DECREF( tmp_cond_value_1 );
if (tmp_cond_truth_1 == 1)
{
goto branch_yes_2;
}
else
{
goto branch_no_2;
}
branch_yes_2:;
tmp_assign_source_7 = var_skipper_gen.object;
assert( var_skipper.object == NULL );
var_skipper.object = INCREASE_REFCOUNT( tmp_assign_source_7 );
goto branch_end_2;
branch_no_2:;
tmp_assign_source_8 = var_skipper_func.object;
assert( var_skipper.object == NULL );
var_skipper.object = INCREASE_REFCOUNT( tmp_assign_source_8 );
branch_end_2:;
tmp_source_name_5 = var_nose.storage->object;
if ( tmp_source_name_5 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 210329 ], 50, 0 );
exception_tb = NULL;
frame_function->f_lineno = 162;
goto frame_exception_exit_1;
}
tmp_source_name_4 = LOOKUP_ATTRIBUTE( tmp_source_name_5, const_str_plain_tools );
if ( tmp_source_name_4 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 162;
goto frame_exception_exit_1;
}
tmp_called_3 = LOOKUP_ATTRIBUTE( tmp_source_name_4, const_str_plain_make_decorator );
Py_DECREF( tmp_source_name_4 );
if ( tmp_called_3 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 162;
goto frame_exception_exit_1;
}
tmp_call_arg_element_2 = par_f.storage->object;
if ( tmp_call_arg_element_2 == NULL )
{
Py_DECREF( tmp_called_3 );
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 6491 ], 47, 0 );
exception_tb = NULL;
frame_function->f_lineno = 162;
goto frame_exception_exit_1;
}
frame_function->f_lineno = 162;
tmp_called_2 = CALL_FUNCTION_WITH_ARGS1( tmp_called_3, tmp_call_arg_element_2 );
Py_DECREF( tmp_called_3 );
if ( tmp_called_2 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 162;
goto frame_exception_exit_1;
}
tmp_call_arg_element_3 = var_skipper.object;
frame_function->f_lineno = 162;
tmp_return_value = CALL_FUNCTION_WITH_ARGS1( tmp_called_2, tmp_call_arg_element_3 );
Py_DECREF( tmp_called_2 );
if ( tmp_return_value == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 162;
goto frame_exception_exit_1;
}
goto frame_return_exit_1;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
// Put the previous frame back on top.
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
goto frame_no_exception_1;
frame_return_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
goto function_return_exit;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
}
else if ( exception_tb->tb_frame != frame_function )
{
PyTracebackObject *traceback_new = (PyTracebackObject *)MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
traceback_new->tb_next = exception_tb;
exception_tb = traceback_new;
}
tmp_frame_locals = PyDict_New();
if ((var_nose.storage != NULL && var_nose.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_nose,
var_nose.storage->object
);
}
if ((var_skip_val.storage != NULL && var_skip_val.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_skip_val,
var_skip_val.storage->object
);
}
if ((var_get_msg.storage != NULL && var_get_msg.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_get_msg,
var_get_msg.storage->object
);
}
if ((var_skipper_func.object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_skipper_func,
var_skipper_func.object
);
}
if ((var_skipper_gen.object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_skipper_gen,
var_skipper_gen.object
);
}
if ((var_skipper.object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_skipper,
var_skipper.object
);
}
if ((par_f.storage != NULL && par_f.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_f,
par_f.storage->object
);
}
if ((_python_context->closure_skip_condition.storage != NULL && _python_context->closure_skip_condition.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_skip_condition,
_python_context->closure_skip_condition.storage->object
);
}
detachFrame( exception_tb, tmp_frame_locals );
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
// Return the error.
goto function_exception_exit;
frame_no_exception_1:;
// Return statement must be present.
assert(false);
function_exception_exit:
assert( exception_type );
PyErr_Restore( exception_type, exception_value, (PyObject *)exception_tb );
return NULL;
function_return_exit:
return tmp_return_value;
}
static PyObject *fparse_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, Py_ssize_t args_size, PyObject *kw )
{
assert( kw == NULL || PyDict_Check( kw ) );
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_size = kw ? PyDict_Size( kw ) : 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_found = 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_only_found = 0;
Py_ssize_t args_given = args_size;
PyObject *_python_par_f = NULL;
// Copy given dictionary values to the the respective variables:
if ( kw_size > 0 )
{
Py_ssize_t ppos = 0;
PyObject *key, *value;
while( PyDict_Next( kw, &ppos, &key, &value ) )
{
#if PYTHON_VERSION < 300
if (unlikely( !PyString_Check( key ) && !PyUnicode_Check( key ) ))
#else
if (unlikely( !PyUnicode_Check( key ) ))
#endif
{
PyErr_Format( PyExc_TypeError, "skip_decorator() keywords must be strings" );
goto error_exit;
}
NUITKA_MAY_BE_UNUSED bool found = false;
Py_INCREF( key );
Py_INCREF( value );
// Quick path, could be our value.
if ( found == false && const_str_plain_f == key )
{
assert( _python_par_f == NULL );
_python_par_f = value;
found = true;
kw_found += 1;
}
// Slow path, compare against all parameter names.
if ( found == false && RICH_COMPARE_BOOL_EQ( const_str_plain_f, key ) == 1 )
{
assert( _python_par_f == NULL );
_python_par_f = value;
found = true;
kw_found += 1;
}
Py_DECREF( key );
if ( found == false )
{
Py_DECREF( value );
PyErr_Format(
PyExc_TypeError,
"skip_decorator() got an unexpected keyword argument '%s'",
Nuitka_String_Check( key ) ? Nuitka_String_AsString( key ) : "<non-string>"
);
goto error_exit;
}
}
#if PYTHON_VERSION < 300
assert( kw_found == kw_size );
assert( kw_only_found == 0 );
#endif
}
// Check if too many arguments were given in case of non star args
if (unlikely( args_given > 1 ))
{
#if PYTHON_VERSION < 270
ERROR_TOO_MANY_ARGUMENTS( self, args_given, kw_size );
#elif PYTHON_VERSION < 330
ERROR_TOO_MANY_ARGUMENTS( self, args_given + kw_found );
#else
ERROR_TOO_MANY_ARGUMENTS( self, args_given, kw_only_found );
#endif
goto error_exit;
}
// Copy normal parameter values given as part of the args list to the respective variables:
if (likely( 0 < args_given ))
{
if (unlikely( _python_par_f != NULL ))
{
ERROR_MULTIPLE_VALUES( self, 0 );
goto error_exit;
}
_python_par_f = INCREASE_REFCOUNT( args[ 0 ] );
}
else if ( _python_par_f == NULL )
{
if ( 0 + self->m_defaults_given >= 1 )
{
_python_par_f = INCREASE_REFCOUNT( PyTuple_GET_ITEM( self->m_defaults, self->m_defaults_given + 0 - 1 ) );
}
#if PYTHON_VERSION < 330
else
{
#if PYTHON_VERSION < 270
ERROR_TOO_FEW_ARGUMENTS( self, kw_size, args_given + kw_found );
#elif PYTHON_VERSION < 300
ERROR_TOO_FEW_ARGUMENTS( self, args_given + kw_found );
#else
ERROR_TOO_FEW_ARGUMENTS( self, args_given + kw_found - kw_only_found );
#endif
goto error_exit;
}
#endif
}
#if PYTHON_VERSION >= 330
if (unlikely( _python_par_f == NULL ))
{
PyObject *values[] = { _python_par_f };
ERROR_TOO_FEW_ARGUMENTS( self, values );
goto error_exit;
}
#endif
return impl_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( self, _python_par_f );
error_exit:;
Py_XDECREF( _python_par_f );
return NULL;
}
static PyObject *dparse_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, int size )
{
if ( size == 1 )
{
return impl_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( self, INCREASE_REFCOUNT( args[ 0 ] ) );
}
else
{
PyObject *result = fparse_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( self, args, size, NULL );
return result;
}
}
static PyObject *impl_lambda_1_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self )
{
// The context of the function.
struct _context_lambda_1_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t *_python_context = (struct _context_lambda_1_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t *)self->m_context;
// Local variable declarations.
PyObject *exception_type = NULL, *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
PyObject *tmp_called_1;
PyObject *tmp_frame_locals;
PyObject *tmp_return_value;
tmp_return_value = NULL;
// Actual function code.
static PyFrameObject *cache_frame_function = NULL;
MAKE_OR_REUSE_FRAME( cache_frame_function, codeobj_38d1a85c0c830f4f214d9ffc5eb9df27, module_numpy$testing$decorators );
PyFrameObject *frame_function = cache_frame_function;
// Push the new frame as the currently active one.
pushFrameStack( frame_function );
// Mark the frame object as in use, ref count 1 will be up for reuse.
Py_INCREF( frame_function );
assert( Py_REFCNT( frame_function ) == 2 ); // Frame stack
#if PYTHON_VERSION >= 340
frame_function->f_executing += 1;
#endif
// Framed code:
tmp_called_1 = _python_context->closure_skip_condition.storage->object;
if ( tmp_called_1 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 210269 ], 60, 0 );
exception_tb = NULL;
frame_function->f_lineno = 126;
goto frame_exception_exit_1;
}
frame_function->f_lineno = 126;
tmp_return_value = CALL_FUNCTION_NO_ARGS( tmp_called_1 );
if ( tmp_return_value == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 126;
goto frame_exception_exit_1;
}
goto frame_return_exit_1;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
// Put the previous frame back on top.
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
goto frame_no_exception_1;
frame_return_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
goto function_return_exit;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
}
else if ( exception_tb->tb_frame != frame_function )
{
PyTracebackObject *traceback_new = (PyTracebackObject *)MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
traceback_new->tb_next = exception_tb;
exception_tb = traceback_new;
}
tmp_frame_locals = PyDict_New();
if ((_python_context->closure_skip_condition.storage != NULL && _python_context->closure_skip_condition.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_skip_condition,
_python_context->closure_skip_condition.storage->object
);
}
detachFrame( exception_tb, tmp_frame_locals );
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
// Return the error.
goto function_exception_exit;
frame_no_exception_1:;
// Return statement must be present.
assert(false);
function_exception_exit:
assert( exception_type );
PyErr_Restore( exception_type, exception_value, (PyObject *)exception_tb );
return NULL;
function_return_exit:
return tmp_return_value;
}
static PyObject *fparse_lambda_1_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, Py_ssize_t args_size, PyObject *kw )
{
assert( kw == NULL || PyDict_Check( kw ) );
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_size = kw ? PyDict_Size( kw ) : 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_found = 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_only_found = 0;
Py_ssize_t args_given = args_size;
if (unlikely( args_given + kw_size > 0 ))
{
#if PYTHON_VERSION < 330
ERROR_NO_ARGUMENTS_ALLOWED(
self,
args_given + kw_size
);
#else
ERROR_NO_ARGUMENTS_ALLOWED(
self,
kw_size > 0 ? kw : NULL,
args_given
);
#endif
goto error_exit;
}
return impl_lambda_1_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( self );
error_exit:;
return NULL;
}
static PyObject *dparse_lambda_1_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, int size )
{
if ( size == 0 )
{
return impl_lambda_1_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( self );
}
else
{
PyObject *result = fparse_lambda_1_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( self, args, size, NULL );
return result;
}
}
static PyObject *impl_lambda_2_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self )
{
// The context of the function.
struct _context_lambda_2_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t *_python_context = (struct _context_lambda_2_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t *)self->m_context;
// Local variable declarations.
PyObject *exception_type = NULL, *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
PyObject *tmp_frame_locals;
PyObject *tmp_return_value;
tmp_return_value = NULL;
// Actual function code.
static PyFrameObject *cache_frame_function = NULL;
MAKE_OR_REUSE_FRAME( cache_frame_function, codeobj_2b2ac8416d57591c0ed51a03292717a9, module_numpy$testing$decorators );
PyFrameObject *frame_function = cache_frame_function;
// Push the new frame as the currently active one.
pushFrameStack( frame_function );
// Mark the frame object as in use, ref count 1 will be up for reuse.
Py_INCREF( frame_function );
assert( Py_REFCNT( frame_function ) == 2 ); // Frame stack
#if PYTHON_VERSION >= 340
frame_function->f_executing += 1;
#endif
// Framed code:
tmp_return_value = _python_context->closure_skip_condition.storage->object;
if ( tmp_return_value == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 210269 ], 60, 0 );
exception_tb = NULL;
frame_function->f_lineno = 128;
goto frame_exception_exit_1;
}
Py_INCREF( tmp_return_value );
goto frame_return_exit_1;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
// Put the previous frame back on top.
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
goto frame_no_exception_1;
frame_return_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
goto function_return_exit;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
}
else if ( exception_tb->tb_frame != frame_function )
{
PyTracebackObject *traceback_new = (PyTracebackObject *)MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
traceback_new->tb_next = exception_tb;
exception_tb = traceback_new;
}
tmp_frame_locals = PyDict_New();
if ((_python_context->closure_skip_condition.storage != NULL && _python_context->closure_skip_condition.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_skip_condition,
_python_context->closure_skip_condition.storage->object
);
}
detachFrame( exception_tb, tmp_frame_locals );
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
// Return the error.
goto function_exception_exit;
frame_no_exception_1:;
// Return statement must be present.
assert(false);
function_exception_exit:
assert( exception_type );
PyErr_Restore( exception_type, exception_value, (PyObject *)exception_tb );
return NULL;
function_return_exit:
return tmp_return_value;
}
static PyObject *fparse_lambda_2_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, Py_ssize_t args_size, PyObject *kw )
{
assert( kw == NULL || PyDict_Check( kw ) );
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_size = kw ? PyDict_Size( kw ) : 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_found = 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_only_found = 0;
Py_ssize_t args_given = args_size;
if (unlikely( args_given + kw_size > 0 ))
{
#if PYTHON_VERSION < 330
ERROR_NO_ARGUMENTS_ALLOWED(
self,
args_given + kw_size
);
#else
ERROR_NO_ARGUMENTS_ALLOWED(
self,
kw_size > 0 ? kw : NULL,
args_given
);
#endif
goto error_exit;
}
return impl_lambda_2_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( self );
error_exit:;
return NULL;
}
static PyObject *dparse_lambda_2_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, int size )
{
if ( size == 0 )
{
return impl_lambda_2_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( self );
}
else
{
PyObject *result = fparse_lambda_2_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( self, args, size, NULL );
return result;
}
}
static PyObject *impl_function_3_get_msg_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject *_python_par_func, PyObject *_python_par_msg )
{
// No context is used.
// Local variable declarations.
PyObjectLocalVariable par_func; par_func.object = _python_par_func;
PyObjectLocalVariable par_msg; par_msg.object = _python_par_msg;
PyObjectLocalVariable var_out;
PyObject *exception_type = NULL, *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
PyObject *tmp_assign_source_1;
PyObject *tmp_assign_source_2;
PyObject *tmp_binop_left_1;
PyObject *tmp_binop_right_1;
PyObject *tmp_compare_left_1;
PyObject *tmp_compare_right_1;
PyObject *tmp_frame_locals;
bool tmp_is_1;
PyObject *tmp_return_value;
PyObject *tmp_source_name_1;
PyObject *tmp_tuple_element_1;
tmp_return_value = NULL;
// Actual function code.
static PyFrameObject *cache_frame_function = NULL;
MAKE_OR_REUSE_FRAME( cache_frame_function, codeobj_bd9304085c0017625f820777b98bc1c8, module_numpy$testing$decorators );
PyFrameObject *frame_function = cache_frame_function;
// Push the new frame as the currently active one.
pushFrameStack( frame_function );
// Mark the frame object as in use, ref count 1 will be up for reuse.
Py_INCREF( frame_function );
assert( Py_REFCNT( frame_function ) == 2 ); // Frame stack
#if PYTHON_VERSION >= 340
frame_function->f_executing += 1;
#endif
// Framed code:
tmp_compare_left_1 = par_msg.object;
if ( tmp_compare_left_1 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 28198 ], 49, 0 );
exception_tb = NULL;
frame_function->f_lineno = 132;
goto frame_exception_exit_1;
}
tmp_compare_right_1 = Py_None;
tmp_is_1 = ( tmp_compare_left_1 == tmp_compare_right_1 );
if (tmp_is_1)
{
goto branch_yes_1;
}
else
{
goto branch_no_1;
}
branch_yes_1:;
tmp_assign_source_1 = const_str_digest_77b93c11daedc95daaec5bf946942c57;
assert( var_out.object == NULL );
var_out.object = INCREASE_REFCOUNT( tmp_assign_source_1 );
goto branch_end_1;
branch_no_1:;
tmp_assign_source_2 = par_msg.object;
if ( tmp_assign_source_2 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 28198 ], 49, 0 );
exception_tb = NULL;
frame_function->f_lineno = 135;
goto frame_exception_exit_1;
}
assert( var_out.object == NULL );
var_out.object = INCREASE_REFCOUNT( tmp_assign_source_2 );
branch_end_1:;
tmp_binop_left_1 = const_str_digest_cce3eee55d61791558336fd1035509cd;
tmp_binop_right_1 = PyTuple_New( 2 );
tmp_source_name_1 = par_func.object;
if ( tmp_source_name_1 == NULL )
{
Py_DECREF( tmp_binop_right_1 );
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 47143 ], 50, 0 );
exception_tb = NULL;
frame_function->f_lineno = 137;
goto frame_exception_exit_1;
}
tmp_tuple_element_1 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain___name__ );
if ( tmp_tuple_element_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
Py_DECREF( tmp_binop_right_1 );
frame_function->f_lineno = 137;
goto frame_exception_exit_1;
}
PyTuple_SET_ITEM( tmp_binop_right_1, 0, tmp_tuple_element_1 );
tmp_tuple_element_1 = var_out.object;
Py_INCREF( tmp_tuple_element_1 );
PyTuple_SET_ITEM( tmp_binop_right_1, 1, tmp_tuple_element_1 );
tmp_return_value = BINARY_OPERATION_REMAINDER( tmp_binop_left_1, tmp_binop_right_1 );
Py_DECREF( tmp_binop_right_1 );
if ( tmp_return_value == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 137;
goto frame_exception_exit_1;
}
goto frame_return_exit_1;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
// Put the previous frame back on top.
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
goto frame_no_exception_1;
frame_return_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
goto function_return_exit;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
}
else if ( exception_tb->tb_frame != frame_function )
{
PyTracebackObject *traceback_new = (PyTracebackObject *)MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
traceback_new->tb_next = exception_tb;
exception_tb = traceback_new;
}
tmp_frame_locals = PyDict_New();
if ((var_out.object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_out,
var_out.object
);
}
if ((par_func.object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_func,
par_func.object
);
}
if ((par_msg.object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_msg,
par_msg.object
);
}
detachFrame( exception_tb, tmp_frame_locals );
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
// Return the error.
goto function_exception_exit;
frame_no_exception_1:;
// Return statement must be present.
assert(false);
function_exception_exit:
assert( exception_type );
PyErr_Restore( exception_type, exception_value, (PyObject *)exception_tb );
return NULL;
function_return_exit:
return tmp_return_value;
}
static PyObject *fparse_function_3_get_msg_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, Py_ssize_t args_size, PyObject *kw )
{
assert( kw == NULL || PyDict_Check( kw ) );
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_size = kw ? PyDict_Size( kw ) : 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_found = 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_only_found = 0;
Py_ssize_t args_given = args_size;
PyObject *_python_par_func = NULL;
PyObject *_python_par_msg = NULL;
// Copy given dictionary values to the the respective variables:
if ( kw_size > 0 )
{
Py_ssize_t ppos = 0;
PyObject *key, *value;
while( PyDict_Next( kw, &ppos, &key, &value ) )
{
#if PYTHON_VERSION < 300
if (unlikely( !PyString_Check( key ) && !PyUnicode_Check( key ) ))
#else
if (unlikely( !PyUnicode_Check( key ) ))
#endif
{
PyErr_Format( PyExc_TypeError, "get_msg() keywords must be strings" );
goto error_exit;
}
NUITKA_MAY_BE_UNUSED bool found = false;
Py_INCREF( key );
Py_INCREF( value );
// Quick path, could be our value.
if ( found == false && const_str_plain_func == key )
{
assert( _python_par_func == NULL );
_python_par_func = value;
found = true;
kw_found += 1;
}
if ( found == false && const_str_plain_msg == key )
{
assert( _python_par_msg == NULL );
_python_par_msg = value;
found = true;
kw_found += 1;
}
// Slow path, compare against all parameter names.
if ( found == false && RICH_COMPARE_BOOL_EQ( const_str_plain_func, key ) == 1 )
{
assert( _python_par_func == NULL );
_python_par_func = value;
found = true;
kw_found += 1;
}
if ( found == false && RICH_COMPARE_BOOL_EQ( const_str_plain_msg, key ) == 1 )
{
assert( _python_par_msg == NULL );
_python_par_msg = value;
found = true;
kw_found += 1;
}
Py_DECREF( key );
if ( found == false )
{
Py_DECREF( value );
PyErr_Format(
PyExc_TypeError,
"get_msg() got an unexpected keyword argument '%s'",
Nuitka_String_Check( key ) ? Nuitka_String_AsString( key ) : "<non-string>"
);
goto error_exit;
}
}
#if PYTHON_VERSION < 300
assert( kw_found == kw_size );
assert( kw_only_found == 0 );
#endif
}
// Check if too many arguments were given in case of non star args
if (unlikely( args_given > 2 ))
{
#if PYTHON_VERSION < 270
ERROR_TOO_MANY_ARGUMENTS( self, args_given, kw_size );
#elif PYTHON_VERSION < 330
ERROR_TOO_MANY_ARGUMENTS( self, args_given + kw_found );
#else
ERROR_TOO_MANY_ARGUMENTS( self, args_given, kw_only_found );
#endif
goto error_exit;
}
// Copy normal parameter values given as part of the args list to the respective variables:
if (likely( 0 < args_given ))
{
if (unlikely( _python_par_func != NULL ))
{
ERROR_MULTIPLE_VALUES( self, 0 );
goto error_exit;
}
_python_par_func = INCREASE_REFCOUNT( args[ 0 ] );
}
else if ( _python_par_func == NULL )
{
if ( 0 + self->m_defaults_given >= 2 )
{
_python_par_func = INCREASE_REFCOUNT( PyTuple_GET_ITEM( self->m_defaults, self->m_defaults_given + 0 - 2 ) );
}
#if PYTHON_VERSION < 330
else
{
#if PYTHON_VERSION < 270
ERROR_TOO_FEW_ARGUMENTS( self, kw_size, args_given + kw_found );
#elif PYTHON_VERSION < 300
ERROR_TOO_FEW_ARGUMENTS( self, args_given + kw_found );
#else
ERROR_TOO_FEW_ARGUMENTS( self, args_given + kw_found - kw_only_found );
#endif
goto error_exit;
}
#endif
}
if (likely( 1 < args_given ))
{
if (unlikely( _python_par_msg != NULL ))
{
ERROR_MULTIPLE_VALUES( self, 1 );
goto error_exit;
}
_python_par_msg = INCREASE_REFCOUNT( args[ 1 ] );
}
else if ( _python_par_msg == NULL )
{
if ( 1 + self->m_defaults_given >= 2 )
{
_python_par_msg = INCREASE_REFCOUNT( PyTuple_GET_ITEM( self->m_defaults, self->m_defaults_given + 1 - 2 ) );
}
#if PYTHON_VERSION < 330
else
{
#if PYTHON_VERSION < 270
ERROR_TOO_FEW_ARGUMENTS( self, kw_size, args_given + kw_found );
#elif PYTHON_VERSION < 300
ERROR_TOO_FEW_ARGUMENTS( self, args_given + kw_found );
#else
ERROR_TOO_FEW_ARGUMENTS( self, args_given + kw_found - kw_only_found );
#endif
goto error_exit;
}
#endif
}
#if PYTHON_VERSION >= 330
if (unlikely( _python_par_func == NULL || _python_par_msg == NULL ))
{
PyObject *values[] = { _python_par_func, _python_par_msg };
ERROR_TOO_FEW_ARGUMENTS( self, values );
goto error_exit;
}
#endif
return impl_function_3_get_msg_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( self, _python_par_func, _python_par_msg );
error_exit:;
Py_XDECREF( _python_par_func );
Py_XDECREF( _python_par_msg );
return NULL;
}
static PyObject *dparse_function_3_get_msg_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, int size )
{
if ( size == 2 )
{
return impl_function_3_get_msg_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( self, INCREASE_REFCOUNT( args[ 0 ] ), INCREASE_REFCOUNT( args[ 1 ] ) );
}
else
{
PyObject *result = fparse_function_3_get_msg_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( self, args, size, NULL );
return result;
}
}
static PyObject *impl_function_4_skipper_func_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject *_python_par_args, PyObject *_python_par_kwargs )
{
// The context of the function.
struct _context_function_4_skipper_func_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t *_python_context = (struct _context_function_4_skipper_func_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t *)self->m_context;
// Local variable declarations.
PyObjectLocalVariable par_args; par_args.object = _python_par_args;
PyObjectLocalVariable par_kwargs; par_kwargs.object = _python_par_kwargs;
PyObject *exception_type = NULL, *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
PyObject *tmp_call_arg_element_1;
PyObject *tmp_call_arg_element_2;
PyObject *tmp_call_arg_element_3;
PyObject *tmp_called_1;
PyObject *tmp_called_2;
PyObject *tmp_called_3;
int tmp_cond_truth_1;
PyObject *tmp_cond_value_1;
PyObject *tmp_dircall_arg1_1;
PyObject *tmp_dircall_arg2_1;
PyObject *tmp_dircall_arg3_1;
PyObject *tmp_frame_locals;
PyObject *tmp_raise_type_1;
PyObject *tmp_return_value;
PyObject *tmp_source_name_1;
tmp_return_value = NULL;
// Actual function code.
static PyFrameObject *cache_frame_function = NULL;
MAKE_OR_REUSE_FRAME( cache_frame_function, codeobj_91afb59a1dc50640f8f2d44615c96cfe, module_numpy$testing$decorators );
PyFrameObject *frame_function = cache_frame_function;
// Push the new frame as the currently active one.
pushFrameStack( frame_function );
// Mark the frame object as in use, ref count 1 will be up for reuse.
Py_INCREF( frame_function );
assert( Py_REFCNT( frame_function ) == 2 ); // Frame stack
#if PYTHON_VERSION >= 340
frame_function->f_executing += 1;
#endif
// Framed code:
tmp_called_1 = _python_context->closure_skip_val.storage->object;
if ( tmp_called_1 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 210379 ], 54, 0 );
exception_tb = NULL;
frame_function->f_lineno = 143;
goto frame_exception_exit_1;
}
frame_function->f_lineno = 143;
tmp_cond_value_1 = CALL_FUNCTION_NO_ARGS( tmp_called_1 );
if ( tmp_cond_value_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 143;
goto frame_exception_exit_1;
}
tmp_cond_truth_1 = CHECK_IF_TRUE( tmp_cond_value_1 );
if ( tmp_cond_truth_1 == -1 )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
Py_DECREF( tmp_cond_value_1 );
frame_function->f_lineno = 143;
goto frame_exception_exit_1;
}
Py_DECREF( tmp_cond_value_1 );
if (tmp_cond_truth_1 == 1)
{
goto branch_yes_1;
}
else
{
goto branch_no_1;
}
branch_yes_1:;
tmp_source_name_1 = _python_context->closure_nose.storage->object;
if ( tmp_source_name_1 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 210329 ], 50, 0 );
exception_tb = NULL;
frame_function->f_lineno = 144;
goto frame_exception_exit_1;
}
tmp_called_2 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_SkipTest );
if ( tmp_called_2 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 144;
goto frame_exception_exit_1;
}
tmp_called_3 = _python_context->closure_get_msg.storage->object;
if ( tmp_called_3 == NULL )
{
Py_DECREF( tmp_called_2 );
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 210433 ], 53, 0 );
exception_tb = NULL;
frame_function->f_lineno = 144;
goto frame_exception_exit_1;
}
tmp_call_arg_element_2 = _python_context->closure_f.storage->object;
if ( tmp_call_arg_element_2 == NULL )
{
Py_DECREF( tmp_called_2 );
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 6491 ], 47, 0 );
exception_tb = NULL;
frame_function->f_lineno = 144;
goto frame_exception_exit_1;
}
tmp_call_arg_element_3 = _python_context->closure_msg.storage->object;
if ( tmp_call_arg_element_3 == NULL )
{
Py_DECREF( tmp_called_2 );
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 28198 ], 49, 0 );
exception_tb = NULL;
frame_function->f_lineno = 144;
goto frame_exception_exit_1;
}
frame_function->f_lineno = 144;
tmp_call_arg_element_1 = CALL_FUNCTION_WITH_ARGS2( tmp_called_3, tmp_call_arg_element_2, tmp_call_arg_element_3 );
if ( tmp_call_arg_element_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
Py_DECREF( tmp_called_2 );
frame_function->f_lineno = 144;
goto frame_exception_exit_1;
}
frame_function->f_lineno = 144;
tmp_raise_type_1 = CALL_FUNCTION_WITH_ARGS1( tmp_called_2, tmp_call_arg_element_1 );
Py_DECREF( tmp_called_2 );
Py_DECREF( tmp_call_arg_element_1 );
if ( tmp_raise_type_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 144;
goto frame_exception_exit_1;
}
exception_type = tmp_raise_type_1;
frame_function->f_lineno = 144;
RAISE_EXCEPTION_WITH_TYPE( &exception_type, &exception_value, &exception_tb );
goto frame_exception_exit_1;
goto branch_end_1;
branch_no_1:;
tmp_dircall_arg1_1 = _python_context->closure_f.storage->object;
if ( tmp_dircall_arg1_1 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 6491 ], 47, 0 );
exception_tb = NULL;
frame_function->f_lineno = 146;
goto frame_exception_exit_1;
}
tmp_dircall_arg2_1 = par_args.object;
if ( tmp_dircall_arg2_1 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 5435 ], 50, 0 );
exception_tb = NULL;
frame_function->f_lineno = 146;
goto frame_exception_exit_1;
}
tmp_dircall_arg3_1 = par_kwargs.object;
if ( tmp_dircall_arg3_1 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 71458 ], 52, 0 );
exception_tb = NULL;
frame_function->f_lineno = 146;
goto frame_exception_exit_1;
}
tmp_return_value = impl_function_2_complex_call_helper_star_list_star_dict_of_module___internal__( INCREASE_REFCOUNT( tmp_dircall_arg1_1 ), INCREASE_REFCOUNT( tmp_dircall_arg2_1 ), INCREASE_REFCOUNT( tmp_dircall_arg3_1 ) );
if ( tmp_return_value == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 146;
goto frame_exception_exit_1;
}
goto frame_return_exit_1;
branch_end_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
// Put the previous frame back on top.
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
goto frame_no_exception_1;
frame_return_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
goto function_return_exit;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
}
else if ( exception_tb->tb_frame != frame_function )
{
PyTracebackObject *traceback_new = (PyTracebackObject *)MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
traceback_new->tb_next = exception_tb;
exception_tb = traceback_new;
}
tmp_frame_locals = PyDict_New();
if ((_python_context->closure_skip_val.storage != NULL && _python_context->closure_skip_val.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_skip_val,
_python_context->closure_skip_val.storage->object
);
}
if ((_python_context->closure_nose.storage != NULL && _python_context->closure_nose.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_nose,
_python_context->closure_nose.storage->object
);
}
if ((_python_context->closure_get_msg.storage != NULL && _python_context->closure_get_msg.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_get_msg,
_python_context->closure_get_msg.storage->object
);
}
if ((par_args.object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_args,
par_args.object
);
}
if ((par_kwargs.object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_kwargs,
par_kwargs.object
);
}
if ((_python_context->closure_f.storage != NULL && _python_context->closure_f.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_f,
_python_context->closure_f.storage->object
);
}
if ((_python_context->closure_msg.storage != NULL && _python_context->closure_msg.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_msg,
_python_context->closure_msg.storage->object
);
}
detachFrame( exception_tb, tmp_frame_locals );
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
// Return the error.
goto function_exception_exit;
frame_no_exception_1:;
// Return statement must be present.
assert(false);
function_exception_exit:
assert( exception_type );
PyErr_Restore( exception_type, exception_value, (PyObject *)exception_tb );
return NULL;
function_return_exit:
return tmp_return_value;
}
static PyObject *fparse_function_4_skipper_func_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, Py_ssize_t args_size, PyObject *kw )
{
assert( kw == NULL || PyDict_Check( kw ) );
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_size = kw ? PyDict_Size( kw ) : 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_found = 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_only_found = 0;
Py_ssize_t args_given = args_size;
PyObject *_python_par_args = NULL;
PyObject *_python_par_kwargs = NULL;
if ( kw == NULL )
{
_python_par_kwargs = PyDict_New();
}
else
{
if ( ((PyDictObject *)kw)->ma_used > 0 )
{
#if PYTHON_VERSION < 330
_python_par_kwargs = _PyDict_NewPresized( ((PyDictObject *)kw)->ma_used );
for ( int i = 0; i <= ((PyDictObject *)kw)->ma_mask; i++ )
{
PyDictEntry *entry = &((PyDictObject *)kw)->ma_table[ i ];
if ( entry->me_value != NULL )
{
#if PYTHON_VERSION < 300
if (unlikely( !PyString_Check( entry->me_key ) && !PyUnicode_Check( entry->me_key ) ))
#else
if (unlikely( !PyUnicode_Check( entry->me_key ) ))
#endif
{
PyErr_Format( PyExc_TypeError, "skipper_func() keywords must be strings" );
goto error_exit;
}
int res = PyDict_SetItem( _python_par_kwargs, entry->me_key, entry->me_value );
if (unlikely( res == -1 ))
{
goto error_exit;
}
}
}
#else
if ( _PyDict_HasSplitTable( (PyDictObject *)kw) )
{
PyDictObject *mp = (PyDictObject *)kw;
PyObject **newvalues = PyMem_NEW( PyObject *, mp->ma_keys->dk_size );
assert (newvalues != NULL);
PyDictObject *split_copy = PyObject_GC_New( PyDictObject, &PyDict_Type );
assert( split_copy != NULL );
split_copy->ma_values = newvalues;
split_copy->ma_keys = mp->ma_keys;
split_copy->ma_used = mp->ma_used;
mp->ma_keys->dk_refcnt += 1;
Nuitka_GC_Track( split_copy );
Py_ssize_t size = mp->ma_keys->dk_size;
for ( Py_ssize_t i = 0; i < size; i++ )
{
PyDictKeyEntry *entry = &split_copy->ma_keys->dk_entries[ i ];
if (unlikely( !PyUnicode_Check( entry->me_key ) ))
{
PyErr_Format( PyExc_TypeError, "skipper_func() keywords must be strings" );
goto error_exit;
}
split_copy->ma_values[ i ] = INCREASE_REFCOUNT_X( mp->ma_values[ i ] );
}
_python_par_kwargs = (PyObject *)split_copy;
}
else
{
_python_par_kwargs = PyDict_New();
PyDictObject *mp = (PyDictObject *)kw;
Py_ssize_t size = mp->ma_keys->dk_size;
for ( Py_ssize_t i = 0; i < size; i++ )
{
PyDictKeyEntry *entry = &mp->ma_keys->dk_entries[i];
// TODO: One of these cases has been dealt with above.
PyObject *value;
if ( mp->ma_values )
{
value = mp->ma_values[ i ];
}
else
{
value = entry->me_value;
}
if ( value != NULL )
{
if (unlikely( !PyUnicode_Check( entry->me_key ) ))
{
PyErr_Format( PyExc_TypeError, "skipper_func() keywords must be strings" );
goto error_exit;
}
int res = PyDict_SetItem( _python_par_kwargs, entry->me_key, value );
if (unlikely( res == -1 ))
{
goto error_exit;
}
}
}
}
#endif
}
else
{
_python_par_kwargs = PyDict_New();
}
}
// Copy left over argument values to the star list parameter given.
if ( args_given > 0 )
{
_python_par_args = PyTuple_New( args_size - 0 );
for( Py_ssize_t i = 0; i < args_size - 0; i++ )
{
PyTuple_SET_ITEM( _python_par_args, i, INCREASE_REFCOUNT( args[0+i] ) );
}
}
else
{
_python_par_args = INCREASE_REFCOUNT( const_tuple_empty );
}
return impl_function_4_skipper_func_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( self, _python_par_args, _python_par_kwargs );
error_exit:;
Py_XDECREF( _python_par_args );
Py_XDECREF( _python_par_kwargs );
return NULL;
}
static PyObject *dparse_function_4_skipper_func_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, int size )
{
if ( size == 2 )
{
return impl_function_4_skipper_func_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( self, MAKE_TUPLE( &args[ 0 ], size > 0 ? size-0 : 0 ), PyDict_New() );
}
else
{
PyObject *result = fparse_function_4_skipper_func_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( self, args, size, NULL );
return result;
}
}
// This structure is for attachment as self of the generator function function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators and
// contains the common closure. It is allocated at the time the genexpr object is created.
struct _context_common_function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t
{
// Ref count to keep track of common context usage and release only when it's the last one
int ref_count;
// The generator function can access a read-only closure of the creator.
PyObjectSharedLocalVariable closure_f;
PyObjectSharedLocalVariable closure_get_msg;
PyObjectSharedLocalVariable closure_msg;
PyObjectSharedLocalVariable closure_nose;
PyObjectSharedLocalVariable closure_skip_val;
};
struct _context_generator_function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t
{
_context_common_function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t *common_context;
// The generator function instance can access its parameters from creation time.
PyObjectLocalVariable closure_args;
PyObjectLocalVariable closure_kwargs;
PyObjectLocalVariable closure_x;
PyObjectTempVariable closure_for_loop_1__for_iterator;
PyObjectTempVariable closure_for_loop_1__iter_value;
};
static void _context_common_function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_destructor( void *context_voidptr )
{
_context_common_function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t *_python_context = (struct _context_common_function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t *)context_voidptr;
assert( _python_context->ref_count > 0 );
_python_context->ref_count -= 1;
if ( _python_context->ref_count == 0 )
{
delete _python_context;
}
}
static void _context_generator_function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_destructor( void *context_voidptr )
{
_context_generator_function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t *_python_context = (struct _context_generator_function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t *)context_voidptr;
_context_common_function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_destructor( _python_context->common_context );
delete _python_context;
}
#ifdef _NUITKA_MAKECONTEXT_INTS
static void function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_context( int generator_address_1, int generator_address_2 )
{
// Restore the pointer from ints should it be necessary, often it can be
// directly received.
int generator_addresses[2] = {
generator_address_1,
generator_address_2
};
Nuitka_GeneratorObject *generator = (Nuitka_GeneratorObject *)*(uintptr_t *)&generator_addresses[0];
#else
static void function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_context( Nuitka_GeneratorObject *generator )
{
#endif
assertObject( (PyObject *)generator );
assert( Nuitka_Generator_Check( (PyObject *)generator ) );
// Make context accessible if one is used.
NUITKA_MAY_BE_UNUSED struct _context_generator_function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t *_python_context = (_context_generator_function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t *)generator->m_context;
// Local variable inits
PyObject *exception_type = NULL, *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
PyObject *tmp_assign_source_1;
PyObject *tmp_assign_source_2;
PyObject *tmp_assign_source_3;
PyObject *tmp_call_arg_element_1;
PyObject *tmp_call_arg_element_2;
PyObject *tmp_call_arg_element_3;
PyObject *tmp_called_1;
PyObject *tmp_called_2;
PyObject *tmp_called_3;
int tmp_cond_truth_1;
PyObject *tmp_cond_value_1;
PyObject *tmp_dircall_arg1_1;
PyObject *tmp_dircall_arg2_1;
PyObject *tmp_dircall_arg3_1;
PyObject *tmp_frame_locals;
PyObject *tmp_iter_arg_1;
PyObject *tmp_next_source_1;
PyObject *tmp_raise_type_1;
PyObject *tmp_source_name_1;
int tmp_tried_lineno_1;
NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
PyObject *tmp_yield_1;
// Actual function code.
PyFrameObject *frame_function = MAKE_FRAME( codeobj_321d09f72fe480faec3a87df8a221548, module_numpy$testing$decorators );
Py_INCREF( frame_function );
generator->m_frame = frame_function;
#if PYTHON_VERSION >= 340
frame_function->f_gen = (PyObject *)generator;
#endif
Py_CLEAR( generator->m_frame->f_back );
generator->m_frame->f_back = PyThreadState_GET()->frame;
Py_INCREF( generator->m_frame->f_back );
PyThreadState_GET()->frame = generator->m_frame;
#if PYTHON_VERSION >= 340
frame_function->f_executing += 1;
#endif
// Framed code:
// Throwing into unstarted generators is possible. As they don't stand any
// chance to deal with them, we might as well create traceback on the
// outside,
if ( generator->m_exception_type )
{
generator->m_yielded = NULL;
exception_type = generator->m_exception_type;
generator->m_exception_type = NULL;
exception_value = generator->m_exception_value;
generator->m_exception_value = NULL;
exception_tb = generator->m_exception_tb;;
generator->m_exception_tb = NULL;
if (exception_tb == NULL)
{
goto frame_exception_exit_1;
}
else
{
goto function_exception_exit;
}
}
tmp_called_1 = _python_context->common_context->closure_skip_val.storage->object;
if ( tmp_called_1 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 210379 ], 54, 0 );
exception_tb = NULL;
frame_function->f_lineno = 150;
goto frame_exception_exit_1;
}
frame_function->f_lineno = 150;
tmp_cond_value_1 = CALL_FUNCTION_NO_ARGS( tmp_called_1 );
if ( tmp_cond_value_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 150;
goto frame_exception_exit_1;
}
tmp_cond_truth_1 = CHECK_IF_TRUE( tmp_cond_value_1 );
if ( tmp_cond_truth_1 == -1 )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
Py_DECREF( tmp_cond_value_1 );
frame_function->f_lineno = 150;
goto frame_exception_exit_1;
}
Py_DECREF( tmp_cond_value_1 );
if (tmp_cond_truth_1 == 1)
{
goto branch_yes_1;
}
else
{
goto branch_no_1;
}
branch_yes_1:;
tmp_source_name_1 = _python_context->common_context->closure_nose.storage->object;
if ( tmp_source_name_1 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 210329 ], 50, 0 );
exception_tb = NULL;
frame_function->f_lineno = 151;
goto frame_exception_exit_1;
}
tmp_called_2 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_SkipTest );
if ( tmp_called_2 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 151;
goto frame_exception_exit_1;
}
tmp_called_3 = _python_context->common_context->closure_get_msg.storage->object;
if ( tmp_called_3 == NULL )
{
Py_DECREF( tmp_called_2 );
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 210433 ], 53, 0 );
exception_tb = NULL;
frame_function->f_lineno = 151;
goto frame_exception_exit_1;
}
tmp_call_arg_element_2 = _python_context->common_context->closure_f.storage->object;
if ( tmp_call_arg_element_2 == NULL )
{
Py_DECREF( tmp_called_2 );
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 6491 ], 47, 0 );
exception_tb = NULL;
frame_function->f_lineno = 151;
goto frame_exception_exit_1;
}
tmp_call_arg_element_3 = _python_context->common_context->closure_msg.storage->object;
if ( tmp_call_arg_element_3 == NULL )
{
Py_DECREF( tmp_called_2 );
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 28198 ], 49, 0 );
exception_tb = NULL;
frame_function->f_lineno = 151;
goto frame_exception_exit_1;
}
frame_function->f_lineno = 151;
tmp_call_arg_element_1 = CALL_FUNCTION_WITH_ARGS2( tmp_called_3, tmp_call_arg_element_2, tmp_call_arg_element_3 );
if ( tmp_call_arg_element_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
Py_DECREF( tmp_called_2 );
frame_function->f_lineno = 151;
goto frame_exception_exit_1;
}
frame_function->f_lineno = 151;
tmp_raise_type_1 = CALL_FUNCTION_WITH_ARGS1( tmp_called_2, tmp_call_arg_element_1 );
Py_DECREF( tmp_called_2 );
Py_DECREF( tmp_call_arg_element_1 );
if ( tmp_raise_type_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 151;
goto frame_exception_exit_1;
}
exception_type = tmp_raise_type_1;
frame_function->f_lineno = 151;
RAISE_EXCEPTION_WITH_TYPE( &exception_type, &exception_value, &exception_tb );
goto frame_exception_exit_1;
goto branch_end_1;
branch_no_1:;
tmp_dircall_arg1_1 = _python_context->common_context->closure_f.storage->object;
if ( tmp_dircall_arg1_1 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 6491 ], 47, 0 );
exception_tb = NULL;
frame_function->f_lineno = 153;
goto frame_exception_exit_1;
}
tmp_dircall_arg2_1 = _python_context->closure_args.object;
if ( tmp_dircall_arg2_1 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 5435 ], 50, 0 );
exception_tb = NULL;
frame_function->f_lineno = 153;
goto frame_exception_exit_1;
}
tmp_dircall_arg3_1 = _python_context->closure_kwargs.object;
if ( tmp_dircall_arg3_1 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 71458 ], 52, 0 );
exception_tb = NULL;
frame_function->f_lineno = 153;
goto frame_exception_exit_1;
}
tmp_iter_arg_1 = impl_function_2_complex_call_helper_star_list_star_dict_of_module___internal__( INCREASE_REFCOUNT( tmp_dircall_arg1_1 ), INCREASE_REFCOUNT( tmp_dircall_arg2_1 ), INCREASE_REFCOUNT( tmp_dircall_arg3_1 ) );
if ( tmp_iter_arg_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 153;
goto frame_exception_exit_1;
}
tmp_assign_source_1 = MAKE_ITERATOR( tmp_iter_arg_1 );
Py_DECREF( tmp_iter_arg_1 );
if ( tmp_assign_source_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 153;
goto frame_exception_exit_1;
}
assert( _python_context->closure_for_loop_1__for_iterator.object == NULL );
_python_context->closure_for_loop_1__for_iterator.object = tmp_assign_source_1;
// Tried code
loop_start_1:;
tmp_next_source_1 = _python_context->closure_for_loop_1__for_iterator.object;
tmp_assign_source_2 = ITERATOR_NEXT( tmp_next_source_1 );
if (tmp_assign_source_2 == NULL)
{
if ( !ERROR_OCCURED() || HAS_STOP_ITERATION_OCCURED() )
{
goto loop_end_1;
}
else
{
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 153;
goto try_finally_handler_1;
}
}
if (_python_context->closure_for_loop_1__iter_value.object == NULL)
{
_python_context->closure_for_loop_1__iter_value.object = tmp_assign_source_2;
}
else
{
PyObject *old = _python_context->closure_for_loop_1__iter_value.object;
_python_context->closure_for_loop_1__iter_value.object = tmp_assign_source_2;
Py_DECREF( old );
}
tmp_assign_source_3 = _python_context->closure_for_loop_1__iter_value.object;
if (_python_context->closure_x.object == NULL)
{
_python_context->closure_x.object = INCREASE_REFCOUNT( tmp_assign_source_3 );
}
else
{
PyObject *old = _python_context->closure_x.object;
_python_context->closure_x.object = INCREASE_REFCOUNT( tmp_assign_source_3 );
Py_DECREF( old );
}
tmp_yield_1 = _python_context->closure_x.object;
tmp_unused = YIELD( generator, INCREASE_REFCOUNT( tmp_yield_1 ) );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 154;
goto try_finally_handler_1;
}
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 153;
goto try_finally_handler_1;
}
goto loop_start_1;
loop_end_1:;
// Final block of try/finally
// Tried block ends with no exception occured, note that.
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
try_finally_handler_1:;
exception_keeper_type_1 = exception_type;
exception_keeper_value_1 = exception_value;
exception_keeper_tb_1 = exception_tb;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
tmp_tried_lineno_1 = frame_function->f_lineno;
Py_XDECREF( _python_context->closure_for_loop_1__iter_value.object );
_python_context->closure_for_loop_1__iter_value.object = NULL;
Py_XDECREF( _python_context->closure_for_loop_1__for_iterator.object );
_python_context->closure_for_loop_1__for_iterator.object = NULL;
frame_function->f_lineno = tmp_tried_lineno_1;
// Re-reraise as necessary after finally was executed.
// Reraise exception if any.
if ( exception_keeper_type_1 != NULL )
{
exception_type = exception_keeper_type_1;
exception_value = exception_keeper_value_1;
exception_tb = exception_keeper_tb_1;
goto frame_exception_exit_1;
}
goto finally_end_1;
finally_end_1:;
branch_end_1:;
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
goto frame_no_exception_1;
frame_exception_exit_1:;
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
}
else if ( exception_tb->tb_frame != frame_function )
{
PyTracebackObject *traceback_new = (PyTracebackObject *)MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
traceback_new->tb_next = exception_tb;
exception_tb = traceback_new;
}
tmp_frame_locals = PyDict_New();
if ((_python_context->closure_x.object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_x,
_python_context->closure_x.object
);
}
if ((_python_context->common_context->closure_skip_val.storage != NULL && _python_context->common_context->closure_skip_val.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_skip_val,
_python_context->common_context->closure_skip_val.storage->object
);
}
if ((_python_context->common_context->closure_nose.storage != NULL && _python_context->common_context->closure_nose.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_nose,
_python_context->common_context->closure_nose.storage->object
);
}
if ((_python_context->common_context->closure_get_msg.storage != NULL && _python_context->common_context->closure_get_msg.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_get_msg,
_python_context->common_context->closure_get_msg.storage->object
);
}
if ((_python_context->closure_args.object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_args,
_python_context->closure_args.object
);
}
if ((_python_context->closure_kwargs.object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_kwargs,
_python_context->closure_kwargs.object
);
}
if ((_python_context->common_context->closure_f.storage != NULL && _python_context->common_context->closure_f.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_f,
_python_context->common_context->closure_f.storage->object
);
}
if ((_python_context->common_context->closure_msg.storage != NULL && _python_context->common_context->closure_msg.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_msg,
_python_context->common_context->closure_msg.storage->object
);
}
detachFrame( exception_tb, tmp_frame_locals );
#if PYTHON_VERSION > 300
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
Py_DECREF( frame_function );
// Return the error.
goto function_exception_exit;
frame_no_exception_1:;
PyErr_Restore( INCREASE_REFCOUNT( PyExc_StopIteration ), NULL, NULL );
generator->m_yielded = NULL;
swapFiber( &generator->m_yielder_context, &generator->m_caller_context );
// The above won't return, but we need to make it clear to the compiler
// as well, or else it will complain and/or generate inferior code.
assert(false);
return;
function_exception_exit:
assert( exception_type );
assert( exception_tb );
PyErr_Restore( exception_type, exception_value, (PyObject *)exception_tb );
generator->m_yielded = NULL;
swapFiber( &generator->m_yielder_context, &generator->m_caller_context );
}
static PyObject *impl_function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject *_python_par_args, PyObject *_python_par_kwargs )
{
// Create context if any
struct _context_common_function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t *_python_common_context = (struct _context_common_function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t *)self->m_context;
struct _context_generator_function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t *_python_context = new _context_generator_function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t;
_python_context->common_context = _python_common_context;
_python_common_context->ref_count += 1;
PyObject *result = Nuitka_Generator_New(
function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_context,
const_str_plain_skipper_gen,
codeobj_ede3fa1e264fb4431b96b88a61b0c0d1,
_python_context,
_context_generator_function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_destructor
);
if (unlikely( result == NULL ))
{
PyErr_Format( PyExc_RuntimeError, "cannot create function skipper_gen" );
return NULL;
}
// Copy to context parameter values and closured variables if any.
_python_context->closure_args.object = _python_par_args;
_python_context->closure_kwargs.object = _python_par_kwargs;
return result;
}
static PyObject *fparse_function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, Py_ssize_t args_size, PyObject *kw )
{
assert( kw == NULL || PyDict_Check( kw ) );
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_size = kw ? PyDict_Size( kw ) : 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_found = 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_only_found = 0;
Py_ssize_t args_given = args_size;
PyObject *_python_par_args = NULL;
PyObject *_python_par_kwargs = NULL;
if ( kw == NULL )
{
_python_par_kwargs = PyDict_New();
}
else
{
if ( ((PyDictObject *)kw)->ma_used > 0 )
{
#if PYTHON_VERSION < 330
_python_par_kwargs = _PyDict_NewPresized( ((PyDictObject *)kw)->ma_used );
for ( int i = 0; i <= ((PyDictObject *)kw)->ma_mask; i++ )
{
PyDictEntry *entry = &((PyDictObject *)kw)->ma_table[ i ];
if ( entry->me_value != NULL )
{
#if PYTHON_VERSION < 300
if (unlikely( !PyString_Check( entry->me_key ) && !PyUnicode_Check( entry->me_key ) ))
#else
if (unlikely( !PyUnicode_Check( entry->me_key ) ))
#endif
{
PyErr_Format( PyExc_TypeError, "skipper_gen() keywords must be strings" );
goto error_exit;
}
int res = PyDict_SetItem( _python_par_kwargs, entry->me_key, entry->me_value );
if (unlikely( res == -1 ))
{
goto error_exit;
}
}
}
#else
if ( _PyDict_HasSplitTable( (PyDictObject *)kw) )
{
PyDictObject *mp = (PyDictObject *)kw;
PyObject **newvalues = PyMem_NEW( PyObject *, mp->ma_keys->dk_size );
assert (newvalues != NULL);
PyDictObject *split_copy = PyObject_GC_New( PyDictObject, &PyDict_Type );
assert( split_copy != NULL );
split_copy->ma_values = newvalues;
split_copy->ma_keys = mp->ma_keys;
split_copy->ma_used = mp->ma_used;
mp->ma_keys->dk_refcnt += 1;
Nuitka_GC_Track( split_copy );
Py_ssize_t size = mp->ma_keys->dk_size;
for ( Py_ssize_t i = 0; i < size; i++ )
{
PyDictKeyEntry *entry = &split_copy->ma_keys->dk_entries[ i ];
if (unlikely( !PyUnicode_Check( entry->me_key ) ))
{
PyErr_Format( PyExc_TypeError, "skipper_gen() keywords must be strings" );
goto error_exit;
}
split_copy->ma_values[ i ] = INCREASE_REFCOUNT_X( mp->ma_values[ i ] );
}
_python_par_kwargs = (PyObject *)split_copy;
}
else
{
_python_par_kwargs = PyDict_New();
PyDictObject *mp = (PyDictObject *)kw;
Py_ssize_t size = mp->ma_keys->dk_size;
for ( Py_ssize_t i = 0; i < size; i++ )
{
PyDictKeyEntry *entry = &mp->ma_keys->dk_entries[i];
// TODO: One of these cases has been dealt with above.
PyObject *value;
if ( mp->ma_values )
{
value = mp->ma_values[ i ];
}
else
{
value = entry->me_value;
}
if ( value != NULL )
{
if (unlikely( !PyUnicode_Check( entry->me_key ) ))
{
PyErr_Format( PyExc_TypeError, "skipper_gen() keywords must be strings" );
goto error_exit;
}
int res = PyDict_SetItem( _python_par_kwargs, entry->me_key, value );
if (unlikely( res == -1 ))
{
goto error_exit;
}
}
}
}
#endif
}
else
{
_python_par_kwargs = PyDict_New();
}
}
// Copy left over argument values to the star list parameter given.
if ( args_given > 0 )
{
_python_par_args = PyTuple_New( args_size - 0 );
for( Py_ssize_t i = 0; i < args_size - 0; i++ )
{
PyTuple_SET_ITEM( _python_par_args, i, INCREASE_REFCOUNT( args[0+i] ) );
}
}
else
{
_python_par_args = INCREASE_REFCOUNT( const_tuple_empty );
}
return impl_function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( self, _python_par_args, _python_par_kwargs );
error_exit:;
Py_XDECREF( _python_par_args );
Py_XDECREF( _python_par_kwargs );
return NULL;
}
static PyObject *dparse_function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, int size )
{
if ( size == 2 )
{
return impl_function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( self, MAKE_TUPLE( &args[ 0 ], size > 0 ? size-0 : 0 ), PyDict_New() );
}
else
{
PyObject *result = fparse_function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( self, args, size, NULL );
return result;
}
}
static PyObject *impl_function_4_knownfailureif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject *_python_par_fail_condition, PyObject *_python_par_msg )
{
// No context is used.
// Local variable declarations.
PyObjectSharedLocalVariable par_fail_condition; par_fail_condition.storage->object = _python_par_fail_condition;
PyObjectSharedLocalVariable par_msg; par_msg.storage->object = _python_par_msg;
PyObjectSharedLocalVariable var_fail_val;
PyObjectLocalVariable var_knownfail_decorator;
PyObject *exception_type = NULL, *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
PyObject *tmp_assign_source_1;
PyObject *tmp_assign_source_2;
PyObject *tmp_assign_source_3;
PyObject *tmp_assign_source_4;
PyObject *tmp_compare_left_1;
PyObject *tmp_compare_right_1;
PyObject *tmp_frame_locals;
bool tmp_is_1;
PyObject *tmp_isinstance_cls_1;
PyObject *tmp_isinstance_inst_1;
int tmp_res;
PyObject *tmp_return_value;
PyObject *tmp_source_name_1;
tmp_return_value = NULL;
// Actual function code.
static PyFrameObject *cache_frame_function = NULL;
MAKE_OR_REUSE_FRAME( cache_frame_function, codeobj_88f84882d8f39ca911b2ba4696dd2c39, module_numpy$testing$decorators );
PyFrameObject *frame_function = cache_frame_function;
// Push the new frame as the currently active one.
pushFrameStack( frame_function );
// Mark the frame object as in use, ref count 1 will be up for reuse.
Py_INCREF( frame_function );
assert( Py_REFCNT( frame_function ) == 2 ); // Frame stack
#if PYTHON_VERSION >= 340
frame_function->f_executing += 1;
#endif
// Framed code:
tmp_compare_left_1 = par_msg.storage->object;
if ( tmp_compare_left_1 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 28198 ], 49, 0 );
exception_tb = NULL;
frame_function->f_lineno = 197;
goto frame_exception_exit_1;
}
tmp_compare_right_1 = Py_None;
tmp_is_1 = ( tmp_compare_left_1 == tmp_compare_right_1 );
if (tmp_is_1)
{
goto branch_yes_1;
}
else
{
goto branch_no_1;
}
branch_yes_1:;
tmp_assign_source_1 = const_str_digest_da8fa3b337a2e15d6c752cd258022f5e;
if (par_msg.storage->object == NULL)
{
par_msg.storage->object = INCREASE_REFCOUNT( tmp_assign_source_1 );
}
else
{
PyObject *old = par_msg.storage->object;
par_msg.storage->object = INCREASE_REFCOUNT( tmp_assign_source_1 );
Py_DECREF( old );
}
branch_no_1:;
tmp_isinstance_inst_1 = par_fail_condition.storage->object;
if ( tmp_isinstance_inst_1 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 210486 ], 60, 0 );
exception_tb = NULL;
frame_function->f_lineno = 201;
goto frame_exception_exit_1;
}
tmp_source_name_1 = GET_STRING_DICT_VALUE( moduledict_numpy$testing$decorators, (Nuitka_StringObject *)const_str_plain_collections );
if (unlikely( tmp_source_name_1 == NULL ))
{
tmp_source_name_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_collections );
}
if ( tmp_source_name_1 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_NameError );
exception_value = UNSTREAM_STRING( &constant_bin[ 7813 ], 40, 0 );
exception_tb = NULL;
frame_function->f_lineno = 201;
goto frame_exception_exit_1;
}
tmp_isinstance_cls_1 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_Callable );
if ( tmp_isinstance_cls_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 201;
goto frame_exception_exit_1;
}
tmp_res = Nuitka_IsInstance( tmp_isinstance_inst_1, tmp_isinstance_cls_1 );
Py_DECREF( tmp_isinstance_cls_1 );
if ( tmp_res == -1 )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 201;
goto frame_exception_exit_1;
}
if (tmp_res == 1)
{
goto branch_yes_2;
}
else
{
goto branch_no_2;
}
branch_yes_2:;
tmp_assign_source_2 = MAKE_FUNCTION_lambda_1_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators( par_fail_condition );
if ( tmp_assign_source_2 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
Py_DECREF( tmp_assign_source_2 );
frame_function->f_lineno = 202;
goto frame_exception_exit_1;
}
if (var_fail_val.storage->object == NULL)
{
var_fail_val.storage->object = tmp_assign_source_2;
}
else
{
PyObject *old = var_fail_val.storage->object;
var_fail_val.storage->object = tmp_assign_source_2;
Py_DECREF( old );
}
goto branch_end_2;
branch_no_2:;
tmp_assign_source_3 = MAKE_FUNCTION_lambda_2_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators( par_fail_condition );
if ( tmp_assign_source_3 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
Py_DECREF( tmp_assign_source_3 );
frame_function->f_lineno = 204;
goto frame_exception_exit_1;
}
if (var_fail_val.storage->object == NULL)
{
var_fail_val.storage->object = tmp_assign_source_3;
}
else
{
PyObject *old = var_fail_val.storage->object;
var_fail_val.storage->object = tmp_assign_source_3;
Py_DECREF( old );
}
branch_end_2:;
tmp_assign_source_4 = MAKE_FUNCTION_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators( var_fail_val, par_msg );
if ( tmp_assign_source_4 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
Py_DECREF( tmp_assign_source_4 );
frame_function->f_lineno = 206;
goto frame_exception_exit_1;
}
assert( var_knownfail_decorator.object == NULL );
var_knownfail_decorator.object = tmp_assign_source_4;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
// Put the previous frame back on top.
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
goto frame_no_exception_1;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
}
else if ( exception_tb->tb_frame != frame_function )
{
PyTracebackObject *traceback_new = (PyTracebackObject *)MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
traceback_new->tb_next = exception_tb;
exception_tb = traceback_new;
}
tmp_frame_locals = PyDict_New();
if ((var_fail_val.storage != NULL && var_fail_val.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_fail_val,
var_fail_val.storage->object
);
}
if ((var_knownfail_decorator.object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_knownfail_decorator,
var_knownfail_decorator.object
);
}
if ((par_fail_condition.storage != NULL && par_fail_condition.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_fail_condition,
par_fail_condition.storage->object
);
}
if ((par_msg.storage != NULL && par_msg.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_msg,
par_msg.storage->object
);
}
detachFrame( exception_tb, tmp_frame_locals );
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
// Return the error.
goto function_exception_exit;
frame_no_exception_1:;
tmp_return_value = var_knownfail_decorator.object;
Py_INCREF( tmp_return_value );
goto function_return_exit;
// Return statement must be present.
assert(false);
function_exception_exit:
assert( exception_type );
PyErr_Restore( exception_type, exception_value, (PyObject *)exception_tb );
return NULL;
function_return_exit:
return tmp_return_value;
}
static PyObject *fparse_function_4_knownfailureif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, Py_ssize_t args_size, PyObject *kw )
{
assert( kw == NULL || PyDict_Check( kw ) );
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_size = kw ? PyDict_Size( kw ) : 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_found = 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_only_found = 0;
Py_ssize_t args_given = args_size;
PyObject *_python_par_fail_condition = NULL;
PyObject *_python_par_msg = NULL;
// Copy given dictionary values to the the respective variables:
if ( kw_size > 0 )
{
Py_ssize_t ppos = 0;
PyObject *key, *value;
while( PyDict_Next( kw, &ppos, &key, &value ) )
{
#if PYTHON_VERSION < 300
if (unlikely( !PyString_Check( key ) && !PyUnicode_Check( key ) ))
#else
if (unlikely( !PyUnicode_Check( key ) ))
#endif
{
PyErr_Format( PyExc_TypeError, "knownfailureif() keywords must be strings" );
goto error_exit;
}
NUITKA_MAY_BE_UNUSED bool found = false;
Py_INCREF( key );
Py_INCREF( value );
// Quick path, could be our value.
if ( found == false && const_str_plain_fail_condition == key )
{
assert( _python_par_fail_condition == NULL );
_python_par_fail_condition = value;
found = true;
kw_found += 1;
}
if ( found == false && const_str_plain_msg == key )
{
assert( _python_par_msg == NULL );
_python_par_msg = value;
found = true;
kw_found += 1;
}
// Slow path, compare against all parameter names.
if ( found == false && RICH_COMPARE_BOOL_EQ( const_str_plain_fail_condition, key ) == 1 )
{
assert( _python_par_fail_condition == NULL );
_python_par_fail_condition = value;
found = true;
kw_found += 1;
}
if ( found == false && RICH_COMPARE_BOOL_EQ( const_str_plain_msg, key ) == 1 )
{
assert( _python_par_msg == NULL );
_python_par_msg = value;
found = true;
kw_found += 1;
}
Py_DECREF( key );
if ( found == false )
{
Py_DECREF( value );
PyErr_Format(
PyExc_TypeError,
"knownfailureif() got an unexpected keyword argument '%s'",
Nuitka_String_Check( key ) ? Nuitka_String_AsString( key ) : "<non-string>"
);
goto error_exit;
}
}
#if PYTHON_VERSION < 300
assert( kw_found == kw_size );
assert( kw_only_found == 0 );
#endif
}
// Check if too many arguments were given in case of non star args
if (unlikely( args_given > 2 ))
{
#if PYTHON_VERSION < 270
ERROR_TOO_MANY_ARGUMENTS( self, args_given, kw_size );
#elif PYTHON_VERSION < 330
ERROR_TOO_MANY_ARGUMENTS( self, args_given + kw_found );
#else
ERROR_TOO_MANY_ARGUMENTS( self, args_given, kw_only_found );
#endif
goto error_exit;
}
// Copy normal parameter values given as part of the args list to the respective variables:
if (likely( 0 < args_given ))
{
if (unlikely( _python_par_fail_condition != NULL ))
{
ERROR_MULTIPLE_VALUES( self, 0 );
goto error_exit;
}
_python_par_fail_condition = INCREASE_REFCOUNT( args[ 0 ] );
}
else if ( _python_par_fail_condition == NULL )
{
if ( 0 + self->m_defaults_given >= 2 )
{
_python_par_fail_condition = INCREASE_REFCOUNT( PyTuple_GET_ITEM( self->m_defaults, self->m_defaults_given + 0 - 2 ) );
}
#if PYTHON_VERSION < 330
else
{
#if PYTHON_VERSION < 270
ERROR_TOO_FEW_ARGUMENTS( self, kw_size, args_given + kw_found );
#elif PYTHON_VERSION < 300
ERROR_TOO_FEW_ARGUMENTS( self, args_given + kw_found );
#else
ERROR_TOO_FEW_ARGUMENTS( self, args_given + kw_found - kw_only_found );
#endif
goto error_exit;
}
#endif
}
if (likely( 1 < args_given ))
{
if (unlikely( _python_par_msg != NULL ))
{
ERROR_MULTIPLE_VALUES( self, 1 );
goto error_exit;
}
_python_par_msg = INCREASE_REFCOUNT( args[ 1 ] );
}
else if ( _python_par_msg == NULL )
{
if ( 1 + self->m_defaults_given >= 2 )
{
_python_par_msg = INCREASE_REFCOUNT( PyTuple_GET_ITEM( self->m_defaults, self->m_defaults_given + 1 - 2 ) );
}
#if PYTHON_VERSION < 330
else
{
#if PYTHON_VERSION < 270
ERROR_TOO_FEW_ARGUMENTS( self, kw_size, args_given + kw_found );
#elif PYTHON_VERSION < 300
ERROR_TOO_FEW_ARGUMENTS( self, args_given + kw_found );
#else
ERROR_TOO_FEW_ARGUMENTS( self, args_given + kw_found - kw_only_found );
#endif
goto error_exit;
}
#endif
}
#if PYTHON_VERSION >= 330
if (unlikely( _python_par_fail_condition == NULL || _python_par_msg == NULL ))
{
PyObject *values[] = { _python_par_fail_condition, _python_par_msg };
ERROR_TOO_FEW_ARGUMENTS( self, values );
goto error_exit;
}
#endif
return impl_function_4_knownfailureif_of_module_numpy$testing$decorators( self, _python_par_fail_condition, _python_par_msg );
error_exit:;
Py_XDECREF( _python_par_fail_condition );
Py_XDECREF( _python_par_msg );
return NULL;
}
static PyObject *dparse_function_4_knownfailureif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, int size )
{
if ( size == 2 )
{
return impl_function_4_knownfailureif_of_module_numpy$testing$decorators( self, INCREASE_REFCOUNT( args[ 0 ] ), INCREASE_REFCOUNT( args[ 1 ] ) );
}
else
{
PyObject *result = fparse_function_4_knownfailureif_of_module_numpy$testing$decorators( self, args, size, NULL );
return result;
}
}
static PyObject *impl_lambda_1_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self )
{
// The context of the function.
struct _context_lambda_1_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators_t *_python_context = (struct _context_lambda_1_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators_t *)self->m_context;
// Local variable declarations.
PyObject *exception_type = NULL, *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
PyObject *tmp_called_1;
PyObject *tmp_frame_locals;
PyObject *tmp_return_value;
tmp_return_value = NULL;
// Actual function code.
static PyFrameObject *cache_frame_function = NULL;
MAKE_OR_REUSE_FRAME( cache_frame_function, codeobj_309d7c4278ed80dc856b730b1d6b856c, module_numpy$testing$decorators );
PyFrameObject *frame_function = cache_frame_function;
// Push the new frame as the currently active one.
pushFrameStack( frame_function );
// Mark the frame object as in use, ref count 1 will be up for reuse.
Py_INCREF( frame_function );
assert( Py_REFCNT( frame_function ) == 2 ); // Frame stack
#if PYTHON_VERSION >= 340
frame_function->f_executing += 1;
#endif
// Framed code:
tmp_called_1 = _python_context->closure_fail_condition.storage->object;
if ( tmp_called_1 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 210486 ], 60, 0 );
exception_tb = NULL;
frame_function->f_lineno = 202;
goto frame_exception_exit_1;
}
frame_function->f_lineno = 202;
tmp_return_value = CALL_FUNCTION_NO_ARGS( tmp_called_1 );
if ( tmp_return_value == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 202;
goto frame_exception_exit_1;
}
goto frame_return_exit_1;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
// Put the previous frame back on top.
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
goto frame_no_exception_1;
frame_return_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
goto function_return_exit;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
}
else if ( exception_tb->tb_frame != frame_function )
{
PyTracebackObject *traceback_new = (PyTracebackObject *)MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
traceback_new->tb_next = exception_tb;
exception_tb = traceback_new;
}
tmp_frame_locals = PyDict_New();
if ((_python_context->closure_fail_condition.storage != NULL && _python_context->closure_fail_condition.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_fail_condition,
_python_context->closure_fail_condition.storage->object
);
}
detachFrame( exception_tb, tmp_frame_locals );
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
// Return the error.
goto function_exception_exit;
frame_no_exception_1:;
// Return statement must be present.
assert(false);
function_exception_exit:
assert( exception_type );
PyErr_Restore( exception_type, exception_value, (PyObject *)exception_tb );
return NULL;
function_return_exit:
return tmp_return_value;
}
static PyObject *fparse_lambda_1_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, Py_ssize_t args_size, PyObject *kw )
{
assert( kw == NULL || PyDict_Check( kw ) );
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_size = kw ? PyDict_Size( kw ) : 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_found = 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_only_found = 0;
Py_ssize_t args_given = args_size;
if (unlikely( args_given + kw_size > 0 ))
{
#if PYTHON_VERSION < 330
ERROR_NO_ARGUMENTS_ALLOWED(
self,
args_given + kw_size
);
#else
ERROR_NO_ARGUMENTS_ALLOWED(
self,
kw_size > 0 ? kw : NULL,
args_given
);
#endif
goto error_exit;
}
return impl_lambda_1_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators( self );
error_exit:;
return NULL;
}
static PyObject *dparse_lambda_1_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, int size )
{
if ( size == 0 )
{
return impl_lambda_1_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators( self );
}
else
{
PyObject *result = fparse_lambda_1_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators( self, args, size, NULL );
return result;
}
}
static PyObject *impl_lambda_2_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self )
{
// The context of the function.
struct _context_lambda_2_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators_t *_python_context = (struct _context_lambda_2_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators_t *)self->m_context;
// Local variable declarations.
PyObject *exception_type = NULL, *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
PyObject *tmp_frame_locals;
PyObject *tmp_return_value;
tmp_return_value = NULL;
// Actual function code.
static PyFrameObject *cache_frame_function = NULL;
MAKE_OR_REUSE_FRAME( cache_frame_function, codeobj_df08a236890a6fe25bd887010405ccbd, module_numpy$testing$decorators );
PyFrameObject *frame_function = cache_frame_function;
// Push the new frame as the currently active one.
pushFrameStack( frame_function );
// Mark the frame object as in use, ref count 1 will be up for reuse.
Py_INCREF( frame_function );
assert( Py_REFCNT( frame_function ) == 2 ); // Frame stack
#if PYTHON_VERSION >= 340
frame_function->f_executing += 1;
#endif
// Framed code:
tmp_return_value = _python_context->closure_fail_condition.storage->object;
if ( tmp_return_value == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 210486 ], 60, 0 );
exception_tb = NULL;
frame_function->f_lineno = 204;
goto frame_exception_exit_1;
}
Py_INCREF( tmp_return_value );
goto frame_return_exit_1;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
// Put the previous frame back on top.
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
goto frame_no_exception_1;
frame_return_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
goto function_return_exit;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
}
else if ( exception_tb->tb_frame != frame_function )
{
PyTracebackObject *traceback_new = (PyTracebackObject *)MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
traceback_new->tb_next = exception_tb;
exception_tb = traceback_new;
}
tmp_frame_locals = PyDict_New();
if ((_python_context->closure_fail_condition.storage != NULL && _python_context->closure_fail_condition.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_fail_condition,
_python_context->closure_fail_condition.storage->object
);
}
detachFrame( exception_tb, tmp_frame_locals );
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
// Return the error.
goto function_exception_exit;
frame_no_exception_1:;
// Return statement must be present.
assert(false);
function_exception_exit:
assert( exception_type );
PyErr_Restore( exception_type, exception_value, (PyObject *)exception_tb );
return NULL;
function_return_exit:
return tmp_return_value;
}
static PyObject *fparse_lambda_2_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, Py_ssize_t args_size, PyObject *kw )
{
assert( kw == NULL || PyDict_Check( kw ) );
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_size = kw ? PyDict_Size( kw ) : 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_found = 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_only_found = 0;
Py_ssize_t args_given = args_size;
if (unlikely( args_given + kw_size > 0 ))
{
#if PYTHON_VERSION < 330
ERROR_NO_ARGUMENTS_ALLOWED(
self,
args_given + kw_size
);
#else
ERROR_NO_ARGUMENTS_ALLOWED(
self,
kw_size > 0 ? kw : NULL,
args_given
);
#endif
goto error_exit;
}
return impl_lambda_2_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators( self );
error_exit:;
return NULL;
}
static PyObject *dparse_lambda_2_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, int size )
{
if ( size == 0 )
{
return impl_lambda_2_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators( self );
}
else
{
PyObject *result = fparse_lambda_2_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators( self, args, size, NULL );
return result;
}
}
static PyObject *impl_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject *_python_par_f )
{
// The context of the function.
struct _context_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators_t *_python_context = (struct _context_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators_t *)self->m_context;
// Local variable declarations.
PyObjectSharedLocalVariable par_f; par_f.storage->object = _python_par_f;
PyObjectLocalVariable var_nose;
PyObjectSharedLocalVariable var_KnownFailureTest;
PyObjectLocalVariable var_knownfailer;
PyObject *exception_type = NULL, *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
PyObject *tmp_assign_source_1;
PyObject *tmp_assign_source_2;
PyObject *tmp_assign_source_3;
PyObject *tmp_call_arg_element_1;
PyObject *tmp_call_arg_element_2;
PyObject *tmp_called_1;
PyObject *tmp_called_2;
PyObject *tmp_frame_locals;
PyObject *tmp_import_globals_1;
PyObject *tmp_import_globals_2;
PyObject *tmp_import_locals_1;
PyObject *tmp_import_locals_2;
PyObject *tmp_import_name_from_1;
PyObject *tmp_return_value;
PyObject *tmp_source_name_1;
PyObject *tmp_source_name_2;
tmp_return_value = NULL;
// Actual function code.
static PyFrameObject *cache_frame_function = NULL;
MAKE_OR_REUSE_FRAME( cache_frame_function, codeobj_b49401aaae2582f8d210111f5bd22faa, module_numpy$testing$decorators );
PyFrameObject *frame_function = cache_frame_function;
// Push the new frame as the currently active one.
pushFrameStack( frame_function );
// Mark the frame object as in use, ref count 1 will be up for reuse.
Py_INCREF( frame_function );
assert( Py_REFCNT( frame_function ) == 2 ); // Frame stack
#if PYTHON_VERSION >= 340
frame_function->f_executing += 1;
#endif
// Framed code:
tmp_import_globals_1 = ((PyModuleObject *)module_numpy$testing$decorators)->md_dict;
tmp_import_locals_1 = PyDict_New();
if ((var_nose.object != NULL))
{
PyDict_SetItem(
tmp_import_locals_1,
const_str_plain_nose,
var_nose.object
);
}
if ((var_KnownFailureTest.storage != NULL && var_KnownFailureTest.storage->object != NULL))
{
PyDict_SetItem(
tmp_import_locals_1,
const_str_plain_KnownFailureTest,
var_KnownFailureTest.storage->object
);
}
if ((var_knownfailer.object != NULL))
{
PyDict_SetItem(
tmp_import_locals_1,
const_str_plain_knownfailer,
var_knownfailer.object
);
}
if ((par_f.storage != NULL && par_f.storage->object != NULL))
{
PyDict_SetItem(
tmp_import_locals_1,
const_str_plain_f,
par_f.storage->object
);
}
frame_function->f_lineno = 209;
tmp_assign_source_1 = IMPORT_MODULE( const_str_plain_nose, tmp_import_globals_1, tmp_import_locals_1, Py_None, const_int_0 );
Py_DECREF( tmp_import_locals_1 );
if ( tmp_assign_source_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 209;
goto frame_exception_exit_1;
}
assert( var_nose.object == NULL );
var_nose.object = tmp_assign_source_1;
tmp_import_globals_2 = ((PyModuleObject *)module_numpy$testing$decorators)->md_dict;
tmp_import_locals_2 = PyDict_New();
if ((var_nose.object != NULL))
{
PyDict_SetItem(
tmp_import_locals_2,
const_str_plain_nose,
var_nose.object
);
}
if ((var_KnownFailureTest.storage != NULL && var_KnownFailureTest.storage->object != NULL))
{
PyDict_SetItem(
tmp_import_locals_2,
const_str_plain_KnownFailureTest,
var_KnownFailureTest.storage->object
);
}
if ((var_knownfailer.object != NULL))
{
PyDict_SetItem(
tmp_import_locals_2,
const_str_plain_knownfailer,
var_knownfailer.object
);
}
if ((par_f.storage != NULL && par_f.storage->object != NULL))
{
PyDict_SetItem(
tmp_import_locals_2,
const_str_plain_f,
par_f.storage->object
);
}
frame_function->f_lineno = 210;
tmp_import_name_from_1 = IMPORT_MODULE( const_str_plain_noseclasses, tmp_import_globals_2, tmp_import_locals_2, const_tuple_str_plain_KnownFailureTest_tuple, const_int_pos_1 );
Py_DECREF( tmp_import_locals_2 );
if ( tmp_import_name_from_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 210;
goto frame_exception_exit_1;
}
tmp_assign_source_2 = IMPORT_NAME( tmp_import_name_from_1, const_str_plain_KnownFailureTest );
Py_DECREF( tmp_import_name_from_1 );
if ( tmp_assign_source_2 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 210;
goto frame_exception_exit_1;
}
if (var_KnownFailureTest.storage->object == NULL)
{
var_KnownFailureTest.storage->object = tmp_assign_source_2;
}
else
{
PyObject *old = var_KnownFailureTest.storage->object;
var_KnownFailureTest.storage->object = tmp_assign_source_2;
Py_DECREF( old );
}
tmp_assign_source_3 = MAKE_FUNCTION_function_1_knownfailer_of_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators( var_KnownFailureTest, par_f, _python_context->closure_fail_val, _python_context->closure_msg );
if ( tmp_assign_source_3 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
Py_DECREF( tmp_assign_source_3 );
frame_function->f_lineno = 211;
goto frame_exception_exit_1;
}
assert( var_knownfailer.object == NULL );
var_knownfailer.object = tmp_assign_source_3;
tmp_source_name_2 = var_nose.object;
tmp_source_name_1 = LOOKUP_ATTRIBUTE( tmp_source_name_2, const_str_plain_tools );
if ( tmp_source_name_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 216;
goto frame_exception_exit_1;
}
tmp_called_2 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_make_decorator );
Py_DECREF( tmp_source_name_1 );
if ( tmp_called_2 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 216;
goto frame_exception_exit_1;
}
tmp_call_arg_element_1 = par_f.storage->object;
if ( tmp_call_arg_element_1 == NULL )
{
Py_DECREF( tmp_called_2 );
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 6491 ], 47, 0 );
exception_tb = NULL;
frame_function->f_lineno = 216;
goto frame_exception_exit_1;
}
frame_function->f_lineno = 216;
tmp_called_1 = CALL_FUNCTION_WITH_ARGS1( tmp_called_2, tmp_call_arg_element_1 );
Py_DECREF( tmp_called_2 );
if ( tmp_called_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 216;
goto frame_exception_exit_1;
}
tmp_call_arg_element_2 = var_knownfailer.object;
frame_function->f_lineno = 216;
tmp_return_value = CALL_FUNCTION_WITH_ARGS1( tmp_called_1, tmp_call_arg_element_2 );
Py_DECREF( tmp_called_1 );
if ( tmp_return_value == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 216;
goto frame_exception_exit_1;
}
goto frame_return_exit_1;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
// Put the previous frame back on top.
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
goto frame_no_exception_1;
frame_return_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
goto function_return_exit;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
}
else if ( exception_tb->tb_frame != frame_function )
{
PyTracebackObject *traceback_new = (PyTracebackObject *)MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
traceback_new->tb_next = exception_tb;
exception_tb = traceback_new;
}
tmp_frame_locals = PyDict_New();
if ((var_nose.object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_nose,
var_nose.object
);
}
if ((var_KnownFailureTest.storage != NULL && var_KnownFailureTest.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_KnownFailureTest,
var_KnownFailureTest.storage->object
);
}
if ((var_knownfailer.object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_knownfailer,
var_knownfailer.object
);
}
if ((par_f.storage != NULL && par_f.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_f,
par_f.storage->object
);
}
detachFrame( exception_tb, tmp_frame_locals );
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
// Return the error.
goto function_exception_exit;
frame_no_exception_1:;
// Return statement must be present.
assert(false);
function_exception_exit:
assert( exception_type );
PyErr_Restore( exception_type, exception_value, (PyObject *)exception_tb );
return NULL;
function_return_exit:
return tmp_return_value;
}
static PyObject *fparse_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, Py_ssize_t args_size, PyObject *kw )
{
assert( kw == NULL || PyDict_Check( kw ) );
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_size = kw ? PyDict_Size( kw ) : 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_found = 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_only_found = 0;
Py_ssize_t args_given = args_size;
PyObject *_python_par_f = NULL;
// Copy given dictionary values to the the respective variables:
if ( kw_size > 0 )
{
Py_ssize_t ppos = 0;
PyObject *key, *value;
while( PyDict_Next( kw, &ppos, &key, &value ) )
{
#if PYTHON_VERSION < 300
if (unlikely( !PyString_Check( key ) && !PyUnicode_Check( key ) ))
#else
if (unlikely( !PyUnicode_Check( key ) ))
#endif
{
PyErr_Format( PyExc_TypeError, "knownfail_decorator() keywords must be strings" );
goto error_exit;
}
NUITKA_MAY_BE_UNUSED bool found = false;
Py_INCREF( key );
Py_INCREF( value );
// Quick path, could be our value.
if ( found == false && const_str_plain_f == key )
{
assert( _python_par_f == NULL );
_python_par_f = value;
found = true;
kw_found += 1;
}
// Slow path, compare against all parameter names.
if ( found == false && RICH_COMPARE_BOOL_EQ( const_str_plain_f, key ) == 1 )
{
assert( _python_par_f == NULL );
_python_par_f = value;
found = true;
kw_found += 1;
}
Py_DECREF( key );
if ( found == false )
{
Py_DECREF( value );
PyErr_Format(
PyExc_TypeError,
"knownfail_decorator() got an unexpected keyword argument '%s'",
Nuitka_String_Check( key ) ? Nuitka_String_AsString( key ) : "<non-string>"
);
goto error_exit;
}
}
#if PYTHON_VERSION < 300
assert( kw_found == kw_size );
assert( kw_only_found == 0 );
#endif
}
// Check if too many arguments were given in case of non star args
if (unlikely( args_given > 1 ))
{
#if PYTHON_VERSION < 270
ERROR_TOO_MANY_ARGUMENTS( self, args_given, kw_size );
#elif PYTHON_VERSION < 330
ERROR_TOO_MANY_ARGUMENTS( self, args_given + kw_found );
#else
ERROR_TOO_MANY_ARGUMENTS( self, args_given, kw_only_found );
#endif
goto error_exit;
}
// Copy normal parameter values given as part of the args list to the respective variables:
if (likely( 0 < args_given ))
{
if (unlikely( _python_par_f != NULL ))
{
ERROR_MULTIPLE_VALUES( self, 0 );
goto error_exit;
}
_python_par_f = INCREASE_REFCOUNT( args[ 0 ] );
}
else if ( _python_par_f == NULL )
{
if ( 0 + self->m_defaults_given >= 1 )
{
_python_par_f = INCREASE_REFCOUNT( PyTuple_GET_ITEM( self->m_defaults, self->m_defaults_given + 0 - 1 ) );
}
#if PYTHON_VERSION < 330
else
{
#if PYTHON_VERSION < 270
ERROR_TOO_FEW_ARGUMENTS( self, kw_size, args_given + kw_found );
#elif PYTHON_VERSION < 300
ERROR_TOO_FEW_ARGUMENTS( self, args_given + kw_found );
#else
ERROR_TOO_FEW_ARGUMENTS( self, args_given + kw_found - kw_only_found );
#endif
goto error_exit;
}
#endif
}
#if PYTHON_VERSION >= 330
if (unlikely( _python_par_f == NULL ))
{
PyObject *values[] = { _python_par_f };
ERROR_TOO_FEW_ARGUMENTS( self, values );
goto error_exit;
}
#endif
return impl_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators( self, _python_par_f );
error_exit:;
Py_XDECREF( _python_par_f );
return NULL;
}
static PyObject *dparse_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, int size )
{
if ( size == 1 )
{
return impl_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators( self, INCREASE_REFCOUNT( args[ 0 ] ) );
}
else
{
PyObject *result = fparse_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators( self, args, size, NULL );
return result;
}
}
static PyObject *impl_function_1_knownfailer_of_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject *_python_par_args, PyObject *_python_par_kwargs )
{
// The context of the function.
struct _context_function_1_knownfailer_of_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators_t *_python_context = (struct _context_function_1_knownfailer_of_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators_t *)self->m_context;
// Local variable declarations.
PyObjectLocalVariable par_args; par_args.object = _python_par_args;
PyObjectLocalVariable par_kwargs; par_kwargs.object = _python_par_kwargs;
PyObject *exception_type = NULL, *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
PyObject *tmp_call_arg_element_1;
PyObject *tmp_called_1;
PyObject *tmp_called_2;
int tmp_cond_truth_1;
PyObject *tmp_cond_value_1;
PyObject *tmp_dircall_arg1_1;
PyObject *tmp_dircall_arg2_1;
PyObject *tmp_dircall_arg3_1;
PyObject *tmp_frame_locals;
PyObject *tmp_raise_type_1;
PyObject *tmp_return_value;
tmp_return_value = NULL;
// Actual function code.
static PyFrameObject *cache_frame_function = NULL;
MAKE_OR_REUSE_FRAME( cache_frame_function, codeobj_3f988eaf18b4fc56137ae30ab67e55cc, module_numpy$testing$decorators );
PyFrameObject *frame_function = cache_frame_function;
// Push the new frame as the currently active one.
pushFrameStack( frame_function );
// Mark the frame object as in use, ref count 1 will be up for reuse.
Py_INCREF( frame_function );
assert( Py_REFCNT( frame_function ) == 2 ); // Frame stack
#if PYTHON_VERSION >= 340
frame_function->f_executing += 1;
#endif
// Framed code:
tmp_called_1 = _python_context->closure_fail_val.storage->object;
if ( tmp_called_1 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 210546 ], 54, 0 );
exception_tb = NULL;
frame_function->f_lineno = 212;
goto frame_exception_exit_1;
}
frame_function->f_lineno = 212;
tmp_cond_value_1 = CALL_FUNCTION_NO_ARGS( tmp_called_1 );
if ( tmp_cond_value_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 212;
goto frame_exception_exit_1;
}
tmp_cond_truth_1 = CHECK_IF_TRUE( tmp_cond_value_1 );
if ( tmp_cond_truth_1 == -1 )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
Py_DECREF( tmp_cond_value_1 );
frame_function->f_lineno = 212;
goto frame_exception_exit_1;
}
Py_DECREF( tmp_cond_value_1 );
if (tmp_cond_truth_1 == 1)
{
goto branch_yes_1;
}
else
{
goto branch_no_1;
}
branch_yes_1:;
tmp_called_2 = _python_context->closure_KnownFailureTest.storage->object;
if ( tmp_called_2 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 210600 ], 62, 0 );
exception_tb = NULL;
frame_function->f_lineno = 213;
goto frame_exception_exit_1;
}
tmp_call_arg_element_1 = _python_context->closure_msg.storage->object;
if ( tmp_call_arg_element_1 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 28198 ], 49, 0 );
exception_tb = NULL;
frame_function->f_lineno = 213;
goto frame_exception_exit_1;
}
frame_function->f_lineno = 213;
tmp_raise_type_1 = CALL_FUNCTION_WITH_ARGS1( tmp_called_2, tmp_call_arg_element_1 );
if ( tmp_raise_type_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 213;
goto frame_exception_exit_1;
}
exception_type = tmp_raise_type_1;
frame_function->f_lineno = 213;
RAISE_EXCEPTION_WITH_TYPE( &exception_type, &exception_value, &exception_tb );
goto frame_exception_exit_1;
goto branch_end_1;
branch_no_1:;
tmp_dircall_arg1_1 = _python_context->closure_f.storage->object;
if ( tmp_dircall_arg1_1 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 6491 ], 47, 0 );
exception_tb = NULL;
frame_function->f_lineno = 215;
goto frame_exception_exit_1;
}
tmp_dircall_arg2_1 = par_args.object;
if ( tmp_dircall_arg2_1 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 5435 ], 50, 0 );
exception_tb = NULL;
frame_function->f_lineno = 215;
goto frame_exception_exit_1;
}
tmp_dircall_arg3_1 = par_kwargs.object;
if ( tmp_dircall_arg3_1 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 71458 ], 52, 0 );
exception_tb = NULL;
frame_function->f_lineno = 215;
goto frame_exception_exit_1;
}
tmp_return_value = impl_function_2_complex_call_helper_star_list_star_dict_of_module___internal__( INCREASE_REFCOUNT( tmp_dircall_arg1_1 ), INCREASE_REFCOUNT( tmp_dircall_arg2_1 ), INCREASE_REFCOUNT( tmp_dircall_arg3_1 ) );
if ( tmp_return_value == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 215;
goto frame_exception_exit_1;
}
goto frame_return_exit_1;
branch_end_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
// Put the previous frame back on top.
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
goto frame_no_exception_1;
frame_return_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
goto function_return_exit;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
}
else if ( exception_tb->tb_frame != frame_function )
{
PyTracebackObject *traceback_new = (PyTracebackObject *)MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
traceback_new->tb_next = exception_tb;
exception_tb = traceback_new;
}
tmp_frame_locals = PyDict_New();
if ((_python_context->closure_fail_val.storage != NULL && _python_context->closure_fail_val.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_fail_val,
_python_context->closure_fail_val.storage->object
);
}
if ((_python_context->closure_KnownFailureTest.storage != NULL && _python_context->closure_KnownFailureTest.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_KnownFailureTest,
_python_context->closure_KnownFailureTest.storage->object
);
}
if ((par_args.object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_args,
par_args.object
);
}
if ((par_kwargs.object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_kwargs,
par_kwargs.object
);
}
if ((_python_context->closure_msg.storage != NULL && _python_context->closure_msg.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_msg,
_python_context->closure_msg.storage->object
);
}
if ((_python_context->closure_f.storage != NULL && _python_context->closure_f.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_f,
_python_context->closure_f.storage->object
);
}
detachFrame( exception_tb, tmp_frame_locals );
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
// Return the error.
goto function_exception_exit;
frame_no_exception_1:;
// Return statement must be present.
assert(false);
function_exception_exit:
assert( exception_type );
PyErr_Restore( exception_type, exception_value, (PyObject *)exception_tb );
return NULL;
function_return_exit:
return tmp_return_value;
}
static PyObject *fparse_function_1_knownfailer_of_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, Py_ssize_t args_size, PyObject *kw )
{
assert( kw == NULL || PyDict_Check( kw ) );
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_size = kw ? PyDict_Size( kw ) : 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_found = 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_only_found = 0;
Py_ssize_t args_given = args_size;
PyObject *_python_par_args = NULL;
PyObject *_python_par_kwargs = NULL;
if ( kw == NULL )
{
_python_par_kwargs = PyDict_New();
}
else
{
if ( ((PyDictObject *)kw)->ma_used > 0 )
{
#if PYTHON_VERSION < 330
_python_par_kwargs = _PyDict_NewPresized( ((PyDictObject *)kw)->ma_used );
for ( int i = 0; i <= ((PyDictObject *)kw)->ma_mask; i++ )
{
PyDictEntry *entry = &((PyDictObject *)kw)->ma_table[ i ];
if ( entry->me_value != NULL )
{
#if PYTHON_VERSION < 300
if (unlikely( !PyString_Check( entry->me_key ) && !PyUnicode_Check( entry->me_key ) ))
#else
if (unlikely( !PyUnicode_Check( entry->me_key ) ))
#endif
{
PyErr_Format( PyExc_TypeError, "knownfailer() keywords must be strings" );
goto error_exit;
}
int res = PyDict_SetItem( _python_par_kwargs, entry->me_key, entry->me_value );
if (unlikely( res == -1 ))
{
goto error_exit;
}
}
}
#else
if ( _PyDict_HasSplitTable( (PyDictObject *)kw) )
{
PyDictObject *mp = (PyDictObject *)kw;
PyObject **newvalues = PyMem_NEW( PyObject *, mp->ma_keys->dk_size );
assert (newvalues != NULL);
PyDictObject *split_copy = PyObject_GC_New( PyDictObject, &PyDict_Type );
assert( split_copy != NULL );
split_copy->ma_values = newvalues;
split_copy->ma_keys = mp->ma_keys;
split_copy->ma_used = mp->ma_used;
mp->ma_keys->dk_refcnt += 1;
Nuitka_GC_Track( split_copy );
Py_ssize_t size = mp->ma_keys->dk_size;
for ( Py_ssize_t i = 0; i < size; i++ )
{
PyDictKeyEntry *entry = &split_copy->ma_keys->dk_entries[ i ];
if (unlikely( !PyUnicode_Check( entry->me_key ) ))
{
PyErr_Format( PyExc_TypeError, "knownfailer() keywords must be strings" );
goto error_exit;
}
split_copy->ma_values[ i ] = INCREASE_REFCOUNT_X( mp->ma_values[ i ] );
}
_python_par_kwargs = (PyObject *)split_copy;
}
else
{
_python_par_kwargs = PyDict_New();
PyDictObject *mp = (PyDictObject *)kw;
Py_ssize_t size = mp->ma_keys->dk_size;
for ( Py_ssize_t i = 0; i < size; i++ )
{
PyDictKeyEntry *entry = &mp->ma_keys->dk_entries[i];
// TODO: One of these cases has been dealt with above.
PyObject *value;
if ( mp->ma_values )
{
value = mp->ma_values[ i ];
}
else
{
value = entry->me_value;
}
if ( value != NULL )
{
if (unlikely( !PyUnicode_Check( entry->me_key ) ))
{
PyErr_Format( PyExc_TypeError, "knownfailer() keywords must be strings" );
goto error_exit;
}
int res = PyDict_SetItem( _python_par_kwargs, entry->me_key, value );
if (unlikely( res == -1 ))
{
goto error_exit;
}
}
}
}
#endif
}
else
{
_python_par_kwargs = PyDict_New();
}
}
// Copy left over argument values to the star list parameter given.
if ( args_given > 0 )
{
_python_par_args = PyTuple_New( args_size - 0 );
for( Py_ssize_t i = 0; i < args_size - 0; i++ )
{
PyTuple_SET_ITEM( _python_par_args, i, INCREASE_REFCOUNT( args[0+i] ) );
}
}
else
{
_python_par_args = INCREASE_REFCOUNT( const_tuple_empty );
}
return impl_function_1_knownfailer_of_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators( self, _python_par_args, _python_par_kwargs );
error_exit:;
Py_XDECREF( _python_par_args );
Py_XDECREF( _python_par_kwargs );
return NULL;
}
static PyObject *dparse_function_1_knownfailer_of_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, int size )
{
if ( size == 2 )
{
return impl_function_1_knownfailer_of_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators( self, MAKE_TUPLE( &args[ 0 ], size > 0 ? size-0 : 0 ), PyDict_New() );
}
else
{
PyObject *result = fparse_function_1_knownfailer_of_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators( self, args, size, NULL );
return result;
}
}
static PyObject *impl_function_5_deprecated_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject *_python_par_conditional )
{
// No context is used.
// Local variable declarations.
PyObjectSharedLocalVariable par_conditional; par_conditional.storage->object = _python_par_conditional;
PyObjectLocalVariable var_deprecate_decorator;
PyObject *exception_type = NULL, *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
PyObject *tmp_assign_source_1;
PyObject *tmp_frame_locals;
PyObject *tmp_return_value;
tmp_return_value = NULL;
// Actual function code.
static PyFrameObject *cache_frame_function = NULL;
MAKE_OR_REUSE_FRAME( cache_frame_function, codeobj_2f7a5b07a91aaba658b6bdb2664f75e6, module_numpy$testing$decorators );
PyFrameObject *frame_function = cache_frame_function;
// Push the new frame as the currently active one.
pushFrameStack( frame_function );
// Mark the frame object as in use, ref count 1 will be up for reuse.
Py_INCREF( frame_function );
assert( Py_REFCNT( frame_function ) == 2 ); // Frame stack
#if PYTHON_VERSION >= 340
frame_function->f_executing += 1;
#endif
// Framed code:
tmp_assign_source_1 = MAKE_FUNCTION_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators( par_conditional );
if ( tmp_assign_source_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
Py_DECREF( tmp_assign_source_1 );
frame_function->f_lineno = 245;
goto frame_exception_exit_1;
}
assert( var_deprecate_decorator.object == NULL );
var_deprecate_decorator.object = tmp_assign_source_1;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
// Put the previous frame back on top.
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
goto frame_no_exception_1;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
}
else if ( exception_tb->tb_frame != frame_function )
{
PyTracebackObject *traceback_new = (PyTracebackObject *)MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
traceback_new->tb_next = exception_tb;
exception_tb = traceback_new;
}
tmp_frame_locals = PyDict_New();
if ((var_deprecate_decorator.object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_deprecate_decorator,
var_deprecate_decorator.object
);
}
if ((par_conditional.storage != NULL && par_conditional.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_conditional,
par_conditional.storage->object
);
}
detachFrame( exception_tb, tmp_frame_locals );
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
// Return the error.
goto function_exception_exit;
frame_no_exception_1:;
tmp_return_value = var_deprecate_decorator.object;
Py_INCREF( tmp_return_value );
goto function_return_exit;
// Return statement must be present.
assert(false);
function_exception_exit:
assert( exception_type );
PyErr_Restore( exception_type, exception_value, (PyObject *)exception_tb );
return NULL;
function_return_exit:
return tmp_return_value;
}
static PyObject *fparse_function_5_deprecated_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, Py_ssize_t args_size, PyObject *kw )
{
assert( kw == NULL || PyDict_Check( kw ) );
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_size = kw ? PyDict_Size( kw ) : 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_found = 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_only_found = 0;
Py_ssize_t args_given = args_size;
PyObject *_python_par_conditional = NULL;
// Copy given dictionary values to the the respective variables:
if ( kw_size > 0 )
{
Py_ssize_t ppos = 0;
PyObject *key, *value;
while( PyDict_Next( kw, &ppos, &key, &value ) )
{
#if PYTHON_VERSION < 300
if (unlikely( !PyString_Check( key ) && !PyUnicode_Check( key ) ))
#else
if (unlikely( !PyUnicode_Check( key ) ))
#endif
{
PyErr_Format( PyExc_TypeError, "deprecated() keywords must be strings" );
goto error_exit;
}
NUITKA_MAY_BE_UNUSED bool found = false;
Py_INCREF( key );
Py_INCREF( value );
// Quick path, could be our value.
if ( found == false && const_str_plain_conditional == key )
{
assert( _python_par_conditional == NULL );
_python_par_conditional = value;
found = true;
kw_found += 1;
}
// Slow path, compare against all parameter names.
if ( found == false && RICH_COMPARE_BOOL_EQ( const_str_plain_conditional, key ) == 1 )
{
assert( _python_par_conditional == NULL );
_python_par_conditional = value;
found = true;
kw_found += 1;
}
Py_DECREF( key );
if ( found == false )
{
Py_DECREF( value );
PyErr_Format(
PyExc_TypeError,
"deprecated() got an unexpected keyword argument '%s'",
Nuitka_String_Check( key ) ? Nuitka_String_AsString( key ) : "<non-string>"
);
goto error_exit;
}
}
#if PYTHON_VERSION < 300
assert( kw_found == kw_size );
assert( kw_only_found == 0 );
#endif
}
// Check if too many arguments were given in case of non star args
if (unlikely( args_given > 1 ))
{
#if PYTHON_VERSION < 270
ERROR_TOO_MANY_ARGUMENTS( self, args_given, kw_size );
#elif PYTHON_VERSION < 330
ERROR_TOO_MANY_ARGUMENTS( self, args_given + kw_found );
#else
ERROR_TOO_MANY_ARGUMENTS( self, args_given, kw_only_found );
#endif
goto error_exit;
}
// Copy normal parameter values given as part of the args list to the respective variables:
if (likely( 0 < args_given ))
{
if (unlikely( _python_par_conditional != NULL ))
{
ERROR_MULTIPLE_VALUES( self, 0 );
goto error_exit;
}
_python_par_conditional = INCREASE_REFCOUNT( args[ 0 ] );
}
else if ( _python_par_conditional == NULL )
{
if ( 0 + self->m_defaults_given >= 1 )
{
_python_par_conditional = INCREASE_REFCOUNT( PyTuple_GET_ITEM( self->m_defaults, self->m_defaults_given + 0 - 1 ) );
}
#if PYTHON_VERSION < 330
else
{
#if PYTHON_VERSION < 270
ERROR_TOO_FEW_ARGUMENTS( self, kw_size, args_given + kw_found );
#elif PYTHON_VERSION < 300
ERROR_TOO_FEW_ARGUMENTS( self, args_given + kw_found );
#else
ERROR_TOO_FEW_ARGUMENTS( self, args_given + kw_found - kw_only_found );
#endif
goto error_exit;
}
#endif
}
#if PYTHON_VERSION >= 330
if (unlikely( _python_par_conditional == NULL ))
{
PyObject *values[] = { _python_par_conditional };
ERROR_TOO_FEW_ARGUMENTS( self, values );
goto error_exit;
}
#endif
return impl_function_5_deprecated_of_module_numpy$testing$decorators( self, _python_par_conditional );
error_exit:;
Py_XDECREF( _python_par_conditional );
return NULL;
}
static PyObject *dparse_function_5_deprecated_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, int size )
{
if ( size == 1 )
{
return impl_function_5_deprecated_of_module_numpy$testing$decorators( self, INCREASE_REFCOUNT( args[ 0 ] ) );
}
else
{
PyObject *result = fparse_function_5_deprecated_of_module_numpy$testing$decorators( self, args, size, NULL );
return result;
}
}
static PyObject *impl_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject *_python_par_f )
{
// The context of the function.
struct _context_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators_t *_python_context = (struct _context_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators_t *)self->m_context;
// Local variable declarations.
PyObjectSharedLocalVariable par_f; par_f.storage->object = _python_par_f;
PyObjectLocalVariable var_nose;
PyObjectLocalVariable var_KnownFailureTest;
PyObjectLocalVariable var__deprecated_imp;
PyObjectLocalVariable var_cond;
PyObject *exception_type = NULL, *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
PyObject *tmp_assign_source_1;
PyObject *tmp_assign_source_2;
PyObject *tmp_assign_source_3;
PyObject *tmp_assign_source_4;
PyObject *tmp_assign_source_5;
PyObject *tmp_call_arg_element_1;
PyObject *tmp_call_arg_element_2;
PyObject *tmp_called_1;
PyObject *tmp_called_2;
PyObject *tmp_called_3;
int tmp_cond_truth_1;
PyObject *tmp_cond_value_1;
PyObject *tmp_frame_locals;
PyObject *tmp_import_globals_1;
PyObject *tmp_import_globals_2;
PyObject *tmp_import_locals_1;
PyObject *tmp_import_locals_2;
PyObject *tmp_import_name_from_1;
PyObject *tmp_isinstance_cls_1;
PyObject *tmp_isinstance_inst_1;
int tmp_res;
PyObject *tmp_return_value;
PyObject *tmp_source_name_1;
PyObject *tmp_source_name_2;
PyObject *tmp_source_name_3;
tmp_return_value = NULL;
// Actual function code.
static PyFrameObject *cache_frame_function = NULL;
MAKE_OR_REUSE_FRAME( cache_frame_function, codeobj_af3bfc072ee41a616775b66edc349ae0, module_numpy$testing$decorators );
PyFrameObject *frame_function = cache_frame_function;
// Push the new frame as the currently active one.
pushFrameStack( frame_function );
// Mark the frame object as in use, ref count 1 will be up for reuse.
Py_INCREF( frame_function );
assert( Py_REFCNT( frame_function ) == 2 ); // Frame stack
#if PYTHON_VERSION >= 340
frame_function->f_executing += 1;
#endif
// Framed code:
tmp_import_globals_1 = ((PyModuleObject *)module_numpy$testing$decorators)->md_dict;
tmp_import_locals_1 = PyDict_New();
if ((var_nose.object != NULL))
{
PyDict_SetItem(
tmp_import_locals_1,
const_str_plain_nose,
var_nose.object
);
}
if ((var_KnownFailureTest.object != NULL))
{
PyDict_SetItem(
tmp_import_locals_1,
const_str_plain_KnownFailureTest,
var_KnownFailureTest.object
);
}
if ((var__deprecated_imp.object != NULL))
{
PyDict_SetItem(
tmp_import_locals_1,
const_str_plain__deprecated_imp,
var__deprecated_imp.object
);
}
if ((var_cond.object != NULL))
{
PyDict_SetItem(
tmp_import_locals_1,
const_str_plain_cond,
var_cond.object
);
}
if ((par_f.storage != NULL && par_f.storage->object != NULL))
{
PyDict_SetItem(
tmp_import_locals_1,
const_str_plain_f,
par_f.storage->object
);
}
if ((_python_context->closure_conditional.storage != NULL && _python_context->closure_conditional.storage->object != NULL))
{
PyDict_SetItem(
tmp_import_locals_1,
const_str_plain_conditional,
_python_context->closure_conditional.storage->object
);
}
frame_function->f_lineno = 248;
tmp_assign_source_1 = IMPORT_MODULE( const_str_plain_nose, tmp_import_globals_1, tmp_import_locals_1, Py_None, const_int_0 );
Py_DECREF( tmp_import_locals_1 );
if ( tmp_assign_source_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 248;
goto frame_exception_exit_1;
}
assert( var_nose.object == NULL );
var_nose.object = tmp_assign_source_1;
tmp_import_globals_2 = ((PyModuleObject *)module_numpy$testing$decorators)->md_dict;
tmp_import_locals_2 = PyDict_New();
if ((var_nose.object != NULL))
{
PyDict_SetItem(
tmp_import_locals_2,
const_str_plain_nose,
var_nose.object
);
}
if ((var_KnownFailureTest.object != NULL))
{
PyDict_SetItem(
tmp_import_locals_2,
const_str_plain_KnownFailureTest,
var_KnownFailureTest.object
);
}
if ((var__deprecated_imp.object != NULL))
{
PyDict_SetItem(
tmp_import_locals_2,
const_str_plain__deprecated_imp,
var__deprecated_imp.object
);
}
if ((var_cond.object != NULL))
{
PyDict_SetItem(
tmp_import_locals_2,
const_str_plain_cond,
var_cond.object
);
}
if ((par_f.storage != NULL && par_f.storage->object != NULL))
{
PyDict_SetItem(
tmp_import_locals_2,
const_str_plain_f,
par_f.storage->object
);
}
if ((_python_context->closure_conditional.storage != NULL && _python_context->closure_conditional.storage->object != NULL))
{
PyDict_SetItem(
tmp_import_locals_2,
const_str_plain_conditional,
_python_context->closure_conditional.storage->object
);
}
frame_function->f_lineno = 249;
tmp_import_name_from_1 = IMPORT_MODULE( const_str_plain_noseclasses, tmp_import_globals_2, tmp_import_locals_2, const_tuple_str_plain_KnownFailureTest_tuple, const_int_pos_1 );
Py_DECREF( tmp_import_locals_2 );
if ( tmp_import_name_from_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 249;
goto frame_exception_exit_1;
}
tmp_assign_source_2 = IMPORT_NAME( tmp_import_name_from_1, const_str_plain_KnownFailureTest );
Py_DECREF( tmp_import_name_from_1 );
if ( tmp_assign_source_2 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 249;
goto frame_exception_exit_1;
}
assert( var_KnownFailureTest.object == NULL );
var_KnownFailureTest.object = tmp_assign_source_2;
tmp_assign_source_3 = MAKE_FUNCTION_function_1__deprecated_imp_of_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators( par_f );
if ( tmp_assign_source_3 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
Py_DECREF( tmp_assign_source_3 );
frame_function->f_lineno = 251;
goto frame_exception_exit_1;
}
assert( var__deprecated_imp.object == NULL );
var__deprecated_imp.object = tmp_assign_source_3;
tmp_isinstance_inst_1 = _python_context->closure_conditional.storage->object;
if ( tmp_isinstance_inst_1 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 210662 ], 57, 0 );
exception_tb = NULL;
frame_function->f_lineno = 263;
goto frame_exception_exit_1;
}
tmp_source_name_1 = GET_STRING_DICT_VALUE( moduledict_numpy$testing$decorators, (Nuitka_StringObject *)const_str_plain_collections );
if (unlikely( tmp_source_name_1 == NULL ))
{
tmp_source_name_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_collections );
}
if ( tmp_source_name_1 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_NameError );
exception_value = UNSTREAM_STRING( &constant_bin[ 7813 ], 40, 0 );
exception_tb = NULL;
frame_function->f_lineno = 263;
goto frame_exception_exit_1;
}
tmp_isinstance_cls_1 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_Callable );
if ( tmp_isinstance_cls_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 263;
goto frame_exception_exit_1;
}
tmp_res = Nuitka_IsInstance( tmp_isinstance_inst_1, tmp_isinstance_cls_1 );
Py_DECREF( tmp_isinstance_cls_1 );
if ( tmp_res == -1 )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 263;
goto frame_exception_exit_1;
}
if (tmp_res == 1)
{
goto branch_yes_1;
}
else
{
goto branch_no_1;
}
branch_yes_1:;
tmp_called_1 = _python_context->closure_conditional.storage->object;
if ( tmp_called_1 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 210662 ], 57, 0 );
exception_tb = NULL;
frame_function->f_lineno = 264;
goto frame_exception_exit_1;
}
frame_function->f_lineno = 264;
tmp_assign_source_4 = CALL_FUNCTION_NO_ARGS( tmp_called_1 );
if ( tmp_assign_source_4 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 264;
goto frame_exception_exit_1;
}
assert( var_cond.object == NULL );
var_cond.object = tmp_assign_source_4;
goto branch_end_1;
branch_no_1:;
tmp_assign_source_5 = _python_context->closure_conditional.storage->object;
if ( tmp_assign_source_5 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 210662 ], 57, 0 );
exception_tb = NULL;
frame_function->f_lineno = 266;
goto frame_exception_exit_1;
}
assert( var_cond.object == NULL );
var_cond.object = INCREASE_REFCOUNT( tmp_assign_source_5 );
branch_end_1:;
tmp_cond_value_1 = var_cond.object;
tmp_cond_truth_1 = CHECK_IF_TRUE( tmp_cond_value_1 );
if ( tmp_cond_truth_1 == -1 )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 267;
goto frame_exception_exit_1;
}
if (tmp_cond_truth_1 == 1)
{
goto branch_yes_2;
}
else
{
goto branch_no_2;
}
branch_yes_2:;
tmp_source_name_3 = var_nose.object;
tmp_source_name_2 = LOOKUP_ATTRIBUTE( tmp_source_name_3, const_str_plain_tools );
if ( tmp_source_name_2 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 268;
goto frame_exception_exit_1;
}
tmp_called_3 = LOOKUP_ATTRIBUTE( tmp_source_name_2, const_str_plain_make_decorator );
Py_DECREF( tmp_source_name_2 );
if ( tmp_called_3 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 268;
goto frame_exception_exit_1;
}
tmp_call_arg_element_1 = par_f.storage->object;
if ( tmp_call_arg_element_1 == NULL )
{
Py_DECREF( tmp_called_3 );
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 6491 ], 47, 0 );
exception_tb = NULL;
frame_function->f_lineno = 268;
goto frame_exception_exit_1;
}
frame_function->f_lineno = 268;
tmp_called_2 = CALL_FUNCTION_WITH_ARGS1( tmp_called_3, tmp_call_arg_element_1 );
Py_DECREF( tmp_called_3 );
if ( tmp_called_2 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 268;
goto frame_exception_exit_1;
}
tmp_call_arg_element_2 = var__deprecated_imp.object;
frame_function->f_lineno = 268;
tmp_return_value = CALL_FUNCTION_WITH_ARGS1( tmp_called_2, tmp_call_arg_element_2 );
Py_DECREF( tmp_called_2 );
if ( tmp_return_value == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 268;
goto frame_exception_exit_1;
}
goto frame_return_exit_1;
goto branch_end_2;
branch_no_2:;
tmp_return_value = par_f.storage->object;
if ( tmp_return_value == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 6491 ], 47, 0 );
exception_tb = NULL;
frame_function->f_lineno = 270;
goto frame_exception_exit_1;
}
Py_INCREF( tmp_return_value );
goto frame_return_exit_1;
branch_end_2:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
// Put the previous frame back on top.
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
goto frame_no_exception_1;
frame_return_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
goto function_return_exit;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
}
else if ( exception_tb->tb_frame != frame_function )
{
PyTracebackObject *traceback_new = (PyTracebackObject *)MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
traceback_new->tb_next = exception_tb;
exception_tb = traceback_new;
}
tmp_frame_locals = PyDict_New();
if ((var_nose.object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_nose,
var_nose.object
);
}
if ((var_KnownFailureTest.object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_KnownFailureTest,
var_KnownFailureTest.object
);
}
if ((var__deprecated_imp.object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain__deprecated_imp,
var__deprecated_imp.object
);
}
if ((var_cond.object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_cond,
var_cond.object
);
}
if ((par_f.storage != NULL && par_f.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_f,
par_f.storage->object
);
}
if ((_python_context->closure_conditional.storage != NULL && _python_context->closure_conditional.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_conditional,
_python_context->closure_conditional.storage->object
);
}
detachFrame( exception_tb, tmp_frame_locals );
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
// Return the error.
goto function_exception_exit;
frame_no_exception_1:;
// Return statement must be present.
assert(false);
function_exception_exit:
assert( exception_type );
PyErr_Restore( exception_type, exception_value, (PyObject *)exception_tb );
return NULL;
function_return_exit:
return tmp_return_value;
}
static PyObject *fparse_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, Py_ssize_t args_size, PyObject *kw )
{
assert( kw == NULL || PyDict_Check( kw ) );
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_size = kw ? PyDict_Size( kw ) : 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_found = 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_only_found = 0;
Py_ssize_t args_given = args_size;
PyObject *_python_par_f = NULL;
// Copy given dictionary values to the the respective variables:
if ( kw_size > 0 )
{
Py_ssize_t ppos = 0;
PyObject *key, *value;
while( PyDict_Next( kw, &ppos, &key, &value ) )
{
#if PYTHON_VERSION < 300
if (unlikely( !PyString_Check( key ) && !PyUnicode_Check( key ) ))
#else
if (unlikely( !PyUnicode_Check( key ) ))
#endif
{
PyErr_Format( PyExc_TypeError, "deprecate_decorator() keywords must be strings" );
goto error_exit;
}
NUITKA_MAY_BE_UNUSED bool found = false;
Py_INCREF( key );
Py_INCREF( value );
// Quick path, could be our value.
if ( found == false && const_str_plain_f == key )
{
assert( _python_par_f == NULL );
_python_par_f = value;
found = true;
kw_found += 1;
}
// Slow path, compare against all parameter names.
if ( found == false && RICH_COMPARE_BOOL_EQ( const_str_plain_f, key ) == 1 )
{
assert( _python_par_f == NULL );
_python_par_f = value;
found = true;
kw_found += 1;
}
Py_DECREF( key );
if ( found == false )
{
Py_DECREF( value );
PyErr_Format(
PyExc_TypeError,
"deprecate_decorator() got an unexpected keyword argument '%s'",
Nuitka_String_Check( key ) ? Nuitka_String_AsString( key ) : "<non-string>"
);
goto error_exit;
}
}
#if PYTHON_VERSION < 300
assert( kw_found == kw_size );
assert( kw_only_found == 0 );
#endif
}
// Check if too many arguments were given in case of non star args
if (unlikely( args_given > 1 ))
{
#if PYTHON_VERSION < 270
ERROR_TOO_MANY_ARGUMENTS( self, args_given, kw_size );
#elif PYTHON_VERSION < 330
ERROR_TOO_MANY_ARGUMENTS( self, args_given + kw_found );
#else
ERROR_TOO_MANY_ARGUMENTS( self, args_given, kw_only_found );
#endif
goto error_exit;
}
// Copy normal parameter values given as part of the args list to the respective variables:
if (likely( 0 < args_given ))
{
if (unlikely( _python_par_f != NULL ))
{
ERROR_MULTIPLE_VALUES( self, 0 );
goto error_exit;
}
_python_par_f = INCREASE_REFCOUNT( args[ 0 ] );
}
else if ( _python_par_f == NULL )
{
if ( 0 + self->m_defaults_given >= 1 )
{
_python_par_f = INCREASE_REFCOUNT( PyTuple_GET_ITEM( self->m_defaults, self->m_defaults_given + 0 - 1 ) );
}
#if PYTHON_VERSION < 330
else
{
#if PYTHON_VERSION < 270
ERROR_TOO_FEW_ARGUMENTS( self, kw_size, args_given + kw_found );
#elif PYTHON_VERSION < 300
ERROR_TOO_FEW_ARGUMENTS( self, args_given + kw_found );
#else
ERROR_TOO_FEW_ARGUMENTS( self, args_given + kw_found - kw_only_found );
#endif
goto error_exit;
}
#endif
}
#if PYTHON_VERSION >= 330
if (unlikely( _python_par_f == NULL ))
{
PyObject *values[] = { _python_par_f };
ERROR_TOO_FEW_ARGUMENTS( self, values );
goto error_exit;
}
#endif
return impl_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators( self, _python_par_f );
error_exit:;
Py_XDECREF( _python_par_f );
return NULL;
}
static PyObject *dparse_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, int size )
{
if ( size == 1 )
{
return impl_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators( self, INCREASE_REFCOUNT( args[ 0 ] ) );
}
else
{
PyObject *result = fparse_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators( self, args, size, NULL );
return result;
}
}
static PyObject *impl_function_1__deprecated_imp_of_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject *_python_par_args, PyObject *_python_par_kwargs )
{
// The context of the function.
struct _context_function_1__deprecated_imp_of_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators_t *_python_context = (struct _context_function_1__deprecated_imp_of_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators_t *)self->m_context;
// Local variable declarations.
PyObjectLocalVariable par_args; par_args.object = _python_par_args;
PyObjectLocalVariable par_kwargs; par_kwargs.object = _python_par_kwargs;
PyObjectLocalVariable var_l;
PyObjectTempVariable tmp_with_1__source;
PyObjectTempVariable tmp_with_1__exit;
PyObjectTempVariable tmp_with_1__enter;
PyObjectTempVariable tmp_with_1__indicator;
PyObject *exception_type = NULL, *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
PyObject *exception_keeper_type_2;
PyObject *exception_keeper_value_2;
PyTracebackObject *exception_keeper_tb_2;
PyObject *tmp_assign_source_1;
PyObject *tmp_assign_source_2;
PyObject *tmp_assign_source_3;
PyObject *tmp_assign_source_4;
PyObject *tmp_assign_source_5;
PyObject *tmp_assign_source_6;
PyObject *tmp_attr_source_1;
PyObject *tmp_attr_source_2;
PyObject *tmp_binop_left_1;
PyObject *tmp_binop_left_2;
PyObject *tmp_binop_right_1;
PyObject *tmp_binop_right_2;
PyObject *tmp_call_arg_element_1;
PyObject *tmp_call_arg_element_2;
PyObject *tmp_call_arg_element_3;
PyObject *tmp_call_arg_element_4;
PyObject *tmp_call_arg_element_5;
PyObject *tmp_call_arg_element_6;
PyObject *tmp_call_arg_element_7;
PyObject *tmp_call_kw_1;
PyObject *tmp_called_1;
PyObject *tmp_called_2;
PyObject *tmp_called_3;
PyObject *tmp_called_4;
PyObject *tmp_called_5;
int tmp_cmp_Gt_1;
PyObject *tmp_compare_left_1;
PyObject *tmp_compare_left_2;
PyObject *tmp_compare_left_3;
PyObject *tmp_compare_left_4;
PyObject *tmp_compare_right_1;
PyObject *tmp_compare_right_2;
PyObject *tmp_compare_right_3;
PyObject *tmp_compare_right_4;
int tmp_cond_truth_1;
PyObject *tmp_cond_value_1;
PyObject *tmp_dircall_arg1_1;
PyObject *tmp_dircall_arg2_1;
PyObject *tmp_dircall_arg3_1;
int tmp_exc_match_exception_match_1;
PyObject *tmp_frame_locals;
bool tmp_is_1;
bool tmp_isnot_1;
PyObject *tmp_len_arg_1;
PyObject *tmp_make_exception_arg_1;
PyObject *tmp_make_exception_arg_2;
PyObject *tmp_raise_type_1;
PyObject *tmp_raise_type_2;
PyObject *tmp_return_value;
PyObject *tmp_source_name_1;
PyObject *tmp_source_name_2;
PyObject *tmp_source_name_3;
PyObject *tmp_source_name_4;
PyObject *tmp_source_name_5;
PyObject *tmp_subscr_subscript_1;
PyObject *tmp_subscr_subscript_2;
PyObject *tmp_subscr_target_1;
PyObject *tmp_subscr_target_2;
int tmp_tried_lineno_1;
int tmp_tried_lineno_2;
PyObject *tmp_tuple_element_1;
NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
tmp_return_value = NULL;
// Actual function code.
static PyFrameObject *cache_frame_function = NULL;
MAKE_OR_REUSE_FRAME( cache_frame_function, codeobj_c0a4b60f265895b23c38123a5039f46e, module_numpy$testing$decorators );
PyFrameObject *frame_function = cache_frame_function;
// Push the new frame as the currently active one.
pushFrameStack( frame_function );
// Mark the frame object as in use, ref count 1 will be up for reuse.
Py_INCREF( frame_function );
assert( Py_REFCNT( frame_function ) == 2 ); // Frame stack
#if PYTHON_VERSION >= 340
frame_function->f_executing += 1;
#endif
// Framed code:
// Tried code
tmp_source_name_1 = GET_STRING_DICT_VALUE( moduledict_numpy$testing$decorators, (Nuitka_StringObject *)const_str_plain_warnings );
if (unlikely( tmp_source_name_1 == NULL ))
{
tmp_source_name_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_warnings );
}
if ( tmp_source_name_1 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_NameError );
exception_value = UNSTREAM_STRING( &constant_bin[ 6827 ], 37, 0 );
exception_tb = NULL;
frame_function->f_lineno = 253;
goto try_finally_handler_1;
}
tmp_called_1 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_catch_warnings );
if ( tmp_called_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 253;
goto try_finally_handler_1;
}
tmp_call_kw_1 = PyDict_Copy( const_dict_aae7649b9175b1ed5738500d56e46831 );
frame_function->f_lineno = 253;
tmp_assign_source_1 = CALL_FUNCTION_WITH_KEYARGS( tmp_called_1, tmp_call_kw_1 );
Py_DECREF( tmp_called_1 );
Py_DECREF( tmp_call_kw_1 );
if ( tmp_assign_source_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 253;
goto try_finally_handler_1;
}
assert( tmp_with_1__source.object == NULL );
tmp_with_1__source.object = tmp_assign_source_1;
tmp_attr_source_1 = tmp_with_1__source.object;
tmp_assign_source_2 = LOOKUP_SPECIAL( tmp_attr_source_1, const_str_plain___exit__ );
if ( tmp_assign_source_2 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 253;
goto try_finally_handler_1;
}
assert( tmp_with_1__exit.object == NULL );
tmp_with_1__exit.object = tmp_assign_source_2;
tmp_attr_source_2 = tmp_with_1__source.object;
tmp_called_2 = LOOKUP_SPECIAL( tmp_attr_source_2, const_str_plain___enter__ );
if ( tmp_called_2 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 253;
goto try_finally_handler_1;
}
frame_function->f_lineno = 253;
tmp_assign_source_3 = CALL_FUNCTION_NO_ARGS( tmp_called_2 );
Py_DECREF( tmp_called_2 );
if ( tmp_assign_source_3 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 253;
goto try_finally_handler_1;
}
assert( tmp_with_1__enter.object == NULL );
tmp_with_1__enter.object = tmp_assign_source_3;
tmp_assign_source_4 = Py_True;
assert( tmp_with_1__indicator.object == NULL );
tmp_with_1__indicator.object = INCREASE_REFCOUNT( tmp_assign_source_4 );
// Tried code
// Tried block of try/except
tmp_assign_source_5 = tmp_with_1__enter.object;
assert( var_l.object == NULL );
var_l.object = INCREASE_REFCOUNT( tmp_assign_source_5 );
tmp_source_name_2 = GET_STRING_DICT_VALUE( moduledict_numpy$testing$decorators, (Nuitka_StringObject *)const_str_plain_warnings );
if (unlikely( tmp_source_name_2 == NULL ))
{
tmp_source_name_2 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_warnings );
}
if ( tmp_source_name_2 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_NameError );
exception_value = UNSTREAM_STRING( &constant_bin[ 6827 ], 37, 0 );
exception_tb = NULL;
frame_function->f_lineno = 254;
goto try_except_handler_1;
}
tmp_called_3 = LOOKUP_ATTRIBUTE( tmp_source_name_2, const_str_plain_simplefilter );
if ( tmp_called_3 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 254;
goto try_except_handler_1;
}
tmp_call_arg_element_1 = const_str_plain_always;
frame_function->f_lineno = 254;
tmp_unused = CALL_FUNCTION_WITH_ARGS1( tmp_called_3, tmp_call_arg_element_1 );
Py_DECREF( tmp_called_3 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 254;
goto try_except_handler_1;
}
Py_DECREF( tmp_unused );
tmp_dircall_arg1_1 = _python_context->closure_f.storage->object;
if ( tmp_dircall_arg1_1 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 6491 ], 47, 0 );
exception_tb = NULL;
frame_function->f_lineno = 255;
goto try_except_handler_1;
}
tmp_dircall_arg2_1 = par_args.object;
if ( tmp_dircall_arg2_1 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 5435 ], 50, 0 );
exception_tb = NULL;
frame_function->f_lineno = 255;
goto try_except_handler_1;
}
tmp_dircall_arg3_1 = par_kwargs.object;
if ( tmp_dircall_arg3_1 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 71458 ], 52, 0 );
exception_tb = NULL;
frame_function->f_lineno = 255;
goto try_except_handler_1;
}
tmp_unused = impl_function_2_complex_call_helper_star_list_star_dict_of_module___internal__( INCREASE_REFCOUNT( tmp_dircall_arg1_1 ), INCREASE_REFCOUNT( tmp_dircall_arg2_1 ), INCREASE_REFCOUNT( tmp_dircall_arg3_1 ) );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 255;
goto try_except_handler_1;
}
Py_DECREF( tmp_unused );
tmp_len_arg_1 = var_l.object;
tmp_compare_left_1 = BUILTIN_LEN( tmp_len_arg_1 );
if ( tmp_compare_left_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 256;
goto try_except_handler_1;
}
tmp_compare_right_1 = const_int_0;
tmp_cmp_Gt_1 = RICH_COMPARE_BOOL_GT( tmp_compare_left_1, tmp_compare_right_1 );
if ( tmp_cmp_Gt_1 == -1 )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
Py_DECREF( tmp_compare_left_1 );
frame_function->f_lineno = 256;
goto try_except_handler_1;
}
Py_DECREF( tmp_compare_left_1 );
if (tmp_cmp_Gt_1 == 1)
{
goto branch_no_1;
}
else
{
goto branch_yes_1;
}
branch_yes_1:;
tmp_binop_left_1 = const_str_digest_8f6c4ce8673a7969a1a7f3729b7f0ba0;
tmp_source_name_3 = _python_context->closure_f.storage->object;
if ( tmp_source_name_3 == NULL )
{
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 6491 ], 47, 0 );
exception_tb = NULL;
frame_function->f_lineno = 258;
goto try_except_handler_1;
}
tmp_binop_right_1 = LOOKUP_ATTRIBUTE( tmp_source_name_3, const_str_plain___name__ );
if ( tmp_binop_right_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 258;
goto try_except_handler_1;
}
tmp_make_exception_arg_1 = BINARY_OPERATION_REMAINDER( tmp_binop_left_1, tmp_binop_right_1 );
Py_DECREF( tmp_binop_right_1 );
if ( tmp_make_exception_arg_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 257;
goto try_except_handler_1;
}
frame_function->f_lineno = 257;
tmp_raise_type_1 = CALL_FUNCTION_WITH_ARGS1( PyExc_AssertionError, tmp_make_exception_arg_1 );
Py_DECREF( tmp_make_exception_arg_1 );
if ( tmp_raise_type_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 257;
goto try_except_handler_1;
}
exception_type = tmp_raise_type_1;
frame_function->f_lineno = 257;
RAISE_EXCEPTION_WITH_TYPE( &exception_type, &exception_value, &exception_tb );
goto try_except_handler_1;
branch_no_1:;
tmp_subscr_target_1 = var_l.object;
tmp_subscr_subscript_1 = const_int_0;
tmp_source_name_4 = LOOKUP_SUBSCRIPT( tmp_subscr_target_1, tmp_subscr_subscript_1 );
if ( tmp_source_name_4 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 259;
goto try_except_handler_1;
}
tmp_compare_left_2 = LOOKUP_ATTRIBUTE( tmp_source_name_4, const_str_plain_category );
Py_DECREF( tmp_source_name_4 );
if ( tmp_compare_left_2 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 259;
goto try_except_handler_1;
}
tmp_compare_right_2 = GET_STRING_DICT_VALUE( moduledict_numpy$testing$decorators, (Nuitka_StringObject *)const_str_plain_DeprecationWarning );
if (unlikely( tmp_compare_right_2 == NULL ))
{
tmp_compare_right_2 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_DeprecationWarning );
}
if ( tmp_compare_right_2 == NULL )
{
Py_DECREF( tmp_compare_left_2 );
exception_type = INCREASE_REFCOUNT( PyExc_NameError );
exception_value = UNSTREAM_STRING( &constant_bin[ 6864 ], 47, 0 );
exception_tb = NULL;
frame_function->f_lineno = 259;
goto try_except_handler_1;
}
tmp_isnot_1 = ( tmp_compare_left_2 != tmp_compare_right_2 );
Py_DECREF( tmp_compare_left_2 );
if (tmp_isnot_1)
{
goto branch_yes_2;
}
else
{
goto branch_no_2;
}
branch_yes_2:;
tmp_binop_left_2 = const_str_digest_60d3a817b17570b5de0e234d358684fc;
tmp_binop_right_2 = PyTuple_New( 2 );
tmp_source_name_5 = _python_context->closure_f.storage->object;
if ( tmp_source_name_5 == NULL )
{
Py_DECREF( tmp_binop_right_2 );
exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError );
exception_value = UNSTREAM_STRING( &constant_bin[ 6491 ], 47, 0 );
exception_tb = NULL;
frame_function->f_lineno = 261;
goto try_except_handler_1;
}
tmp_tuple_element_1 = LOOKUP_ATTRIBUTE( tmp_source_name_5, const_str_plain___name__ );
if ( tmp_tuple_element_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
Py_DECREF( tmp_binop_right_2 );
frame_function->f_lineno = 261;
goto try_except_handler_1;
}
PyTuple_SET_ITEM( tmp_binop_right_2, 0, tmp_tuple_element_1 );
tmp_subscr_target_2 = var_l.object;
tmp_subscr_subscript_2 = const_int_0;
tmp_tuple_element_1 = LOOKUP_SUBSCRIPT( tmp_subscr_target_2, tmp_subscr_subscript_2 );
if ( tmp_tuple_element_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
Py_DECREF( tmp_binop_right_2 );
frame_function->f_lineno = 261;
goto try_except_handler_1;
}
PyTuple_SET_ITEM( tmp_binop_right_2, 1, tmp_tuple_element_1 );
tmp_make_exception_arg_2 = BINARY_OPERATION_REMAINDER( tmp_binop_left_2, tmp_binop_right_2 );
Py_DECREF( tmp_binop_right_2 );
if ( tmp_make_exception_arg_2 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 260;
goto try_except_handler_1;
}
frame_function->f_lineno = 260;
tmp_raise_type_2 = CALL_FUNCTION_WITH_ARGS1( PyExc_AssertionError, tmp_make_exception_arg_2 );
Py_DECREF( tmp_make_exception_arg_2 );
if ( tmp_raise_type_2 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_function->f_lineno = 260;
goto try_except_handler_1;
}
exception_type = tmp_raise_type_2;
frame_function->f_lineno = 260;
RAISE_EXCEPTION_WITH_TYPE( &exception_type, &exception_value, &exception_tb );
goto try_except_handler_1;
branch_no_2:;
goto try_except_end_1;
try_except_handler_1:;
// Exception handler of try/except
// Preserve existing published exception.
PRESERVE_FRAME_EXCEPTION( frame_function );
if (exception_tb == NULL)
{
exception_tb = MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
}
else if ( exception_tb->tb_frame != frame_function || exception_tb->tb_lineno != frame_function->f_lineno )
{
exception_tb = ADD_TRACEBACK( frame_function, exception_tb );
}
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
PUBLISH_EXCEPTION( &exception_type, &exception_value, &exception_tb );
tmp_compare_left_3 = PyThreadState_GET()->exc_type;
tmp_compare_right_3 = PyExc_BaseException;
tmp_exc_match_exception_match_1 = EXCEPTION_MATCH_BOOL( tmp_compare_left_3, tmp_compare_right_3 );
if ( tmp_exc_match_exception_match_1 == -1 )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
goto try_finally_handler_2;
}
if (tmp_exc_match_exception_match_1 == 1)
{
goto branch_yes_3;
}
else
{
goto branch_no_3;
}
branch_yes_3:;
tmp_assign_source_6 = Py_False;
if (tmp_with_1__indicator.object == NULL)
{
tmp_with_1__indicator.object = INCREASE_REFCOUNT( tmp_assign_source_6 );
}
else
{
PyObject *old = tmp_with_1__indicator.object;
tmp_with_1__indicator.object = INCREASE_REFCOUNT( tmp_assign_source_6 );
Py_DECREF( old );
}
tmp_called_4 = tmp_with_1__exit.object;
tmp_call_arg_element_2 = PyThreadState_GET()->exc_type;
tmp_call_arg_element_3 = PyThreadState_GET()->exc_value;
tmp_call_arg_element_4 = PyThreadState_GET()->exc_traceback;
tmp_cond_value_1 = CALL_FUNCTION_WITH_ARGS3( tmp_called_4, tmp_call_arg_element_2, tmp_call_arg_element_3, tmp_call_arg_element_4 );
if ( tmp_cond_value_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
goto try_finally_handler_2;
}
tmp_cond_truth_1 = CHECK_IF_TRUE( tmp_cond_value_1 );
if ( tmp_cond_truth_1 == -1 )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
Py_DECREF( tmp_cond_value_1 );
goto try_finally_handler_2;
}
Py_DECREF( tmp_cond_value_1 );
if (tmp_cond_truth_1 == 1)
{
goto branch_no_4;
}
else
{
goto branch_yes_4;
}
branch_yes_4:;
RERAISE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
if (exception_tb && exception_tb->tb_frame == frame_function) frame_function->f_lineno = exception_tb->tb_lineno;
goto try_finally_handler_2;
branch_no_4:;
goto branch_end_3;
branch_no_3:;
RERAISE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
if (exception_tb && exception_tb->tb_frame == frame_function) frame_function->f_lineno = exception_tb->tb_lineno;
goto try_finally_handler_2;
branch_end_3:;
try_except_end_1:;
// Final block of try/finally
// Tried block ends with no exception occured, note that.
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
try_finally_handler_2:;
exception_keeper_type_1 = exception_type;
exception_keeper_value_1 = exception_value;
exception_keeper_tb_1 = exception_tb;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
tmp_tried_lineno_1 = frame_function->f_lineno;
tmp_compare_left_4 = tmp_with_1__indicator.object;
tmp_compare_right_4 = Py_True;
tmp_is_1 = ( tmp_compare_left_4 == tmp_compare_right_4 );
if (tmp_is_1)
{
goto branch_yes_5;
}
else
{
goto branch_no_5;
}
branch_yes_5:;
tmp_called_5 = tmp_with_1__exit.object;
tmp_call_arg_element_5 = Py_None;
tmp_call_arg_element_6 = Py_None;
tmp_call_arg_element_7 = Py_None;
tmp_unused = CALL_FUNCTION_WITH_ARGS3( tmp_called_5, tmp_call_arg_element_5, tmp_call_arg_element_6, tmp_call_arg_element_7 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
goto try_finally_handler_error_1;
}
Py_DECREF( tmp_unused );
branch_no_5:;
frame_function->f_lineno = tmp_tried_lineno_1;
// Re-reraise as necessary after finally was executed.
// Reraise exception if any.
if ( exception_keeper_type_1 != NULL )
{
exception_type = exception_keeper_type_1;
exception_value = exception_keeper_value_1;
exception_tb = exception_keeper_tb_1;
goto try_finally_handler_1;
}
goto finally_end_1;
try_finally_handler_error_1:;
Py_XDECREF( exception_keeper_type_1 );exception_keeper_type_1 = NULL;
Py_XDECREF( exception_keeper_value_1 );exception_keeper_value_1 = NULL;
Py_XDECREF( exception_keeper_tb_1 );exception_keeper_tb_1 = NULL;
goto try_finally_handler_1;
finally_end_1:;
// Final block of try/finally
// Tried block ends with no exception occured, note that.
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
try_finally_handler_1:;
exception_keeper_type_2 = exception_type;
exception_keeper_value_2 = exception_value;
exception_keeper_tb_2 = exception_tb;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
tmp_tried_lineno_2 = frame_function->f_lineno;
Py_XDECREF( tmp_with_1__source.object );
tmp_with_1__source.object = NULL;
Py_XDECREF( tmp_with_1__enter.object );
tmp_with_1__enter.object = NULL;
Py_XDECREF( tmp_with_1__exit.object );
tmp_with_1__exit.object = NULL;
Py_XDECREF( tmp_with_1__indicator.object );
tmp_with_1__indicator.object = NULL;
frame_function->f_lineno = tmp_tried_lineno_2;
// Re-reraise as necessary after finally was executed.
// Reraise exception if any.
if ( exception_keeper_type_2 != NULL )
{
exception_type = exception_keeper_type_2;
exception_value = exception_keeper_value_2;
exception_tb = exception_keeper_tb_2;
goto frame_exception_exit_1;
}
goto finally_end_2;
finally_end_2:;
#if 1
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
// Put the previous frame back on top.
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
goto frame_no_exception_1;
frame_exception_exit_1:;
#if 1
RESTORE_FRAME_EXCEPTION( frame_function );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
}
else if ( exception_tb->tb_frame != frame_function )
{
PyTracebackObject *traceback_new = (PyTracebackObject *)MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) );
traceback_new->tb_next = exception_tb;
exception_tb = traceback_new;
}
tmp_frame_locals = PyDict_New();
if ((var_l.object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_l,
var_l.object
);
}
if ((par_args.object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_args,
par_args.object
);
}
if ((par_kwargs.object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_kwargs,
par_kwargs.object
);
}
if ((_python_context->closure_f.storage != NULL && _python_context->closure_f.storage->object != NULL))
{
PyDict_SetItem(
tmp_frame_locals,
const_str_plain_f,
_python_context->closure_f.storage->object
);
}
detachFrame( exception_tb, tmp_frame_locals );
popFrameStack();
#if PYTHON_VERSION >= 340
frame_function->f_executing -= 1;
#endif
Py_DECREF( frame_function );
// Return the error.
goto function_exception_exit;
frame_no_exception_1:;
tmp_return_value = Py_None;
Py_INCREF( tmp_return_value );
goto function_return_exit;
// Return statement must be present.
assert(false);
function_exception_exit:
assert( exception_type );
PyErr_Restore( exception_type, exception_value, (PyObject *)exception_tb );
return NULL;
function_return_exit:
return tmp_return_value;
}
static PyObject *fparse_function_1__deprecated_imp_of_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, Py_ssize_t args_size, PyObject *kw )
{
assert( kw == NULL || PyDict_Check( kw ) );
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_size = kw ? PyDict_Size( kw ) : 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_found = 0;
NUITKA_MAY_BE_UNUSED Py_ssize_t kw_only_found = 0;
Py_ssize_t args_given = args_size;
PyObject *_python_par_args = NULL;
PyObject *_python_par_kwargs = NULL;
if ( kw == NULL )
{
_python_par_kwargs = PyDict_New();
}
else
{
if ( ((PyDictObject *)kw)->ma_used > 0 )
{
#if PYTHON_VERSION < 330
_python_par_kwargs = _PyDict_NewPresized( ((PyDictObject *)kw)->ma_used );
for ( int i = 0; i <= ((PyDictObject *)kw)->ma_mask; i++ )
{
PyDictEntry *entry = &((PyDictObject *)kw)->ma_table[ i ];
if ( entry->me_value != NULL )
{
#if PYTHON_VERSION < 300
if (unlikely( !PyString_Check( entry->me_key ) && !PyUnicode_Check( entry->me_key ) ))
#else
if (unlikely( !PyUnicode_Check( entry->me_key ) ))
#endif
{
PyErr_Format( PyExc_TypeError, "_deprecated_imp() keywords must be strings" );
goto error_exit;
}
int res = PyDict_SetItem( _python_par_kwargs, entry->me_key, entry->me_value );
if (unlikely( res == -1 ))
{
goto error_exit;
}
}
}
#else
if ( _PyDict_HasSplitTable( (PyDictObject *)kw) )
{
PyDictObject *mp = (PyDictObject *)kw;
PyObject **newvalues = PyMem_NEW( PyObject *, mp->ma_keys->dk_size );
assert (newvalues != NULL);
PyDictObject *split_copy = PyObject_GC_New( PyDictObject, &PyDict_Type );
assert( split_copy != NULL );
split_copy->ma_values = newvalues;
split_copy->ma_keys = mp->ma_keys;
split_copy->ma_used = mp->ma_used;
mp->ma_keys->dk_refcnt += 1;
Nuitka_GC_Track( split_copy );
Py_ssize_t size = mp->ma_keys->dk_size;
for ( Py_ssize_t i = 0; i < size; i++ )
{
PyDictKeyEntry *entry = &split_copy->ma_keys->dk_entries[ i ];
if (unlikely( !PyUnicode_Check( entry->me_key ) ))
{
PyErr_Format( PyExc_TypeError, "_deprecated_imp() keywords must be strings" );
goto error_exit;
}
split_copy->ma_values[ i ] = INCREASE_REFCOUNT_X( mp->ma_values[ i ] );
}
_python_par_kwargs = (PyObject *)split_copy;
}
else
{
_python_par_kwargs = PyDict_New();
PyDictObject *mp = (PyDictObject *)kw;
Py_ssize_t size = mp->ma_keys->dk_size;
for ( Py_ssize_t i = 0; i < size; i++ )
{
PyDictKeyEntry *entry = &mp->ma_keys->dk_entries[i];
// TODO: One of these cases has been dealt with above.
PyObject *value;
if ( mp->ma_values )
{
value = mp->ma_values[ i ];
}
else
{
value = entry->me_value;
}
if ( value != NULL )
{
if (unlikely( !PyUnicode_Check( entry->me_key ) ))
{
PyErr_Format( PyExc_TypeError, "_deprecated_imp() keywords must be strings" );
goto error_exit;
}
int res = PyDict_SetItem( _python_par_kwargs, entry->me_key, value );
if (unlikely( res == -1 ))
{
goto error_exit;
}
}
}
}
#endif
}
else
{
_python_par_kwargs = PyDict_New();
}
}
// Copy left over argument values to the star list parameter given.
if ( args_given > 0 )
{
_python_par_args = PyTuple_New( args_size - 0 );
for( Py_ssize_t i = 0; i < args_size - 0; i++ )
{
PyTuple_SET_ITEM( _python_par_args, i, INCREASE_REFCOUNT( args[0+i] ) );
}
}
else
{
_python_par_args = INCREASE_REFCOUNT( const_tuple_empty );
}
return impl_function_1__deprecated_imp_of_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators( self, _python_par_args, _python_par_kwargs );
error_exit:;
Py_XDECREF( _python_par_args );
Py_XDECREF( _python_par_kwargs );
return NULL;
}
static PyObject *dparse_function_1__deprecated_imp_of_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators( Nuitka_FunctionObject *self, PyObject **args, int size )
{
if ( size == 2 )
{
return impl_function_1__deprecated_imp_of_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators( self, MAKE_TUPLE( &args[ 0 ], size > 0 ? size-0 : 0 ), PyDict_New() );
}
else
{
PyObject *result = fparse_function_1__deprecated_imp_of_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators( self, args, size, NULL );
return result;
}
}
static PyObject *MAKE_FUNCTION_function_1__deprecated_imp_of_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators( PyObjectSharedLocalVariable &closure_f )
{
struct _context_function_1__deprecated_imp_of_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators_t *_python_context = new _context_function_1__deprecated_imp_of_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators_t;
// Copy the parameter default values and closure values over.
_python_context->closure_f.shareWith( closure_f );
PyObject *result = Nuitka_Function_New(
fparse_function_1__deprecated_imp_of_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators,
dparse_function_1__deprecated_imp_of_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators,
const_str_plain__deprecated_imp,
#if PYTHON_VERSION >= 330
NULL,
#endif
codeobj_4c8e788bd9c3c132dd9f7f669b296a0f,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_numpy$testing$decorators,
Py_None,
_python_context,
_context_function_1__deprecated_imp_of_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators_destructor
);
return result;
}
static PyObject *MAKE_FUNCTION_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators( PyObjectSharedLocalVariable &closure_conditional )
{
struct _context_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators_t *_python_context = new _context_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators_t;
// Copy the parameter default values and closure values over.
_python_context->closure_conditional.shareWith( closure_conditional );
PyObject *result = Nuitka_Function_New(
fparse_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators,
dparse_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators,
const_str_plain_deprecate_decorator,
#if PYTHON_VERSION >= 330
NULL,
#endif
codeobj_971aa7347ecde98875db1a9d8bc6e4e2,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_numpy$testing$decorators,
Py_None,
_python_context,
_context_function_1_deprecate_decorator_of_function_5_deprecated_of_module_numpy$testing$decorators_destructor
);
return result;
}
static PyObject *MAKE_FUNCTION_function_1_knownfailer_of_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators( PyObjectSharedLocalVariable &closure_KnownFailureTest, PyObjectSharedLocalVariable &closure_f, PyObjectSharedLocalVariable &closure_fail_val, PyObjectSharedLocalVariable &closure_msg )
{
struct _context_function_1_knownfailer_of_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators_t *_python_context = new _context_function_1_knownfailer_of_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators_t;
// Copy the parameter default values and closure values over.
_python_context->closure_KnownFailureTest.shareWith( closure_KnownFailureTest );
_python_context->closure_f.shareWith( closure_f );
_python_context->closure_fail_val.shareWith( closure_fail_val );
_python_context->closure_msg.shareWith( closure_msg );
PyObject *result = Nuitka_Function_New(
fparse_function_1_knownfailer_of_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators,
dparse_function_1_knownfailer_of_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators,
const_str_plain_knownfailer,
#if PYTHON_VERSION >= 330
NULL,
#endif
codeobj_7fd5d8e86ca4426d24010b3b74ce6c24,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_numpy$testing$decorators,
Py_None,
_python_context,
_context_function_1_knownfailer_of_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators_destructor
);
return result;
}
static PyObject *MAKE_FUNCTION_function_1_set_test_of_function_2_setastest_of_module_numpy$testing$decorators( PyObjectSharedLocalVariable &closure_tf )
{
struct _context_function_1_set_test_of_function_2_setastest_of_module_numpy$testing$decorators_t *_python_context = new _context_function_1_set_test_of_function_2_setastest_of_module_numpy$testing$decorators_t;
// Copy the parameter default values and closure values over.
_python_context->closure_tf.shareWith( closure_tf );
PyObject *result = Nuitka_Function_New(
fparse_function_1_set_test_of_function_2_setastest_of_module_numpy$testing$decorators,
dparse_function_1_set_test_of_function_2_setastest_of_module_numpy$testing$decorators,
const_str_plain_set_test,
#if PYTHON_VERSION >= 330
NULL,
#endif
codeobj_16b57bbb21d7fa07ad3a93de9c8978aa,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_numpy$testing$decorators,
Py_None,
_python_context,
_context_function_1_set_test_of_function_2_setastest_of_module_numpy$testing$decorators_destructor
);
return result;
}
static PyObject *MAKE_FUNCTION_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( PyObjectSharedLocalVariable &closure_msg, PyObjectSharedLocalVariable &closure_skip_condition )
{
struct _context_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t *_python_context = new _context_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t;
// Copy the parameter default values and closure values over.
_python_context->closure_msg.shareWith( closure_msg );
_python_context->closure_skip_condition.shareWith( closure_skip_condition );
PyObject *result = Nuitka_Function_New(
fparse_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators,
dparse_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators,
const_str_plain_skip_decorator,
#if PYTHON_VERSION >= 330
NULL,
#endif
codeobj_109b678cb9a869e39e079ab1653d3590,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_numpy$testing$decorators,
Py_None,
_python_context,
_context_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_destructor
);
return result;
}
static PyObject *MAKE_FUNCTION_function_1_slow_of_module_numpy$testing$decorators( )
{
PyObject *result = Nuitka_Function_New(
fparse_function_1_slow_of_module_numpy$testing$decorators,
dparse_function_1_slow_of_module_numpy$testing$decorators,
const_str_plain_slow,
#if PYTHON_VERSION >= 330
NULL,
#endif
codeobj_664e7a8feec95c848eceb654e1e3cd12,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_numpy$testing$decorators,
const_str_digest_4d4c69f2acb2c3b816bd167203c7e1ae
);
return result;
}
static PyObject *MAKE_FUNCTION_function_2_setastest_of_module_numpy$testing$decorators( PyObject *defaults )
{
PyObject *result = Nuitka_Function_New(
fparse_function_2_setastest_of_module_numpy$testing$decorators,
dparse_function_2_setastest_of_module_numpy$testing$decorators,
const_str_plain_setastest,
#if PYTHON_VERSION >= 330
NULL,
#endif
codeobj_4bacfe779d09e9ef976dc08e12b002d7,
defaults,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_numpy$testing$decorators,
const_str_digest_2e61ca36e0ff07c5ae54128222305c14
);
return result;
}
static PyObject *MAKE_FUNCTION_function_3_get_msg_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( PyObject *defaults )
{
PyObject *result = Nuitka_Function_New(
fparse_function_3_get_msg_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators,
dparse_function_3_get_msg_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators,
const_str_plain_get_msg,
#if PYTHON_VERSION >= 330
NULL,
#endif
codeobj_78c9d7e35c39c80b20e65dadb516a29d,
defaults,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_numpy$testing$decorators,
const_str_digest_da415a408a9e6922e5e2c4732fe86425
);
return result;
}
static PyObject *MAKE_FUNCTION_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators( PyObjectSharedLocalVariable &closure_fail_val, PyObjectSharedLocalVariable &closure_msg )
{
struct _context_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators_t *_python_context = new _context_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators_t;
// Copy the parameter default values and closure values over.
_python_context->closure_fail_val.shareWith( closure_fail_val );
_python_context->closure_msg.shareWith( closure_msg );
PyObject *result = Nuitka_Function_New(
fparse_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators,
dparse_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators,
const_str_plain_knownfail_decorator,
#if PYTHON_VERSION >= 330
NULL,
#endif
codeobj_fa648496dd5cde07493f4a4585e6ae2d,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_numpy$testing$decorators,
Py_None,
_python_context,
_context_function_3_knownfail_decorator_of_function_4_knownfailureif_of_module_numpy$testing$decorators_destructor
);
return result;
}
static PyObject *MAKE_FUNCTION_function_3_skipif_of_module_numpy$testing$decorators( PyObject *defaults )
{
PyObject *result = Nuitka_Function_New(
fparse_function_3_skipif_of_module_numpy$testing$decorators,
dparse_function_3_skipif_of_module_numpy$testing$decorators,
const_str_plain_skipif,
#if PYTHON_VERSION >= 330
NULL,
#endif
codeobj_12d8f43c6102a74fc5c582620e35e8fb,
defaults,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_numpy$testing$decorators,
const_str_digest_f6cc025bc97cf7a68a860190810255ce
);
return result;
}
static PyObject *MAKE_FUNCTION_function_4_knownfailureif_of_module_numpy$testing$decorators( PyObject *defaults )
{
PyObject *result = Nuitka_Function_New(
fparse_function_4_knownfailureif_of_module_numpy$testing$decorators,
dparse_function_4_knownfailureif_of_module_numpy$testing$decorators,
const_str_plain_knownfailureif,
#if PYTHON_VERSION >= 330
NULL,
#endif
codeobj_14d159542df56d28a0bc9125d5dd5ba0,
defaults,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_numpy$testing$decorators,
const_str_digest_4d73e2f373477bbf3b6881800c9d7fcf
);
return result;
}
static PyObject *MAKE_FUNCTION_function_4_skipper_func_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( PyObjectSharedLocalVariable &closure_f, PyObjectSharedLocalVariable &closure_get_msg, PyObjectSharedLocalVariable &closure_msg, PyObjectSharedLocalVariable &closure_nose, PyObjectSharedLocalVariable &closure_skip_val )
{
struct _context_function_4_skipper_func_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t *_python_context = new _context_function_4_skipper_func_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t;
// Copy the parameter default values and closure values over.
_python_context->closure_f.shareWith( closure_f );
_python_context->closure_get_msg.shareWith( closure_get_msg );
_python_context->closure_msg.shareWith( closure_msg );
_python_context->closure_nose.shareWith( closure_nose );
_python_context->closure_skip_val.shareWith( closure_skip_val );
PyObject *result = Nuitka_Function_New(
fparse_function_4_skipper_func_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators,
dparse_function_4_skipper_func_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators,
const_str_plain_skipper_func,
#if PYTHON_VERSION >= 330
NULL,
#endif
codeobj_fa50ff54d73f9224f3e1637cacd081a7,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_numpy$testing$decorators,
const_str_digest_aed9c6f05f8bd9ccbb222086ef95db4a,
_python_context,
_context_function_4_skipper_func_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_destructor
);
return result;
}
static PyObject *MAKE_FUNCTION_function_5_deprecated_of_module_numpy$testing$decorators( PyObject *defaults )
{
PyObject *result = Nuitka_Function_New(
fparse_function_5_deprecated_of_module_numpy$testing$decorators,
dparse_function_5_deprecated_of_module_numpy$testing$decorators,
const_str_plain_deprecated,
#if PYTHON_VERSION >= 330
NULL,
#endif
codeobj_59de52f77071b586304ff5779949659a,
defaults,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_numpy$testing$decorators,
const_str_digest_16fbe8beab858c2b480e70e3991f2cc7
);
return result;
}
static PyObject *MAKE_FUNCTION_function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( PyObjectSharedLocalVariable &closure_f, PyObjectSharedLocalVariable &closure_get_msg, PyObjectSharedLocalVariable &closure_msg, PyObjectSharedLocalVariable &closure_nose, PyObjectSharedLocalVariable &closure_skip_val )
{
struct _context_common_function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t *_python_context = new _context_common_function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t;
_python_context->ref_count = 1;
// Copy the parameter default values and closure values over.
_python_context->closure_f.shareWith( closure_f );
_python_context->closure_get_msg.shareWith( closure_get_msg );
_python_context->closure_msg.shareWith( closure_msg );
_python_context->closure_nose.shareWith( closure_nose );
_python_context->closure_skip_val.shareWith( closure_skip_val );
return Nuitka_Function_New(
fparse_function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators,
dparse_function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators,
const_str_plain_skipper_gen,
#if PYTHON_VERSION >= 330
NULL,
#endif
codeobj_f5066506c1ce2528546e194440edfea6,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_numpy$testing$decorators,
const_str_digest_b538225c2c14046726b9e5abbec7bc7c,
_python_context,
_context_common_function_5_skipper_gen_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_destructor
);
}
static PyObject *MAKE_FUNCTION_lambda_1_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( PyObjectSharedLocalVariable &closure_skip_condition )
{
struct _context_lambda_1_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t *_python_context = new _context_lambda_1_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t;
// Copy the parameter default values and closure values over.
_python_context->closure_skip_condition.shareWith( closure_skip_condition );
PyObject *result = Nuitka_Function_New(
fparse_lambda_1_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators,
dparse_lambda_1_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators,
const_str_angle_lambda,
#if PYTHON_VERSION >= 330
NULL,
#endif
codeobj_38d1a85c0c830f4f214d9ffc5eb9df27,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_numpy$testing$decorators,
Py_None,
_python_context,
_context_lambda_1_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_destructor
);
return result;
}
static PyObject *MAKE_FUNCTION_lambda_1_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators( PyObjectSharedLocalVariable &closure_fail_condition )
{
struct _context_lambda_1_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators_t *_python_context = new _context_lambda_1_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators_t;
// Copy the parameter default values and closure values over.
_python_context->closure_fail_condition.shareWith( closure_fail_condition );
PyObject *result = Nuitka_Function_New(
fparse_lambda_1_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators,
dparse_lambda_1_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators,
const_str_angle_lambda,
#if PYTHON_VERSION >= 330
NULL,
#endif
codeobj_309d7c4278ed80dc856b730b1d6b856c,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_numpy$testing$decorators,
Py_None,
_python_context,
_context_lambda_1_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators_destructor
);
return result;
}
static PyObject *MAKE_FUNCTION_lambda_2_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators( PyObjectSharedLocalVariable &closure_skip_condition )
{
struct _context_lambda_2_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t *_python_context = new _context_lambda_2_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_t;
// Copy the parameter default values and closure values over.
_python_context->closure_skip_condition.shareWith( closure_skip_condition );
PyObject *result = Nuitka_Function_New(
fparse_lambda_2_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators,
dparse_lambda_2_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators,
const_str_angle_lambda,
#if PYTHON_VERSION >= 330
NULL,
#endif
codeobj_2b2ac8416d57591c0ed51a03292717a9,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_numpy$testing$decorators,
Py_None,
_python_context,
_context_lambda_2_lambda_of_function_1_skip_decorator_of_function_3_skipif_of_module_numpy$testing$decorators_destructor
);
return result;
}
static PyObject *MAKE_FUNCTION_lambda_2_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators( PyObjectSharedLocalVariable &closure_fail_condition )
{
struct _context_lambda_2_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators_t *_python_context = new _context_lambda_2_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators_t;
// Copy the parameter default values and closure values over.
_python_context->closure_fail_condition.shareWith( closure_fail_condition );
PyObject *result = Nuitka_Function_New(
fparse_lambda_2_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators,
dparse_lambda_2_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators,
const_str_angle_lambda,
#if PYTHON_VERSION >= 330
NULL,
#endif
codeobj_df08a236890a6fe25bd887010405ccbd,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_numpy$testing$decorators,
Py_None,
_python_context,
_context_lambda_2_lambda_of_function_4_knownfailureif_of_module_numpy$testing$decorators_destructor
);
return result;
}
#if PYTHON_VERSION >= 300
static struct PyModuleDef mdef_numpy$testing$decorators =
{
PyModuleDef_HEAD_INIT,
"numpy.testing.decorators", /* m_name */
NULL, /* m_doc */
-1, /* m_size */
NULL, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
#endif
#define _MODULE_UNFREEZER 0
#if _MODULE_UNFREEZER
#include "nuitka/unfreezing.hpp"
// Table for lookup to find "frozen" modules or DLLs, i.e. the ones included in
// or along this binary.
static struct Nuitka_MetaPathBasedLoaderEntry meta_path_loader_entries[] =
{
{ NULL, NULL, 0 }
};
#endif
// The exported interface to CPython. On import of the module, this function
// gets called. It has to have an exact function name, in cases it's a shared
// library export. This is hidden behind the MOD_INIT_DECL.
MOD_INIT_DECL( numpy$testing$decorators )
{
#if defined(_NUITKA_EXE) || PYTHON_VERSION >= 300
static bool _init_done = false;
// Packages can be imported recursively in deep executables.
if ( _init_done )
{
return MOD_RETURN_VALUE( module_numpy$testing$decorators );
}
else
{
_init_done = true;
}
#endif
#ifdef _NUITKA_MODULE
// In case of a stand alone extension module, need to call initialization
// the init here because that's the first and only time we are going to get
// called here.
// Initialize the constant values used.
_initBuiltinModule();
_initConstants();
// Initialize the compiled types of Nuitka.
PyType_Ready( &Nuitka_Generator_Type );
PyType_Ready( &Nuitka_Function_Type );
PyType_Ready( &Nuitka_Method_Type );
PyType_Ready( &Nuitka_Frame_Type );
#if PYTHON_VERSION < 300
initSlotCompare();
#endif
patchBuiltinModule();
patchTypeComparison();
#endif
#if _MODULE_UNFREEZER
registerMetaPathBasedUnfreezer( meta_path_loader_entries );
#endif
_initModuleConstants();
_initModuleCodeObjects();
// puts( "in initnumpy$testing$decorators" );
// Create the module object first. There are no methods initially, all are
// added dynamically in actual code only. Also no "__doc__" is initially
// set at this time, as it could not contain NUL characters this way, they
// are instead set in early module code. No "self" for modules, we have no
// use for it.
#if PYTHON_VERSION < 300
module_numpy$testing$decorators = Py_InitModule4(
"numpy.testing.decorators", // Module Name
NULL, // No methods initially, all are added
// dynamically in actual module code only.
NULL, // No __doc__ is initially set, as it could
// not contain NUL this way, added early in
// actual code.
NULL, // No self for modules, we don't use it.
PYTHON_API_VERSION
);
#else
module_numpy$testing$decorators = PyModule_Create( &mdef_numpy$testing$decorators );
#endif
moduledict_numpy$testing$decorators = (PyDictObject *)((PyModuleObject *)module_numpy$testing$decorators)->md_dict;
assertObject( module_numpy$testing$decorators );
// Seems to work for Python2.7 out of the box, but for Python3, the module
// doesn't automatically enter "sys.modules", so do it manually.
#if PYTHON_VERSION >= 300
{
int r = PyObject_SetItem( PySys_GetObject( (char *)"modules" ), const_str_digest_1b5c108d861eb7efd57e6856f5d16339, module_numpy$testing$decorators );
assert( r != -1 );
}
#endif
// For deep importing of a module we need to have "__builtins__", so we set
// it ourselves in the same way than CPython does. Note: This must be done
// before the frame object is allocated, or else it may fail.
PyObject *module_dict = PyModule_GetDict( module_numpy$testing$decorators );
if ( PyDict_GetItem( module_dict, const_str_plain___builtins__ ) == NULL )
{
PyObject *value = (PyObject *)builtin_module;
// Check if main module, not a dict then.
#if !defined(_NUITKA_EXE) || !0
value = PyModule_GetDict( value );
#endif
#ifndef __NUITKA_NO_ASSERT__
int res =
#endif
PyDict_SetItem( module_dict, const_str_plain___builtins__, value );
assert( res == 0 );
}
#if PYTHON_VERSION >= 330
#if _MODULE_UNFREEZER
PyDict_SetItem( module_dict, const_str_plain___loader__, metapath_based_loader );
#else
PyDict_SetItem( module_dict, const_str_plain___loader__, Py_None );
#endif
#endif
// Temp variables if any
PyObject *exception_type, *exception_value;
PyTracebackObject *exception_tb;
PyObject *tmp_assign_source_1;
PyObject *tmp_assign_source_2;
PyObject *tmp_assign_source_3;
PyObject *tmp_assign_source_4;
PyObject *tmp_assign_source_5;
PyObject *tmp_assign_source_6;
PyObject *tmp_assign_source_7;
PyObject *tmp_assign_source_8;
PyObject *tmp_assign_source_9;
PyObject *tmp_assign_source_10;
PyObject *tmp_assign_source_11;
PyObject *tmp_assign_source_12;
PyObject *tmp_defaults_1;
PyObject *tmp_defaults_2;
PyObject *tmp_defaults_3;
PyObject *tmp_defaults_4;
PyObject *tmp_import_globals_1;
PyObject *tmp_import_globals_2;
PyObject *tmp_import_globals_3;
PyObject *tmp_import_globals_4;
PyObject *tmp_import_globals_5;
PyObject *tmp_import_name_from_1;
PyObject *tmp_import_name_from_2;
PyObject *tmp_import_name_from_3;
// Module code.
tmp_assign_source_1 = const_str_digest_67d31ba9a58fac5a0d23edc7c539684e;
UPDATE_STRING_DICT0( moduledict_numpy$testing$decorators, (Nuitka_StringObject *)const_str_plain___doc__, tmp_assign_source_1 );
tmp_assign_source_2 = const_str_digest_07d346a90218147c85cc05f1870721e8;
UPDATE_STRING_DICT0( moduledict_numpy$testing$decorators, (Nuitka_StringObject *)const_str_plain___file__, tmp_assign_source_2 );
// Frame without reuse.
PyFrameObject *frame_module = MAKE_FRAME( codeobj_9066537bf9ba3d43769ab81db6dcdbba, module_numpy$testing$decorators );
// Push the new frame as the currently active one, and we should be exlusively
// owning it.
pushFrameStack( frame_module );
assert( Py_REFCNT( frame_module ) == 1 );
#if PYTHON_VERSION >= 340
frame_module->f_executing += 1;
#endif
// Framed code:
tmp_import_globals_1 = ((PyModuleObject *)module_numpy$testing$decorators)->md_dict;
frame_module->f_lineno = 16;
tmp_import_name_from_1 = IMPORT_MODULE( const_str_plain___future__, tmp_import_globals_1, tmp_import_globals_1, const_tuple_b3c114ff65e5229953139969fd8f9f4c_tuple, const_int_0 );
if ( tmp_import_name_from_1 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_module->f_lineno = 16;
goto frame_exception_exit_1;
}
tmp_assign_source_3 = IMPORT_NAME( tmp_import_name_from_1, const_str_plain_division );
Py_DECREF( tmp_import_name_from_1 );
if ( tmp_assign_source_3 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_module->f_lineno = 16;
goto frame_exception_exit_1;
}
UPDATE_STRING_DICT1( moduledict_numpy$testing$decorators, (Nuitka_StringObject *)const_str_plain_division, tmp_assign_source_3 );
tmp_import_globals_2 = ((PyModuleObject *)module_numpy$testing$decorators)->md_dict;
frame_module->f_lineno = 16;
tmp_import_name_from_2 = IMPORT_MODULE( const_str_plain___future__, tmp_import_globals_2, tmp_import_globals_2, const_tuple_b3c114ff65e5229953139969fd8f9f4c_tuple, const_int_0 );
if ( tmp_import_name_from_2 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_module->f_lineno = 16;
goto frame_exception_exit_1;
}
tmp_assign_source_4 = IMPORT_NAME( tmp_import_name_from_2, const_str_plain_absolute_import );
Py_DECREF( tmp_import_name_from_2 );
if ( tmp_assign_source_4 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_module->f_lineno = 16;
goto frame_exception_exit_1;
}
UPDATE_STRING_DICT1( moduledict_numpy$testing$decorators, (Nuitka_StringObject *)const_str_plain_absolute_import, tmp_assign_source_4 );
tmp_import_globals_3 = ((PyModuleObject *)module_numpy$testing$decorators)->md_dict;
frame_module->f_lineno = 16;
tmp_import_name_from_3 = IMPORT_MODULE( const_str_plain___future__, tmp_import_globals_3, tmp_import_globals_3, const_tuple_b3c114ff65e5229953139969fd8f9f4c_tuple, const_int_0 );
if ( tmp_import_name_from_3 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_module->f_lineno = 16;
goto frame_exception_exit_1;
}
tmp_assign_source_5 = IMPORT_NAME( tmp_import_name_from_3, const_str_plain_print_function );
Py_DECREF( tmp_import_name_from_3 );
if ( tmp_assign_source_5 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_module->f_lineno = 16;
goto frame_exception_exit_1;
}
UPDATE_STRING_DICT1( moduledict_numpy$testing$decorators, (Nuitka_StringObject *)const_str_plain_print_function, tmp_assign_source_5 );
tmp_import_globals_4 = ((PyModuleObject *)module_numpy$testing$decorators)->md_dict;
frame_module->f_lineno = 18;
tmp_assign_source_6 = IMPORT_MODULE( const_str_plain_warnings, tmp_import_globals_4, tmp_import_globals_4, Py_None, const_int_0 );
if ( tmp_assign_source_6 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_module->f_lineno = 18;
goto frame_exception_exit_1;
}
UPDATE_STRING_DICT1( moduledict_numpy$testing$decorators, (Nuitka_StringObject *)const_str_plain_warnings, tmp_assign_source_6 );
tmp_import_globals_5 = ((PyModuleObject *)module_numpy$testing$decorators)->md_dict;
frame_module->f_lineno = 19;
tmp_assign_source_7 = IMPORT_MODULE( const_str_plain_collections, tmp_import_globals_5, tmp_import_globals_5, Py_None, const_int_0 );
if ( tmp_assign_source_7 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
frame_module->f_lineno = 19;
goto frame_exception_exit_1;
}
UPDATE_STRING_DICT1( moduledict_numpy$testing$decorators, (Nuitka_StringObject *)const_str_plain_collections, tmp_assign_source_7 );
tmp_assign_source_8 = MAKE_FUNCTION_function_1_slow_of_module_numpy$testing$decorators( );
if ( tmp_assign_source_8 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
Py_DECREF( tmp_assign_source_8 );
frame_module->f_lineno = 22;
goto frame_exception_exit_1;
}
UPDATE_STRING_DICT1( moduledict_numpy$testing$decorators, (Nuitka_StringObject *)const_str_plain_slow, tmp_assign_source_8 );
tmp_defaults_1 = const_tuple_true_tuple;
tmp_assign_source_9 = MAKE_FUNCTION_function_2_setastest_of_module_numpy$testing$decorators( INCREASE_REFCOUNT( tmp_defaults_1 ) );
if ( tmp_assign_source_9 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
Py_DECREF( tmp_assign_source_9 );
frame_module->f_lineno = 57;
goto frame_exception_exit_1;
}
UPDATE_STRING_DICT1( moduledict_numpy$testing$decorators, (Nuitka_StringObject *)const_str_plain_setastest, tmp_assign_source_9 );
tmp_defaults_2 = const_tuple_none_tuple;
tmp_assign_source_10 = MAKE_FUNCTION_function_3_skipif_of_module_numpy$testing$decorators( INCREASE_REFCOUNT( tmp_defaults_2 ) );
if ( tmp_assign_source_10 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
Py_DECREF( tmp_assign_source_10 );
frame_module->f_lineno = 90;
goto frame_exception_exit_1;
}
UPDATE_STRING_DICT1( moduledict_numpy$testing$decorators, (Nuitka_StringObject *)const_str_plain_skipif, tmp_assign_source_10 );
tmp_defaults_3 = const_tuple_none_tuple;
tmp_assign_source_11 = MAKE_FUNCTION_function_4_knownfailureif_of_module_numpy$testing$decorators( INCREASE_REFCOUNT( tmp_defaults_3 ) );
if ( tmp_assign_source_11 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
Py_DECREF( tmp_assign_source_11 );
frame_module->f_lineno = 167;
goto frame_exception_exit_1;
}
UPDATE_STRING_DICT1( moduledict_numpy$testing$decorators, (Nuitka_StringObject *)const_str_plain_knownfailureif, tmp_assign_source_11 );
tmp_defaults_4 = const_tuple_true_tuple;
tmp_assign_source_12 = MAKE_FUNCTION_function_5_deprecated_of_module_numpy$testing$decorators( INCREASE_REFCOUNT( tmp_defaults_4 ) );
if ( tmp_assign_source_12 == NULL )
{
assert( ERROR_OCCURED() );
PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb );
Py_DECREF( tmp_assign_source_12 );
frame_module->f_lineno = 220;
goto frame_exception_exit_1;
}
UPDATE_STRING_DICT1( moduledict_numpy$testing$decorators, (Nuitka_StringObject *)const_str_plain_deprecated, tmp_assign_source_12 );
// Restore frame exception if necessary.
#if 0
RESTORE_FRAME_EXCEPTION( frame_module );
#endif
popFrameStack();
assertFrameObject( frame_module );
Py_DECREF( frame_module );
goto frame_no_exception_1;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_module );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_module ) );
}
else if ( exception_tb->tb_frame != frame_module )
{
PyTracebackObject *traceback_new = (PyTracebackObject *)MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_module ) );
traceback_new->tb_next = exception_tb;
exception_tb = traceback_new;
}
// Put the previous frame back on top.
popFrameStack();
#if PYTHON_VERSION >= 340
frame_module->f_executing -= 1;
#endif
Py_DECREF( frame_module );
// Return the error.
goto module_exception_exit;
frame_no_exception_1:;
return MOD_RETURN_VALUE( module_numpy$testing$decorators );
module_exception_exit:
PyErr_Restore( exception_type, exception_value, (PyObject *)exception_tb );
return MOD_RETURN_VALUE( NULL );
}
|
bf17eb18f549b39a65c33f377b99a8da935662fe
|
37a368d47a664bf5156068ad65684359aaad9897
|
/cpp/src/barretenberg/benchmark/honk_bench/ultra_honk.bench.cpp
|
56c45d24ef010d4a1a3b5d2756ab9093c37c0efe
|
[
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] |
permissive
|
AztecProtocol/barretenberg
|
e35828f2ec58be737edf5af53d75f491bbc797fc
|
e5df3f2efe5db8c6ece54a6d1e4db876c9b788a2
|
refs/heads/master
| 2023-08-30T20:57:07.608894
| 2023-08-30T14:13:42
| 2023-08-30T14:14:20
| 574,999,978
| 58
| 29
|
Apache-2.0
| 2023-09-12T16:37:34
| 2022-12-06T14:34:53
|
C++
|
UTF-8
|
C++
| false
| false
| 2,282
|
cpp
|
ultra_honk.bench.cpp
|
#include <benchmark/benchmark.h>
#include "barretenberg/benchmark/honk_bench/benchmark_utilities.hpp"
#include "barretenberg/honk/composer/ultra_composer.hpp"
#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"
using namespace benchmark;
using namespace proof_system::plonk;
namespace ultra_honk_bench {
using UltraBuilder = proof_system::UltraCircuitBuilder;
using UltraHonk = proof_system::honk::UltraComposer;
// Number of times to perform operation of interest in the benchmark circuits, e.g. # of hashes to perform
constexpr size_t MIN_NUM_ITERATIONS = bench_utils::BenchParams::MIN_NUM_ITERATIONS;
constexpr size_t MAX_NUM_ITERATIONS = bench_utils::BenchParams::MAX_NUM_ITERATIONS;
// Number of times to repeat each benchmark
constexpr size_t NUM_REPETITIONS = bench_utils::BenchParams::NUM_REPETITIONS;
/**
* @brief Benchmark: Construction of a Ultra Honk proof for a circuit determined by the provided circuit function
*/
void construct_proof_ultra(State& state, void (*test_circuit_function)(UltraBuilder&, size_t)) noexcept
{
bench_utils::construct_proof_with_specified_num_iterations<UltraHonk>(state, test_circuit_function);
}
// Define benchmarks
BENCHMARK_CAPTURE(construct_proof_ultra, sha256, &bench_utils::generate_sha256_test_circuit<UltraBuilder>)
->DenseRange(MIN_NUM_ITERATIONS, MAX_NUM_ITERATIONS)
->Repetitions(NUM_REPETITIONS)
->Unit(::benchmark::kSecond);
BENCHMARK_CAPTURE(construct_proof_ultra, keccak, &bench_utils::generate_keccak_test_circuit<UltraBuilder>)
->DenseRange(MIN_NUM_ITERATIONS, MAX_NUM_ITERATIONS)
->Repetitions(NUM_REPETITIONS)
->Unit(::benchmark::kSecond);
BENCHMARK_CAPTURE(construct_proof_ultra,
ecdsa_verification,
&bench_utils::generate_ecdsa_verification_test_circuit<UltraBuilder>)
->DenseRange(MIN_NUM_ITERATIONS, MAX_NUM_ITERATIONS)
->Repetitions(NUM_REPETITIONS)
->Unit(::benchmark::kSecond);
BENCHMARK_CAPTURE(construct_proof_ultra,
merkle_membership,
&bench_utils::generate_merkle_membership_test_circuit<UltraBuilder>)
->DenseRange(MIN_NUM_ITERATIONS, MAX_NUM_ITERATIONS)
->Repetitions(NUM_REPETITIONS)
->Unit(::benchmark::kSecond);
} // namespace ultra_honk_bench
|
d872db9d33024cf22ca517cef6b729066d0b71c6
|
2c4f360dc9bbfd5892e29341245e3374125d6b60
|
/unitsLib/units-2.1/scalar/MagneticField.h
|
39f345406eeb7c54f984205f71a721edae0cfccf
|
[
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
mitre/FMACM
|
d5549ed4b0e26e72d8186afc77a57e4f3833d864
|
a9fb00aef7561d2cb35af1163b44dda55a48c85f
|
refs/heads/master
| 2023-09-03T01:13:05.401619
| 2023-08-16T20:48:59
| 2023-08-16T20:48:59
| 35,225,860
| 11
| 4
|
Apache-2.0
| 2018-06-27T18:07:04
| 2015-05-07T14:49:02
|
C++
|
UTF-8
|
C++
| false
| false
| 883
|
h
|
MagneticField.h
|
//
// $Id: MagneticField.h,v 1.1.2.1 2005-12-16 06:22:31 knicewar Exp $
//
// Copyright Keith Nicewarner. All rights reserved.
//
// Represent the abstract concept of a measure of magnetic field
// (current per units length). The internal representation of the
// units is hidden from the user.
//
#ifndef Units_MagneticField_h
#define Units_MagneticField_h
#include "SpecificUnit.h"
#include "RatioUnitFormat.h"
namespace Units
{
UNITS_DECLARE_BASE_UNIT(MagneticField, 0, -1, 0, 1, 0, 0, 0, 0);
#define MagneticFieldFormat RatioUnitFormat
UNITS_DECLARE_SPECIFIC_UNIT(MagneticField,
AmpsPerMeterMagneticField, "A/m", 1.0);
UNITS_DECLARE_SPECIFIC_UNIT(MagneticField,
OerstedsMagneticField, "Oe",
1000.0/(4*3.14159265358979323846));
} // namespace Units
#endif // Units_MagneticField_h
|
914350b671aa2912185874004b5e4dbbe447f6cf
|
7d9e50d1e5b0748180440d70fe16fc3b447f2e8d
|
/Practice/Exams/20172/III/prova3/questao1/iobserver.h
|
ced3eb419f8c497dc10bc46faefcd13d178f34d7
|
[] |
no_license
|
cjlcarvalho/patterns
|
b880c5e04e57d82b081e863b09e3deb54698b086
|
4f9cf15df161bb82ecd52d3524ae7d44ada8b991
|
refs/heads/master
| 2021-09-13T02:23:48.068664
| 2018-04-23T23:17:34
| 2018-04-23T23:17:34
| 111,008,981
| 1
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 152
|
h
|
iobserver.h
|
#ifndef IOBSERVER_H
#define IOBSERVER_H
class ISubject;
class IObserver
{
public:
virtual void update(ISubject *s) = 0;
};
#endif // IOBSERVER_H
|
2ddfebdbddbb6b008f7effc453489ca8a94bae8d
|
6c4b0b422d16efe9c16483baf17f1529a674d421
|
/Base/CHTTPClient.cpp
|
2a7a66f318e0120990a3dbe68736d2d178be933f
|
[] |
no_license
|
Fengerking/bangStock
|
04e9b6a1e77f4470d042fc17c73bafd229ddd4c3
|
62f26b1597bb2013c4b84fcc2e0ef2e8f96e3e30
|
refs/heads/master
| 2021-01-19T10:53:11.577776
| 2017-04-13T14:50:42
| 2017-04-13T14:50:42
| 87,909,425
| 0
| 0
| null | null | null | null |
GB18030
|
C++
| false
| false
| 31,587
|
cpp
|
CHTTPClient.cpp
|
/*******************************************************************************
File: CHTTPClient.cpp
Contains: http client implement code
Written by: Bangfei Jin
Change History (most recent first):
2017-01-06 Bangfei Create file
*******************************************************************************/
#ifdef __QC_OS_WIN32__
#include <winsock2.h>
#include "Ws2tcpip.h"
#else
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <errno.h>
#include <limits.h>
#include <signal.h>
#include <ctype.h>
#include "GKMacrodef.h"
#include <exception>
#include <typeinfo>
#include <pthread.h>
#include <sys/types.h>
#include <fcntl.h>
#include<signal.h>
#endif // __QC_OS_WIN32__
#include "qcErr.h"
#include "CHTTPClient.h"
#include "UMsgMng.h"
#include "UUrlParser.h"
#include "USystemFunc.h"
#include "ULogFunc.h"
#define CONNECTION_TIMEOUT_IN_SECOND 30 //unit: second
#define HTTP_HEADER_RECV_TIMEOUT_IN_SECOND 30 //unit: second
#define HTTP_HEADER_RECV_MAXTIME 10000 //
#define CONNECT_ERROR_BASE 600 //connect error base value
#define REQUEST_ERROR_BASE 1000 //request error base value
#define RESPONSE_ERROR_BASE 1300 //response error base value
#define DNS_ERROR_BASE 2000 //dns resolve error base value
#define HTTPRESPONSE_INTERUPTER 1304
#define ERROR_CODE_TEST 902
#define INET_ADDR_EXCEPTION 16
#define DNS_TIME_OUT 17
#define DNS_UNKNOWN 18
#define TIME_KEEP_ALIVE 1 // 打开探测
#define TIME_KEEP_IDLE 10 // 开始探测前的空闲等待时长10s
#define TIME_KEEP_INTVL 2 // 发送探测分节的时间间隔 2s
#define TIME_KEEP_CNT 3 // 发送探测分节的次数 3 times
static const int KInvalidSocketHandler = -1;
static const int KInvalidContentLength = -1;
static const char KContentType[] = {'C', 'o', 'n', 't', 'e', 'n', 't', '-', 'T', 'y', 'p', 'e', '\0'};
static const char KContentRangeKey[] = {'C', 'o', 'n', 't', 'e', 'n', 't', '-', 'R', 'a', 'n', 'g', 'e', '\0'};
static const char KContentLengthKey[] = {'C', 'o', 'n', 't', 'e', 'n', 't', '-', 'L', 'e', 'n', 'g', 't', 'h', '\0'};
static const char KLocationKey[] = {'L', 'o', 'c', 'a', 't', 'i', 'o', 'n', '\0'};
static const char KTransferEncodingKey[] = {'T', 'r', 'a', 'n', 's', 'f', 'e', 'r', '-', 'E', 'n', 'c', 'o', 'd', 'i', 'n', 'g','\0'};
static const int STATUS_OK = 0;
static const int Status_Error_ServerConnectTimeOut = 905;
static const int Status_Error_HttpResponseTimeOut = 1556;
static const int Status_Error_HttpResponseBadDescriptor = 1557;
static const int Status_Error_HttpResponseArgumentError= 1558;
static const int Status_Error_NoUsefulSocket = 1559;
#define _ETIMEDOUT 60
unsigned int g_ProxyHostIP = 0;
QCIPAddr g_ProxyHostIPV6 = NULL;
int g_ProxyHostPort = 0;
char* g_AutherKey = NULL;
char* g_Domain = NULL;
#define ONESECOND 1000
#define WAIT_DNS_INTERNAL 50
#define WAIT_DNS_MAX_TIME 600
void HTTP_SignalHandle(int avalue)
{
// gCancle = true;
}
CHTTPClient::CHTTPClient(CDNSCache * pDNSCache)
: CBaseObject ()
, m_sState (DISCONNECTED)
, m_nSocketHandle (0)
, m_llContentLength (0)
, m_nWSAStartup (0)
, m_pHostMetaData (NULL)
, m_pDNSCache (pDNSCache)
, m_sHostIP (NULL)
, m_nStatusCode (0)
, m_bCancel (false)
, m_nHostIP (0)
, m_bMediaType (false)
, m_bTransferBlock (false)
{
SetObjectName ("CHTTPClient");
#ifndef __QC_OS_WIN32__
m_hConnectionTid = 0;
#endif
#ifdef __QC_OS_WIN32__
WORD wVersionRequested;
WSADATA wsaData;
wVersionRequested = MAKEWORD( 2, 2 );
m_nWSAStartup = WSAStartup( wVersionRequested, &wsaData );
#else
struct sigaction act, oldact;
act.sa_handler = HTTP_SignalHandle;
act.sa_flags = SA_NODEFER;
//sigaddset(&act.sa_mask, SIGALRM);
sigaction(SIGALRM, &act, &oldact);
//signal(SIGPIPE, SIG_IGN);
#endif
memset(&m_hConnectionTid, 0, sizeof(m_hConnectionTid));
memset(m_szRedirectUrl,0,sizeof(m_szRedirectUrl));
}
CHTTPClient::~CHTTPClient(void)
{
if (m_sState == CONNECTED)
Disconnect();
#ifdef __QC_OS_WIN32__
WSACleanup();
#endif
if (m_nHostIP != NULL)
{
struct sockaddr_storage* tmp = (struct sockaddr_storage*)m_nHostIP;
//b need free? free(tmp);
m_nHostIP = NULL;
}
QC_FREE_P (m_pHostMetaData);
}
int CHTTPClient::RequestData (char * pHost, char * pPath, char * pHead, char * pData, int nPort)
{
if(m_nWSAStartup)
return QC_ERR_STATUS;
m_nStatusCode = STATUS_OK;
m_bCancel = false;
m_bTransferBlock = false;
m_bMediaType = false;
if (m_sHostIP == NULL)
m_sHostIP = (QCIPAddr)malloc(sizeof(struct sockaddr_storage));
else
memset(m_sHostIP, 0, sizeof(struct sockaddr_storage));
m_nHostIP = 0;
int nErr = ResolveDNS(pHost, m_sHostIP);
if( nErr != QC_ERR_NONE)
return NULL;
nErr = ConnectServer(m_sHostIP, nPort);
if( nErr != QC_ERR_NONE)
return nErr;
char szRequest[4096];
char szLine[1024];
sprintf (szRequest, "GET %s HTTP/1.1\r\n", pPath);
sprintf (szLine, "%s\r\n\r\n", pHead);
strcat (szRequest, szLine);
if (strlen (pData) > 0)
{
sprintf (szLine, "%s\r\n", pData);
strcat (szRequest, szLine);
}
/*
if(nPort != 80) {
sprintf(m_szRequset, "GET /%s HTTP/1.1\r\n%s:%d\r\nConnection: keep-alive\r\n\r\n", m_szHostFileName, m_pHostMetaData, aPort);
else {
sprintf(m_szRequset, "GET /%s HTTP/1.1\r\n%s\r\nConnection: keep-alive\r\n\r\n", m_szHostFileName, m_pHostMetaData);
}
*/
nErr = Send(szRequest, strlen(szRequest));
if ((nErr != QC_ERR_NONE) && (m_sState == CONNECTED))
{
nErr = QC_ERR_CANNOT_CONNECT;
QCLOGE("connect failed. Connection is going to be closed");
Disconnect();
}
return nErr;
}
int CHTTPClient::Read(char* aDstBuffer, int aSize)
{
if(m_sState == DISCONNECTED)
return QC_ERR_Disconnected;
struct timeval tTimeout = {0, 500000};
return Receive(m_nSocketHandle, tTimeout, aDstBuffer, aSize);
}
int CHTTPClient::Recv(char* aDstBuffer, int aSize)
{
struct timeval tTimeout = {0, 20000};//{HTTP_HEADER_RECV_TIMEOUT_IN_SECOND, 0};
int nErr;
// int retryCnt = HTTP_HEADER_RECV_MAXTIMES;// 6*5s = 30s, total wait time is 30s;
long long nStartTime = qcGetSysTime();
long long nOffset = 0;
do{
nErr = Receive(m_nSocketHandle, tTimeout, aDstBuffer, aSize);
nOffset = qcGetSysTime() - nStartTime;
if (nOffset > HTTP_HEADER_RECV_MAXTIME || m_bCancel) {
break;
}
}while (nErr == 0);
return nErr;
}
int CHTTPClient::Send(const char* aSendBuffer, int aSize)
{
if(m_sState == DISCONNECTED)
return QC_ERR_Disconnected;
int nSend = 0;
int nTotalsend = 0;
while(nTotalsend < aSize)
{
#ifdef __QC_OS_WIN32__
nSend = send(m_nSocketHandle , aSendBuffer + nTotalsend, aSize - nTotalsend , 0 );
#else
nSend = write(m_nSocketHandle, aSendBuffer + nTotalsend, aSize - nTotalsend);
if (nSend < 0 && errno == EINTR) {
nSend = 0; /* and call write() again */
}
#endif
if(nSend < 0)
{
SetStatusCode(errno + REQUEST_ERROR_BASE);
QCLOGE("send error!%s/n", strerror(errno));
return QC_ERR_CANNOT_CONNECT;
}
nTotalsend += nSend;
}
return QC_ERR_NONE;
}
int CHTTPClient::Connect(const char* aUrl, long long aOffset)
{
if(m_nWSAStartup)
return QC_ERR_CANNOT_CONNECT;
QCMSG_Notify (QC_MSG_HTTP_CONNECT_START, 0, 0, aUrl);
int nPort;
qcUrlParseUrl(aUrl, m_szHostAddr, m_szHostFileName, nPort);
m_nStatusCode = STATUS_OK;
m_bCancel = false;
m_bTransferBlock = false;
m_bMediaType = false;
m_llContentLength = KInvalidContentLength;
#ifdef __QC_OS_WIN32__
m_hConnectionTid.p = NULL;
m_hConnectionTid.x = 0;
#else
m_hConnectionTid = pthread_self();
#endif // __QC_OS_WIN32__
if (m_sHostIP == NULL) {
m_sHostIP = (QCIPAddr)malloc(sizeof(struct sockaddr_storage));
}
else{
memset(m_sHostIP, 0, sizeof(struct sockaddr_storage));
}
m_nHostIP = 0;
int nErr = ResolveDNS(m_szHostAddr, m_sHostIP);
if( nErr != QC_ERR_NONE)
return nErr;
nErr = ConnectServer(m_sHostIP, nPort);
if( nErr != QC_ERR_NONE)
return nErr;
return SendRequestAndParseResponse(&CHTTPClient::Connect, aUrl, nPort, aOffset);
}
int CHTTPClient::ConnectViaProxy(const char* aUrl, long long aOffset)
{
if(m_nWSAStartup)
return QC_ERR_CANNOT_CONNECT;
QCMSG_Notify (QC_MSG_HTTP_CONNECT_START, 0, 0, aUrl);
char tLine[3] = {0};
int nPort;
int nErr;
m_nStatusCode = STATUS_OK;
m_bCancel = false;
m_bTransferBlock = false;
m_bMediaType = false;
m_llContentLength = KInvalidContentLength;
#ifdef __QC_OS_WIN32__
m_hConnectionTid.p = NULL;
m_hConnectionTid.x = 0;
#else
m_hConnectionTid = pthread_self();
#endif // __QC_OS_WIN32__
if (g_Domain != NULL) {
//memset(&g_ProxyHostIP, 0, sizeof(QCIPAddr));
if (g_ProxyHostIPV6 == NULL) {
g_ProxyHostIPV6 = (QCIPAddr)malloc(sizeof(struct sockaddr_storage));
}
else{
memset(g_ProxyHostIPV6, 0, sizeof(struct sockaddr_storage));
}
int nErr = ResolveDNS(g_Domain, g_ProxyHostIPV6);
if( nErr != QC_ERR_NONE)
{
return nErr;
}
nErr = ConnectServer(g_ProxyHostIPV6, g_ProxyHostPort);
}
else
nErr = ConnectServerIPV4Proxy(g_ProxyHostIP, g_ProxyHostPort);
if( nErr != QC_ERR_NONE)
return nErr;
qcUrlParseUrl(aUrl, m_szHostAddr, m_szHostFileName, nPort);
m_nStatusCode = STATUS_OK;
char strRequest[2048] = {0};
// sprintf(strRequest, "CONNECT %s:%d HTTP/1.1\r\nHost: %s:%d\r\nProxy-Connection: Keep-Alive\r\nContent-Length: 0\r\nProxy-Authorization: Basic MzAwMDAwNDU1MDpCREFBQUQ5QjczOUQzQjNG\r\n\r\n",g_pHostAddr, nPort, g_pHostAddr, nPort);MzAwMDAwNDU1MDpCREFBQUQ5QjczOUQzQjNG
sprintf(strRequest, "CONNECT %s:%d HTTP/1.1\r\nProxy-Authorization: Basic %s\r\n\r\n",m_szHostAddr, nPort, g_AutherKey);
//send proxyserver connect request
nErr = Send(strRequest, strlen(strRequest));
if (nErr != QC_ERR_NONE)
return nErr;
unsigned int nStatusCode;
//wait for proxyserver connect response
//response: HTTP/1.1 200 Connection established\r\n
nErr = ParseResponseHeader(nStatusCode);
if (nStatusCode != 200)
return nErr;
//read \r\n
Recv(tLine, 2);
return SendRequestAndParseResponse(&CHTTPClient::ConnectViaProxy, aUrl, nPort, aOffset);
}
void CHTTPClient::Interrupt()
{
#ifndef __QC_OS_WIN32__
if (m_hConnectionTid > 0 && !pthread_equal(m_hConnectionTid, pthread_self()))
{
int pthread_kill_err = pthread_kill(m_hConnectionTid, 0);
if((pthread_kill_err != ESRCH) && (pthread_kill_err != EINVAL))
{
pthread_kill(m_hConnectionTid, SIGALRM);
QCLOGI("sent interrupt signal");
}
}
#endif
m_bCancel = true;
}
unsigned int CHTTPClient::HostIP()
{
return m_nHostIP;
}
void CHTTPClient::SetSocketCheckForNetException(void)
{
#ifdef __QC_OS_IOS__
int keepalive = TIME_KEEP_ALIVE;
int keepidle = TIME_KEEP_IDLE;
int keepintvl = TIME_KEEP_INTVL;
int keepcnt = TIME_KEEP_CNT;
if(m_nSocketHandle != KInvalidSocketHandler){
setsockopt(m_nSocketHandle, SOL_SOCKET, SO_KEEPALIVE, (void *)&keepalive, sizeof (keepalive));
setsockopt(m_nSocketHandle, IPPROTO_TCP, TCP_KEEPALIVE, (void *) &keepidle, sizeof (keepidle));
setsockopt(m_nSocketHandle, IPPROTO_TCP, TCP_KEEPINTVL, (void *)&keepintvl, sizeof (keepintvl));
setsockopt(m_nSocketHandle, IPPROTO_TCP, TCP_KEEPCNT, (void *)&keepcnt, sizeof (keepcnt));
}
#endif
}
int CHTTPClient::RequireContentLength()
{
int nErr = QC_ERR_ARG;
if(!m_bTransferBlock)
return nErr;
while (true)
{
nErr = ReceiveLine(m_szLineBuffer, sizeof(char) * KMaxLineLength);
if (nErr != QC_ERR_NONE)
{
QCLOGE("CHTTPClient RecHeader Error:%d", nErr);
break;
}
if (m_szLineBuffer[0] == '\0')
continue;
int a= ConvertToValue(m_szLineBuffer);
return a;
}
return nErr;
}
int CHTTPClient::ConvertToValue(char * aBuffer)
{
int size = strlen(aBuffer);
int i=0;
int value = 0;
while(i<size)
{
if(aBuffer[i] >= '0' && aBuffer[i] <= '9')
{
value = value* 16 +(aBuffer[i]-'0');
}
else if(aBuffer[i] >= 'a' && aBuffer[i] <= 'f')
{
value = value* 16 +(aBuffer[i]-'a' + 10);
}
else if(aBuffer[i] >= 'A' && aBuffer[i] <= 'F')
{
value = value* 16 +(aBuffer[i]-'A' + 10);
}
else
return -1;
i++;
}
return value;
}
char* CHTTPClient::GetRedirectUrl(void)
{
if(strlen(m_szRedirectUrl) == 0)
return NULL;
else
return m_szRedirectUrl;
}
void CHTTPClient::SetHostMetaData(char* aHostHead)
{
QC_FREE_P (m_pHostMetaData);
if(aHostHead)
{
m_pHostMetaData = (char*)malloc(strlen(aHostHead) + 1);
strcpy(m_pHostMetaData, aHostHead);
}
}
int CHTTPClient::Disconnect()
{
QCMSG_Notify (QC_MSG_HTTP_DISCONNECT_START, 0, 0);
if ((m_sState == CONNECTED || m_sState == CONNECTING) && (m_nSocketHandle != KInvalidSocketHandler))
{
#ifdef __QC_OS_WIN32__
closesocket(m_nSocketHandle);
#else
close(m_nSocketHandle);
#endif
m_nSocketHandle = KInvalidSocketHandler;
m_sState = DISCONNECTED;
}
m_bTransferBlock = false;
m_bMediaType = false;
memset(m_szRedirectUrl,0,sizeof(m_szRedirectUrl));
#ifndef __QC_OS_WIN32__
m_hConnectionTid = 0;
#else
memset(&m_hConnectionTid, 0, sizeof(m_hConnectionTid));
#endif
m_bCancel = false;
QCMSG_Notify (QC_MSG_HTTP_DISCONNECT_DONE, 0, 0);
return 0;
}
bool CHTTPClient::IsCancel()
{
return m_bCancel;
}
int CHTTPClient::HttpStatus(void)
{
return (int)m_sState;
}
unsigned int CHTTPClient::StatusCode(void)
{
return m_nStatusCode;
}
void CHTTPClient::SetStatusCode(unsigned int aCode)
{
//just for test, will delete later!
if (aCode == ERROR_CODE_TEST || aCode == ERROR_CODE_TEST + 2)
aCode = aCode<<1;
m_nStatusCode = aCode;
}
int CHTTPClient::ConnectServer(const QCIPAddr aHostIP, int& nPortNum)
{
if((m_nSocketHandle = socket(aHostIP->sa_family, SOCK_STREAM, 0)) == KInvalidSocketHandler)//
{
QCLOGE("socket return error");
m_nStatusCode = Status_Error_NoUsefulSocket;
return QC_ERR_CANNOT_CONNECT;
}
m_sState = CONNECTING;
SetSocketNonBlock(m_nSocketHandle); //aIP = ((struct sockaddr_in*)(res->ai_addr))->sin_addr;
if (aHostIP->sa_family==AF_INET6) {
((struct sockaddr_in6*)aHostIP)->sin6_port = htons(nPortNum);
} else {
((struct sockaddr_in*)aHostIP)->sin_port = htons(nPortNum);
}
#ifdef __TT_OS_IOS__
int nErr = connect(m_nSocketHandle, aHostIP, aHostIP->sa_len);
#else
int nErr = connect(m_nSocketHandle, aHostIP, sizeof(struct sockaddr));
#endif
if (nErr < 0)
{
m_nStatusCode = errno + CONNECT_ERROR_BASE;
#ifdef __QC_OS_WIN32__
if(nErr == -1)
#else
if (errno == EINPROGRESS)
#endif
{
timeval timeout = {CONNECTION_TIMEOUT_IN_SECOND, 0};
nErr = WaitSocketWriteBuffer(m_nSocketHandle, timeout);
}
if (nErr < 0)
{
if (nErr == QC_ERR_TIMEOUT)
{
m_nStatusCode = Status_Error_ServerConnectTimeOut;
if (m_pDNSCache != NULL)
m_pDNSCache->Del(m_szHostAddr);
}
QCLOGE("connect error. nErr: %d, errorno: %d", nErr, errno);
Disconnect();
SetSocketBlock(m_nSocketHandle);
return QC_ERR_CANNOT_CONNECT;
}
}
SetSocketBlock(m_nSocketHandle);
m_sState = CONNECTED;
QCMSG_Notify (QC_MSG_HTTP_CONNECT_SUCESS, 0, 0);
return QC_ERR_NONE;
}
int CHTTPClient::ConnectServerIPV4Proxy(unsigned int nHostIP, int& nPortNum)
{
if((m_nSocketHandle = socket(AF_INET, SOCK_STREAM, 0)) == KInvalidSocketHandler)
{
QCLOGE("socket return error");
m_nStatusCode = Status_Error_NoUsefulSocket;
return QC_ERR_CANNOT_CONNECT;
}
m_sState = CONNECTING;
SetSocketNonBlock(m_nSocketHandle);
struct sockaddr_in server_addr;
memset(&server_addr, 0, sizeof(server_addr));
server_addr.sin_family = AF_INET;
server_addr.sin_port = htons(nPortNum);
server_addr.sin_addr = *(struct in_addr *)(&nHostIP);
int nErr = connect(m_nSocketHandle, (struct sockaddr *)(&server_addr), sizeof(struct sockaddr));
if (nErr < 0)
{
m_nStatusCode = errno + CONNECT_ERROR_BASE;
#ifdef __QC_OS_WIN32__
if(nErr == -1)
#else
if (errno == EINPROGRESS)
#endif
{
timeval timeout = {CONNECTION_TIMEOUT_IN_SECOND, 0};
nErr = WaitSocketWriteBuffer(m_nSocketHandle, timeout);
}
if (nErr < 0)
{
if (nErr == QC_ERR_TIMEOUT)
{
m_nStatusCode = Status_Error_ServerConnectTimeOut;
if (m_pDNSCache != NULL)
m_pDNSCache->Del(m_szHostAddr);
}
QCLOGE("connect error. nErr: %d, errorno: %d", nErr, errno);
Disconnect();
SetSocketBlock(m_nSocketHandle);
return QC_ERR_CANNOT_CONNECT;
}
}
SetSocketBlock(m_nSocketHandle);
m_sState = CONNECTED;
return QC_ERR_NONE;
}
int CHTTPClient::ResolveDNS(char* aHostAddr, QCIPAddr aHostIP)
{
QCIPAddr * cachedHostIp = NULL;
int loopWaitCnt = 0;
bool parseRet;
QCMSG_Notify (QC_MSG_HTTP_DNS_START, 0, 0, aHostAddr);
if (m_pDNSCache != NULL)
cachedHostIp = (QCIPAddr*)m_pDNSCache->Get(aHostAddr);
if (cachedHostIp != NULL)
{
memcpy((void *)aHostIP, cachedHostIp, sizeof(struct sockaddr_storage));
QCMSG_Notify (QC_MSG_HTTP_DNS_GET_CACHE, 0, 0);
return QC_ERR_NONE;
}
if (m_bCancel)
return QC_ERR_CANNOT_CONNECT;
parseRet = false;
struct addrinfo hints;
struct addrinfo *res;
int ret;
char pHostIP[INET6_ADDRSTRLEN];
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_UNSPEC; /* Allow IPv4 & IPv6 */
hints.ai_socktype = SOCK_STREAM;
ret = getaddrinfo(aHostAddr, NULL,&hints,&res);
if (ret == 0 && res != NULL) {
memcpy(aHostIP, res->ai_addr, res->ai_addrlen);
freeaddrinfo(res);
parseRet = true;
} else {
m_nStatusCode = DNS_ERROR_BASE + ret;
QCLOGE ("getaddrinfo return err: %d", ret);
}
if (parseRet)
{
void *numericAddress = NULL;
if (aHostIP->sa_family == AF_INET6) {
m_nHostIP = 0xffffffff;
//numericAddress = (void*)&(((struct sockaddr_in6*)&aHostIP)->sin6_addr);
} else {
numericAddress = (void*)&(((struct sockaddr_in*)aHostIP)->sin_addr);
if (inet_ntop(aHostIP->sa_family, numericAddress, pHostIP, INET6_ADDRSTRLEN) != NULL){
m_nHostIP = inet_addr(pHostIP);
if (strcmp(pHostIP, aHostAddr) != 0)
{
if (m_pDNSCache != NULL)
m_pDNSCache->Add (aHostAddr, (void *)aHostIP, sizeof(struct sockaddr_storage));
}
}
}
QCMSG_Notify (QC_MSG_HTTP_DNS_GET_IPADDR, 0, 0);
return QC_ERR_NONE;
}
//parse fail
return QC_ERR_CANNOT_CONNECT;
}
int CHTTPClient::SendRequestAndParseResponse(_pFunConnect pFunConnect, const char* aUrl, int aPort, long long aOffset)
{
//send get file request
int nErr = SendRequest(aPort, aOffset);
if (nErr == QC_ERR_NONE)
{
unsigned int nStatusCode = STATUS_OK;
nErr = ParseResponseHeader(nStatusCode);
if (nErr == QC_ERR_NONE)
{
if (IsRedirectStatusCode(nStatusCode))
{
return Redirect(pFunConnect, aOffset);
}
else if (nStatusCode == 200 || nStatusCode == 206)
{
nErr = ParseContentLength(nStatusCode);
}
else
{
m_nStatusCode = nStatusCode;
nErr = QC_ERR_CANNOT_CONNECT;
}
}
}
if ((nErr != QC_ERR_NONE) && (m_sState == CONNECTED))
{
nErr = QC_ERR_CANNOT_CONNECT;
QCLOGE("connect failed. Connection is going to be closed");
Disconnect();
}
struct timeval nRecvDataTimeOut = {0, 500000};
SetSocketTimeOut(m_nSocketHandle, nRecvDataTimeOut);
return nErr;
}
int CHTTPClient::SendRequest(int aPort, long long aOffset)
{
memset(m_szRequset, 0, sizeof(m_szRequset));
if (m_pHostMetaData)
{
if(NULL == strstr(m_pHostMetaData,"Host:"))
{
if (aOffset > 0)
{
if(aPort != 80) {
sprintf(m_szRequset, "GET /%s HTTP/1.1\r\n%sHost: %s:%d\r\nRange: bytes=%ld-\r\nConnection: keep-alive\r\n\r\n", m_szHostFileName, m_pHostMetaData, m_szHostAddr, aPort, aOffset);
} else {
sprintf(m_szRequset, "GET /%s HTTP/1.1\r\n%sHost: %s\r\nRange: bytes=%ld-\r\nConnection: keep-alive\r\n\r\n", m_szHostFileName, m_pHostMetaData, m_szHostAddr, aOffset);
}
}
else
{
if(aPort != 80) {
sprintf(m_szRequset, "GET /%s HTTP/1.1\r\n%sHost: %s:%d\r\nConnection: keep-alive\r\n\r\n", m_szHostFileName, m_pHostMetaData, m_szHostAddr, aPort);
} else {
sprintf(m_szRequset, "GET /%s HTTP/1.1\r\n%sHost: %s\r\nConnection: keep-alive\r\n\r\n", m_szHostFileName, m_pHostMetaData, m_szHostAddr);
}
}
}
else{
if (aOffset > 0)
{
if(aPort != 80) {
sprintf(m_szRequset, "GET /%s HTTP/1.1\r\n%s:%d\r\nRange: bytes=%ld-\r\nConnection: keep-alive\r\n\r\n", m_szHostFileName, m_pHostMetaData, aPort, aOffset);
} else {
sprintf(m_szRequset, "GET /%s HTTP/1.1\r\n%s\r\nRange: bytes=%ld-\r\nConnection: keep-alive\r\n\r\n", m_szHostFileName, m_pHostMetaData, aOffset);
}
}
else
{
if(aPort != 80) {
sprintf(m_szRequset, "GET /%s HTTP/1.1\r\n%s:%d\r\nConnection: keep-alive\r\n\r\n", m_szHostFileName, m_pHostMetaData, aPort);
} else {
sprintf(m_szRequset, "GET /%s HTTP/1.1\r\n%s\r\nConnection: keep-alive\r\n\r\n", m_szHostFileName, m_pHostMetaData);
}
}
}
}
else{
if (aOffset > 0)
{
if(aPort != 80) {
sprintf(m_szRequset, "GET /%s HTTP/1.1\r\nHost: %s:%d\r\nRange: bytes=%ld-\r\nConnection: keep-alive\r\n\r\n", m_szHostFileName, m_szHostAddr, aPort, aOffset);
} else {
sprintf(m_szRequset, "GET /%s HTTP/1.1\r\nHost: %s\r\nRange: bytes=%ld-\r\nConnection: keep-alive\r\n\r\n", m_szHostFileName, m_szHostAddr, aOffset);
}
}
else
{
if(aPort != 80) {
sprintf(m_szRequset, "GET /%s HTTP/1.1\r\nHost: %s:%d\r\nConnection: keep-alive\r\n\r\n", m_szHostFileName, m_szHostAddr, aPort);
} else {
sprintf(m_szRequset, "GET /%s HTTP/1.1\r\nHost: %s\r\nConnection: keep-alive\r\n\r\n", m_szHostFileName, m_szHostAddr);
}
}
}
return Send(m_szRequset, strlen(m_szRequset));
}
int CHTTPClient::ParseResponseHeader(unsigned int& aStatusCode)
{
int nErr = ParseHeader(aStatusCode);
if(nErr == QC_ERR_BadDescriptor)
{
m_nStatusCode = Status_Error_HttpResponseBadDescriptor;
QCLOGW("ParseResponseHeader return %d, %u", nErr, aStatusCode);
}
return nErr;
}
int CHTTPClient::ParseHeader(unsigned int& aStatusCode)
{
char tLine[KMaxLineLength];
int nErr = ReceiveLine(tLine, sizeof(tLine));
if (nErr != QC_ERR_NONE)
{
QCLOGE("Receive Response Error!");
return nErr;
}
char* pSpaceStart = strchr(tLine, ' ');
if (pSpaceStart == NULL)
{
QCLOGE("Receive Response content Error!");
return QC_ERR_BadDescriptor;
}
char* pResponseStatusStart = pSpaceStart + 1;
char* pResponseStatusEnd = pResponseStatusStart;
while (isdigit(*pResponseStatusEnd))
{
++pResponseStatusEnd;
}
if (pResponseStatusStart == pResponseStatusEnd)
{
return QC_ERR_BadDescriptor;
}
memmove(tLine, pResponseStatusStart, pResponseStatusEnd - pResponseStatusStart);
tLine[pResponseStatusEnd - pResponseStatusStart] = '\0';
unsigned int nResponseNum = strtol(tLine, NULL, 10);
if ((nResponseNum < 0) || (nResponseNum > 999))
{
QCLOGE("Receive Invalid ResponseNum!");
return QC_ERR_BadDescriptor;
}
aStatusCode = nResponseNum;
QCMSG_Notify (QC_MSG_HTTP_GET_HEADDATA, 0, 0, tLine);
return QC_ERR_NONE;
}
bool CHTTPClient::IsRedirectStatusCode(unsigned int aStatusCode)
{
return aStatusCode == 301 || aStatusCode == 302
|| aStatusCode == 303 || aStatusCode == 307;
}
int CHTTPClient::Redirect(_pFunConnect pFunConnect, long long aOffset)
{
int nErr = GetHeaderValueByKey(KLocationKey, m_szHeaderValueBuffer, sizeof(char)*KMaxLineLength);
Disconnect();
if (QC_ERR_NONE == nErr)
{
memcpy(m_szRedirectUrl,m_szHeaderValueBuffer,sizeof(m_szRedirectUrl));
QCMSG_Notify (QC_MSG_HTTP_REDIRECT, 0, 0, m_szRedirectUrl);
return (this->*pFunConnect)(m_szHeaderValueBuffer, aOffset);
}
else
{
nErr = QC_ERR_CANNOT_CONNECT;
}
return nErr;
}
int CHTTPClient::ParseContentLength(unsigned int aStatusCode)
{
const char* pKey = (aStatusCode == 206) ? KContentRangeKey : KContentLengthKey;
int nErr = GetHeaderValueByKey(pKey, m_szHeaderValueBuffer, sizeof(char)*KMaxLineLength);
if(m_bTransferBlock)
return QC_ERR_NONE;
if(QC_ERR_FINISH == nErr && m_bMediaType)
{
m_llContentLength = 0;
return QC_ERR_NONE;
}
if (QC_ERR_NONE == nErr)
{
char *pStart = (aStatusCode == 206) ? strchr(m_szHeaderValueBuffer, '/') + 1 : m_szHeaderValueBuffer;
char* pEnd = NULL;
long nContentLen = strtol(pStart, &pEnd, 10);
if ((pEnd == m_szHeaderValueBuffer) || (*pEnd != '\0'))
{
QCLOGE("CHTTPClient Get ContentLength Error!");
m_nStatusCode = Status_Error_HttpResponseArgumentError;
nErr = QC_ERR_ARG;
}
else
{
m_llContentLength = nContentLen;
QCMSG_Notify (QC_MSG_HTTP_CONTENT_LEN, 0, m_llContentLength);
}
}
return nErr;
}
int CHTTPClient::GetHeaderValueByKey(const char* aKey, char* aBuffer, int aBufferLen)
{
int nErr = QC_ERR_ARG;
bool bIsKeyFound = false;
bool bIsKeyChange = false;
if(0 == strcmp(aKey, KContentLengthKey))
bIsKeyChange = true;
while (true)
{
nErr = ReceiveLine(m_szLineBuffer, sizeof(char) * KMaxLineLength);
if (nErr != QC_ERR_NONE)
{
QCLOGE("CHTTPClient RecHeader Error:%d", nErr);
break;
}
if(m_bTransferBlock)
{
if (m_szLineBuffer[0] == '\0')
{
nErr = QC_ERR_NONE;
break;
}
else
continue;
}
if (m_szLineBuffer[0] == '\0')
{
nErr = bIsKeyFound ? QC_ERR_NONE : QC_ERR_FINISH;
break;
}
char* pColonStart = strchr(m_szLineBuffer, ':');
if (pColonStart == NULL)
{
continue;
}
char* pEndofkey = pColonStart;
while ((pEndofkey > m_szLineBuffer) && isspace(pEndofkey[-1]))
{
--pEndofkey;
}
char* pStartofValue = pColonStart + 1;
while (isspace(*pStartofValue))
{
++pStartofValue;
}
*pEndofkey = '\0';
if (strncmp(m_szLineBuffer, aKey, strlen(aKey)) != 0)
{
if(bIsKeyChange){
if (strncmp(m_szLineBuffer, KTransferEncodingKey, strlen(KTransferEncodingKey)) == 0)
{
m_bTransferBlock = true;
m_llContentLength = 0;
}
if (strncmp(m_szLineBuffer, KContentType, strlen(KContentType)) == 0)
{
char* pSrc = m_szLineBuffer + strlen(KContentType) + 1;
if(strstr(pSrc, "audio") != NULL || strstr(pSrc, "video") != NULL) {
m_bMediaType = true;
}
}
}
continue;
}
if (aBufferLen > (int)strlen(pStartofValue))
{
bIsKeyFound = true;
strcpy(aBuffer, pStartofValue);
}
}
return nErr;
}
int CHTTPClient::ReceiveLine(char* aLine, int aSize)
{
if (m_sState != CONNECTED)
return QC_ERR_RETRY;
bool bSawCR = false;
int nLength = 0;
char log[2048];
memset(log, 0, sizeof(char) * 2048);
while (true)
{
char c;
int n = Recv(&c, 1);
if (n <= 0)
{
strncpy(log, aLine, nLength);
if (n == 0)
{
m_nStatusCode = Status_Error_HttpResponseTimeOut;
return QC_ERR_TIMEOUT;
}
else
{
return QC_ERR_CANNOT_CONNECT;
}
}
if (bSawCR && c == '\n')
{
aLine[nLength - 1] = '\0';
//strncpy(log, aLine, nLength);
//LOGI("log: %s, logLength: %d", log, nLength);
return QC_ERR_NONE;
}
bSawCR = (c == '\r');
if (nLength + 1 >= aSize)
{
return QC_ERR_Overflow;
}
aLine[nLength++] = c;
}
return QC_ERR_NONE;
}
int CHTTPClient::Receive(int& aSocketHandle, timeval& aTimeOut, char* aDstBuffer, int aSize)
{
int nErr = WaitSocketReadBuffer(aSocketHandle, aTimeOut);
if (nErr > 0)
{
nErr = recv(aSocketHandle, aDstBuffer, aSize, 0);
if (nErr == 0)
{
//server close socket
nErr = QC_ERR_ServerTerminated;
QCLOGW ("server closed socket!");
}
if (nErr == -1 && errno == _ETIMEDOUT) {
//network abnormal disconnected
nErr = QC_ERR_NTAbnormallDisconneted;
QCLOGW ("network abnormal disconnected!");
}
}
return nErr;
}
int CHTTPClient::WaitSocketWriteBuffer(int& aSocketHandle, timeval& aTimeOut)
{
fd_set fds;
FD_ZERO(&fds);
FD_SET(aSocketHandle, &fds);
int ret = select(aSocketHandle + 1, NULL, &fds, NULL, &aTimeOut);
int err = 0;
int errLength = sizeof(err);
if (ret > 0 && FD_ISSET(aSocketHandle, &fds))
{
getsockopt(aSocketHandle, SOL_SOCKET, SO_ERROR, (char *)&err, (socklen_t*)&errLength);
if (err != 0)
{
SetStatusCode(err + CONNECT_ERROR_BASE);
ret = -1;
}
}
else if(ret < 0)
{
SetStatusCode(errno + CONNECT_ERROR_BASE);
}
return (ret > 0) ? QC_ERR_NONE : ((ret == 0) ? QC_ERR_TIMEOUT : QC_ERR_CANNOT_CONNECT);
}
int CHTTPClient::WaitSocketReadBuffer(int& aSocketHandle, timeval& aTimeOut)
{
fd_set fds;
int nRet;
int tryCnt =0;
retry:
FD_ZERO(&fds);
FD_SET(aSocketHandle, &fds);
//select : if error happens, select return -1, detail errorcode is in error
SetStatusCode(0);
nRet = select(aSocketHandle + 1, &fds, NULL, NULL, &aTimeOut);
if (nRet > 0 && !FD_ISSET(aSocketHandle, &fds))
{
nRet = 0;
}
else if(nRet < 0)
{
SetStatusCode(errno + RESPONSE_ERROR_BASE);
if (StatusCode() == HTTPRESPONSE_INTERUPTER && tryCnt == 0 && IsCancel() == false)
{
tryCnt++;
goto retry;
}
}
return nRet;
}
int CHTTPClient::SetSocketTimeOut(int& aSocketHandle, timeval aTimeOut)
{
return setsockopt(aSocketHandle, SOL_SOCKET, SO_RCVTIMEO, (char *)&aTimeOut, sizeof(struct timeval));
}
void CHTTPClient::SetSocketBlock(int& aSocketHandle)
{
#ifdef __QC_OS_WIN32__
u_long non_blk = 0;
ioctlsocket(aSocketHandle, FIONBIO, &non_blk);
#else
int flags = fcntl(aSocketHandle, F_GETFL, 0);
flags &= (~O_NONBLOCK);
fcntl(aSocketHandle, F_SETFL, flags);
#endif
}
void CHTTPClient::SetSocketNonBlock(int& aSocketHandle)
{
#ifdef __QC_OS_WIN32__
u_long non_blk = 1;
ioctlsocket(aSocketHandle, FIONBIO, &non_blk);
#else
int flags = fcntl(aSocketHandle, F_GETFL, 0);
fcntl(aSocketHandle, F_SETFL, flags | O_NONBLOCK);
#endif
}
|
5393a4d71f9734417df9df83bdbd9a2caa281f58
|
9c3c0462e8c59e56e41e315e7738ca9fec81a6e9
|
/sum_of_n_number.cpp
|
0f89ea5926aa98c0011a0c430e71b8fbc9b358e2
|
[] |
no_license
|
AN-2000/CPP_Basics
|
65a7ac645704527050ad482aff034cd182964d7c
|
608067c692cd445c9d347123b744ed2f420cd98b
|
refs/heads/master
| 2022-12-03T11:56:57.220945
| 2020-08-20T03:19:15
| 2020-08-20T03:19:15
| 271,737,930
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 271
|
cpp
|
sum_of_n_number.cpp
|
#include <iostream>
using namespace std;
int main(){
int n, i = 1, sum = 0; //initial condition
//Input
cin>>n;
while(i<=n){ //Stoping condition
sum = sum + i;
i = i + 1; //Update condition
}
cout<<"sum:"<<sum;
return 0;
}
|
d4e83bea03df085a23a8495dc17e5356c401b2ee
|
88ae8695987ada722184307301e221e1ba3cc2fa
|
/third_party/skia/src/core/SkChromeRemoteGlyphCache.cpp
|
efe31ec081a7e5e013d3e13e8db6b7955d68b5d3
|
[
"BSD-3-Clause",
"Apache-2.0",
"LGPL-2.0-or-later",
"MIT",
"GPL-1.0-or-later"
] |
permissive
|
iridium-browser/iridium-browser
|
71d9c5ff76e014e6900b825f67389ab0ccd01329
|
5ee297f53dc7f8e70183031cff62f37b0f19d25f
|
refs/heads/master
| 2023-08-03T16:44:16.844552
| 2023-07-20T15:17:00
| 2023-07-23T16:09:30
| 220,016,632
| 341
| 40
|
BSD-3-Clause
| 2021-08-13T13:54:45
| 2019-11-06T14:32:31
| null |
UTF-8
|
C++
| false
| false
| 48,164
|
cpp
|
SkChromeRemoteGlyphCache.cpp
|
/*
* Copyright 2018 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "include/private/chromium/SkChromeRemoteGlyphCache.h"
#include "include/core/SkDrawable.h"
#include "include/core/SkFont.h"
#include "include/core/SkSpan.h"
#include "include/core/SkTypeface.h"
#include "include/private/base/SkDebug.h"
#include "src/base/SkTLazy.h"
#include "src/core/SkChecksum.h"
#include "src/core/SkDescriptor.h"
#include "src/core/SkDevice.h"
#include "src/core/SkDistanceFieldGen.h"
#include "src/core/SkDraw.h"
#include "src/core/SkEnumerate.h"
#include "src/core/SkFontMetricsPriv.h"
#include "src/core/SkGlyph.h"
#include "src/core/SkReadBuffer.h"
#include "src/core/SkScalerContext.h"
#include "src/core/SkStrike.h"
#include "src/core/SkStrikeCache.h"
#include "src/core/SkTHash.h"
#include "src/core/SkTraceEvent.h"
#include "src/core/SkTypeface_remote.h"
#include "src/core/SkWriteBuffer.h"
#include "src/text/GlyphRun.h"
#include "src/text/StrikeForGPU.h"
#include <algorithm>
#include <bitset>
#include <iterator>
#include <memory>
#include <new>
#include <optional>
#include <string>
#include <tuple>
#include <unordered_map>
#if defined(SK_GANESH)
#include "include/gpu/GrContextOptions.h"
#include "include/private/chromium/Slug.h"
#include "src/gpu/ganesh/GrDrawOpAtlas.h"
#include "src/text/gpu/SDFTControl.h"
#include "src/text/gpu/SubRunAllocator.h"
#include "src/text/gpu/SubRunContainer.h"
#include "src/text/gpu/TextBlob.h"
#endif
using namespace skia_private;
using namespace sktext;
using namespace sktext::gpu;
using namespace skglyph;
// TODO: remove when new serialization code is done.
//#define SK_SUPPORT_LEGACY_STRIKE_SERIALIZATION
namespace {
#if defined(SK_SUPPORT_LEGACY_STRIKE_SERIALIZATION)
// -- Serializer -----------------------------------------------------------------------------------
size_t pad(size_t size, size_t alignment) { return (size + (alignment - 1)) & ~(alignment - 1); }
// Alignment between x86 and x64 differs for some types, in particular
// int64_t and doubles have 4 and 8-byte alignment, respectively.
// Be consistent even when writing and reading across different architectures.
template<typename T>
size_t serialization_alignment() {
return sizeof(T) == 8 ? 8 : alignof(T);
}
class Serializer {
public:
explicit Serializer(std::vector<uint8_t>* buffer) : fBuffer{buffer} {}
template <typename T, typename... Args>
T* emplace(Args&&... args) {
auto result = this->allocate(sizeof(T), serialization_alignment<T>());
return new (result) T{std::forward<Args>(args)...};
}
template <typename T>
void write(const T& data) {
T* result = (T*)this->allocate(sizeof(T), serialization_alignment<T>());
memcpy(result, &data, sizeof(T));
}
void writeDescriptor(const SkDescriptor& desc) {
write(desc.getLength());
auto result = this->allocate(desc.getLength(), alignof(SkDescriptor));
memcpy(result, &desc, desc.getLength());
}
void* allocate(size_t size, size_t alignment) {
size_t aligned = pad(fBuffer->size(), alignment);
fBuffer->resize(aligned + size);
return &(*fBuffer)[aligned];
}
private:
std::vector<uint8_t>* fBuffer;
};
// -- Deserializer -------------------------------------------------------------------------------
// Note that the Deserializer is reading untrusted data, we need to guard against invalid data.
class Deserializer {
public:
Deserializer(const volatile char* memory, size_t memorySize)
: fMemory(memory), fMemorySize(memorySize) {}
template <typename T>
bool read(T* val) {
auto* result = this->ensureAtLeast(sizeof(T), serialization_alignment<T>());
if (!result) return false;
memcpy(val, const_cast<const char*>(result), sizeof(T));
return true;
}
bool readDescriptor(SkAutoDescriptor* ad) {
uint32_t descLength = 0u;
if (!this->read<uint32_t>(&descLength)) return false;
auto* underlyingBuffer = this->ensureAtLeast(descLength, alignof(SkDescriptor));
if (!underlyingBuffer) return false;
SkReadBuffer buffer((void*)underlyingBuffer, descLength);
auto autoDescriptor = SkAutoDescriptor::MakeFromBuffer(buffer);
if (!autoDescriptor.has_value()) { return false; }
*ad = std::move(*autoDescriptor);
return true;
}
const volatile void* read(size_t size, size_t alignment) {
return this->ensureAtLeast(size, alignment);
}
size_t bytesRead() const { return fBytesRead; }
private:
const volatile char* ensureAtLeast(size_t size, size_t alignment) {
size_t padded = pad(fBytesRead, alignment);
// Not enough data.
if (padded > fMemorySize) return nullptr;
if (size > fMemorySize - padded) return nullptr;
auto* result = fMemory + padded;
fBytesRead = padded + size;
return result;
}
// Note that we read each piece of memory only once to guard against TOCTOU violations.
const volatile char* fMemory;
size_t fMemorySize;
size_t fBytesRead = 0u;
};
// Paths use a SkWriter32 which requires 4 byte alignment.
static const size_t kPathAlignment = 4u;
static const size_t kDrawableAlignment = 8u;
#endif
// -- StrikeSpec -----------------------------------------------------------------------------------
struct StrikeSpec {
StrikeSpec() = default;
StrikeSpec(SkTypefaceID typefaceID, SkDiscardableHandleId discardableHandleId)
: fTypefaceID{typefaceID}, fDiscardableHandleId(discardableHandleId) {}
SkTypefaceID fTypefaceID = 0u;
SkDiscardableHandleId fDiscardableHandleId = 0u;
};
// -- RemoteStrike ----------------------------------------------------------------------------
class RemoteStrike final : public sktext::StrikeForGPU {
public:
// N.B. RemoteStrike is not valid until ensureScalerContext is called.
RemoteStrike(const SkStrikeSpec& strikeSpec,
std::unique_ptr<SkScalerContext> context,
SkDiscardableHandleId discardableHandleId);
~RemoteStrike() override = default;
void lock() override {}
void unlock() override {}
SkGlyphDigest digestFor(skglyph::ActionType, SkPackedGlyphID) override;
bool prepareForImage(SkGlyph* glyph) override {
this->ensureScalerContext();
glyph->setImage(&fAlloc, fContext.get());
return glyph->image() != nullptr;
}
bool prepareForPath(SkGlyph* glyph) override {
this->ensureScalerContext();
glyph->setPath(&fAlloc, fContext.get());
return glyph->path() != nullptr;
}
bool prepareForDrawable(SkGlyph* glyph) override {
this->ensureScalerContext();
glyph->setDrawable(&fAlloc, fContext.get());
return glyph->drawable() != nullptr;
}
#if defined(SK_SUPPORT_LEGACY_STRIKE_SERIALIZATION)
void writePendingGlyphs(Serializer* serializer);
#else
void writePendingGlyphs(SkWriteBuffer& buffer);
#endif
SkDiscardableHandleId discardableHandleId() const { return fDiscardableHandleId; }
const SkDescriptor& getDescriptor() const override {
return *fDescriptor.getDesc();
}
void setStrikeSpec(const SkStrikeSpec& strikeSpec);
const SkGlyphPositionRoundingSpec& roundingSpec() const override {
return fRoundingSpec;
}
sktext::SkStrikePromise strikePromise() override;
bool hasPendingGlyphs() const {
return !fMasksToSend.empty() || !fPathsToSend.empty() || !fDrawablesToSend.empty();
}
void resetScalerContext();
private:
#if defined(SK_SUPPORT_LEGACY_STRIKE_SERIALIZATION)
void writeGlyphPath(const SkGlyph& glyph, Serializer* serializer) const;
void writeGlyphDrawable(const SkGlyph& glyph, Serializer* serializer) const;
#endif
void ensureScalerContext();
const SkAutoDescriptor fDescriptor;
const SkDiscardableHandleId fDiscardableHandleId;
const SkGlyphPositionRoundingSpec fRoundingSpec;
// The context built using fDescriptor
std::unique_ptr<SkScalerContext> fContext;
// fStrikeSpec is set every time getOrCreateCache is called. This allows the code to maintain
// the fContext as lazy as possible.
const SkStrikeSpec* fStrikeSpec;
// Have the metrics been sent for this strike. Only send them once.
bool fHaveSentFontMetrics{false};
// The masks and paths that currently reside in the GPU process.
THashTable<SkGlyphDigest, SkPackedGlyphID, SkGlyphDigest> fSentGlyphs;
// The Masks, SDFT Mask, and Paths that need to be sent to the GPU task for the processed
// TextBlobs. Cleared after diffs are serialized.
std::vector<SkGlyph> fMasksToSend;
std::vector<SkGlyph> fPathsToSend;
std::vector<SkGlyph> fDrawablesToSend;
// Alloc for storing bits and pieces of paths and drawables, Cleared after diffs are serialized.
SkArenaAllocWithReset fAlloc{256};
};
RemoteStrike::RemoteStrike(
const SkStrikeSpec& strikeSpec,
std::unique_ptr<SkScalerContext> context,
uint32_t discardableHandleId)
: fDescriptor{strikeSpec.descriptor()}
, fDiscardableHandleId(discardableHandleId)
, fRoundingSpec{context->isSubpixel(), context->computeAxisAlignmentForHText()}
// N.B. context must come last because it is used above.
, fContext{std::move(context)} {
SkASSERT(fDescriptor.getDesc() != nullptr);
SkASSERT(fContext != nullptr);
}
#if defined(SK_SUPPORT_LEGACY_STRIKE_SERIALIZATION)
// No need to write fScalerContextBits because any needed image is already generated.
void write_glyph(const SkGlyph& glyph, Serializer* serializer) {
serializer->write<SkPackedGlyphID>(glyph.getPackedID());
serializer->write<float>(glyph.advanceX());
serializer->write<float>(glyph.advanceY());
serializer->write<uint16_t>(glyph.width());
serializer->write<uint16_t>(glyph.height());
serializer->write<int16_t>(glyph.top());
serializer->write<int16_t>(glyph.left());
serializer->write<uint8_t>(glyph.maskFormat());
}
void RemoteStrike::writePendingGlyphs(Serializer* serializer) {
SkASSERT(this->hasPendingGlyphs());
// Write the desc.
serializer->emplace<StrikeSpec>(fContext->getTypeface()->uniqueID(), fDiscardableHandleId);
serializer->writeDescriptor(*fDescriptor.getDesc());
serializer->emplace<bool>(fHaveSentFontMetrics);
if (!fHaveSentFontMetrics) {
// Write FontMetrics if not sent before.
SkFontMetrics fontMetrics;
fContext->getFontMetrics(&fontMetrics);
serializer->write<SkFontMetrics>(fontMetrics);
fHaveSentFontMetrics = true;
}
// Write mask glyphs
serializer->emplace<uint64_t>(fMasksToSend.size());
for (SkGlyph& glyph : fMasksToSend) {
SkASSERT(SkMask::IsValidFormat(glyph.maskFormat()));
write_glyph(glyph, serializer);
auto imageSize = glyph.imageSize();
if (imageSize > 0 && SkGlyphDigest::FitsInAtlas(glyph)) {
glyph.setImage(serializer->allocate(imageSize, glyph.formatAlignment()));
fContext->getImage(glyph);
}
}
fMasksToSend.clear();
// Write glyphs paths.
serializer->emplace<uint64_t>(fPathsToSend.size());
for (SkGlyph& glyph : fPathsToSend) {
SkASSERT(SkMask::IsValidFormat(glyph.maskFormat()));
write_glyph(glyph, serializer);
this->writeGlyphPath(glyph, serializer);
}
fPathsToSend.clear();
// Write glyphs drawables.
serializer->emplace<uint64_t>(fDrawablesToSend.size());
for (SkGlyph& glyph : fDrawablesToSend) {
SkASSERT(SkMask::IsValidFormat(glyph.maskFormat()));
write_glyph(glyph, serializer);
writeGlyphDrawable(glyph, serializer);
}
fDrawablesToSend.clear();
fAlloc.reset();
}
#else
void RemoteStrike::writePendingGlyphs(SkWriteBuffer& buffer) {
SkASSERT(this->hasPendingGlyphs());
buffer.writeUInt(fContext->getTypeface()->uniqueID());
buffer.writeUInt(fDiscardableHandleId);
fDescriptor.getDesc()->flatten(buffer);
buffer.writeBool(fHaveSentFontMetrics);
if (!fHaveSentFontMetrics) {
// Write FontMetrics if not sent before.
SkFontMetrics fontMetrics;
fContext->getFontMetrics(&fontMetrics);
SkFontMetricsPriv::Flatten(buffer, fontMetrics);
fHaveSentFontMetrics = true;
}
// Make sure to install all the mask data into the glyphs before sending.
for (SkGlyph& glyph: fMasksToSend) {
this->prepareForImage(&glyph);
}
// Make sure to install all the path data into the glyphs before sending.
for (SkGlyph& glyph: fPathsToSend) {
this->prepareForPath(&glyph);
}
// Make sure to install all the drawable data into the glyphs before sending.
for (SkGlyph& glyph: fDrawablesToSend) {
this->prepareForDrawable(&glyph);
}
// Send all the pending glyph information.
SkStrike::FlattenGlyphsByType(buffer, fMasksToSend, fPathsToSend, fDrawablesToSend);
// Reset all the sending data.
fMasksToSend.clear();
fPathsToSend.clear();
fDrawablesToSend.clear();
fAlloc.reset();
}
#endif
void RemoteStrike::ensureScalerContext() {
if (fContext == nullptr) {
fContext = fStrikeSpec->createScalerContext();
}
}
void RemoteStrike::resetScalerContext() {
fContext = nullptr;
fStrikeSpec = nullptr;
}
void RemoteStrike::setStrikeSpec(const SkStrikeSpec& strikeSpec) {
fStrikeSpec = &strikeSpec;
}
#if defined(SK_SUPPORT_LEGACY_STRIKE_SERIALIZATION)
void RemoteStrike::writeGlyphPath(const SkGlyph& glyph, Serializer* serializer) const {
if (glyph.isEmpty()) {
serializer->write<uint64_t>(0u);
return;
}
const SkPath* path = glyph.path();
if (path == nullptr) {
serializer->write<uint64_t>(0u);
return;
}
size_t pathSize = path->writeToMemory(nullptr);
serializer->write<uint64_t>(pathSize);
path->writeToMemory(serializer->allocate(pathSize, kPathAlignment));
serializer->write<bool>(glyph.pathIsHairline());
}
void RemoteStrike::writeGlyphDrawable(const SkGlyph& glyph, Serializer* serializer) const {
if (glyph.isEmpty()) {
serializer->write<uint64_t>(0u);
return;
}
SkDrawable* drawable = glyph.drawable();
if (drawable == nullptr) {
serializer->write<uint64_t>(0u);
return;
}
sk_sp<SkPicture> picture = drawable->makePictureSnapshot();
sk_sp<SkData> data = picture->serialize();
serializer->write<uint64_t>(data->size());
memcpy(serializer->allocate(data->size(), kDrawableAlignment), data->data(), data->size());
}
#endif
SkGlyphDigest RemoteStrike::digestFor(ActionType actionType, SkPackedGlyphID packedGlyphID) {
SkGlyphDigest* digestPtr = fSentGlyphs.find(packedGlyphID);
if (digestPtr != nullptr && digestPtr->actionFor(actionType) != GlyphAction::kUnset) {
return *digestPtr;
}
SkGlyph* glyph;
this->ensureScalerContext();
switch (actionType) {
case kPath: {
fPathsToSend.emplace_back(fContext->makeGlyph(packedGlyphID, &fAlloc));
glyph = &fPathsToSend.back();
break;
}
case kDrawable: {
fDrawablesToSend.emplace_back(fContext->makeGlyph(packedGlyphID, &fAlloc));
glyph = &fDrawablesToSend.back();
break;
}
default: {
fMasksToSend.emplace_back(fContext->makeGlyph(packedGlyphID, &fAlloc));
glyph = &fMasksToSend.back();
break;
}
}
if (digestPtr == nullptr) {
digestPtr = fSentGlyphs.set(SkGlyphDigest{0, *glyph});
}
digestPtr->setActionFor(actionType, glyph, this);
return *digestPtr;
}
sktext::SkStrikePromise RemoteStrike::strikePromise() {
return sktext::SkStrikePromise{*this->fStrikeSpec};
}
} // namespace
// -- SkStrikeServerImpl ---------------------------------------------------------------------------
class SkStrikeServerImpl final : public sktext::StrikeForGPUCacheInterface {
public:
explicit SkStrikeServerImpl(
SkStrikeServer::DiscardableHandleManager* discardableHandleManager);
// SkStrikeServer API methods
void writeStrikeData(std::vector<uint8_t>* memory);
sk_sp<sktext::StrikeForGPU> findOrCreateScopedStrike(const SkStrikeSpec& strikeSpec) override;
// Methods for testing
void setMaxEntriesInDescriptorMapForTesting(size_t count);
size_t remoteStrikeMapSizeForTesting() const;
private:
inline static constexpr size_t kMaxEntriesInDescriptorMap = 2000u;
void checkForDeletedEntries();
sk_sp<RemoteStrike> getOrCreateCache(const SkStrikeSpec& strikeSpec);
struct MapOps {
size_t operator()(const SkDescriptor* key) const {
return key->getChecksum();
}
bool operator()(const SkDescriptor* lhs, const SkDescriptor* rhs) const {
return *lhs == *rhs;
}
};
using DescToRemoteStrike =
std::unordered_map<const SkDescriptor*, sk_sp<RemoteStrike>, MapOps, MapOps>;
DescToRemoteStrike fDescToRemoteStrike;
SkStrikeServer::DiscardableHandleManager* const fDiscardableHandleManager;
THashSet<SkTypefaceID> fCachedTypefaces;
size_t fMaxEntriesInDescriptorMap = kMaxEntriesInDescriptorMap;
// State cached until the next serialization.
THashSet<RemoteStrike*> fRemoteStrikesToSend;
std::vector<SkTypefaceProxyPrototype> fTypefacesToSend;
};
SkStrikeServerImpl::SkStrikeServerImpl(SkStrikeServer::DiscardableHandleManager* dhm)
: fDiscardableHandleManager(dhm) {
SkASSERT(fDiscardableHandleManager);
}
void SkStrikeServerImpl::setMaxEntriesInDescriptorMapForTesting(size_t count) {
fMaxEntriesInDescriptorMap = count;
}
size_t SkStrikeServerImpl::remoteStrikeMapSizeForTesting() const {
return fDescToRemoteStrike.size();
}
#if defined(SK_SUPPORT_LEGACY_STRIKE_SERIALIZATION)
void SkStrikeServerImpl::writeStrikeData(std::vector<uint8_t>* memory) {
#if defined(SK_TRACE_GLYPH_RUN_PROCESS)
SkString msg;
msg.appendf("\nBegin send strike differences\n");
#endif
size_t strikesToSend = 0;
fRemoteStrikesToSend.foreach ([&](RemoteStrike* strike) {
if (strike->hasPendingGlyphs()) {
strikesToSend++;
} else {
strike->resetScalerContext();
}
});
if (strikesToSend == 0 && fTypefacesToSend.empty()) {
fRemoteStrikesToSend.reset();
return;
}
Serializer serializer(memory);
serializer.emplace<uint64_t>(fTypefacesToSend.size());
for (const auto& typefaceProto: fTypefacesToSend) {
// Temporary: use inside knowledge of SkBinaryWriteBuffer to set the size and alignment.
// This should agree with the alignment used in readStrikeData.
alignas(uint32_t) std::uint8_t bufferBytes[24];
SkBinaryWriteBuffer buffer{bufferBytes, std::size(bufferBytes)};
typefaceProto.flatten(buffer);
serializer.write<uint32_t>(buffer.bytesWritten());
void* dest = serializer.allocate(buffer.bytesWritten(), alignof(uint32_t));
buffer.writeToMemory(dest);
}
fTypefacesToSend.clear();
serializer.emplace<uint64_t>(SkTo<uint64_t>(strikesToSend));
fRemoteStrikesToSend.foreach (
[&](RemoteStrike* strike) {
if (strike->hasPendingGlyphs()) {
strike->writePendingGlyphs(&serializer);
strike->resetScalerContext();
}
#ifdef SK_DEBUG
auto it = fDescToRemoteStrike.find(&strike->getDescriptor());
SkASSERT(it != fDescToRemoteStrike.end());
SkASSERT(it->second.get() == strike);
#endif
#if defined(SK_TRACE_GLYPH_RUN_PROCESS)
msg.append(strike->getDescriptor().dumpRec());
#endif
}
);
fRemoteStrikesToSend.reset();
#if defined(SK_TRACE_GLYPH_RUN_PROCESS)
msg.appendf("End send strike differences");
SkDebugf("%s\n", msg.c_str());
#endif
}
#else
void SkStrikeServerImpl::writeStrikeData(std::vector<uint8_t>* memory) {
SkBinaryWriteBuffer buffer{nullptr, 0};
// Gather statistics about what needs to be sent.
size_t strikesToSend = 0;
fRemoteStrikesToSend.foreach([&](RemoteStrike* strike) {
if (strike->hasPendingGlyphs()) {
strikesToSend++;
} else {
// This strike has nothing to send, so drop its scaler context to reduce memory.
strike->resetScalerContext();
}
});
// If there are no strikes or typefaces to send, then cleanup and return.
if (strikesToSend == 0 && fTypefacesToSend.empty()) {
fRemoteStrikesToSend.reset();
return;
}
// Send newly seen typefaces.
SkASSERT_RELEASE(SkTFitsIn<int>(fTypefacesToSend.size()));
buffer.writeInt(fTypefacesToSend.size());
for (const auto& typeface: fTypefacesToSend) {
SkTypefaceProxyPrototype proto{typeface};
proto.flatten(buffer);
}
fTypefacesToSend.clear();
buffer.writeInt(strikesToSend);
fRemoteStrikesToSend.foreach(
[&](RemoteStrike* strike) {
if (strike->hasPendingGlyphs()) {
strike->writePendingGlyphs(buffer);
strike->resetScalerContext();
}
}
);
fRemoteStrikesToSend.reset();
// Copy data into the vector.
auto data = buffer.snapshotAsData();
memory->assign(data->bytes(), data->bytes() + data->size());
}
#endif // defined(SK_SUPPORT_LEGACY_STRIKE_SERIALIZATION)
sk_sp<StrikeForGPU> SkStrikeServerImpl::findOrCreateScopedStrike(
const SkStrikeSpec& strikeSpec) {
return this->getOrCreateCache(strikeSpec);
}
void SkStrikeServerImpl::checkForDeletedEntries() {
auto it = fDescToRemoteStrike.begin();
while (fDescToRemoteStrike.size() > fMaxEntriesInDescriptorMap &&
it != fDescToRemoteStrike.end()) {
RemoteStrike* strike = it->second.get();
if (fDiscardableHandleManager->isHandleDeleted(strike->discardableHandleId())) {
// If we are trying to send the strike, then do not erase it.
if (!fRemoteStrikesToSend.contains(strike)) {
// Erase returns the iterator following the removed element.
it = fDescToRemoteStrike.erase(it);
continue;
}
}
++it;
}
}
sk_sp<RemoteStrike> SkStrikeServerImpl::getOrCreateCache(const SkStrikeSpec& strikeSpec) {
// In cases where tracing is turned off, make sure not to get an unused function warning.
// Lambdaize the function.
TRACE_EVENT1("skia", "RecForDesc", "rec",
TRACE_STR_COPY(
[&strikeSpec](){
auto ptr =
strikeSpec.descriptor().findEntry(kRec_SkDescriptorTag, nullptr);
SkScalerContextRec rec;
std::memcpy((void*)&rec, ptr, sizeof(rec));
return rec.dump();
}().c_str()
)
);
if (auto it = fDescToRemoteStrike.find(&strikeSpec.descriptor());
it != fDescToRemoteStrike.end())
{
// We have processed the RemoteStrike before. Reuse it.
sk_sp<RemoteStrike> strike = it->second;
strike->setStrikeSpec(strikeSpec);
if (fRemoteStrikesToSend.contains(strike.get())) {
// Already tracking
return strike;
}
// Strike is in unknown state on GPU. Start tracking strike on GPU by locking it.
bool locked = fDiscardableHandleManager->lockHandle(it->second->discardableHandleId());
if (locked) {
fRemoteStrikesToSend.add(strike.get());
return strike;
}
// If it wasn't locked, then forget this strike, and build it anew below.
fDescToRemoteStrike.erase(it);
}
const SkTypeface& typeface = strikeSpec.typeface();
// Create a new RemoteStrike. Start by processing the typeface.
const SkTypefaceID typefaceId = typeface.uniqueID();
if (!fCachedTypefaces.contains(typefaceId)) {
fCachedTypefaces.add(typefaceId);
fTypefacesToSend.emplace_back(typeface);
}
auto context = strikeSpec.createScalerContext();
auto newHandle = fDiscardableHandleManager->createHandle(); // Locked on creation
auto remoteStrike = sk_make_sp<RemoteStrike>(strikeSpec, std::move(context), newHandle);
remoteStrike->setStrikeSpec(strikeSpec);
fRemoteStrikesToSend.add(remoteStrike.get());
auto d = &remoteStrike->getDescriptor();
fDescToRemoteStrike[d] = remoteStrike;
checkForDeletedEntries();
return remoteStrike;
}
// -- GlyphTrackingDevice --------------------------------------------------------------------------
#if defined(SK_GANESH)
class GlyphTrackingDevice final : public SkNoPixelsDevice {
public:
GlyphTrackingDevice(
const SkISize& dimensions, const SkSurfaceProps& props, SkStrikeServerImpl* server,
sk_sp<SkColorSpace> colorSpace, sktext::gpu::SDFTControl SDFTControl)
: SkNoPixelsDevice(SkIRect::MakeSize(dimensions), props, std::move(colorSpace))
, fStrikeServerImpl(server)
, fSDFTControl(SDFTControl) {
SkASSERT(fStrikeServerImpl != nullptr);
}
SkBaseDevice* onCreateDevice(const CreateInfo& cinfo, const SkPaint*) override {
const SkSurfaceProps surfaceProps(this->surfaceProps().flags(), cinfo.fPixelGeometry);
return new GlyphTrackingDevice(cinfo.fInfo.dimensions(), surfaceProps, fStrikeServerImpl,
cinfo.fInfo.refColorSpace(), fSDFTControl);
}
SkStrikeDeviceInfo strikeDeviceInfo() const override {
return {this->surfaceProps(), this->scalerContextFlags(), &fSDFTControl};
}
protected:
void onDrawGlyphRunList(SkCanvas*,
const sktext::GlyphRunList& glyphRunList,
const SkPaint& initialPaint,
const SkPaint& drawingPaint) override {
SkMatrix drawMatrix = this->localToDevice();
drawMatrix.preTranslate(glyphRunList.origin().x(), glyphRunList.origin().y());
// Just ignore the resulting SubRunContainer. Since we're passing in a null SubRunAllocator
// no SubRuns will be produced.
STSubRunAllocator<sizeof(SubRunContainer), alignof(SubRunContainer)> tempAlloc;
auto container = SubRunContainer::MakeInAlloc(glyphRunList,
drawMatrix,
drawingPaint,
this->strikeDeviceInfo(),
fStrikeServerImpl,
&tempAlloc,
SubRunContainer::kStrikeCalculationsOnly,
"Cache Diff");
// Calculations only. No SubRuns.
SkASSERT(container->isEmpty());
}
sk_sp<sktext::gpu::Slug> convertGlyphRunListToSlug(const sktext::GlyphRunList& glyphRunList,
const SkPaint& initialPaint,
const SkPaint& drawingPaint) override {
// Full matrix for placing glyphs.
SkMatrix positionMatrix = this->localToDevice();
positionMatrix.preTranslate(glyphRunList.origin().x(), glyphRunList.origin().y());
// Use the SkStrikeServer's strike cache to generate the Slug.
return sktext::gpu::MakeSlug(this->localToDevice(),
glyphRunList,
initialPaint,
drawingPaint,
this->strikeDeviceInfo(),
fStrikeServerImpl);
}
private:
SkStrikeServerImpl* const fStrikeServerImpl;
const sktext::gpu::SDFTControl fSDFTControl;
};
#endif // defined(SK_GANESH)
// -- SkStrikeServer -------------------------------------------------------------------------------
SkStrikeServer::SkStrikeServer(DiscardableHandleManager* dhm)
: fImpl(new SkStrikeServerImpl{dhm}) { }
SkStrikeServer::~SkStrikeServer() = default;
std::unique_ptr<SkCanvas> SkStrikeServer::makeAnalysisCanvas(int width, int height,
const SkSurfaceProps& props,
sk_sp<SkColorSpace> colorSpace,
bool DFTSupport,
bool DFTPerspSupport) {
#if defined(SK_GANESH)
GrContextOptions ctxOptions;
#if !defined(SK_DISABLE_SDF_TEXT)
auto control = sktext::gpu::SDFTControl{DFTSupport,
props.isUseDeviceIndependentFonts(),
DFTPerspSupport,
ctxOptions.fMinDistanceFieldFontSize,
ctxOptions.fGlyphsAsPathsFontSize};
#else
auto control = sktext::gpu::SDFTControl{};
#endif
sk_sp<SkBaseDevice> trackingDevice(new GlyphTrackingDevice(
SkISize::Make(width, height),
props, this->impl(),
std::move(colorSpace),
control));
#else
sk_sp<SkBaseDevice> trackingDevice(new SkNoPixelsDevice(
SkIRect::MakeWH(width, height), props, std::move(colorSpace)));
#endif
return std::make_unique<SkCanvas>(std::move(trackingDevice));
}
void SkStrikeServer::writeStrikeData(std::vector<uint8_t>* memory) {
fImpl->writeStrikeData(memory);
}
SkStrikeServerImpl* SkStrikeServer::impl() { return fImpl.get(); }
void SkStrikeServer::setMaxEntriesInDescriptorMapForTesting(size_t count) {
fImpl->setMaxEntriesInDescriptorMapForTesting(count);
}
size_t SkStrikeServer::remoteStrikeMapSizeForTesting() const {
return fImpl->remoteStrikeMapSizeForTesting();
}
// -- DiscardableStrikePinner ----------------------------------------------------------------------
class DiscardableStrikePinner : public SkStrikePinner {
public:
DiscardableStrikePinner(SkDiscardableHandleId discardableHandleId,
sk_sp<SkStrikeClient::DiscardableHandleManager> manager)
: fDiscardableHandleId(discardableHandleId), fManager(std::move(manager)) {}
~DiscardableStrikePinner() override = default;
bool canDelete() override { return fManager->deleteHandle(fDiscardableHandleId); }
void assertValid() override { fManager->assertHandleValid(fDiscardableHandleId); }
private:
const SkDiscardableHandleId fDiscardableHandleId;
sk_sp<SkStrikeClient::DiscardableHandleManager> fManager;
};
// -- SkStrikeClientImpl ---------------------------------------------------------------------------
class SkStrikeClientImpl {
public:
explicit SkStrikeClientImpl(sk_sp<SkStrikeClient::DiscardableHandleManager>,
bool isLogging = true,
SkStrikeCache* strikeCache = nullptr);
bool readStrikeData(const volatile void* memory, size_t memorySize);
bool translateTypefaceID(SkAutoDescriptor* descriptor) const;
sk_sp<SkTypeface> retrieveTypefaceUsingServerID(SkTypefaceID) const;
private:
class PictureBackedGlyphDrawable final : public SkDrawable {
public:
PictureBackedGlyphDrawable(sk_sp<SkPicture> self) : fSelf(std::move(self)) {}
private:
sk_sp<SkPicture> fSelf;
SkRect onGetBounds() override { return fSelf->cullRect(); }
size_t onApproximateBytesUsed() override {
return sizeof(PictureBackedGlyphDrawable) + fSelf->approximateBytesUsed();
}
void onDraw(SkCanvas* canvas) override { canvas->drawPicture(fSelf); }
};
#if defined(SK_SUPPORT_LEGACY_STRIKE_SERIALIZATION)
static bool ReadGlyph(SkTLazy<SkGlyph>& glyph, Deserializer* deserializer);
#endif
sk_sp<SkTypeface> addTypeface(const SkTypefaceProxyPrototype& typefaceProto);
THashMap<SkTypefaceID, sk_sp<SkTypeface>> fServerTypefaceIdToTypeface;
sk_sp<SkStrikeClient::DiscardableHandleManager> fDiscardableHandleManager;
SkStrikeCache* const fStrikeCache;
const bool fIsLogging;
};
SkStrikeClientImpl::SkStrikeClientImpl(
sk_sp<SkStrikeClient::DiscardableHandleManager>
discardableManager,
bool isLogging,
SkStrikeCache* strikeCache)
: fDiscardableHandleManager(std::move(discardableManager)),
fStrikeCache{strikeCache ? strikeCache : SkStrikeCache::GlobalStrikeCache()},
fIsLogging{isLogging} {}
#if defined(SK_SUPPORT_LEGACY_STRIKE_SERIALIZATION)
// No need to write fScalerContextBits because any needed image is already generated.
bool SkStrikeClientImpl::ReadGlyph(SkTLazy<SkGlyph>& glyph, Deserializer* deserializer) {
SkPackedGlyphID glyphID;
if (!deserializer->read<SkPackedGlyphID>(&glyphID)) return false;
glyph.init(glyphID);
if (!deserializer->read<float>(&glyph->fAdvanceX)) return false;
if (!deserializer->read<float>(&glyph->fAdvanceY)) return false;
if (!deserializer->read<uint16_t>(&glyph->fWidth)) return false;
if (!deserializer->read<uint16_t>(&glyph->fHeight)) return false;
if (!deserializer->read<int16_t>(&glyph->fTop)) return false;
if (!deserializer->read<int16_t>(&glyph->fLeft)) return false;
uint8_t maskFormat;
if (!deserializer->read<uint8_t>(&maskFormat)) return false;
if (!SkMask::IsValidFormat(maskFormat)) return false;
glyph->fMaskFormat = static_cast<SkMask::Format>(maskFormat);
SkDEBUGCODE(glyph->fAdvancesBoundsFormatAndInitialPathDone = true;)
return true;
}
#endif
// Change the path count to track the line number of the failing read.
// TODO: change __LINE__ back to glyphPathsCount when bug chromium:1287356 is closed.
#define READ_FAILURE \
{ \
SkDebugf("Bad font data serialization line: %d", __LINE__); \
SkStrikeClient::DiscardableHandleManager::ReadFailureData data = { \
memorySize, deserializer.bytesRead(), typefaceSize, \
strikeCount, glyphImagesCount, __LINE__}; \
fDiscardableHandleManager->notifyReadFailure(data); \
return false; \
}
#if defined(SK_SUPPORT_LEGACY_STRIKE_SERIALIZATION)
bool SkStrikeClientImpl::readStrikeData(const volatile void* memory, size_t memorySize) {
SkASSERT(memorySize != 0u);
Deserializer deserializer(static_cast<const volatile char*>(memory), memorySize);
uint64_t typefaceSize = 0;
uint64_t strikeCount = 0;
uint64_t glyphImagesCount = 0;
uint64_t glyphPathsCount = 0;
uint64_t glyphDrawablesCount = 0;
if (!deserializer.read<uint64_t>(&typefaceSize)) READ_FAILURE
for (size_t i = 0; i < typefaceSize; ++i) {
uint32_t typefaceSizeBytes;
// Read the size of the buffer generated at flatten time.
if (!deserializer.read<uint32_t>(&typefaceSizeBytes)) READ_FAILURE
// Temporary: use inside knowledge of SkReadBuffer to set the alignment.
// This should agree with the alignment used in writeStrikeData.
auto* bytes = deserializer.read(typefaceSizeBytes, alignof(uint32_t));
if (bytes == nullptr) READ_FAILURE
SkReadBuffer buffer(const_cast<const void*>(bytes), typefaceSizeBytes);
auto typefaceProto = SkTypefaceProxyPrototype::MakeFromBuffer(buffer);
if (!typefaceProto) READ_FAILURE
this->addTypeface(typefaceProto.value());
}
#if defined(SK_TRACE_GLYPH_RUN_PROCESS)
SkString msg;
msg.appendf("\nBegin receive strike differences\n");
#endif
if (!deserializer.read<uint64_t>(&strikeCount)) READ_FAILURE
for (size_t i = 0; i < strikeCount; ++i) {
StrikeSpec spec;
if (!deserializer.read<StrikeSpec>(&spec)) READ_FAILURE
SkAutoDescriptor ad;
if (!deserializer.readDescriptor(&ad)) READ_FAILURE
#if defined(SK_TRACE_GLYPH_RUN_PROCESS)
msg.appendf(" Received descriptor:\n%s", ad.getDesc()->dumpRec().c_str());
#endif
bool fontMetricsInitialized;
if (!deserializer.read(&fontMetricsInitialized)) READ_FAILURE
SkFontMetrics fontMetrics{};
if (!fontMetricsInitialized) {
if (!deserializer.read<SkFontMetrics>(&fontMetrics)) READ_FAILURE
}
// Preflight the TypefaceID before doing the Descriptor translation.
auto* tfPtr = fServerTypefaceIdToTypeface.find(spec.fTypefaceID);
// Received a TypefaceID for a typeface we don't know about.
if (!tfPtr) READ_FAILURE
// Replace the ContextRec in the desc from the server to create the client
// side descriptor.
if (!this->translateTypefaceID(&ad)) READ_FAILURE
SkDescriptor* clientDesc = ad.getDesc();
#if defined(SK_TRACE_GLYPH_RUN_PROCESS)
msg.appendf(" Mapped descriptor:\n%s", clientDesc->dumpRec().c_str());
#endif
auto strike = fStrikeCache->findStrike(*clientDesc);
// Make sure strike is pinned
if (strike) {
strike->verifyPinnedStrike();
}
// Metrics are only sent the first time. If the metrics are not initialized, there must
// be an existing strike.
if (fontMetricsInitialized && strike == nullptr) READ_FAILURE
if (strike == nullptr) {
// Note that we don't need to deserialize the effects since we won't be generating any
// glyphs here anyway, and the desc is still correct since it includes the serialized
// effects.
SkStrikeSpec strikeSpec{*clientDesc, *tfPtr};
strike = fStrikeCache->createStrike(
strikeSpec, &fontMetrics,
std::make_unique<DiscardableStrikePinner>(
spec.fDiscardableHandleId, fDiscardableHandleManager));
}
if (!deserializer.read<uint64_t>(&glyphImagesCount)) READ_FAILURE
for (size_t j = 0; j < glyphImagesCount; j++) {
SkTLazy<SkGlyph> glyph;
if (!ReadGlyph(glyph, &deserializer)) READ_FAILURE
if (!glyph->isEmpty() && SkGlyphDigest::FitsInAtlas(*glyph)) {
const volatile void* image =
deserializer.read(glyph->imageSize(), glyph->formatAlignment());
if (!image) READ_FAILURE
glyph->fImage = (void*)image;
}
strike->mergeGlyphAndImage(glyph->getPackedID(), *glyph);
}
if (!deserializer.read<uint64_t>(&glyphPathsCount)) READ_FAILURE
for (size_t j = 0; j < glyphPathsCount; j++) {
SkTLazy<SkGlyph> glyph;
if (!ReadGlyph(glyph, &deserializer)) READ_FAILURE
SkGlyph* allocatedGlyph = strike->mergeGlyphAndImage(glyph->getPackedID(), *glyph);
SkPath* pathPtr = nullptr;
SkPath path;
uint64_t pathSize = 0u;
bool hairline = false;
if (!deserializer.read<uint64_t>(&pathSize)) READ_FAILURE
if (pathSize > 0) {
auto* pathData = deserializer.read(pathSize, kPathAlignment);
if (!pathData) READ_FAILURE
if (!path.readFromMemory(const_cast<const void*>(pathData), pathSize)) READ_FAILURE
pathPtr = &path;
if (!deserializer.read<bool>(&hairline)) READ_FAILURE
}
strike->mergePath(allocatedGlyph, pathPtr, hairline);
}
if (!deserializer.read<uint64_t>(&glyphDrawablesCount)) READ_FAILURE
for (size_t j = 0; j < glyphDrawablesCount; j++) {
SkTLazy<SkGlyph> glyph;
if (!ReadGlyph(glyph, &deserializer)) READ_FAILURE
SkGlyph* allocatedGlyph = strike->mergeGlyphAndImage(glyph->getPackedID(), *glyph);
sk_sp<SkDrawable> drawable;
uint64_t drawableSize = 0u;
if (!deserializer.read<uint64_t>(&drawableSize)) READ_FAILURE
if (drawableSize > 0) {
auto* drawableData = deserializer.read(drawableSize, kDrawableAlignment);
if (!drawableData) READ_FAILURE
sk_sp<SkPicture> picture(SkPicture::MakeFromData(
const_cast<const void*>(drawableData), drawableSize));
if (!picture) READ_FAILURE
drawable = sk_make_sp<PictureBackedGlyphDrawable>(std::move(picture));
}
strike->mergeDrawable(allocatedGlyph, std::move(drawable));
}
}
#if defined(SK_TRACE_GLYPH_RUN_PROCESS)
msg.appendf("End receive strike differences");
SkDebugf("%s\n", msg.c_str());
#endif
return true;
}
#else
bool SkStrikeClientImpl::readStrikeData(const volatile void* memory, size_t memorySize) {
SkASSERT(memorySize != 0);
SkASSERT(memory != nullptr);
SkReadBuffer buffer{const_cast<const void*>(memory), memorySize};
// Limit the kinds of effects that appear in a glyph's drawable (crbug.com/1442140):
buffer.setAllowSkSL(false);
int curTypeface = 0,
curStrike = 0;
auto postError = [&](int line) {
SkDebugf("Read Error Posted %s : %d", __FILE__, line);
SkStrikeClient::DiscardableHandleManager::ReadFailureData data{
memorySize,
buffer.offset(),
SkTo<uint64_t>(curTypeface),
SkTo<uint64_t>(curStrike),
SkTo<uint64_t>(0),
SkTo<uint64_t>(0)};
fDiscardableHandleManager->notifyReadFailure(data);
};
// Read the number of typefaces sent.
const int typefaceCount = buffer.readInt();
for (curTypeface = 0; curTypeface < typefaceCount; ++curTypeface) {
auto proto = SkTypefaceProxyPrototype::MakeFromBuffer(buffer);
if (proto) {
this->addTypeface(proto.value());
} else {
postError(__LINE__);
return false;
}
}
// Read the number of strikes sent.
const int stirkeCount = buffer.readInt();
for (curStrike = 0; curStrike < stirkeCount; ++curStrike) {
const SkTypefaceID serverTypefaceID = buffer.readUInt();
if (serverTypefaceID == 0 && !buffer.isValid()) {
postError(__LINE__);
return false;
}
const SkDiscardableHandleId discardableHandleID = buffer.readUInt();
if (discardableHandleID == 0 && !buffer.isValid()) {
postError(__LINE__);
return false;
}
std::optional<SkAutoDescriptor> serverDescriptor = SkAutoDescriptor::MakeFromBuffer(buffer);
if (!buffer.validate(serverDescriptor.has_value())) {
postError(__LINE__);
return false;
}
const bool fontMetricsInitialized = buffer.readBool();
if (!fontMetricsInitialized && !buffer.isValid()) {
postError(__LINE__);
return false;
}
std::optional<SkFontMetrics> fontMetrics;
if (!fontMetricsInitialized) {
fontMetrics = SkFontMetricsPriv::MakeFromBuffer(buffer);
if (!fontMetrics || !buffer.isValid()) {
postError(__LINE__);
return false;
}
}
auto* clientTypeface = fServerTypefaceIdToTypeface.find(serverTypefaceID);
if (clientTypeface == nullptr) {
postError(__LINE__);
return false;
}
if (!this->translateTypefaceID(&serverDescriptor.value())) {
postError(__LINE__);
return false;
}
SkDescriptor* clientDescriptor = serverDescriptor->getDesc();
auto strike = fStrikeCache->findStrike(*clientDescriptor);
if (strike == nullptr) {
// Metrics are only sent the first time. If creating a new strike, then the metrics
// are not initialized.
if (fontMetricsInitialized) {
postError(__LINE__);
return false;
}
SkStrikeSpec strikeSpec{*clientDescriptor, *clientTypeface};
strike = fStrikeCache->createStrike(
strikeSpec, &fontMetrics.value(),
std::make_unique<DiscardableStrikePinner>(
discardableHandleID, fDiscardableHandleManager));
}
// Make sure this strike is pinned on the GPU side.
strike->verifyPinnedStrike();
if (!strike->mergeFromBuffer(buffer)) {
postError(__LINE__);
return false;
}
}
return true;
}
#endif // defined(SK_SUPPORT_LEGACY_STRIKE_SERIALIZATION)
bool SkStrikeClientImpl::translateTypefaceID(SkAutoDescriptor* toChange) const {
SkDescriptor& descriptor = *toChange->getDesc();
// Rewrite the typefaceID in the rec.
{
uint32_t size;
// findEntry returns a const void*, remove the const in order to update in place.
void* ptr = const_cast<void *>(descriptor.findEntry(kRec_SkDescriptorTag, &size));
SkScalerContextRec rec;
std::memcpy((void*)&rec, ptr, size);
// Get the local typeface from remote typefaceID.
auto* tfPtr = fServerTypefaceIdToTypeface.find(rec.fTypefaceID);
// Received a strike for a typeface which doesn't exist.
if (!tfPtr) { return false; }
// Update the typeface id to work with the client side.
rec.fTypefaceID = tfPtr->get()->uniqueID();
std::memcpy(ptr, &rec, size);
}
descriptor.computeChecksum();
return true;
}
sk_sp<SkTypeface> SkStrikeClientImpl::retrieveTypefaceUsingServerID(SkTypefaceID typefaceID) const {
auto* tfPtr = fServerTypefaceIdToTypeface.find(typefaceID);
return tfPtr != nullptr ? *tfPtr : nullptr;
}
sk_sp<SkTypeface> SkStrikeClientImpl::addTypeface(const SkTypefaceProxyPrototype& typefaceProto) {
sk_sp<SkTypeface>* typeface =
fServerTypefaceIdToTypeface.find(typefaceProto.serverTypefaceID());
// We already have the typeface.
if (typeface != nullptr) {
return *typeface;
}
auto newTypeface = sk_make_sp<SkTypefaceProxy>(
typefaceProto, fDiscardableHandleManager, fIsLogging);
fServerTypefaceIdToTypeface.set(typefaceProto.serverTypefaceID(), newTypeface);
return std::move(newTypeface);
}
// SkStrikeClient ----------------------------------------------------------------------------------
SkStrikeClient::SkStrikeClient(sk_sp<DiscardableHandleManager> discardableManager,
bool isLogging,
SkStrikeCache* strikeCache)
: fImpl{new SkStrikeClientImpl{std::move(discardableManager), isLogging, strikeCache}} {}
SkStrikeClient::~SkStrikeClient() = default;
bool SkStrikeClient::readStrikeData(const volatile void* memory, size_t memorySize) {
return fImpl->readStrikeData(memory, memorySize);
}
sk_sp<SkTypeface> SkStrikeClient::retrieveTypefaceUsingServerIDForTest(
SkTypefaceID typefaceID) const {
return fImpl->retrieveTypefaceUsingServerID(typefaceID);
}
bool SkStrikeClient::translateTypefaceID(SkAutoDescriptor* descriptor) const {
return fImpl->translateTypefaceID(descriptor);
}
#if defined(SK_GANESH)
sk_sp<sktext::gpu::Slug> SkStrikeClient::deserializeSlugForTest(const void* data, size_t size) const {
return sktext::gpu::Slug::Deserialize(data, size, this);
}
#endif // defined(SK_GANESH)
|
0a63529f61e15206e1b56ff20d2e9b6222020963
|
bd9fb8b7cab112ea7caca4e8c5fa2a5833020d30
|
/ESP8266example/Thermostat/Thermostat.ino
|
67b573de471a402164c1675134d7d5e88d459a55
|
[
"MIT"
] |
permissive
|
kikeelectronico/Homeware-LAN
|
fc053c690eafac06e12b683023cfd2b393f887c8
|
4a8ea10ed7e911257d3ea86d46809623f3c3b525
|
refs/heads/master
| 2023-08-22T18:24:11.801573
| 2023-08-04T17:36:03
| 2023-08-04T17:36:03
| 233,239,354
| 53
| 28
|
MIT
| 2023-09-14T04:38:31
| 2020-01-11T13:51:27
|
JavaScript
|
UTF-8
|
C++
| false
| false
| 4,587
|
ino
|
Thermostat.ino
|
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include <ArduinoJson.h>
#include <EEPROM.h>
#include <Wire.h>
#include <Adafruit_BMP280.h>
#include <SPI.h>
// This example receibes shows via serial port both the mode and the temperature setpoint of the
// a thermostat. It alse send the real temperature reading the value froma BMP280 temperature sensor.
/* Remember to cahnge
* #define MQTT_MAX_PACKET_SIZE 128
* for
* #define MQTT_MAX_PACKET_SIZE 256
* in the PubSubClient library.
*/
//Instructins
//Change <thermostat-id> for the id of your thermostat in the line 125
//Change <thermostat-id> for the id of your thermostat in the line 44
//Change network setting:
const char* ssid = "your-wifi-ssid";
const char* password = "your-wifi-password";
const char* mqtt_server = "raspberry-pi-IP";
const char* mqtt_user = "your-mqtt-user";
const char* mqtt_user = "your-mqtt-password";
//Objects
WiFiClient espClient;
PubSubClient client(espClient);
Adafruit_BMP280 bmp;
//General
long lastMsg = 0;
char msg[50];
int value = 0;
char json_c[200];
char deviceMode[30];
int temperatureSetPoint = 0;
int thermostatTemperatureAmbient = 0;
bool sendSetPoint = false;
bool showSetPoint = false;
long int tempUpdateTimeStamp = 0;
char requestA[100] = "{\"id\":\"<thermostat-id>\",\"param\":\"thermostatTemperatureAmbient\",\"value\":";
char requestB[50] = ",\"intent\":\"rules\"}";
char request[300];
void setup_wifi() {
// We start by connecting to a WiFi network
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(1000);
}
randomSeed(micros());
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
delay(2000);
//Connect to sensor
Wire.begin(D1,D2);
if (!bmp.begin()) {
Serial.println(F("Could not find the sensor, check wiring or I2C address"));
} else {
Serial.println(F("Sensor Ok"));
}
}
void callback(char* topic, byte* payload, unsigned int length) {
Serial.print("Message arrived [");
Serial.print(topic);
Serial.print("] ");
for (int i = 0; i < length; i++) {
Serial.print((char)payload[i]);
json_c[i] = payload[i];
}
Serial.println();
Serial.println(json_c);
StaticJsonDocument<200> doc;
DeserializationError error = deserializeJson(doc, json_c);
if (error) {
Serial.print(F("deserializeJson() failed: "));
Serial.println(error.c_str());
} else {
//You can use the different values of a thermostat
//Example of a string value
strcpy(deviceMode, doc[F("thermostatMode")]);
//Example of a int value
temperatureSetPoint = doc[F("thermostatTemperatureSetpoint")];
Serial.print(deviceMode);
Serial.print(" - ");
Serial.println(temperatureSetPoint);
}
}
void reconnect() {
// Loop until we're reconnected
while (!client.connected()) {
Serial.print("Attempting MQTT connection...");
// Create a random client ID
String clientId = "ESP8266Client-";
clientId += String(random(0xffff), HEX);
// Attempt to connect
if (client.connect(clientId.c_str(), mqtt_user, mqtt_password)) {
delay(2000);
Serial.println("connected");
// Once connected, publish an announcement...
client.publish("hello", "hello world");
// ... and resubscribe
client.subscribe("device/<thermostat-id>");
} else {
Serial.print("failed, rc=");
Serial.print(client.state());
Serial.println(" try again in 5 seconds");
// Wait 5 seconds before retrying
delay(5000);
}
}
}
void setup() {
Serial.begin(115200);
setup_wifi();
client.setServer(mqtt_server, 1883);
client.setCallback(callback);
}
void loop() {
if (!client.connected()) {
reconnect();
}
client.loop();
//Send temperature to Homeware
char thermostatTemperatureAmbientBuf[2];
//Read the rempetarure from the sensor
int i=bmp.readTemperature()-1;
//If the ambient temperature has change
if(thermostatTemperatureAmbient != i){
//Convert the int variable from the sensor into a string variable.
sprintf(thermostatTemperatureAmbientBuf, "%d", i);
//Prepare the MQTT request with the temperature value.
strcpy(request, requestA);
strcat(request, thermostatTemperatureAmbientBuf);
strcat(request, requestB);
//Sernd the request
client.publish("device/control", request);
Serial.println(request);
thermostatTemperatureAmbient = i;
}
delay(1000);
}
|
725a8286de2db1f5f40f350b525a6e029f106065
|
840faa97d44492f7435ba042e2c1312de99f4ea3
|
/src/kudu/clock/system_unsync_time.h
|
5179b3f3af9e61ff37826d14b91bc7ecd5be0176
|
[
"OpenSSL",
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-openssl",
"LicenseRef-scancode-ssleay-windows",
"LicenseRef-scancode-google-patent-license-webrtc",
"LicenseRef-scancode-unknown-license-reference",
"dtoa",
"MIT",
"BSL-1.0",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown"
] |
permissive
|
apache/kudu
|
c05fad4ea1cf48a650e99b2fb6917f19a790bd3d
|
ecb51af801bd1bf40d0216b0697bf7e5765461d5
|
refs/heads/master
| 2023-08-31T23:18:23.205496
| 2023-08-28T21:54:50
| 2023-08-29T19:16:49
| 50,647,838
| 1,757
| 698
|
Apache-2.0
| 2023-08-17T13:36:43
| 2016-01-29T08:00:06
|
C++
|
UTF-8
|
C++
| false
| false
| 1,596
|
h
|
system_unsync_time.h
|
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
#pragma once
#include <cstdint>
#include "kudu/clock/time_service.h"
#include "kudu/gutil/macros.h"
#include "kudu/util/status.h"
namespace kudu {
namespace clock {
// TimeService implementation which uses the system clock without requiring
// that NTP is running or synchronized.
//
// This is useful on OSX which doesn't support the required adjtimex() syscall
// to query the NTP synchronization status.
class SystemUnsyncTime : public TimeService {
public:
SystemUnsyncTime() = default;
Status Init() override;
Status WalltimeWithError(uint64_t* now_usec, uint64_t* error_usec) override;
int64_t skew_ppm() const override {
return 500; // Reasonable default value.
}
private:
DISALLOW_COPY_AND_ASSIGN(SystemUnsyncTime);
};
} // namespace clock
} // namespace kudu
|
6b254940a4c869aabfd0d5125f370c96d89655ff
|
3ce84c6401e12cf955a04e3692ce98dc15fa55da
|
/core/camerafixture/wildcardablePointerPair.h
|
f4934a2ec83ab0e4248ea583872a267fed907251
|
[] |
no_license
|
PimenovAlexander/corecvs
|
b3470cac2c1853d3237daafc46769c15223020c9
|
67a92793aa819e6931f0c46e8e9167cf6f322244
|
refs/heads/master_cmake
| 2021-10-09T10:12:37.980459
| 2021-09-28T23:19:31
| 2021-09-28T23:19:31
| 13,349,418
| 15
| 68
| null | 2021-08-24T18:38:04
| 2013-10-05T17:35:48
|
C++
|
UTF-8
|
C++
| false
| false
| 1,631
|
h
|
wildcardablePointerPair.h
|
#ifndef WILDCARDABLEPOINTERPAIR_H
#define WILDCARDABLEPOINTERPAIR_H
#include <unordered_map>
namespace corecvs {
template<typename U, typename V>
class WildcardablePointerPair
{
public:
#if !defined(WIN32) || (_MSC_VER >= 1900) // Sometime in future (when we switch to VS2015 due to https://msdn.microsoft.com/library/hh567368.apx ) we will get constexpr on windows
static constexpr U* UWILDCARD = nullptr;
static constexpr V* VWILDCARD = nullptr;
#else
static U* const UWILDCARD;
static V* const VWILDCARD;
#endif
typedef U* UTYPE;
typedef V* VTYPE;
WildcardablePointerPair(U* u = UWILDCARD, V* v = VWILDCARD) : u(u), v(v)
{
}
bool isWildcard() const
{
return u == UWILDCARD || v == VWILDCARD;
}
// Yes, this is NOT transitive (and you should use wildcarded wpps only for indexing not for insertion)
bool operator== (const WildcardablePointerPair<U, V> &wpp) const
{
return (u == UWILDCARD || wpp.u == UWILDCARD || u == wpp.u) &&
(v == VWILDCARD || wpp.v == VWILDCARD || v == wpp.v);
}
// This operator IS transitive
bool operator< (const WildcardablePointerPair<U, V> &wpp) const
{
return u == wpp.u ? v < wpp.v : u < wpp.u;
}
U* u;
V* v;
};
} //namespace corecvs
namespace std {
template<typename U, typename V>
struct hash<corecvs::WildcardablePointerPair<U, V>>
{
size_t operator() (const corecvs::WildcardablePointerPair<U, V> &wpp) const
{
return std::hash<U*>()(wpp.u) ^ (31 * std::hash<V*>()(wpp.v));
}
};
} // namespace std
#endif // WILDCARDABLEPOINTERPAIR_H
|
4c8aed6318729bec775ad8754a100543db73a111
|
7cd9751c057fcb36b91f67e515aaab0a3e74a709
|
/testing/variable_storage/ConstantIntensityIC.cc
|
c98a4833ce55e43003bd50d135a538fb4c0c4bd3
|
[
"MIT"
] |
permissive
|
pgmaginot/DARK_ARTS
|
5ce49db05f711835e47780677f0bf02c09e0f655
|
f04b0a30dcac911ef06fe0916921020826f5c42b
|
refs/heads/master
| 2016-09-06T18:30:25.652859
| 2015-06-12T19:00:40
| 2015-06-12T19:00:40
| 20,808,459
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,758
|
cc
|
ConstantIntensityIC.cc
|
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include "Input_Reader.h"
#include "Cell_Data.h"
#include "Intensity_Data.h"
#include "Angular_Quadrature.h"
#include "Materials.h"
#include "Fem_Quadrature.h"
#include "Quadrule_New.h"
#include "Dark_Arts_Exception.h"
int main(int argc, char** argv)
{
int val = 0;
const double tol = 1.0E-6;
/// expected spacing we should be able to see
std::vector<int> expected_n_cells(2,0);
expected_n_cells[0] = 5;
expected_n_cells[1] = 3;
const double sn_w = 2.;
const double I_0 = pow(0.4, 4 )/sn_w;
const double I_1 = pow(0.98,4 )/sn_w;
Input_Reader input_reader;
try{
input_reader.read_xml(argv[1]);
}
catch( const Dark_Arts_Exception& da_exception )
{
da_exception.testing_message();
val = -1;
}
Cell_Data cell_data( input_reader );
Quadrule_New quad_fun;
Fem_Quadrature fem_quadrature( input_reader , quad_fun);
Angular_Quadrature angular_quadrature( input_reader , quad_fun );
Materials materials( input_reader, fem_quadrature , cell_data, angular_quadrature);
const int n_p = fem_quadrature.get_number_of_interpolation_points();
Eigen::VectorXd local_i_vec;
Eigen::VectorXd local_zero_vec;
Intensity_Data intensity_ic(cell_data, angular_quadrature, fem_quadrature, materials,input_reader);
Intensity_Data intensity_zero(cell_data, angular_quadrature, fem_quadrature);
int cell_cnt = 0;
const int n_dir = angular_quadrature.get_number_of_dir();
const int n_grp = 1;
try
{
for(int reg=0; reg < 2 ; reg++)
{
double I;
if( reg==0)
I = I_0;
else
I = I_1;
for(int cell = 0; cell < expected_n_cells[reg] ; cell++)
{
for(int dir = 0; dir < n_dir ; dir++)
{
local_i_vec = Eigen::VectorXd::Zero(n_p);
local_zero_vec = Eigen::VectorXd::Ones(n_p);
intensity_ic.get_cell_intensity( cell_cnt, n_grp-1 , dir, local_i_vec);
intensity_zero.get_cell_intensity(cell_cnt,n_grp-1,dir,local_zero_vec);
for(int el = 0 ; el < n_p ; el++)
{
if( fabs( local_i_vec(el) - I) > tol )
throw Dark_Arts_Exception(VARIABLE_STORAGE , "IC intensity different than expected");
if( fabs(local_zero_vec(el) ) > tol )
throw Dark_Arts_Exception(VARIABLE_STORAGE , "Zero intensity different than expected");
}
local_zero_vec(0) = double(cell_cnt) + 10.*double(dir+1) + 0.1;
local_zero_vec(1) = double(cell_cnt) + 10.*double(dir+1) + 0.2;
local_zero_vec(2) = double(cell_cnt) + 10.*double(dir+1) + 0.3;
local_zero_vec(3) = double(cell_cnt) + 10.*double(dir+1) + 0.4;
intensity_zero.set_cell_intensity(cell_cnt,n_grp-1,dir,local_zero_vec);
}
cell_cnt++;
}
}
std::cout << "Checking Set/Get\n";
/// check the set get's again, independently
for(int d = (n_dir - 1); d > -1 ; d--)
{
for(int cell = 0; cell < 8 ; cell++)
{
intensity_zero.get_cell_intensity(cell,n_grp-1,d,local_zero_vec);
for(int el = 0; el < n_p ; el++)
{
if( fabs(local_zero_vec(el) - (double(cell) + 10.*double(d+1) + 0.1*double(el+1) ) ) > tol)
throw Dark_Arts_Exception(VARIABLE_STORAGE , "Set/get problems");
}
}
}
}
catch(const Dark_Arts_Exception& da_exception )
{
da_exception.testing_message();
val = -1;
}
// Return 0 if tests passed, somethnig else if failing
return val;
}
|
806727c3361f24350a01c0eadbe8c01ad3950ebc
|
1d0a8eba3a188c584b396cc90231e0126668817f
|
/lab10/prelab/heap.h
|
1919fe15f2d4b552a1509e0912898955a4bb778d
|
[] |
no_license
|
shahrozimtiaz/shahrozimtiaz.github.io
|
98262a9cd6c2ee10d177046b792f50116fefa913
|
ed91df8b96117022ca6113473c5129b80bc94e0c
|
refs/heads/master
| 2020-04-15T09:40:53.370161
| 2020-03-05T19:53:24
| 2020-03-05T19:53:24
| 164,561,028
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,059
|
h
|
heap.h
|
//Name:Shahroz Imtiaz
//Email ID:si6rf
//File Name: heap.h
//Date:11/25/2018
//*NOTE: Some heap code was taken from the lecture slides and modified*
//ORIGINAL CODE:
// written by Aaron Bloomfield, 2014
// Released under a CC BY-SA license
// This code is part of the https://github.com/aaronbloomfield/pdr repository
#ifndef HEAP_H
#define HEAP_H
#include <vector>
#include "huffmanNode.h"
using namespace std;
class heap {
public:
heap();
~heap();
void insert(huffmanNode* node);
huffmanNode* findMin();
void deleteMin();
unsigned int getSize(); //of heap
heap createHuffmanTree(heap h); //constructs the huffman tree
void setHuffmanCode(huffmanNode* root, string code); //sets the path to each node
void printHuffmanCode(huffmanNode* root, string code); //only prints the path to each node
vector<huffmanNode*> getVectorHeap(); //used for getting path in main()
private:
vector<huffmanNode*> huffmanHeap;
unsigned int heapSize;
void percolateUp(int hole);
void percolateDown(int hole);
};
#endif
|
5bf39496356d5c4547ccf91cbb1b75838c2a531b
|
a7764174fb0351ea666faa9f3b5dfe304390a011
|
/inc/Handle_LocOpe_HBuilder.hxx
|
231bcd880742302d40bd974d28fe8387cd7b5861
|
[] |
no_license
|
uel-dataexchange/Opencascade_uel
|
f7123943e9d8124f4fa67579e3cd3f85cfe52d91
|
06ec93d238d3e3ea2881ff44ba8c21cf870435cd
|
refs/heads/master
| 2022-11-16T07:40:30.837854
| 2020-07-08T01:56:37
| 2020-07-08T01:56:37
| 276,290,778
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 829
|
hxx
|
Handle_LocOpe_HBuilder.hxx
|
// This file is generated by WOK (CPPExt).
// Please do not edit this file; modify original file instead.
// The copyright and license terms as defined for the original file apply to
// this header file considered to be the "object code" form of the original source.
#ifndef _Handle_LocOpe_HBuilder_HeaderFile
#define _Handle_LocOpe_HBuilder_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_DefineHandle_HeaderFile
#include <Standard_DefineHandle.hxx>
#endif
#ifndef _Handle_TopOpeBRepBuild_HBuilder_HeaderFile
#include <Handle_TopOpeBRepBuild_HBuilder.hxx>
#endif
class Standard_Transient;
class Handle(Standard_Type);
class Handle(TopOpeBRepBuild_HBuilder);
class LocOpe_HBuilder;
DEFINE_STANDARD_HANDLE(LocOpe_HBuilder,TopOpeBRepBuild_HBuilder)
#endif
|
af668ce7351a1be9511601cfc9dbd6209e42258c
|
2e4d2c7ca022d30d85e8f2bb6262462868a77441
|
/DP/alex and a rhombus.cpp
|
c5fc54920b7934d1a0542550caf6825607fdf9e2
|
[] |
no_license
|
AdityaGirishPawate/Codeforces
|
24412e19bfb3bfa1bc139377f05e5e9bb128cd8f
|
c63550e0e2e8319bf0a893240ecd23d905abe84a
|
refs/heads/master
| 2022-11-21T12:54:37.590639
| 2020-07-29T16:11:00
| 2020-07-29T16:11:00
| 269,074,389
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 216
|
cpp
|
alex and a rhombus.cpp
|
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ll n,i;
cin>>n;
vector<ll> a(n);
a[0]=1;
for(i=1;i<n;i++)
a[i]+=a[i-1] + 4*i;
cout<<a[i-1]<<endl;
}
|
1110f26caa9f28a69fd75a35fa68060cd2965c8c
|
59b2d9114592a1151713996a8888456a7fbfe56c
|
/uva/10878.cpp
|
3ffc518795a8c64f5aa1fc4973a445224ccbbefe
|
[] |
no_license
|
111qqz/ACM-ICPC
|
8a8e8f5653d8b6dc43524ef96b2cf473135e28bf
|
0a1022bf13ddf1c1e3a705efcc4a12df506f5ed2
|
refs/heads/master
| 2022-04-02T21:43:33.759517
| 2020-01-18T14:14:07
| 2020-01-18T14:14:07
| 98,531,401
| 1
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,081
|
cpp
|
10878.cpp
|
/* ***********************************************
Author :111qqz
Created Time :2016年01月25日 星期一 09时40分29秒
File Name :code/uva/10878.cpp
************************************************ */
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
#define fst first
#define sec second
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define ms(a,x) memset(a,x,sizeof(a))
typedef long long LL;
#define pi pair < int ,int >
#define MP make_pair
using namespace std;
const double eps = 1E-8;
const int dx4[4]={1,0,0,-1};
const int dy4[4]={0,-1,1,0};
const int inf = 0x3f3f3f3f;
string mat[50]={"| o . o|","| oo . o |","| oo o. o|","| oo .o |","| oo .o o|","| oo .oo |","| oo .ooo|",
"| oo o. |",};
string matc[50]={"| o . o|",
"| o . |",
"| ooo . o|",
"| ooo .o o|",
"| oo o. o|",
"| oo . oo|",
"| oo o. oo|",
"| o . |",
"| oo . o |",
"| ooo . o |",
"| oo o.ooo|",
"| ooo .ooo|",
"| oo o.oo |",
"| o . |",
"| oo .oo |",
"| oo o.ooo|",
"| oooo. |",
"| o . |",
"| oo o. o |",
"| ooo .o o|",
"| oo o.o o|",
"| ooo . |",
"| ooo . oo|",
"| o . |",
"| oo o.ooo|",
"| ooo .oo |",
"| oo .o o|",
"| ooo . o |",
"| o . |",
"| ooo .o |",
"| oo o. |",
"| oo .o o|",
"| o . |",
"| oo o.o |",
"| oo . o|",
"| oooo. o |",
"| oooo. o|",
"| o . |",
"| oo .o |",
"| oo o.ooo|",
"| oo .ooo|",
"| o o.oo |",
"| o. o |"};
map<string,char>mp;
string ori="A quick brown fox jumps over the lazy dog.";
int len;
string tar;
int main()
{
#ifndef ONLINE_JUDGE
freopen("code/in.txt","r",stdin);
#endif
len = ori.length();
//cout<<"len:"<<len<<endl;
mp.clear();
for ( int i = 0 ; i < len ; i ++)
{
mp[matc[i]]=ori[i];
}
while (getline(cin,tar))
{
int p = tar.find('|');
if (p==-1) continue;
printf("%c",mp[tar]);
}
#ifndef ONLINE_JUDGE
fclose(stdin);
#endif
return 0;
}
|
90e9af9022d90236a7ef5834add4a6d382d9f33a
|
da84df7dcc8dfe8e28cd0925e6f6c400c4caf55a
|
/projet-musique/core/bddrel_playlist.h
|
60db19b1da7d239bb1b14b49ab7bbecd27170431
|
[] |
no_license
|
toopoormaghell/projet-musique
|
4f2664d091d4480b526c2bbbc34633d01412449e
|
e0407261c496444cd81178c70e47bb899dacb851
|
refs/heads/master
| 2021-05-22T04:32:06.924158
| 2021-01-23T17:14:05
| 2021-01-23T17:14:05
| 16,050,891
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 373
|
h
|
bddrel_playlist.h
|
#ifndef BDDREL_PLAYLIST_H
#define BDDREL_PLAYLIST_H
#include <QObject>
#include "bddsingleton.h"
class BDDRel_Playlist: public QObject
{
Q_OBJECT
public:
explicit BDDRel_Playlist(QObject* parent = nullptr);
void AjoutRel_Playlist(int id_playlist, int id_relation);
void AjouterAlbumEnPlaylist(int id_playlist, int id_album);
};
#endif // BDDREL_PLAYLIST_H
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.