hexsha stringlengths 40 40 | size int64 19 11.4M | ext stringclasses 13
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 3 270 | max_stars_repo_name stringlengths 5 110 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 9 | max_stars_count float64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 3 270 | max_issues_repo_name stringlengths 5 116 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses listlengths 1 9 | max_issues_count float64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 3 270 | max_forks_repo_name stringlengths 5 116 | max_forks_repo_head_hexsha stringlengths 40 78 | max_forks_repo_licenses listlengths 1 9 | max_forks_count float64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 19 11.4M | avg_line_length float64 1.93 229k | max_line_length int64 12 688k | alphanum_fraction float64 0.07 0.99 | matches listlengths 1 10 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
22ddd77faba1e041181fb3b59819ac1d4aba6043 | 1,366 | cpp | C++ | algorithms/kmp.cpp | NChechulin/Algorithms-and-Data-Structures | c138d814f59ca0d22f895f85a4d089dd2d4f2775 | [
"MIT"
] | null | null | null | algorithms/kmp.cpp | NChechulin/Algorithms-and-Data-Structures | c138d814f59ca0d22f895f85a4d089dd2d4f2775 | [
"MIT"
] | null | null | null | algorithms/kmp.cpp | NChechulin/Algorithms-and-Data-Structures | c138d814f59ca0d22f895f85a4d089dd2d4f2775 | [
"MIT"
] | null | null | null | #include <iostream>
#include <string>
#include <vector>
std::vector<int> getFailureArray(const std::string &pattern) {
int pattern_length = pattern.size();
std::vector<int> failure(pattern_length + 1);
failure[0] = -1;
int j = -1;
for (int i = 0; i < pattern_length; i++) {
while (j != -1 && pattern[j] != pattern[i]) {
j = failure[j];
}
j++;
failure[i + 1] = j;
}
return failure;
}
bool kmp(const std::string &pattern, const std::string &text) {
int text_length = text.size(), pattern_length = pattern.size();
std::vector<int> failure = getFailureArray(pattern);
int k = 0;
for (int j = 0; j < text_length; j++) {
while (k != -1 && pattern[k] != text[j]) {
k = failure[k];
}
k++;
if (k == pattern_length)
return true;
}
return false;
}
int main() {
std::string text = "alskfjaldsabc1abc1abc12k23adsfabcabc";
std::string pattern = "abc1abc12l";
if (kmp(pattern, text) == true) {
std::cout << "Found" << std::endl;
} else {
std::cout << "Not Found" << std::endl;
}
text = "abcabc";
pattern = "bca";
if (kmp(pattern, text) == true) {
std::cout << "Found" << std::endl;
} else {
std::cout << "Not Found" << std::endl;
}
return 0;
}
| 23.551724 | 67 | 0.52123 | [
"vector"
] |
22e3d46be88a1703460cf5566e377b22696183df | 6,306 | cpp | C++ | example/extern/boost/asio/boostechoclient.cpp | joydit/solidframe | 0539b0a1e77663ac4c701a88f56723d3e3688e8c | [
"BSL-1.0"
] | null | null | null | example/extern/boost/asio/boostechoclient.cpp | joydit/solidframe | 0539b0a1e77663ac4c701a88f56723d3e3688e8c | [
"BSL-1.0"
] | null | null | null | example/extern/boost/asio/boostechoclient.cpp | joydit/solidframe | 0539b0a1e77663ac4c701a88f56723d3e3688e8c | [
"BSL-1.0"
] | null | null | null | #include <cstdlib>
#include <iostream>
#include <boost/bind.hpp>
#include <boost/asio.hpp>
#include <boost/concept_check.hpp>
#include <queue>
#include <sstream>
#include "system/timespec.hpp"
using namespace boost::asio;
using boost::asio::ip::tcp;
using namespace std;
using namespace solid;
typedef boost::asio::ip::tcp::endpoint TcpEndPointT;
struct Manager{
struct DataStub{
std::string data;
};
typedef std::vector<DataStub> DataVectorT;
Manager(
uint32_t _repeatcnt,
uint32_t _datafromlen,
uint32_t _datatolen,
uint32_t _datacnt
);
const DataVectorT& dataVector()const{
return datavec;
}
uint32_t repeatCount()const{return repeat_count;}
void endPoint(const TcpEndPointT &_rendpoint){
endpoint = _rendpoint;
}
const TcpEndPointT& endPoint()const{
return endpoint;
}
void report(uint32_t _mintime, uint32_t _maxtime, const uint64_t &_readcnt){
if(mintime > _mintime) mintime = _mintime;
if(maxtime < _maxtime) maxtime = _maxtime;
readcnt += _readcnt;
}
void print(){
std::cerr<<"mintime = "<<mintime<<" maxtime = "<<maxtime<<" readcnt = "<<readcnt<<std::endl;
}
private:
DataVectorT datavec;
uint32_t repeat_count;
TcpEndPointT endpoint;
uint32_t mintime;
uint32_t maxtime;
uint64_t readcnt;
};
class session
{
public:
session(boost::asio::io_service& io_service, Manager &_rm, uint32_t _idx)
: rm(_rm), socket_(io_service), mintime(0xffffffff), maxtime(0), crtread(0), readcnt(0)
{
writeidx = _idx % rm.dataVector().size();
readidx = writeidx;
}
~session(){
rm.report(mintime, maxtime, readcnt);
}
tcp::socket& socket()
{
return socket_;
}
void start(const TcpEndPointT &_rendpoint)
{
socket().async_connect(
_rendpoint,
boost::bind(
&session::handle_connect,
this,
boost::asio::placeholders::error
)
);
}
private:
void handle_connect(
const boost::system::error_code &_rerr
){
if(_rerr){
delete this;
return;
}
socket().async_read_some(
boost::asio::buffer(data_, max_length),
boost::bind(&session::handle_read, this,
boost::asio::placeholders::error,
boost::asio::placeholders::bytes_transferred)
);
const std::string &data = rm.dataVector()[writeidx % rm.dataVector().size()].data;
//cout<<"write "<<(writeidx % rm.dataVector().size())<<" size = "<<data.size()<<endl;
timeq.push(TimeSpec::createRealTime());
boost::asio::async_write(
socket_,
boost::asio::buffer(data.data(), data.size()),
boost::bind(&session::handle_write, this,
boost::asio::placeholders::error)
);
}
void handle_read(const boost::system::error_code& error,
size_t bytes_transferred)
{
if (!error)
{
if(consume_data(data_, bytes_transferred)){
delete this;
return;
}
socket().async_read_some(
boost::asio::buffer(data_, max_length),
boost::bind(&session::handle_read, this,
boost::asio::placeholders::error,
boost::asio::placeholders::bytes_transferred)
);
}
else
{
delete this;
}
}
void handle_write(const boost::system::error_code& error)
{
if (!error)
{
++writeidx;
if(writeidx == rm.repeatCount()){
return;
}
const std::string &data = rm.dataVector()[writeidx%rm.dataVector().size()].data;
//cout<<"write2 "<<(writeidx % rm.dataVector().size())<<" size = "<<data.size()<<endl;
timeq.push(TimeSpec::createRealTime());
boost::asio::async_write(
socket_,
boost::asio::buffer(data.data(), data.size()),
boost::bind(&session::handle_write, this,
boost::asio::placeholders::error)
);
}
else
{
//delete this;
}
}
bool consume_data(const char *_p, size_t _l);
typedef std::queue<TimeSpec> TimeSpecQueueT;
enum { max_length = 1024 };
Manager &rm;
tcp::socket socket_;
char data_[max_length];
uint32_t writeidx;
uint32_t readidx;
TimeSpecQueueT timeq;
uint32_t mintime;
uint32_t maxtime;
uint32_t crtread;
uint64_t readcnt;
};
int main(int argc, char* argv[])
{
try
{
if (argc != 5)
{
std::cerr << "Usage: boost_echoclient <address> <port> <connection_count> <repeat_count>\n";
return 1;
}
boost::asio::io_service io_service;
using namespace std; // For atoi.
Manager m(atoi(argv[4]), 4096, 24 * 1024, 10);
m.endPoint(ip::tcp::endpoint(ip::address::from_string(argv[1]), atoi(argv[2])));
int concnt = atoi(argv[3]);
int idx = 0;
while(concnt--){
session *ps = new session(io_service, m, idx);
ps->start(m.endPoint());
++idx;
}
io_service.run();
m.print();
}
catch (std::exception& e)
{
std::cerr << "Exception: " << e.what() << "\n";
}
return 0;
}
Manager::Manager(
uint32_t _repeatcnt,
uint32_t _datafromlen,
uint32_t _datatolen,
uint32_t _datacnt
):repeat_count(_repeatcnt){
mintime = 0xffffffff;
maxtime = 0;
readcnt = 0;
string line;
for(char c = '0'; c <= '9'; ++c) line += c;
for(char c = 'a'; c <= 'z'; ++c) line += c;
for(char c = 'A'; c <= 'Z'; ++c) line += c;
size_t idx = 0;
for(uint32_t i = 1; i <= _datacnt; ++i){
uint32_t datalen = (_datafromlen * _datacnt + _datatolen * i - _datafromlen * i - _datatolen)/(_datacnt - 1);
//cout<<"Data len for "<<i<<" = "<<datalen<<endl;
datavec.push_back(DataStub());
for(uint32_t j = 0; datavec.back().data.size() < datalen; ++j){
if(!(j % line.size())){
ostringstream oss;
oss<<' '<<idx<<' ';
++idx;
datavec.back().data += oss.str();
}else{
datavec.back().data.push_back(line[j%line.size()]);
}
}
}
}
bool session::consume_data(const char *_p, size_t _l){
//cout<<"consume [";
//cout.write(_p, _l)<<']'<<endl;
readcnt += _l;
while(_l){
const uint32_t crtdatalen = rm.dataVector()[readidx % rm.dataVector().size()].data.size();
uint32_t toread = crtdatalen - crtread;
if(toread > _l) toread = _l;
crtread += toread;
_l -= toread;
//cout<<"consume "<<(readidx % rm.dataVector().size())<<" size = "<<crtdatalen<<" crtread = "<<crtread<<endl;
if(crtread == crtdatalen){
crtread = 0;
TimeSpec ts(TimeSpec::createRealTime());
ts -= timeq.front();
timeq.pop();
const uint32_t msec = ts.seconds() * 1000 + ts.nanoSeconds()/1000000;
if(mintime > msec) mintime = msec;
if(maxtime < msec) maxtime = msec;
++readidx;
if(readidx == rm.repeatCount()){
return true;
}
}
}
return false;
} | 23.014599 | 111 | 0.646844 | [
"vector",
"solid"
] |
22ea8acda51a731a2acf8bf00c92bed93b0c70e8 | 4,359 | cc | C++ | src/gmmbin/gmm-est-map.cc | shuipi100/kaldi | 8e30fddb300a87e7c79ef2c0b9c731a8a9fd23f0 | [
"Apache-2.0"
] | 805 | 2018-05-28T02:32:04.000Z | 2022-03-26T09:13:12.000Z | src/gmmbin/gmm-est-map.cc | shuipi100/kaldi | 8e30fddb300a87e7c79ef2c0b9c731a8a9fd23f0 | [
"Apache-2.0"
] | 49 | 2015-10-24T22:06:28.000Z | 2019-12-24T11:13:34.000Z | src/gmmbin/gmm-est-map.cc | shuipi100/kaldi | 8e30fddb300a87e7c79ef2c0b9c731a8a9fd23f0 | [
"Apache-2.0"
] | 267 | 2018-06-07T08:33:28.000Z | 2022-03-30T12:18:33.000Z | // gmmbin/gmm-est-map.cc
// Copyright 2009-2012 Microsoft Corporation
// Johns Hopkins University (author: Daniel Povey)
// See ../../COPYING for clarification regarding multiple authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABLITY OR NON-INFRINGEMENT.
// See the Apache 2 License for the specific language governing permissions and
// limitations under the License.
#include "base/kaldi-common.h"
#include "util/common-utils.h"
#include "gmm/am-diag-gmm.h"
#include "tree/context-dep.h"
#include "hmm/transition-model.h"
#include "gmm/mle-am-diag-gmm.h"
int main(int argc, char *argv[]) {
try {
using namespace kaldi;
typedef kaldi::int32 int32;
const char *usage =
"Do Maximum A Posteriori re-estimation of GMM-based acoustic model\n"
"Usage: gmm-est-map [options] <model-in> <stats-in> <model-out>\n"
"e.g.: gmm-est-map 1.mdl 1.acc 2.mdl\n";
bool binary_write = true;
MapTransitionUpdateConfig tcfg;
MapDiagGmmOptions gmm_opts;
std::string update_flags_str = "mvwt";
std::string occs_out_filename;
ParseOptions po(usage);
po.Register("binary", &binary_write, "Write output in binary mode");
po.Register("update-flags", &update_flags_str, "Which GMM parameters to "
"update: subset of mvwt.");
po.Register("write-occs", &occs_out_filename, "File to write state "
"occupancies to.");
tcfg.Register(&po);
gmm_opts.Register(&po);
po.Read(argc, argv);
if (po.NumArgs() != 3) {
po.PrintUsage();
exit(1);
}
kaldi::GmmFlagsType update_flags =
StringToGmmFlags(update_flags_str);
std::string model_in_filename = po.GetArg(1),
stats_filename = po.GetArg(2),
model_out_filename = po.GetArg(3);
AmDiagGmm am_gmm;
TransitionModel trans_model;
{
bool binary_read;
Input ki(model_in_filename, &binary_read);
trans_model.Read(ki.Stream(), binary_read);
am_gmm.Read(ki.Stream(), binary_read);
}
Vector<double> transition_accs;
AccumAmDiagGmm gmm_accs;
{
bool binary;
Input ki(stats_filename, &binary);
transition_accs.Read(ki.Stream(), binary);
gmm_accs.Read(ki.Stream(), binary, true); // true == add; doesn't matter here.
}
if (update_flags & kGmmTransitions) { // Update transition model.
BaseFloat objf_impr, count;
trans_model.MapUpdate(transition_accs, tcfg, &objf_impr, &count);
KALDI_LOG << "Transition model update: Overall " << (objf_impr/count)
<< " log-like improvement per frame over " << (count)
<< " frames.";
}
{ // Update GMMs.
BaseFloat objf_impr, count;
BaseFloat tot_like = gmm_accs.TotLogLike(),
tot_t = gmm_accs.TotCount();
MapAmDiagGmmUpdate(gmm_opts, gmm_accs, update_flags, &am_gmm,
&objf_impr, &count);
KALDI_LOG << "GMM update: Overall " << (objf_impr/count)
<< " objective function improvement per frame over "
<< count << " frames";
KALDI_LOG << "GMM update: Overall avg like per frame = "
<< (tot_like/tot_t) << " over " << tot_t << " frames.";
}
if (!occs_out_filename.empty()) { // get state occs
Vector<BaseFloat> state_occs;
state_occs.Resize(gmm_accs.NumAccs());
for (int i = 0; i < gmm_accs.NumAccs(); i++)
state_occs(i) = gmm_accs.GetAcc(i).occupancy().Sum();
bool binary = false;
WriteKaldiObject(state_occs, occs_out_filename, binary);
}
{
Output ko(model_out_filename, binary_write);
trans_model.Write(ko.Stream(), binary_write);
am_gmm.Write(ko.Stream(), binary_write);
}
KALDI_LOG << "Written model to " << model_out_filename;
return 0;
} catch(const std::exception &e) {
std::cerr << e.what() << '\n';
return -1;
}
}
| 33.790698 | 85 | 0.63822 | [
"vector",
"model"
] |
22ecfbaff37e0effb7fc6821efe7cb35ab846797 | 1,089 | cpp | C++ | Clerk/UI/Goals/GoalsProgressRender.cpp | sergeylenkov/Clerk | b220864e89559207c5eeea113668891236fcbfb9 | [
"MIT"
] | 14 | 2016-11-01T15:48:02.000Z | 2020-07-15T13:00:27.000Z | Clerk/UI/Goals/GoalsProgressRender.cpp | sergeylenkov/Clerk | b220864e89559207c5eeea113668891236fcbfb9 | [
"MIT"
] | 29 | 2017-11-16T04:15:33.000Z | 2021-12-22T07:15:42.000Z | Clerk/UI/Goals/GoalsProgressRender.cpp | sergeylenkov/Clerk | b220864e89559207c5eeea113668891236fcbfb9 | [
"MIT"
] | 2 | 2018-08-15T15:25:11.000Z | 2019-01-28T12:49:50.000Z | #include "GoalsProgressRender.h"
GoalsProgressRender::GoalsProgressRender() : wxDataViewCustomRenderer("string", wxDATAVIEW_CELL_INERT, wxDVR_DEFAULT_ALIGNMENT)
{
}
GoalsProgressRender::~GoalsProgressRender()
{
}
bool GoalsProgressRender::Render(wxRect rect, wxDC *dc, int state)
{
int percentWidth = (rect.GetWidth() / 100.0) * _value;
int y = (rect.GetHeight() - 4) / 2;
dc->SetPen(wxPen(wxColor(216, 216, 216), 1));
dc->SetBrush(wxBrush(wxColor(216, 216, 216)));
dc->DrawRectangle(rect.GetX(), rect.GetY() + y, rect.GetWidth(), 4);
wxColor color = Colors::ColorForGoal(_value);
dc->SetPen(wxPen(color, 1));
dc->SetBrush(wxBrush(color));
dc->DrawRectangle(rect.GetX(), rect.GetY() + y, percentWidth, 4);
return true;
}
wxSize GoalsProgressRender::GetSize() const
{
return wxDefaultSize;
}
bool GoalsProgressRender::SetValue(const wxVariant &value)
{
_value = value.GetDouble();
if (_value > 100) {
_value = 100;
}
else if (_value < 1) {
_value = 1;
}
return true;
}
bool GoalsProgressRender::GetValue(wxVariant &WXUNUSED(value)) const
{
return true;
} | 20.54717 | 127 | 0.707071 | [
"render"
] |
22f20927b886fc9e2d9a46df968dbe3a5816af12 | 10,762 | cpp | C++ | source/backend/cpu/CPUDeconvolution.cpp | loveltyoic/MNN | ff405a307819a7228e0d1fc02c00c68021745b0a | [
"Apache-2.0"
] | 1 | 2021-02-03T07:50:59.000Z | 2021-02-03T07:50:59.000Z | source/backend/cpu/CPUDeconvolution.cpp | sunnythree/MNN | 166fe68cd1ba05d02b018537bf6af03374431690 | [
"Apache-2.0"
] | null | null | null | source/backend/cpu/CPUDeconvolution.cpp | sunnythree/MNN | 166fe68cd1ba05d02b018537bf6af03374431690 | [
"Apache-2.0"
] | 1 | 2021-01-15T06:28:11.000Z | 2021-01-15T06:28:11.000Z | //
// CPUDeconvolution.cpp
// MNN
//
// Created by MNN on 2018/07/20.
// Copyright © 2018, Alibaba Group Holding Limited
//
#include "CPUDeconvolution.hpp"
#include "CPUBackend.hpp"
#include "Concurrency.h"
#include "Macro.h"
#include "Matrix.hpp"
#include "TensorUtils.hpp"
#include "compute/ConvOpt.h"
#include "compute/DeconvolutionWithStride.hpp"
#ifdef MNN_USE_NEON
#include <arm_neon.h>
#endif
namespace MNN {
CPUDeconvolutionCommon::CPUDeconvolutionCommon(const Op* convOp, Backend* b)
: CPUConvolution(convOp->main_as_Convolution2D()->common(), b) {
auto conv2D = convOp->main_as_Convolution2D();
int outputCount = mCommon->outputCount();
mBias.reset(Tensor::createDevice<float>(std::vector<int>{ALIGN_UP4(outputCount)}));
bool success = b->onAcquireBuffer(mBias.get(), Backend::STATIC);
if (!success) {
mValid = false;
return;
}
::memset(mBias->host<float>(), 0, mBias->size());
::memcpy(mBias->host<float>(), conv2D->bias()->data(), conv2D->bias()->size() * sizeof(float));
mSrcCount =
conv2D->weight()->size() * mCommon->group() / mCommon->kernelX() / mCommon->kernelY() / mCommon->outputCount();
}
CPUDeconvolutionCommon::~CPUDeconvolutionCommon() {
backend()->onReleaseBuffer(mBias.get(), Backend::STATIC);
}
ErrorCode CPUDeconvolutionCommon::onResize(const std::vector<Tensor*>& inputs, const std::vector<Tensor*>& outputs) {
auto input = inputs[0];
auto output = outputs[0];
if (mCommon->padMode() == PadMode_SAME) {
const int outputWidth = output->width();
const int outputHeight = output->height();
const int outputWidthPadded = (input->width() - 1) * mCommon->strideX() + mCommon->kernelX();
const int outputHeightPadded = (input->height() - 1) * mCommon->strideY() + mCommon->kernelY();
const int padNeededWidth = outputWidthPadded - outputWidth;
const int padNeededHeight = outputHeightPadded - outputHeight;
mPadX = padNeededWidth / 2;
mPadY = padNeededHeight / 2;
return NO_ERROR;
}
mPadX = mCommon->padX();
mPadY = mCommon->padY();
return NO_ERROR;
}
CPUDeconvolution::CPUDeconvolution(const Op* convOp, Backend* backend) : MNN::CPUDeconvolutionCommon(convOp, backend) {
auto layer = convOp->main_as_Convolution2D()->common();
const float* tempWeight = convOp->main_as_Convolution2D()->weight()->data();
int fw = layer->kernelX();
int fh = layer->kernelY();
int srcCount = mSrcCount;
int alignedWeightSize = ALIGN_UP4(layer->outputCount()) * ALIGN_UP4(srcCount) * fw * fh;
mWeight.reset(Tensor::createDevice<float>(std::vector<int>{alignedWeightSize}));
bool success = backend->onAcquireBuffer(mWeight.get(), Backend::STATIC);
if (!success) {
mValid = false;
return;
}
float* dest = mWeight->host<float>();
MNN_ASSERT(nullptr != dest);
int outputCount = layer->outputCount();
int srcCountD4 = UP_DIV(srcCount, 4);
// MNN_PRINT("ic:%d, oc:%d\n", mSrcCount, outputCount);
for (int b = 0; b < outputCount; ++b) {
int b_4 = b / 4;
float* dst_b = dest + b_4 * 16 * fw * fh * srcCountD4;
int mx = b % 4;
for (int d = 0; d < srcCount; ++d) {
int my = d % 4;
int d_4 = d / 4;
float* dst_d = dst_b + d_4 * 16;
for (int y = 0; y < fh; ++y) {
float* dst_y = dst_d + y * fw * 16 * srcCountD4;
for (int x = 0; x < fw; ++x) {
float* dst_x = dst_y + x * 16 * srcCountD4;
dst_x[4 * my + mx] = tempWeight[x + y * fw + b * fw * fh + d * fw * fh * outputCount];
}
}
}
}
mTempColBuffer.reset(new Tensor(4));
mTempSrcBuffer.reset(new Tensor(4));
}
CPUDeconvolution::~CPUDeconvolution() {
backend()->onReleaseBuffer(mWeight.get(), Backend::STATIC);
}
ErrorCode CPUDeconvolution::onResize(const std::vector<Tensor*>& inputs, const std::vector<Tensor*>& outputs) {
CPUDeconvolutionCommon::onResize(inputs, outputs);
auto input = inputs[0];
auto output = outputs[0];
auto ic = input->channel();
auto oc = output->channel();
auto kernelCount = UP_DIV(oc, 4) * mCommon->kernelX() * mCommon->kernelY();
int number = std::max(1, ((CPUBackend*)backend())->threadNumber());
mTempColBuffer->setLength(0, number);
mTempColBuffer->setLength(1, kernelCount);
mTempColBuffer->setLength(2, CONVOLUTION_TILED_NUMBWR1x1);
mTempColBuffer->setLength(3, 4);
mTempSrcBuffer->setLength(0, number);
mTempSrcBuffer->setLength(1, UP_DIV(ic, 4));
mTempSrcBuffer->setLength(2, CONVOLUTION_TILED_NUMBWR1x1);
mTempSrcBuffer->setLength(3, 4);
TensorUtils::setLinearLayout(mTempSrcBuffer.get());
TensorUtils::setLinearLayout(mTempColBuffer.get());
auto res = backend()->onAcquireBuffer(mTempSrcBuffer.get(), Backend::DYNAMIC);
if (!res) {
return OUT_OF_MEMORY;
}
res = backend()->onAcquireBuffer(mTempColBuffer.get(), Backend::DYNAMIC);
if (!res) {
return OUT_OF_MEMORY;
}
backend()->onReleaseBuffer(mTempSrcBuffer.get(), Backend::DYNAMIC);
backend()->onReleaseBuffer(mTempColBuffer.get(), Backend::DYNAMIC);
auto layer = mCommon;
// Revert Set input, output for use easier
output = inputs[0];
input = outputs[0];
CONV_SETUP_KERNELSIZE(4);
auto dst_depth_quad = UP_DIV(output->channel(), 4);
auto src_z_step = input->width() * input->height() * 4;
int count = width * height;
int tileCount = UP_DIV(count, CONVOLUTION_TILED_NUMBWR1x1);
int threadNumber = std::max(1, ((CPUBackend*)backend())->threadNumber());
threadNumber = std::min(threadNumber, tileCount);
auto weightAddr = mWeight->host<float>();
mThreadNumber = threadNumber;
mFunction = [this, width, height, count, tileCount, threadNumber, dst_depth_quad, kernelCount, strideX, strideY,
padX, padY, src_height, src_width, src_z_step, dilateX, dilateY, kernel_width, kernel_height,
src_depth_quad, dilateX_step, dilateY_step,
weightAddr](const float* dstOrigin, float* srcOrigin, int tId) {
auto tempSource = mTempSrcBuffer->host<float>() + tId * mTempSrcBuffer->stride(0);
auto tempDest = mTempColBuffer->host<float>() + tId * mTempColBuffer->stride(0);
for (int tIndex = (int)tId; tIndex < tileCount; tIndex += threadNumber) {
int xStart = tIndex * CONVOLUTION_TILED_NUMBWR1x1;
int xCount = std::min(count - xStart, CONVOLUTION_TILED_NUMBWR1x1);
// Copy Dest
{
auto dstStart = dstOrigin + xStart * 4;
for (int dz = 0; dz < dst_depth_quad; ++dz) {
auto source = dstStart + dz * width * height * 4;
auto dest = tempSource + dz * CONVOLUTION_TILED_NUMBWR1x1 * 4;
::memcpy(dest, source, xCount * 4 * sizeof(float));
}
}
// Gemm
MNNGemmFloatUnit_4(tempDest, tempSource, weightAddr, dst_depth_quad, CONVOLUTION_TILED_NUMBWR1x1 * 4,
kernelCount, 0);
// Col2Image
std::unique_lock<std::mutex> __l(mLock);
for (int i = 0; i < xCount; ++i) {
auto oIndex = i + xStart;
int ox = oIndex % width;
int oy = oIndex / width;
int srcStartX = ox * strideX - padX;
int srcStartY = oy * strideY - padY;
int sfy = ALIMAX(0, (UP_DIV(-srcStartY, dilateY)));
int efy = ALIMIN(kernel_height, UP_DIV(src_height - srcStartY, dilateY));
int sfx = ALIMAX(0, (UP_DIV(-srcStartX, dilateX)));
int efx = ALIMIN(kernel_width, UP_DIV(src_width - srcStartX, dilateX));
auto dstStart = srcOrigin + srcStartX * 4 + srcStartY * src_width * 4;
auto srcStart = tempDest + 4 * i;
for (int z = 0; z < src_depth_quad; ++z) {
auto dstZ = dstStart + z * src_z_step;
auto srcZ = srcStart + kernel_width * kernel_height * 4 * CONVOLUTION_TILED_NUMBWR1x1 * z;
for (int fy = sfy; fy < efy; ++fy) {
auto dstY = dstZ + fy * dilateY_step;
auto srcY = srcZ + fy * kernel_width * CONVOLUTION_TILED_NUMBWR1x1 * 4;
for (int fx = sfx; fx < efx; ++fx) {
auto dstX = dstY + fx * dilateX_step;
auto srcX = srcY + fx * CONVOLUTION_TILED_NUMBWR1x1 * 4;
#ifdef MNN_USE_NEON
vst1q_f32(dstX, vld1q_f32(dstX) + vld1q_f32(srcX));
#else
for (int j = 0; j < 4; ++j) {
dstX[j] += srcX[j];
}
#endif
}
}
}
}
}
};
return NO_ERROR;
}
ErrorCode CPUDeconvolution::onExecute(const std::vector<Tensor*>& inputs, const std::vector<Tensor*>& outputs) {
auto output = inputs[0];
auto input = outputs[0];
auto srcPlane = input->width() * input->height();
auto icC4 = UP_DIV(input->channel(), 4);
for (int batchIndex = 0; batchIndex < input->batch(); ++batchIndex) {
float* srcOrigin = input->host<float>() + batchIndex * input->stride(0);
memset(srcOrigin, 0, input->stride(0) * sizeof(float));
const float* dstOrigin = output->host<float>() + batchIndex * output->stride(0);
MNN_CONCURRENCY_BEGIN(tId, mThreadNumber) {
mFunction(dstOrigin, srcOrigin, (int)tId);
}
MNN_CONCURRENCY_END();
mPostFunction(srcOrigin, mBias->host<float>(), srcPlane, icC4);
}
return NO_ERROR;
}
class CPUDeconvolutionCreator : public CPUBackend::Creator {
public:
virtual Execution* onCreate(const std::vector<Tensor*>& inputs, const std::vector<Tensor*>& outputs,
const MNN::Op* op, Backend* backend) const {
auto convOp = op->main_as_Convolution2D();
auto common = convOp->common();
if (common->strideY() > 1 || common->strideX() > 1) {
if (common->dilateX() == 1 && common->dilateY() == 1) {
return new DeconvolutionWithStride(op, backend);
}
}
return new CPUDeconvolution(op, backend);
}
};
REGISTER_CPU_OP_CREATOR(CPUDeconvolutionCreator, OpType_Deconvolution);
} // namespace MNN
| 41.392308 | 119 | 0.586601 | [
"vector"
] |
22f64f3f08894411f4743cc0a957a06f107a6cc9 | 6,263 | cpp | C++ | Code/Libraries/3D/src/GL2/gl2vertexbuffer.cpp | rajdakin/Eldritch | 3cd6831a4eebb11babec831e2fc59361411ad57f | [
"Zlib"
] | 4 | 2018-01-31T11:56:52.000Z | 2021-06-27T18:11:23.000Z | Code/Libraries/3D/src/GL2/gl2vertexbuffer.cpp | rajdakin/Eldritch | 3cd6831a4eebb11babec831e2fc59361411ad57f | [
"Zlib"
] | 11 | 2019-01-04T19:50:48.000Z | 2021-04-26T08:31:45.000Z | Code/Libraries/3D/src/GL2/gl2vertexbuffer.cpp | rajdakin/Eldritch | 3cd6831a4eebb11babec831e2fc59361411ad57f | [
"Zlib"
] | 4 | 2018-02-27T07:10:51.000Z | 2021-04-22T09:38:13.000Z | #include "core.h"
#include "gl2vertexbuffer.h"
#include "vector.h"
#include "vector2.h"
#include "vector4.h"
#ifdef __amigaos4__
#include "idatastream.h"
#endif
#ifdef NO_VBO
#include <cstdlib>
#include <cstring>
#endif
#ifdef HAVE_GLES
extern "C" {
//void* eglGetProcAddress(const char*); // cannot include EGL/egl.h, as it conflict with other headers...
void* SDL_GL_GetProcAddress(const char* proc);
}
#define eglGetProcAddress(aa) SDL_GL_GetProcAddress(aa)
static int MapBufferInited = 0;
static PFNGLMAPBUFFEROESPROC glMapBuffer = NULL;
static PFNGLUNMAPBUFFEROESPROC glUnmapBuffer = NULL;
#define GL_WRITE_ONLY GL_WRITE_ONLY_OES
#endif
GL2VertexBuffer::GL2VertexBuffer()
: m_RefCount( 0 )
, m_NumVertices( 0 )
, m_Dynamic( false )
, m_PositionsVBO( 0 )
, m_ColorsVBO( 0 )
, m_FloatColorsVBO( 0 )
, m_UVsVBO( 0 )
, m_NormalsVBO( 0 )
//, m_NormalsBVBO( 0 )
, m_TangentsVBO( 0 )
, m_BoneIndicesVBO( 0 )
, m_BoneWeightsVBO( 0 )
{
#if !defined(NO_VBO) && defined(HAVE_GLES)
if( !MapBufferInited )
{
glMapBuffer = reinterpret_cast<PFNGLMAPBUFFEROESPROC>(eglGetProcAddress("glMapBufferOES")); // Hmm...
glUnmapBuffer = reinterpret_cast<PFNGLUNMAPBUFFEROESPROC>(eglGetProcAddress("glUnmapBufferOES")); // Hmm...
MapBufferInited = 1;
}
#endif
}
GL2VertexBuffer::~GL2VertexBuffer()
{
DeviceRelease();
}
int GL2VertexBuffer::AddReference()
{
++m_RefCount;
return m_RefCount;
}
int GL2VertexBuffer::Release()
{
DEVASSERT( m_RefCount > 0 );
--m_RefCount;
if( m_RefCount <= 0 )
{
delete this;
return 0;
}
return m_RefCount;
}
void GL2VertexBuffer::DeviceRelease()
{
#ifdef NO_VBO
#define SAFEDELETEBUFFER( USE ) if( m_##USE##VBO != 0 ) { free( m_##USE##VBO ); }
#else
#define SAFEDELETEBUFFER( USE ) if( m_##USE##VBO != 0 ) { glDeleteBuffers( 1, &m_##USE##VBO ); }
#endif
SAFEDELETEBUFFER( Positions );
SAFEDELETEBUFFER( Colors );
SAFEDELETEBUFFER( FloatColors );
SAFEDELETEBUFFER( UVs );
SAFEDELETEBUFFER( Normals );
//SAFEDELETEBUFFER( NormalsB );
SAFEDELETEBUFFER( Tangents );
SAFEDELETEBUFFER( BoneIndices );
SAFEDELETEBUFFER( BoneWeights );
#undef SAFEDELETEBUFFER
}
void GL2VertexBuffer::DeviceReset()
{
}
void GL2VertexBuffer::RegisterDeviceResetCallback( const SDeviceResetCallback& Callback )
{
Unused( Callback );
}
void GL2VertexBuffer::Init( const SInit& InitStruct )
{
XTRACE_FUNCTION;
m_NumVertices = InitStruct.NumVertices;
m_Dynamic = InitStruct.Dynamic;
const GLenum Usage = InitStruct.Dynamic ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW;
#ifdef NO_VBO
#define CREATEBUFFER( USE, TYPE ) \
if( InitStruct.USE ) \
{ \
m_##USE##VBO = malloc( m_NumVertices * sizeof( TYPE ) ); \
memcpy( m_##USE##VBO, InitStruct.USE, m_NumVertices * sizeof( TYPE ) ); \
ASSERT( m_##USE##VBO != 0 ); \
}
#else
#define CREATEBUFFER( USE, TYPE ) \
if( InitStruct.USE ) \
{ \
glGenBuffers( 1, &m_##USE##VBO ); \
ASSERT( m_##USE##VBO != 0 ); \
glBindBuffer( GL_ARRAY_BUFFER, m_##USE##VBO ); \
glBufferData( GL_ARRAY_BUFFER, InitStruct.NumVertices * sizeof( TYPE ), InitStruct.USE, Usage ); \
}
#endif
CREATEBUFFER( Positions, Vector );
CREATEBUFFER( Colors, uint );
CREATEBUFFER( FloatColors, Vector4 );
CREATEBUFFER( UVs, Vector2 );
CREATEBUFFER( Normals, Vector );
//CREATEBUFFER( NormalsB, Vector );
CREATEBUFFER( Tangents, Vector4 );
CREATEBUFFER( BoneIndices, SBoneData );
CREATEBUFFER( BoneWeights, SBoneData );
#undef CREATEBUFFER
GLERRORCHECK;
}
#ifdef NO_VBO
#define GETBUFFER( USE ) void* GL2VertexBuffer::Get##USE() { return m_##USE##VBO; }
#else
#define GETBUFFER( USE ) void* GL2VertexBuffer::Get##USE() { return &m_##USE##VBO; }
#endif
GETBUFFER( Positions )
GETBUFFER( Colors )
GETBUFFER( FloatColors )
GETBUFFER( UVs )
GETBUFFER( Normals )
//GETBUFFER( NormalsB )
GETBUFFER( Tangents )
GETBUFFER( BoneIndices )
GETBUFFER( BoneWeights )
#undef GETBUFFER
uint GL2VertexBuffer::GetNumVertices()
{
return m_NumVertices;
}
void GL2VertexBuffer::SetNumVertices( uint NumVertices )
{
m_NumVertices = NumVertices;
}
void* GL2VertexBuffer::Lock( IVertexBuffer::EVertexElements VertexType )
{
ASSERT( m_Dynamic );
#ifdef NO_VBO
switch (VertexType) {
case EVE_Positions:
return m_PositionsVBO;
case EVE_Colors:
return m_ColorsVBO;
case EVE_FloatColors:
return m_FloatColorsVBO;
case EVE_UVs:
return m_UVsVBO;
case EVE_Normals:
return m_NormalsVBO;
case EVE_Tangents:
return m_TangentsVBO;
case EVE_BoneIndices:
return m_BoneIndicesVBO;
case EVE_BoneWeights:
return m_BoneWeightsVBO;
default:
WARN;
return 0;
}
#else
const GLuint VBO = InternalGetVBO( VertexType );
ASSERT( VBO != 0 );
glBindBuffer( GL_ARRAY_BUFFER, VBO );
void* const pData = glMapBuffer( GL_ARRAY_BUFFER, GL_WRITE_ONLY );
ASSERT( pData );
return pData;
#endif
}
void GL2VertexBuffer::Unlock( EVertexElements VertexType )
{
ASSERT( m_Dynamic );
#ifdef __amigaos4__
if( VertexType==EVE_Colors )
{
GLuint* p = (GLuint*)m_ColorsVBO;
for( int i=0; i<m_NumVertices; ++i, ++p )
{
littleBigEndian(p);
}
}
#endif
#ifndef NO_VBO
const GLuint VBO = InternalGetVBO( VertexType );
ASSERT( VBO != 0 );
glBindBuffer( GL_ARRAY_BUFFER, VBO );
const GLboolean Success = glUnmapBuffer( GL_ARRAY_BUFFER );
ASSERT( Success == GL_TRUE );
Unused( Success );
#endif
}
#ifndef NO_VBO
GLuint GL2VertexBuffer::InternalGetVBO( EVertexElements VertexType )
{
switch( VertexType )
{
case EVE_Positions:
return m_PositionsVBO;
case EVE_Colors:
return m_ColorsVBO;
case EVE_FloatColors:
return m_FloatColorsVBO;
case EVE_UVs:
return m_UVsVBO;
case EVE_Normals:
return m_NormalsVBO;
//case EVE_NormalsB:
// return m_NormalsBVBO;
case EVE_Tangents:
return m_TangentsVBO;
case EVE_BoneIndices:
return m_BoneIndicesVBO;
case EVE_BoneWeights:
return m_BoneWeightsVBO;
default:
WARN;
return 0;
}
}
#endif
| 23.545113 | 110 | 0.676353 | [
"vector"
] |
22fd39f1680593be3fbc2e6575592d8b83c665c9 | 9,283 | cpp | C++ | 3. Cooperative Autonomy/Programa/PathPlanning.cpp | diegoalejogm/Mobile-Robotics-Projects | 9b3535766ab785021c693627d3b61d3fb064e1e3 | [
"MIT"
] | 2 | 2019-01-28T16:12:52.000Z | 2019-04-18T03:04:58.000Z | 3. Cooperative Autonomy/Programa/PathPlanning.cpp | diegoalejogm/RoboticsProject | 9b3535766ab785021c693627d3b61d3fb064e1e3 | [
"MIT"
] | null | null | null | 3. Cooperative Autonomy/Programa/PathPlanning.cpp | diegoalejogm/RoboticsProject | 9b3535766ab785021c693627d3b61d3fb064e1e3 | [
"MIT"
] | 1 | 2018-05-20T15:51:13.000Z | 2018-05-20T15:51:13.000Z | #include "Configuration.h"
#include "IntegerPoint2D.h"
#include "PathPlanning.h"
#include <cstdio>
#include <iostream>
#include <fstream>
#include <map>
#include <string>
#include <queue>
#define SAFETY_DISTANCE false
#define FIRST_TRY_TO_SPIN true
#define PATH_SHORTENER false
#define CELL_SIZE 400
#define PI acos(-1.0)
using namespace std;
struct State {
int px1, py1, px2, py2;
} startState, endState;
Configuration startposition[2], endposition[2];
vector<Configuration> solRobot1, solRobot2;
string input[20][20];
int dimX, dimY;
bool bfsPosition[20][20][20][20];
int bfsTrace[20][20][20][20][2];
queue <State> bfsQueue;
const int dirx[] = {0,0,0,1,-1,1,1,-1,-1};
const int diry[] = {0,1,-1,0,0,1,-1,1,-1};
const int angle[] = {0,0,180,270,90,315,225,45,135};
map<int, int> angleToDir;
ofstream debug;
void parseInput() {
ifstream inputFile;
inputFile.open("escena.txt");
string ax1, ax2, ax3, ax4;
inputFile >> ax1 >> dimX;
inputFile >> ax1 >> dimY;
inputFile >> ax1 >> ax2 >> ax3 >> ax4;
startposition[0].position = IntegerPoint2D(std::stoi(ax2.substr(0, ax2.length() - 1)), std::stoi(ax3.substr(0, ax3.length() - 1)));
startposition[0].angle = std::stoi(ax4);
inputFile >> ax1 >> ax2 >> ax3 >> ax4;
endposition[0].position = IntegerPoint2D(std::stoi(ax2.substr(0, ax2.length() - 1)), std::stoi(ax3.substr(0, ax3.length() - 1)));
endposition[0].angle = std::stoi(ax4);
inputFile >> ax1 >> ax2 >> ax3 >> ax4;
startposition[1].position = IntegerPoint2D(std::stoi(ax2.substr(0, ax2.length() - 1)), std::stoi(ax3.substr(0, ax3.length() - 1)));
startposition[1].angle = std::stoi(ax4);
inputFile >> ax1 >> ax2 >> ax3 >> ax4;
endposition[1].position = IntegerPoint2D(std::stoi(ax2.substr(0, ax2.length() - 1)), std::stoi(ax3.substr(0, ax3.length() - 1)));
endposition[1].angle = std::stoi(ax4);
for (int i = 0; i < 6; i++)
inputFile >> ax1;
for (int i = 0; i < dimX; i++) {
for (int j = 0; j < dimY; j++) {
inputFile >> input[i][j];
}
}
inputFile.close();
}
inline bool equal(int px1, int py1, int px2, int py2) {
return (px1 == px2) && (py1 == py2);
}
inline int simplifyAngle(int angle) {
while (angle > 180)
angle -= 360;
while (angle <= -180) {
angle += 360;
}
return angle;
}
bool validMove(State actual, State next, int dir1, int dir2) {
int pnx, pny;
if (next.px1 < 0 || next.py1 < 0 || next.px1 >= dimX || next.py1 >= dimY ||
next.px2 < 0 || next.py2 < 0 || next.px2 >= dimX || next.py2 >= dimY)
return false;
if (input[next.px1][next.py1] == "xx" || input[next.px2][next.py2] == "xx")
return false;
if (equal(next.px1, next.py1, next.px2, next.py2) || equal(actual.px1, actual.py1, next.px2, next.py2) ||
equal(next.px1, next.py1, actual.px2, actual.py2) || equal(actual.px1, actual.py1, actual.px2, actual.py2))
return false;
if (SAFETY_DISTANCE) {
for (int i = 0; i < 9; i++) {
pnx = next.px1 + dirx[i];
pny = next.py1 + diry[i];
if (pnx < 0 || pny < 0 || pnx >= dimX || pny >= dimY || input[pnx][pny] == "xx") return false;
if (equal(pnx, pny, next.px2, next.py2) || equal(pnx, pny, actual.px2, actual.py2)) return false;
pnx = next.px2 + dirx[i];
pny = next.py2 + diry[i];
if (pnx < 0 || pny < 0 || pnx >= dimX || pny >= dimY || input[pnx][pny] == "xx") return false;
if (equal(pnx, pny, next.px1, next.py1) || equal(pnx, pny, actual.px1, actual.py1)) return false;
}
} else {
if (dir1 > 4) {
pnx = actual.px1 + dirx[dir1];
pny = actual.py1;
if (pnx < 0 || pny < 0 || pnx >= dimX || pny >= dimY || input[pnx][pny] == "xx") return false;
if (equal(pnx, pny, next.px2, next.py2) || equal(pnx, pny, actual.px2, actual.py2)) return false;
pnx = actual.px1;
pny = actual.py1 + diry[dir1];
if (pnx < 0 || pny < 0 || pnx >= dimX || pny >= dimY || input[pnx][pny] == "xx") return false;
if (equal(pnx, pny, next.px2, next.py2) || equal(pnx, pny, actual.px2, actual.py2)) return false;
}
if (dir2 > 4) {
pnx = actual.px2 + dirx[dir2];
pny = actual.py2;
if (pnx < 0 || pny < 0 || pnx >= dimX || pny >= dimY || input[pnx][pny] == "xx") return false;
if (equal(pnx, pny, next.px1, next.py1) || equal(pnx, pny, actual.px1, actual.py1)) return false;
pnx = actual.px2;
pny = actual.py2 + diry[dir2];
if (pnx < 0 || pny < 0 || pnx >= dimX || pny >= dimY || input[pnx][pny] == "xx") return false;
if (equal(pnx, pny, next.px1, next.py1) || equal(pnx, pny, actual.px1, actual.py1)) return false;
}
}
return true;
}
void bfs() {
startState.py1 = (startposition[0].position.x - CELL_SIZE / 2) / CELL_SIZE;
startState.py2 = (startposition[1].position.x - CELL_SIZE / 2) / CELL_SIZE;
startState.px1 = dimY - (startposition[0].position.y + CELL_SIZE / 2) / CELL_SIZE;
startState.px2 = dimY - (startposition[1].position.y + CELL_SIZE / 2) / CELL_SIZE;
endState.py1 = (endposition[0].position.x - CELL_SIZE / 2) / CELL_SIZE;
endState.py2 = (endposition[1].position.x - CELL_SIZE / 2) / CELL_SIZE;
endState.px1 = dimY - (endposition[0].position.y + CELL_SIZE / 2) / CELL_SIZE;
endState.px2 = dimY - (endposition[1].position.y + CELL_SIZE / 2) / CELL_SIZE;
bfsQueue.push(startState);
memset(bfsPosition, 0, sizeof(bfsPosition));
bfsPosition[startState.px1][startState.py1][startState.px2][startState.py2] = true;
bfsTrace[startState.px1][startState.py1][startState.px2][startState.py2][0] =
bfsTrace[startState.px1][startState.py1][startState.px2][startState.py2][1] = -1;
while (bfsQueue.size() > 0 && !bfsPosition[endState.px1][endState.py1][endState.px2][endState.py2]) {
State ac, nx;
ac = bfsQueue.front(); bfsQueue.pop();
debug << ac.px1 << " " << ac.py1 << " " << ac.px2 << " " << ac.py2 << endl;
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 9; j++) {
nx.px1 = ac.px1 + dirx[i];
nx.py1 = ac.py1 + diry[i];
nx.px2 = ac.px2 + dirx[j];
nx.py2 = ac.py2 + diry[j];
if (validMove(ac, nx, i, j) && !bfsPosition[nx.px1][nx.py1][nx.px2][nx.py2]) {
bfsPosition[nx.px1][nx.py1][nx.px2][nx.py2] = true;
bfsTrace[nx.px1][nx.py1][nx.px2][nx.py2][0] = i;
bfsTrace[nx.px1][nx.py1][nx.px2][nx.py2][1] = j;
bfsQueue.push(nx);
}
}
}
}
debug << "END DFS" << endl;
}
void generateSolution() {
vector<State> sol;
vector<int> soldir1;
vector<int> soldir2;
State current = endState;
bool finished = false;
while (!finished) {
sol.push_back(current);
debug << current.px1 << " " << current.py1 << " " << current.px2 << " " << current.py2 << endl;
if (bfsTrace[current.px1][current.py1][current.px2][current.py2][0] == -1) finished = true;
else {
int dir1 = bfsTrace[current.px1][current.py1][current.px2][current.py2][0];
int dir2 = bfsTrace[current.px1][current.py1][current.px2][current.py2][1];
soldir1.push_back(dir1);
soldir2.push_back(dir2);
current.px1 = current.px1 - dirx[dir1];
current.py1 = current.py1 - diry[dir1];
current.px2 = current.px2 - dirx[dir2];
current.py2 = current.py2 - diry[dir2];
}
}
Configuration lastKnown1, lastKnown2;
lastKnown1.angle = 0;
lastKnown1.position.x = 0;
lastKnown1.position.y = 0;
lastKnown2.angle = 0;
lastKnown2.position.x = 0;
lastKnown2.position.y = 0;
int trueAngle1, trueAngle2, dirn1, dirn2;
for (int i = soldir1.size() - 1; i >= 0; i--) {
if (soldir1[i] != 0) {
trueAngle1 = angle[soldir1[i]];
trueAngle1 -= startposition[0].angle;
trueAngle1 = simplifyAngle(trueAngle1);
dirn1 = angleToDir[trueAngle1];
} else {
trueAngle1 = lastKnown1.angle;
dirn1 = 0;
}
if(soldir2[i] != 0) {
trueAngle2 = angle[soldir2[i]];
trueAngle2 -= startposition[1].angle;
trueAngle2 = simplifyAngle(trueAngle2);
dirn2 = angleToDir[trueAngle2];
}
else {
trueAngle2 = lastKnown2.angle;
dirn2 = 0;
}
if ((trueAngle2 != lastKnown2.angle || trueAngle1 != lastKnown1.angle) && FIRST_TRY_TO_SPIN) {
lastKnown1.angle = trueAngle1;
lastKnown2.angle = trueAngle2;
solRobot1.push_back(lastKnown1);
solRobot2.push_back(lastKnown2);
}
lastKnown1.angle = trueAngle1;
lastKnown1.position.y -= dirx[dirn1] * CELL_SIZE ;
lastKnown1.position.x += diry[dirn1] * CELL_SIZE ;
lastKnown2.angle = trueAngle2;
lastKnown2.position.y -= dirx[dirn2] * CELL_SIZE ;
lastKnown2.position.x += diry[dirn2] * CELL_SIZE ;
solRobot1.push_back(lastKnown1);
solRobot2.push_back(lastKnown2);
}
lastKnown1.angle = simplifyAngle(endposition[0].angle - startposition[0].angle);
solRobot1.push_back(lastKnown1);
lastKnown2.angle = simplifyAngle(endposition[1].angle - startposition[1].angle);
solRobot2.push_back(lastKnown2);
for (int i = 0; i < solRobot1.size(); i++) {
debug << "A: " << solRobot1[i].position.x << " " << solRobot1[i].position.y << " " << solRobot1[i].angle << endl;
debug << "B: " << solRobot2[i].position.x << " " << solRobot2[i].position.y << " " << solRobot2[i].angle << endl;
}
}
void PathPlanning::Init() {
debug.open("debug.txt");
angleToDir[0] = 1;
angleToDir[180] = 2;
angleToDir[-90] = 3;
angleToDir[90] = 4;
angleToDir[-45] = 5;
angleToDir[-135] = 6;
angleToDir[45] = 7;
angleToDir[135] = 8;
parseInput();
bfs();
generateSolution();
}
vector<Configuration>& PathPlanning::getRobotPath(int robotNumber)
{
if (robotNumber == 1)
return solRobot1;
else
return solRobot2;
}
| 33.756364 | 132 | 0.636109 | [
"vector"
] |
fe066959edc53a821771a0d81d3288658261d7f4 | 5,385 | cpp | C++ | TypesetWidget/cases.cpp | Math-Collection/YAWYSIWYGEE-Qt-Equation-Editor-Widget | c4e177bff5edff8122ec73a7ed8f325b42fc74b4 | [
"MIT"
] | 2 | 2020-03-28T15:35:08.000Z | 2021-01-10T06:50:05.000Z | TypesetWidget/cases.cpp | Qt-Widgets/YAWYSIWYGEE-Qt-Equation-Editor-Widget | 040383a8db795bb863c451caf4022018181afaf1 | [
"MIT"
] | null | null | null | TypesetWidget/cases.cpp | Qt-Widgets/YAWYSIWYGEE-Qt-Equation-Editor-Widget | 040383a8db795bb863c451caf4022018181afaf1 | [
"MIT"
] | null | null | null | #include "cases.h"
#include "algorithm.h"
#include "cursor.h"
#include "document.h"
#include "globals.h"
#include <QMenu>
#include <QPainter>
namespace Typeset{
Cases::Cases(const std::vector<SubPhrase*>& data)
: NaryConstruct(data){
Q_ASSERT(data.size()%2 == 0);
Q_ASSERT(data.size() > 0);
updateLayout();
}
void Cases::updateLayout(){
max_val_w = 0;
qreal max_con_w = 0;
for(std::vector<SubPhrase*>::size_type i = 0; i < children.size(); i+=2){
max_val_w = qMax(max_val_w, children[i]->w);
max_con_w = qMax(max_con_w, children[i+1]->w);
}
qreal xc = bracket_width + hspace + max_val_w;
w = xc + max_con_w;
qreal y = 0;
for(std::vector<SubPhrase*>::size_type i = 0; i < children.size(); i+=2){
qreal u = qMax(children[i]->u, children[i+1]->u);
children[i]->setPos(bracket_width + (max_val_w - children[i]->w)/2,
y + u - children[i]->u);
children[i+1]->setPos(xc + (max_con_w - children[i+1]->w)/2,
y + u - children[i+1]->u);
y += vspace + u + qMax(children[i]->d, children[i+1]->d);
}
qreal h = y - vspace;
u = d = h/2;
}
Text* Cases::textUp(const SubPhrase* caller, qreal x) const{
major_integer i = caller->child_id;
return (i > 1) ? Algorithm::textAtSetpoint(*children[i-2], x) : prev;
}
Text* Cases::textDown(const SubPhrase* caller, qreal x) const{
major_integer i = caller->child_id + 2;
return (i < children.size()) ? Algorithm::textAtSetpoint(*children[i], x) : next;
}
void Cases::populateMenu(QMenu& menu, const SubPhrase* caller){
if(caller == nullptr){
Construct::populateMenu(menu);
return;
}
active = caller->child_id;
menu.addSeparator();
QAction* createRowBelow = menu.addAction("Conditional Value: Create row below");
QAction* createRowAbove = menu.addAction("Conditional Value: Create row above");
QAction* deleteRow = menu.addAction("Conditional Value: Delete row");
connect(createRowBelow, SIGNAL(triggered()), this, SLOT(createRowBelow()));
connect(createRowAbove, SIGNAL(triggered()), this, SLOT(createRowAbove()));
connect(deleteRow, SIGNAL(triggered()), this, SLOT(deleteRow()));
deleteRow->setEnabled(children.size() > 2);
}
void Cases::write(QTextStream& out) const{
out << ESCAPE << "c";
for(SubPhrase* c : children) c->write(out);
}
void Cases::paint(QPainter* painter, const QStyleOptionGraphicsItem* options, QWidget*){
setupPainter(painter, options);
painter->drawArc(QRectF(bwh,0,bwh,u), 90*16, 90*16);
painter->drawArc(QRectF(0,0,bwh,u), 270*16, 90*16);
painter->drawArc(QRectF(0,u,bwh,u), 0*16, 90*16);
painter->drawArc(QRectF(bwh,u,bwh,u), 180*16, 90*16);
qreal x = bracket_width + 2 + max_val_w;
qreal y = -7;
for(std::vector<SubPhrase*>::size_type i = 0; i < children.size(); i+=2){
y += qMax(children[i]->u, children[i+1]->u) + qMax(children[i]->d, children[i+1]->d);
painter->drawText(QPointF(x, y), ",");
y += vspace;
}
}
void Cases::insertRow(major_integer row, SubPhrase* first, SubPhrase* second){
children.resize(children.size() + 2);
for(major_integer i = static_cast<major_integer>(children.size()-1); i > 2*row+1; i--){
children[i] = children[i-2];
children[i]->child_id = i;
}
children[2*row] = first;
children[2*row + 1] = second;
first->show();
second->show();
first->child_id = 2*row;
second->child_id = 2*row + 1;
updateToTop();
}
void Cases::removeRow(major_integer row){
children[2*row]->hide();
children[2*row+1]->hide();
for(major_integer i = 2*row+2; i < children.size(); i++){
children[i-2] = children[i];
children[i]->child_id = i-2;
}
children.resize(children.size() - 2);
updateToTop();
}
void Cases::createRowBelow(){
typesetDocument()->undo_stack->push( new AddRow(*this, active/2+1 ) );
}
void Cases::createRowAbove(){
typesetDocument()->undo_stack->push( new AddRow(*this, active/2 ) );
}
void Cases::deleteRow(){
typesetDocument()->undo_stack->push( new RemoveRow(*this, active/2 ) );
}
Cases::AddRow::AddRow(Cases& c, major_integer row)
: c(c),
row(row) {
uint8_t script_level = c.children.front()->front->getScriptLevel();
for(std::vector<SubPhrase*>::size_type i = 0; i < 2; i++){
Text* t = new Text(script_level);
t->next = t->prev = nullptr;
data.push_back( new SubPhrase(t) );
data[i]->setParentConstruct(c);
}
}
Cases::AddRow::~AddRow(){
if(active) return;
for(SubPhrase* datum : data) datum->deletePostorder();
}
void Cases::AddRow::redo(){
active = true;
c.insertRow(row, data[0], data[1]);
}
void Cases::AddRow::undo(){
active = false;
c.removeRow(row);
}
Cases::RemoveRow::RemoveRow(Cases& c, major_integer row)
: c(c),
row(row) {
major_integer start = 2*row;
for(std::vector<SubPhrase*>::size_type i = start; i < start + 2; i++)
data.push_back(c.children[i]);
}
Cases::RemoveRow::~RemoveRow(){
if(!active) return;
for(SubPhrase* datum : data) datum->deletePostorder();
}
void Cases::RemoveRow::redo(){
active = true;
c.removeRow(row);
}
void Cases::RemoveRow::undo(){
active = false;
c.insertRow(row, data[0], data[1]);
}
}
| 28.193717 | 93 | 0.614299 | [
"vector"
] |
fe13ee7460a3b1550916e8127c8030f02b2d7e18 | 10,794 | cpp | C++ | kdesktop-src/kdesktop/kdesktop/ble2.cpp | freeors/kDesktop | 1e10e1199525ca2e3491dd10290d266544961fe3 | [
"BSD-2-Clause"
] | null | null | null | kdesktop-src/kdesktop/kdesktop/ble2.cpp | freeors/kDesktop | 1e10e1199525ca2e3491dd10290d266544961fe3 | [
"BSD-2-Clause"
] | null | null | null | kdesktop-src/kdesktop/kdesktop/ble2.cpp | freeors/kDesktop | 1e10e1199525ca2e3491dd10290d266544961fe3 | [
"BSD-2-Clause"
] | 3 | 2021-03-01T11:15:31.000Z | 2021-06-27T15:17:52.000Z | /* $Id: title_screen.cpp 48740 2011-03-05 10:01:34Z mordante $ */
/*
Copyright (C) 2008 - 2011 by Mark de Wever <koraq@xs4all.nl>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY.
See the COPYING file for more details.
*/
#define GETTEXT_DOMAIN "kdesktop-lib"
#include "ble2.hpp"
#include <time.h>
#include "gettext.hpp"
#include "help.hpp"
#include "filesystem.hpp"
#include "sound.hpp"
#include "wml_exception.hpp"
#include <iomanip>
using namespace std::placeholders;
#include <algorithm>
#include "base_instance.hpp"
enum {atyle_none, atype_playback, atype_apns};
static int alert_type = atype_playback;
#define MAX_RESERVE_TEMPS 6
#define RESERVE_FILE_DATA_LEN (sizeof(ttemperature) * MAX_RESERVE_TEMPS)
#define THRESHOLD_HDERR_REF 5
#define RESISTANCE_OUTRANDE UINT16_MAX
const char* tble2::uuid_my_service = "fd00";
const char* tble2::uuid_write_characteristic = "fd01";
const char* tble2::uuid_notify_characteristic = "fd03";
bool tble2::tether3elem::valid() const
{
return ipv4 != 0 && prefixlen >= 1 && prefixlen <= 31 && gateway != 0 && utils::is_same_net(ipv4, gateway, prefixlen);
}
bool tble2::is_discovery_name(const SDL_BlePeripheral& peripheral)
{
if (game_config::os != os_windows) {
if (peripheral.manufacturer_data_len < 2) {
return false;
}
const uint16_t launcher_manufacturer_id_ = 65520; // 0xfff0 ==> (xmit)f0 ff
if (peripheral.manufacturer_data[0] != posix_lo8(launcher_manufacturer_id_) || peripheral.manufacturer_data[1] != posix_hi8(launcher_manufacturer_id_)) {
return false;
}
}
const std::string lower_name = utils::lowercase(peripheral.name);
if (lower_name.empty()) {
return false;
}
// rdpd, rk3399(ios)
if (game_config::os != os_ios) {
return !strcmp(lower_name.c_str(), "rdpd");
} else {
return !strcmp(lower_name.c_str(), "rdpd") || !strcmp(lower_name.c_str(), "rk3399");
}
}
void fill_interval_fields(uint8_t* data, int normal_interval, int fast_interval, int fast_perieod)
{
data[0] = posix_lo8(normal_interval);
data[1] = posix_hi8(normal_interval);
data[2] = posix_lo8(fast_interval);
data[3] = posix_hi8(fast_interval);
data[4] = posix_lo8(fast_perieod);
data[5] = posix_hi8(fast_perieod);
}
tble2::tble2(base_instance* instance)
: tble(instance, connector_)
, status_(nposm)
, plugin_(NULL)
, buf_(true)
{
buf_.set_did_read(std::bind(&tble2::did_read_ble, this, _1, _2, _3));
disable_reconnect_ = true;
uint8_t data[6];
{
ttask& task = insert_task(taskid_postready);
// step0: notify read
task.insert(nposm, uuid_my_service, uuid_notify_characteristic, option_notify);
}
{
ttask& task = insert_task(taskid_queryip);
// step0: set time
task.insert(nposm, uuid_my_service, uuid_write_characteristic, option_write, data, 6);
}
{
ttask& task = insert_task(taskid_updateip);
// step0: set time
task.insert(nposm, uuid_my_service, uuid_write_characteristic, option_write, data, 6);
}
{
ttask& task = insert_task(taskid_connectwifi);
// step0: set time
task.insert(nposm, uuid_my_service, uuid_write_characteristic, option_write, data, 6);
}
{
ttask& task = insert_task(taskid_removewifi);
// step0: set time
task.insert(nposm, uuid_my_service, uuid_write_characteristic, option_write, data, 6);
}
{
ttask& task = insert_task(taskid_refreshwifilist);
// step0: set time
task.insert(nposm, uuid_my_service, uuid_write_characteristic, option_write, data, 6);
}
}
tble2::~tble2()
{
}
void tble2::disconnect_with_disable_reconnect()
{
mac_addr_.clear();
connector_.clear();
disconnect_peripheral();
}
void tble2::connect_wifi(const std::string& ssid, const std::string& password)
{
VALIDATE(!ssid.empty() && !password.empty(), null_str);
VALIDATE(status_ == status_updateip, null_str);
tuint8data data;
buf_.form_connectwifi_req(ssid, password, data);
tble::ttask& task = get_task(taskid_connectwifi);
tstep& step = task.get_step(0);
step.set_data(data.ptr, data.len);
if (game_config::os != os_windows) {
task.execute(*this);
}
}
void tble2::remove_wifi(const std::string& ssid)
{
VALIDATE(!ssid.empty(), null_str);
VALIDATE(status_ == status_updateip, null_str);
tuint8data data;
buf_.form_removewifi_req(ssid, data);
tble::ttask& task = get_task(taskid_removewifi);
tstep& step = task.get_step(0);
step.set_data(data.ptr, data.len);
if (game_config::os != os_windows) {
task.execute(*this);
}
}
void tble2::refresh_wifi()
{
VALIDATE(status_ == status_updateip, null_str);
tuint8data data;
buf_.form_send_packet(msg_wifilist_req, nullptr, 0, data);
tble::ttask& task = get_task(taskid_refreshwifilist);
tstep& step = task.get_step(0);
step.set_data(data.ptr, data.len);
if (game_config::os != os_windows) {
task.execute(*this);
}
}
void tble2::app_calculate_mac_addr(SDL_BlePeripheral& peripheral)
{
if (peripheral.manufacturer_data && peripheral.manufacturer_data_len >= 8) {
int start = 2;
if (peripheral.manufacturer_data_len > 8) {
unsigned char flag = peripheral.manufacturer_data[2];
if (flag & 0x1) {
start = 8;
} else {
start = 3;
}
}
peripheral.mac_addr[0] = peripheral.manufacturer_data[start];
peripheral.mac_addr[1] = peripheral.manufacturer_data[start + 1];
peripheral.mac_addr[2] = peripheral.manufacturer_data[start + 2];
peripheral.mac_addr[3] = peripheral.manufacturer_data[start + 3];
peripheral.mac_addr[4] = peripheral.manufacturer_data[start + 4];
peripheral.mac_addr[5] = peripheral.manufacturer_data[start + 5];
} else {
peripheral.mac_addr[0] = '\0';
}
}
void tble2::app_discover_peripheral(SDL_BlePeripheral& peripheral)
{
if (!connector_.valid() && !connecting_peripheral_ && !peripheral_ && mac_addr_equal(mac_addr_.mac_addr, peripheral.mac_addr) && is_discovery_name(peripheral)) {
connect_peripheral(peripheral);
}
if (plugin_) {
plugin_->did_discover_peripheral(peripheral);
}
}
void tble2::app_release_peripheral(SDL_BlePeripheral& peripheral)
{
if (plugin_) {
plugin_->did_release_peripheral(peripheral);
}
}
bool tble2::is_right_services()
{
// even thouth this peripheral has 3 service, but for ios, only can discover 1 service.
// if (peripheral_->valid_services != 3) {
if (peripheral_->valid_services == 0) {
return false;
}
const SDL_BleService* my_service = nullptr;
for (int n = 0; n < peripheral_->valid_services; n ++) {
const SDL_BleService& service = peripheral_->services[n];
if (SDL_BleUuidEqual(service.uuid, uuid_my_service)) {
my_service = &service;
}
}
if (my_service == nullptr) {
return false;
}
if (my_service->valid_characteristics != 3) {
return false;
}
std::vector<std::string> chars;
chars.push_back(uuid_write_characteristic);
chars.push_back(uuid_notify_characteristic);
for (std::vector<std::string>::const_iterator it = chars.begin(); it != chars.end(); ++ it) {
int n = 0;
for (; n < my_service->valid_characteristics; n ++) {
const SDL_BleCharacteristic& char2 = my_service->characteristics[n];
if (SDL_BleUuidEqual(char2.uuid, it->c_str())) {
break;
}
}
if (n == my_service->valid_characteristics) {
return false;
}
}
return true;
}
void tble2::app_connect_peripheral(SDL_BlePeripheral& peripheral, const int error)
{
if (!error) {
SDL_Log("tble2::app_connect_peripheral, will execute task#%i", taskid_postready);
tble::ttask& task = get_task(taskid_postready);
task.execute(*this);
}
if (plugin_) {
plugin_->did_connect_peripheral(peripheral, error);
}
}
void tble2::app_disconnect_peripheral(SDL_BlePeripheral& peripheral, const int error)
{
if (plugin_) {
plugin_->did_disconnect_peripheral(peripheral, error);
}
}
void tble2::app_discover_characteristics(SDL_BlePeripheral& peripheral, SDL_BleService& service, const int error)
{
if (plugin_) {
plugin_->did_discover_characteristics(peripheral, service, error);
}
}
void tble2::app_read_characteristic(SDL_BlePeripheral& peripheral, SDL_BleCharacteristic& characteristic, const unsigned char* data, int len)
{
VALIDATE(peripheral_ == &peripheral, null_str);
if (SDL_BleUuidEqual(characteristic.uuid, uuid_notify_characteristic) && plugin_ != nullptr) {
buf_.enqueue(data, len);
}
}
void tble2::did_read_ble(int cmd, const uint8_t* data, int len)
{
// std::string str = rtc::hex_encode((const char*)data, len);
// SDL_Log("%u tble2::did_read_ble, %s", SDL_GetTicks(), str.c_str());
SDL_BlePeripheral& peripheral = *peripheral_;
if (cmd == msg_queryip_resp) {
tblebuf::tqueryip_resp resp = buf_.parse_queryip_resp(data, len);
plugin_->did_query_ip(peripheral, resp);
} else if (cmd == msg_wifilist_resp) {
if (status_ == status_updateip) {
plugin_->did_recv_wifilist(peripheral, data, len);
}
}
}
void tble2::app_write_characteristic(SDL_BlePeripheral& peripheral, SDL_BleCharacteristic& characteristic, const int error)
{
if (plugin_) {
plugin_->did_write_characteristic(peripheral, characteristic, error);
}
}
void tble2::app_notify_characteristic(SDL_BlePeripheral& peripheral, SDL_BleCharacteristic& characteristic, const int error)
{
if (plugin_) {
plugin_->did_notify_characteristic(peripheral, characteristic, error);
}
}
bool tble2::app_task_callback(ttask& task, int step_at, bool start)
{
SDL_Log("tble2::app_task_callback--- task#%i, step_at: %i, %s, current_step_: %i", task.id(), step_at, start? "prefix": "postfix", current_step_);
if (start) {
if (task.id() == taskid_queryip) {
if (step_at == 0) {
tstep& step = task.get_step(0);
tuint8data data;
buf_.form_queryip_req(data);
step.set_data(data.ptr, data.len);
}
} else if (task.id() == taskid_updateip) {
if (step_at == 0) {
tstep& step = task.get_step(0);
tuint8data data;
buf_.form_send_packet(msg_updateip_req, nullptr, 0, data);
step.set_data(data.ptr, data.len);
}
}
} else {
if (task.id() == taskid_postready) {
if (step_at == (int)(task.steps().size() - 1)) {
if (plugin_ != nullptr) {
plugin_->did_start_queryip(*peripheral_);
}
int taskid = nposm;
if (status_ == status_queryip) {
taskid = taskid_queryip;
} else if (status_ == status_updateip) {
taskid = taskid_updateip;
} else {
VALIDATE(false, null_str);
}
tble::ttask& task = get_task(taskid);
task.execute(*this);
}
}
}
return true;
}
| 27.819588 | 166 | 0.704929 | [
"vector"
] |
fe191f4854a5ff9df186d9291456e09e446cff81 | 1,144 | hpp | C++ | aslam_optimizer/aslam_backend/include/aslam/backend/sparse_matrix_functions.hpp | mmmspatz/kalibr | e2e881e5d25d378f0c500c67e00532ee1c1082fd | [
"BSD-4-Clause"
] | null | null | null | aslam_optimizer/aslam_backend/include/aslam/backend/sparse_matrix_functions.hpp | mmmspatz/kalibr | e2e881e5d25d378f0c500c67e00532ee1c1082fd | [
"BSD-4-Clause"
] | null | null | null | aslam_optimizer/aslam_backend/include/aslam/backend/sparse_matrix_functions.hpp | mmmspatz/kalibr | e2e881e5d25d378f0c500c67e00532ee1c1082fd | [
"BSD-4-Clause"
] | null | null | null | #ifndef ASLAM_BACKEND_SPARSE_MATRIX_FUNCTIONS_HPP
#define ASLAM_BACKEND_SPARSE_MATRIX_FUNCTIONS_HPP
#include <sparse_block_matrix/linear_solver.h>
#include <boost/shared_ptr.hpp>
#include <eigen3/Eigen/Dense>
namespace aslam {
namespace backend {
void applySchurComplement(sparse_block_matrix::SparseBlockMatrix<Eigen::MatrixXd>& H,
const Eigen::VectorXd& e,
double lambda,
int marginalizedStartingBlock,
bool doLevenberg,
sparse_block_matrix::SparseBlockMatrix<Eigen::MatrixXd>& A,
std::vector<Eigen::MatrixXd>& invVi,
Eigen::VectorXd& b);
void buildDsi(int i,
sparse_block_matrix::SparseBlockMatrix<Eigen::MatrixXd>& H,
const Eigen::VectorXd& e, int marginalizedStartingBlock, const Eigen::MatrixXd& invVi,
const Eigen::VectorXd& dx, Eigen::VectorXd& outDsi);
} // namespace backend
} // namespace aslam
#endif /* ASLAM_BACKEND_SPARSE_MATRIX_FUNCTIONS_HPP */
| 38.133333 | 104 | 0.613636 | [
"vector"
] |
fe1cc3414fc7299d0041a668f98a9cb99b7299e6 | 3,729 | hpp | C++ | sdk/include/xfControl.hpp | qianxj/XExplorer | 00e326da03ffcaa21115a2345275452607c6bab5 | [
"MIT"
] | null | null | null | sdk/include/xfControl.hpp | qianxj/XExplorer | 00e326da03ffcaa21115a2345275452607c6bab5 | [
"MIT"
] | null | null | null | sdk/include/xfControl.hpp | qianxj/XExplorer | 00e326da03ffcaa21115a2345275452607c6bab5 | [
"MIT"
] | null | null | null | #pragma once
#include "xfnode.hpp"
#include "xfwinbase.hpp"
namespace Hxsoft{ namespace XFrame
{
typedef struct tagBindControl
{
UINT key;
LPTSTR name;
UINT fireEvent;
}TBindControl;
class XFRAME_API xfControl :
public xfWinbase
{
public:
xfControl(void);
~xfControl(void);
public:
xfNode * m_pxfNode;
xfNode * GetXfNode(){ return m_pxfNode;}
bool SetXfNode(xfNode * pNode){ m_pxfNode = pNode; return true;}
public:
DWORD m_dwExStyle;
DWORD m_dwStyle;
LPTSTR m_pszWinClass;
bool m_bMdiClient;
public:
virtual HWND CreateControl(LPTSTR pszWndTitle, RECT & rtPos, HWND hWndParent, UINT uID,HINSTANCE hInstance,HMENU hMenu = NULL,LPVOID lpParam = NULL);
virtual void Initial();
virtual void Initial(IXMLDOMElement *pElement);
public:
bool m_bTransparent;
public:
virtual int DoDraw(HDC hPaintDC,RECT * pDrawRect = NULL)=0;
RECT m_DrawRect;
public:
virtual int AdjustControlRect(RECT rect,bool redraw = true);
public:
void SwitchLayer(LPTSTR pStrLayerSheet =NULL,LPTSTR pStrLayerFrame=NULL);
public:
virtual class xfWin* GetWin();
public:
virtual int ControlCreated();
public:
bool EvtLButton(TEvent * pEvent,LPARAM lPara);
public:
std::vector<xbObserver *> * m_pObservers;
int AddObserver(xbObserver * pObservers);
int RemoveObserver(xbObserver * pObservers);
int ClearObserver();
public:
virtual int OnClose();
public:
virtual xbObject * GetInterface();
public:
bool SetLayerFlow(LPCTSTR pFlow,bool bRedraw);
public:
virtual xbObject * QueryItem(LPTSTR pItem){return NULL;}
public:
virtual SIZE GetContentExtent();
//data bind operate
private:
struct TBindDataCall
{
int getdata;
int getdata1;
int datachanged;
int datachanged1;
int insertrow;
int insertrow1;
int deleterow;
int deleterow1;
int rowcount;
int rowchanged;
int remove;
};
struct TBindData
{
int vc;
int tk;
wchar_t* root;
int hrow;
int hcol;
int getdata;
int getdata1;
int datachanged;
int datachanged1;
int insertrow;
int insertrow1;
int deleterow;
int deleterow1;
int rowcount;
int rowchanged;
int remove;
TBindData();
};
TBindData * m_pBindData;
public:
bool hasBindData();
int BindDataVC();
public:
int bindData(void * pcall,int vc,int tk);
int bindData(void * pcall,int vc,int tk,const wchar_t* root);
private:
int manageCall(void * context, void * p, int fn);
public:
int bindNotifyDataChanged(wchar_t* path,int row,wchar_t* col, wchar_t* data);
int bindNotifyDataChanged(wchar_t* path,wchar_t* id,wchar_t* col, wchar_t* data);
int bindNotifyInsertRow(wchar_t* path,int row);
int bindNotifyInsertRow(wchar_t* path,wchar_t *id);
int bindNotifyDeleteRow(wchar_t* path,int row);
int bindNotifyDeleteRow(wchar_t* path,wchar_t *id);
int bindNotifyGetRowCount(wchar_t* path);
int bindNotifyRowChanged(wchar_t* path,int row);
int bindNotifyRemove();
public:
wchar_t* bindGetData(wchar_t* path, int row, wchar_t*col);
wchar_t* bindGetData(wchar_t* path, wchar_t* id, wchar_t*col);
public:
virtual int bindUpdateDataChanged(wchar_t* path,int row,wchar_t* col, wchar_t* data);
virtual int bindUpdateInsertRow(wchar_t* path,int row);
virtual int bindUpdateDeleteRow(wchar_t* path,int row);
virtual int bindUpdateDataChanged(wchar_t* path,wchar_t* id,wchar_t* col, wchar_t* data);
virtual int bindUpdateInsertRow(wchar_t* path,wchar_t* id);
virtual int bindUpdateDeleteRow(wchar_t* path,wchar_t* id);
public:
virtual int addBindControl(UINT key, LPTSTR name, UINT ev=0x202);
virtual int fireBindControl(UINT key);
vector<TBindControl> *m_BindControl;
virtual bool EvtKeyDown(TEvent * pEvent, LPARAM lParam);
};
}} | 26.827338 | 152 | 0.731295 | [
"vector"
] |
fe29671ec1d3501f3a05274bf303de9ad93a90e7 | 8,724 | hpp | C++ | maylee/include/maylee/syntax/syntax_parser.hpp | eidolonsystems/maylee | a0a2e94bdc8543f88e428bee53b83db7a4bca0c0 | [
"MIT"
] | null | null | null | maylee/include/maylee/syntax/syntax_parser.hpp | eidolonsystems/maylee | a0a2e94bdc8543f88e428bee53b83db7a4bca0c0 | [
"MIT"
] | null | null | null | maylee/include/maylee/syntax/syntax_parser.hpp | eidolonsystems/maylee | a0a2e94bdc8543f88e428bee53b83db7a4bca0c0 | [
"MIT"
] | null | null | null | #ifndef MAYLEE_SYNTAX_PARSER_HPP
#define MAYLEE_SYNTAX_PARSER_HPP
#include <deque>
#include <memory>
#include <optional>
#include <string>
#include <type_traits>
#include <vector>
#include "maylee/lexicon/token.hpp"
#include "maylee/syntax/expression.hpp"
#include "maylee/syntax/statement.hpp"
#include "maylee/syntax/syntax_error_code.hpp"
#include "maylee/syntax/syntax_error.hpp"
#include "maylee/syntax/syntax.hpp"
#include "maylee/syntax/syntax_node.hpp"
#include "maylee/syntax/terminal_node.hpp"
#include "maylee/syntax/token_iterator.hpp"
#include "maylee/syntax/unmatched_bracket_syntax_error.hpp"
namespace maylee {
//! Parses syntax nodes from tokens.
class syntax_parser {
public:
//! Constructs a default syntax parser.
syntax_parser() = default;
//! Feeds this parser a token.
/*!
\param t The token to feed.
*/
void feed(token t);
//! Returns an iterator to the next terminal token.
token_iterator get_next_terminal() const;
//! Parses the next syntax node.
/*!
\return The syntax node parsed from the previously fed tokens or
<code>nullptr</code> iff no syntax node is available.
*/
std::unique_ptr<syntax_node> parse_node();
private:
std::vector<token> m_tokens;
token_iterator m_cursor;
syntax_parser(const syntax_parser&) = delete;
syntax_parser& operator =(const syntax_parser&) = delete;
token_iterator get_next_terminal(token_iterator cursor) const;
std::unique_ptr<syntax_node> parse_node(token_iterator& cursor);
std::unique_ptr<function_definition> parse_function_definition(
token_iterator& cursor);
std::unique_ptr<if_statement> parse_if_statement(token_iterator& cursor);
std::unique_ptr<return_statement> parse_return_statement(
token_iterator& cursor);
std::unique_ptr<terminal_node> parse_terminal_node(
token_iterator& cursor);
std::unique_ptr<statement> parse_statement(token_iterator& cursor);
std::unique_ptr<statement> expect_statement(token_iterator& cursor);
std::unique_ptr<let_expression> parse_let_expression(
token_iterator& cursor);
std::unique_ptr<literal_expression> parse_literal_expression(
token_iterator& cursor);
std::unique_ptr<variable_expression> parse_variable_expression(
token_iterator& cursor);
std::unique_ptr<expression> parse_expression_term(token_iterator& cursor);
std::unique_ptr<expression> parse_expression(token_iterator& cursor);
std::unique_ptr<expression> expect_expression(token_iterator& cursor);
};
//! Parses an identifier from a token stream.
/*!
\param cursor An iterator to the first token to parse.
\return The symbol represented by the parsed identifier.
*/
inline const std::string& parse_identifier(token_iterator& cursor) {
if(cursor.is_empty()) {
throw syntax_error(syntax_error_code::IDENTIFIER_EXPECTED,
cursor.get_location());
}
return std::visit(
[&] (auto&& value) -> const std::string& {
using T = std::decay_t<decltype(value)>;
if constexpr(std::is_same_v<T, identifier>) {
++cursor;
return value.get_symbol();
}
throw syntax_error(syntax_error_code::IDENTIFIER_EXPECTED,
cursor.get_location());
},
cursor->get_instance());
}
//! Parses an identifier from a token stream.
/*!
\param cursor An iterator to the first token to parse.
\return The symbol represented by the parsed identifier.
*/
inline std::optional<std::string> try_parse_identifier(
token_iterator& cursor) {
try {
return parse_identifier(cursor);
} catch(const syntax_error&) {
return std::nullopt;
}
}
//! Tests if a token represents the end of a syntax node, this happens if
//! a token is a new line, end of file, a colon, or keywords end/else/else if.
/*!
\param t The token to test.
\return <code>true</code> iff <i>t</i> ends a syntax node.
*/
inline bool is_syntax_node_end(const token& t) {
return is_terminal(t) || match(t, punctuation::mark::COLON) ||
match(t, keyword::word::END) || match(t, keyword::word::ELSE) ||
match(t, keyword::word::ELSE_IF);
}
//! Ensures that the token represented by an iterator is equal to some other
//! token, throwing a syntax_error otherwise.
/*!
\param cursor The iterator to test, this iterator is advanced past the
the location where the expected token is located.
\param t The token to expect.
*/
inline void expect(token_iterator& cursor, const token::instance& t) {
auto c = cursor;
while(!c.is_empty() && match(*c, terminal::type::new_line)) {
++c;
}
if(c.is_empty() || c->get_instance() != t) {
std::visit(
[&] (auto&& instance) {
using T = std::decay_t<decltype(instance)>;
if constexpr(std::is_same_v<T, punctuation>) {
if(instance == punctuation::mark::COLON) {
throw syntax_error(syntax_error_code::COLON_EXPECTED,
cursor.get_location());
} else if(instance == punctuation::mark::COMMA) {
throw syntax_error(syntax_error_code::COMMA_EXPECTED,
cursor.get_location());
}
} else if constexpr(std::is_same_v<T, bracket>) {
if(instance == bracket::type::OPEN_ROUND_BRACKET) {
throw syntax_error(syntax_error_code::OPEN_ROUND_BRACKET_EXPECTED,
cursor.get_location());
}
} else if constexpr(std::is_same_v<T, operation>) {
if(instance == operation::symbol::ASSIGN) {
throw syntax_error(syntax_error_code::ASSIGNMENT_EXPECTED,
cursor.get_location());
}
}
}, t);
}
++c;
cursor = c;
}
inline void syntax_parser::feed(token t) {
auto position = &*m_cursor - m_tokens.data();
m_tokens.push_back(std::move(t));
m_cursor.adjust(m_tokens.data() + position,
m_cursor.get_size_remaining() + 1);
}
inline token_iterator syntax_parser::get_next_terminal() const {
return get_next_terminal(m_cursor);
}
inline std::unique_ptr<syntax_node> syntax_parser::parse_node() {
return parse_node(m_cursor);
}
inline token_iterator syntax_parser::get_next_terminal(
token_iterator cursor) const {
if(cursor.is_empty() || is_terminal(*cursor)) {
return cursor;
}
auto c = cursor;
if(match(*c, punctuation::mark::COLON)) {
++c;
while(true) {
c = get_next_terminal(c);
if(c.is_empty()) {
return cursor;
}
if(match(*c, keyword::word::END)) {
++c;
return c;
}
++c;
}
}
if(match(*c, keyword::word::END) ||
match(*c, keyword::word::ELSE) ||
match(*c, keyword::word::ELSE_IF)) {
return c;
}
auto is_symbol = std::visit(
[&] (auto&& t) {
using T = std::decay_t<decltype(t)>;
if constexpr(std::is_same_v<T, identifier> ||
std::is_same_v<T, keyword> ||
std::is_same_v<T, literal> ||
std::is_same_v<T, punctuation>) {
return true;
}
return false;
}, c->get_instance());
if(is_symbol) {
++c;
return get_next_terminal(c);
}
if(std::get_if<operation>(&c->get_instance())) {
++c;
if(c.is_empty()) {
return cursor;
}
if(match(*c, terminal::type::new_line)) {
++c;
}
return get_next_terminal(c);
}
if(auto open_bracket = std::get_if<bracket>(&c->get_instance())) {
if(!is_open(*open_bracket)) {
return c;
}
auto l = c.get_location();
++c;
auto end = get_next_terminal(c);
if(end.is_empty()) {
return cursor;
}
auto close_bracket = std::get_if<bracket>(&end->get_instance());
if(close_bracket == nullptr ||
get_opposite(*close_bracket) != *open_bracket) {
throw unmatched_bracket_syntax_error(l, *open_bracket);
}
++end;
return get_next_terminal(end);
}
return cursor;
}
inline std::unique_ptr<syntax_node> syntax_parser::parse_node(
token_iterator& cursor) {
if(auto node = parse_statement(cursor)) {
if(!cursor.is_empty() && match(*cursor, terminal::type::new_line)) {
++cursor;
}
return node;
} else if(auto node = parse_terminal_node(cursor)) {
return node;
}
return nullptr;
}
}
#include "syntax_parser_expressions.hpp"
#include "syntax_parser_statements.hpp"
#endif
| 32.796992 | 80 | 0.632279 | [
"vector"
] |
fe329c5e147e18480bf8c093d8118f8b3991289d | 15,395 | cpp | C++ | src/geometry/shapes2/VoxelGrid.cpp | ShnitzelKiller/Reverse-Engineering-Carpentry | 585b5ff053c7e3bf286b663a584bc83687691bd6 | [
"MIT"
] | 3 | 2021-09-08T07:28:13.000Z | 2022-03-02T21:12:40.000Z | src/geometry/shapes2/VoxelGrid.cpp | ShnitzelKiller/Reverse-Engineering-Carpentry | 585b5ff053c7e3bf286b663a584bc83687691bd6 | [
"MIT"
] | 1 | 2021-09-21T14:40:55.000Z | 2021-09-26T01:19:38.000Z | src/geometry/shapes2/VoxelGrid.cpp | ShnitzelKiller/Reverse-Engineering-Carpentry | 585b5ff053c7e3bf286b663a584bc83687691bd6 | [
"MIT"
] | null | null | null | //
// Created by James Noeckel on 4/2/20.
//
#include "VoxelGrid.hpp"
#include <unordered_map>
#include <utility>
#include "utils/IntervalTree.h"
#include "utils/sorted_data_structures.hpp"
#define BISECTION_STEPS 5
using namespace Eigen;
static const std::vector<std::vector<std::pair<int, int>>> database =
{{},
{{3, 0}},
{{0, 1}},
{{3, 1}},
{{1, 2}},
{{1, 0}, {3, 2}},
{{0, 2}},
{{3, 2}},
{{2, 3}},
{{2, 0}},
{{2, 1}, {0, 3}},
{{2, 1}},
{{1, 3}},
{{1, 0}},
{{0, 3}},
{}};
void VoxelGrid2D::set_resolution(double grid_spacing, int max_resolution, const Eigen::Vector2d &minPt, const Eigen::Vector2d &maxPt, bool clear) {
Eigen::Array2d dims = maxPt - minPt;
if (grid_spacing <= 0) {
grid_spacing = dims.maxCoeff() / max_resolution;
}
res_ = (dims / grid_spacing).ceil().cast<int>();
int ind;
int biggest_res = res_.maxCoeff(&ind);
if (biggest_res > max_resolution) {
grid_spacing = dims[ind] / max_resolution;
res_ = (dims / grid_spacing).ceil().cast<int>();
}
spacing_ = grid_spacing;
if (clear) {
data_.resize(res_.prod(), 0.0f);
} else {
data_.resize(res_.prod());
}
if (res_.x() < 0) res_.x() = 0;
if (res_.y() < 0) res_.y() = 0;
}
VoxelGrid2D::VoxelGrid2D(const std::vector<std::pair<Eigen::Vector2d, Eigen::Vector2d>> &edges, double grid_spacing,
int max_resolution) : min_value_(0.0f) {
IntervalTree<double, Interval<double>> tree;
std::vector<std::pair<Interval<double>, Interval<double>>> intervals;
minPt_ = Eigen::Vector2d(std::numeric_limits<double>::max(), std::numeric_limits<double>::max());
Eigen::Vector2d maxPt(std::numeric_limits<double>::lowest(), std::numeric_limits<double>::lowest());
for (const auto & edge : edges) {
double a = edge.first.x();
double b = edge.second.x();
if (a == b) continue;
double depth1 = edge.first.y();
double depth2 = edge.second.y();
if (b < a) {
std::swap(a, b);
std::swap(depth1, depth2);
}
intervals.emplace_back(Interval<double>(a, b), Interval<double>(depth1, depth2));
minPt_ = minPt_.cwiseMin(edge.first);
minPt_ = minPt_.cwiseMin(edge.second);
maxPt = maxPt.cwiseMax(edge.first);
maxPt = maxPt.cwiseMax(edge.second);
}
tree.build(intervals.begin(), intervals.end());
set_resolution(grid_spacing, max_resolution, minPt_, maxPt, false);
for (size_t i=0; i<res_.y(); i++) {
for (size_t j=0; j<res_.x(); j++) {
double pos = minPt_.x() + (0.5 + j) * grid_spacing;
double depth = minPt_.y() + (0.5 + i) * grid_spacing;
auto result = tree.query(pos);
int crossings = 0;
for (const auto& pair : result) {
double real_depth =
(pos - pair.first.start) / (pair.first.end - pair.first.start) *
(pair.second.end - pair.second.start) + pair.second.start;
if (real_depth >= depth) {
crossings++;
}
}
data_[i * res_.x() + j] = crossings % 2 == 1 ? 1.0f : 0.0f;
}
}
}
VoxelGrid2D::VoxelGrid2D(const Eigen::Ref<const Eigen::MatrixX2d> &points, double grid_spacing, int max_resolution) : min_value_(0.0f) {
minPt_ = points.colwise().minCoeff().transpose();
Eigen::Vector2d maxPt = points.colwise().maxCoeff().transpose();
set_resolution(grid_spacing, max_resolution, minPt_, maxPt, true);
for (int i=0; i<points.rows(); i++) {
Eigen::Array2i ind = ((points.row(i).transpose()-minPt_).array()/spacing_).floor().cast<int>();
if (ind.x() >= 0 && ind.y() >= 0 && ind.x() < res_.x() && ind.y() < res_.y()) {
data_[ind.y() * res_.x() + ind.x()] += 1.0f;
}
}
}
VoxelGrid2D::VoxelGrid2D(std::vector<double> data, int width, int height, double min_x, double min_y, double spacing)
: spacing_(spacing), minPt_(min_x, min_y), res_(width, height), data_(std::move(data)) {
if (!data_.empty())
min_value_ = *std::min_element(data_.begin(), data_.end());
}
VoxelGrid2D::VoxelGrid2D(ScalarField<2>::Handle field, double min_x, double min_y, double max_x, double max_y, double spacing, int max_resolution)
: spacing_(spacing), minPt_(min_x, min_y), field_(std::move(field)) {
Vector2d maxPt(max_x, max_y);
set_resolution(spacing, max_resolution, minPt_, maxPt, false);
int n = res_.prod();
MatrixX2d Q(n, 2);
for (int i=0; i<res_.y(); ++i) {
for (int j=0; j<res_.x(); ++j) {
Q.row(i * res_.x() + j) = (minPt_.array() + spacing_ * (0.5 + Array2d(j, i))).transpose();
}
}
VectorXd values = (*field_)(Q);
for (int i=0; i<n; ++i) {
data_[i] = values(i);
}
/*for (int i=0; i<height; ++i) {
for (int j=0; j<width; ++j) {
RowVector2d pt = (minPt_.array() + spacing_ * (0.5 + Array2d(j, i))).transpose();
data_[i*width+j] = (*field_)(pt)(0);
}
}*/
}
double VoxelGrid2D::query(const Eigen::Ref<const Eigen::Vector2d> &pt) const {
Eigen::Array2i ind = ((pt-minPt_).array()/spacing_).floor().cast<int>();
if (ind.x() < 0 || ind.y() < 0 || ind.x() >= res_.x() || ind.y() >= res_.y()) {
return min_value_;
} else {
return data_[ind.y() * res_.x() + ind.x()];
}
}
double VoxelGrid2D::query(int row, int col) const {
if (row < 0 || col < 0 || row >= res_.y() || col >= res_.x()) return min_value_;
return data_[row * res_.x() + col];
}
/**
* Compute a unique ID for the edge with the given index in the given marching squares cell.
*
* @param cols number of columns in marching squares grid (1 more than number of columns of data)
* @param index Index of edge within cell. 0 -> bottom, 1 -> right, 2 -> top, 3 -> left
* @return
*/
size_t cell_edge_to_id(size_t row, size_t col, size_t cols, size_t num_horizontal_edges, int index) {
size_t global_edge_id;
if (index == 0) {
size_t cell_id = row * cols + col;
global_edge_id = cell_id;
} else if (index == 1) {
size_t cell_id = row * (cols+1) + col;
global_edge_id = num_horizontal_edges + cell_id + 1;
} else if (index == 2) {
size_t cell_id = row * cols + col;
global_edge_id = cell_id + cols;
} else if (index == 3) {
size_t cell_id = row * (cols+1) + col;
global_edge_id = num_horizontal_edges + cell_id;
} else {
assert(false);
}
return global_edge_id;
}
std::vector<std::vector<Eigen::Vector2d>> VoxelGrid2D::marching_squares(std::vector<std::vector<int>> &hierarchy, double threshold, bool bisect) const {
return marching_squares(hierarchy, true, threshold, bisect);
}
std::vector<std::vector<Eigen::Vector2d>> VoxelGrid2D::marching_squares(double threshold, bool bisect) const {
std::vector<std::vector<int>> hierarchy;
return marching_squares(hierarchy, false, threshold, bisect);
}
std::vector<std::vector<Eigen::Vector2d>>
VoxelGrid2D::marching_squares(std::vector<std::vector<int>> &hierarchy, bool compute_hierarchy, double threshold, bool bisect) const {
//default threshold: sort data values, and find the median in the range after the first non-minimum value as the max density,
//then take the midpoint between the min and max density.
if (!std::isfinite(threshold)) {
std::vector<int> indices(data_.size());
std::iota(indices.begin(), indices.end(), 0);
std::sort(indices.begin(), indices.end(), [&](int a, int b) {return data_[a] < data_[b];});
double minval = data_[indices[0]];
auto it = std::upper_bound(indices.begin(), indices.end(), minval, [&] (double a, int b) {return a < data_[b];});
if (it != indices.end()) {
/*double median = data_[*(it + std::distance(it, indices.end())/2)];
threshold = 0.5 * (minval + median);*/
double weight = 0.0;
double mean = 0.0;
for (auto it2 = it; it2 != indices.end(); it2++) {
double newweight = weight + 1.0;
mean = (weight * mean + data_[*it2]) / newweight;
weight = newweight;
}
threshold = 0.5 * (minval + mean);
} else {
return {};
}
}
size_t num_horizontal_edges = (res_.x() + 1) * (res_.y() + 2);
size_t num_vertical_edges = (res_.x() + 2) * (res_.y() + 1);
size_t total_edges = num_horizontal_edges + num_vertical_edges;
std::vector<int> edge_to_segment(total_edges, -1);
for (int i=0; i<res_.y()+1; i++) {
for (int j=0; j<res_.x()+1; j++) {
unsigned char index =
(query(i-1, j-1) > threshold ? 1U : 0U) |
((query(i-1, j) > threshold ? 1U : 0U) << 1) |
((query(i, j) > threshold ? 1U : 0U) << 2) |
((query(i, j-1) > threshold ? 1U : 0U) << 3);
std::vector<std::pair<int, int>> cell_edges = database[index];
for (const auto &edge : cell_edges) {
size_t global_edge_id_1 = cell_edge_to_id(i, j, res_.x()+1, num_horizontal_edges, edge.first);
size_t global_edge_id_2 = cell_edge_to_id(i, j, res_.x()+1, num_horizontal_edges, edge.second);
edge_to_segment[global_edge_id_1] = global_edge_id_2;
}
}
}
std::vector<int> edge_to_contour(total_edges, -1);
std::vector<std::vector<Eigen::Vector2d>> contours;
for (size_t loop_base_index = 0; loop_base_index < total_edges; loop_base_index++) {
if (edge_to_segment[loop_base_index] >= 0 && edge_to_contour[loop_base_index] < 0) {
size_t start_index = loop_base_index;
bool closed = false;
contours.emplace_back();
for (size_t i=0; i<total_edges; i++) {
edge_to_contour[start_index] = contours.size()-1;
/** index (x, y) */
Eigen::Array2i indA, indB;
/** axis along which the segment lies, s.t. indA(axis) != indB(axis) */
int axis;
if (start_index >= num_horizontal_edges) {
// vertical segment intersected
axis = 1;
size_t col = (start_index-num_horizontal_edges) % (res_.x() + 2);
size_t row = (start_index-num_horizontal_edges) / (res_.x() + 2);
indA = Eigen::Array2i(col - 1, row - 1);
indB = Eigen::Array2i(col - 1, row);
} else {
// horizontal segment intersected
axis = 0;
size_t col = start_index % (res_.x() + 1);
size_t row = start_index / (res_.x() + 1);
indA = Eigen::Array2i(col - 1, row - 1);
indB = Eigen::Array2i(col, row - 1);
}
double valA = query(indA.y(), indA.x());
double valB = query(indB.y(), indB.x());
if (bisect && field_) {
// bisection in world space
bool switched = valA > valB;
Vector2d ptA = (minPt_.array() + (0.5 + indA.cast<double>()) * spacing_).matrix();
Vector2d ptB = (minPt_.array() + (0.5 + indB.cast<double>()) * spacing_).matrix();
/*if (switched) {
std::swap(ptA, ptB);
}*/
Vector2d midpoint;
midpoint(1-axis) = ptA(1-axis);
midpoint(axis) = 0.5 * (ptA(axis) + ptB(axis));
for (unsigned iter=0; iter<BISECTION_STEPS; ++iter) {
double valMid = (*field_)(midpoint.transpose())(0);
if ((valMid < threshold) ^ switched) {
ptA(axis) = midpoint(axis);
} else {
ptB(axis) = midpoint(axis);
}
midpoint(axis) = 0.5 * (ptA(axis) + ptB(axis));
}
contours.back().emplace_back(std::move(midpoint));
} else {
double weightB = (threshold - valA)/(valB - valA);
Eigen::Vector2d midpointTransformed = (minPt_.array() + (0.5 + (1.0f - weightB) * indA.cast<double>() + weightB * indB.cast<double>()) * spacing_).matrix();
contours.back().emplace_back(std::move(midpointTransformed));
}
start_index = edge_to_segment[start_index];
if (start_index == loop_base_index) {
closed = true;
break;
}
}
assert(closed);
}
}
if (compute_hierarchy) {
hierarchy.clear();
hierarchy.resize(contours.size() + 1);
//traverse scan lines to find hierarchy
std::vector<int> contour_stack = {static_cast<int>(contours.size())};
for (int row = 0; row < res_.y(); row++) {
for (int col = 0; col < res_.x() + 1; col++) {
size_t edge_index = (res_.x() + 1) * (row + 1) + col;
int contour_id = edge_to_contour[edge_index];
if (contour_id >= 0) {
if (contour_id == contour_stack.back()) {
contour_stack.pop_back();
} else {
sorted_insert(hierarchy[contour_stack.back()], contour_id);
contour_stack.push_back(contour_id);
}
}
}
assert(contour_stack.size() == 1);
}
}
return contours;
}
Eigen::Vector2i VoxelGrid2D::resolution() const {
return res_;
}
void VoxelGrid2D::discretize(double threshold) {
field_.reset();
for (int i=0; i<res_.y(); ++i) {
for (int j=0; j<res_.x(); ++j) {
size_t ind = i * res_.x() + j;
data_[ind] = data_[ind] > threshold ? 1 : 0;
}
}
}
void VoxelGrid2D::dilate(double threshold, bool erode, const Eigen::Ref<const Eigen::MatrixXi> &kernel, int centerRow, int centerCol) {
field_.reset();
std::vector<double> newGrid(data_.size());
for (int i=0; i<res_.y(); ++i) {
for (int j=0; j<res_.x(); ++j) {
size_t ind = i * res_.x() + j;
bool contained = erode;
for (int di=0; di<kernel.rows(); ++di) {
for (int dj=0; dj<kernel.cols(); ++dj) {
int pi = i + di - centerRow;
int pj = j + dj - centerCol;
size_t ind2 = pi * res_.x() + pj;
if (kernel(di, dj)) {
if (pi >= 0 && pi < res_.y() && pj >= 0 && pj < res_.x()) {
if (erode ^ (data_[ind2] > threshold)) {
contained = !erode;
break;
}
} else if (erode) contained = false;
}
}
}
newGrid[ind] = contained ? 1 : 0;
}
}
data_ = newGrid;
}
| 41.834239 | 176 | 0.523027 | [
"vector"
] |
fe3979be8eda94f5c0aef4603693a151a0dd737b | 2,817 | cc | C++ | src/IntRank2/CDipT.cc | pygamma-mrs/gamma | c83a7c242c481d2ecdfd49ba394fea3d5816bccb | [
"BSD-3-Clause"
] | 4 | 2021-03-15T10:02:13.000Z | 2022-01-16T11:06:28.000Z | src/IntRank2/CDipT.cc | pygamma-mrs/gamma | c83a7c242c481d2ecdfd49ba394fea3d5816bccb | [
"BSD-3-Clause"
] | 1 | 2022-01-27T15:35:03.000Z | 2022-01-27T15:35:03.000Z | src/IntRank2/CDipT.cc | pygamma-mrs/gamma | c83a7c242c481d2ecdfd49ba394fea3d5816bccb | [
"BSD-3-Clause"
] | null | null | null | #include <gamma.h>
#include <vector>
int main()
{
// This Is A Typical Dipolar Spatial Cartesian Tensor (KHz)
matrix Dmx(3,3,h_matrix_type);
Dmx.put ( 0.79,0,0); Dmx.put_h( 0.00,0,1); Dmx.put_h( 0.00,0,2);
Dmx.put (-1.13,1,1); Dmx.put_h(-0.93,1,2);
Dmx.put ( 0.34,2,2);
// First We Diagonalize It To Determine delzz and eta
// We Must Sort The Diagonal Values So That |Dzz| >= |Dyy| >= |Dxx|
matrix Aeval, Aevec; // Eigvenvalues, Eigenvectors
diag(Dmx, Aeval, Aevec); // Diagonalize Dmx
double Axx = Aeval.getRe(0,0); // Get diagonal Axx
double Ayy = Aeval.getRe(1,1); // Get diagonal Ayy
double Azz = Aeval.getRe(2,2); // Get diagonal Azz
double tmp;
if(fabs(Axx) > fabs(Azz)) { tmp=Azz; Azz=Axx; Axx=tmp; }
if(fabs(Ayy) > fabs(Azz)) { tmp=Azz; Azz=Ayy; Ayy=tmp; }
if(fabs(Ayy) > fabs(Axx)) { tmp=Ayy; Ayy=Axx; Axx=tmp; }
double Aeta = (Axx-Ayy)/Azz;
cout << "\n\n\tCartesian Tensor\n" << Dmx;
cout << "\n\n\tDiagonalized Tensor\n" << Aeval;
cout << "\n\n\tThe trace value is: " << trace(Aeval);
cout << "\n\n\tThe delxx value appears to be: " << Axx;
cout << "\n\n\tThe delyy value appears to be: " << Ayy;
cout << "\n\n\tThe delzz value appears to be: " << Azz;
cout << "\n\n\tThe asymmetry appears to be: " << Aeta;
// Solve For Angle Beta Assuming No Asymmetry
/*
1 2
A = - del [ 3cos (beta) - 1 ]
zz 2 zz
2 1 [ ]
cos (beta) = - | 2A / del + 1 |
3 [ zz zz ] */
double Csqbeta = 2.0*Dmx.getRe(2,2)/Azz + 1.0;
double Cbeta = sqrt(Csqbeta);
double beta = acos(Cbeta);
cout << "\n\tCosine Of Beta Squared Is " << Csqbeta;
cout << "\n\tCosine Of Beta Is " << Cbeta;
cout << "\n\tAngle Beta Determined As " << beta*RAD2DEG << " Degrees";
/*
1
A = - del [ 3sin(alpha)*sin(2beta) ]
yz 4 zz
1 [ ] /
sin(alpha) = - | 4A / del | / sin(2.0*beta)
3 [ yz zz ] / */
double SalphaC2beta3 = 4.0*Dmx.getRe(1,2)/Azz;
double Salpha = (1.0/3.0)*SalphaC2beta3/sin(2.0*beta);
double alpha = asin(Salpha);
cout << "\n\tThree Sin Alpha Cos 2 Beta Is " << SalphaC2beta3;
cout << "\n\tSine Of Alpha Is " << Salpha;
cout << "\n\tAngle Alpha Determined As " << alpha*RAD2DEG << " Degrees";
coord X(Axx, Ayy, Azz);
IntRank2A IR2A(X);
IR2A.printCartesian(cout,alpha*RAD2DEG,beta*RAD2DEG);
}
| 37.56 | 76 | 0.488818 | [
"vector"
] |
fe4031c9ac9d832d1cb79db5350e49e64c83c5b6 | 1,984 | cpp | C++ | src/TileMap.cpp | MartinsLucas/Jogos | e72ac454d19557d3a45211a57e0695bb6c3f104a | [
"MIT"
] | null | null | null | src/TileMap.cpp | MartinsLucas/Jogos | e72ac454d19557d3a45211a57e0695bb6c3f104a | [
"MIT"
] | 7 | 2019-06-06T17:39:10.000Z | 2019-07-17T07:37:55.000Z | src/TileMap.cpp | MartinsLucas/Jogos | e72ac454d19557d3a45211a57e0695bb6c3f104a | [
"MIT"
] | null | null | null | #include "TileMap.h"
#include "Camera.h"
TileMap::TileMap(GameObject &associated, const char *file, TileSet *tileSet) : Component(associated) {
this->Load(file);
this->SetTileSet(tileSet);
}
void TileMap::Load(const char *file) {
ifstream tileMap;
tileMap.open(file);
if(tileMap.good()) {
char comma;
tileMap >> this->mapWidth >> comma;
tileMap >> this->mapHeight >> comma;
tileMap >> this->mapDepth >> comma;
int currentValue = 0;
for (int k = 0 ; k < this->mapDepth ; k++) {
for (int j = 0 ; j < this->mapHeight ; j++) {
for (int i = 0 ; i < this->mapWidth ; i++) {
tileMap >> currentValue >> comma;
this->tileMatrix.emplace_back(currentValue - 1);
}
}
}
} else {
printf("Couldn't open TileMap file!\n");
}
tileMap.close();
}
void TileMap::SetTileSet(TileSet* tileSet) {
this->tileSet = tileSet;
}
void TileMap::RenderLayer(int layer, float cameraX, float cameraY) {
for (int j = 0 ; j < this->mapHeight ; j++) {
for (int i = 0 ; i < this->mapWidth ; i++) {
this->tileSet->RenderTile(
this->At(i, j, layer),
(this->tileSet->GetTileWidth() * i) - cameraX,
(this->tileSet->GetTileHeight() * j) - cameraY
);
}
}
}
void TileMap::Render() {
for (int index = 0; index < this->mapDepth; index++) {
RenderLayer(
index,
Camera::position.x * ( 1 + index * 1.5),
Camera::position.y * ( 1 + index * 1.5)
);
}
}
int TileMap::GetDepth() {
return(this->mapDepth);
}
int TileMap::GetWidth() {
return(this->mapWidth);
}
int TileMap::GetHeight() {
return(this->mapHeight);
}
int& TileMap::At(int i, int j, int k) {
return(this->tileMatrix[i + (j * this->mapWidth) + (k * (this->mapWidth * this->mapHeight))]);
}
void TileMap::Update(float dt) {}
void TileMap::Start() {}
bool TileMap::Is(const char *type) {
if (strcmp(type, "TileMap") == 0) {
return(true);
} else {
return(false);
}
}
| 22.545455 | 102 | 0.581149 | [
"render"
] |
1cfc36143d335afea8d30ccfc498bdaeea805343 | 1,070 | cpp | C++ | HackerRank/map_int_to_string.cpp | przet/CppProgramming | 042aff253988b74db47659d36806912ce84dd8bc | [
"MIT"
] | null | null | null | HackerRank/map_int_to_string.cpp | przet/CppProgramming | 042aff253988b74db47659d36806912ce84dd8bc | [
"MIT"
] | null | null | null | HackerRank/map_int_to_string.cpp | przet/CppProgramming | 042aff253988b74db47659d36806912ce84dd8bc | [
"MIT"
] | null | null | null | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <map>
#include <string>
int main() {
int n = 0;
std::cin >> n;
typedef std::map <int, std::string> Map;
Map m;
m[1] = "one";
m[2] = "two";
m[3] = "three";
m[4] = "four";
m[5] = "five";
m[6] = "six";
m[7] = "seven";
m[8] = "eight";
m[9] = "nine";
if (n<1 | n>pow(10, 9))
return 1;
if (n >= 1 | n <= 9)
{
switch (n)
{
case 1:
std::cout << m.at(1) << std::endl;
break;
case 2:
std::cout << m.at(2)<< std::endl;
break;
case 3:
std::cout << m.at(3)<< std::endl;
break;
case 4:
std::cout << m.at(3)<< std::endl;
break;
case 5:
std::cout << m.at(3)<< std::endl;
break;
case 6:
std::cout << m.at(3)<< std::endl;
break;
case 7:
std::cout << m.at(3)<< std::endl;
break;
case 8:
std::cout << m.at(3)<< std::endl;
break;
case 9:
std::cout << m.at(3)<< std::endl;
break;
default:
break;
}
}
if (n > 9)
std::cout << n << "is greater than 9" << std::endl;
return 0;
} | 15.970149 | 53 | 0.497196 | [
"vector"
] |
1cfc7473c1581b2039afa6b1039f4da730df210f | 9,594 | cpp | C++ | libman/gmeans_coordinator.cpp | disa-mhembere/knor | 5c4174b80726eb5fc8da7042d517e8c3929ec747 | [
"Apache-2.0"
] | 13 | 2017-06-30T12:48:54.000Z | 2021-05-26T06:54:10.000Z | libman/gmeans_coordinator.cpp | disa-mhembere/knor | 5c4174b80726eb5fc8da7042d517e8c3929ec747 | [
"Apache-2.0"
] | 30 | 2016-11-21T23:21:48.000Z | 2017-03-05T06:26:52.000Z | libman/gmeans_coordinator.cpp | disa-mhembere/k-par-means | 5c4174b80726eb5fc8da7042d517e8c3929ec747 | [
"Apache-2.0"
] | 5 | 2017-04-11T00:44:04.000Z | 2018-11-01T10:41:06.000Z | /*
* Copyright 2016 neurodata (http://neurodata.io/)
* Written by Disa Mhembere (disa@jhu.edu)
*
* This file is part of knor
*
* 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 CURRENT_KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <random>
#include <stdexcept>
#include "gmeans_coordinator.hpp"
#include "gmeans.hpp"
#include "io.hpp"
#include "clusters.hpp"
#include "linalg.hpp"
#include "AndersonDarling.hpp"
#include "hclust_id_generator.hpp"
#include "thd_safe_bool_vector.hpp"
namespace knor {
gmeans_coordinator::gmeans_coordinator(const std::string fn,
const size_t nrow,
const size_t ncol, const unsigned k, const unsigned max_iters,
const unsigned nnodes, const unsigned nthreads,
const double* centers, const base::init_t it,
const double tolerance, const base::dist_t dt,
const unsigned min_clust_size, const short strictness) :
xmeans_coordinator(fn, nrow, ncol, k, max_iters, nnodes, nthreads,
centers, it, tolerance, dt, min_clust_size),
strictness(strictness) {
}
void gmeans_coordinator::deactivate(const unsigned id) {
cltr_active_vec->check_set(id, false);
}
void gmeans_coordinator::activate(const unsigned id) {
cltr_active_vec->check_set(id, true);
if (id > 0)
curr_nclust++;
}
void gmeans_coordinator::build_thread_state() {
// NUMA node affinity binding policy is round-robin
unsigned thds_row = nrow / nthreads;
for (unsigned thd_id = 0; thd_id < nthreads; thd_id++) {
std::pair<unsigned, unsigned> tup = get_rid_len_tup(thd_id);
thd_max_row_idx.push_back((thd_id*thds_row) + tup.second);
threads.push_back(gmeans::create((thd_id % nnodes),
thd_id, tup.first, tup.second,
ncol, k, hcltrs, &cluster_assignments[0], fn,
_dist_t, cltr_active_vec, partition_dist, nearest_cdist,
compute_pdist));
threads[thd_id]->set_parent_cond(&cond);
threads[thd_id]->set_parent_pending_threads(&pending_threads);
threads[thd_id]->start(WAIT); // Thread puts itself to sleep
std::static_pointer_cast<gmeans>(threads[thd_id])
->set_part_id(&part_id[0]);
std::static_pointer_cast<gmeans>(threads[thd_id])
->set_g_clusters(cltrs);
}
}
void gmeans_coordinator::assemble_ad_vecs(std::unordered_map<unsigned,
std::vector<double>>& ad_vecs) {
for (size_t i = 0; i < nearest_cdist.size(); i++) {
ad_vecs[part_id[i]].push_back(nearest_cdist[i]);
}
}
void gmeans_coordinator::compute_ad_stats(
std::unordered_map<unsigned, std::vector<double>>& ad_vecs) {
std::vector<unsigned> keys;
for (auto const& kv : ad_vecs)
keys.push_back(kv.first);
std::vector<double> scores(keys.size());
#pragma omp parallel for
for (size_t idx = 0; idx < keys.size(); idx++) {
double score = base::AndersonDarling::compute_statistic(
ad_vecs[keys[idx]].size(), &(ad_vecs[keys[idx]][0]));
scores[idx] = score;
}
// NOTE: We push the score onto the back
for (size_t idx = 0; idx < keys.size(); idx++)
ad_vecs[keys[idx]].push_back(scores[idx]);
}
// NOTE: This modifies hcltrs
void gmeans_coordinator::partition_decision() {
// Each Anderson Darling (AD) vector represents the vector for which
// each cluster gets its AD statistic.
std::unordered_map<unsigned, std::vector<double>> ad_vecs;
std::vector<double> critical_values;
// Populate the AD vectors
assemble_ad_vecs(ad_vecs);
for (auto& kv : ad_vecs) {
base::linalg::scale(&(kv.second)[0], kv.second.size());
}
// Compute Critical values
base::AndersonDarling::compute_critical_values(
ad_vecs.size(), critical_values);
// Compute AD statistics
compute_ad_stats(ad_vecs);
std::vector<size_t> keys;
hcltrs.get_keys(keys);
std::vector<bool> revert_cache;
auto max_pid = (*std::max_element(keys.begin(), keys.end()));
revert_cache.assign(max_pid+1, false);
// NOTE: We use ad_vecs.back() to store the score
for (size_t i = 0; i < keys.size(); i++) {
unsigned pid = keys[i];
auto score = ad_vecs[pid].back();
if (score <= critical_values[strictness]) {
unsigned lid = hcltrs[pid]->get_zeroid();
unsigned rid = hcltrs[pid]->get_oneid();
// Deactivate both lid and rid
deactivate(lid); deactivate(rid);
// Deactivate pid
deactivate(pid);
revert_cache[pid] = true;
hcltrs.erase(pid);
// We can reuse these children ids
ider->reclaim_id(lid);
ider->reclaim_id(rid);
curr_nclust -= 2;
final_centroids[pid] = std::vector<double>(
cltrs->get_mean_rawptr(pid),
cltrs->get_mean_rawptr(pid) + ncol);
cluster_assignment_counts[pid] =
cluster_assignment_counts[lid] + cluster_assignment_counts[rid];
cluster_assignment_counts[lid] = cluster_assignment_counts[rid] = 0;
}
}
// Assemble cluster membership
// TODO: Use dynamic or guided scheduler
#ifdef _OPENMP
#pragma omp parallel for default(shared) firstprivate(revert_cache)
#endif
for (size_t rid = 0; rid < nrow; rid++) {
auto pid = part_id[rid];
// Ignore keys outside in hcltrs
if (pid < revert_cache.size() && revert_cache[pid]) {
// Means that row assignments needs to be reverted to part_id
cluster_assignments[rid] = pid;
}
}
}
void gmeans_coordinator::compute_cluster_diffs() {
auto itr = hcltrs.get_iterator();
while (itr.has_next()) {
auto kv = itr.next();
auto c = std::static_pointer_cast<base::h_clusters>(kv.second);
c->metadata.resize(ncol+1); // +1th index stores the divisor
// Compute difference
for (size_t i = 0; i < ncol; i++)
base::linalg::vdiff(c->get_mean_rawptr(0),
c->get_mean_rawptr(1), ncol, c->metadata);
// Compute v.dot(v)
c->metadata[ncol] = base::linalg::dot(&c->metadata[0],
&c->metadata[0], ncol); // NOTE: last element intentionally ignored
}
}
// Main driver
base::cluster_t gmeans_coordinator::run(
double* allocd_data, const bool numa_opt) {
#ifdef PROFILER
ProfilerStart("gmeans_coordinator.perf");
#endif
build_thread_state();
if (!numa_opt && NULL == allocd_data) {
wake4run(ALLOC_DATA);
wait4complete();
} else if (allocd_data) { // No NUMA opt
set_thread_data_ptr(allocd_data);
}
struct timeval start, end;
gettimeofday(&start , NULL);
run_hinit(); // Initialize clusters
// Run loop
size_t iter = 0;
while (true) {
// TODO: Do this simultaneously with H_EM step
wake4run(MEAN);
wait4complete();
combine_partition_means();
compute_pdist = true;
for (iter = 0; iter < max_iters; iter++) {
#ifndef BIND
printf("\nNCLUST: %lu, Iteration: %lu\n", curr_nclust, iter);
#endif
// Now pick between the cluster splits
wake4run(H_EM);
wait4complete();
update_clusters();
#ifndef BIND
printf("\nAssignment counts:\n");
base::sparse_print(cluster_assignment_counts);
printf("\n*****************************************************\n");
#endif
if (compute_pdist)
compute_pdist = false;
}
compute_cluster_diffs();
wake4run(H_SPLIT);
wait4complete();
// Decide on split or not here
partition_decision();
if (at_cluster_cap()) {
#ifndef BIND
printf("\n\nCLUSTER SIZE EXIT @ %lu!\n", curr_nclust);
#endif
break;
}
// Update global state
init_splits(); // Initialize possible splits
// Break when clusters are inactive due to size
if (hcltrs.keyless()) {
assert(steady_state()); // NOTE: Comment when benchmarking
#ifndef BIND
printf("\n\nSTEADY STATE EXIT!\n");
#endif
break;
}
}
complete_final_centroids();
#ifdef PROFILER
ProfilerStop();
#endif
gettimeofday(&end, NULL);
#ifndef BIND
printf("\n\nAlgorithmic time taken = %.6f sec\n",
base::time_diff(start, end));
printf("\n******************************************\n");
verify_consistency();
#endif
#ifndef BIND
printf("Final cluster counts: \n");
base::sparse_print(cluster_assignment_counts);
//printf("Final centroids\n");
//for (auto const& kv : final_centroids) {
//printf("k: %u, v: ", kv.first); base::print(kv.second);
//}
printf("\n******************************************\n");
#endif
return base::cluster_t(this->nrow, this->ncol, iter,
cluster_assignments, cluster_assignment_counts,
final_centroids);
}
} // End namespace knor
| 31.663366 | 83 | 0.613508 | [
"vector"
] |
1cffd4da39ba3687eccd091c7d1ac4b3477f433f | 5,597 | cpp | C++ | src/app/qgsaddattrdialog.cpp | dyna-mis/Hilabeling | cb7d5d4be29624a20c8a367162dbc6fd779b2b52 | [
"MIT"
] | null | null | null | src/app/qgsaddattrdialog.cpp | dyna-mis/Hilabeling | cb7d5d4be29624a20c8a367162dbc6fd779b2b52 | [
"MIT"
] | null | null | null | src/app/qgsaddattrdialog.cpp | dyna-mis/Hilabeling | cb7d5d4be29624a20c8a367162dbc6fd779b2b52 | [
"MIT"
] | 1 | 2021-12-25T08:40:30.000Z | 2021-12-25T08:40:30.000Z | /***************************************************************************
qgsaddattrdialog.h - description
-------------------
begin : January 2005
copyright : (C) 2005 by Marco Hugentobler
email : marco.hugentobler@autoform.ch
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "qgsaddattrdialog.h"
#include "qgsvectorlayer.h"
#include "qgsvectordataprovider.h"
#include "qgslogger.h"
#include <QMessageBox>
QgsAddAttrDialog::QgsAddAttrDialog( QgsVectorLayer *vlayer, QWidget *parent, Qt::WindowFlags fl )
: QDialog( parent, fl )
, mIsShapeFile( vlayer && vlayer->providerType() == QLatin1String( "ogr" ) && vlayer->storageType() == QLatin1String( "ESRI Shapefile" ) )
{
setupUi( this );
connect( mTypeBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsAddAttrDialog::mTypeBox_currentIndexChanged );
connect( mLength, &QSpinBox::editingFinished, this, &QgsAddAttrDialog::mLength_editingFinished );
if ( !vlayer )
return;
//fill data types into the combo box
const QList< QgsVectorDataProvider::NativeType > &typelist = vlayer->dataProvider()->nativeTypes();
for ( int i = 0; i < typelist.size(); i++ )
{
QgsDebugMsg( QStringLiteral( "name:%1 type:%2 typeName:%3 length:%4-%5 prec:%6-%7" )
.arg( typelist[i].mTypeDesc )
.arg( typelist[i].mType )
.arg( typelist[i].mTypeName )
.arg( typelist[i].mMinLen ).arg( typelist[i].mMaxLen )
.arg( typelist[i].mMinPrec ).arg( typelist[i].mMaxPrec ) );
mTypeBox->addItem( typelist[i].mTypeDesc );
mTypeBox->setItemData( i, static_cast<int>( typelist[i].mType ), Qt::UserRole );
mTypeBox->setItemData( i, typelist[i].mTypeName, Qt::UserRole + 1 );
mTypeBox->setItemData( i, typelist[i].mMinLen, Qt::UserRole + 2 );
mTypeBox->setItemData( i, typelist[i].mMaxLen, Qt::UserRole + 3 );
mTypeBox->setItemData( i, typelist[i].mMinPrec, Qt::UserRole + 4 );
mTypeBox->setItemData( i, typelist[i].mMaxPrec, Qt::UserRole + 5 );
}
mTypeBox_currentIndexChanged( 0 );
if ( mIsShapeFile )
mNameEdit->setMaxLength( 10 );
}
void QgsAddAttrDialog::mTypeBox_currentIndexChanged( int idx )
{
mTypeName->setText( mTypeBox->itemData( idx, Qt::UserRole + 1 ).toString() );
mLength->setMinimum( mTypeBox->itemData( idx, Qt::UserRole + 2 ).toInt() );
mLength->setMaximum( mTypeBox->itemData( idx, Qt::UserRole + 3 ).toInt() );
mLength->setVisible( mLength->minimum() < mLength->maximum() );
mLengthLabel->setVisible( mLength->minimum() < mLength->maximum() );
if ( mLength->value() < mLength->minimum() )
mLength->setValue( mLength->minimum() );
if ( mLength->value() > mLength->maximum() )
mLength->setValue( mLength->maximum() );
setPrecisionMinMax();
}
void QgsAddAttrDialog::mLength_editingFinished()
{
setPrecisionMinMax();
}
void QgsAddAttrDialog::setPrecisionMinMax()
{
int idx = mTypeBox->currentIndex();
int minPrecType = mTypeBox->itemData( idx, Qt::UserRole + 4 ).toInt();
int maxPrecType = mTypeBox->itemData( idx, Qt::UserRole + 5 ).toInt();
mPrec->setVisible( minPrecType < maxPrecType );
mPrecLabel->setVisible( minPrecType < maxPrecType );
mPrec->setMinimum( minPrecType );
mPrec->setMaximum( std::max( minPrecType, std::min( maxPrecType, mLength->value() ) ) );
}
void QgsAddAttrDialog::accept()
{
if ( mIsShapeFile && mNameEdit->text().compare( QLatin1String( "shape" ), Qt::CaseInsensitive ) == 0 )
{
QMessageBox::warning( this, tr( "Add Field" ),
tr( "Invalid field name. This field name is reserved and cannot be used." ) );
return;
}
if ( mNameEdit->text().isEmpty() )
{
QMessageBox::warning( this, tr( "Add Field" ),
tr( "No name specified. Please specify a name to create a new field." ) );
return;
}
QDialog::accept();
}
QgsField QgsAddAttrDialog::field() const
{
QgsDebugMsg( QStringLiteral( "idx:%1 name:%2 type:%3 typeName:%4 length:%5 prec:%6 comment:%7" )
.arg( mTypeBox->currentIndex() )
.arg( mNameEdit->text() )
.arg( mTypeBox->currentData( Qt::UserRole ).toInt() )
.arg( mTypeBox->currentData( Qt::UserRole + 1 ).toString() )
.arg( mLength->value() )
.arg( mPrec->value() )
.arg( mCommentEdit->text() ) );
return QgsField(
mNameEdit->text(),
( QVariant::Type ) mTypeBox->currentData( Qt::UserRole ).toInt(),
mTypeBox->currentData( Qt::UserRole + 1 ).toString(),
mLength->value(),
mPrec->value(),
mCommentEdit->text(),
static_cast<QVariant::Type>( mTypeBox->currentData( Qt::UserRole ).toInt() ) == QVariant::Map ? QVariant::String : QVariant::Invalid
);
}
| 41.768657 | 155 | 0.57102 | [
"shape"
] |
e8007011f271d2c5e380822f0d96deea000cd5d2 | 4,633 | cpp | C++ | tests/OxCalculatorT2Linear_test.cpp | MRKonrad/OxShmolli2 | abe020f4aa08c1037f04fe80e68f0651d03cccd1 | [
"MIT"
] | 7 | 2018-12-10T10:11:03.000Z | 2021-03-11T14:40:40.000Z | tests/OxCalculatorT2Linear_test.cpp | MRKonrad/OxShmolli2 | abe020f4aa08c1037f04fe80e68f0651d03cccd1 | [
"MIT"
] | 10 | 2019-03-10T11:42:55.000Z | 2021-12-10T15:39:41.000Z | tests/OxCalculatorT2Linear_test.cpp | MRKonrad/OxShmolli2 | abe020f4aa08c1037f04fe80e68f0651d03cccd1 | [
"MIT"
] | 3 | 2019-12-04T14:05:54.000Z | 2022-02-26T00:24:38.000Z | /*!
* \file OxCalculatorT2Linear_test.cpp
* \author Konrad Werys
* \date 2019/11/01
*/
#include "gtest/gtest.h"
#include "OxTestData.h"
#include "CmakeConfigForTomato.h"
#ifdef USE_PRIVATE_NR2
#ifdef USE_YAML
#include "OxModelT2TwoParam.h"
#include "OxModelT2ThreeParam.h"
#include "OxFitterAmoebaVnl.h"
#include "OxFitterLevenbergMarquardtVnl.h"
#include "OxStartPointCalculatorBasic.h"
#include "OxCalculatorT2Linear.h"
#ifdef USE_VNL
TEST(OxCalculatorT2Linear, blood) {
typedef double TYPE;
char filePath [] = "testData/T2_blood.yaml";
Ox::TestData<TYPE> testData(filePath);
int nSamples = testData.getNSamples();
Ox::CalculatorT2Linear<TYPE> calculator;
// set the data
calculator.setNSamples(nSamples);
calculator.setEchoTimes(testData.getEchoTimesPtr());
calculator.setSigMag(testData.getSignalMagPtr());
calculator.calculate();
EXPECT_NEAR(calculator.getResults()["B"], testData.getResultsThreeParam()[1], 1);
EXPECT_NEAR(calculator.getResults()["T2"], testData.getResultsThreeParam()[2], 1);
}
TEST(OxCalculatorT2Linear, myo) {
typedef double TYPE;
char filePath [] = "testData/T2_myocardium.yaml";
Ox::TestData<TYPE> testData(filePath);
int nSamples = testData.getNSamples();
Ox::CalculatorT2Linear<TYPE> calculator;
// set the data
calculator.setNSamples(nSamples);
calculator.setEchoTimes(testData.getEchoTimesPtr());
calculator.setSigMag(testData.getSignalMagPtr());
calculator.calculate();
EXPECT_NEAR(calculator.getResults()["B"], testData.getResultsThreeParam()[1], 10); // !!!
EXPECT_NEAR(calculator.getResults()["T2"], testData.getResultsThreeParam()[2], 1);
}
TEST(OxCalculatorT2Linear, myo_3samples) {
typedef double TYPE;
char filePath [] = "testData/T2_myocardium_3samples.yaml";
Ox::TestData<TYPE> testData(filePath);
int nSamples = testData.getNSamples();
Ox::CalculatorT2Linear<TYPE> calculator;
// set the data
calculator.setNSamples(nSamples);
calculator.setEchoTimes(testData.getEchoTimesPtr());
calculator.setSigMag(testData.getSignalMagPtr());
calculator.calculate();
EXPECT_NEAR(calculator.getResults()["B"], testData.getResultsThreeParam()[1], 2e-1);
EXPECT_NEAR(calculator.getResults()["T2"], testData.getResultsThreeParam()[2], 2e-1);
}
TEST(OxCalculatorT2Linear, blood_3samples) {
typedef double TYPE;
char filePath [] = "testData/T2_blood_3samples.yaml";
Ox::TestData<TYPE> testData(filePath);
int nSamples = testData.getNSamples();
Ox::CalculatorT2Linear<TYPE> calculator;
// set the data
calculator.setNSamples(nSamples);
calculator.setEchoTimes(testData.getEchoTimesPtr());
calculator.setSigMag(testData.getSignalMagPtr());
calculator.calculate();
EXPECT_NEAR(calculator.getResults()["B"], testData.getResultsThreeParam()[1], 2e-1);
EXPECT_NEAR(calculator.getResults()["T2"], testData.getResultsThreeParam()[2], 2e-1);
}
TEST(OxCalculatorT2Linear, copyConstructor) {
typedef double TYPE;
char filePath [] = "testData/T2_blood_3samples.yaml";
Ox::TestData<TYPE> testData(filePath);
int nSamples = testData.getNSamples();
// init the necessary objects
Ox::ModelT2TwoParam<TYPE> model;
Ox::FitterAmoebaVnl<TYPE> fitterAmoebaVnl;
//Ox::StartPointCalculatorBasic<TYPE> startPointCalculator;
Ox::CalculatorT2Linear<TYPE> calculator;
// configure
calculator.setModel(&model);
calculator.setFitter(&fitterAmoebaVnl);
//calculator.setStartPointCalculator(&startPointCalculator);
// set the data
calculator.setNSamples(nSamples);
calculator.setEchoTimes(testData.getEchoTimesPtr());
calculator.setSigMag(testData.getSignalMagPtr());
calculator.setMeanCutOff(123);
Ox::CalculatorT2Linear<TYPE> calculatorCopy = calculator;
EXPECT_EQ(calculator.getMeanCutOff(), calculatorCopy.getMeanCutOff());
EXPECT_EQ(calculator.getNSamples(), calculatorCopy.getNSamples());
EXPECT_EQ(calculator.getNDims(), calculatorCopy.getNDims());
// empty array pointers
EXPECT_THROW(calculatorCopy.getEchoTimes(), std::runtime_error);
EXPECT_FALSE(calculatorCopy.getRepTimes());
EXPECT_FALSE(calculatorCopy.getRelAcqTimes());
EXPECT_THROW(calculatorCopy.getSigMag(), std::runtime_error);
EXPECT_FALSE(calculatorCopy.getSigPha());
// non-empty pointers of internal arrays
EXPECT_TRUE(calculatorCopy.getSignal());
EXPECT_TRUE(calculatorCopy.getSigns());
EXPECT_TRUE(calculatorCopy.getStartPoint());
}
#endif // USE_VNL
#endif // USE_YAML
#endif // USE_PRIVATE_NR2 | 29.890323 | 93 | 0.732139 | [
"model"
] |
e8036e5819cec8fb0fdaa0bc678fb29ea2abfd5d | 2,121 | cpp | C++ | main.cpp | YourName0729/B4-S4 | d079849e8d37191938ca18e89cfa5ec33ad9a3a6 | [
"MIT"
] | 1 | 2021-07-10T14:25:25.000Z | 2021-07-10T14:25:25.000Z | main.cpp | YourName0729/B4-S4 | d079849e8d37191938ca18e89cfa5ec33ad9a3a6 | [
"MIT"
] | null | null | null | main.cpp | YourName0729/B4-S4 | d079849e8d37191938ca18e89cfa5ec33ad9a3a6 | [
"MIT"
] | null | null | null | #include <iostream>
#include <fstream>
#include <filesystem>
#include <sstream>
#include "converter.hpp"
#include "dimacs_adapter.hpp"
using namespace std;
void print(const State& st) {
vector<vector<bool>> vec2(st.getHeight(), vector<bool>(st.getLength(), 0));
for (auto p : st) {
vec2[p.x - 1][p.y - 1] = 1;
}
for (int i = 0; i < st.getHeight(); ++i) {
for (int j = 0; j < st.getLength(); ++j) {
if (vec2[i][j]) cout << 'O';
else cout << '.';
}
cout << '\n';
}
}
void print(const string& s) {
State st;
ifstream fin(s);
fin >> st;
print(st);
}
// bool prefix(const string& s, const string& t) {
// for (int i = 0; i < t.length(); ++i) {
// if (s[i] != t[i]) return 0;
// }
// return 1;
// }
int main() {
print("./oscillator/o12x12x2_tilt_1.txt");
for (const auto& entry : filesystem::directory_iterator("./oscillator")) {
if (entry.path() == "./oscillator/tmp.txt") continue;
print(entry.path().string());
}
// Converter cvt(20, 20, 2);
// cvt.convert();
// for (const auto& entry : filesystem::directory_iterator("./oscillator")) {
// if (entry.path() == "./oscillator/tmp.txt") continue;
// ifstream fin(entry.path());
// State st;
// fin >> st;
// cvt.preventOld(st);
// }
// std::ofstream fout("cnf.cnf");
// DIMACSAdapter::cnf2dimacs(cvt.getCnf(), fout);
// fout.close();
// system("./MiniSat_v1.14_linux cnf.cnf ans.sat");
// std::ifstream fin("ans.sat");
// auto st = cvt.decode(DIMACSAdapter::dimacs2cls(fin));
// fin.close();
// if (!st.size()) return 0;
// std::ofstream fout2("oscillator/tmp.txt");
// fout2 << st;
// fout2.close();
// print(st);
// string name;
// stringstream ss;
// cin >> name;
// if (name == ".") return 0;
// ss << "oscillator/o" << st.getHeight() << 'x' << st.getLength() << 'x' << 2 << '_' << name << ".txt";
// ss >> name;
// rename("oscillator/tmp.txt", name.c_str());
return 0;
} | 24.952941 | 108 | 0.516737 | [
"vector"
] |
e811fd89507df36401a638ee363870f49fb95ee8 | 1,277 | cpp | C++ | src/homework/05_functions/main.cpp | acc-cosc-1337-fall-2021/acc-cosc-1337-fall-2021-ruddygarmendez | 7184c4c8c312db920d8682f20a8678a62f7ea0ee | [
"MIT"
] | null | null | null | src/homework/05_functions/main.cpp | acc-cosc-1337-fall-2021/acc-cosc-1337-fall-2021-ruddygarmendez | 7184c4c8c312db920d8682f20a8678a62f7ea0ee | [
"MIT"
] | null | null | null | src/homework/05_functions/main.cpp | acc-cosc-1337-fall-2021/acc-cosc-1337-fall-2021-ruddygarmendez | 7184c4c8c312db920d8682f20a8678a62f7ea0ee | [
"MIT"
] | 1 | 2021-10-09T15:49:37.000Z | 2021-10-09T15:49:37.000Z | /*
use a vector of int with values 8, 4, 20, 88, 66, 99
Prompt user for 1 for Get Max from vector and 2 for Get primes.
Prompt user for a number and return max value or list of primes
and display them to screen.
Program continues until user decides to exit.
*/
#include"func.h"
using std::cout;
using std::cin;
int main()
{
int choice;
std::string dna;
do{
cout<<"\n";
cout<<"MAIN MENU\n";
cout<<"\n";
cout<<"1 - Get GC content\n";
cout<<"2 - Get DNA complement\n";
cout<<"3 - Exit\n";
cout<<"ENTER YOUR CHOICE:\n";
cin>>choice;
switch(choice){
case 1:
cout<<"You have chosen GC content\n ";
cout<<"Please enter your DNA string \n";
cin>>dna;
cout<<"The answer is: "<<get_gc_content(dna);
break;
case 2:
cout<<"You have chosen get DNA complement \n";
cout<<"Please enter your DNA string \n";
cin>>dna;
cout<<"The answer is: "<<get_dna_complement(dna);
break;
case 3:
char confirm;
cout<<"Are you sure you want to exit? (Y) or (N)\n";
cin>>confirm;
if (confirm=='Y'||confirm=='y'){
break;
}
else{
choice=4;
break;
}
default:
cout<<"Invalid option";
break;
}
} while (choice !=3);
return 0;
} | 17.736111 | 63 | 0.577917 | [
"vector"
] |
e812f1da1387330c5eb8acdce1c526e5ac405c57 | 4,957 | hh | C++ | src/modules/LCAcc/TexSynth2.hh | cdsc-github/parade-ara-simulator | 00c977200a8e7aa31b03d560886ec80840a3c416 | [
"BSD-3-Clause"
] | 31 | 2015-12-15T19:14:10.000Z | 2021-12-31T17:40:21.000Z | src/modules/LCAcc/TexSynth2.hh | cdsc-github/parade-ara-simulator | 00c977200a8e7aa31b03d560886ec80840a3c416 | [
"BSD-3-Clause"
] | 5 | 2015-12-04T08:06:47.000Z | 2020-08-09T21:49:46.000Z | src/modules/LCAcc/TexSynth2.hh | cdsc-github/parade-ara-simulator | 00c977200a8e7aa31b03d560886ec80840a3c416 | [
"BSD-3-Clause"
] | 21 | 2015-11-05T08:25:45.000Z | 2021-06-19T02:24:50.000Z | #ifndef LCACC_MODE_TEXSYNTH2_H
#define LCACC_MODE_TEXSYNTH2_H
#include "LCAccOperatingMode.hh"
#include "SPMInterface.hh"
#include <vector>
namespace LCAcc
{
class OperatingMode_TexSynth2 : public LCAccOperatingMode
{
uint32_t output0;
uint32_t output1;
uint32_t output2;
uint32_t output3;
int32_t offsetX0;
int32_t offsetY0;
int32_t offsetX1;
int32_t offsetY1;
int32_t offsetX2;
int32_t offsetY2;
int32_t offsetX3;
int32_t offsetY3;
uint32_t elementSize;
uint32_t elementCount;
intptr_t inputAddr;
uint32_t width;
uint32_t height;
int line;
public:
inline OperatingMode_TexSynth2() {}
inline virtual void GetSPMReadIndexSet(int iteration, int maxIteration, int taskID, const std::vector<uint64_t>& argAddrVec, const std::vector<bool>& argActive, std::vector<uint64_t>& outputArgs)
{
assert(0 < argAddrVec.size());
uint64_t addr_dummy = argAddrVec[0];
if (argActive[0]) {
outputArgs.push_back(addr_dummy);
}
}
inline virtual void GetSPMWriteIndexSet(int iteration, int maxIteration, int taskID, const std::vector<uint64_t>& argAddrVec, const std::vector<bool>& argActive, std::vector<uint64_t>& outputArgs)
{
}
inline virtual void Compute(int iteration, int maxIteration, int taskID, const std::vector<uint64_t>& LCACC_INTERNAL_argAddrVec, const std::vector<bool>& LCACC_INTERNAL_argActive)
{
assert(LCACC_INTERNAL_argAddrVec.size() == 1);
assert(0 < LCACC_INTERNAL_argAddrVec.size());
uint64_t addr_dummy = LCACC_INTERNAL_argAddrVec[0];
double dummy;
dummy = 0;
dummy = ReadSPMFlt(0, addr_dummy, 0);
#define SPMAddressOf(x) (addr_##x)
int index = (iteration + maxIteration * taskID);
int imageIndex = index / (width * height);
int imagePitch = width * height * elementSize * elementCount * imageIndex;
int in_j = line;
int in_i = index % width;
for (int i = 0; i < elementCount; i++) {
int x = (in_i + offsetX0 + width) % width;
int y = (in_j + offsetY0 + height) % height;
AddRead(inputAddr + imagePitch + (x + width * y) * (elementSize * elementCount) + (i * elementSize), output0 + iteration * (elementSize * elementCount) + (i * elementSize), elementSize);
}
for (int i = 0; i < elementCount; i++) {
int x = (in_i + offsetX1 + width) % width;
int y = (in_j + offsetY1 + height) % height;
AddRead(inputAddr + imagePitch + (x + width * y) * (elementSize * elementCount) + (i * elementSize), output1 + iteration * (elementSize * elementCount) + (i * elementSize), elementSize);
}
for (int i = 0; i < elementCount; i++) {
int x = (in_i + offsetX2 + width) % width;
int y = (in_j + offsetY2 + height) % height;
AddRead(inputAddr + imagePitch + (x + width * y) * (elementSize * elementCount) + (i * elementSize), output2 + iteration * (elementSize * elementCount) + (i * elementSize), elementSize);
}
for (int i = 0; i < elementCount; i++) {
int x = (in_i + offsetX3 + width) % width;
int y = (in_j + offsetY3 + height) % height;
AddRead(inputAddr + imagePitch + (x + width * y) * (elementSize * elementCount) + (i * elementSize), output3 + iteration * (elementSize * elementCount) + (i * elementSize), elementSize);
}
#undef SPMAddressOf
}
inline virtual void BeginComputation() {}
inline virtual void EndComputation() {}
inline virtual int CycleTime()
{
return 1;
}
inline virtual int InitiationInterval()
{
return 1;
}
inline virtual int PipelineDepth()
{
return 21;
}
inline virtual bool CallAllAtEnd()
{
return false;
}
inline static std::string GetModeName()
{
return "TexSynth2";
}
inline virtual int ArgumentCount()
{
return 1;
}
inline virtual void SetRegisterValues(const std::vector<uint64_t>& regs)
{
assert(regs.size() == 18);
output0 = ConvertTypes<uint64_t, uint32_t>(regs[0]);
output1 = ConvertTypes<uint64_t, uint32_t>(regs[1]);
output2 = ConvertTypes<uint64_t, uint32_t>(regs[2]);
output3 = ConvertTypes<uint64_t, uint32_t>(regs[3]);
offsetX0 = ConvertTypes<uint64_t, int32_t>(regs[4]);
offsetY0 = ConvertTypes<uint64_t, int32_t>(regs[5]);
offsetX1 = ConvertTypes<uint64_t, int32_t>(regs[6]);
offsetY1 = ConvertTypes<uint64_t, int32_t>(regs[7]);
offsetX2 = ConvertTypes<uint64_t, int32_t>(regs[8]);
offsetY2 = ConvertTypes<uint64_t, int32_t>(regs[9]);
offsetX3 = ConvertTypes<uint64_t, int32_t>(regs[10]);
offsetY3 = ConvertTypes<uint64_t, int32_t>(regs[11]);
elementSize = ConvertTypes<uint64_t, uint32_t>(regs[12]);
elementCount = ConvertTypes<uint64_t, uint32_t>(regs[13]);
inputAddr = ConvertTypes<uint64_t, intptr_t>(regs[14]);
width = ConvertTypes<uint64_t, uint32_t>(regs[15]);
height = ConvertTypes<uint64_t, uint32_t>(regs[16]);
line = ConvertTypes<uint64_t, int>(regs[17]);
}
inline static int GetOpCode()
{
return 911;
}
};
}
#endif
| 33.952055 | 198 | 0.677224 | [
"vector"
] |
e81c264309133228401beff79b69313a5aeb7ad2 | 20,977 | cpp | C++ | dev/Code/Framework/AtomCore/Tests/Math/FrustumTests.cpp | brianherrera/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | [
"AML"
] | 1,738 | 2017-09-21T10:59:12.000Z | 2022-03-31T21:05:46.000Z | dev/Code/Framework/AtomCore/Tests/Math/FrustumTests.cpp | olivier-be/lumberyard | 3d688932f919dbf5821f0cb8a210ce24abe39e9e | [
"AML"
] | 427 | 2017-09-29T22:54:36.000Z | 2022-02-15T19:26:50.000Z | dev/Code/Framework/AtomCore/Tests/Math/FrustumTests.cpp | olivier-be/lumberyard | 3d688932f919dbf5821f0cb8a210ce24abe39e9e | [
"AML"
] | 671 | 2017-09-21T08:04:01.000Z | 2022-03-29T14:30:07.000Z | /*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/UnitTest/TestTypes.h>
#include <AtomCore/Math/Frustum.h>
#include <AtomCore/Math/ShapeIntersection.h>
namespace AZ
{
std::ostream& operator<< (std::ostream& stream, const Vector3& vector)
{
stream << "x: " << vector.GetX() << " y: " << vector.GetY() << " z: " << vector.GetZ();
return stream;
}
std::ostream& operator<< (std::ostream& stream, const Sphere& sphere)
{
stream << "center: " << sphere.GetCenter() << " radius: " << sphere.GetRadius();
return stream;
}
}
namespace UnitTest
{
enum FrustumPlanes
{
Near,
Far,
Left,
Right,
Top,
Bottom,
NumPlanes
};
struct FrustumTestCase
{
AZ::Vector3 nearTopLeft;
AZ::Vector3 nearTopRight;
AZ::Vector3 nearBottomLeft;
AZ::Vector3 nearBottomRight;
AZ::Vector3 farTopLeft;
AZ::Vector3 farTopRight;
AZ::Vector3 farBottomLeft;
AZ::Vector3 farBottomRight;
// Used to set which plane is being used
FrustumPlanes plane;
// Used to set a test case name
std::string testCaseName;
};
std::ostream& operator<< (std::ostream& stream, const UnitTest::FrustumTestCase& frustumTestCase)
{
stream << "NearTopLeft: " << frustumTestCase.nearTopLeft
<< std::endl << "NearTopRight: " << frustumTestCase.nearTopRight
<< std::endl << "NearBottomRight: " << frustumTestCase.nearBottomRight
<< std::endl << "NearBottomLeft: " << frustumTestCase.nearBottomLeft
<< std::endl << "FarTopLeft: " << frustumTestCase.farTopLeft
<< std::endl << "FarTopRight: " << frustumTestCase.farTopRight
<< std::endl << "FarBottomLeft: " << frustumTestCase.farBottomLeft
<< std::endl << "FarBottomRight: " << frustumTestCase.farBottomRight;
return stream;
}
class FrustumIntersectionTests
: public ::testing::WithParamInterface <FrustumTestCase>
, public UnitTest::AllocatorsTestFixture
{
protected:
void SetUp() override
{
UnitTest::AllocatorsTestFixture::SetUp();
// Build a frustum from 8 points
// This allows us to generate test cases in each of the 9 regions in the 3x3 grid divided by the 6 planes,
// as well as test cases that span across those regions
m_testCase = GetParam();
// Planes can be generated from triangles. Points must wind counter-clockwise (right-handed) for the normal to point in the correct direction.
// The Frustum class assumes the plane normals point inwards
m_planes[FrustumPlanes::Near] = AZ::Plane::CreateFromTriangle(m_testCase.nearTopLeft, m_testCase.nearTopRight, m_testCase.nearBottomRight);
m_planes[FrustumPlanes::Far] = AZ::Plane::CreateFromTriangle(m_testCase.farTopRight, m_testCase.farTopLeft, m_testCase.farBottomLeft);
m_planes[FrustumPlanes::Left] = AZ::Plane::CreateFromTriangle(m_testCase.nearTopLeft, m_testCase.nearBottomLeft, m_testCase.farTopLeft);
m_planes[FrustumPlanes::Right] = AZ::Plane::CreateFromTriangle(m_testCase.nearTopRight, m_testCase.farTopRight, m_testCase.farBottomRight);
m_planes[FrustumPlanes::Top] = AZ::Plane::CreateFromTriangle(m_testCase.nearTopLeft, m_testCase.farTopLeft, m_testCase.farTopRight);
m_planes[FrustumPlanes::Bottom] = AZ::Plane::CreateFromTriangle(m_testCase.nearBottomLeft, m_testCase.nearBottomRight, m_testCase.farBottomRight);
// AZ::Plane::CreateFromTriangle uses Vector3::GetNormalized to create a normal, which is not perfectly normalized.
// Since the distance value is set by float dist = -(normal.Dot(v0));, this means that an imperfect normal actually gives you a slightly different distance
// and thus a slightly different plane. Correct that here.
m_planes[FrustumPlanes::Near] = AZ::Plane::CreateFromNormalAndPoint(m_planes[FrustumPlanes::Near].GetNormal().GetNormalizedExact(), m_testCase.nearTopLeft);
m_planes[FrustumPlanes::Far] = AZ::Plane::CreateFromNormalAndPoint(m_planes[FrustumPlanes::Far].GetNormal().GetNormalizedExact(), m_testCase.farTopRight);
m_planes[FrustumPlanes::Left] = AZ::Plane::CreateFromNormalAndPoint(m_planes[FrustumPlanes::Left].GetNormal().GetNormalizedExact(), m_testCase.nearTopLeft);
m_planes[FrustumPlanes::Right] = AZ::Plane::CreateFromNormalAndPoint(m_planes[FrustumPlanes::Right].GetNormal().GetNormalizedExact(), m_testCase.nearTopRight);
m_planes[FrustumPlanes::Top] = AZ::Plane::CreateFromNormalAndPoint(m_planes[FrustumPlanes::Top].GetNormal().GetNormalizedExact(), m_testCase.nearTopLeft);
m_planes[FrustumPlanes::Bottom] = AZ::Plane::CreateFromNormalAndPoint(m_planes[FrustumPlanes::Bottom].GetNormal().GetNormalizedExact(), m_testCase.nearBottomLeft);
// Create the frustum itself
m_frustum.SetNearPlane(m_planes[FrustumPlanes::Near]);
m_frustum.SetFarPlane(m_planes[FrustumPlanes::Far]);
m_frustum.SetLeftPlane(m_planes[FrustumPlanes::Left]);
m_frustum.SetRightPlane(m_planes[FrustumPlanes::Right]);
m_frustum.SetTopPlane(m_planes[FrustumPlanes::Top]);
m_frustum.SetBottomPlane(m_planes[FrustumPlanes::Bottom]);
// Get the center points
m_centerPoints[FrustumPlanes::Near] = m_testCase.nearTopLeft + 0.5f * (m_testCase.nearBottomRight - m_testCase.nearTopLeft);
m_centerPoints[FrustumPlanes::Far] = m_testCase.farTopLeft + 0.5f * (m_testCase.farBottomRight - m_testCase.farTopLeft);
m_centerPoints[FrustumPlanes::Left] = m_testCase.nearTopLeft + 0.5f * (m_testCase.farBottomLeft - m_testCase.nearTopLeft);
m_centerPoints[FrustumPlanes::Right] = m_testCase.nearTopRight + 0.5f * (m_testCase.farBottomRight - m_testCase.nearTopRight);
m_centerPoints[FrustumPlanes::Top] = m_testCase.nearTopLeft + 0.5f * (m_testCase.farTopRight - m_testCase.nearTopLeft);
m_centerPoints[FrustumPlanes::Bottom] = m_testCase.nearBottomLeft + 0.5f * (m_testCase.farBottomRight - m_testCase.nearBottomLeft);
// Get the shortest edge of the frustum
AZStd::vector<AZ::Vector3> edges;
// Near plane
edges.push_back(m_testCase.nearTopLeft - m_testCase.nearTopRight);
edges.push_back(m_testCase.nearTopRight - m_testCase.nearBottomRight);
edges.push_back(m_testCase.nearBottomRight - m_testCase.nearBottomLeft);
edges.push_back(m_testCase.nearBottomLeft - m_testCase.nearTopLeft);
// Edges from near plane to far plane
edges.push_back(m_testCase.nearTopLeft - m_testCase.farTopLeft);
edges.push_back(m_testCase.nearTopRight - m_testCase.farTopRight);
edges.push_back(m_testCase.nearBottomRight - m_testCase.farBottomRight);
edges.push_back(m_testCase.nearBottomLeft - m_testCase.farBottomLeft);
// Far plane
edges.push_back(m_testCase.farTopLeft - m_testCase.farTopRight);
edges.push_back(m_testCase.farTopRight - m_testCase.farBottomRight);
edges.push_back(m_testCase.farBottomRight - m_testCase.farBottomLeft);
edges.push_back(m_testCase.farBottomLeft - m_testCase.farTopLeft);
m_minEdgeLength = std::numeric_limits<float>::max();
for (const AZ::Vector3& edge : edges)
{
m_minEdgeLength = AZ::GetMin(m_minEdgeLength, static_cast<float>(edge.GetLengthExact()));
}
}
AZ::Sphere GenerateSphereOutsidePlane(const AZ::Plane& plane, const AZ::Vector3& planeCenter)
{
// Get a radius small enough for the entire sphere to fit outside the plane without extending past the other planes in the frustum
float radius = 0.25f * m_minEdgeLength;
// Get the outward pointing normal of the plane
AZ::Vector3 normal = -1.0f * plane.GetNormal();
// Create a sphere that is outside the plane
AZ::Vector3 center = planeCenter + normal * (radius + m_marginOfErrorOffset);
return AZ::Sphere(center, radius);
}
AZ::Sphere GenerateSphereInsidePlane(const AZ::Plane& plane, const AZ::Vector3& planeCenter)
{
// Get a radius small enough for the entire sphere to fit outside the plane without extending past the other planes in the frustum
float radius = 0.25f * m_minEdgeLength;
// Get the inward pointing normal of the plane
AZ::Vector3 normal = plane.GetNormal();
// Create a sphere that is inside the plane
AZ::Vector3 center = planeCenter + normal * (radius + m_marginOfErrorOffset);
return AZ::Sphere(center, radius);
}
// The points used to generate the test cases
FrustumTestCase m_testCase;
// The planes generated from the points.
// Keep these around for access to the normals, which are used to generate shapes inside/outside of the frustum
AZ::Plane m_planes[FrustumPlanes::NumPlanes];
// The center points on the frustum for each plane
AZ::Vector3 m_centerPoints[FrustumPlanes::NumPlanes];
// The length of the shortest edge in the frustum
float m_minEdgeLength = std::numeric_limits<float>::max();
// Shapes generated inside/outside the frustum will be offset by this much as a margin of error
// Through trial and error determined that, for the test cases below, the sphere needs to be offset from the frustum by at least 0.05625f to be guaranteed to pass,
// which gives a reasonable idea of how precise these intersection tests are.
// For the box shaped frustum, the tests passed when offset by FLT_EPSILON, but the frustums further away from the origin were less precise.
float m_marginOfErrorOffset = 0.05625f;
// The frustum under test
AZ::Frustum m_frustum;
};
// Tests that a frustum does not contain a sphere that is outside the frustum
TEST_P(FrustumIntersectionTests, FrustumContainsSphere_SphereOutsidePlane_False)
{
AZ::Sphere testSphere = GenerateSphereOutsidePlane(m_planes[m_testCase.plane], m_centerPoints[m_testCase.plane]);
EXPECT_FALSE(AZ::ShapeIntersection::Contains(m_frustum, testSphere)) << "Frustum contains sphere even though sphere is completely outside the frustum." << std::endl << "Frustum:" << std::endl << m_testCase << std::endl << "Sphere:" << std::endl << testSphere << std::endl;
}
// Tests that a sphere outside the frustum does not overlap the frustum
TEST_P(FrustumIntersectionTests, SphereOverlapsFrustum_SphereOutsidePlane_False)
{
AZ::Sphere testSphere = GenerateSphereOutsidePlane(m_planes[m_testCase.plane], m_centerPoints[m_testCase.plane]);
EXPECT_FALSE(AZ::ShapeIntersection::Overlaps(testSphere, m_frustum)) << "Sphere overlaps frustum even though sphere is completely outside the frustum." << std::endl << "Frustum:" << std::endl << m_testCase << std::endl << "Sphere:" << std::endl << testSphere << std::endl;
}
// Tests that a frustum contains a sphere that is inside the frustum
TEST_P(FrustumIntersectionTests, FrustumContainsSphere_SphereInsidePlane_True)
{
AZ::Sphere testSphere = GenerateSphereInsidePlane(m_planes[m_testCase.plane], m_centerPoints[m_testCase.plane]);
EXPECT_TRUE(AZ::ShapeIntersection::Contains(m_frustum, testSphere)) << "Frustum does not contain sphere even though sphere is completely inside the frustum." << std::endl << "Frustum:" << std::endl << m_testCase << std::endl << "Sphere:" << std::endl << testSphere << std::endl;
}
// Tests that a sphere inside the frustum overlaps the frustum
TEST_P(FrustumIntersectionTests, SphereOverlapsFrustum_SphereInsidePlane_True)
{
AZ::Sphere testSphere = GenerateSphereInsidePlane(m_planes[m_testCase.plane], m_centerPoints[m_testCase.plane]);
EXPECT_TRUE(AZ::ShapeIntersection::Overlaps(testSphere, m_frustum)) << "Sphere does not overlap frustum even though sphere is completely inside the frustum." << std::endl << "Frustum:" << std::endl << m_testCase << std::endl << "Sphere:" << std::endl << testSphere << std::endl;
}
// Tests that a frustum does not contain a sphere that is half inside half outside the frustum
TEST_P(FrustumIntersectionTests, FrustumContainsSphere_SphereHalfInsideHalfOutsidePlane_False)
{
AZ::Sphere testSphere(m_centerPoints[m_testCase.plane], m_minEdgeLength * .25f);
EXPECT_FALSE(AZ::ShapeIntersection::Contains(m_frustum, testSphere)) << "Frustum contains sphere even though sphere is partially outside the frustum." << std::endl << "Frustum:" << std::endl << m_testCase << std::endl << "Sphere:" << std::endl << testSphere << std::endl;
}
// Tests that a sphere half inside half outside the frustum overlaps the frustum
TEST_P(FrustumIntersectionTests, SphereOverlapsFrustum_SphereHalfInsideHalfOutsidePlane_True)
{
AZ::Sphere testSphere(m_centerPoints[m_testCase.plane], m_minEdgeLength * .25f);
EXPECT_TRUE(AZ::ShapeIntersection::Overlaps(testSphere, m_frustum)) << "Sphere does not overlap frustum even though sphere is partially inside the frustum." << std::endl << "Frustum:" << std::endl << m_testCase << std::endl << "Sphere:" << std::endl << testSphere << std::endl;
}
std::vector<FrustumTestCase> GenerateFrustumIntersectionTestCases()
{
std::vector<FrustumTestCase> testCases;
std::vector<FrustumTestCase> frustums;
// 2x2x2 box (Z-up coordinate system)
FrustumTestCase box;
box.nearTopLeft = AZ::Vector3(-1.0f, -1.0f, 1.0f);
box.nearTopRight = AZ::Vector3(1.0f, -1.0f, 1.0f);
box.nearBottomLeft = AZ::Vector3(-1.0f, -1.0f, -1.0f);
box.nearBottomRight = AZ::Vector3(1.0f, -1.0f, -1.0f);
box.farTopLeft = AZ::Vector3(-1.0f, 1.0f, 1.0f);
box.farTopRight = AZ::Vector3(1.0f, 1.0f, 1.0f);
box.farBottomLeft = AZ::Vector3(-1.0f, 1.0f, -1.0f);
box.farBottomRight = AZ::Vector3(1.0f, 1.0f, -1.0f);
box.testCaseName = "BoxShapedFrustum";
frustums.push_back(box);
// Default values in a CCamera from Cry_Camera.h
FrustumTestCase defaultCameraFrustum;
defaultCameraFrustum.nearTopLeft = AZ::Vector3(-0.204621f, 0.200000f, 0.153465f);
defaultCameraFrustum.nearTopRight = AZ::Vector3(0.204621f, 0.200000f, 0.153465f);
defaultCameraFrustum.nearBottomLeft = AZ::Vector3(-0.204621f, 0.200000f, -0.153465f);
defaultCameraFrustum.nearBottomRight = AZ::Vector3(0.204621f, 0.200000f, -0.153465f);
defaultCameraFrustum.farTopLeft = AZ::Vector3(-1047.656982f, 1024.000000f, 785.742737f);
defaultCameraFrustum.farTopRight = AZ::Vector3(1047.656982f, 1024.000000f, 785.742737f);
defaultCameraFrustum.farBottomLeft = AZ::Vector3(-1047.656982f, 1024.000000f, -785.742737f);
defaultCameraFrustum.farBottomRight = AZ::Vector3(1047.656982f, 1024.000000f, -785.742737f);
defaultCameraFrustum.testCaseName = "DefaultCameraFrustum";
frustums.push_back(defaultCameraFrustum);
// These frustums were generated from flying around StarterGame and dumping the frustum values for the viewport camera and shadow cascade frustums to a log file
FrustumTestCase starterGame0;
starterGame0.nearTopLeft = AZ::Vector3(41656.351563f, 794907.750000f, -604483.687500f);
starterGame0.nearTopRight = AZ::Vector3(41662.343750f, 794907.375000f, -604483.687500f);
starterGame0.nearBottomLeft = AZ::Vector3(41656.164063f, 794904.125000f, -604488.437500f);
starterGame0.nearBottomRight = AZ::Vector3(41662.156250f, 794903.750000f, -604488.437500f);
starterGame0.farTopLeft = AZ::Vector3(41677.691406f, 795314.937500f, -604793.375000f);
starterGame0.farTopRight = AZ::Vector3(41683.683594f, 795314.562500f, -604793.375000f);
starterGame0.farBottomLeft = AZ::Vector3(41677.503906f, 795311.312500f, -604798.125000f);
starterGame0.farBottomRight = AZ::Vector3(41683.496094f, 795310.937500f, -604798.125000f);
starterGame0.testCaseName = "StarterGameFrustum0";
frustums.push_back(starterGame0);
FrustumTestCase starterGame1;
starterGame1.nearTopLeft = AZ::Vector3(0.166996f, 0.240156f, 0.117468f);
starterGame1.nearTopRight = AZ::Vector3(0.226816f, -0.184736f, 0.117423f);
starterGame1.nearBottomLeft = AZ::Vector3(0.169258f, 0.240499f, -0.113460f);
starterGame1.nearBottomRight = AZ::Vector3(0.229078f, -0.184393f, -0.113506f);
starterGame1.farTopLeft = AZ::Vector3(83.497986f, 120.077904f, 58.734165f);
starterGame1.farTopRight = AZ::Vector3(113.408234f, -92.368172f, 58.711285f);
starterGame1.farBottomLeft = AZ::Vector3(84.628860f, 120.249550f, -56.730221f);
starterGame1.farBottomRight = AZ::Vector3(114.539108f, -92.196526f, -56.753101f);
starterGame1.testCaseName = "StarterGameFrustum1";
frustums.push_back(starterGame1);
FrustumTestCase starterGame2;
starterGame2.nearTopLeft = AZ::Vector3(-0.007508f, 0.091724f, -0.043323f);
starterGame2.nearTopRight = AZ::Vector3(0.018772f, 0.090096f, -0.043323f);
starterGame2.nearBottomLeft = AZ::Vector3(-0.008393f, 0.077435f, -0.065421f);
starterGame2.nearBottomRight = AZ::Vector3(0.017887f, 0.075807f, -0.065421f);
starterGame2.farTopLeft = AZ::Vector3(-11.637362f, 142.172897f, -67.151001f);
starterGame2.farTopRight = AZ::Vector3(29.096817f, 139.649338f, -67.151001f);
starterGame2.farBottomLeft = AZ::Vector3(-13.009484f, 120.024765f, -101.403290f);
starterGame2.farBottomRight = AZ::Vector3(27.724697f, 117.501205f, -101.403290f);
starterGame2.testCaseName = "StarterGameFrustum2";
frustums.push_back(starterGame2);
FrustumTestCase starterGame3;
starterGame3.nearTopLeft = AZ::Vector3(0.211831f, -0.207308f, 0.107297f);
starterGame3.nearTopRight = AZ::Vector3(-0.217216f, -0.201659f, 0.107297f);
starterGame3.nearBottomLeft = AZ::Vector3(0.211954f, -0.197980f, -0.123455f);
starterGame3.nearBottomRight = AZ::Vector3(-0.217093f, -0.192331f, -0.123455f);
starterGame3.farTopLeft = AZ::Vector3(8473.246094f, -8292.310547f, 4291.892578f);
starterGame3.farTopRight = AZ::Vector3(-8688.623047f, -8066.359863f, 4291.892578f);
starterGame3.farBottomLeft = AZ::Vector3(8478.158203f, -7919.196777f, -4938.199219f);
starterGame3.farBottomRight = AZ::Vector3(-8683.710938f, -7693.245605f, -4938.199219f);
starterGame3.testCaseName = "StarterGameFrustum3";
frustums.push_back(starterGame3);
// For each test frustum, create test cases for every plane
for (FrustumTestCase frustum : frustums)
{
for (int i = 0; i < FrustumPlanes::NumPlanes; ++i)
{
frustum.plane = static_cast<FrustumPlanes>(i);
testCases.push_back(frustum);
}
}
return testCases;
}
std::string GenerateFrustumIntersectionTestCaseName(const ::testing::TestParamInfo<FrustumTestCase>& info)
{
std::string testCaseName = info.param.testCaseName;
switch (info.param.plane)
{
case FrustumPlanes::Near:
testCaseName += "_NearPlane";
break;
case FrustumPlanes::Far:
testCaseName += "_FarPlane";
break;
case FrustumPlanes::Left:
testCaseName += "_LeftPlane";
break;
case FrustumPlanes::Right:
testCaseName += "_RightPlane";
break;
case FrustumPlanes::Top:
testCaseName += "_TopPlane";
break;
case FrustumPlanes::Bottom:
testCaseName += "_BottomPlane";
break;
}
return testCaseName;
}
INSTANTIATE_TEST_CASE_P(FrustumIntersection, FrustumIntersectionTests, ::testing::ValuesIn(GenerateFrustumIntersectionTestCases()), GenerateFrustumIntersectionTestCaseName);
} | 57.471233 | 286 | 0.683701 | [
"vector"
] |
e81e2862657f3d14d01be657ffc7b9d3da4545a1 | 8,546 | cpp | C++ | src/cache_server_main.cpp | gatehouse/cppcms | 61da055ffeb349b4eda14bc9ac393af9ce842364 | [
"MIT"
] | 388 | 2017-03-01T07:39:21.000Z | 2022-03-30T19:38:41.000Z | src/cache_server_main.cpp | gatehouse/cppcms | 61da055ffeb349b4eda14bc9ac393af9ce842364 | [
"MIT"
] | 81 | 2017-03-08T20:28:00.000Z | 2022-01-23T08:19:31.000Z | src/cache_server_main.cpp | gatehouse/cppcms | 61da055ffeb349b4eda14bc9ac393af9ce842364 | [
"MIT"
] | 127 | 2017-03-05T21:53:40.000Z | 2022-02-25T02:31:01.000Z | ///////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2008-2012 Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com>
//
// See accompanying file COPYING.TXT file for licensing details.
//
///////////////////////////////////////////////////////////////////////////////
#if defined(__sun)
#define _POSIX_PTHREAD_SEMANTICS
#endif
#include "tcp_cache_server.h"
#include "cache_storage.h"
#ifndef CPPCMS_WIN32
#include <signal.h>
#include "daemonize.h"
#endif
#ifdef CPPCMS_WIN_NATIVE
#include "winservice.h"
#endif
#include <iostream>
#include <stdlib.h>
#include <stdexcept>
#include <booster/shared_ptr.h>
#include <booster/intrusive_ptr.h>
#include <booster/shared_object.h>
#include <booster/thread.h>
#include <booster/log.h>
#include "base_cache.h"
#include "logging.h"
#include <cppcms/session_storage.h>
#include <cppcms/json.h>
#include <cppcms/service.h>
#include <cppcms/cppcms_error.h>
#ifdef CPPCMS_WIN_NATIVE
#include "session_win32_file_storage.h"
#include "winservice.h"
#else
#include "session_posix_file_storage.h"
#endif
#include "session_memory_storage.h"
struct settings {
std::string ip;
int port;
int threads;
int gc;
cppcms::json::value config;
booster::shared_ptr<cppcms::sessions::session_storage_factory> sessions;
booster::shared_object plugin;
booster::intrusive_ptr<cppcms::impl::base_cache> cache;
~settings()
{
sessions.reset(); // ensure that sessions object is destroyed before shared object
cache = 0;
}
settings(int argc,char **argv)
{
try {
config = cppcms::service::load_settings(argc,argv);
setup(config);
}
catch(cppcms::cppcms_error const &) {
help();
throw;
}
}
void help()
{
std::cerr <<
"usage: cppcms_scale [ -c config.js ] [ parameters ]\n"
" -c config.js JSON, Configuration file, also parameters may\n"
" be set via command line rather then the file\n"
" --ip=IP IP to bind, default 0.0.0.0\n"
" --port=N Port to bind, mandatory\n"
" --threads=N Worker threads, default = # HW CPU\n"
" --cache-limit=N The size of the cache in items\n"
" --session-storage=(memory|files|external)\n"
" Session storage module\n"
" --session-gc=N The frequency of garbage collection\n"
" --session-dir=/path The location of files for session storage\n"
" --session-shared_object=/path\n"
" The shared object/dll that is used as external\n"
" storage"
" --session-module=name\n"
" The name of the module for example mymod for\n"
" an external storage, renamed to shared object\n"
" according to OS conventions, like libmymod.so\n"
#ifndef CPPCMS_WIN32
" --daemon-enable=(true|false)\n"
" Run the process as daemon, default false\n"
" --daemon-lock=/path Location of the lock file that keeps process pid\n"
" --daemon-user=user User that the daemon should run under\n"
" --daemon-group=grp Group that the daemon should run under\n"
" --daemon-chroot=/path\n"
" Run the service in chroot jain\n"
" --daemon-fdlimit=N The limit of file descriptors for the service\n"
#endif
#ifdef CPPCMS_WIN_NATIVE
" --winservice-mode=(install|uninstall)\n"
" Install or uninstall windows service\n"
" --winservice-name=XXX\n"
" Name of windows service\n"
" --winservice-display_name=XXX\n"
" The service name shown in the UI\n"
" --winservice-start=(auto|demand)\n"
" Windows service start mode\n"
" --winservice-user=XXX\n"
" --winservice-password=XXX\n"
" The user and password the service would run under\n"
#endif
<< std::endl;
}
void setup(cppcms::json::value const &v)
{
ip=v.get("ip","0.0.0.0");
port=v.get<int>("port");
threads=v.get("threads",booster::thread::hardware_concurrency());
int items = v.get("cache.limit",-1);
if(items!=-1){
cache = cppcms::impl::thread_cache_factory(items);
}
gc=v.get("session.gc",10);
std::string stor = v.get("session.storage","");
if(!stor.empty()) {
#ifndef CPPCMS_NO_GZIP
if(stor == "files") {
std::string dir = v.get("session.dir","");
#ifdef CPPCMS_WIN_NATIVE
sessions.reset(new cppcms::sessions::session_file_storage_factory(dir));
#else
sessions.reset(new cppcms::sessions::session_file_storage_factory(dir,threads,1,false));
#endif
}
else
#endif //CPPCMS_NO_GZIP
if(stor == "memory") {
sessions.reset(new cppcms::sessions::session_memory_storage_factory());
}
else if(stor == "external") {
std::string so = v.get<std::string>("session.shared_object","");
std::string module = v.get<std::string>("session.module","");
std::string entry_point = v.get<std::string>("session.entry_point","sessions_generator");
if(so.empty() && module.empty())
throw cppcms::cppcms_error(
"session.storage=external "
"and neither session.shared_object "
"nor session.module is defined");
if(!so.empty() && !module.empty())
throw cppcms::cppcms_error(
"both session.shared_object "
"and session.module are defined");
if(so.empty()) {
so = booster::shared_object::name(module);
}
std::string error;
if(!plugin.open(so,error)) {
throw cppcms::cppcms_error("sessions_pool: failed to load shared object " + so + ": " + error);
}
cppcms::sessions::cppcms_session_storage_generator_type f=0;
plugin.symbol(f,entry_point);
sessions.reset(f(v.find("session.settings")));
}
else
throw cppcms::cppcms_error("Unknown session.storage:"+stor);
}
if(!sessions && !cache) {
throw cppcms::cppcms_error("Neither cache.limit nor session.storage is defined");
}
}
};
#if !defined(CPPCMS_WIN32)
void main_posix(settings &par)
{
cppcms::impl::daemonizer demon(par.config);
cppcms::impl::tcp_cache_service srv(
par.cache,
par.sessions,
par.threads,
par.ip,
par.port,
par.gc);
// Wait for signals for exit
sigset_t wait_mask;
sigemptyset(&wait_mask);
sigaddset(&wait_mask, SIGINT);
sigaddset(&wait_mask, SIGQUIT);
sigaddset(&wait_mask, SIGTERM);
pthread_sigmask(SIG_BLOCK, &wait_mask, 0);
int sig = 0;
sigwait(&wait_mask, &sig);
BOOSTER_NOTICE("cppcms_scale")<<"Catch signal: exiting...";
srv.stop();
}
#elif defined(CPPCMS_WIN_NATIVE)
static booster::shared_ptr<cppcms::impl::tcp_cache_service> the_server;
static settings *the_settings;
static booster::mutex done_lock;
static booster::condition_variable done_cond;
static bool done;
static void win_prepare()
{
BOOSTER_NOTICE("cppcms_scale")<<"Starting service...";
settings &par = *the_settings;
the_server.reset(
new cppcms::impl::tcp_cache_service(
par.cache,
par.sessions,
par.threads,
par.ip,
par.port,
par.gc)
);
}
static void win_stop()
{
booster::unique_lock<booster::mutex> guard(done_lock);
done = true;
done_cond.notify_all();
}
static void win_run()
{
{
booster::unique_lock<booster::mutex> guard(done_lock);
while(!done) {
done_cond.wait(guard);
}
}
BOOSTER_NOTICE("cppcms_scale")<<"Stopping service...";
the_server->stop();
the_server.reset();
the_settings = 0;
}
void main_win(settings &par,int argc,char **argv)
{
using cppcms::impl::winservice;
the_settings = ∥
winservice::instance().prepare(win_prepare);
winservice::instance().stop(win_stop);
winservice::instance().exec(win_run);
winservice::instance().run(par.config,argc,argv);
}
#endif
#ifdef CPPCMS_WIN32
void main_console(settings &par)
{
cppcms::impl::tcp_cache_service srv(
par.cache,
par.sessions,
par.threads,
par.ip,
par.port,
par.gc);
std::cout << "Press any key to stop..." << std::flush;
std::cin.get();
srv.stop();
}
#endif
int main(int argc,char **argv)
{
try
{
settings par(argc,argv);
cppcms::impl::setup_logging(par.config);
#ifndef CPPCMS_WIN32
main_posix(par);
#elif defined CPPCMS_WIN_NATIVE
if(cppcms::impl::winservice::is_console(par.config))
main_console(par);
else
main_win(par,argc,argv);
#else // cygwin
main_console(par);
#endif
}
catch(std::exception const &e) {
BOOSTER_ERROR("cppcms_scale")<<e.what()<<booster::trace(e);
return 1;
}
return 0;
}
| 27.391026 | 100 | 0.638193 | [
"object"
] |
e8202fa41cc0e131f4e74c986f362076cb5e3b05 | 4,245 | cpp | C++ | src/EVector.cpp | hoolheart/EinkDataDriver | 6fe82f3be70f276559184f87888f7a1d320a23cb | [
"Apache-2.0"
] | 1 | 2015-12-18T20:22:25.000Z | 2015-12-18T20:22:25.000Z | src/EVector.cpp | hoolheart/EinkDataDriver | 6fe82f3be70f276559184f87888f7a1d320a23cb | [
"Apache-2.0"
] | null | null | null | src/EVector.cpp | hoolheart/EinkDataDriver | 6fe82f3be70f276559184f87888f7a1d320a23cb | [
"Apache-2.0"
] | null | null | null | /*
* EVector.cpp
*
* Created on: 2013-1-17
* Author: Edward Chou
*/
#include "EVector.h"
#include <stdlib.h>
#include <time.h>
VEC_TEMPLATE
EVectorT::EVector(unsigned int _l) {
length = _l;
dat = new T[_l];
}
VEC_TEMPLATE
EVectorT::EVector(unsigned int _l, T _ini) {
length = _l;
dat = new T[_l];
for (int i=0;i<_l;i++) {
dat[i]=_ini;
}
}
VEC_TEMPLATE
EVectorT::EVector(const EVectorT &_other) {
length = _other.Length();
dat = new T[length];
for (int i=0;i>length;i++) {
dat[i] = _other[i];
}
}
VEC_TEMPLATE
EVectorT::~EVector() {
delete dat;
}
VEC_TEMPLATE
T& EVectorT::operator [](unsigned int _pos) _THROW_ERROR
{
if(_pos>=length)
reportErr("Vector Operation[] Error: Index Out of Range!");
return dat[_pos];
}
VEC_TEMPLATE
T EVectorT::operator [](unsigned int _pos) const _THROW_ERROR
{
if(_pos>=length)
reportErr("Vector Operation[] Error: Index Out of Range!");
return dat[_pos];
}
VEC_TEMPLATE
void EVectorT::rands() {
for (int i=0;i<length;i++) {
srand((unsigned)time(NULL));
dat[i] = (T)rand();
}
}
VEC_TEMPLATE
void EVectorT::rands(T lb, T ub) {
T k = (ub-lb)/(T)RAND_MAX;
for (int i=0;i<length;i++) {
srand((unsigned)time(NULL));
dat[i] = lb+k*(T)rand();
}
}
VEC_TEMPLATE
EVectorT EVectorT::operator -() _NO_THROW
{
EVectorT temp(*this);
return temp;
}
VEC_TEMPLATE
EVectorT& EVectorT::operator=(const EVectorT &_m) _NO_THROW
{
if(length != _m.Length()) {
if (length!=0) delete dat;
length = _m.Length();
dat = new T[length];
}
for(unsigned int i=0;i<length;i++)
{
dat[i] = _m[i];
}
return *this;
}
VEC_TEMPLATE
EVectorT& EVectorT::operator +=(const EVectorT &_m) _THROW_ERROR
{
if(length != _m.Length())
reportErr("Vector Operation += Error: the Size is different!");
for(unsigned int i=0;i<length;i++)
dat[i] += _m[i];
return *this;
}
VEC_TEMPLATE
EVectorT& EVectorT::operator +=(T c) _NO_THROW
{
for(unsigned int i=0;i<length;i++)
dat[i] += c;
return *this;
}
VEC_TEMPLATE
EVectorT& EVectorT::operator -=(const EVectorT &_m) _THROW_ERROR
{
if(length != _m.Length())
reportErr("Vector Operation += Error: the Size is different!");
for(unsigned int i=0;i<length;i++)
dat[i] -= _m[i];
return *this;
}
VEC_TEMPLATE
EVectorT& EVectorT::operator -=(T c) _NO_THROW
{
for(unsigned int i=0;i<length;i++)
dat[i] -= c;
return *this;
}
VEC_TEMPLATE
EVectorT& EVectorT::operator *=(T c) _NO_THROW
{
for(unsigned int i=0;i<length;i++)
dat[i] *= c;
return *this;
}
VEC_TEMPLATE
EVectorT& EVectorT::operator /=(T c) _THROW_ERROR
{
if(c==0)
reportErr("Divided by zero!");
for(unsigned int i=0;i<length;i++)
dat[i] /= c;
return *this;
}
VEC_TEMPLATE
EVectorT operator+(const EVectorT &m1, const EVectorT &m2) _THROW_ERROR
{
EVectorT temp(m1);
temp += m2;
return temp;
}
VEC_TEMPLATE
EVectorT operator+(T c, const EVectorT &m) _NO_THROW
{
EVectorT temp(m);
temp += c;
return temp;
}
VEC_TEMPLATE
EVectorT operator+(const EVectorT &m, T c) _NO_THROW
{
EVectorT temp(m);
temp += c;
return temp;
}
VEC_TEMPLATE
EVectorT operator-(const EVectorT &m1, const EVectorT &m2) _THROW_ERROR
{
EVectorT temp(m1);
temp -= m2;
return temp;
}
VEC_TEMPLATE
EVectorT operator-(T c, const EVectorT &m) _NO_THROW
{
EVectorT temp(-m);
temp += c;
return temp;
}
VEC_TEMPLATE
EVectorT operator-(const EVectorT &m, T c) _NO_THROW
{
EVectorT temp(m);
temp -= c;
return temp;
}
VEC_TEMPLATE
T dotproduct(const EVectorT &m1, const EVectorT &m2) _THROW_ERROR
{
if(m1.Length()!=m2.Length())
reportErr("Dot product error: Sizes are different!");
T t=0;
for(unsigned int i=0;i<m1.Length();i++)
t += m1[i]*m2[i];
return t;
}
VEC_TEMPLATE
EVectorT operator*(T c, const EVectorT &m) _NO_THROW
{
EVectorT temp(m);
temp *= c;
return temp;
}
VEC_TEMPLATE
EVectorT operator*(const EVectorT &m, T c) _NO_THROW
{
EVectorT temp(m);
temp *= c;
return temp;
}
VEC_TEMPLATE
EVectorT operator/(const EVectorT &m, T c) _THROW_ERROR
{
if(c==0)
reportErr("Divided by zero!");
EVectorT temp(m);
temp /= c;
return temp;
}
| 18.866667 | 71 | 0.634629 | [
"vector"
] |
e8267e4cc9fd6001107899491799d35758d019e0 | 11,986 | cpp | C++ | src/database/sqliteDbms.cpp | Galfurian/RadMud | 1362cb0ee1b7a17386e57a98e29dd8baeea75af3 | [
"MIT"
] | 18 | 2016-05-26T18:11:31.000Z | 2022-02-10T20:00:52.000Z | src/database/sqliteDbms.cpp | Galfurian/RadMud | 1362cb0ee1b7a17386e57a98e29dd8baeea75af3 | [
"MIT"
] | null | null | null | src/database/sqliteDbms.cpp | Galfurian/RadMud | 1362cb0ee1b7a17386e57a98e29dd8baeea75af3 | [
"MIT"
] | 2 | 2016-06-30T15:20:01.000Z | 2020-08-27T18:28:33.000Z | /// @file sqliteDbms.cpp
/// @brief It's manage action to Database.
/// @author Enrico Fraccaroli
/// @date Aug 23 2014
/// @copyright
/// Copyright (c) 2016 Enrico Fraccaroli <enrico.fraccaroli@gmail.com>
/// 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 "sqliteDbms.hpp"
#include "sqliteLoadFunctions.hpp"
#include "logger.hpp"
#include "mud.hpp"
#include "sqliteException.hpp"
SQLiteDbms::SQLiteDbms() :
dbConnection(),
loaders()
{
loaders.emplace_back(
TableLoader("BadName", LoadBadName));
loaders.emplace_back(
TableLoader("BlockedIp", LoadBlockedIp));
loaders.emplace_back(
TableLoader("News", LoadNews));
loaders.emplace_back(
TableLoader("Terrain", LoadTerrain));
loaders.emplace_back(
TableLoader("Material", LoadMaterial));
loaders.emplace_back(
TableLoader("Area", LoadArea));
loaders.emplace_back(
TableLoader("Room", LoadRoom));
loaders.emplace_back(
TableLoader("Exit", LoadExit));
loaders.emplace_back(
TableLoader("AreaList", LoadAreaList));
loaders.emplace_back(
TableLoader("TravelPoint", LoadTravelPoint));
loaders.emplace_back(
TableLoader("BodyPart", LoadBodyPart));
loaders.emplace_back(
TableLoader("Model", LoadModel));
loaders.emplace_back(
TableLoader("Faction", LoadFaction));
loaders.emplace_back(
TableLoader("Race", LoadRace));
loaders.emplace_back(
TableLoader("RaceBodyPart", LoadRaceBodyPart));
loaders.emplace_back(
TableLoader("RaceCorpse", LoadRaceCorpse));
loaders.emplace_back(
TableLoader("Liquid", LoadLiquid));
loaders.emplace_back(
TableLoader("Item", LoadItem));
loaders.emplace_back(
TableLoader("ItemContent", LoadContent));
loaders.emplace_back(
TableLoader("ItemContentLiq", LoadContentLiq));
loaders.emplace_back(
TableLoader("ItemRoom", LoadItemRoom));
loaders.emplace_back(
TableLoader("Writings", LoadWriting));
loaders.emplace_back(
TableLoader("Profession", LoadProfession));
loaders.emplace_back(
TableLoader("Production", LoadProduction));
loaders.emplace_back(
TableLoader("ProductionTool", LoadProductionTool));
loaders.emplace_back(
TableLoader("ProductionOutcome", LoadProductionOutcome));
loaders.emplace_back(
TableLoader("ProductionIngredient", LoadProductionIngredient));
loaders.emplace_back(
TableLoader("ProductionKnowledge", LoadProductionKnowledge));
loaders.emplace_back(
TableLoader("Currency", LoadCurrency));
loaders.emplace_back(
TableLoader("ModelBodyPart", LoadModelBodyPart));
loaders.emplace_back(
TableLoader("Mobile", LoadMobile));
loaders.emplace_back(
TableLoader("Skill", LoadSkill));
loaders.emplace_back(
TableLoader("SkillPrerequisite", LoadSkillPrerequisite));
loaders.emplace_back(
TableLoader("SkillAbilityModifier", LoadSkillAbilityModifier));
loaders.emplace_back(
TableLoader("SkillStatusModifier", LoadSkillStatusModifier));
loaders.emplace_back(
TableLoader("SkillCombatModifier", LoadSkillCombatModifier));
loaders.emplace_back(
TableLoader("SkillKnowledge", LoadSkillKnowledge));
loaders.emplace_back(
TableLoader("BodyPartResources", LoadBodyPartResources));
loaders.emplace_back(
TableLoader("BodyPartWeapon", LoadBodyPartWeapon));
loaders.emplace_back(
TableLoader("RaceBaseSkill", LoadRaceBaseSkill));
loaders.emplace_back(
TableLoader("RaceBaseAbility", LoadRaceBaseAbility));
loaders.emplace_back(
TableLoader("HeightMap", LoadHeightMap));
loaders.emplace_back(
TableLoader("HeightMapThreshold", LoadHeightMapThreshold));
loaders.emplace_back(
TableLoader("TerrainLiquid", LoadTerrainLiquid));
loaders.emplace_back(
TableLoader("TerrainLiquidSources", LoadTerrainLiquidSources));
loaders.emplace_back(
TableLoader("RoomLiquid", LoadRoomLiquid));
loaders.emplace_back(
TableLoader("Building", LoadBuilding));
loaders.emplace_back(
TableLoader("BuildingIngredient", LoadBuildingIngredient));
loaders.emplace_back(
TableLoader("BuildingKnowledge", LoadBuildingKnowledge));
loaders.emplace_back(
TableLoader("BuildingTool", LoadBuildingTool));
loaders.emplace_back(
TableLoader("Shop", LoadShop));
}
SQLiteDbms::~SQLiteDbms()
{
// Nothing to do.
}
SQLiteDbms & SQLiteDbms::instance()
{
// Since it's a static variable, if the class has already been created,
// It won't be created again. And it **is** thread-safe in C++11.
static SQLiteDbms instance;
// Return a reference to our instance.
return instance;
}
bool SQLiteDbms::openDatabase()
{
if (!dbConnection.openConnection(Mud::instance().getMudDatabaseName(),
Mud::instance().getMudSystemDirectory(),
true))
{
this->showLastError();
return false;
}
return true;
}
bool SQLiteDbms::closeDatabase()
{
if (!dbConnection.closeConnection())
{
this->showLastError();
return false;
}
return true;
}
bool SQLiteDbms::loadTables()
{
// Status variable for loading operation.
bool status = true;
for (auto iterator : loaders)
{
Logger::log(LogLevel::Debug,
" Loading Table: " + iterator.table + ".");
// Execute the query.
auto result = dbConnection.executeSelect(iterator.getQuery().c_str());
// Check the result.
if (result == nullptr)
{
return false;
}
try
{
// Iterate through the rows.
while (result->next())
{
// Call the row parsing function.
iterator.loadFunction(result);
}
}
catch (SQLiteException & e)
{
Logger::log(LogLevel::Error, std::string(e.what()));
// Release the resource.
result->release();
status = false;
break;
}
// Release the resource.
result->release();
}
return status;
}
bool SQLiteDbms::insertInto(std::string table,
std::vector<std::string> args,
bool orIgnore,
bool orReplace)
{
std::stringstream stream;
stream << "INSERT";
if (orIgnore)
{
stream << " OR IGNORE";
}
else if (orReplace)
{
stream << " OR REPLACE";
}
stream << " INTO `" << table << "`" << std::endl;
stream << "VALUES(" << std::endl;
for (auto it = args.begin(); it != args.end(); ++it)
{
auto value = (*it);
if ((it + 1) == args.end())
{
stream << "\"" << value << "\");";
}
else
{
stream << "\"" << value << "\", ";
}
}
return (dbConnection.executeQuery(stream.str().c_str()) != 0);
}
bool SQLiteDbms::deleteFrom(std::string table, QueryList where)
{
std::stringstream stream;
stream << "DELETE FROM " << table << std::endl;
stream << "WHERE" << std::endl;
for (auto it = where.begin(); it != where.end(); ++it)
{
auto clause = (*it);
if ((it + 1) == where.end())
{
stream << " " << clause.first
<< " = \"" << clause.second << "\";" << std::endl;
}
else
{
stream << " " << clause.first
<< " = \"" << clause.second << "\" AND" << std::endl;
}
}
return (dbConnection.executeQuery(stream.str().c_str()) != 0);
}
bool SQLiteDbms::updateInto(std::string table, QueryList value, QueryList where)
{
std::stringstream stream;
stream << "UPDATE " << table << std::endl;
stream << "SET" << std::endl;
for (auto it = value.begin(); it != value.end(); ++it)
{
auto clause = (*it);
if ((it + 1) == value.end())
{
stream << " " << clause.first
<< " = \"" << clause.second << "\"" << std::endl;
}
else
{
stream << " " << clause.first
<< " = \"" << clause.second << "\"," << std::endl;
}
}
stream << "WHERE" << std::endl;
for (auto it = where.begin(); it != where.end(); ++it)
{
auto clause = (*it);
if ((it + 1) == where.end())
{
stream << " " << clause.first
<< " = \"" << clause.second << "\";" << std::endl;
}
else
{
stream << " " << clause.first
<< " = \"" << clause.second << "\" AND" << std::endl;
}
}
return (dbConnection.executeQuery(stream.str().c_str()) != 0);
}
bool SQLiteDbms::updatePlayers()
{
// Start a new transaction.
dbConnection.beginTransaction();
for (auto player : Mud::instance().mudPlayers)
{
if (player->isPlaying())
{
if (!player->updateOnDB())
{
Logger::log(LogLevel::Error,
"Can't save the player '%s'.", player->getName());
this->showLastError();
}
}
}
// Complete the transaction.
dbConnection.endTransaction();
return true;
}
bool SQLiteDbms::updateItems()
{
// Start a transaction.
// dbConnection.beginTransaction();
for (auto it : Mud::instance().mudItems)
{
if (!it.second->updateOnDB())
{
Logger::log(LogLevel::Error,
"Can't save the item '%s'.", it.second->getName());
this->showLastError();
}
}
// Complete the transaction.
// dbConnection.endTransaction();
return true;
}
bool SQLiteDbms::updateRooms()
{
// Start a new transaction.
// dbConnection.beginTransaction();
for (auto it : Mud::instance().mudRooms)
{
if (!it.second->updateOnDB())
{
Logger::log(LogLevel::Error,
"Can't save the room '%s'.", it.second->name);
this->showLastError();
}
}
// Complete the transaction.
// dbConnection.endTransaction();
return true;
}
void SQLiteDbms::beginTransaction()
{
dbConnection.beginTransaction();
}
void SQLiteDbms::rollbackTransection()
{
dbConnection.rollbackTransection();
}
void SQLiteDbms::endTransaction()
{
dbConnection.endTransaction();
}
void SQLiteDbms::showLastError() const
{
Logger::log(LogLevel::Error,
"Error code :" + ToString(dbConnection.getLastErrorCode()));
Logger::log(LogLevel::Error,
"Last error :" + dbConnection.getLastErrorMsg());
}
| 31.376963 | 80 | 0.593359 | [
"vector",
"model"
] |
e828c78a25503e99b0062fa9bfedb12c380103f5 | 4,060 | cpp | C++ | Graph Algorithms/tp.cpp | mishrakeshav/CSES-Problem-Set | 7f7169b20af44430e9208ba22c122054cea23ca1 | [
"MIT"
] | null | null | null | Graph Algorithms/tp.cpp | mishrakeshav/CSES-Problem-Set | 7f7169b20af44430e9208ba22c122054cea23ca1 | [
"MIT"
] | null | null | null | Graph Algorithms/tp.cpp | mishrakeshav/CSES-Problem-Set | 7f7169b20af44430e9208ba22c122054cea23ca1 | [
"MIT"
] | null | null | null | /* SAMPLE
5 8
########
#M..A..#
#.#.M#.#
#M#..#..
#.######
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pi = pair<ll, ll>;
using vi = vector<ll>;
ll n, m;
int main() {
cin >> n >> m;
vector<vector<bool>> wall(n, vector<bool>(m, 0));
set<pi> monsters;
pi start;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
char c;
cin >> c;
if (c == '#') wall[i][j] = true;
if (c == 'M') monsters.insert({i, j});
if (c == 'A') start = {i, j};
}
}
vector<vector<int>> closestMonster(n, vector<int>(m, INT_MAX));
vector<vector<int>> closestHuman(n, vector<int>(m, INT_MAX));
queue<pair<pi, int>> q;
//cout << "bfs to find how close each square is to a monster" << endl;
for (pi mon : monsters) {
q.push({mon, 0});
closestMonster[mon.first][mon.second] = 0;
}
vector<pi> adj = {
{1, 0},
{-1, 0},
{0, 1},
{0, -1}
};
while (!q.empty()) {
pair<pi, int> top = q.front();
q.pop();
pi loc = top.first;
int depth = top.second;
for (pi dir : adj) {
int i = dir.first + loc.first;
int j = dir.second + loc.second;
if (i < 0 || i >= n || j < 0 || j >= m) continue;
if (wall[i][j]) continue;
if (closestMonster[i][j] != INT_MAX) continue;
q.push({{i, j}, depth + 1});
closestMonster[i][j] = depth + 1;
}
}
//cout << "bfs to find how close each square is to a human" << endl;
q.push({start, 0});
closestHuman[start.first][start.second] = 0;
while (!q.empty()) {
pair<pi, int> top = q.front();
q.pop();
pi loc = top.first;
int depth = top.second;
for (pi dir : adj) {
int i = dir.first + loc.first;
int j = dir.second + loc.second;
if (i < 0 || i >= n || j < 0 || j >= m) continue;
if (wall[i][j]) continue;
if (closestHuman[i][j] != INT_MAX) continue;
q.push({{i, j}, depth + 1});
closestHuman[i][j] = depth + 1;
}
}
vector<vector<bool>> doable(n, vector<bool>(m, 0));
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
doable[i][j] = closestHuman[i][j] < closestMonster[i][j];
}
}
//cout << "find shortest path to an ending" << endl;
vector<vector<char>> dirs(n, vector<char>(m, 0));
vector<vector<pi>> parent(n, vector<pi>(m, {-1, -1}));
vector<vector<bool>> visit(n, vector<bool>(m, 0));
q.push({start, 0});
visit[start.first][start.second] = true;
while (!q.empty()) {
pair<pi, int> top = q.front();
q.pop();
pi loc = top.first;
int depth = top.second;
if(loc.first == 0 || loc.first == n - 1 || loc.second == 0 || loc.second == m - 1) {
vector<char> seq;
for (pi curr = loc; curr != start; curr = parent[curr.first][curr.second]) {
seq.push_back(dirs[curr.first][curr.second]);
}
cout << "YES" << endl;
reverse(seq.begin(), seq.end());
cout << seq.size() << endl;
for (char c : seq) cout << c;
cout << endl;
return 0;
}
for (pi dir : adj) {
int i = dir.first + loc.first;
int j = dir.second + loc.second;
if (i < 0 || i >= n || j < 0 || j >= m) continue;
if (!doable[i][j]) continue;
if (visit[i][j]) continue;
if (dir.first == -1) dirs[i][j] = 'U';
if (dir.first == 1) dirs[i][j] = 'D';
if (dir.second == 1) dirs[i][j] = 'R';
if (dir.second == -1) dirs[i][j] = 'L';
parent[i][j] = {loc.first, loc.second};
visit[i][j] = true;
q.push({{i, j}, depth + 1});
}
}
cout << "NO" << endl;
return 0;
} | 27.248322 | 92 | 0.438916 | [
"vector"
] |
e831cd4b31a426c1bf1375ed314288f20e6e7fbb | 33,111 | cpp | C++ | src/World.cpp | petedishman/RayTracer | b073f3f9db6838a1b1291ae7f34db20ce134c3ed | [
"MIT"
] | null | null | null | src/World.cpp | petedishman/RayTracer | b073f3f9db6838a1b1291ae7f34db20ce134c3ed | [
"MIT"
] | 1 | 2018-11-23T04:57:30.000Z | 2018-11-26T11:41:08.000Z | src/World.cpp | petedishman/RayTracer | b073f3f9db6838a1b1291ae7f34db20ce134c3ed | [
"MIT"
] | null | null | null | // World.cpp: implementation of the CWorld class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "RayTracer.h"
#include <time.h> // This is just for seeding the random number generator
#include "RayTracing.h"
#include "RayTable.h"
#include "World.h"
#include "RenderProgressDlg.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CWorld::CWorld()
{
FileParser = new CFileParser((CWorld*) this);
RayArray = NULL;
ImageFile = NULL;
PreScaledImage = NULL;
RestoreRenderOptions();
FocalLength = 500.0;
LensRadius = 1.0;
KeepRendering = TRUE;
}
CWorld::~CWorld()
{
delete FileParser;
// save settings to registry
SaveRenderOptions();
// just to make sure there's no objects about
RestoreDefaults();
}
BOOL CWorld::ConstructScene(CString *source_text)
{
CString input;
input = *source_text;
// clean everything up before we read in new stuff
RestoreDefaults();
if (FileParser->ParseInput(&input))
{
return true;
}
else
{
// set up the error index so that calling function can highlight error
ParserErrorIndex = FileParser->ErrorAtIndex;
return false;
}
}
void CWorld::RestoreDefaults()
{
// This function will wipe out all of the stored world
// information ready for a fresh set or when an error
// occurs and we want to remove some dodgy data
// we need to delete all the lights we created
Light_List.FreeExtra();
for (int i = 0; i < Light_List.GetSize(); i++)
delete Light_List[i];
Light_List.RemoveAll();
// we need to delete all the objects we created
Object_List.FreeExtra();
for (int i = 0; i < Object_List.GetSize(); i++)
delete Object_List[i];
Object_List.RemoveAll();
// return all the other values to their default states
CameraLocation.Heading.Set(0.0, 0.0, 1.0);
CameraLocation.Postion.Set(0.0, 0.0, -100.0);
CameraLocation.Up.Set(0.0, 1.0, 0.0);
bg_Colour.Set(0.0f, 0.0f, 0.0f);
AmbientLight.Set(1.0f, 1.0f, 1.0f);
FieldOfView = 30.0;
Fog_Distance = 5000.0;
Image_Height = 0;
Image_Width = 0;
KeepRendering = TRUE;
}
int CWorld::GetImageHeight()
{
return Image_Height;
}
BOOL CWorld::EverythingReady()
{
// FileParser ensures they're positive
if (Image_Height != 0 && Image_Width != 0 && Object_List.GetSize() != 0 && Light_List.GetSize() != 0)
return TRUE;
else
{
HWND hWnd = AfxGetApp()->m_pMainWnd->m_hWnd;
if (Image_Height == 0)
MessageBox(hWnd, _T("You must specify a Height for the image"), _T("Error in Input"), MB_OK);
if (Image_Width == 0)
MessageBox(hWnd, _T("You must specify a Width for the image"), _T("Error in Input"), MB_OK);
if (Object_List.GetSize() == 0)
MessageBox(hWnd, _T("You must specify at least one object"), _T("Error in Input"), MB_OK);
if (Light_List.GetSize() == 0)
MessageBox(hWnd, _T("You must specify at least one light"), _T("Error in Input"), MB_OK);
return FALSE;
}
}
void CWorld::RenderImage()
{
// This is the main rendering function
// this is called and it results in the picture being created
Stats.Set_RenderStart();
Stats.Set_TotalLights(Light_List.GetSize());
Stats.Set_TotalObjects(Object_List.GetSize());
Stats.Set_ImageWidth(Image_Width);
Stats.Set_ImageHeight(Image_Height);
Stats.Set_ClampColours(ClampColours);
Stats.Set_DepthOfField(DepthOfFieldOn);
Stats.Set_FocalLength(FocalLength);
Stats.Set_LensRadius(LensRadius);
Stats.Set_LightAtten(LightAtten);
Stats.Set_AtmosFogging(AtmosFogging);
Stats.Set_MaxDepth(MaxDepth);
Stats.Set_RaysPerPixel(RaysPerPixel);
Stats.Set_StochasticSS(StochasticSS);
// Need to create the output filename based off of the input file name
CString OutputFileName;
OutputFileName += OutputDir;
if (OutputFileName.Right(2) != _T("\\"))
OutputFileName += _T("\\");
if (InputFileName.Right(4) == _T(".rsd"))
{
CString temp;
temp = InputFileName.Left(InputFileName.GetLength() - 4);
temp += _T(".tga");
OutputFileName += temp;
}
else
{
OutputFileName += InputFileName;
OutputFileName += _T(".tga");
}
// check to see that the file doesn't exist all ready
CFile File;
if (File.Open((LPCTSTR) OutputFileName, CFile::modeRead | CFile::shareDenyNone, NULL))
{
int result;
// the file exists
result = MessageBox(AfxGetApp()->m_pMainWnd->m_hWnd,
_T("The output file already exists, either rename the existing file now\nor click OK to overwrite it anyway"),
_T("File Exists"), MB_OK);
File.Close();
}
Stats.Set_OutputFile(OutputFileName);
Stats.Set_InputFile(InputFileName);
// Initialise the renderer
// First we need to set up the projection plane
CalculateProjectionPlane();
// we'll initialise the RayArray here too
RayArray = new CRay[RaysPerPixel];
// We also need to initialise the Targa surface to write to
ImageFile = new CTarga;
// seed random number generator with current time;
srand((unsigned) time(NULL));
// we're not fussed about background colour as we will be writing over
// every pixel anyway
ImageFile->create_canvas(Image_Width, Image_Height, 0,0,0);
if (!ClampColours)
{
// we need to create an array of CColour's to allow scaling to be performed
PreScaledImage = new CColour[Image_Width * Image_Height];
}
// render first line
// send message to dialog box
// repeat
for (int j = 0; j < Image_Height; j++)
{
RenderLine(j);
RenderingDialog->SendMessage(WM_USER_ONE_LINE_RENDERED, 0, 0);
}
// If we're scaling the colours ImageFile doesn't contain anything yet
// so here we perform the scaling putting the results in to ImageFile.
if (!ClampColours)
ScaleColours();
//MessageBox(AfxGetApp()->m_pMainWnd->m_hWnd, (LPCTSTR) OutputFileName, "Filename is", MB_OK);
// write out image file
if (!ImageFile->Write_Targa((LPCTSTR) OutputFileName))
MessageBox(AfxGetApp()->m_pMainWnd->m_hWnd, _T("Failed to create file"), _T("Filename"), MB_OK);
else
MessageBox(AfxGetApp()->m_pMainWnd->m_hWnd, _T("File created successfully"), _T("Filename"), MB_OK);
// we're done
// clear up memory allocations
ClearUpMemoryAllocations();
// send message saying we're done
RenderingDialog->SendMessage(WM_USER_RENDER_COMPLETE, 0, 0);
Stats.Set_RenderDone();
Stats.WriteStats();
}
// This is the thread function that gets the rendering going
// CRayTracerFileView will call this with AfxBeginThread()
UINT ThreadFunc (LPVOID pParam)
{
CWorld * WorldPtr;
WorldPtr = (CWorld *) pParam;
WorldPtr->RenderImage();
return 0;
}
void CWorld::CalculateProjectionPlane()
{
// This function will take the camera position information
// along with the field of view
// and calculate where the projection plane is going to be
// probably also want image height/width
// as it's probably best if the projection plane has the same
// aspect ratio that the image has.
CVector CentreOfPlane;
double HalfDistPlane;
CVector DirToEdgeOfPlane;
double HalfHeightPlane;
double AspectRatio;
CVector Edge1, Edge2;
double CameraToPlane = 1.0;
CentreOfPlane = CameraLocation.Postion + (CameraLocation.Heading * CameraToPlane);
HalfDistPlane = CameraToPlane * tan(0.5 * DEG2RAD(FieldOfView));
DirToEdgeOfPlane = CameraLocation.Up.Cross (CameraLocation.Heading); // Up x Heading
// the cross product automatically normalises the returned vector for us
Edge1 = CentreOfPlane + (DirToEdgeOfPlane * HalfDistPlane);
// negate the direction;
DirToEdgeOfPlane = DirToEdgeOfPlane * -1;
Edge2 = CentreOfPlane + (DirToEdgeOfPlane * HalfDistPlane);
///////////////////////////////////////////////////////////////
//
//
// -----------------
// | |
// | | we now have these 3 points on the plane
// * * *
// | |
// | |
// -----------------
//
// Trouble is we're not sure which way round Edge1 and Edge2 go
// need to figure that out, but they could be anywhere
//
// the location all depends on the cross product.
// with what I've got now (0,1,0)x(0,0,1) = (1,0,0)
// which would imply edge1 is the one on the right
// I'm going to go with that until something proves me wrong
////////////////////////////////////////////////////////////////
AspectRatio = (double) Image_Width / (double) Image_Height;
HalfHeightPlane = HalfDistPlane / AspectRatio;
// if we take a normalised copy of the camera up vector
// we can get the 4 positions of the plane;
CVector Up = CameraLocation.Up;
Up.Normalize();
ProjectionPlane.TopRight = Edge1 + (Up * HalfHeightPlane);
ProjectionPlane.TopLeft = Edge2 + (Up * HalfHeightPlane);
HalfHeightPlane = -HalfHeightPlane;
ProjectionPlane.BottomRight = Edge1 + (Up * HalfHeightPlane);
ProjectionPlane.BottomLeft = Edge2 + (Up * HalfHeightPlane);
// done
}
void CWorld::RenderLine(int j)
{
// This function will loop through all the pixels on this line and render them
CColour result;
for (int i = 0; i < Image_Width; i++)
{
result = RenderPixel(i, j);
// depending on whether we're clamping or scaling colours we need to do different things
// with result.
if (ClampColours)
{
// have a problem here
// rendering part is written with (0,0) being top left pixel
// but Targa class is written with (0,0) being bottom left
// and for good reason too if I remember
// so I'll put in a small kludge here to get round that and keep
// both as they are
ImageFile->Write_Pixel(i, (Image_Height - 1 - j), result.Get_Rbyte(), result.Get_Gbyte(), result.Get_Bbyte());
}
else
{
// scaling colours
PreScaledImage[j * Image_Width + i] = result;
}
}
}
CColour CWorld::RenderPixel(int i, int j)
{
// This is a trickier one
CColour temp;
// We want to check here every loop that the user hasn't cancelled the process
// Because we only check every once a pixel there might be a slight delay but nothing
// too noticeable unless they're doing 100rpps and a massive maxdepth with a really
// complicated scene. But it's not that important to have a quick response anyway
if (!KeepRendering)
{
// The User has cancelled it
// we can call TerminateRenderingThread() here which will then
// clear up any memory and stop the thread.
StopRendering();
}
if (DepthOfFieldOn)
{
// generate rays with depth of field ray function and average results;
// Need to generate depth of field style rays then render them as for
// ordinary rays, can probably happily move the calls to renderray below
// out of the if statement as that section can be kept identical.
// This function needs to generate a set of rays and place them in RayArray
GenerateDOFRays(i, j);
}
else
{
GenerateRays(i, j);
// the RayArray will now have the rays to use in it.
}
// Render all the different rays and then average their results
for (int n = 0; n < RaysPerPixel; n++)
{
Stats.Inc_PrimaryRays();
temp = temp + RenderRay(&(RayArray[n]), 0);
}
temp = temp * ((double) 1.0 / (double) RaysPerPixel);
return temp;
}
void CWorld::GenerateRays(int i, int j)
{
// This function will take a pixel address and then
// using the Rays per pixel value and the projection
// plane will calculate the rays needed filling in
// the RayArray array (what a great name :-) )
double x, y;
CVector AcrossPlane, DownPlane;
CVector PointOnPlane;
AcrossPlane = ProjectionPlane.TopRight - ProjectionPlane.TopLeft;
DownPlane = ProjectionPlane.BottomLeft - ProjectionPlane.TopLeft;
AcrossPlane.Normalize();
DownPlane.Normalize();
double LengthOfPlane, HeightOfPlane;
LengthOfPlane = (ProjectionPlane.TopRight - ProjectionPlane.TopLeft).Length();
HeightOfPlane = (ProjectionPlane.BottomLeft - ProjectionPlane.TopLeft).Length();
// we want to generate rays from the camera position to a point on the projection plane
double MaxJitter;
if (StochasticSS)
{
switch (RaysPerPixel)
{
case ONE_RPP:
MaxJitter = 0.5; // probably quite strange using stochastic on 1 rpp
break;
case FOUR_RPP:
MaxJitter = 0.25;
break;
case NINE_RPP:
MaxJitter = 1.0 / 6.0;
break;
case SIXTEEN_RPP:
MaxJitter = 1.0 / 8.0;
break;
case FORTYNINE_RPP:
MaxJitter = 1.0 / 14.0;
break;
case HUNDRED_RPP:
MaxJitter = 1.0 / 20.0;
break;
}
}
xy_pair temp;
for (int n = 0; n < RaysPerPixel; n++)
{
switch (RaysPerPixel)
{
case ONE_RPP:
temp = one_rpp[n];
break;
case FOUR_RPP:
temp = four_rpp[n];
break;
case NINE_RPP:
temp = nine_rpp[n];
break;
case SIXTEEN_RPP:
temp = sixteen_rpp[n];
break;
case FORTYNINE_RPP:
temp = fortynine_rpp[n];
break;
case HUNDRED_RPP:
temp = hundred_rpp[n];
break;
}
if (StochasticSS)
{
temp.x += GetRandomNumber(2.0 * MaxJitter) - MaxJitter;
temp.y += GetRandomNumber(2.0 * MaxJitter) - MaxJitter;
}
x = ((double) i + temp.x) / (double) Image_Width;
y = ((double) j + temp.y) / (double) Image_Height;
x *= LengthOfPlane;
y *= HeightOfPlane;
PointOnPlane = ProjectionPlane.TopLeft + (AcrossPlane * x) + (DownPlane * y);
RayArray[n].Start = CameraLocation.Postion;
RayArray[n].Dir = PointOnPlane - CameraLocation.Postion;
RayArray[n].Dir.Normalize();
RayArray[n].CurrentObjIndex = -1;
}
}
CColour CWorld::RenderRay(CRay *Ray, int Depth)
{
// This is the recursive part of the ray tracer
// we will call this recursively until we reach
// the max depth or don't need to go any further
CColour Result;
CColour ZeroColour;
s_ShadingInfo ShadingInformation;
s_IntersectionInfo Intersection;
int NoOfLightsVisible;
// we can count the number of rays by how many times this function gets called.
Stats.Inc_TotalRays();
Stats.Set_CurrentDepth(Depth);
if (Depth < MaxDepth)
{
// Render
// Find closest intersection of ray with all objects
// Find which lights are visible at that point
// Calculate colour of point from those lights
if (GetNearestIntersection(Ray, &Intersection))
{
NoOfLightsVisible = GetActiveLights(&Intersection);
// Build data structure to pass to shade function
ShadingInformation.Lights = &Light_List;
ShadingInformation.ActiveLights = &ActiveLight_List;
ShadingInformation.Intersection = ⋂
ShadingInformation.Ambient = &AmbientLight;
ShadingInformation.Ray = Ray;
ShadingInformation.LightAtten = LightAtten;
ShadingInformation.AtmosFogging = AtmosFogging;
// now we can tell the object to shade it self
Result = Object_List[Intersection.Index]->Shade(&ShadingInformation);
// we're not in air so we should scale the shaded colour by the transparency I reckon
if (Ray->CurrentObjIndex != -1)
Result = Result * Object_List[Intersection.Index]->Transparency;
// We're inside the object so we want to negate the normal to get the following
// calculations correct. We don't negate the normal for ordinary shading as
// ordinary shading is for calculating the effect of lights on the surfaces not inside
// them
CVector ZeroVec;
if (Ray->CurrentObjIndex != -1)
Intersection.Normal = ZeroVec - Intersection.Normal;
// at this point we can now generate the reflective ray and render it
// recursively with RenderRay(Ray, Depth + 1)
// we only do a reflective ray if the object is reflective
if ((Object_List[Intersection.Index]->Reflection != ZeroColour))
{
CColour Refl_Colour;
CRay ReflectedRay;
// Create the reflected ray
ReflectedRay.Start = Intersection.Point;
ReflectedRay.Dir = Object_List[Intersection.Index]->GetReflectedDir(Ray, &Intersection);
// Nudge the ray along a little to avoid it hitting the object it came from
ReflectedRay.Start = ReflectedRay.Evaluate(0.0005);
Stats.Inc_ReflectedRays();
Refl_Colour = RenderRay(&ReflectedRay, Depth + 1);
Refl_Colour = Refl_Colour * Object_List[Intersection.Index]->Reflection;
Result = Result + Refl_Colour;
}
// now we need to spawn refracted rays
if (Object_List[Intersection.Index]->Transparency != ZeroColour)
{
CColour Refr_Colour;
CVector RefractedRayDir;
CRay RefractedRay;
// We'll call GetRefractedDir with Ray containing the current objects RI
if (Object_List[Intersection.Index]->GetRefractedDir(Ray, &Intersection, &RefractedRayDir))
{
// Create the refracted ray
RefractedRay.Start = Intersection.Point;
RefractedRay.Dir = RefractedRayDir;
// if (Ray->CurrentRI == RI_AIR)
// RefractedRay.CurrentRI = Object_List[Intersection.Index]->Refractive_Index;
// else
// RefractedRay.CurrentRI = RI_AIR;
// If we're in air the new ray is in the object, if we're in the object
// the new ray is in air as that's all we're allowing.
if (Ray->CurrentObjIndex == -1)
RefractedRay.CurrentObjIndex = Intersection.Index;
else
RefractedRay.CurrentObjIndex = -1;
// Nudge the ray just a little bit
RefractedRay.Start = RefractedRay.Evaluate(0.0005);
Stats.Inc_TransmittedRays();
Refr_Colour = RenderRay(&RefractedRay, Depth + 1);
Refr_Colour = Refr_Colour * Object_List[Intersection.Index]->Transparency;
Result = Result + Refr_Colour;
}
else
{
// we might need to trace the totally internally reflected ray actually?????
RefractedRay.Start = Intersection.Point;
RefractedRay.Dir = RefractedRayDir;
// This ray should have the refractive index of the object as TIR rays should
// always be internal
RefractedRay.CurrentObjIndex = Intersection.Index;
// Nudge the ray just a little bit
RefractedRay.Start = RefractedRay.Evaluate(0.0005);
Stats.Inc_TIRRays();
Refr_Colour = RenderRay(&RefractedRay, Depth + 1);
Refr_Colour = Refr_Colour * Object_List[Intersection.Index]->Transparency;
Result = Result + Refr_Colour;
}
}
}
else
{
// we didn't get an intersection
Result = bg_Colour;
}
}
else
{
Stats.Inc_MaxDepthExceeded();
// return black
Result.Set(0.0f, 0.0f, 0.0f);
}
// we can apply fogging here if it is turned on
if (AtmosFogging)
{
if (Result != bg_Colour)
{
// we got an intersection so apply fogging to it.
// since the fog colour is the bg_colour there's no point applying fog
// if it's already that colour plus it might mean there wasn't an intersection.
double scale_factor;
double Distance_To_Point;
Distance_To_Point = (CameraLocation.Postion - Intersection.Point).Length();
scale_factor = Distance_To_Point / Fog_Distance;
// clamp that to [0..1]
if (scale_factor < 0.0) scale_factor = 0.0;
if (scale_factor > 1.0) scale_factor = 1.0;
Result = (Result * (1 - scale_factor)) + (bg_Colour * scale_factor);
}
}
return Result;
}
BOOL CWorld::GetNearestIntersection(CRay *Ray, s_IntersectionInfo *Info)
{
// This function will take the given ray and intersect it
// with all the objects in the object list looking for the closest
// intersection
// if it finds one it fills in the Info object and returns true
// otherwise it returns false;
CVector PointOfIntersection;
s_IntersectionInfo CurrentHit;
double CurrentLength;
double length;
bool foundany = false;
bool FoundAtLeastOne = false;
for (int i = 0; i < Object_List.GetSize(); i++)
{
if (Object_List[i]->Intersect(Ray, &PointOfIntersection))
{
// we have a hit
FoundAtLeastOne = true;
Stats.Inc_TotalIntersections();
// find length of this ray
length = (PointOfIntersection - Ray->Start).Length();
if (!foundany)
{
CurrentHit.Index = i;
CurrentHit.Point = PointOfIntersection;
CurrentLength = length;
foundany = true;
}
else
{
// we have found one before
if (length < CurrentLength)
{
CurrentHit.Index = i;
CurrentHit.Point = PointOfIntersection;
CurrentLength = length;
}
}
}
}
if (FoundAtLeastOne)
{
// I think this is the only place that the normal function is called
Stats.Inc_ShadedIntersections();
// Get the normal at the point
CurrentHit.Normal = Object_List[CurrentHit.Index]->Normal(&(CurrentHit.Point), Ray);
// return the intersection info
(*Info) = CurrentHit;
}
return FoundAtLeastOne;
}
int CWorld::GetActiveLights(s_IntersectionInfo *Info)
{
// This function will use the given information about
// an intersection to check which lights are visible from
// that point
// it then fills in the array ActiveLight_List which the object
// can then use to light itself with
// if objects are in the way of the light but are transparent
// then that is factored in to the info
// the return value is the number of lights added to the list
CRay Ray;
bool Blocked;
CVector PointOfIntersection;
s_ActiveLightsInfo *LightInfo;
double DistanceToLight;
int count = 0;
CColour transparency;
CColour ZeroColour;
// First off we want to clear out the old information from the active light list
ActiveLight_List.FreeExtra();
for (int n = 0; n < ActiveLight_List.GetSize(); n++)
delete ActiveLight_List[n];
ActiveLight_List.RemoveAll();
Ray.Start = Info->Point;
for (int i = 0; i < Light_List.GetSize(); i ++)
{
// we need to generate a ray from the point to each light in turn
// then take that ray and see if any objects get in the way of it (noting if they're transparent)
Ray.Dir = Light_List[i]->Position - Ray.Start;
DistanceToLight = Ray.Dir.Length();
Ray.Dir.Normalize();
// If at this point dirtolight dotted with surface normal is not in range 0.0 to 1.0
// then we ignore the light definitely
double DotResult;
DotResult = Ray.Dir.Dot(Info->Normal);
// if this value is not in the range then we can't see the light
// so... there's no point doing any of the below, the light is not visible ??
// NOTE:
//
// When testing for the dot product to be in the desired range, if we use 0.0 and 1.0
// we sometimes get what appear to be rounding errors (?) on the edges of spheres
// these usually show up as near-white pixels as on that pixel there is a massive amount of
// specular reflection from a light and on the pixel next to it the light is no longer visible
// due to this dot product so the pixel ends up being significantly darker
// needless to say this looks horrible.
//
// it may be necessary to change this value as 0.05 seems a little high but effective nonetheless.
if (DotResult >= 0.05 )
{
transparency.Set(1.0f,1.0f,1.0f); // ie. we want 100% of this lights light at the moment.
Blocked = false;
// we don't want to check for intersections with the object that this ray starts from !!!!!!
for (int j = 0; j < Object_List.GetSize(); j++)
{
// we now need to check that ray against each object except itself
if (j != Info->Index)
{
Stats.Inc_ShadowRays();
if (Object_List[j]->Intersect(&Ray, &PointOfIntersection))
{
// this object is not necessarily in the way we need to check that the object
// is actually before the light
// i.e. we have pointofinterest.........object.......light
//
// rather than pointofinterest.......light.......object
// if the distance to PointOfIntersection from Ray.start is less than the distance to
// the light then the object does block it otherwise it doesn't
if ((PointOfIntersection - Ray.Start).Length() < DistanceToLight)
{
// this object is in the way
// if it isn't transparent at all then we can stop
// if it is transparent we have to note the transparency then check all the other objects
if (Object_List[j]->Transparency == ZeroColour)
{
// object is not transparent so light is blocked
Blocked = true;
//MessageBox(NULL, "We're are getting lights blocked by objects", "Debug", MB_OK);
break;
}
else
{
// object is transparent so include it's transparency
transparency = transparency * Object_List[j]->Transparency;
}
}
// else the light is in front of this object so we should count it
}
}
} // end of for loop through objects
// when we get here either the light is not visible and Blocked equals true
// or the light is visible (possibly through transparent objects) and Blocked equals false
if (!Blocked)
{
// the light is visible so we want to add it to the active lights list
LightInfo = new s_ActiveLightsInfo;
LightInfo->Index = i;
LightInfo->Transparency = transparency;
ActiveLight_List.Add(LightInfo);
count++;
}
}
// MessageBox(NULL, "The light was blocked due to the dot product going \nout of range (ray direction and normal)", "Debug", MB_OK);
// if it is blocked we don't care and we just carry on checking the next one
} // end of for loop through lights
return count; // number of lights added to list
}
void CWorld::GenerateDOFRays(int i, int j)
{
// The first thing we want to do is generate a ray
// from the eyepos straight through the centre of the
// pixel, this will be our primary ray along which we'll
// find the focal point for this set of rays.
double x,y;
CVector AcrossPlane, DownPlane, PointOnPlane;
AcrossPlane = ProjectionPlane.TopRight - ProjectionPlane.TopLeft;
DownPlane = ProjectionPlane.BottomLeft - ProjectionPlane.TopLeft;
AcrossPlane.Normalize();
DownPlane.Normalize();
double LengthOfPlane, HeightOfPlane;
LengthOfPlane = (ProjectionPlane.TopRight - ProjectionPlane.TopLeft).Length();
HeightOfPlane = (ProjectionPlane.BottomLeft - ProjectionPlane.TopLeft).Length();
// Generate primary ray through middle of pixel square.
x = ((double) i + (double) 0.5) / (double) Image_Width;
y = ((double) j + (double) 0.5) / (double) Image_Height;
x *= LengthOfPlane;
y *= HeightOfPlane;
PointOnPlane = ProjectionPlane.TopLeft + (AcrossPlane * x) + (DownPlane * y);
CRay PrimaryRay;
PrimaryRay.Start = CameraLocation.Postion;
PrimaryRay.Dir = PointOnPlane - CameraLocation.Postion;
PrimaryRay.Dir.Normalize();
CVector FocalPoint;
FocalPoint = PrimaryRay.Evaluate(FocalLength);
// Now we have the focal point we need to calculate the jittered positions for the other
// rays to start from.
// as we're using a square lens for now we can use the ray position tables from the ordinary
// supersampling, however these are tables of offsets with 0,0 being the top left
// we want 0,0 being the middle so we need to subtract 0.5 from all of them first
xy_pair CurrentPoint;
double MaxJitter; // The maximum amount we can jitter each subpixel ray point to keep it in it's
// little square
switch (RaysPerPixel)
{
case ONE_RPP:
// don't need it for this
break;
case FOUR_RPP:
MaxJitter = 0.25;
break;
case NINE_RPP:
MaxJitter = 1.0 / 6.0;
break;
case SIXTEEN_RPP:
MaxJitter = 1.0 / 8.0;
break;
case FORTYNINE_RPP:
MaxJitter = 1.0 / 14.0;
break;
case HUNDRED_RPP:
MaxJitter = 1.0 / 20.0;
break;
}
for (int n = 0; n < RaysPerPixel; n++)
{
switch (RaysPerPixel)
{
case ONE_RPP:
CurrentPoint = one_rpp[n]; // doesn't make sense to do this for 1RPP, check above ver of this func
break;
case FOUR_RPP:
CurrentPoint = four_rpp[n];
break;
case NINE_RPP:
CurrentPoint = nine_rpp[n];
break;
case SIXTEEN_RPP:
CurrentPoint = sixteen_rpp[n];
break;
case FORTYNINE_RPP:
CurrentPoint = fortynine_rpp[n];
break;
case HUNDRED_RPP:
CurrentPoint = hundred_rpp[n];
break;
}
// subtract 0.5 off as mentioned above
CurrentPoint.x -= 0.5;
CurrentPoint.y -= 0.5;
// Jitter the position in x and y by +/- MaxJitter
CurrentPoint.x += GetRandomNumber(2.0 * MaxJitter) - MaxJitter;
CurrentPoint.y += GetRandomNumber(2.0 * MaxJitter) - MaxJitter;
// Scale the point by the lensradius, as we're using a square lens here, we'll take
// lensradius to be the height/width of the lens
CurrentPoint.x *= LensRadius;
CurrentPoint.y *= LensRadius;
// now we need to create the ray start point by getting a point that is y up from
// the eyepos and x to the right of the eyepos.
// to get the direction to the right of eyepos we need to do Heading X Up.
CVector Up, Across;
Up = CameraLocation.Up;
Across = Up.Cross(CameraLocation.Heading);
Across.Normalize();
CVector RayStart;
// Create the new ray
RayStart = CameraLocation.Postion + (Across * CurrentPoint.x) + (Up * CurrentPoint.y);
RayArray[n].Start = RayStart;
RayArray[n].Dir = FocalPoint - RayStart;
RayArray[n].Dir.Normalize();
RayArray[n].CurrentObjIndex = -1;
}
}
double CWorld::GetRandomNumber(double Max)
{
// Return a random floating point number in the range (0.0..Max)
return ((double) rand() / (double) RAND_MAX) * Max;
}
void CWorld::ScaleColours()
{
// This function needs to find the highest colour value
// in PreScaledImage[] and then scale all of the other colours
// so that they all fit in to the range 0..1
float highest = 0.0;
CColour Current;
// find the highest value
for (int n = 0; n < Image_Width*Image_Height; n++)
{
Current = PreScaledImage[n];
if (Current.Get_R() > highest)
highest = Current.Get_R();
if (Current.Get_G() > highest)
highest = Current.Get_G();
if (Current.Get_B() > highest)
highest = Current.Get_B();
}
CString output;
output.Format(_T("The highest colour value is : %f"), highest);
MessageBox(NULL, (LPCTSTR) output, _T("Test"), MB_OK);
float scale_value = 1.0f / highest;
for (int y = 0; y < Image_Height; y++)
for (int x = 0; x < Image_Width; x++)
{
// we don't want to scale the colours unless some have overflowed
// to scale the colours we need to divide all of them by highest
if (highest > 1.0)
PreScaledImage[y * Image_Width + x] = PreScaledImage[y * Image_Width + x] * scale_value;
BYTE r, g, b;
r = PreScaledImage[y * Image_Width + x].Get_Rbyte();
g = PreScaledImage[y * Image_Width + x].Get_Gbyte();
b = PreScaledImage[y * Image_Width + x].Get_Bbyte();
ImageFile->Write_Pixel(x, (Image_Height - 1 - y), r, g, b);
}
}
void CWorld::ClearUpMemoryAllocations()
{
// This function will clear out any possible memory allocations that have been
// made it will be called when rendering is cancelled and when rendering ends
// naturally.
if (RayArray != NULL)
{
delete[] RayArray;
RayArray = NULL;
}
if (ImageFile != NULL)
{
delete ImageFile;
ImageFile = NULL;
}
if ((!ClampColours) && (PreScaledImage != NULL))
{
delete[] PreScaledImage;
PreScaledImage = NULL;
}
ActiveLight_List.FreeExtra();
for (int n = 0; n < ActiveLight_List.GetSize(); n++)
delete ActiveLight_List[n];
ActiveLight_List.RemoveAll();
RestoreDefaults();
}
void CWorld::StopRendering()
{
// This function needs to clear up any memory allocations and
// then terminate the thread.
ClearUpMemoryAllocations();
// this function also deletes the thread object from memory so
// we don't need to worry about freeing up that bit of memory
AfxEndThread(0);
}
void CWorld::SaveRenderOptions()
{
CWinApp *App = AfxGetApp();
CString version = _T("version 1.0\\Render");
App->WriteProfileInt(version, _T("Light Attenuation"), LightAtten);
App->WriteProfileInt(version, _T("Atmos. Fogging"), AtmosFogging);
App->WriteProfileInt(version, _T("Depth Of Field"), DepthOfFieldOn);
App->WriteProfileInt(version, _T("StochasticSS"), StochasticSS);
App->WriteProfileInt(version, _T("Clamp Colours"), ClampColours);
App->WriteProfileInt(version, _T("Max Depth"), MaxDepth);
App->WriteProfileInt(version, _T("Rays Per Pixel"), RaysPerPixel);
App->WriteProfileString(version, _T("Output Dir"), OutputDir);
}
void CWorld::RestoreRenderOptions()
{
CWinApp *App = AfxGetApp();
CString version = _T("version 1.0\\Render");
int LA, AF, DF, SS, CC, MD, RP;
CString OD;
if (
( (LA = App->GetProfileInt(version, _T("Light Attenuation"), -1)) != -1) &&
( (AF = App->GetProfileInt(version, _T("Atmos. Fogging"), -1)) != -1) &&
( (DF = App->GetProfileInt(version, _T("Depth Of Field"), -1)) != -1) &&
( (SS = App->GetProfileInt(version, _T("StochasticSS"), -1)) != -1) &&
( (CC = App->GetProfileInt(version, _T("Clamp Colours"), -1)) != -1) &&
( (MD = App->GetProfileInt(version, _T("Max Depth"), -1)) != -1) &&
( (RP = App->GetProfileInt(version, _T("Rays Per Pixel"), -1)) != -1))
{
// they all had values so now we can use them
DepthOfFieldOn = DF;
RaysPerPixel = RP;
MaxDepth = MD;
StochasticSS = SS;
LightAtten = LA;
AtmosFogging = AF;
ClampColours = CC;
}
else
{
// use bog standard default values
DepthOfFieldOn = FALSE;
RaysPerPixel = ONE_RPP;
MaxDepth = 10;
StochasticSS = FALSE;
LightAtten = FALSE;
AtmosFogging = FALSE;
ClampColours = TRUE;
}
if ((OD = App->GetProfileString(version, _T("Output Dir"))) != "")
{
// got a good value, use it
OutputDir = OD;
}
else
{
// use a default value
OutputDir = "C:\\My Document\\";
}
}
| 26.573836 | 133 | 0.685512 | [
"render",
"object",
"vector"
] |
e83312cb3a92f82503cf3174d9702b4eb02bbf8e | 28,755 | cpp | C++ | src/thirdparty/taglib2/taglib/dsdiff/dsdifffile.cpp | billlin0904/xamp2 | c11ada6138a5c8427523543bb7035f2ac2cff8d5 | [
"MIT"
] | 2 | 2020-02-09T04:55:36.000Z | 2022-01-08T08:50:50.000Z | src/thirdparty/taglib2/taglib/dsdiff/dsdifffile.cpp | billlin0904/xamp2 | c11ada6138a5c8427523543bb7035f2ac2cff8d5 | [
"MIT"
] | 1 | 2022-02-16T10:14:05.000Z | 2022-02-16T10:14:05.000Z | src/thirdparty/taglib2/taglib/dsdiff/dsdifffile.cpp | billlin0904/xamp2 | c11ada6138a5c8427523543bb7035f2ac2cff8d5 | [
"MIT"
] | 2 | 2019-09-23T15:21:27.000Z | 2021-04-12T09:00:37.000Z | /***************************************************************************
copyright : (C) 2016 by Damien Plisson, Audirvana
email : damien78@audirvana.com
***************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#include <tbytevector.h>
#include <tdebug.h>
#include <id3v2tag.h>
#include <tstringlist.h>
#include <tpropertymap.h>
#include <tagutils.h>
#include <tsmartptr.h>
#include "tagunion.h"
#include "dsdifffile.h"
using namespace TagLib;
struct Chunk64
{
ByteVector name;
unsigned long long offset;
unsigned long long size;
char padding;
};
namespace
{
enum {
ID3v2Index = 0,
DIINIndex = 1
};
enum {
PROPChunk = 0,
DIINChunk = 1
};
}
class DSDIFF::File::FilePrivate
{
public:
FilePrivate() :
endianness(BigEndian),
size(0),
isID3InPropChunk(false),
duplicateID3V2chunkIndex(-1),
id3v2TagChunkID("ID3 "),
hasID3v2(false),
hasDiin(false)
{
childChunkIndex[ID3v2Index] = -1;
childChunkIndex[DIINIndex] = -1;
}
Endianness endianness;
ByteVector type;
unsigned long long size;
ByteVector format;
std::vector<Chunk64> chunks;
std::vector<Chunk64> childChunks[2];
int childChunkIndex[2];
bool isID3InPropChunk; // Two possibilities can be found: ID3V2 chunk inside PROP chunk or at root level
int duplicateID3V2chunkIndex; // 2 ID3 chunks are present. This is then the index of the one in
// PROP chunk that will be removed upon next save to remove duplicates.
SCOPED_PTR<AudioProperties> properties;
DoubleTagUnion tag;
ByteVector id3v2TagChunkID;
bool hasID3v2;
bool hasDiin;
};
////////////////////////////////////////////////////////////////////////////////
// static members
////////////////////////////////////////////////////////////////////////////////
bool DSDIFF::File::isSupported(IOStream *stream)
{
// A DSDIFF file has to start with "FRM8????????DSD ".
const ByteVector id = Utils::readHeader(stream, 16, false);
return (id.startsWith("FRM8") && id.containsAt("DSD ", 12));
}
////////////////////////////////////////////////////////////////////////////////
// public members
////////////////////////////////////////////////////////////////////////////////
DSDIFF::File::File(FileName file, bool readProperties,
AudioProperties::ReadStyle propertiesStyle) : TagLib::File(file)
{
d = new FilePrivate;
d->endianness = BigEndian;
if(isOpen())
read(readProperties, propertiesStyle);
}
DSDIFF::File::File(IOStream *stream, bool readProperties,
AudioProperties::ReadStyle propertiesStyle) : TagLib::File(stream)
{
d = new FilePrivate;
d->endianness = BigEndian;
if(isOpen())
read(readProperties, propertiesStyle);
}
DSDIFF::File::~File()
{
delete d;
}
TagLib::Tag *DSDIFF::File::tag() const
{
return &d->tag;
}
ID3v2::Tag *DSDIFF::File::ID3v2Tag() const
{
return d->tag.access<ID3v2::Tag>(ID3v2Index, false);
}
bool DSDIFF::File::hasID3v2Tag() const
{
return d->hasID3v2;
}
DSDIFF::DIIN::Tag *DSDIFF::File::DIINTag() const
{
return d->tag.access<DSDIFF::DIIN::Tag>(DIINIndex, false);
}
bool DSDIFF::File::hasDIINTag() const
{
return d->hasDiin;
}
PropertyMap DSDIFF::File::properties() const
{
if(d->hasID3v2)
return d->tag.access<ID3v2::Tag>(ID3v2Index, false)->properties();
return PropertyMap();
}
void DSDIFF::File::removeUnsupportedProperties(const StringList &unsupported)
{
if(d->hasID3v2)
d->tag.access<ID3v2::Tag>(ID3v2Index, false)->removeUnsupportedProperties(unsupported);
if(d->hasDiin)
d->tag.access<DSDIFF::DIIN::Tag>(DIINIndex, false)->removeUnsupportedProperties(unsupported);
}
PropertyMap DSDIFF::File::setProperties(const PropertyMap &properties)
{
return d->tag.access<ID3v2::Tag>(ID3v2Index, true)->setProperties(properties);
}
DSDIFF::AudioProperties *DSDIFF::File::audioProperties() const
{
return d->properties.get();
}
bool DSDIFF::File::save()
{
if(readOnly()) {
debug("DSDIFF::File::save() -- File is read only.");
return false;
}
if(!isValid()) {
debug("DSDIFF::File::save() -- Trying to save invalid file.");
return false;
}
// First: save ID3V2 chunk
ID3v2::Tag *id3v2Tag = d->tag.access<ID3v2::Tag>(ID3v2Index, false);
if(d->isID3InPropChunk) {
if(id3v2Tag != NULL && !id3v2Tag->isEmpty()) {
setChildChunkData(d->id3v2TagChunkID, id3v2Tag->render(), PROPChunk);
d->hasID3v2 = true;
}
else {
// Empty tag: remove it
setChildChunkData(d->id3v2TagChunkID, ByteVector(), PROPChunk);
d->hasID3v2 = false;
}
}
else {
if(id3v2Tag != NULL && !id3v2Tag->isEmpty()) {
setRootChunkData(d->id3v2TagChunkID, id3v2Tag->render());
d->hasID3v2 = true;
}
else {
// Empty tag: remove it
setRootChunkData(d->id3v2TagChunkID, ByteVector());
d->hasID3v2 = false;
}
}
// Second: save the DIIN chunk
if(d->hasDiin) {
DSDIFF::DIIN::Tag *diinTag = d->tag.access<DSDIFF::DIIN::Tag>(DIINIndex, false);
if(!diinTag->title().isEmpty()) {
ByteVector diinTitle;
if(d->endianness == BigEndian)
diinTitle.append(ByteVector::fromUInt32BE(diinTag->title().size()));
else
diinTitle.append(ByteVector::fromUInt32LE(diinTag->title().size()));
diinTitle.append(ByteVector::fromCString(diinTag->title().toCString()));
setChildChunkData("DITI", diinTitle, DIINChunk);
}
else
setChildChunkData("DITI", ByteVector(), DIINChunk);
if(!diinTag->artist().isEmpty()) {
ByteVector diinArtist;
if(d->endianness == BigEndian)
diinArtist.append(ByteVector::fromUInt32BE(diinTag->artist().size()));
else
diinArtist.append(ByteVector::fromUInt32LE(diinTag->artist().size()));
diinArtist.append(ByteVector::fromCString(diinTag->artist().toCString()));
setChildChunkData("DIAR", diinArtist, DIINChunk);
}
else
setChildChunkData("DIAR", ByteVector(), DIINChunk);
}
// Third: remove the duplicate ID3V2 chunk (inside PROP chunk) if any
if(d->duplicateID3V2chunkIndex>=0) {
setChildChunkData(d->duplicateID3V2chunkIndex, ByteVector(), PROPChunk);
d->duplicateID3V2chunkIndex = -1;
}
return true;
}
////////////////////////////////////////////////////////////////////////////////
// private members
////////////////////////////////////////////////////////////////////////////////
void DSDIFF::File::setRootChunkData(unsigned int i, const ByteVector &data)
{
if(data.isEmpty()) {
// Null data: remove chunk
// Update global size
unsigned long long removedChunkTotalSize = d->chunks[i].size + d->chunks[i].padding + 12;
d->size -= removedChunkTotalSize;
if(d->endianness == BigEndian)
insert(ByteVector::fromUInt64BE(d->size), 4, 8);
else
insert(ByteVector::fromUInt64LE(d->size), 4, 8);
removeBlock(d->chunks[i].offset - 12, removedChunkTotalSize);
// Update the internal offsets
for(unsigned long r = i + 1; r < d->chunks.size(); r++)
d->chunks[r].offset = d->chunks[r - 1].offset + 12
+ d->chunks[r - 1].size + d->chunks[r - 1].padding;
d->chunks.erase(d->chunks.begin() + i);
}
else {
// Non null data: update chunk
// First we update the global size
d->size += ((data.size() + 1) & ~1) - (d->chunks[i].size + d->chunks[i].padding);
if(d->endianness == BigEndian)
insert(ByteVector::fromUInt64BE(d->size), 4, 8);
else
insert(ByteVector::fromUInt64LE(d->size), 4, 8);
// Now update the specific chunk
writeChunk(d->chunks[i].name,
data,
d->chunks[i].offset - 12,
d->chunks[i].size + d->chunks[i].padding + 12);
d->chunks[i].size = data.size();
d->chunks[i].padding = (data.size() & 0x01) ? 1 : 0;
// Finally update the internal offsets
updateRootChunksStructure(i + 1);
}
}
void DSDIFF::File::setRootChunkData(const ByteVector &name, const ByteVector &data)
{
if(d->chunks.size() == 0) {
debug("DSDIFF::File::setPropChunkData - No valid chunks found.");
return;
}
for(unsigned int i = 0; i < d->chunks.size(); i++) {
if(d->chunks[i].name == name) {
setRootChunkData(i, data);
return;
}
}
// Couldn't find an existing chunk, so let's create a new one.
unsigned int i = d->chunks.size() - 1;
unsigned long offset = d->chunks[i].offset + d->chunks[i].size + d->chunks[i].padding;
// First we update the global size
d->size += (offset & 1) + ((data.size() + 1) & ~1) + 12;
if(d->endianness == BigEndian)
insert(ByteVector::fromUInt64BE(d->size), 4, 8);
else
insert(ByteVector::fromUInt64LE(d->size), 4, 8);
// Now add the chunk to the file
writeChunk(name,
data,
offset,
std::max<unsigned long long>(0, length() - offset),
(offset & 1) ? 1 : 0);
Chunk64 chunk;
chunk.name = name;
chunk.size = data.size();
chunk.offset = offset + 12;
chunk.padding = (data.size() & 0x01) ? 1 : 0;
d->chunks.push_back(chunk);
}
void DSDIFF::File::setChildChunkData(unsigned int i,
const ByteVector &data,
unsigned int childChunkNum)
{
std::vector<Chunk64> &childChunks = d->childChunks[childChunkNum];
if(data.isEmpty()) {
// Null data: remove chunk
// Update global size
unsigned long long removedChunkTotalSize = childChunks[i].size + childChunks[i].padding + 12;
d->size -= removedChunkTotalSize;
if(d->endianness == BigEndian)
insert(ByteVector::fromUInt64BE(d->size), 4, 8);
else
insert(ByteVector::fromUInt64LE(d->size), 4, 8);
// Update child chunk size
d->chunks[d->childChunkIndex[childChunkNum]].size -= removedChunkTotalSize;
if(d->endianness == BigEndian)
insert(ByteVector::fromUInt64BE(d->chunks[d->childChunkIndex[childChunkNum]].size),
d->chunks[d->childChunkIndex[childChunkNum]].offset - 8, 8);
else
insert(ByteVector::fromUInt64LE(d->chunks[d->childChunkIndex[childChunkNum]].size),
d->chunks[d->childChunkIndex[childChunkNum]].offset - 8, 8);
// Remove the chunk
removeBlock(childChunks[i].offset - 12, removedChunkTotalSize);
// Update the internal offsets
// For child chunks
if((i + 1) < childChunks.size()) {
childChunks[i + 1].offset = childChunks[i].offset;
i++;
for(i++; i < childChunks.size(); i++)
childChunks[i].offset = childChunks[i - 1].offset + 12
+ childChunks[i - 1].size + childChunks[i - 1].padding;
}
// And for root chunks
for(i = d->childChunkIndex[childChunkNum] + 1; i < d->chunks.size(); i++)
d->chunks[i].offset = d->chunks[i - 1].offset + 12
+ d->chunks[i - 1].size + d->chunks[i - 1].padding;
childChunks.erase(childChunks.begin() + i);
}
else {
// Non null data: update chunk
// First we update the global size
d->size += ((data.size() + 1) & ~1) - (childChunks[i].size + childChunks[i].padding);
if(d->endianness == BigEndian)
insert(ByteVector::fromUInt64BE(d->size), 4, 8);
else
insert(ByteVector::fromUInt64LE(d->size), 4, 8);
// And the PROP chunk size
d->chunks[d->childChunkIndex[childChunkNum]].size += ((data.size() + 1) & ~1)
- (childChunks[i].size + childChunks[i].padding);
if(d->endianness == BigEndian)
insert(ByteVector::fromUInt64BE(d->chunks[d->childChunkIndex[childChunkNum]].size),
d->chunks[d->childChunkIndex[childChunkNum]].offset - 8, 8);
else
insert(ByteVector::fromUInt64LE(d->chunks[d->childChunkIndex[childChunkNum]].size),
d->chunks[d->childChunkIndex[childChunkNum]].offset - 8, 8);
// Now update the specific chunk
writeChunk(childChunks[i].name,
data,
childChunks[i].offset - 12,
childChunks[i].size + childChunks[i].padding + 12);
childChunks[i].size = data.size();
childChunks[i].padding = (data.size() & 0x01) ? 1 : 0;
// Now update the internal offsets
// For child Chunks
for(i++; i < childChunks.size(); i++)
childChunks[i].offset = childChunks[i - 1].offset + 12
+ childChunks[i - 1].size + childChunks[i - 1].padding;
// And for root chunks
updateRootChunksStructure(d->childChunkIndex[childChunkNum] + 1);
}
}
void DSDIFF::File::setChildChunkData(const ByteVector &name,
const ByteVector &data,
unsigned int childChunkNum)
{
std::vector<Chunk64> &childChunks = d->childChunks[childChunkNum];
if(childChunks.size() == 0) {
debug("DSDIFF::File::setPropChunkData - No valid chunks found.");
return;
}
for(unsigned int i = 0; i < childChunks.size(); i++) {
if(childChunks[i].name == name) {
setChildChunkData(i, data, childChunkNum);
return;
}
}
// Do not attempt to remove a non existing chunk
if(data.isEmpty())
return;
// Couldn't find an existing chunk, so let's create a new one.
unsigned int i = childChunks.size() - 1;
unsigned long offset = childChunks[i].offset + childChunks[i].size + childChunks[i].padding;
// First we update the global size
d->size += (offset & 1) + ((data.size() + 1) & ~1) + 12;
if(d->endianness == BigEndian)
insert(ByteVector::fromUInt64BE(d->size), 4, 8);
else
insert(ByteVector::fromUInt64LE(d->size), 4, 8);
// And the child chunk size
d->chunks[d->childChunkIndex[childChunkNum]].size += (offset & 1)
+ ((data.size() + 1) & ~1) + 12;
if(d->endianness == BigEndian)
insert(ByteVector::fromUInt64BE(d->chunks[d->childChunkIndex[childChunkNum]].size),
d->chunks[d->childChunkIndex[childChunkNum]].offset - 8, 8);
else
insert(ByteVector::fromUInt64LE(d->chunks[d->childChunkIndex[childChunkNum]].size),
d->chunks[d->childChunkIndex[childChunkNum]].offset - 8, 8);
// Now add the chunk to the file
unsigned long long nextRootChunkIdx = length();
if((d->childChunkIndex[childChunkNum] + 1) < static_cast<int>(d->chunks.size()))
nextRootChunkIdx = d->chunks[d->childChunkIndex[childChunkNum] + 1].offset - 12;
writeChunk(name, data, offset,
std::max<unsigned long long>(0, nextRootChunkIdx - offset),
(offset & 1) ? 1 : 0);
// For root chunks
updateRootChunksStructure(d->childChunkIndex[childChunkNum] + 1);
Chunk64 chunk;
chunk.name = name;
chunk.size = data.size();
chunk.offset = offset + 12;
chunk.padding = (data.size() & 0x01) ? 1 : 0;
childChunks.push_back(chunk);
}
static bool isValidChunkID(const ByteVector &name)
{
if(name.size() != 4)
return false;
for(int i = 0; i < 4; i++) {
if(name[i] < 32 || name[i] > 127)
return false;
}
return true;
}
void DSDIFF::File::updateRootChunksStructure(unsigned int startingChunk)
{
for(unsigned int i = startingChunk; i < d->chunks.size(); i++)
d->chunks[i].offset = d->chunks[i - 1].offset + 12
+ d->chunks[i - 1].size + d->chunks[i - 1].padding;
// Update childchunks structure as well
if(d->childChunkIndex[PROPChunk] >= static_cast<int>(startingChunk)) {
std::vector<Chunk64> &childChunksToUpdate = d->childChunks[PROPChunk];
if(childChunksToUpdate.size() > 0) {
childChunksToUpdate[0].offset = d->chunks[d->childChunkIndex[PROPChunk]].offset + 12;
for(unsigned int i = 1; i < childChunksToUpdate.size(); i++)
childChunksToUpdate[i].offset = childChunksToUpdate[i - 1].offset + 12
+ childChunksToUpdate[i - 1].size + childChunksToUpdate[i - 1].padding;
}
}
if(d->childChunkIndex[DIINChunk] >= static_cast<int>(startingChunk)) {
std::vector<Chunk64> &childChunksToUpdate = d->childChunks[DIINChunk];
if(childChunksToUpdate.size() > 0) {
childChunksToUpdate[0].offset = d->chunks[d->childChunkIndex[DIINChunk]].offset + 12;
for(unsigned int i = 1; i < childChunksToUpdate.size(); i++)
childChunksToUpdate[i].offset = childChunksToUpdate[i - 1].offset + 12
+ childChunksToUpdate[i - 1].size + childChunksToUpdate[i - 1].padding;
}
}
}
void DSDIFF::File::read(bool readProperties, AudioProperties::ReadStyle propertiesStyle)
{
bool bigEndian = (d->endianness == BigEndian);
d->type = readBlock(4);
d->size = bigEndian ? readBlock(8).toInt64BE(0) : readBlock(8).toInt64LE(0);
d->format = readBlock(4);
// + 12: chunk header at least, fix for additional junk bytes
while(tell() + 12 <= length()) {
ByteVector chunkName = readBlock(4);
unsigned long long chunkSize = bigEndian ? readBlock(8).toInt64BE(0) : readBlock(8).toInt64LE(0);
if(!isValidChunkID(chunkName)) {
debug("DSDIFF::File::read() -- Chunk '" + chunkName + "' has invalid ID");
setValid(false);
break;
}
if(static_cast<unsigned long long>(tell()) + chunkSize > static_cast<unsigned long long>(length())) {
debug("DSDIFF::File::read() -- Chunk '" + chunkName
+ "' has invalid size (larger than the file size)");
setValid(false);
break;
}
Chunk64 chunk;
chunk.name = chunkName;
chunk.size = chunkSize;
chunk.offset = tell();
seek(chunk.size, Current);
// Check padding
chunk.padding = 0;
long uPosNotPadded = tell();
if((uPosNotPadded & 0x01) != 0) {
ByteVector iByte = readBlock(1);
if((iByte.size() != 1) || (iByte[0] != 0))
// Not well formed, re-seek
seek(uPosNotPadded, Beginning);
else
chunk.padding = 1;
}
d->chunks.push_back(chunk);
}
unsigned long long lengthDSDSamplesTimeChannels = 0; // For DSD uncompressed
unsigned long long audioDataSizeinBytes = 0; // For computing bitrate
unsigned long dstNumFrames = 0; // For DST compressed frames
unsigned short dstFrameRate = 0; // For DST compressed frames
for(unsigned int i = 0; i < d->chunks.size(); i++) {
if(d->chunks[i].name == "DSD ") {
lengthDSDSamplesTimeChannels = d->chunks[i].size * 8;
audioDataSizeinBytes = d->chunks[i].size;
}
else if(d->chunks[i].name == "DST ") {
// Now decode the chunks inside the DST chunk to read the DST Frame Information one
long long dstChunkEnd = d->chunks[i].offset + d->chunks[i].size;
seek(d->chunks[i].offset);
audioDataSizeinBytes = d->chunks[i].size;
while(tell() + 12 <= dstChunkEnd) {
ByteVector dstChunkName = readBlock(4);
long long dstChunkSize = bigEndian ? readBlock(8).toInt64BE(0) : readBlock(8).toInt64LE(0);
if(!isValidChunkID(dstChunkName)) {
debug("DSDIFF::File::read() -- DST Chunk '" + dstChunkName + "' has invalid ID");
setValid(false);
break;
}
if(static_cast<long long>(tell()) + dstChunkSize > dstChunkEnd) {
debug("DSDIFF::File::read() -- DST Chunk '" + dstChunkName
+ "' has invalid size (larger than the DST chunk)");
setValid(false);
break;
}
if(dstChunkName == "FRTE") {
// Found the DST frame information chunk
dstNumFrames = bigEndian ? readBlock(4).toUInt32BE(0) : readBlock(4).toUInt32LE(0);
dstFrameRate = bigEndian ? readBlock(2).toUInt16BE(0) : readBlock(2).toUInt16LE(0);
break; // Found the wanted one, no need to look at the others
}
seek(dstChunkSize, Current);
// Check padding
long uPosNotPadded = tell();
if((uPosNotPadded & 0x01) != 0) {
ByteVector iByte = readBlock(1);
if((iByte.size() != 1) || (iByte[0] != 0))
// Not well formed, re-seek
seek(uPosNotPadded, Beginning);
}
}
}
else if(d->chunks[i].name == "PROP") {
d->childChunkIndex[PROPChunk] = i;
// Now decodes the chunks inside the PROP chunk
long long propChunkEnd = d->chunks[i].offset + d->chunks[i].size;
seek(d->chunks[i].offset + 4); // +4 to remove the 'SND ' marker at beginning of 'PROP' chunk
while(tell() + 12 <= propChunkEnd) {
ByteVector propChunkName = readBlock(4);
long long propChunkSize = bigEndian ? readBlock(8).toInt64BE(0) : readBlock(8).toInt64LE(0);
if(!isValidChunkID(propChunkName)) {
debug("DSDIFF::File::read() -- PROP Chunk '" + propChunkName + "' has invalid ID");
setValid(false);
break;
}
if(static_cast<long long>(tell()) + propChunkSize > propChunkEnd) {
debug("DSDIFF::File::read() -- PROP Chunk '" + propChunkName
+ "' has invalid size (larger than the PROP chunk)");
setValid(false);
break;
}
Chunk64 chunk;
chunk.name = propChunkName;
chunk.size = propChunkSize;
chunk.offset = tell();
seek(chunk.size, Current);
// Check padding
chunk.padding = 0;
long uPosNotPadded = tell();
if((uPosNotPadded & 0x01) != 0) {
ByteVector iByte = readBlock(1);
if((iByte.size() != 1) || (iByte[0] != 0))
// Not well formed, re-seek
seek(uPosNotPadded, Beginning);
else
chunk.padding = 1;
}
d->childChunks[PROPChunk].push_back(chunk);
}
}
else if(d->chunks[i].name == "DIIN") {
d->childChunkIndex[DIINChunk] = i;
d->hasDiin = true;
// Now decode the chunks inside the DIIN chunk
long long diinChunkEnd = d->chunks[i].offset + d->chunks[i].size;
seek(d->chunks[i].offset);
while(tell() + 12 <= diinChunkEnd) {
ByteVector diinChunkName = readBlock(4);
long long diinChunkSize = bigEndian ? readBlock(8).toInt64BE(0) : readBlock(8).toInt64LE(0);
if(!isValidChunkID(diinChunkName)) {
debug("DSDIFF::File::read() -- DIIN Chunk '" + diinChunkName + "' has invalid ID");
setValid(false);
break;
}
if(static_cast<long long>(tell()) + diinChunkSize > diinChunkEnd) {
debug("DSDIFF::File::read() -- DIIN Chunk '" + diinChunkName
+ "' has invalid size (larger than the DIIN chunk)");
setValid(false);
break;
}
Chunk64 chunk;
chunk.name = diinChunkName;
chunk.size = diinChunkSize;
chunk.offset = tell();
seek(chunk.size, Current);
// Check padding
chunk.padding = 0;
long uPosNotPadded = tell();
if((uPosNotPadded & 0x01) != 0) {
ByteVector iByte = readBlock(1);
if((iByte.size() != 1) || (iByte[0] != 0))
// Not well formed, re-seek
seek(uPosNotPadded, Beginning);
else
chunk.padding = 1;
}
d->childChunks[DIINChunk].push_back(chunk);
}
}
else if(d->chunks[i].name == "ID3 " || d->chunks[i].name == "id3 ") {
d->id3v2TagChunkID = d->chunks[i].name;
d->tag.set(ID3v2Index, new ID3v2::Tag(this, d->chunks[i].offset));
d->isID3InPropChunk = false;
d->hasID3v2 = true;
}
}
if(!isValid())
return;
if(d->childChunkIndex[PROPChunk] < 0) {
debug("DSDIFF::File::read() -- no PROP chunk found");
setValid(false);
return;
}
// Read properties
unsigned int sampleRate=0;
unsigned short channels=0;
for(unsigned int i = 0; i < d->childChunks[PROPChunk].size(); i++) {
if(d->childChunks[PROPChunk][i].name == "ID3 " || d->childChunks[PROPChunk][i].name == "id3 ") {
if(d->hasID3v2) {
d->duplicateID3V2chunkIndex = i;
continue; // ID3V2 tag has already been found at root level
}
d->id3v2TagChunkID = d->childChunks[PROPChunk][i].name;
d->tag.set(ID3v2Index, new ID3v2::Tag(this, d->childChunks[PROPChunk][i].offset));
d->isID3InPropChunk = true;
d->hasID3v2 = true;
}
else if(d->childChunks[PROPChunk][i].name == "FS ") {
// Sample rate
seek(d->childChunks[PROPChunk][i].offset);
sampleRate = bigEndian ? readBlock(4).toUInt32BE(0) : readBlock(4).toUInt32LE(0);
}
else if(d->childChunks[PROPChunk][i].name == "CHNL") {
// Channels
seek(d->childChunks[PROPChunk][i].offset);
channels = bigEndian ? readBlock(2).toInt16BE(0) : readBlock(2).toInt16LE(0);
}
}
// Read title & artist from DIIN chunk
d->tag.access<DSDIFF::DIIN::Tag>(DIINIndex, true);
if(d->hasDiin) {
for(unsigned int i = 0; i < d->childChunks[DIINChunk].size(); i++) {
if(d->childChunks[DIINChunk][i].name == "DITI") {
seek(d->childChunks[DIINChunk][i].offset);
unsigned int titleStrLength = bigEndian ? readBlock(4).toUInt32BE(0) : readBlock(4).toUInt32LE(0);
if(titleStrLength <= d->childChunks[DIINChunk][i].size) {
ByteVector titleStr = readBlock(titleStrLength);
d->tag.access<DSDIFF::DIIN::Tag>(DIINIndex, false)->setTitle(titleStr);
}
}
else if(d->childChunks[DIINChunk][i].name == "DIAR") {
seek(d->childChunks[DIINChunk][i].offset);
unsigned int artistStrLength = bigEndian ? readBlock(4).toUInt32BE(0) : readBlock(4).toUInt32LE(0);
if(artistStrLength <= d->childChunks[DIINChunk][i].size) {
ByteVector artistStr = readBlock(artistStrLength);
d->tag.access<DSDIFF::DIIN::Tag>(DIINIndex, false)->setArtist(artistStr);
}
}
}
}
if(readProperties) {
if(lengthDSDSamplesTimeChannels == 0) {
// DST compressed signal : need to compute length of DSD uncompressed frames
if(dstFrameRate > 0)
lengthDSDSamplesTimeChannels = (unsigned long long)dstNumFrames
* (unsigned long long)sampleRate / (unsigned long long)dstFrameRate;
else
lengthDSDSamplesTimeChannels = 0;
}
else {
// In DSD uncompressed files, the read number of samples is the total for each channel
if(channels > 0)
lengthDSDSamplesTimeChannels /= channels;
}
int bitrate = 0;
if(lengthDSDSamplesTimeChannels > 0)
bitrate = (audioDataSizeinBytes*8*sampleRate) / lengthDSDSamplesTimeChannels / 1000;
d->properties.reset(new AudioProperties(sampleRate,
channels,
lengthDSDSamplesTimeChannels,
bitrate,
propertiesStyle));
}
if(!ID3v2Tag()) {
d->tag.access<ID3v2::Tag>(ID3v2Index, true);
d->isID3InPropChunk = false; // By default, ID3 chunk is at root level
d->hasID3v2 = false;
}
}
void DSDIFF::File::writeChunk(const ByteVector &name, const ByteVector &data,
unsigned long long offset, unsigned long replace,
unsigned int leadingPadding)
{
ByteVector combined;
if(leadingPadding)
combined.append(ByteVector(leadingPadding, '\x00'));
combined.append(name);
if(d->endianness == BigEndian)
combined.append(ByteVector::fromUInt64BE(data.size()));
else
combined.append(ByteVector::fromUInt64LE(data.size()));
combined.append(data);
if((data.size() & 0x01) != 0)
combined.append('\x00');
insert(combined, offset, replace);
}
| 34.029586 | 107 | 0.594888 | [
"render",
"vector"
] |
e8340d659400093a5038b55726ae4c976c2d08f8 | 3,676 | cc | C++ | daemon/error_map_manager.cc | nawazish-couchbase/kv_engine | 132f1bb04c9212bcac9e401d069aeee5f63ff1cd | [
"MIT",
"BSD-3-Clause"
] | 104 | 2017-05-22T20:41:57.000Z | 2022-03-24T00:18:34.000Z | daemon/error_map_manager.cc | nawazish-couchbase/kv_engine | 132f1bb04c9212bcac9e401d069aeee5f63ff1cd | [
"MIT",
"BSD-3-Clause"
] | 3 | 2017-11-14T08:12:46.000Z | 2022-03-03T11:14:17.000Z | daemon/error_map_manager.cc | nawazish-couchbase/kv_engine | 132f1bb04c9212bcac9e401d069aeee5f63ff1cd | [
"MIT",
"BSD-3-Clause"
] | 71 | 2017-05-22T20:41:59.000Z | 2022-03-29T10:34:32.000Z | /*
* Copyright 2021-Present Couchbase, Inc.
*
* Use of this software is governed by the Business Source License included
* in the file licenses/BSL-Couchbase.txt. As of the Change Date specified
* in that file, in accordance with the Business Source License, use of this
* software will be governed by the Apache License, Version 2.0, included in
* the file licenses/APL2.txt.
*/
#include "error_map_manager.h"
#include <boost/filesystem.hpp>
#include <nlohmann/json.hpp>
#include <platform/dirutils.h>
class ErrorMapManagerImpl : public ErrorMapManager {
public:
ErrorMapManagerImpl(std::vector<std::string> maps)
: ErrorMapManager(std::move(maps)) {
}
};
std::string_view ErrorMapManager::getErrorMap(size_t version) {
return error_maps[std::min(version, error_maps.size() - 1)];
}
namespace cb::errormap {
/// The one and only instance of the error map
static std::unique_ptr<ErrorMapManager> instance;
/// Version 1 is equal to v2 except that it allows for new attributes
nlohmann::json v2to1(nlohmann::json map) {
const std::array<std::string, 16> attributes = {{"item-deleted",
"item-locked",
"item-only",
"invalid-input",
"fetch-config",
"conn-state-invalidated",
"auth",
"special-handling",
"support",
"temp",
"internal",
"retry-now",
"retry-later",
"subdoc",
"dcp",
"success"}};
map["version"] = 1;
// The highest revision we had in the old format was 4
map["revision"] = 4 + map["revision"].get<int>();
for (auto& entry : map["errors"]) {
if (entry.is_object()) {
std::vector<std::string> at;
for (auto& attr : entry["attrs"]) {
auto val = attr.get<std::string>();
// strip off unsupported attributes
if (std::find(attributes.begin(), attributes.end(), val) !=
attributes.end()) {
at.emplace_back(std::move(val));
}
}
entry["attrs"] = at;
}
}
return map;
}
std::vector<std::string> getMap(const boost::filesystem::path& directory) {
// we need revision 0, 1 and 2
std::vector<std::string> maps(3);
auto file = directory / "error_map_v2.json";
// throws an exception if the file doesn't exist, file IO problems
// and JSON parse problems
auto v2 = nlohmann::json::parse(cb::io::loadFile(file.generic_string()));
auto v1 = cb::errormap::v2to1(v2);
maps[2] = v2.dump();
maps[1] = v1.dump();
return maps;
}
} // namespace cb::errormap
void ErrorMapManager::initialize(const boost::filesystem::path& directory) {
cb::errormap::instance = std::make_unique<ErrorMapManagerImpl>(
cb::errormap::getMap(directory));
}
void ErrorMapManager::shutdown() {
cb::errormap::instance.reset();
}
ErrorMapManager& ErrorMapManager::instance() {
return *cb::errormap::instance;
}
| 38.291667 | 78 | 0.503264 | [
"vector"
] |
e83511ea609663c7bfd8a7b89df8924207b614a1 | 8,272 | cpp | C++ | client_project/build/jsb-default/frameworks/cocos2d-x/cocos/scripting/js-bindings/jswrapper/v8/Class.cpp | pertgame/battleframe | ffba8a7b4f7f45f1eed2c56060d9a2205fb1fdc9 | [
"MIT"
] | 30 | 2019-09-06T17:24:54.000Z | 2022-01-24T02:32:52.000Z | client_project/build/jsb-default/frameworks/cocos2d-x/cocos/scripting/js-bindings/jswrapper/v8/Class.cpp | pertgame/battleframe | ffba8a7b4f7f45f1eed2c56060d9a2205fb1fdc9 | [
"MIT"
] | null | null | null | client_project/build/jsb-default/frameworks/cocos2d-x/cocos/scripting/js-bindings/jswrapper/v8/Class.cpp | pertgame/battleframe | ffba8a7b4f7f45f1eed2c56060d9a2205fb1fdc9 | [
"MIT"
] | 19 | 2019-09-17T02:56:50.000Z | 2022-01-24T02:32:53.000Z | /****************************************************************************
Copyright (c) 2016 Chukong Technologies Inc.
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "Class.hpp"
#if SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8
#include "Object.hpp"
#include "Utils.hpp"
#include "ScriptEngine.hpp"
namespace se {
// ------------------------------------------------------- Object
namespace {
// std::unordered_map<std::string, Class *> __clsMap;
v8::Isolate* __isolate = nullptr;
std::vector<Class*> __allClasses;
}
Class::Class()
: _parent(nullptr)
, _parentProto(nullptr)
, _proto(nullptr)
, _ctor(nullptr)
, _finalizeFunc(nullptr)
, _createProto(true)
{
__allClasses.push_back(this);
}
Class::~Class()
{
}
/* static */
Class* Class::create(const std::string& clsName, se::Object* parent, Object* parentProto, v8::FunctionCallback ctor)
{
Class* cls = new Class();
if (cls != nullptr && !cls->init(clsName, parent, parentProto, ctor))
{
delete cls;
cls = nullptr;
}
return cls;
}
bool Class::init(const std::string& clsName, Object* parent, Object* parentProto, v8::FunctionCallback ctor)
{
_name = clsName;
_parent = parent;
if (_parent != nullptr)
_parent->incRef();
_parentProto = parentProto;
if (_parentProto != nullptr)
_parentProto->incRef();
_ctor = ctor;
_ctorTemplate.Reset(__isolate, v8::FunctionTemplate::New(__isolate, _ctor));
v8::MaybeLocal<v8::String> jsNameVal = v8::String::NewFromUtf8(__isolate, _name.c_str(), v8::NewStringType::kNormal);
if (jsNameVal.IsEmpty())
return false;
_ctorTemplate.Get(__isolate)->SetClassName(jsNameVal.ToLocalChecked());
_ctorTemplate.Get(__isolate)->InstanceTemplate()->SetInternalFieldCount(1);
return true;
}
void Class::destroy()
{
SAFE_DEC_REF(_parent);
SAFE_DEC_REF(_proto);
SAFE_DEC_REF(_parentProto);
_ctorTemplate.Reset();
}
void Class::cleanup()
{
for (auto cls : __allClasses)
{
cls->destroy();
}
se::ScriptEngine::getInstance()->addAfterCleanupHook([](){
for (auto cls : __allClasses)
{
delete cls;
}
__allClasses.clear();
});
}
void Class::setCreateProto(bool createProto)
{
_createProto = createProto;
}
bool Class::install()
{
// assert(__clsMap.find(_name) == __clsMap.end());
//
// __clsMap.emplace(_name, this);
if (_parentProto != nullptr)
{
_ctorTemplate.Get(__isolate)->Inherit(_parentProto->_getClass()->_ctorTemplate.Get(__isolate));
}
v8::Local<v8::Context> context = __isolate->GetCurrentContext();
v8::MaybeLocal<v8::Function> ctor = _ctorTemplate.Get(__isolate)->GetFunction(context);
if (ctor.IsEmpty())
return false;
v8::Local<v8::Function> ctorChecked = ctor.ToLocalChecked();
v8::MaybeLocal<v8::String> name = v8::String::NewFromUtf8(__isolate, _name.c_str(), v8::NewStringType::kNormal);
if (name.IsEmpty())
return false;
v8::Maybe<bool> result = _parent->_getJSObject()->Set(context, name.ToLocalChecked(), ctorChecked);
if (result.IsNothing())
return false;
v8::MaybeLocal<v8::String> prototypeName = v8::String::NewFromUtf8(__isolate, "prototype", v8::NewStringType::kNormal);
if (prototypeName.IsEmpty())
return false;
v8::MaybeLocal<v8::Value> prototypeObj = ctorChecked->Get(context, prototypeName.ToLocalChecked());
if (prototypeObj.IsEmpty())
return false;
if (_createProto)
{
// Proto object is released in Class::destroy.
_proto = Object::_createJSObject(this, v8::Local<v8::Object>::Cast(prototypeObj.ToLocalChecked()));
_proto->root();
}
return true;
}
bool Class::defineFunction(const char *name, v8::FunctionCallback func)
{
v8::MaybeLocal<v8::String> jsName = v8::String::NewFromUtf8(__isolate, name, v8::NewStringType::kNormal);
if (jsName.IsEmpty())
return false;
_ctorTemplate.Get(__isolate)->PrototypeTemplate()->Set(jsName.ToLocalChecked(), v8::FunctionTemplate::New(__isolate, func));
return true;
}
bool Class::defineProperty(const char *name, v8::AccessorNameGetterCallback getter, v8::AccessorNameSetterCallback setter)
{
v8::MaybeLocal<v8::String> jsName = v8::String::NewFromUtf8(__isolate, name, v8::NewStringType::kNormal);
if (jsName.IsEmpty())
return false;
_ctorTemplate.Get(__isolate)->PrototypeTemplate()->SetAccessor(jsName.ToLocalChecked(), getter, setter);
return true;
}
bool Class::defineStaticFunction(const char *name, v8::FunctionCallback func)
{
v8::MaybeLocal<v8::String> jsName = v8::String::NewFromUtf8(__isolate, name, v8::NewStringType::kNormal);
if (jsName.IsEmpty())
return false;
_ctorTemplate.Get(__isolate)->Set(jsName.ToLocalChecked(), v8::FunctionTemplate::New(__isolate, func));
return true;
}
bool Class::defineStaticProperty(const char *name, v8::AccessorNameGetterCallback getter, v8::AccessorNameSetterCallback setter)
{
v8::MaybeLocal<v8::String> jsName = v8::String::NewFromUtf8(__isolate, name, v8::NewStringType::kNormal);
if (jsName.IsEmpty())
return false;
_ctorTemplate.Get(__isolate)->SetNativeDataProperty(jsName.ToLocalChecked(), getter, setter);
return true;
}
bool Class::defineFinalizeFunction(V8FinalizeFunc finalizeFunc)
{
assert(finalizeFunc != nullptr);
_finalizeFunc = finalizeFunc;
return true;
}
// v8::Local<v8::Object> Class::_createJSObject(const std::string &clsName, Class** outCls)
// {
// auto iter = __clsMap.find(clsName);
// if (iter == __clsMap.end())
// {
// *outCls = nullptr;
// return v8::Local<v8::Object>::Cast(v8::Undefined(__isolate));
// }
//
// *outCls = iter->second;
// return _createJSObjectWithClass(iter->second);
// }
v8::Local<v8::Object> Class::_createJSObjectWithClass(Class* cls)
{
v8::MaybeLocal<v8::Object> ret = cls->_ctorTemplate.Get(__isolate)->InstanceTemplate()->NewInstance(__isolate->GetCurrentContext());
assert(!ret.IsEmpty());
return ret.ToLocalChecked();
}
Object* Class::getProto() const
{
return _proto;
}
V8FinalizeFunc Class::_getFinalizeFunction() const
{
return _finalizeFunc;
}
/* static */
void Class::setIsolate(v8::Isolate* isolate)
{
__isolate = isolate;
}
} // namespace se {
#endif // #if SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8
| 33.489879 | 140 | 0.619802 | [
"object",
"vector"
] |
e838d9815c666d98b3c39224afc983a56633dd5e | 53,607 | cpp | C++ | proto/tests/mock_switch.cpp | MaxPolovyi/PI | ca70829e33017518cd7cc1a1f1d1d0904cd59344 | [
"Apache-2.0"
] | null | null | null | proto/tests/mock_switch.cpp | MaxPolovyi/PI | ca70829e33017518cd7cc1a1f1d1d0904cd59344 | [
"Apache-2.0"
] | null | null | null | proto/tests/mock_switch.cpp | MaxPolovyi/PI | ca70829e33017518cd7cc1a1f1d1d0904cd59344 | [
"Apache-2.0"
] | null | null | null | /* Copyright 2013-present Barefoot Networks, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Antonin Bas (antonin@barefootnetworks.com)
*
*/
#include "mock_switch.h"
#include <gmock/gmock.h>
#include <boost/functional/hash.hpp>
#include <boost/optional.hpp>
#include <algorithm> // std::copy, std::for_each
#include <map>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include "PI/frontends/proto/device_mgr.h"
#include "PI/int/pi_int.h"
#include "PI/int/serialize.h"
#include "PI/pi.h"
#include "PI/pi_mc.h"
#include "PI/target/pi_imp.h"
#include "PI/target/pi_learn_imp.h"
namespace pi {
namespace proto {
namespace testing {
namespace {
using ::testing::_;
using ::testing::Invoke;
using ::testing::Return;
class DummyMatchKey {
friend struct DummyMatchKeyHash;
public:
explicit DummyMatchKey(const pi_match_key_t *match_key)
: priority(match_key->priority),
mk(&match_key->data[0], &match_key->data[match_key->data_size]) { }
bool operator==(const DummyMatchKey& other) const {
return priority == other.priority && mk == other.mk;
}
bool operator!=(const DummyMatchKey& other) const {
return !(*this == other);
}
size_t emit(char *dst) const {
size_t s = 0;
s += emit_uint32(dst, priority);
std::copy(mk.begin(), mk.end(), dst + s);
s += mk.size();
return s;
}
size_t nbytes() const {
return mk.size();
}
void set_priority(int priority) {
this->priority = priority;
}
private:
uint32_t priority;
std::vector<char> mk;
};
struct DummyMatchKeyHash {
std::size_t operator()(const DummyMatchKey& b) const {
std::size_t seed = 0;
boost::hash_combine(seed, b.priority);
boost::hash_range(seed, b.mk.begin(), b.mk.end());
return seed;
}
};
class ActionData {
public:
// define default constuctor for DummyTableEntry below
ActionData() { }
explicit ActionData(const pi_action_data_t *action_data)
: action_id(action_data->action_id),
data(&action_data->data[0],
&action_data->data[action_data->data_size]) { }
size_t emit(char *dst) const {
size_t s = 0;
s += emit_p4_id(dst, action_id);
s += emit_uint32(dst + s, data.size());
std::copy(data.begin(), data.end(), dst + s);
s += data.size();
return s;
}
private:
pi_p4_id_t action_id;
std::vector<char> data;
};
// CRTP seems overkill here, since we only need to access one static method in
// the derived classes...
template <typename T, typename ConfigType>
class DummyResource {
public:
using config_type = ConfigType;
template <typename I>
pi_status_t read(I index, ConfigType *config) const {
auto it = resources.find(static_cast<typename Resources::key_type>(index));
if (it == resources.end())
*config = T::get_default();
else
*config = it->second;
return PI_STATUS_SUCCESS;
}
template <typename I>
pi_status_t write(I index, const ConfigType *config) {
resources[static_cast<typename Resources::key_type>(index)] = *config;
return PI_STATUS_SUCCESS;
}
private:
using Resources = std::unordered_map<uint64_t, ConfigType>;
using key_type = typename Resources::key_type;
static_assert(sizeof(key_type) >= sizeof(uint64_t),
"Key cannot fit uint64");
static_assert(sizeof(key_type) >= sizeof(pi_entry_handle_t),
"Key cannot fit entry handle");
Resources resources;
};
class DummyMeter : public DummyResource<DummyMeter, pi_meter_spec_t> {
public:
static constexpr pi_res_type_id_t direct_res_type = PI_DIRECT_METER_ID;
static pi_meter_spec_t get_default() {
return {0, 0, 0, 0, PI_METER_UNIT_DEFAULT, PI_METER_TYPE_DEFAULT};
}
};
class DummyCounter : public DummyResource<DummyCounter, pi_counter_data_t> {
public:
static constexpr pi_res_type_id_t direct_res_type = PI_DIRECT_COUNTER_ID;
static pi_counter_data_t get_default() {
return {PI_COUNTER_UNIT_PACKETS | PI_COUNTER_UNIT_BYTES, 0u, 0u};
}
};
class DummyTableEntry {
public:
explicit DummyTableEntry(const pi_table_entry_t *table_entry)
: type(table_entry->entry_type) {
switch (table_entry->entry_type) {
case PI_ACTION_ENTRY_TYPE_DATA:
ad = ActionData(table_entry->entry.action_data);
break;
case PI_ACTION_ENTRY_TYPE_INDIRECT:
indirect_h = table_entry->entry.indirect_handle;
break;
default:
assert(0);
}
}
size_t emit(char *dst) const {
size_t s = 0;
s += emit_action_entry_type(dst, type);
switch (type) {
case PI_ACTION_ENTRY_TYPE_NONE:
break;
case PI_ACTION_ENTRY_TYPE_DATA:
s += ad.emit(dst + s);
break;
case PI_ACTION_ENTRY_TYPE_INDIRECT:
s += emit_indirect_handle(dst + s, indirect_h);
break;
}
s += emit_uint32(dst + s, 0); // properties
return s;
}
private:
pi_action_entry_type_t type;
// not bothering with a union here
ActionData ad;
pi_indirect_handle_t indirect_h;
};
class DummyTable {
public:
struct Entry {
// NOLINTNEXTLINE
Entry(DummyMatchKey &&mk, DummyTableEntry &&entry)
: mk(mk), entry(entry) { }
DummyMatchKey mk;
DummyTableEntry entry;
};
DummyTable(pi_p4_id_t table_id, const pi_p4info_t *p4info)
: table_id(table_id), p4info(p4info) { }
void add_counter(pi_p4_id_t c_id, DummyCounter *counter) {
counters[c_id] = counter;
}
void add_meter(pi_p4_id_t m_id, DummyMeter *meter) {
meters[m_id] = meter;
}
pi_status_t entry_add(const pi_match_key_t *match_key,
const pi_table_entry_t *table_entry,
pi_entry_handle_t *entry_handle) {
auto r = key_to_handle.emplace(DummyMatchKey(match_key), entry_counter);
// TODO(antonin): we need a better error code for duplicate entry
if (!r.second) return PI_STATUS_TARGET_ERROR;
// An actual target would probably discard the priority for a non-ternary
// table...
DummyMatchKey dmk(match_key);
if (!has_ternary_match()) dmk.set_priority(0);
entries.emplace(
entry_counter,
Entry(std::move(dmk), DummyTableEntry(table_entry)));
// direct resources
// my original plan was to support them in DummyTableEntry, but because I
// need to access the Dummy instances for the resources, it seems easier to
// do it here.
if (table_entry->direct_res_config) {
auto *configs = table_entry->direct_res_config->configs;
for (size_t i = 0; i < table_entry->direct_res_config->num_configs; i++) {
pi_p4_id_t res_id = configs[i].res_id;
if (pi_is_direct_counter_id(res_id)) {
counters[res_id]->write(
entry_counter,
static_cast<const pi_counter_data_t *>(configs[i].config));
} else if (pi_is_direct_meter_id(res_id)) {
meters[res_id]->write(
entry_counter,
static_cast<const pi_meter_spec_t *>(configs[i].config));
} else {
assert(0 && "Unsupported direct resource id");
}
}
}
*entry_handle = entry_counter++;
return PI_STATUS_SUCCESS;
}
pi_status_t default_action_set(const pi_table_entry_t *table_entry) {
// boost::optional::emplace is only available in "recent" versions of boost
// (>= 1.56.0); to avoid issues we use copy assignment
// default_entry.emplace(table_entry);
default_entry = DummyTableEntry(table_entry);
return PI_STATUS_SUCCESS;
}
pi_status_t default_action_reset() {
default_entry.reset();
return PI_STATUS_SUCCESS;
}
// TOFO(antonin): implement
// TODO(antonin): support const default actions, how?
pi_status_t default_action_get(pi_table_entry_t *table_entry) {
(void) table_entry;
return PI_STATUS_SUCCESS;
}
pi_status_t entry_delete_wkey(const pi_match_key_t *match_key) {
auto it = key_to_handle.find(DummyMatchKey(match_key));
if (it == key_to_handle.end()) return PI_STATUS_TARGET_ERROR;
auto entry_handle = it->second;
auto cnt = entries.erase(entry_handle);
(void) cnt;
assert(cnt == 1);
key_to_handle.erase(it);
return PI_STATUS_SUCCESS;
}
pi_status_t entry_modify_wkey(const pi_match_key_t *match_key,
const pi_table_entry_t *table_entry) {
auto it = key_to_handle.find(DummyMatchKey(match_key));
if (it == key_to_handle.end()) return PI_STATUS_TARGET_ERROR;
auto entry_handle = it->second;
auto &entry = entries.at(entry_handle);
entry.entry = DummyTableEntry(table_entry);
return PI_STATUS_SUCCESS;
}
pi_status_t entries_fetch(pi_table_fetch_res_t *res) {
res->num_entries = entries.size();
// TODO(antonin): it does not make much sense to me anymore for it to be the
// target's responsibility to populate this field
res->mkey_nbytes = 0;
char *buf = new char[16384]; // should be large enough for testing
char *buf_ptr = buf;
for (const auto &p : entries) {
buf_ptr += emit_entry_handle(buf_ptr, p.first);
res->mkey_nbytes = p.second.mk.nbytes();
buf_ptr += p.second.mk.emit(buf_ptr);
buf_ptr += p.second.entry.emit(buf_ptr);
buf_ptr += emit_direct_configs(buf_ptr, p.first);
}
res->entries = buf;
res->entries_size = std::distance(buf, buf_ptr);
return PI_STATUS_SUCCESS;
}
private:
bool has_ternary_match() const {
size_t num_mfs = pi_p4info_table_num_match_fields(p4info, table_id);
for (size_t idx = 0; idx < num_mfs; idx++) {
auto mf_info = pi_p4info_table_match_field_info(p4info, table_id, idx);
if (mf_info->match_type == PI_P4INFO_MATCH_TYPE_TERNARY ||
mf_info->match_type == PI_P4INFO_MATCH_TYPE_RANGE)
return true;
}
return false;
}
template <typename T, typename It>
size_t emit_direct_resources_one_type(char *dst, pi_entry_handle_t h,
const It first, const It last) const {
size_t s = 0;
PIDirectResMsgSizeFn msg_size_fn;
PIDirectResEmitFn emit_fn;
pi_direct_res_get_fns(
T::direct_res_type, &msg_size_fn, &emit_fn, NULL, NULL);
for (auto it = first; it != last; ++it) {
s += emit_p4_id(dst + s, it->first);
typename T::config_type config;
it->second->read(h, &config);
s += emit_uint32(dst + s, msg_size_fn(&config));
s += emit_fn(dst + s, &config);
}
return s;
}
size_t emit_direct_configs(char *dst, pi_entry_handle_t h) const {
size_t s = 0;
s += emit_uint32(dst, counters.size() + meters.size());
s += emit_direct_resources_one_type<DummyCounter>(
dst + s, h, counters.begin(), counters.end());
s += emit_direct_resources_one_type<DummyMeter>(
dst + s, h, meters.begin(), meters.end());
return s;
}
const pi_p4_id_t table_id;
const pi_p4info_t *p4info;
std::unordered_map<pi_entry_handle_t, Entry> entries{};
std::unordered_map<DummyMatchKey, pi_entry_handle_t, DummyMatchKeyHash>
key_to_handle{};
boost::optional<DummyTableEntry> default_entry;
size_t entry_counter{0};
std::map<pi_p4_id_t, DummyCounter *> counters{};
std::map<pi_p4_id_t, DummyMeter *> meters{};
};
class DummyActionProf {
public:
pi_status_t member_create(const pi_action_data_t *action_data,
pi_indirect_handle_t *mbr_handle) {
members.emplace(member_counter, ActionData(action_data));
*mbr_handle = member_counter++;
return PI_STATUS_SUCCESS;
}
pi_status_t member_modify(pi_indirect_handle_t mbr_handle,
const pi_action_data_t *action_data) {
auto it = members.find(mbr_handle);
if (it == members.end()) return PI_STATUS_TARGET_ERROR;
it->second = ActionData(action_data);
return PI_STATUS_SUCCESS;
}
pi_status_t member_delete(pi_indirect_handle_t mbr_handle) {
auto count = members.erase(mbr_handle);
return (count == 0) ? PI_STATUS_TARGET_ERROR : PI_STATUS_SUCCESS;
}
pi_status_t group_create(size_t max_size, pi_indirect_handle_t *grp_handle) {
(void) max_size;
groups.emplace(group_counter, GroupMembers());
*grp_handle = group_counter++;
return PI_STATUS_SUCCESS;
}
pi_status_t group_delete(pi_indirect_handle_t grp_handle) {
auto count = groups.erase(grp_handle);
return (count == 0) ? PI_STATUS_TARGET_ERROR : PI_STATUS_SUCCESS;
}
pi_status_t group_add_member(pi_indirect_handle_t grp_handle,
pi_indirect_handle_t mbr_handle) {
auto it = groups.find(grp_handle);
if (it == groups.end()) return PI_STATUS_TARGET_ERROR;
auto p = it->second.insert(mbr_handle);
return (!p.second) ? PI_STATUS_TARGET_ERROR : PI_STATUS_SUCCESS;
}
pi_status_t group_remove_member(pi_indirect_handle_t grp_handle,
pi_indirect_handle_t mbr_handle) {
auto it = groups.find(grp_handle);
if (it == groups.end()) return PI_STATUS_TARGET_ERROR;
auto count = it->second.erase(mbr_handle);
return (count == 0) ? PI_STATUS_TARGET_ERROR : PI_STATUS_SUCCESS;
}
pi_status_t group_set_members(pi_indirect_handle_t grp_handle,
size_t num_mbrs,
const pi_indirect_handle_t *mbr_handles) {
auto it = groups.find(grp_handle);
if (it == groups.end()) return PI_STATUS_TARGET_ERROR;
it->second.clear();
it->second.insert(mbr_handles, mbr_handles + num_mbrs);
return PI_STATUS_SUCCESS;
}
pi_status_t entries_fetch(pi_act_prof_fetch_res_t *res) {
res->num_members = members.size();
res->num_groups = groups.size();
constexpr size_t kBufSize = 16384; // should be large enough for testing
// members
{
char *buf = new char[kBufSize];
char *buf_ptr = buf;
for (const auto &p : members) {
buf_ptr += emit_indirect_handle(buf_ptr, p.first);
buf_ptr += p.second.emit(buf_ptr);
}
res->entries_members = buf;
res->entries_members_size = std::distance(buf, buf_ptr);
}
// groups
{
char *buf = new char[kBufSize];
char *buf_ptr = buf;
res->mbr_handles = new pi_indirect_handle_t[kBufSize];
res->num_cumulated_mbr_handles = 0;
size_t offset = 0;
for (const auto &p : groups) {
buf_ptr += emit_indirect_handle(buf_ptr, p.first);
auto &mbrs = p.second;
buf_ptr += emit_uint32(buf_ptr, mbrs.size());
buf_ptr += emit_uint32(buf_ptr, res->num_cumulated_mbr_handles);
res->num_cumulated_mbr_handles += mbrs.size();
for (const auto &m : mbrs) res->mbr_handles[offset++] = m;
}
res->entries_groups = buf;
res->entries_groups_size = std::distance(buf, buf_ptr);
}
return PI_STATUS_SUCCESS;
}
private:
using GroupMembers = std::unordered_set<pi_indirect_handle_t>;
std::unordered_map<pi_indirect_handle_t, ActionData> members{};
std::unordered_map<pi_indirect_handle_t, GroupMembers> groups{};
size_t member_counter{0};
size_t group_counter{1 << 24};
};
class DummyPRE {
public:
pi_status_t mc_grp_create(pi_mc_grp_id_t grp_id,
pi_mc_grp_handle_t *grp_handle) {
pi_mc_grp_handle_t grp_h = static_cast<pi_mc_grp_handle_t>(grp_id);
auto p = mc_grps.insert(grp_h);
if (!p.second) return PI_STATUS_TARGET_ERROR;
*grp_handle = grp_h;
return PI_STATUS_SUCCESS;
}
pi_status_t mc_grp_delete(pi_mc_grp_handle_t grp_handle) {
auto c = mc_grps.erase(grp_handle);
return (c == 0) ? PI_STATUS_TARGET_ERROR : PI_STATUS_SUCCESS;
}
pi_status_t mc_node_create(pi_mc_rid_t rid,
size_t eg_ports_count,
const pi_mc_port_t *eg_ports,
pi_mc_node_handle_t *node_handle) {
mc_nodes.emplace(node_counter,
McNode(node_counter, rid, eg_ports_count, eg_ports));
*node_handle = node_counter++;
return PI_STATUS_SUCCESS;
}
pi_status_t mc_node_modify(pi_mc_node_handle_t node_handle,
size_t eg_ports_count,
const pi_mc_port_t *eg_ports) {
auto it = mc_nodes.find(node_handle);
if (it == mc_nodes.end()) return PI_STATUS_TARGET_ERROR;
it->second.set_ports(eg_ports_count, eg_ports);
return PI_STATUS_SUCCESS;
}
pi_status_t mc_node_delete(pi_mc_node_handle_t node_handle) {
auto c = mc_nodes.erase(node_handle);
return (c == 0) ? PI_STATUS_TARGET_ERROR : PI_STATUS_SUCCESS;
}
pi_status_t mc_grp_attach_node(pi_mc_grp_handle_t grp_handle,
pi_mc_node_handle_t node_handle) {
auto it = mc_nodes.find(node_handle);
if (it == mc_nodes.end()) return PI_STATUS_TARGET_ERROR;
if (it->second.attached_to.is_initialized()) return PI_STATUS_TARGET_ERROR;
it->second.attached_to = grp_handle;
return PI_STATUS_SUCCESS;
}
pi_status_t mc_grp_detach_node(pi_mc_grp_handle_t grp_handle,
pi_mc_node_handle_t node_handle) {
(void)grp_handle;
auto it = mc_nodes.find(node_handle);
if (it == mc_nodes.end()) return PI_STATUS_TARGET_ERROR;
if (!it->second.attached_to.is_initialized()) return PI_STATUS_TARGET_ERROR;
it->second.attached_to = boost::none;
return PI_STATUS_SUCCESS;
}
pi_status_t clone_session_set(
pi_clone_session_id_t clone_session_id,
const pi_clone_session_config_t *clone_session_config) {
(void)clone_session_id;
(void)clone_session_config;
return PI_STATUS_SUCCESS;
}
pi_status_t clone_session_reset(pi_clone_session_id_t clone_session_id) {
(void)clone_session_id;
return PI_STATUS_SUCCESS;
}
private:
struct McNode {
pi_mc_node_handle_t node_handle;
pi_mc_rid_t rid;
std::vector<pi_mc_port_t> eg_ports;
boost::optional<pi_mc_grp_handle_t> attached_to;
McNode(pi_mc_node_handle_t node_handle,
pi_mc_rid_t rid,
size_t eg_ports_count,
const pi_mc_port_t *eg_ports)
: node_handle(node_handle), rid(rid) {
set_ports(eg_ports_count, eg_ports);
}
void set_ports(size_t eg_ports_count, const pi_mc_port_t *eg_ports) {
if (eg_ports_count == 0)
this->eg_ports.clear();
else
this->eg_ports.assign(eg_ports, eg_ports + eg_ports_count);
}
};
std::unordered_map<pi_mc_node_handle_t, McNode> mc_nodes;
std::unordered_set<pi_mc_grp_handle_t> mc_grps;
size_t node_counter{0};
};
} // namespace
class DummySwitch {
public:
explicit DummySwitch(device_id_t device_id)
: device_id(device_id) { }
pi_status_t table_entry_add(pi_p4_id_t table_id,
const pi_match_key_t *match_key,
const pi_table_entry_t *table_entry,
pi_entry_handle_t *entry_handle) {
return get_table(table_id).entry_add(match_key, table_entry, entry_handle);
}
pi_status_t table_default_action_set(pi_p4_id_t table_id,
const pi_table_entry_t *table_entry) {
return get_table(table_id).default_action_set(table_entry);
}
pi_status_t table_default_action_reset(pi_p4_id_t table_id) {
return get_table(table_id).default_action_reset();
}
pi_status_t table_default_action_get(pi_p4_id_t table_id,
pi_table_entry_t *table_entry) {
return get_table(table_id).default_action_get(table_entry);
}
pi_status_t table_entry_delete_wkey(pi_p4_id_t table_id,
const pi_match_key_t *match_key) {
return get_table(table_id).entry_delete_wkey(match_key);
}
pi_status_t table_entry_modify_wkey(pi_p4_id_t table_id,
const pi_match_key_t *match_key,
const pi_table_entry_t *table_entry) {
return get_table(table_id).entry_modify_wkey(match_key, table_entry);
}
pi_status_t table_entries_fetch(pi_p4_id_t table_id,
pi_table_fetch_res_t *res) {
return get_table(table_id).entries_fetch(res);
}
pi_status_t action_prof_member_create(pi_p4_id_t act_prof_id,
const pi_action_data_t *action_data,
pi_indirect_handle_t *mbr_handle) {
// constructs DummyActionProf if not already in map
return action_profs[act_prof_id].member_create(action_data, mbr_handle);
}
pi_status_t action_prof_member_modify(pi_p4_id_t act_prof_id,
pi_indirect_handle_t mbr_handle,
const pi_action_data_t *action_data) {
return action_profs[act_prof_id].member_modify(mbr_handle, action_data);
}
pi_status_t action_prof_member_delete(pi_p4_id_t act_prof_id,
pi_indirect_handle_t mbr_handle) {
return action_profs[act_prof_id].member_delete(mbr_handle);
}
pi_status_t action_prof_group_create(pi_p4_id_t act_prof_id,
size_t max_size,
pi_indirect_handle_t *grp_handle) {
return action_profs[act_prof_id].group_create(max_size, grp_handle);
}
pi_status_t action_prof_group_delete(pi_p4_id_t act_prof_id,
pi_indirect_handle_t grp_handle) {
return action_profs[act_prof_id].group_delete(grp_handle);
}
pi_status_t action_prof_group_add_member(pi_p4_id_t act_prof_id,
pi_indirect_handle_t grp_handle,
pi_indirect_handle_t mbr_handle) {
return action_profs[act_prof_id].group_add_member(grp_handle, mbr_handle);
}
pi_status_t action_prof_group_remove_member(pi_p4_id_t act_prof_id,
pi_indirect_handle_t grp_handle,
pi_indirect_handle_t mbr_handle) {
return action_profs[act_prof_id].group_remove_member(
grp_handle, mbr_handle);
}
pi_status_t action_prof_group_set_members(
pi_p4_id_t act_prof_id,
pi_indirect_handle_t grp_handle,
size_t num_mbrs,
const pi_indirect_handle_t *mbr_handles) {
return action_profs[act_prof_id].group_set_members(
grp_handle, num_mbrs, mbr_handles);
}
pi_status_t action_prof_entries_fetch(pi_p4_id_t act_prof_id,
pi_act_prof_fetch_res_t *res) {
return action_profs[act_prof_id].entries_fetch(res);
}
pi_status_t meter_read(pi_p4_id_t meter_id, size_t index,
pi_meter_spec_t *meter_spec) {
return meters[meter_id].read(index, meter_spec);
}
pi_status_t meter_set(pi_p4_id_t meter_id, size_t index,
const pi_meter_spec_t *meter_spec) {
return meters[meter_id].write(index, meter_spec);
}
pi_status_t meter_read_direct(pi_p4_id_t meter_id,
pi_entry_handle_t entry_handle,
pi_meter_spec_t *meter_spec) {
return meters[meter_id].read(entry_handle, meter_spec);
}
pi_status_t meter_set_direct(pi_p4_id_t meter_id,
pi_entry_handle_t entry_handle,
const pi_meter_spec_t *meter_spec) {
return meters[meter_id].write(entry_handle, meter_spec);
}
pi_status_t counter_read(pi_p4_id_t counter_id, size_t index, int flags,
pi_counter_data_t *counter_data) {
(void) flags;
return counters[counter_id].read(index, counter_data);
}
pi_status_t counter_write(pi_p4_id_t counter_id, size_t index,
const pi_counter_data_t *counter_data) {
return counters[counter_id].write(index, counter_data);
}
pi_status_t counter_read_direct(pi_p4_id_t counter_id,
pi_entry_handle_t entry_handle, int flags,
pi_counter_data_t *counter_data) {
(void) flags;
return counters[counter_id].read(entry_handle, counter_data);
}
pi_status_t counter_write_direct(pi_p4_id_t counter_id,
pi_entry_handle_t entry_handle,
const pi_counter_data_t *counter_data) {
return counters[counter_id].write(entry_handle, counter_data);
}
pi_status_t packetout_send(const char *, size_t) {
return PI_STATUS_SUCCESS;
}
pi_status_t packetin_inject(const std::string &packet) const {
return pi_packetin_receive(device_id, packet.data(), packet.size());
}
pi_status_t mc_grp_create(pi_mc_grp_id_t grp_id,
pi_mc_grp_handle_t *grp_handle) {
return pre.mc_grp_create(grp_id, grp_handle);
}
pi_status_t mc_grp_delete(pi_mc_grp_handle_t grp_handle) {
return pre.mc_grp_delete(grp_handle);
}
pi_status_t mc_node_create(pi_mc_rid_t rid,
size_t eg_ports_count,
const pi_mc_port_t *eg_ports,
pi_mc_node_handle_t *node_handle) {
return pre.mc_node_create(rid, eg_ports_count, eg_ports, node_handle);
}
pi_status_t mc_node_modify(pi_mc_node_handle_t node_handle,
size_t eg_ports_count,
const pi_mc_port_t *eg_ports) {
return pre.mc_node_modify(node_handle, eg_ports_count, eg_ports);
}
pi_status_t mc_node_delete(pi_mc_node_handle_t node_handle) {
return pre.mc_node_delete(node_handle);
}
pi_status_t mc_grp_attach_node(pi_mc_grp_handle_t grp_handle,
pi_mc_node_handle_t node_handle) {
return pre.mc_grp_attach_node(grp_handle, node_handle);
}
pi_status_t mc_grp_detach_node(pi_mc_grp_handle_t grp_handle,
pi_mc_node_handle_t node_handle) {
return pre.mc_grp_detach_node(grp_handle, node_handle);
}
pi_status_t clone_session_set(
pi_clone_session_id_t clone_session_id,
const pi_clone_session_config_t *clone_session_config) {
return pre.clone_session_set(clone_session_id, clone_session_config);
}
pi_status_t clone_session_reset(pi_clone_session_id_t clone_session_id) {
return pre.clone_session_reset(clone_session_id);
}
pi_status_t learn_config_set(pi_p4_id_t learn_id,
const pi_learn_config_t *config) {
(void)learn_id;
(void)config;
return PI_STATUS_SUCCESS;
}
pi_status_t learn_msg_ack(pi_p4_id_t learn_id, pi_learn_msg_id_t msg_id) {
(void)learn_id;
(void)msg_id;
return PI_STATUS_SUCCESS;
}
pi_status_t learn_msg_done(pi_learn_msg_t *msg) {
delete[] msg->entries;
delete msg;
return PI_STATUS_SUCCESS;
}
pi_status_t learn_new_msg(pi_p4_id_t learn_id,
pi_learn_msg_id_t msg_id,
const std::vector<std::string> &samples) const {
if (samples.empty()) return PI_STATUS_SUCCESS;
auto *msg = new pi_learn_msg_t;
msg->dev_tgt = {device_id, 0xff};
msg->learn_id = learn_id;
msg->msg_id = msg_id;
msg->num_entries = samples.size();
msg->entry_size = samples.front().size();
auto *entries = new char[msg->num_entries * msg->entry_size];
msg->entries = entries;
std::for_each(samples.begin(), samples.end(),
[&entries](const std::string &s) {
std::memcpy(entries, s.data(), s.size());
entries += s.size();
});
return pi_learn_new_msg(msg);
}
void set_p4info(const pi_p4info_t *p4info) {
this->p4info = p4info;
}
void reset() {
tables.clear();
action_profs.clear();
counters.clear();
meters.clear();
}
private:
DummyTable &get_table(pi_p4_id_t table_id) {
auto t_it = tables.find(table_id);
if (t_it == tables.end()) {
auto &table = tables.emplace(
table_id, DummyTable(table_id, p4info)).first->second;
// add pointers to direct resources to DummyTable
size_t num_direct_resources;
auto *res_ids = pi_p4info_table_get_direct_resources(
p4info, table_id, &num_direct_resources);
for (size_t i = 0; i < num_direct_resources; i++) {
if (pi_is_direct_counter_id(res_ids[i]))
table.add_counter(res_ids[i], &counters[res_ids[i]]);
else if (pi_is_direct_meter_id(res_ids[i]))
table.add_meter(res_ids[i], &meters[res_ids[i]]);
else
assert(0 && "Unsupported direct resource id");
}
return table;
} else {
return t_it->second;
}
}
const pi_p4info_t *p4info{nullptr};
std::unordered_map<pi_p4_id_t, DummyTable> tables{};
std::unordered_map<pi_p4_id_t, DummyActionProf> action_profs{};
std::unordered_map<pi_p4_id_t, DummyMeter> meters{};
std::unordered_map<pi_p4_id_t, DummyCounter> counters{};
DummyPRE pre{};
device_id_t device_id;
};
DummySwitchMock::DummySwitchMock(device_id_t device_id)
: sw(new DummySwitch(device_id)) {
// delegate calls to real object
auto sw_ = sw.get();
// cannot use DoAll to combine 2 actions here (call to real object + handle
// capture), because the handle needs to be captured after the delegated call,
// but the delegated call is the one which needs to return the status
ON_CALL(*this, table_entry_add(_, _, _, _))
.WillByDefault(Invoke(this, &DummySwitchMock::_table_entry_add));
ON_CALL(*this, table_default_action_set(_, _))
.WillByDefault(Invoke(sw_, &DummySwitch::table_default_action_set));
ON_CALL(*this, table_default_action_reset(_))
.WillByDefault(Invoke(sw_, &DummySwitch::table_default_action_reset));
ON_CALL(*this, table_default_action_get(_, _))
.WillByDefault(Invoke(sw_, &DummySwitch::table_default_action_get));
ON_CALL(*this, table_entry_delete_wkey(_, _))
.WillByDefault(Invoke(sw_, &DummySwitch::table_entry_delete_wkey));
ON_CALL(*this, table_entry_modify_wkey(_, _, _))
.WillByDefault(Invoke(sw_, &DummySwitch::table_entry_modify_wkey));
ON_CALL(*this, table_entries_fetch(_, _))
.WillByDefault(Invoke(sw_, &DummySwitch::table_entries_fetch));
// cannot use DoAll to combine 2 actions here (call to real object + handle
// capture), because the handle needs to be captured after the delegated call,
// but the delegated call is the one which needs to return the status
ON_CALL(*this, action_prof_member_create(_, _, _))
.WillByDefault(
Invoke(this, &DummySwitchMock::_action_prof_member_create));
ON_CALL(*this, action_prof_member_modify(_, _, _))
.WillByDefault(Invoke(sw_, &DummySwitch::action_prof_member_modify));
ON_CALL(*this, action_prof_member_delete(_, _))
.WillByDefault(Invoke(sw_, &DummySwitch::action_prof_member_delete));
// same comment as for action_prof_member_create above
ON_CALL(*this, action_prof_group_create(_, _, _))
.WillByDefault(Invoke(this, &DummySwitchMock::_action_prof_group_create));
ON_CALL(*this, action_prof_group_delete(_, _))
.WillByDefault(Invoke(sw_, &DummySwitch::action_prof_group_delete));
ON_CALL(*this, action_prof_group_add_member(_, _, _))
.WillByDefault(Invoke(sw_, &DummySwitch::action_prof_group_add_member));
ON_CALL(*this, action_prof_group_remove_member(_, _, _))
.WillByDefault(
Invoke(sw_, &DummySwitch::action_prof_group_remove_member));
ON_CALL(*this, action_prof_group_set_members(_, _, _, _))
.WillByDefault(Invoke(sw_, &DummySwitch::action_prof_group_set_members));
ON_CALL(*this, action_prof_entries_fetch(_, _))
.WillByDefault(Invoke(sw_, &DummySwitch::action_prof_entries_fetch));
ON_CALL(*this, action_prof_api_support()).WillByDefault(Return(
static_cast<int>(PiActProfApiSupport_BOTH)));
ON_CALL(*this, meter_read(_, _, _))
.WillByDefault(Invoke(sw_, &DummySwitch::meter_read));
ON_CALL(*this, meter_set(_, _, _))
.WillByDefault(Invoke(sw_, &DummySwitch::meter_set));
ON_CALL(*this, meter_read_direct(_, _, _))
.WillByDefault(Invoke(sw_, &DummySwitch::meter_read_direct));
ON_CALL(*this, meter_set_direct(_, _, _))
.WillByDefault(Invoke(sw_, &DummySwitch::meter_set_direct));
ON_CALL(*this, counter_read(_, _, _, _))
.WillByDefault(Invoke(sw_, &DummySwitch::counter_read));
ON_CALL(*this, counter_write(_, _, _))
.WillByDefault(Invoke(sw_, &DummySwitch::counter_write));
ON_CALL(*this, counter_read_direct(_, _, _, _))
.WillByDefault(Invoke(sw_, &DummySwitch::counter_read_direct));
ON_CALL(*this, counter_write_direct(_, _, _))
.WillByDefault(Invoke(sw_, &DummySwitch::counter_write_direct));
ON_CALL(*this, packetout_send(_, _))
.WillByDefault(Invoke(sw_, &DummySwitch::packetout_send));
ON_CALL(*this, mc_grp_create(_, _))
.WillByDefault(Invoke(this, &DummySwitchMock::_mc_grp_create));
ON_CALL(*this, mc_grp_delete(_))
.WillByDefault(Invoke(sw_, &DummySwitch::mc_grp_delete));
ON_CALL(*this, mc_node_create(_, _, _, _))
.WillByDefault(Invoke(this, &DummySwitchMock::_mc_node_create));
ON_CALL(*this, mc_node_modify(_, _, _))
.WillByDefault(Invoke(sw_, &DummySwitch::mc_node_modify));
ON_CALL(*this, mc_node_modify(_, _, _))
.WillByDefault(Invoke(sw_, &DummySwitch::mc_node_modify));
ON_CALL(*this, mc_node_delete(_))
.WillByDefault(Invoke(sw_, &DummySwitch::mc_node_delete));
ON_CALL(*this, mc_grp_attach_node(_, _))
.WillByDefault(Invoke(sw_, &DummySwitch::mc_grp_attach_node));
ON_CALL(*this, mc_grp_detach_node(_, _))
.WillByDefault(Invoke(sw_, &DummySwitch::mc_grp_detach_node));
ON_CALL(*this, clone_session_set(_, _))
.WillByDefault(Invoke(sw_, &DummySwitch::clone_session_set));
ON_CALL(*this, clone_session_reset(_))
.WillByDefault(Invoke(sw_, &DummySwitch::clone_session_reset));
ON_CALL(*this, learn_config_set(_, _))
.WillByDefault(Invoke(sw_, &DummySwitch::learn_config_set));
ON_CALL(*this, learn_msg_ack(_, _))
.WillByDefault(Invoke(sw_, &DummySwitch::learn_msg_ack));
ON_CALL(*this, learn_msg_done(_))
.WillByDefault(Invoke(sw_, &DummySwitch::learn_msg_done));
}
DummySwitchMock::~DummySwitchMock() = default;
pi_status_t
DummySwitchMock::_table_entry_add(pi_p4_id_t table_id,
const pi_match_key_t *match_key,
const pi_table_entry_t *table_entry,
pi_entry_handle_t *h) {
auto r = sw->table_entry_add(table_id, match_key, table_entry, h);
if (r == PI_STATUS_SUCCESS) table_h = *h;
return r;
}
pi_entry_handle_t
DummySwitchMock::get_table_entry_handle() const {
return table_h;
}
pi_status_t
DummySwitchMock::_action_prof_member_create(pi_p4_id_t act_prof_id,
const pi_action_data_t *action_data,
pi_indirect_handle_t *h) {
auto r = sw->action_prof_member_create(act_prof_id, action_data, h);
if (r == PI_STATUS_SUCCESS) action_prof_h = *h;
return r;
}
pi_status_t
DummySwitchMock::_action_prof_group_create(pi_p4_id_t act_prof_id,
size_t max_size,
pi_indirect_handle_t *h) {
auto r = sw->action_prof_group_create(act_prof_id, max_size, h);
if (r == PI_STATUS_SUCCESS) action_prof_h = *h;
return r;
}
pi_indirect_handle_t
DummySwitchMock::get_action_prof_handle() const {
return action_prof_h;
}
pi_status_t
DummySwitchMock::_mc_grp_create(pi_mc_grp_id_t grp_id,
pi_mc_grp_handle_t *grp_handle) {
auto r = sw->mc_grp_create(grp_id, grp_handle);
if (r == PI_STATUS_SUCCESS) mc_grp_h = *grp_handle;
return r;
}
pi_mc_grp_handle_t
DummySwitchMock::get_mc_grp_handle() const {
return mc_grp_h;
}
pi_status_t
DummySwitchMock::_mc_node_create(pi_mc_rid_t rid,
size_t eg_ports_count,
const pi_mc_port_t *eg_ports,
pi_mc_node_handle_t *node_handle) {
auto r = sw->mc_node_create(rid, eg_ports_count, eg_ports, node_handle);
if (r == PI_STATUS_SUCCESS) mc_node_h = *node_handle;
return r;
}
pi_mc_node_handle_t
DummySwitchMock::get_mc_node_handle() const {
return mc_node_h;
}
pi_status_t
DummySwitchMock::packetin_inject(const std::string &packet) const {
return sw->packetin_inject(packet);
}
pi_status_t
DummySwitchMock::digest_inject(pi_p4_id_t learn_id,
pi_learn_msg_id_t msg_id,
const std::vector<std::string> &samples) const {
return sw->learn_new_msg(learn_id, msg_id, samples);
}
void
DummySwitchMock::set_p4info(const pi_p4info_t *p4info) {
sw->set_p4info(p4info);
}
void
DummySwitchMock::reset() {
sw->reset();
}
namespace {
// here we implement the _pi_* methods which are needed for our tests
extern "C" {
pi_status_t _pi_init(void *) { return PI_STATUS_SUCCESS; }
pi_status_t _pi_destroy() { return PI_STATUS_SUCCESS; }
pi_status_t _pi_assign_device(pi_dev_id_t dev_id, const pi_p4info_t *p4info,
pi_assign_extra_t *) {
auto *sw = DeviceResolver::get_switch(dev_id);
sw->reset();
sw->set_p4info(p4info);
return PI_STATUS_SUCCESS;
}
pi_status_t _pi_update_device_start(pi_dev_id_t dev_id,
const pi_p4info_t *p4info,
const char *, size_t) {
auto *sw = DeviceResolver::get_switch(dev_id);
sw->reset();
sw->set_p4info(p4info);
return PI_STATUS_SUCCESS;
}
pi_status_t _pi_update_device_end(pi_dev_id_t) { return PI_STATUS_SUCCESS; }
pi_status_t _pi_remove_device(pi_dev_id_t) { return PI_STATUS_SUCCESS; }
pi_status_t _pi_session_init(pi_session_handle_t *) {
return PI_STATUS_SUCCESS;
}
pi_status_t _pi_session_cleanup(pi_session_handle_t) {
return PI_STATUS_SUCCESS;
}
pi_status_t _pi_batch_begin(pi_session_handle_t) {
return PI_STATUS_SUCCESS;
}
pi_status_t _pi_batch_end(pi_session_handle_t, bool) {
return PI_STATUS_SUCCESS;
}
pi_status_t _pi_table_entry_add(pi_session_handle_t,
pi_dev_tgt_t dev_tgt, pi_p4_id_t table_id,
const pi_match_key_t *match_key,
const pi_table_entry_t *table_entry,
int overwrite,
pi_entry_handle_t *entry_handle) {
(void)overwrite;
return DeviceResolver::get_switch(dev_tgt.dev_id)->table_entry_add(
table_id, match_key, table_entry, entry_handle);
}
pi_status_t _pi_table_default_action_set(pi_session_handle_t,
pi_dev_tgt_t dev_tgt,
pi_p4_id_t table_id,
const pi_table_entry_t *table_entry) {
return DeviceResolver::get_switch(dev_tgt.dev_id)->table_default_action_set(
table_id, table_entry);
}
pi_status_t _pi_table_default_action_reset(pi_session_handle_t,
pi_dev_tgt_t dev_tgt,
pi_p4_id_t table_id) {
return DeviceResolver::get_switch(dev_tgt.dev_id)->table_default_action_reset(
table_id);
}
pi_status_t _pi_table_default_action_get(pi_session_handle_t,
pi_dev_id_t dev_id,
pi_p4_id_t table_id,
pi_table_entry_t *table_entry) {
return DeviceResolver::get_switch(dev_id)->table_default_action_get(
table_id, table_entry);
}
// TODO(antonin): implement when default_action_get is supported
pi_status_t _pi_table_default_action_done(pi_session_handle_t,
pi_table_entry_t *table_entry) {
(void) table_entry;
return PI_STATUS_SUCCESS;
}
pi_status_t _pi_table_entry_delete(pi_session_handle_t,
pi_dev_id_t,
pi_p4_id_t,
pi_entry_handle_t) {
return PI_STATUS_NOT_IMPLEMENTED_BY_TARGET;
}
pi_status_t _pi_table_entry_delete_wkey(pi_session_handle_t,
pi_dev_id_t dev_id, pi_p4_id_t table_id,
const pi_match_key_t *match_key) {
return DeviceResolver::get_switch(dev_id)->table_entry_delete_wkey(
table_id, match_key);
}
pi_status_t _pi_table_entry_modify_wkey(pi_session_handle_t,
pi_dev_id_t dev_id, pi_p4_id_t table_id,
const pi_match_key_t *match_key,
const pi_table_entry_t *table_entry) {
return DeviceResolver::get_switch(dev_id)->table_entry_modify_wkey(
table_id, match_key, table_entry);
}
pi_status_t _pi_table_entry_modify(pi_session_handle_t,
pi_dev_id_t, pi_p4_id_t,
pi_entry_handle_t,
const pi_table_entry_t *) {
return PI_STATUS_NOT_IMPLEMENTED_BY_TARGET;
}
pi_status_t _pi_table_entries_fetch(pi_session_handle_t,
pi_dev_id_t dev_id, pi_p4_id_t table_id,
pi_table_fetch_res_t *res) {
return DeviceResolver::get_switch(dev_id)->table_entries_fetch(
table_id, res);
}
pi_status_t _pi_table_entries_fetch_done(pi_session_handle_t,
pi_table_fetch_res_t *res) {
delete[] res->entries;
return PI_STATUS_SUCCESS;
}
pi_status_t _pi_act_prof_mbr_create(pi_session_handle_t,
pi_dev_tgt_t dev_tgt,
pi_p4_id_t act_prof_id,
const pi_action_data_t *action_data,
pi_indirect_handle_t *mbr_handle) {
return DeviceResolver::get_switch(dev_tgt.dev_id)->action_prof_member_create(
act_prof_id, action_data, mbr_handle);
}
pi_status_t _pi_act_prof_mbr_delete(pi_session_handle_t,
pi_dev_id_t dev_id, pi_p4_id_t act_prof_id,
pi_indirect_handle_t mbr_handle) {
return DeviceResolver::get_switch(dev_id)->action_prof_member_delete(
act_prof_id, mbr_handle);
}
pi_status_t _pi_act_prof_mbr_modify(pi_session_handle_t,
pi_dev_id_t dev_id, pi_p4_id_t act_prof_id,
pi_indirect_handle_t mbr_handle,
const pi_action_data_t *action_data) {
return DeviceResolver::get_switch(dev_id)->action_prof_member_modify(
act_prof_id, mbr_handle, action_data);
}
pi_status_t _pi_act_prof_grp_create(pi_session_handle_t,
pi_dev_tgt_t dev_tgt,
pi_p4_id_t act_prof_id, size_t max_size,
pi_indirect_handle_t *grp_handle) {
return DeviceResolver::get_switch(dev_tgt.dev_id)->action_prof_group_create(
act_prof_id, max_size, grp_handle);
}
pi_status_t _pi_act_prof_grp_delete(pi_session_handle_t,
pi_dev_id_t dev_id, pi_p4_id_t act_prof_id,
pi_indirect_handle_t grp_handle) {
return DeviceResolver::get_switch(dev_id)->action_prof_group_delete(
act_prof_id, grp_handle);
}
pi_status_t _pi_act_prof_grp_add_mbr(pi_session_handle_t,
pi_dev_id_t dev_id, pi_p4_id_t act_prof_id,
pi_indirect_handle_t grp_handle,
pi_indirect_handle_t mbr_handle) {
return DeviceResolver::get_switch(dev_id)->action_prof_group_add_member(
act_prof_id, grp_handle, mbr_handle);
}
pi_status_t _pi_act_prof_grp_remove_mbr(pi_session_handle_t,
pi_dev_id_t dev_id,
pi_p4_id_t act_prof_id,
pi_indirect_handle_t grp_handle,
pi_indirect_handle_t mbr_handle) {
return DeviceResolver::get_switch(dev_id)->action_prof_group_remove_member(
act_prof_id, grp_handle, mbr_handle);
}
pi_status_t _pi_act_prof_grp_set_mbrs(pi_session_handle_t,
pi_dev_id_t dev_id,
pi_p4_id_t act_prof_id,
pi_indirect_handle_t grp_handle,
size_t num_mbrs,
const pi_indirect_handle_t *mbr_handles) {
return DeviceResolver::get_switch(dev_id)->action_prof_group_set_members(
act_prof_id, grp_handle, num_mbrs, mbr_handles);
}
pi_status_t _pi_act_prof_entries_fetch(pi_session_handle_t,
pi_dev_id_t dev_id,
pi_p4_id_t act_prof_id,
pi_act_prof_fetch_res_t *res) {
return DeviceResolver::get_switch(dev_id)->action_prof_entries_fetch(
act_prof_id, res);
}
pi_status_t _pi_act_prof_entries_fetch_done(pi_session_handle_t,
pi_act_prof_fetch_res_t *res) {
delete[] res->entries_members;
delete[] res->entries_groups;
delete[] res->mbr_handles;
return PI_STATUS_SUCCESS;
}
int _pi_act_prof_api_support(pi_dev_id_t dev_id) {
return DeviceResolver::get_switch(dev_id)->action_prof_api_support();
}
pi_status_t _pi_meter_read(pi_session_handle_t,
pi_dev_tgt_t dev_tgt, pi_p4_id_t meter_id,
size_t index, pi_meter_spec_t *meter_spec) {
return DeviceResolver::get_switch(dev_tgt.dev_id)->meter_read(
meter_id, index, meter_spec);
}
pi_status_t _pi_meter_set(pi_session_handle_t,
pi_dev_tgt_t dev_tgt, pi_p4_id_t meter_id,
size_t index, const pi_meter_spec_t *meter_spec) {
return DeviceResolver::get_switch(dev_tgt.dev_id)->meter_set(
meter_id, index, meter_spec);
}
pi_status_t _pi_meter_read_direct(pi_session_handle_t,
pi_dev_tgt_t dev_tgt, pi_p4_id_t meter_id,
pi_entry_handle_t entry_handle,
pi_meter_spec_t *meter_spec) {
return DeviceResolver::get_switch(dev_tgt.dev_id)->meter_read_direct(
meter_id, entry_handle, meter_spec);
}
pi_status_t _pi_meter_set_direct(pi_session_handle_t,
pi_dev_tgt_t dev_tgt, pi_p4_id_t meter_id,
pi_entry_handle_t entry_handle,
const pi_meter_spec_t *meter_spec) {
return DeviceResolver::get_switch(dev_tgt.dev_id)->meter_set_direct(
meter_id, entry_handle, meter_spec);
}
pi_status_t _pi_counter_read(pi_session_handle_t,
pi_dev_tgt_t dev_tgt, pi_p4_id_t counter_id,
size_t index, int flags,
pi_counter_data_t *counter_data) {
return DeviceResolver::get_switch(dev_tgt.dev_id)->counter_read(
counter_id, index, flags, counter_data);
}
pi_status_t _pi_counter_write(pi_session_handle_t,
pi_dev_tgt_t dev_tgt, pi_p4_id_t counter_id,
size_t index,
const pi_counter_data_t *counter_data) {
return DeviceResolver::get_switch(dev_tgt.dev_id)->counter_write(
counter_id, index, counter_data);
}
pi_status_t _pi_counter_read_direct(pi_session_handle_t,
pi_dev_tgt_t dev_tgt, pi_p4_id_t counter_id,
pi_entry_handle_t entry_handle, int flags,
pi_counter_data_t *counter_data) {
return DeviceResolver::get_switch(dev_tgt.dev_id)->counter_read_direct(
counter_id, entry_handle, flags, counter_data);
}
pi_status_t _pi_counter_write_direct(pi_session_handle_t,
pi_dev_tgt_t dev_tgt,
pi_p4_id_t counter_id,
pi_entry_handle_t entry_handle,
const pi_counter_data_t *counter_data) {
return DeviceResolver::get_switch(dev_tgt.dev_id)->counter_write_direct(
counter_id, entry_handle, counter_data);
}
pi_status_t _pi_counter_hw_sync(pi_session_handle_t,
pi_dev_tgt_t dev_tgt, pi_p4_id_t counter_id,
PICounterHwSyncCb cb, void *cb_cookie) {
(void) dev_tgt;
(void) counter_id;
(void) cb_cookie;
return (cb == NULL) ? PI_STATUS_SUCCESS : PI_STATUS_NOT_IMPLEMENTED_BY_TARGET;
}
pi_status_t _pi_packetout_send(pi_dev_id_t dev_id, const char *pkt,
size_t size) {
return DeviceResolver::get_switch(dev_id)->packetout_send(pkt, size);
}
pi_status_t _pi_mc_session_init(pi_mc_session_handle_t *) {
return PI_STATUS_SUCCESS;
}
pi_status_t _pi_mc_session_cleanup(pi_mc_session_handle_t) {
return PI_STATUS_SUCCESS;
}
pi_status_t _pi_mc_grp_create(pi_mc_session_handle_t,
pi_dev_id_t dev_id,
pi_mc_grp_id_t grp_id,
pi_mc_grp_handle_t *grp_handle) {
return DeviceResolver::get_switch(dev_id)->mc_grp_create(grp_id, grp_handle);
}
pi_status_t _pi_mc_grp_delete(pi_mc_session_handle_t,
pi_dev_id_t dev_id,
pi_mc_grp_handle_t grp_handle) {
return DeviceResolver::get_switch(dev_id)->mc_grp_delete(grp_handle);
}
pi_status_t _pi_mc_node_create(pi_mc_session_handle_t,
pi_dev_id_t dev_id,
pi_mc_rid_t rid,
size_t eg_ports_count,
const pi_mc_port_t *eg_ports,
pi_mc_node_handle_t *node_handle) {
return DeviceResolver::get_switch(dev_id)->mc_node_create(
rid, eg_ports_count, eg_ports, node_handle);
}
pi_status_t _pi_mc_node_modify(pi_mc_session_handle_t,
pi_dev_id_t dev_id,
pi_mc_node_handle_t node_handle,
size_t eg_ports_count,
const pi_mc_port_t *eg_ports) {
return DeviceResolver::get_switch(dev_id)->mc_node_modify(
node_handle, eg_ports_count, eg_ports);
}
pi_status_t _pi_mc_node_delete(pi_mc_session_handle_t,
pi_dev_id_t dev_id,
pi_mc_node_handle_t node_handle) {
return DeviceResolver::get_switch(dev_id)->mc_node_delete(node_handle);
}
pi_status_t _pi_mc_grp_attach_node(pi_mc_session_handle_t,
pi_dev_id_t dev_id,
pi_mc_grp_handle_t grp_handle,
pi_mc_node_handle_t node_handle) {
return DeviceResolver::get_switch(dev_id)->mc_grp_attach_node(
grp_handle, node_handle);
}
pi_status_t _pi_mc_grp_detach_node(pi_mc_session_handle_t,
pi_dev_id_t dev_id,
pi_mc_grp_handle_t grp_handle,
pi_mc_node_handle_t node_handle) {
return DeviceResolver::get_switch(dev_id)->mc_grp_detach_node(
grp_handle, node_handle);
}
pi_status_t _pi_clone_session_set(
pi_session_handle_t,
pi_dev_tgt_t dev_tgt,
pi_clone_session_id_t clone_session_id,
const pi_clone_session_config_t *clone_session_config) {
return DeviceResolver::get_switch(dev_tgt.dev_id)->clone_session_set(
clone_session_id, clone_session_config);
}
pi_status_t _pi_clone_session_reset(pi_session_handle_t,
pi_dev_tgt_t dev_tgt,
pi_clone_session_id_t clone_session_id) {
return DeviceResolver::get_switch(dev_tgt.dev_id)->clone_session_reset(
clone_session_id);
}
pi_status_t _pi_learn_config_set(pi_session_handle_t,
pi_dev_id_t dev_id, pi_p4_id_t learn_id,
const pi_learn_config_t *config) {
return DeviceResolver::get_switch(dev_id)->learn_config_set(learn_id, config);
}
pi_status_t _pi_learn_msg_ack(pi_session_handle_t,
pi_dev_id_t dev_id,
pi_p4_id_t learn_id,
pi_learn_msg_id_t msg_id) {
return DeviceResolver::get_switch(dev_id)->learn_msg_ack(learn_id, msg_id);
}
pi_status_t _pi_learn_msg_done(pi_learn_msg_t *msg) {
return DeviceResolver::get_switch(msg->dev_tgt.dev_id)->learn_msg_done(msg);
}
}
} // namespace
} // namespace testing
} // namespace proto
} // namespace pi
| 36.691992 | 80 | 0.657134 | [
"object",
"vector"
] |
e839cd4ef9676f25719dd13419fa3f4efefce373 | 3,890 | cpp | C++ | src/commons.cpp | MysteriousJ/GamepadKeyController | 35cde4a32c24667aebc10055a420b21dbe08708c | [
"MIT"
] | 1 | 2017-04-02T22:49:31.000Z | 2017-04-02T22:49:31.000Z | src/commons.cpp | MysteriousJ/GamepadKeyController | 35cde4a32c24667aebc10055a420b21dbe08708c | [
"MIT"
] | null | null | null | src/commons.cpp | MysteriousJ/GamepadKeyController | 35cde4a32c24667aebc10055a420b21dbe08708c | [
"MIT"
] | null | null | null | #include "commons.h"
#include <vector>
#include <algorithm>
#include <sstream>
#include "Windowsx.h"
#include "Commctrl.h" // needed for hotkey macros
int commons::getUniqueInt()
{
static int i = 0;
i++;
return i;
}
bool commons::isNumber(const std::wstring& s){
for(unsigned int i=0; i<s.size(); i++){
if (s[i]!=L'1' && s[i]!=L'2' && s[i]!=L'3' && s[i]!=L'4' && s[i]!=L'5' && s[i]!=L'6' &&
s[i]!=L'7' && s[i]!=L'8' && s[i]!=L'9' && s[i]!=L'0' && s[i]!=L'.' && s[i]!=L'-')
return false;
}
return true;
}
double commons::wStringToNumber(const std::wstring& text){
std::wstringstream ss(text);
double result;
ss >> result;
return result;
}
std::wstring commons::numberToWString(double d)
{
std::wstringstream ss;
ss << d;
std::wstring s;
ss>>s;
return s;
}
void commons::restrictEditBoxToNumbers(HWND editTextControl, std::wstring& previousStringInBox)
{
static const int maxChars = 8;
wchar_t text[maxChars];
Edit_GetText(editTextControl, (LPWSTR)text, maxChars);
// limit input to numbers or a decimal point
if (commons::isNumber(text) && Edit_GetTextLength(editTextControl) < maxChars-1)
previousStringInBox = text;
else
// if the new character is not a number, revert to the previous string
Edit_SetText(editTextControl, (LPCWSTR)previousStringInBox.c_str());
}
double commons::getNumberFromEditBox(HWND editTextControl)
{
wchar_t text[8]; // arbitrarily sized buffer
Edit_GetText(editTextControl, (LPWSTR)text, 8);
return commons::wStringToNumber(text);
}
HWND commons::createChildWindow(HWND parentWindow, std::basic_string<wchar_t> className, WNDPROC windowProcedure, int cbWndExtra, LPVOID lpParam)
{
HINSTANCE hInstance = (HINSTANCE) GetWindowLong (parentWindow, GWL_HINSTANCE);
static std::vector<std::basic_string<wchar_t>> registeredClasses;
if (std::find(registeredClasses.begin(), registeredClasses.end(), className) == registeredClasses.end())
{
WNDCLASS wc;
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = windowProcedure;
wc.cbClsExtra = 0;
wc.cbWndExtra = cbWndExtra; // We're passing a pointer to this object so it can be used in an OOP style in wndProc
wc.hInstance = hInstance;
wc.hIcon = NULL;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = className.c_str();
RegisterClass(&wc);
registeredClasses.push_back(className);
}
return CreateWindow(className.c_str(), NULL, WS_CHILDWINDOW | WS_VISIBLE, 0,0,0,0,
parentWindow, (HMENU) getUniqueInt(), hInstance, lpParam);
}
HWND commons::createComboBox(HWND parentWindow, LPCWSTR items[], int numberOfItems)
{
HINSTANCE hInstance = (HINSTANCE) GetWindowLong (parentWindow, GWL_HINSTANCE);
HWND wnd = CreateWindow(TEXT("COMBOBOX"),TEXT("THING"),
WS_CHILD| WS_VISIBLE | CBS_DROPDOWNLIST,
0, 0, 0, 0, parentWindow,
(HMENU) getUniqueInt(),hInstance,NULL);
for (int i=0; i<numberOfItems; i++)
SendMessage(wnd, CB_ADDSTRING, 0, (LPARAM)items[i]);
//set to first item
SendMessage(wnd, CB_SETCURSEL, (WPARAM)0, 0);
return wnd;
}
void commons::simulateKeyPress(int key, int modifierKeyFlags)
{
// Accelerator keys
if(HOTKEYF_SHIFT & modifierKeyFlags)
keybd_event(VK_SHIFT, 0, 0, NULL);
if(HOTKEYF_CONTROL & modifierKeyFlags)
keybd_event(VK_CONTROL, 0, 0, NULL);
if(HOTKEYF_ALT & modifierKeyFlags)
keybd_event(VK_MENU, 0, 0, NULL); // VK_MENU is Alt
keybd_event(key, 0, 0, NULL);
}
void commons::simulateKeyRelease(int key, int modifierKeyFlags)
{
keybd_event(key, 0, KEYEVENTF_KEYUP, NULL);
// Accelerator keys
if(HOTKEYF_SHIFT & modifierKeyFlags)
keybd_event(VK_SHIFT, 0, KEYEVENTF_KEYUP, NULL);
if(HOTKEYF_CONTROL & modifierKeyFlags)
keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, NULL);
if(HOTKEYF_ALT & modifierKeyFlags)
keybd_event(VK_MENU, 0, 0, NULL); // VK_MENU is Alt
} | 29.694656 | 145 | 0.714139 | [
"object",
"vector"
] |
e840bca521e0d19bfe36bb3e4c74c0efe8c5c73e | 1,242 | cc | C++ | CPP/No174.cc | hxz1998/funny_leetcode | 1d2c425af09b57a030fc018ddc1e1a5ffb966cd0 | [
"Apache-2.0"
] | null | null | null | CPP/No174.cc | hxz1998/funny_leetcode | 1d2c425af09b57a030fc018ddc1e1a5ffb966cd0 | [
"Apache-2.0"
] | null | null | null | CPP/No174.cc | hxz1998/funny_leetcode | 1d2c425af09b57a030fc018ddc1e1a5ffb966cd0 | [
"Apache-2.0"
] | null | null | null | /**
* Created by Xiaozhong on 2020/8/18.
* Copyright (c) 2020/8/18 Xiaozhong. All rights reserved.
*/
#include "vector"
using namespace std;
class Solution {
private:
int dfs(vector<vector<int>> &dungeon, vector<vector<int>> &visited, int i, int j, int m, int n) {
// 到达终点,递归终止
if (i == m - 1 && j == n - 1) return max(1 - dungeon[i][j], 1);
// 如果之前已经计算过到达该点所用的健康点数,则直接返回
if (visited[i][j] > 0) return visited[i][j];
// 开始计算从 (i, j) 出发到终点所需要的最小值
int ans = 0;
// 如果碰到了最后一行,那么只能向右
if (i == m - 1) ans = max(dfs(dungeon, visited, i, j + 1, m, n) - dungeon[i][j], 1);
// 如果碰到了最后一列,那么只能向下
else if (j == n - 1) ans = max(dfs(dungeon, visited, i + 1, j, m, n) - dungeon[i][j], 1);
// 正常求值
else
ans = max(min(dfs(dungeon, visited, i + 1, j, m, n), dfs(dungeon, visited, i, j + 1, m, n)) - dungeon[i][j],
1);
// 记录并返回
return visited[i][j] = ans;
}
public:
int calculateMinimumHP(vector<vector<int>> &dungeon) {
vector<vector<int>> visited(dungeon.size(), vector<int>(dungeon[0].size(), 0));
return dfs(dungeon, visited, 0, 0, dungeon.size(), dungeon[0].size());
}
}; | 34.5 | 120 | 0.536232 | [
"vector"
] |
e84531480782bad22fd97646843ffacd3c92e8ea | 627 | cpp | C++ | pg_answer/28796834c9d14542bb4f57bacb4f62b6.cpp | Guyutongxue/Introduction_to_Computation | 062f688fe3ffb8e29cfaf139223e4994edbf64d6 | [
"WTFPL"
] | 8 | 2019-10-09T14:33:42.000Z | 2020-12-03T00:49:29.000Z | pg_answer/28796834c9d14542bb4f57bacb4f62b6.cpp | Guyutongxue/Introduction_to_Computation | 062f688fe3ffb8e29cfaf139223e4994edbf64d6 | [
"WTFPL"
] | null | null | null | pg_answer/28796834c9d14542bb4f57bacb4f62b6.cpp | Guyutongxue/Introduction_to_Computation | 062f688fe3ffb8e29cfaf139223e4994edbf64d6 | [
"WTFPL"
] | null | null | null | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
int inversion(const std::string& s) {
int inv{0};
for (int i{0}; i < s.size(); ++i) {
for (int j{i + 1}; j < s.size(); ++j) {
if (s[i] > s[j]) {
++inv;
}
}
}
return inv;
}
int main() {
int n, m;
std::cin >> n >> m;
std::vector<std::string> v(m);
for (auto& s : v) {
std::cin >> s;
}
std::sort(v.begin(), v.end(), [](auto& a, auto& b) { return inversion(a) < inversion(b); });
for (auto& s : v) {
std::cout << s << std::endl;
}
} | 21.62069 | 96 | 0.435407 | [
"vector"
] |
e84a6e6ab62de68c3152cce2697281cb2b955073 | 9,286 | cpp | C++ | Response.cpp | SGSSGene/cndl | c31af4c47973dde79e7f83594807e59167c102bc | [
"MIT"
] | 4 | 2020-02-20T11:37:45.000Z | 2021-06-03T09:37:51.000Z | Response.cpp | SGSSGene/cndl | c31af4c47973dde79e7f83594807e59167c102bc | [
"MIT"
] | 3 | 2020-03-31T09:42:08.000Z | 2020-09-28T19:58:44.000Z | Response.cpp | SGSSGene/cndl | c31af4c47973dde79e7f83594807e59167c102bc | [
"MIT"
] | 1 | 2020-03-31T09:02:28.000Z | 2020-03-31T09:02:28.000Z | #include "Response.h"
#include "DateStrHelper.h"
#include <algorithm>
#include <map>
#include <string_view>
namespace cndl {
using namespace std::string_literals;
using namespace std::string_view_literals;
namespace {
const std::unordered_map<int, std::string_view> code2reason {
// 1xx switching protocols
{101, "Switching Protocols"},
// 2xx success
{200, "OK"},
{201, "Created"},
{202, "Accepted"},
{203, "Non-Authoritative Information"},
{204, "No Content"},
{205, "Reset Content"},
{206, "Partial Content"},
{207, "Multi-Status"},
{208, "Already Reported"},
{226, "IM Used"},
// 3xx redirection
{300, "Multiple Choices"},
{301, "Moved Permanently"},
{302, "Found"},
{303, "See Other"},
{304, "Not Modified"},
{305, "Use Proxy"},
{306, "Switch Proxy"},
{307, "Temporary Redirect"},
{308, "Permanent Redirect"},
// 4xx client errors
{400, "Bad Request"},
{401, "Unauthorized"},
{402, "Payment Required"},
{403, "Forbidden"},
{404, "Not Found"},
{405, "Method Not Allowed"},
{406, "Not Acceptable"},
{407, "Proxy Authentication Required"},
{408, "Request Timeout"},
{409, "Conflict"},
{410, "Gone"},
{411, "Length Required"},
{412, "Precondition Failed"},
{413, "Payload Too Large"},
{414, "URI Too Long"},
{415, "Unsupported Media Type"},
{416, "Range Not Satisfiable"},
{417, "Expectation Failed"},
{418, "I'm a teapot"},
{421, "Misdirected Request"},
{422, "Unprocessable Entity"},
{423, "Locked"},
{424, "Failed Dependency"},
{425, "Too Early"},
{426, "Upgrade Required"},
{428, "Precondition Required"},
{429, "Too Many Requests"},
{431, "Request Header Fields Too Large"},
{451, "Unavailable For Legal Reasons"},
// 5xx server errors
{500, "Internal Server Error"},
{501, "Not Implemented"},
{502, "Bad Gateway"},
{503, "Service Unavailable"},
{504, "Gateway Timeout"},
{505, "HTTP Version Not Supported"},
{506, "Variant Also Negotiates"},
{507, "Insufficient Storage"},
{508, "Loop Detected"},
{510, "Not Extended"},
{511, "Network Authentication Required"},
};
const std::unordered_map<std::string_view, std::string_view> extension_lookup_table {
{"html", "text/html"},
{"htm", "text/html"},
{"shtml", "text/html"},
{"css", "text/css"},
{"xml", "text/xml"},
{"gif", "image/gif"},
{"jpeg", "image/jpeg"},
{"jpg", "image/jpeg"},
{"js", "application/javascript"},
{"atom", "application/atom+xml"},
{"rss", "application/rss+xml"},
{"mml", "text/mathml"},
{"txt", "text/plain"},
{"jad", "text/vnd.sun.jme.app-descriptor"},
{"wml", "text/vnd.wap.wml"},
{"htc", "text/x-component"},
{"png", "image/png"},
{"svg", "image/svg+xml"},
{"svgz", "image/svg+xml"},
{"tif", "image/tiff"},
{"tiff", "image/tiff"},
{"wbmp", "image/vnd.wap.wbmp"},
{"webp", "image/webp"},
{"ico", "image/x-icon"},
{"jng", "image/x-jng"},
{"bmp", "image/x-ms-bmp"},
{"woff", "font/woff"},
{"woff2", "font/woff2"},
{"jar", "application/java-archive"},
{"war", "application/java-archive"},
{"ear", "application/java-archive"},
{"json", "application/json"},
{"hqx", "application/mac-binhex40"},
{"doc", "application/msword"},
{"pdf", "application/pdf"},
{"ps", "application/postscript"},
{"eps", "application/postscript"},
{"ai", "application/postscript"},
{"rtf", "application/rtf"},
{"m3u8", "application/vnd.apple.mpegurl"},
{"kml", "application/vnd.google-earth.kml+xml"},
{"kmz", "application/vnd.google-earth.kmz"},
{"xls", "application/vnd.ms-excel"},
{"eot", "application/vnd.ms-fontobject"},
{"ppt", "application/vnd.ms-powerpoint"},
{"odg", "application/vnd.oasis.opendocument.graphics"},
{"odp", "application/vnd.oasis.opendocument.presentation"},
{"ods", "application/vnd.oasis.opendocument.spreadsheet"},
{"odt", "application/vnd.oasis.opendocument.text"},
{"wmlc", "application/vnd.wap.wmlc"},
{"7z", "application/x-7z-compressed"},
{"cco", "application/x-cocoa"},
{"jardiff", "application/x-java-archive-diff"},
{"jnlp", "application/x-java-jnlp-file"},
{"run", "application/x-makeself"},
{"pl", "application/x-perl"},
{"pm", "application/x-perl"},
{"prc", "application/x-pilot"},
{"pdb", "application/x-pilot"},
{"rar", "application/x-rar-compressed"},
{"rpm", "application/x-redhat-package-manager"},
{"sea", "application/x-sea"},
{"swf", "application/x-shockwave-flash"},
{"sit", "application/x-stuffit"},
{"tcl", "application/x-tcl"},
{"tk", "application/x-tcl"},
{"der", "application/x-x509-ca-cert"},
{"pem", "application/x-x509-ca-cert"},
{"crt", "application/x-x509-ca-cert"},
{"xpi", "application/x-xpinstall"},
{"xhtml", "application/xhtml+xml"},
{"xspf", "application/xspf+xml"},
{"zip", "application/zip"},
{"bin", "application/octet-stream"},
{"exe", "application/octet-stream"},
{"dll", "application/octet-stream"},
{"deb", "application/octet-stream"},
{"dmg", "application/octet-stream"},
{"iso", "application/octet-stream"},
{"img", "application/octet-stream"},
{"msi", "application/octet-stream"},
{"msp", "application/octet-stream"},
{"msm", "application/octet-stream"},
{"mid", "audio/midi"},
{"midi", "audio/midi"},
{"kar", "audio/midi"},
{"mp3", "audio/mpeg"},
{"ogg", "audio/ogg"},
{"m4a", "audio/x-m4a"},
{"ra", "audio/x-realaudio"},
{"3gpp", "video/3gpp"},
{"3gp", "video/3gpp"},
{"ts", "video/mp2t"},
{"mp4", "video/mp4"},
{"mpeg", "video/mpeg"},
{"mpg", "video/mpeg"},
{"mov", "video/quicktime"},
{"webm", "video/webm"},
{"flv", "video/x-flv"},
{"m4v", "video/x-m4v"},
{"mng", "video/x-mng"},
{"asx", "video/x-ms-asf"},
{"asf", "video/x-ms-asf"},
{"wmv", "video/x-ms-wmv"},
{"avi", "video/x-msvideo"},
{"wasm", "application/wasm"},
};
}
Response::Response(Error const& from_error, ErrorBodyGenerator pageGenerator)
: Response{}
{
status_code = from_error.code();
if (pageGenerator) {
std::string body = pageGenerator(status_code, from_error.what());
std::transform(begin(body), end(body), std::back_inserter(message_body), [](char c) { return std::byte{static_cast<unsigned char>(c)}; });
} else {
std::string_view what{from_error.what()};
std::transform(begin(what), end(what), std::back_inserter(message_body), [](char c) { return std::byte{static_cast<unsigned char>(c)}; });
}
}
void Response::setCookie(std::string_view name, std::string_view value, CookieAttributes attributes) {
std::string val = std::string{name} + "=" + std::string{value};
if (auto expires = std::get_if<struct tm>(&attributes.lifetime); expires) {
val += "; Expires=" + mkdatestr(*expires);
}
if (auto max_age = std::get_if<std::chrono::seconds>(&attributes.lifetime); max_age) {
val += "; Max-Age=" + std::to_string(max_age->count()) + "s";
}
if (attributes.secure) {
val += "; Secure";
}
if (attributes.http_only) {
val += "; HttpOnly";
}
if (attributes.path) {
val += "; Path="+*attributes.path;
}
if (attributes.domain) {
val += "; Domain="+*attributes.domain;
}
fields.emplace("Set-Cookie", std::move(val));
}
std::vector<std::byte> Response::serialize() const {
using namespace std::string_view_literals;
std::vector<std::byte> serialized;
auto append_str = [](std::vector<std::byte>& target, auto const& str) {
std::transform(begin(str), end(str), std::back_inserter(target), [](char c) { return std::byte{static_cast<unsigned char>(c)}; });
};
append_str(serialized, version);
append_str(serialized, " "sv);
append_str(serialized, std::to_string(status_code));
append_str(serialized, " "sv);
if (reason_phrase.empty()) {
append_str(serialized, code2reason.at(status_code));
} else {
append_str(serialized, reason_phrase);
}
append_str(serialized, "\r\n"sv);
for (auto const& [name, val] : fields) {
append_str(serialized, name);
append_str(serialized, ": "sv);
append_str(serialized, val);
append_str(serialized, "\r\n"sv);
}
append_str(serialized, "Content-Length: "sv);
append_str(serialized, std::to_string(message_body.size()));
append_str(serialized, "\r\n\r\n"sv);
serialized.insert(serialized.end(), message_body.begin(), message_body.end());
return serialized;
}
void Response::setContentTypeFromExtension(std::string_view extension) {
fields.erase("Content-Type");
fields.emplace("Content-Type", contentTypeLookup(extension));
}
std::string_view Response::contentTypeLookup(std::string_view extension) {
if (extension.size() > 0 and extension[0] == '.') {
extension = extension.substr(1);
}
auto it = extension_lookup_table.find(extension);
if (it == extension_lookup_table.end()){
return "text/plain";
}
return it->second;
}
}
| 31.477966 | 146 | 0.593905 | [
"vector",
"transform"
] |
e850ca9f76dc9b8853c7d435a2882d62443f372a | 434 | cpp | C++ | SceneServer/SSBattleMgr/SSBTreeCon_HasAbsorbMonster.cpp | tsymiar/---- | 90e21cbfe7b3bc730c998e9f5ef87aa3581e357a | [
"Unlicense"
] | 6 | 2019-07-15T23:55:15.000Z | 2020-09-07T15:07:54.000Z | SceneServer/SSBattleMgr/SSBTreeCon_HasAbsorbMonster.cpp | j1527156/BattleServer | 68c9146bf35e93dfd5a175b46e9761ee3c7c0d04 | [
"Unlicense"
] | null | null | null | SceneServer/SSBattleMgr/SSBTreeCon_HasAbsorbMonster.cpp | j1527156/BattleServer | 68c9146bf35e93dfd5a175b46e9761ee3c7c0d04 | [
"Unlicense"
] | 7 | 2019-07-15T23:55:24.000Z | 2021-08-10T07:49:05.000Z | #include "SSBTreeCon_HasAbsorbMonster.h"
#include "SSAI_HeroRobot.h"
#include "SSHero.h"
namespace SceneServer{
BOOLEAN CSSBTreeCon_HasAbsorbMonster::Travel(CSSAI_HeroRobot* pAI,CSSBTreeNode *&pActionNode,vector<SBTreeResult> *rstVec){
CSSHero* pHero = pAI->GetHero();
for (INT32 i = 0; i < c_n32MaxAbsorbSkillNum; ++i){
if (eObjectType_None != pHero->GetAbsorbMonsterID(i)){
return TRUE;
}
}
return FALSE;
}
}; | 25.529412 | 124 | 0.728111 | [
"vector"
] |
e8603d8d2cb323a86f01c04b8c5d1e7052d5ffb3 | 3,453 | cc | C++ | roofnet/txstat.cc | kohler/click-packages | cec70da7cf460548ef08f1ddad6924db29d5c0c5 | [
"MIT"
] | 13 | 2015-02-26T23:12:09.000Z | 2021-04-18T04:37:12.000Z | roofnet/txstat.cc | kohoumas/click-packages | 6bb5c4ba286e5dbc74efd1708921d530425691f6 | [
"MIT"
] | null | null | null | roofnet/txstat.cc | kohoumas/click-packages | 6bb5c4ba286e5dbc74efd1708921d530425691f6 | [
"MIT"
] | 7 | 2015-08-25T09:29:41.000Z | 2021-04-18T04:37:13.000Z | /*
* txstat.{cc,hh} -- extract per-packet link tx counts
* John Bicket
*
* Copyright (c) 1999-2002 Massachusetts Institute of Technology
*
* 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, subject to the conditions
* listed in the Click LICENSE file. These conditions include: you must
* preserve this copyright notice, and you cannot mention the copyright
* holders in advertising related to the Software without their permission.
* The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
* notice is a summary of the Click LICENSE file; the license in that file is
* legally binding.
*/
#include <click/config.h>
#include <click/confparse.hh>
#include <clicknet/ether.h>
#include <click/error.hh>
#include <click/glue.hh>
#include <click/timer.hh>
#include <click/straccum.hh>
#include <clicknet/wifi.h>
#include "txstat.hh"
CLICK_DECLS
TXStat::TXStat()
{
static unsigned char bcast_addr[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
_bcast = EtherAddress(bcast_addr);
}
TXStat::~TXStat()
{
}
int
TXStat::configure(Vector<String> &conf, ErrorHandler *errh)
{
int res = cp_va_kparse(conf, this, errh,
"SRCETH", cpkP+cpkM, cpEtherAddress, &_eth,
cpEnd);
return res;
}
int
TXStat::initialize(ErrorHandler *errh)
{
if (noutputs() > 0) {
if (!_eth)
return errh->error("Source IP and Ethernet address must be specified to send probes");
}
return 0;
}
Packet *
TXStat::simple_action(Packet *p_in)
{
click_ether *eh = (click_ether *) p_in->data();
//click_chatter("SRCR %s: got sr packet", _ip.unparse().c_str());
EtherAddress dst = EtherAddress(eh->ether_dhost);
if (dst == _bcast) {
//click_chatter("TXStat %s: broadcast packet", _eth.unparse().c_str());
p_in->kill();
return 0;
}
struct click_wifi_extra *ceh = (struct click_wifi_extra *) p_in->user_anno();
//int long_retries = p_in->user_anno_c (TX_ANNO_LONG_RETRIES);
bool success = !(ceh->flags & WIFI_EXTRA_TX_FAIL);
int rate = ceh->rate;
TXNeighborInfo *nfo = _neighbors.findp(dst);
if (!nfo) {
TXNeighborInfo foo = TXNeighborInfo(dst);
_neighbors.insert(dst, foo);
nfo = _neighbors.findp(dst);
}
nfo->_packets_sent++;
//nfo->_long_retries += long_retries;
//nfo->_short_retries += short_retries;
nfo->_rate = rate;
//click_chatter("TXStat %s: long=%d, short=%d, fail=%s",
//_eth.unparse().c_str(), long_retries, short_retries, failure ? "true" : "false");
if (!success) {
nfo->_failures++;
}
p_in->kill();
return 0;
}
String
TXStat::static_print_tx_stats(Element *e, void *)
{
TXStat *n = (TXStat *) e;
return n->print_tx_stats();
}
String
TXStat::print_tx_stats()
{
StringAccum sa;
for (TXNIter iter = _neighbors.begin(); iter.live(); iter++) {
TXNeighborInfo nfo = iter.value();
sa << nfo._eth.unparse() << "\n";
sa << " packets sent :" << nfo._packets_sent << "\n";
sa << " failures :" << nfo._failures << "\n";
sa << " long_retries :" << nfo._long_retries << "\n";
sa << " short_retries:" << nfo._short_retries << "\n";
sa << " rate :" << nfo._rate << "\n";
sa << "\n";
}
return sa.take_string();
}
void
TXStat::add_handlers()
{
add_read_handler("tx_stats", static_print_tx_stats, 0);
}
EXPORT_ELEMENT(TXStat)
CLICK_ENDDECLS
| 25.962406 | 92 | 0.668694 | [
"vector"
] |
e86c86958f6bb6b3396a4132d8afbe584dfba82d | 2,679 | cpp | C++ | src/process.cpp | tusharkulkarnieep/system_monitor_project | f770e4de03508f6118d79b837ba7d69ad01833ef | [
"MIT"
] | null | null | null | src/process.cpp | tusharkulkarnieep/system_monitor_project | f770e4de03508f6118d79b837ba7d69ad01833ef | [
"MIT"
] | null | null | null | src/process.cpp | tusharkulkarnieep/system_monitor_project | f770e4de03508f6118d79b837ba7d69ad01833ef | [
"MIT"
] | null | null | null | #include <unistd.h>
#include <cctype>
#include <sstream>
#include <string>
#include <vector>
#include <iostream>
#include "process.h"
#include "linux_parser.h"
#define STARTTIME (22)
using std::string;
using std::to_string;
using std::vector;
using std::cout;
using std::stof;
Process::Process(int pid) : processid(pid){} // Defining the constructor
int Process::Pid()
{
return processid;
}
float Process::CpuUtilization()
{
float total_time, elapsedtime;
// Getting the process times read from processtimes function
vector<float> protimes = Process::processtimes();
// Assigning the starttime
protimes[starttime] = LinuxParser::UpTime(Process::Pid());
// Calculating the total process time
total_time = protimes[utime] + protimes[stime] + protimes[cutime] + protimes[cstime];
// Calculating the elapsed time since the process started
elapsedtime = LinuxParser::SysUpTime() - protimes[starttime];
// Calculating the CPU utilization.
cpuutilization = total_time/elapsedtime;
return cpuutilization;
}
string Process::Command() { return LinuxParser::Command(Process::Pid()); }
string Process::Ram() { return LinuxParser::Ram(Process::Pid()); }
string Process::User() { return LinuxParser::User(Process::Pid()); }
long int Process::UpTime() { return LinuxParser::UpTime(Process::Pid()) ; }
bool Process::operator<(Process const& a) const
{
return a.cpuutilization < cpuutilization; // overloading operator< for comparing cpu utilization for processes
}
vector<float> Process::processtimes()
{
string line, value;
vector<float> pt {};
float t = 0;
string utime, stime, cutime, cstime;
// Opening the respective stst file for respective pid
std::ifstream filestream(LinuxParser::kProcDirectory + to_string(Process::Pid()) + LinuxParser::kStatFilename);
if(filestream.is_open())
{
while (std::getline(filestream,line))
{
std::istringstream linestream(line);
// looping till the 22nd value in the file that is Starttime of the process
for (int i = 1; i <= STARTTIME ; i++)
{
linestream >> value;
// getting the values at locations 14, 15, 16 and 17 from the file
if (i == STARTTIME-8 || i == STARTTIME-7 || i == STARTTIME-6 || i == STARTTIME-5)
{
// converting the time to seconds
t = stof(value) / sysconf(_SC_CLK_TCK);
// moving the value to the vector of process times.
pt.push_back(t);
}
}
}
}
return pt;
} | 31.892857 | 126 | 0.633445 | [
"vector"
] |
e871e55e13f9660f65133753fbc7decc169e079b | 826,888 | cpp | C++ | GCG_Source.build/module.django.db.models.deletion.cpp | Pckool/GCG | cee786d04ea30f3995e910bca82635f442b2a6a8 | [
"MIT"
] | null | null | null | GCG_Source.build/module.django.db.models.deletion.cpp | Pckool/GCG | cee786d04ea30f3995e910bca82635f442b2a6a8 | [
"MIT"
] | null | null | null | GCG_Source.build/module.django.db.models.deletion.cpp | Pckool/GCG | cee786d04ea30f3995e910bca82635f442b2a6a8 | [
"MIT"
] | null | null | null | /* Generated code for Python source for module 'django.db.models.deletion'
* created by Nuitka version 0.5.28.2
*
* This code is in part copyright 2017 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.h"
#include "__helpers.h"
/* The _module_django$db$models$deletion is a Python object pointer of module type. */
/* Note: For full compatibility 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_django$db$models$deletion;
PyDictObject *moduledict_django$db$models$deletion;
/* The module constants used, if any. */
static PyObject *const_str_digest_85cd31bd2bdae1f31ac2d01dbdfcece0;
extern PyObject *const_str_plain_related_model;
extern PyObject *const_str_plain_collector;
static PyObject *const_str_digest_5f5d2c1b0e46dd2d1920137e41b63ca4;
extern PyObject *const_str_plain_metaclass;
extern PyObject *const_str_plain___spec__;
extern PyObject *const_str_plain_sender;
extern PyObject *const_str_plain__meta;
static PyObject *const_str_digest_ee0f69070b25f713a9c5066608df3f60;
extern PyObject *const_str_plain___name__;
static PyObject *const_tuple_92a654805d556220df81829d2d67bdd3_tuple;
extern PyObject *const_str_plain_sorted;
static PyObject *const_str_plain_fast_deletes;
static PyObject *const_tuple_2121a1e03240e6f8803ed7ddee9cba88_tuple;
extern PyObject *const_dict_empty;
extern PyObject *const_str_plain_i;
extern PyObject *const_str_plain___file__;
extern PyObject *const_str_plain_deconstruct;
extern PyObject *const_tuple_none_false_false_tuple;
static PyObject *const_str_plain_source_attr;
extern PyObject *const_tuple_str_plain_pk_tuple;
extern PyObject *const_str_plain_CASCADE;
static PyObject *const_str_digest_230446a2965d8c36febdb9fab47679c7;
extern PyObject *const_str_plain_max;
extern PyObject *const_str_plain___exit__;
extern PyObject *const_tuple_str_plain_value_tuple;
extern PyObject *const_str_angle_listcontraction;
static PyObject *const_str_plain_parent_objs;
extern PyObject *const_str_plain_private_fields;
extern PyObject *const_str_plain__base_manager;
extern PyObject *const_str_plain_any;
extern PyObject *const_str_plain_parents;
extern PyObject *const_str_plain_concrete;
extern PyObject *const_str_plain_link;
static PyObject *const_str_digest_52c67151f8dbe568410e1068fb45d022;
extern PyObject *const_str_plain_items;
extern PyObject *const_str_plain_update_batch;
static PyObject *const_str_plain_add_field_update;
extern PyObject *const_str_digest_dd38da9eafc032377ee2d8f2b673b5a7;
extern PyObject *const_str_plain_one_to_one;
extern PyObject *const_str_plain_instance;
static PyObject *const_tuple_str_plain_obj_str_plain_new_objs_str_plain_ptr_tuple;
extern PyObject *const_str_plain_get_fields;
static PyObject *const_tuple_2f728e8154faf8f9a35da488ffb9ba18_tuple;
static PyObject *const_str_digest_8d75dab84a5137dd7de48ade8741da90;
static PyObject *const_tuple_str_plain_self_str_plain_related_str_plain_objs_tuple;
extern PyObject *const_str_plain_filter;
extern PyObject *const_str_plain___enter__;
extern PyObject *const_str_plain_callable;
extern PyObject *const_str_plain_remote_field;
extern PyObject *const_str_plain_using;
extern PyObject *const_str_plain_opts;
extern PyObject *const_str_plain_from_field;
extern PyObject *const_tuple_none_none_none_tuple;
static PyObject *const_tuple_05ad8e05a42a7262bd53e2f658d60011_tuple;
extern PyObject *const_str_plain___doc__;
static PyObject *const_str_digest_23b8da73b6bb6e424df48db928e9ddf2;
extern PyObject *const_str_plain_models;
extern PyObject *const_str_plain_reverse;
static PyObject *const_str_plain_batches;
static PyObject *const_str_plain_sorted_models;
static PyObject *const_str_plain_get_del_batches;
extern PyObject *const_str_plain_features;
extern PyObject *const_str_plain_pk;
extern PyObject *const_str_plain_data;
extern PyObject *const_str_plain___package__;
extern PyObject *const_str_plain_add;
static PyObject *const_str_plain_sub_objs;
extern PyObject *const_str_angle_genexpr;
static PyObject *const_str_plain_instances_with_model;
extern PyObject *const_str_plain_label;
static PyObject *const_str_digest_e1d442fac25913f8e85f0c8374277763;
static PyObject *const_str_digest_01cd8491ff6ab307c2be3f0c42c6482c;
static PyObject *const_tuple_cd1c91c7b40fb9524f3f24851725d436_tuple;
static PyObject *const_str_digest_10c7762372a358852f82c6bd65871a4c;
extern PyObject *const_str_plain___qualname__;
static PyObject *const_tuple_22a60571b3d8400b5767a08572c9afe7_tuple;
extern PyObject *const_str_plain_null;
extern PyObject *const_str_plain_savepoint;
extern PyObject *const_str_plain_ptr;
static PyObject *const_str_plain_can_defer_constraint_checks;
extern PyObject *const_str_plain__raw_delete;
extern PyObject *const_str_digest_b9c4baf879ebd882d40843df3a4dead7;
extern PyObject *const_str_plain_DeleteQuery;
extern PyObject *const_str_plain_transaction;
extern PyObject *const_str_plain_six;
extern PyObject *const_str_plain_value;
extern PyObject *const_str_plain_SET;
extern PyObject *const_str_plain_iteritems;
extern PyObject *const_str_plain_collections;
static PyObject *const_dict_6ee1bcc71367e6ed460b6341b211ffaf;
extern PyObject *const_str_plain_query;
static PyObject *const_str_digest_2e9b1c68970bea3034a67c68850448ee;
static PyObject *const_tuple_c525b06aa9c477c413e5bde33d97264c_tuple;
extern PyObject *const_str_plain_related;
extern PyObject *const_tuple_str_plain_attrgetter_tuple;
static PyObject *const_str_plain_protected_objects;
extern PyObject *const_str_digest_76151557ac4cfbca827b761e50d5fea2;
static PyObject *const_str_digest_dd6799b77c88d585189f8ae05cc08949;
static PyObject *const_str_plain_reverse_dependency;
static PyObject *const_tuple_8c6792f275435852ce7543be949b9dfc_tuple;
extern PyObject *const_tuple_str_plain_Counter_str_plain_OrderedDict_tuple;
extern PyObject *const_tuple_empty;
static PyObject *const_str_digest_4f0b04eb363db51d0f7d8ba74d06c571;
extern PyObject *const_str_plain_keep_parents;
extern PyObject *const_str_digest_467c9722f19d9d40d148689532cdc0b1;
extern PyObject *const_str_plain_append;
extern PyObject *const_str_plain_DO_NOTHING;
static PyObject *const_str_plain_concrete_models;
extern PyObject *const_str_plain___loader__;
static PyObject *const_str_plain_bulk_related_objects;
extern PyObject *const_str_plain_name;
extern PyObject *const_str_plain_attrgetter;
extern PyObject *const_str_plain_get_default;
static PyObject *const_tuple_9e7f64d727c5e25e70ef7551ec15e21b_tuple;
static PyObject *const_str_digest_2e2a525b1b4e0c41a738de210e98b08d;
extern PyObject *const_str_plain_send;
static PyObject *const_tuple_str_plain_value_str_plain_set_on_delete_tuple;
extern PyObject *const_str_plain_concrete_model;
static PyObject *const_str_plain_can_fast_delete;
extern PyObject *const_str_plain_attname;
extern PyObject *const_str_plain_on_delete;
static PyObject *const_tuple_str_plain_obj_str_plain_instances_tuple;
extern PyObject *const_str_plain_UpdateQuery;
extern PyObject *const_str_plain_auto_created;
static PyObject *const_str_digest_9cb311616f5ee2b71697f34f3227f4c5;
static PyObject *const_str_digest_6a27259f36dfe26eb63bbecfd7d103bc;
extern PyObject *const_str_plain_ModuleSpec;
extern PyObject *const_tuple_str_plain_opts_tuple;
extern PyObject *const_str_plain_objs;
static PyObject *const_str_digest_e393693c8d3429bd871c35d225c2632a;
extern PyObject *const_str_plain_found;
extern PyObject *const_str_plain_f;
extern PyObject *const_str_plain_IntegrityError;
extern PyObject *const_str_plain_sql;
extern PyObject *const_str_plain_bulk_batch_size;
extern PyObject *const_str_plain_post_delete;
extern PyObject *const_str_plain_count;
extern PyObject *const_str_plain_ops;
extern PyObject *const_tuple_str_plain_self_str_plain_using_tuple;
extern PyObject *const_str_plain_related_name;
extern PyObject *const_int_0;
extern PyObject *const_str_plain_atomic;
static PyObject *const_str_digest_6b5e14ab7f9b2cf9216c0b090d2dc992;
extern PyObject *const_str_plain_PROTECT;
extern PyObject *const_str_plain_msg;
static PyObject *const_str_plain_instances_for_fieldvalues;
extern PyObject *const_str_digest_d716329e951eca08639438a76ba8d694;
extern PyObject *const_str_digest_3a59af3086b40e635cf46a918dad8363;
extern PyObject *const_str_plain_SET_NULL;
extern PyObject *const_str_plain_OrderedDict;
extern PyObject *const_str_plain_connections;
extern PyObject *const_str_plain_m2m_changed;
extern PyObject *const_str_plain_SET_DEFAULT;
static PyObject *const_str_digest_e21eecfbf3e2cc513aaf495b8aa3812a;
extern PyObject *const_str_plain_setdefault;
extern PyObject *const_str_plain_ProtectedError;
extern PyObject *const_str_angle_lambda;
static PyObject *const_str_digest_67f0e3ff968d7b1cfe7a777af84ab064;
static PyObject *const_str_digest_66754303e0f93f94f34e2f2d323f4919;
extern PyObject *const_str_plain_new_objs;
extern PyObject *const_str_plain_batch;
extern PyObject *const_str_plain___cached__;
extern PyObject *const_str_plain_one_to_many;
extern PyObject *const_str_plain_Counter;
extern PyObject *const_str_plain___class__;
static PyObject *const_tuple_none_false_true_none_false_false_tuple;
extern PyObject *const_str_plain_nullable;
extern PyObject *const_tuple_none_tuple;
static PyObject *const_tuple_c5fd794b0ca7c77367526e24e77a6971_tuple;
extern PyObject *const_str_plain_related_objects;
static PyObject *const_str_digest_2892d778c404230192a65706efdb587e;
extern PyObject *const_str_plain_pk_list;
extern PyObject *const_str_plain___module__;
extern PyObject *const_tuple_type_object_tuple;
extern PyObject *const_str_plain_source;
extern PyObject *const_str_plain_difference;
extern PyObject *const_str_plain_dependencies;
static PyObject *const_str_plain_deleted_counter;
static PyObject *const_tuple_str_plain_i_str_plain_objs_str_plain_conn_batch_size_tuple;
extern PyObject *const_str_plain_update;
extern PyObject *const_int_pos_1;
extern PyObject *const_str_plain_values;
extern PyObject *const_str_plain_delete_batch;
extern PyObject *const_str_plain_include_hidden;
extern PyObject *const_tuple_str_digest_b9c4baf879ebd882d40843df3a4dead7_str_plain_f_tuple;
static PyObject *const_str_plain_conn_batch_size;
extern PyObject *const_str_plain_qs;
static PyObject *const_tuple_2cca156038e30b830d0424f03ca4f923_tuple;
extern PyObject *const_str_plain_field;
extern PyObject *const_str_plain_key;
static PyObject *const_tuple_b4f040e1fde1d4345997cb995090de97_tuple;
extern PyObject *const_str_plain___prepare__;
extern PyObject *const_str_plain___init__;
extern PyObject *const_str_plain_signals;
extern PyObject *const_str_plain_itervalues;
extern PyObject *const_str_plain_self;
static PyObject *const_str_digest_326cfea7fac86133f31d954412935b81;
static PyObject *const_str_digest_299987120dd75516a372f40806f51910;
static PyObject *const_str_plain_field_updates;
static PyObject *const_str_plain_get_candidate_relations_to_delete;
extern PyObject *const_tuple_str_plain_six_tuple;
static PyObject *const_str_digest_936f3643509ceeb465bd0e37fbfc266f;
static PyObject *const_str_digest_c881c9d0889ca7c54ae2f5e14c9867eb;
extern PyObject *const_str_plain_instances;
extern PyObject *const_str_plain_operator;
extern PyObject *const_str_plain_get;
extern PyObject *const_str_plain_collect;
static PyObject *const_tuple_c64f9b32d0195b9422056e3844b028c9_tuple;
extern PyObject *const_str_plain_sort;
extern PyObject *const_str_plain_delete;
extern PyObject *const_str_plain_has_listeners;
extern PyObject *const_str_plain_obj;
static PyObject *const_str_plain_set_on_delete;
extern PyObject *const_str_plain_pre_delete;
static PyObject *const_tuple_str_plain_signals_str_plain_sql_tuple;
extern PyObject *const_str_plain_Collector;
static PyObject *const_str_plain_collect_related;
extern PyObject *const_str_plain_model;
static PyObject *const_tuple_a4bf1ff87ed44cbea3554ae9e6800659_tuple;
static PyObject *module_filename_obj;
static bool constants_created = false;
static void createModuleConstants( void )
{
const_str_digest_85cd31bd2bdae1f31ac2d01dbdfcece0 = UNSTREAM_STRING( &constant_bin[ 881129 ], 17, 0 );
const_str_digest_5f5d2c1b0e46dd2d1920137e41b63ca4 = UNSTREAM_STRING( &constant_bin[ 881146 ], 23, 0 );
const_str_digest_ee0f69070b25f713a9c5066608df3f60 = UNSTREAM_STRING( &constant_bin[ 881169 ], 33, 0 );
const_tuple_92a654805d556220df81829d2d67bdd3_tuple = PyTuple_New( 4 );
PyTuple_SET_ITEM( const_tuple_92a654805d556220df81829d2d67bdd3_tuple, 0, const_str_plain_collector ); Py_INCREF( const_str_plain_collector );
PyTuple_SET_ITEM( const_tuple_92a654805d556220df81829d2d67bdd3_tuple, 1, const_str_plain_field ); Py_INCREF( const_str_plain_field );
const_str_plain_sub_objs = UNSTREAM_STRING( &constant_bin[ 881202 ], 8, 1 );
PyTuple_SET_ITEM( const_tuple_92a654805d556220df81829d2d67bdd3_tuple, 2, const_str_plain_sub_objs ); Py_INCREF( const_str_plain_sub_objs );
PyTuple_SET_ITEM( const_tuple_92a654805d556220df81829d2d67bdd3_tuple, 3, const_str_plain_using ); Py_INCREF( const_str_plain_using );
const_str_plain_fast_deletes = UNSTREAM_STRING( &constant_bin[ 881210 ], 12, 1 );
const_tuple_2121a1e03240e6f8803ed7ddee9cba88_tuple = PyTuple_New( 3 );
PyTuple_SET_ITEM( const_tuple_2121a1e03240e6f8803ed7ddee9cba88_tuple, 0, const_str_plain_IntegrityError ); Py_INCREF( const_str_plain_IntegrityError );
PyTuple_SET_ITEM( const_tuple_2121a1e03240e6f8803ed7ddee9cba88_tuple, 1, const_str_plain_connections ); Py_INCREF( const_str_plain_connections );
PyTuple_SET_ITEM( const_tuple_2121a1e03240e6f8803ed7ddee9cba88_tuple, 2, const_str_plain_transaction ); Py_INCREF( const_str_plain_transaction );
const_str_plain_source_attr = UNSTREAM_STRING( &constant_bin[ 881222 ], 11, 1 );
const_str_digest_230446a2965d8c36febdb9fab47679c7 = UNSTREAM_STRING( &constant_bin[ 881233 ], 861, 0 );
const_str_plain_parent_objs = UNSTREAM_STRING( &constant_bin[ 882094 ], 11, 1 );
const_str_digest_52c67151f8dbe568410e1068fb45d022 = UNSTREAM_STRING( &constant_bin[ 882105 ], 25, 0 );
const_str_plain_add_field_update = UNSTREAM_STRING( &constant_bin[ 882130 ], 16, 1 );
const_tuple_str_plain_obj_str_plain_new_objs_str_plain_ptr_tuple = PyTuple_New( 3 );
PyTuple_SET_ITEM( const_tuple_str_plain_obj_str_plain_new_objs_str_plain_ptr_tuple, 0, const_str_plain_obj ); Py_INCREF( const_str_plain_obj );
PyTuple_SET_ITEM( const_tuple_str_plain_obj_str_plain_new_objs_str_plain_ptr_tuple, 1, const_str_plain_new_objs ); Py_INCREF( const_str_plain_new_objs );
PyTuple_SET_ITEM( const_tuple_str_plain_obj_str_plain_new_objs_str_plain_ptr_tuple, 2, const_str_plain_ptr ); Py_INCREF( const_str_plain_ptr );
const_tuple_2f728e8154faf8f9a35da488ffb9ba18_tuple = PyTuple_New( 7 );
PyTuple_SET_ITEM( const_tuple_2f728e8154faf8f9a35da488ffb9ba18_tuple, 0, const_str_plain_self ); Py_INCREF( const_str_plain_self );
const_str_plain_sorted_models = UNSTREAM_STRING( &constant_bin[ 882146 ], 13, 1 );
PyTuple_SET_ITEM( const_tuple_2f728e8154faf8f9a35da488ffb9ba18_tuple, 1, const_str_plain_sorted_models ); Py_INCREF( const_str_plain_sorted_models );
const_str_plain_concrete_models = UNSTREAM_STRING( &constant_bin[ 882159 ], 15, 1 );
PyTuple_SET_ITEM( const_tuple_2f728e8154faf8f9a35da488ffb9ba18_tuple, 2, const_str_plain_concrete_models ); Py_INCREF( const_str_plain_concrete_models );
PyTuple_SET_ITEM( const_tuple_2f728e8154faf8f9a35da488ffb9ba18_tuple, 3, const_str_plain_models ); Py_INCREF( const_str_plain_models );
PyTuple_SET_ITEM( const_tuple_2f728e8154faf8f9a35da488ffb9ba18_tuple, 4, const_str_plain_found ); Py_INCREF( const_str_plain_found );
PyTuple_SET_ITEM( const_tuple_2f728e8154faf8f9a35da488ffb9ba18_tuple, 5, const_str_plain_model ); Py_INCREF( const_str_plain_model );
PyTuple_SET_ITEM( const_tuple_2f728e8154faf8f9a35da488ffb9ba18_tuple, 6, const_str_plain_dependencies ); Py_INCREF( const_str_plain_dependencies );
const_str_digest_8d75dab84a5137dd7de48ade8741da90 = UNSTREAM_STRING( &constant_bin[ 882174 ], 94, 0 );
const_tuple_str_plain_self_str_plain_related_str_plain_objs_tuple = PyTuple_New( 3 );
PyTuple_SET_ITEM( const_tuple_str_plain_self_str_plain_related_str_plain_objs_tuple, 0, const_str_plain_self ); Py_INCREF( const_str_plain_self );
PyTuple_SET_ITEM( const_tuple_str_plain_self_str_plain_related_str_plain_objs_tuple, 1, const_str_plain_related ); Py_INCREF( const_str_plain_related );
PyTuple_SET_ITEM( const_tuple_str_plain_self_str_plain_related_str_plain_objs_tuple, 2, const_str_plain_objs ); Py_INCREF( const_str_plain_objs );
const_tuple_05ad8e05a42a7262bd53e2f658d60011_tuple = PyTuple_New( 19 );
PyTuple_SET_ITEM( const_tuple_05ad8e05a42a7262bd53e2f658d60011_tuple, 0, const_str_plain_self ); Py_INCREF( const_str_plain_self );
PyTuple_SET_ITEM( const_tuple_05ad8e05a42a7262bd53e2f658d60011_tuple, 1, const_str_plain_objs ); Py_INCREF( const_str_plain_objs );
PyTuple_SET_ITEM( const_tuple_05ad8e05a42a7262bd53e2f658d60011_tuple, 2, const_str_plain_source ); Py_INCREF( const_str_plain_source );
PyTuple_SET_ITEM( const_tuple_05ad8e05a42a7262bd53e2f658d60011_tuple, 3, const_str_plain_nullable ); Py_INCREF( const_str_plain_nullable );
const_str_plain_collect_related = UNSTREAM_STRING( &constant_bin[ 881439 ], 15, 1 );
PyTuple_SET_ITEM( const_tuple_05ad8e05a42a7262bd53e2f658d60011_tuple, 4, const_str_plain_collect_related ); Py_INCREF( const_str_plain_collect_related );
PyTuple_SET_ITEM( const_tuple_05ad8e05a42a7262bd53e2f658d60011_tuple, 5, const_str_plain_source_attr ); Py_INCREF( const_str_plain_source_attr );
const_str_plain_reverse_dependency = UNSTREAM_STRING( &constant_bin[ 881733 ], 18, 1 );
PyTuple_SET_ITEM( const_tuple_05ad8e05a42a7262bd53e2f658d60011_tuple, 6, const_str_plain_reverse_dependency ); Py_INCREF( const_str_plain_reverse_dependency );
PyTuple_SET_ITEM( const_tuple_05ad8e05a42a7262bd53e2f658d60011_tuple, 7, const_str_plain_keep_parents ); Py_INCREF( const_str_plain_keep_parents );
PyTuple_SET_ITEM( const_tuple_05ad8e05a42a7262bd53e2f658d60011_tuple, 8, const_str_plain_new_objs ); Py_INCREF( const_str_plain_new_objs );
PyTuple_SET_ITEM( const_tuple_05ad8e05a42a7262bd53e2f658d60011_tuple, 9, const_str_plain_model ); Py_INCREF( const_str_plain_model );
PyTuple_SET_ITEM( const_tuple_05ad8e05a42a7262bd53e2f658d60011_tuple, 10, const_str_plain_concrete_model ); Py_INCREF( const_str_plain_concrete_model );
PyTuple_SET_ITEM( const_tuple_05ad8e05a42a7262bd53e2f658d60011_tuple, 11, const_str_plain_ptr ); Py_INCREF( const_str_plain_ptr );
PyTuple_SET_ITEM( const_tuple_05ad8e05a42a7262bd53e2f658d60011_tuple, 12, const_str_plain_parent_objs ); Py_INCREF( const_str_plain_parent_objs );
PyTuple_SET_ITEM( const_tuple_05ad8e05a42a7262bd53e2f658d60011_tuple, 13, const_str_plain_parents ); Py_INCREF( const_str_plain_parents );
PyTuple_SET_ITEM( const_tuple_05ad8e05a42a7262bd53e2f658d60011_tuple, 14, const_str_plain_related ); Py_INCREF( const_str_plain_related );
PyTuple_SET_ITEM( const_tuple_05ad8e05a42a7262bd53e2f658d60011_tuple, 15, const_str_plain_field ); Py_INCREF( const_str_plain_field );
const_str_plain_batches = UNSTREAM_STRING( &constant_bin[ 882268 ], 7, 1 );
PyTuple_SET_ITEM( const_tuple_05ad8e05a42a7262bd53e2f658d60011_tuple, 16, const_str_plain_batches ); Py_INCREF( const_str_plain_batches );
PyTuple_SET_ITEM( const_tuple_05ad8e05a42a7262bd53e2f658d60011_tuple, 17, const_str_plain_batch ); Py_INCREF( const_str_plain_batch );
PyTuple_SET_ITEM( const_tuple_05ad8e05a42a7262bd53e2f658d60011_tuple, 18, const_str_plain_sub_objs ); Py_INCREF( const_str_plain_sub_objs );
const_str_digest_23b8da73b6bb6e424df48db928e9ddf2 = UNSTREAM_STRING( &constant_bin[ 882275 ], 111, 0 );
const_str_plain_get_del_batches = UNSTREAM_STRING( &constant_bin[ 882386 ], 15, 1 );
const_str_plain_instances_with_model = UNSTREAM_STRING( &constant_bin[ 882401 ], 20, 1 );
const_str_digest_e1d442fac25913f8e85f0c8374277763 = UNSTREAM_STRING( &constant_bin[ 882421 ], 313, 0 );
const_str_digest_01cd8491ff6ab307c2be3f0c42c6482c = UNSTREAM_STRING( &constant_bin[ 882734 ], 26, 0 );
const_tuple_cd1c91c7b40fb9524f3f24851725d436_tuple = PyTuple_New( 3 );
PyTuple_SET_ITEM( const_tuple_cd1c91c7b40fb9524f3f24851725d436_tuple, 0, const_str_digest_b9c4baf879ebd882d40843df3a4dead7 ); Py_INCREF( const_str_digest_b9c4baf879ebd882d40843df3a4dead7 );
PyTuple_SET_ITEM( const_tuple_cd1c91c7b40fb9524f3f24851725d436_tuple, 1, const_str_plain_link ); Py_INCREF( const_str_plain_link );
PyTuple_SET_ITEM( const_tuple_cd1c91c7b40fb9524f3f24851725d436_tuple, 2, const_str_plain_from_field ); Py_INCREF( const_str_plain_from_field );
const_str_digest_10c7762372a358852f82c6bd65871a4c = UNSTREAM_STRING( &constant_bin[ 882760 ], 138, 0 );
const_tuple_22a60571b3d8400b5767a08572c9afe7_tuple = PyTuple_New( 5 );
PyTuple_SET_ITEM( const_tuple_22a60571b3d8400b5767a08572c9afe7_tuple, 0, const_str_plain_self ); Py_INCREF( const_str_plain_self );
PyTuple_SET_ITEM( const_tuple_22a60571b3d8400b5767a08572c9afe7_tuple, 1, const_str_plain_field ); Py_INCREF( const_str_plain_field );
PyTuple_SET_ITEM( const_tuple_22a60571b3d8400b5767a08572c9afe7_tuple, 2, const_str_plain_value ); Py_INCREF( const_str_plain_value );
PyTuple_SET_ITEM( const_tuple_22a60571b3d8400b5767a08572c9afe7_tuple, 3, const_str_plain_objs ); Py_INCREF( const_str_plain_objs );
PyTuple_SET_ITEM( const_tuple_22a60571b3d8400b5767a08572c9afe7_tuple, 4, const_str_plain_model ); Py_INCREF( const_str_plain_model );
const_str_plain_can_defer_constraint_checks = UNSTREAM_STRING( &constant_bin[ 882898 ], 27, 1 );
const_dict_6ee1bcc71367e6ed460b6341b211ffaf = _PyDict_NewPresized( 1 );
PyDict_SetItem( const_dict_6ee1bcc71367e6ed460b6341b211ffaf, const_str_plain_include_hidden, Py_True );
assert( PyDict_Size( const_dict_6ee1bcc71367e6ed460b6341b211ffaf ) == 1 );
const_str_digest_2e9b1c68970bea3034a67c68850448ee = UNSTREAM_STRING( &constant_bin[ 882925 ], 25, 0 );
const_tuple_c525b06aa9c477c413e5bde33d97264c_tuple = PyTuple_New( 4 );
PyTuple_SET_ITEM( const_tuple_c525b06aa9c477c413e5bde33d97264c_tuple, 0, const_str_plain_self ); Py_INCREF( const_str_plain_self );
PyTuple_SET_ITEM( const_tuple_c525b06aa9c477c413e5bde33d97264c_tuple, 1, const_str_plain_objs ); Py_INCREF( const_str_plain_objs );
PyTuple_SET_ITEM( const_tuple_c525b06aa9c477c413e5bde33d97264c_tuple, 2, const_str_plain_field ); Py_INCREF( const_str_plain_field );
const_str_plain_conn_batch_size = UNSTREAM_STRING( &constant_bin[ 882950 ], 15, 1 );
PyTuple_SET_ITEM( const_tuple_c525b06aa9c477c413e5bde33d97264c_tuple, 3, const_str_plain_conn_batch_size ); Py_INCREF( const_str_plain_conn_batch_size );
const_str_plain_protected_objects = UNSTREAM_STRING( &constant_bin[ 882965 ], 17, 1 );
const_str_digest_dd6799b77c88d585189f8ae05cc08949 = UNSTREAM_STRING( &constant_bin[ 882982 ], 28, 0 );
const_tuple_8c6792f275435852ce7543be949b9dfc_tuple = PyTuple_New( 5 );
PyTuple_SET_ITEM( const_tuple_8c6792f275435852ce7543be949b9dfc_tuple, 0, const_str_plain_collector ); Py_INCREF( const_str_plain_collector );
PyTuple_SET_ITEM( const_tuple_8c6792f275435852ce7543be949b9dfc_tuple, 1, const_str_plain_field ); Py_INCREF( const_str_plain_field );
PyTuple_SET_ITEM( const_tuple_8c6792f275435852ce7543be949b9dfc_tuple, 2, const_str_plain_sub_objs ); Py_INCREF( const_str_plain_sub_objs );
PyTuple_SET_ITEM( const_tuple_8c6792f275435852ce7543be949b9dfc_tuple, 3, const_str_plain_using ); Py_INCREF( const_str_plain_using );
PyTuple_SET_ITEM( const_tuple_8c6792f275435852ce7543be949b9dfc_tuple, 4, const_str_plain_value ); Py_INCREF( const_str_plain_value );
const_str_digest_4f0b04eb363db51d0f7d8ba74d06c571 = UNSTREAM_STRING( &constant_bin[ 881169 ], 14, 0 );
const_str_plain_bulk_related_objects = UNSTREAM_STRING( &constant_bin[ 883010 ], 20, 1 );
const_tuple_9e7f64d727c5e25e70ef7551ec15e21b_tuple = PyTuple_New( 3 );
PyTuple_SET_ITEM( const_tuple_9e7f64d727c5e25e70ef7551ec15e21b_tuple, 0, const_str_digest_b9c4baf879ebd882d40843df3a4dead7 ); Py_INCREF( const_str_digest_b9c4baf879ebd882d40843df3a4dead7 );
PyTuple_SET_ITEM( const_tuple_9e7f64d727c5e25e70ef7551ec15e21b_tuple, 1, const_str_plain_model ); Py_INCREF( const_str_plain_model );
PyTuple_SET_ITEM( const_tuple_9e7f64d727c5e25e70ef7551ec15e21b_tuple, 2, const_str_plain_self ); Py_INCREF( const_str_plain_self );
const_str_digest_2e2a525b1b4e0c41a738de210e98b08d = UNSTREAM_STRING( &constant_bin[ 883030 ], 13, 0 );
const_tuple_str_plain_value_str_plain_set_on_delete_tuple = PyTuple_New( 2 );
PyTuple_SET_ITEM( const_tuple_str_plain_value_str_plain_set_on_delete_tuple, 0, const_str_plain_value ); Py_INCREF( const_str_plain_value );
const_str_plain_set_on_delete = UNSTREAM_STRING( &constant_bin[ 882747 ], 13, 1 );
PyTuple_SET_ITEM( const_tuple_str_plain_value_str_plain_set_on_delete_tuple, 1, const_str_plain_set_on_delete ); Py_INCREF( const_str_plain_set_on_delete );
const_str_plain_can_fast_delete = UNSTREAM_STRING( &constant_bin[ 882935 ], 15, 1 );
const_tuple_str_plain_obj_str_plain_instances_tuple = PyTuple_New( 2 );
PyTuple_SET_ITEM( const_tuple_str_plain_obj_str_plain_instances_tuple, 0, const_str_plain_obj ); Py_INCREF( const_str_plain_obj );
PyTuple_SET_ITEM( const_tuple_str_plain_obj_str_plain_instances_tuple, 1, const_str_plain_instances ); Py_INCREF( const_str_plain_instances );
const_str_digest_9cb311616f5ee2b71697f34f3227f4c5 = UNSTREAM_STRING( &constant_bin[ 883043 ], 20, 0 );
const_str_digest_6a27259f36dfe26eb63bbecfd7d103bc = UNSTREAM_STRING( &constant_bin[ 883063 ], 52, 0 );
const_str_digest_e393693c8d3429bd871c35d225c2632a = UNSTREAM_STRING( &constant_bin[ 883115 ], 85, 0 );
const_str_digest_6b5e14ab7f9b2cf9216c0b090d2dc992 = UNSTREAM_STRING( &constant_bin[ 883200 ], 25, 0 );
const_str_plain_instances_for_fieldvalues = UNSTREAM_STRING( &constant_bin[ 883225 ], 25, 1 );
const_str_digest_e21eecfbf3e2cc513aaf495b8aa3812a = UNSTREAM_STRING( &constant_bin[ 883250 ], 30, 0 );
const_str_digest_67f0e3ff968d7b1cfe7a777af84ab064 = UNSTREAM_STRING( &constant_bin[ 883280 ], 21, 0 );
const_str_digest_66754303e0f93f94f34e2f2d323f4919 = UNSTREAM_STRING( &constant_bin[ 883301 ], 34, 0 );
const_tuple_none_false_true_none_false_false_tuple = PyTuple_New( 6 );
PyTuple_SET_ITEM( const_tuple_none_false_true_none_false_false_tuple, 0, Py_None ); Py_INCREF( Py_None );
PyTuple_SET_ITEM( const_tuple_none_false_true_none_false_false_tuple, 1, Py_False ); Py_INCREF( Py_False );
PyTuple_SET_ITEM( const_tuple_none_false_true_none_false_false_tuple, 2, Py_True ); Py_INCREF( Py_True );
PyTuple_SET_ITEM( const_tuple_none_false_true_none_false_false_tuple, 3, Py_None ); Py_INCREF( Py_None );
PyTuple_SET_ITEM( const_tuple_none_false_true_none_false_false_tuple, 4, Py_False ); Py_INCREF( Py_False );
PyTuple_SET_ITEM( const_tuple_none_false_true_none_false_false_tuple, 5, Py_False ); Py_INCREF( Py_False );
const_tuple_c5fd794b0ca7c77367526e24e77a6971_tuple = PyTuple_New( 7 );
PyTuple_SET_ITEM( const_tuple_c5fd794b0ca7c77367526e24e77a6971_tuple, 0, const_str_plain_self ); Py_INCREF( const_str_plain_self );
PyTuple_SET_ITEM( const_tuple_c5fd794b0ca7c77367526e24e77a6971_tuple, 1, const_str_plain_objs ); Py_INCREF( const_str_plain_objs );
PyTuple_SET_ITEM( const_tuple_c5fd794b0ca7c77367526e24e77a6971_tuple, 2, const_str_plain_from_field ); Py_INCREF( const_str_plain_from_field );
PyTuple_SET_ITEM( const_tuple_c5fd794b0ca7c77367526e24e77a6971_tuple, 3, const_str_plain_model ); Py_INCREF( const_str_plain_model );
PyTuple_SET_ITEM( const_tuple_c5fd794b0ca7c77367526e24e77a6971_tuple, 4, const_str_plain_opts ); Py_INCREF( const_str_plain_opts );
PyTuple_SET_ITEM( const_tuple_c5fd794b0ca7c77367526e24e77a6971_tuple, 5, const_str_plain_related ); Py_INCREF( const_str_plain_related );
PyTuple_SET_ITEM( const_tuple_c5fd794b0ca7c77367526e24e77a6971_tuple, 6, const_str_plain_field ); Py_INCREF( const_str_plain_field );
const_str_digest_2892d778c404230192a65706efdb587e = UNSTREAM_STRING( &constant_bin[ 883335 ], 16, 0 );
const_str_plain_deleted_counter = UNSTREAM_STRING( &constant_bin[ 883351 ], 15, 1 );
const_tuple_str_plain_i_str_plain_objs_str_plain_conn_batch_size_tuple = PyTuple_New( 3 );
PyTuple_SET_ITEM( const_tuple_str_plain_i_str_plain_objs_str_plain_conn_batch_size_tuple, 0, const_str_plain_i ); Py_INCREF( const_str_plain_i );
PyTuple_SET_ITEM( const_tuple_str_plain_i_str_plain_objs_str_plain_conn_batch_size_tuple, 1, const_str_plain_objs ); Py_INCREF( const_str_plain_objs );
PyTuple_SET_ITEM( const_tuple_str_plain_i_str_plain_objs_str_plain_conn_batch_size_tuple, 2, const_str_plain_conn_batch_size ); Py_INCREF( const_str_plain_conn_batch_size );
const_tuple_2cca156038e30b830d0424f03ca4f923_tuple = PyTuple_New( 4 );
PyTuple_SET_ITEM( const_tuple_2cca156038e30b830d0424f03ca4f923_tuple, 0, const_str_plain_self ); Py_INCREF( const_str_plain_self );
PyTuple_SET_ITEM( const_tuple_2cca156038e30b830d0424f03ca4f923_tuple, 1, const_str_plain_msg ); Py_INCREF( const_str_plain_msg );
PyTuple_SET_ITEM( const_tuple_2cca156038e30b830d0424f03ca4f923_tuple, 2, const_str_plain_protected_objects ); Py_INCREF( const_str_plain_protected_objects );
PyTuple_SET_ITEM( const_tuple_2cca156038e30b830d0424f03ca4f923_tuple, 3, const_str_plain___class__ ); Py_INCREF( const_str_plain___class__ );
const_tuple_b4f040e1fde1d4345997cb995090de97_tuple = PyTuple_New( 9 );
PyTuple_SET_ITEM( const_tuple_b4f040e1fde1d4345997cb995090de97_tuple, 0, const_str_plain_self ); Py_INCREF( const_str_plain_self );
PyTuple_SET_ITEM( const_tuple_b4f040e1fde1d4345997cb995090de97_tuple, 1, const_str_plain_objs ); Py_INCREF( const_str_plain_objs );
PyTuple_SET_ITEM( const_tuple_b4f040e1fde1d4345997cb995090de97_tuple, 2, const_str_plain_source ); Py_INCREF( const_str_plain_source );
PyTuple_SET_ITEM( const_tuple_b4f040e1fde1d4345997cb995090de97_tuple, 3, const_str_plain_nullable ); Py_INCREF( const_str_plain_nullable );
PyTuple_SET_ITEM( const_tuple_b4f040e1fde1d4345997cb995090de97_tuple, 4, const_str_plain_reverse_dependency ); Py_INCREF( const_str_plain_reverse_dependency );
PyTuple_SET_ITEM( const_tuple_b4f040e1fde1d4345997cb995090de97_tuple, 5, const_str_plain_new_objs ); Py_INCREF( const_str_plain_new_objs );
PyTuple_SET_ITEM( const_tuple_b4f040e1fde1d4345997cb995090de97_tuple, 6, const_str_plain_model ); Py_INCREF( const_str_plain_model );
PyTuple_SET_ITEM( const_tuple_b4f040e1fde1d4345997cb995090de97_tuple, 7, const_str_plain_instances ); Py_INCREF( const_str_plain_instances );
PyTuple_SET_ITEM( const_tuple_b4f040e1fde1d4345997cb995090de97_tuple, 8, const_str_plain_obj ); Py_INCREF( const_str_plain_obj );
const_str_digest_326cfea7fac86133f31d954412935b81 = UNSTREAM_STRING( &constant_bin[ 883366 ], 44, 0 );
const_str_digest_299987120dd75516a372f40806f51910 = UNSTREAM_STRING( &constant_bin[ 883410 ], 26, 0 );
const_str_plain_field_updates = UNSTREAM_STRING( &constant_bin[ 882134 ], 13, 1 );
const_str_plain_get_candidate_relations_to_delete = UNSTREAM_STRING( &constant_bin[ 883063 ], 33, 1 );
const_str_digest_936f3643509ceeb465bd0e37fbfc266f = UNSTREAM_STRING( &constant_bin[ 883436 ], 18, 0 );
const_str_digest_c881c9d0889ca7c54ae2f5e14c9867eb = UNSTREAM_STRING( &constant_bin[ 883454 ], 448, 0 );
const_tuple_c64f9b32d0195b9422056e3844b028c9_tuple = PyTuple_New( 13 );
PyTuple_SET_ITEM( const_tuple_c64f9b32d0195b9422056e3844b028c9_tuple, 0, const_str_plain_self ); Py_INCREF( const_str_plain_self );
PyTuple_SET_ITEM( const_tuple_c64f9b32d0195b9422056e3844b028c9_tuple, 1, const_str_plain_model ); Py_INCREF( const_str_plain_model );
PyTuple_SET_ITEM( const_tuple_c64f9b32d0195b9422056e3844b028c9_tuple, 2, const_str_plain_instances ); Py_INCREF( const_str_plain_instances );
PyTuple_SET_ITEM( const_tuple_c64f9b32d0195b9422056e3844b028c9_tuple, 3, const_str_plain_deleted_counter ); Py_INCREF( const_str_plain_deleted_counter );
PyTuple_SET_ITEM( const_tuple_c64f9b32d0195b9422056e3844b028c9_tuple, 4, const_str_plain_obj ); Py_INCREF( const_str_plain_obj );
PyTuple_SET_ITEM( const_tuple_c64f9b32d0195b9422056e3844b028c9_tuple, 5, const_str_plain_qs ); Py_INCREF( const_str_plain_qs );
PyTuple_SET_ITEM( const_tuple_c64f9b32d0195b9422056e3844b028c9_tuple, 6, const_str_plain_count ); Py_INCREF( const_str_plain_count );
PyTuple_SET_ITEM( const_tuple_c64f9b32d0195b9422056e3844b028c9_tuple, 7, const_str_plain_instances_for_fieldvalues ); Py_INCREF( const_str_plain_instances_for_fieldvalues );
PyTuple_SET_ITEM( const_tuple_c64f9b32d0195b9422056e3844b028c9_tuple, 8, const_str_plain_query ); Py_INCREF( const_str_plain_query );
PyTuple_SET_ITEM( const_tuple_c64f9b32d0195b9422056e3844b028c9_tuple, 9, const_str_plain_field ); Py_INCREF( const_str_plain_field );
PyTuple_SET_ITEM( const_tuple_c64f9b32d0195b9422056e3844b028c9_tuple, 10, const_str_plain_value ); Py_INCREF( const_str_plain_value );
PyTuple_SET_ITEM( const_tuple_c64f9b32d0195b9422056e3844b028c9_tuple, 11, const_str_plain_pk_list ); Py_INCREF( const_str_plain_pk_list );
PyTuple_SET_ITEM( const_tuple_c64f9b32d0195b9422056e3844b028c9_tuple, 12, const_str_plain_instance ); Py_INCREF( const_str_plain_instance );
const_tuple_str_plain_signals_str_plain_sql_tuple = PyTuple_New( 2 );
PyTuple_SET_ITEM( const_tuple_str_plain_signals_str_plain_sql_tuple, 0, const_str_plain_signals ); Py_INCREF( const_str_plain_signals );
PyTuple_SET_ITEM( const_tuple_str_plain_signals_str_plain_sql_tuple, 1, const_str_plain_sql ); Py_INCREF( const_str_plain_sql );
const_tuple_a4bf1ff87ed44cbea3554ae9e6800659_tuple = PyTuple_New( 4 );
PyTuple_SET_ITEM( const_tuple_a4bf1ff87ed44cbea3554ae9e6800659_tuple, 0, const_str_plain_self ); Py_INCREF( const_str_plain_self );
PyTuple_SET_ITEM( const_tuple_a4bf1ff87ed44cbea3554ae9e6800659_tuple, 1, const_str_plain_model ); Py_INCREF( const_str_plain_model );
PyTuple_SET_ITEM( const_tuple_a4bf1ff87ed44cbea3554ae9e6800659_tuple, 2, const_str_plain_instances ); Py_INCREF( const_str_plain_instances );
PyTuple_SET_ITEM( const_tuple_a4bf1ff87ed44cbea3554ae9e6800659_tuple, 3, const_str_plain_obj ); Py_INCREF( const_str_plain_obj );
constants_created = true;
}
#ifndef __NUITKA_NO_ASSERT__
void checkModuleConstants_django$db$models$deletion( void )
{
// The module may not have been used at all.
if (constants_created == false) return;
}
#endif
// The module code objects.
static PyCodeObject *codeobj_a11e5ebad594f04b3297d4c72617dd62;
static PyCodeObject *codeobj_4b00f26fa23ce9cf84eb4ee268fff765;
static PyCodeObject *codeobj_ca681f1e72441112db196f9175e5fa01;
static PyCodeObject *codeobj_af9bcfcc848055391ca50c1e06838db9;
static PyCodeObject *codeobj_3c1bb6457a1f70db422aa5e68969fc61;
static PyCodeObject *codeobj_98425bf3c18878aa96d6f20a8d834c08;
static PyCodeObject *codeobj_564feb323b16cc532f21be0bd5a6c08f;
static PyCodeObject *codeobj_9f9f08f015e7aca9bdfd4554bcb4e2d4;
static PyCodeObject *codeobj_3373b6532797b8bba981ca5cb6bcd3ab;
static PyCodeObject *codeobj_fe5fd8468a25eeb05511be662f519940;
static PyCodeObject *codeobj_a6b2853858fd7876502e41f7330ad59d;
static PyCodeObject *codeobj_2da8fa3bec250901b606518977497807;
static PyCodeObject *codeobj_4c958942f740ab9933b111ab3c2bb6b8;
static PyCodeObject *codeobj_e15a0ab237ab5954be0dac3bc9648c0e;
static PyCodeObject *codeobj_5dcad26cc3b905ae41d0893ea74b9e28;
static PyCodeObject *codeobj_ab1bfafe331c310312d94db8b929ec6d;
static PyCodeObject *codeobj_04e7822706aae5b7e03c2d783b09c51b;
static PyCodeObject *codeobj_29bdba5324aae2c24553ff6d5c9f67bb;
static PyCodeObject *codeobj_c37c38be553a1b6c0f108c3733c05bf0;
static PyCodeObject *codeobj_a4ac5ac02c2c8757e9123cd37f196656;
static PyCodeObject *codeobj_a71d042c297bd0001c6b1b57573b0fc1;
static PyCodeObject *codeobj_54ec43c561ef94893d9bbef71a219f87;
static PyCodeObject *codeobj_1d84a1db58e155104a4304b25b805bc2;
static PyCodeObject *codeobj_6f3ca5631f310a307e49f023c6b223c1;
static PyCodeObject *codeobj_754aafcc5876f7f866cf01b2a209ba26;
static PyCodeObject *codeobj_fa0d05ef46f92604e6acafcaa709d060;
static PyCodeObject *codeobj_4bbbe6a77682e8d72ff63d99850f6a2e;
static PyCodeObject *codeobj_0b5cd91cb73546ecb3383c870bbbce8b;
static PyCodeObject *codeobj_3024af40360f1e53d055413e8dcd6901;
static void createModuleCodeObjects(void)
{
module_filename_obj = MAKE_RELATIVE_PATH( const_str_digest_dd6799b77c88d585189f8ae05cc08949 );
codeobj_a11e5ebad594f04b3297d4c72617dd62 = MAKE_CODEOBJ( module_filename_obj, const_str_angle_genexpr, 59, const_tuple_str_digest_b9c4baf879ebd882d40843df3a4dead7_str_plain_f_tuple, 1, 0, CO_GENERATOR | CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
codeobj_4b00f26fa23ce9cf84eb4ee268fff765 = MAKE_CODEOBJ( module_filename_obj, const_str_angle_genexpr, 143, const_tuple_cd1c91c7b40fb9524f3f24851725d436_tuple, 1, 0, CO_GENERATOR | CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
codeobj_ca681f1e72441112db196f9175e5fa01 = MAKE_CODEOBJ( module_filename_obj, const_str_angle_genexpr, 259, const_tuple_9e7f64d727c5e25e70ef7551ec15e21b_tuple, 1, 0, CO_GENERATOR | CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
codeobj_af9bcfcc848055391ca50c1e06838db9 = MAKE_CODEOBJ( module_filename_obj, const_str_angle_lambda, 39, const_tuple_str_plain_value_tuple, 0, 0, CO_OPTIMIZED | CO_NEWLOCALS );
codeobj_3c1bb6457a1f70db422aa5e68969fc61 = MAKE_CODEOBJ( module_filename_obj, const_str_angle_listcontraction, 163, const_tuple_str_plain_i_str_plain_objs_str_plain_conn_batch_size_tuple, 1, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
codeobj_98425bf3c18878aa96d6f20a8d834c08 = MAKE_CODEOBJ( module_filename_obj, const_str_angle_listcontraction, 203, const_tuple_str_plain_obj_str_plain_new_objs_str_plain_ptr_tuple, 1, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
codeobj_564feb323b16cc532f21be0bd5a6c08f = MAKE_CODEOBJ( module_filename_obj, const_str_angle_listcontraction, 291, const_tuple_str_plain_obj_str_plain_instances_tuple, 1, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
codeobj_9f9f08f015e7aca9bdfd4554bcb4e2d4 = MAKE_CODEOBJ( module_filename_obj, const_str_angle_listcontraction, 301, const_tuple_str_plain_obj_str_plain_instances_tuple, 1, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
codeobj_3373b6532797b8bba981ca5cb6bcd3ab = MAKE_CODEOBJ( module_filename_obj, const_str_digest_66754303e0f93f94f34e2f2d323f4919, 1, const_tuple_empty, 0, 0, CO_NOFREE );
codeobj_fe5fd8468a25eeb05511be662f519940 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_CASCADE, 15, const_tuple_92a654805d556220df81829d2d67bdd3_tuple, 4, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
codeobj_a6b2853858fd7876502e41f7330ad59d = MAKE_CODEOBJ( module_filename_obj, const_str_plain_DO_NOTHING, 51, const_tuple_92a654805d556220df81829d2d67bdd3_tuple, 4, 0, CO_NOFREE );
codeobj_2da8fa3bec250901b606518977497807 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_PROTECT, 22, const_tuple_92a654805d556220df81829d2d67bdd3_tuple, 4, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
codeobj_4c958942f740ab9933b111ab3c2bb6b8 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_SET, 32, const_tuple_str_plain_value_str_plain_set_on_delete_tuple, 1, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
codeobj_e15a0ab237ab5954be0dac3bc9648c0e = MAKE_CODEOBJ( module_filename_obj, const_str_plain_SET_DEFAULT, 47, const_tuple_92a654805d556220df81829d2d67bdd3_tuple, 4, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
codeobj_5dcad26cc3b905ae41d0893ea74b9e28 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_SET_NULL, 43, const_tuple_92a654805d556220df81829d2d67bdd3_tuple, 4, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
codeobj_ab1bfafe331c310312d94db8b929ec6d = MAKE_CODEOBJ( module_filename_obj, const_str_plain___init__, 10, const_tuple_2cca156038e30b830d0424f03ca4f923_tuple, 3, 0, CO_OPTIMIZED | CO_NEWLOCALS );
codeobj_04e7822706aae5b7e03c2d783b09c51b = MAKE_CODEOBJ( module_filename_obj, const_str_plain___init__, 65, const_tuple_str_plain_self_str_plain_using_tuple, 2, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
codeobj_29bdba5324aae2c24553ff6d5c9f67bb = MAKE_CODEOBJ( module_filename_obj, const_str_plain_add, 81, const_tuple_b4f040e1fde1d4345997cb995090de97_tuple, 5, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
codeobj_c37c38be553a1b6c0f108c3733c05bf0 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_add_field_update, 108, const_tuple_22a60571b3d8400b5767a08572c9afe7_tuple, 4, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
codeobj_a4ac5ac02c2c8757e9123cd37f196656 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_can_fast_delete, 120, const_tuple_c5fd794b0ca7c77367526e24e77a6971_tuple, 3, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
codeobj_a71d042c297bd0001c6b1b57573b0fc1 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_collect, 168, const_tuple_05ad8e05a42a7262bd53e2f658d60011_tuple, 8, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
codeobj_54ec43c561ef94893d9bbef71a219f87 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_delete, 262, const_tuple_c64f9b32d0195b9422056e3844b028c9_tuple, 1, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
codeobj_1d84a1db58e155104a4304b25b805bc2 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_get_candidate_relations_to_delete, 55, const_tuple_str_plain_opts_tuple, 1, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
codeobj_6f3ca5631f310a307e49f023c6b223c1 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_get_del_batches, 156, const_tuple_c525b06aa9c477c413e5bde33d97264c_tuple, 3, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
codeobj_754aafcc5876f7f866cf01b2a209ba26 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_instances_with_model, 238, const_tuple_a4bf1ff87ed44cbea3554ae9e6800659_tuple, 1, 0, CO_GENERATOR | CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
codeobj_fa0d05ef46f92604e6acafcaa709d060 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_related_objects, 230, const_tuple_str_plain_self_str_plain_related_str_plain_objs_tuple, 3, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
codeobj_4bbbe6a77682e8d72ff63d99850f6a2e = MAKE_CODEOBJ( module_filename_obj, const_str_plain_set_on_delete, 34, const_tuple_8c6792f275435852ce7543be949b9dfc_tuple, 4, 0, CO_OPTIMIZED | CO_NEWLOCALS );
codeobj_0b5cd91cb73546ecb3383c870bbbce8b = MAKE_CODEOBJ( module_filename_obj, const_str_plain_set_on_delete, 37, const_tuple_8c6792f275435852ce7543be949b9dfc_tuple, 4, 0, CO_OPTIMIZED | CO_NEWLOCALS );
codeobj_3024af40360f1e53d055413e8dcd6901 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_sort, 243, const_tuple_2f728e8154faf8f9a35da488ffb9ba18_tuple, 1, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
}
// The module function declarations.
#if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
static PyObject *django$db$models$deletion$$$function_8_get_candidate_relations_to_delete$$$genexpr_1_genexpr_context( struct Nuitka_GeneratorObject *generator, PyObject *yield_return_value );
#else
static void django$db$models$deletion$$$function_8_get_candidate_relations_to_delete$$$genexpr_1_genexpr_context( struct Nuitka_GeneratorObject *generator );
#endif
#if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
static PyObject *django$db$models$deletion$$$function_12_can_fast_delete$$$genexpr_1_genexpr_context( struct Nuitka_GeneratorObject *generator, PyObject *yield_return_value );
#else
static void django$db$models$deletion$$$function_12_can_fast_delete$$$genexpr_1_genexpr_context( struct Nuitka_GeneratorObject *generator );
#endif
#if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
static PyObject *django$db$models$deletion$$$function_16_instances_with_model$$$genobj_1_instances_with_model_context( struct Nuitka_GeneratorObject *generator, PyObject *yield_return_value );
#else
static void django$db$models$deletion$$$function_16_instances_with_model$$$genobj_1_instances_with_model_context( struct Nuitka_GeneratorObject *generator );
#endif
#if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
static PyObject *django$db$models$deletion$$$function_17_sort$$$genexpr_1_genexpr_context( struct Nuitka_GeneratorObject *generator, PyObject *yield_return_value );
#else
static void django$db$models$deletion$$$function_17_sort$$$genexpr_1_genexpr_context( struct Nuitka_GeneratorObject *generator );
#endif
NUITKA_CROSS_MODULE PyObject *impl___internal__$$$function_8_complex_call_helper_star_dict( PyObject **python_pars );
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_10_add( PyObject *defaults );
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_11_add_field_update( );
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_12_can_fast_delete( PyObject *defaults );
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_13_get_del_batches( );
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_14_collect( PyObject *defaults );
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_15_related_objects( );
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_16_instances_with_model( );
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_17_sort( );
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_18_delete( );
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_1___init__( );
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_2_CASCADE( );
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_3_PROTECT( );
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_4_SET( );
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_4_SET$$$function_1_set_on_delete( struct Nuitka_CellObject *closure_value );
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_4_SET$$$function_2_set_on_delete( struct Nuitka_CellObject *closure_value );
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_4_SET$$$function_3_lambda( struct Nuitka_CellObject *closure_value );
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_5_SET_NULL( );
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_6_SET_DEFAULT( );
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_7_DO_NOTHING( );
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_8_get_candidate_relations_to_delete( );
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_9___init__( );
// The module function definitions.
static PyObject *impl_django$db$models$deletion$$$function_1___init__( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
{
// Preserve error status for checks
#ifndef __NUITKA_NO_ASSERT__
NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
#endif
// Local variable declarations.
PyObject *par_self = python_pars[ 0 ];
PyObject *par_msg = python_pars[ 1 ];
PyObject *par_protected_objects = python_pars[ 2 ];
PyObject *exception_type = NULL;
PyObject *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
PyObject *tmp_args_element_name_1;
PyObject *tmp_args_element_name_2;
PyObject *tmp_assattr_name_1;
PyObject *tmp_assattr_target_1;
PyObject *tmp_called_name_1;
PyObject *tmp_object_name_1;
bool tmp_result;
PyObject *tmp_return_value;
PyObject *tmp_source_name_1;
PyObject *tmp_type_name_1;
NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
static struct Nuitka_FrameObject *cache_frame_ab1bfafe331c310312d94db8b929ec6d = NULL;
struct Nuitka_FrameObject *frame_ab1bfafe331c310312d94db8b929ec6d;
NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
tmp_return_value = NULL;
// Actual function code.
// Tried code:
MAKE_OR_REUSE_FRAME( cache_frame_ab1bfafe331c310312d94db8b929ec6d, codeobj_ab1bfafe331c310312d94db8b929ec6d, module_django$db$models$deletion, sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *) );
frame_ab1bfafe331c310312d94db8b929ec6d = cache_frame_ab1bfafe331c310312d94db8b929ec6d;
// Push the new frame as the currently active one.
pushFrameStack( frame_ab1bfafe331c310312d94db8b929ec6d );
// Mark the frame object as in use, ref count 1 will be up for reuse.
assert( Py_REFCNT( frame_ab1bfafe331c310312d94db8b929ec6d ) == 2 ); // Frame stack
// Framed code:
tmp_assattr_name_1 = par_protected_objects;
CHECK_OBJECT( tmp_assattr_name_1 );
tmp_assattr_target_1 = par_self;
CHECK_OBJECT( tmp_assattr_target_1 );
tmp_result = SET_ATTRIBUTE( tmp_assattr_target_1, const_str_plain_protected_objects, tmp_assattr_name_1 );
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 11;
type_description_1 = "oooN";
goto frame_exception_exit_1;
}
tmp_type_name_1 = GET_STRING_DICT_VALUE( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_ProtectedError );
if (unlikely( tmp_type_name_1 == NULL ))
{
tmp_type_name_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_ProtectedError );
}
if ( tmp_type_name_1 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "ProtectedError" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 12;
type_description_1 = "oooN";
goto frame_exception_exit_1;
}
tmp_object_name_1 = par_self;
if ( tmp_object_name_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 12;
type_description_1 = "oooN";
goto frame_exception_exit_1;
}
tmp_source_name_1 = BUILTIN_SUPER( tmp_type_name_1, tmp_object_name_1 );
if ( tmp_source_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 12;
type_description_1 = "oooN";
goto frame_exception_exit_1;
}
tmp_called_name_1 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain___init__ );
Py_DECREF( tmp_source_name_1 );
if ( tmp_called_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 12;
type_description_1 = "oooN";
goto frame_exception_exit_1;
}
tmp_args_element_name_1 = par_msg;
if ( tmp_args_element_name_1 == NULL )
{
Py_DECREF( tmp_called_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "msg" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 12;
type_description_1 = "oooN";
goto frame_exception_exit_1;
}
tmp_args_element_name_2 = par_protected_objects;
if ( tmp_args_element_name_2 == NULL )
{
Py_DECREF( tmp_called_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "protected_objects" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 12;
type_description_1 = "oooN";
goto frame_exception_exit_1;
}
frame_ab1bfafe331c310312d94db8b929ec6d->m_frame.f_lineno = 12;
{
PyObject *call_args[] = { tmp_args_element_name_1, tmp_args_element_name_2 };
tmp_unused = CALL_FUNCTION_WITH_ARGS2( tmp_called_name_1, call_args );
}
Py_DECREF( tmp_called_name_1 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 12;
type_description_1 = "oooN";
goto frame_exception_exit_1;
}
Py_DECREF( tmp_unused );
#if 0
RESTORE_FRAME_EXCEPTION( frame_ab1bfafe331c310312d94db8b929ec6d );
#endif
// Put the previous frame back on top.
popFrameStack();
goto frame_no_exception_1;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_ab1bfafe331c310312d94db8b929ec6d );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( frame_ab1bfafe331c310312d94db8b929ec6d, exception_lineno );
}
else if ( exception_tb->tb_frame != &frame_ab1bfafe331c310312d94db8b929ec6d->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, frame_ab1bfafe331c310312d94db8b929ec6d, exception_lineno );
}
// Attachs locals to frame if any.
Nuitka_Frame_AttachLocals(
(struct Nuitka_FrameObject *)frame_ab1bfafe331c310312d94db8b929ec6d,
type_description_1,
par_self,
par_msg,
par_protected_objects,
NULL
);
// Release cached frame.
if ( frame_ab1bfafe331c310312d94db8b929ec6d == cache_frame_ab1bfafe331c310312d94db8b929ec6d )
{
Py_DECREF( frame_ab1bfafe331c310312d94db8b929ec6d );
}
cache_frame_ab1bfafe331c310312d94db8b929ec6d = NULL;
assertFrameObject( frame_ab1bfafe331c310312d94db8b929ec6d );
// Put the previous frame back on top.
popFrameStack();
// Return the error.
goto try_except_handler_1;
frame_no_exception_1:;
tmp_return_value = Py_None;
Py_INCREF( tmp_return_value );
goto try_return_handler_1;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_1___init__ );
return NULL;
// Return handler code:
try_return_handler_1:;
Py_XDECREF( par_self );
par_self = NULL;
Py_XDECREF( par_msg );
par_msg = NULL;
Py_XDECREF( par_protected_objects );
par_protected_objects = NULL;
goto function_return_exit;
// Exception handler code:
try_except_handler_1:;
exception_keeper_type_1 = exception_type;
exception_keeper_value_1 = exception_value;
exception_keeper_tb_1 = exception_tb;
exception_keeper_lineno_1 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( par_self );
par_self = NULL;
Py_XDECREF( par_msg );
par_msg = NULL;
Py_XDECREF( par_protected_objects );
par_protected_objects = NULL;
// Re-raise.
exception_type = exception_keeper_type_1;
exception_value = exception_keeper_value_1;
exception_tb = exception_keeper_tb_1;
exception_lineno = exception_keeper_lineno_1;
goto function_exception_exit;
// End of try:
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_1___init__ );
return NULL;
function_exception_exit:
assert( exception_type );
RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
return NULL;
function_return_exit:
CHECK_OBJECT( tmp_return_value );
assert( had_error || !ERROR_OCCURRED() );
return tmp_return_value;
}
static PyObject *impl_django$db$models$deletion$$$function_2_CASCADE( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
{
// Preserve error status for checks
#ifndef __NUITKA_NO_ASSERT__
NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
#endif
// Local variable declarations.
PyObject *par_collector = python_pars[ 0 ];
PyObject *par_field = python_pars[ 1 ];
PyObject *par_sub_objs = python_pars[ 2 ];
PyObject *par_using = python_pars[ 3 ];
PyObject *exception_type = NULL;
PyObject *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
int tmp_and_left_truth_1;
PyObject *tmp_and_left_value_1;
PyObject *tmp_and_right_value_1;
PyObject *tmp_args_element_name_1;
PyObject *tmp_args_element_name_2;
PyObject *tmp_args_element_name_3;
PyObject *tmp_args_name_1;
PyObject *tmp_called_name_1;
PyObject *tmp_called_name_2;
int tmp_cond_truth_1;
PyObject *tmp_cond_value_1;
PyObject *tmp_dict_key_1;
PyObject *tmp_dict_key_2;
PyObject *tmp_dict_key_3;
PyObject *tmp_dict_value_1;
PyObject *tmp_dict_value_2;
PyObject *tmp_dict_value_3;
PyObject *tmp_kw_name_1;
PyObject *tmp_operand_name_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;
PyObject *tmp_source_name_6;
PyObject *tmp_source_name_7;
PyObject *tmp_source_name_8;
PyObject *tmp_source_name_9;
PyObject *tmp_subscribed_name_1;
PyObject *tmp_subscript_name_1;
PyObject *tmp_tuple_element_1;
NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
static struct Nuitka_FrameObject *cache_frame_fe5fd8468a25eeb05511be662f519940 = NULL;
struct Nuitka_FrameObject *frame_fe5fd8468a25eeb05511be662f519940;
NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
tmp_return_value = NULL;
// Actual function code.
// Tried code:
MAKE_OR_REUSE_FRAME( cache_frame_fe5fd8468a25eeb05511be662f519940, codeobj_fe5fd8468a25eeb05511be662f519940, module_django$db$models$deletion, sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *) );
frame_fe5fd8468a25eeb05511be662f519940 = cache_frame_fe5fd8468a25eeb05511be662f519940;
// Push the new frame as the currently active one.
pushFrameStack( frame_fe5fd8468a25eeb05511be662f519940 );
// Mark the frame object as in use, ref count 1 will be up for reuse.
assert( Py_REFCNT( frame_fe5fd8468a25eeb05511be662f519940 ) == 2 ); // Frame stack
// Framed code:
tmp_source_name_1 = par_collector;
CHECK_OBJECT( tmp_source_name_1 );
tmp_called_name_1 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_collect );
if ( tmp_called_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 16;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_args_name_1 = PyTuple_New( 1 );
tmp_tuple_element_1 = par_sub_objs;
if ( tmp_tuple_element_1 == NULL )
{
Py_DECREF( tmp_called_name_1 );
Py_DECREF( tmp_args_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "sub_objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 16;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
Py_INCREF( tmp_tuple_element_1 );
PyTuple_SET_ITEM( tmp_args_name_1, 0, tmp_tuple_element_1 );
tmp_kw_name_1 = _PyDict_NewPresized( 3 );
tmp_dict_key_1 = const_str_plain_source;
tmp_source_name_3 = par_field;
if ( tmp_source_name_3 == NULL )
{
Py_DECREF( tmp_called_name_1 );
Py_DECREF( tmp_args_name_1 );
Py_DECREF( tmp_kw_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "field" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 16;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_source_name_2 = LOOKUP_ATTRIBUTE( tmp_source_name_3, const_str_plain_remote_field );
if ( tmp_source_name_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_1 );
Py_DECREF( tmp_args_name_1 );
Py_DECREF( tmp_kw_name_1 );
exception_lineno = 16;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_dict_value_1 = LOOKUP_ATTRIBUTE( tmp_source_name_2, const_str_plain_model );
Py_DECREF( tmp_source_name_2 );
if ( tmp_dict_value_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_1 );
Py_DECREF( tmp_args_name_1 );
Py_DECREF( tmp_kw_name_1 );
exception_lineno = 16;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_res = PyDict_SetItem( tmp_kw_name_1, tmp_dict_key_1, tmp_dict_value_1 );
Py_DECREF( tmp_dict_value_1 );
assert( !(tmp_res != 0) );
tmp_dict_key_2 = const_str_plain_source_attr;
tmp_source_name_4 = par_field;
if ( tmp_source_name_4 == NULL )
{
Py_DECREF( tmp_called_name_1 );
Py_DECREF( tmp_args_name_1 );
Py_DECREF( tmp_kw_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "field" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 17;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_dict_value_2 = LOOKUP_ATTRIBUTE( tmp_source_name_4, const_str_plain_name );
if ( tmp_dict_value_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_1 );
Py_DECREF( tmp_args_name_1 );
Py_DECREF( tmp_kw_name_1 );
exception_lineno = 17;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_res = PyDict_SetItem( tmp_kw_name_1, tmp_dict_key_2, tmp_dict_value_2 );
Py_DECREF( tmp_dict_value_2 );
assert( !(tmp_res != 0) );
tmp_dict_key_3 = const_str_plain_nullable;
tmp_source_name_5 = par_field;
if ( tmp_source_name_5 == NULL )
{
Py_DECREF( tmp_called_name_1 );
Py_DECREF( tmp_args_name_1 );
Py_DECREF( tmp_kw_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "field" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 17;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_dict_value_3 = LOOKUP_ATTRIBUTE( tmp_source_name_5, const_str_plain_null );
if ( tmp_dict_value_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_1 );
Py_DECREF( tmp_args_name_1 );
Py_DECREF( tmp_kw_name_1 );
exception_lineno = 17;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_res = PyDict_SetItem( tmp_kw_name_1, tmp_dict_key_3, tmp_dict_value_3 );
Py_DECREF( tmp_dict_value_3 );
assert( !(tmp_res != 0) );
frame_fe5fd8468a25eeb05511be662f519940->m_frame.f_lineno = 16;
tmp_unused = CALL_FUNCTION( tmp_called_name_1, tmp_args_name_1, tmp_kw_name_1 );
Py_DECREF( tmp_called_name_1 );
Py_DECREF( tmp_args_name_1 );
Py_DECREF( tmp_kw_name_1 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 16;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
Py_DECREF( tmp_unused );
tmp_source_name_6 = par_field;
if ( tmp_source_name_6 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "field" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 18;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_and_left_value_1 = LOOKUP_ATTRIBUTE( tmp_source_name_6, const_str_plain_null );
if ( tmp_and_left_value_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 18;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_and_left_truth_1 = CHECK_IF_TRUE( tmp_and_left_value_1 );
if ( tmp_and_left_truth_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_and_left_value_1 );
exception_lineno = 18;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
if ( tmp_and_left_truth_1 == 1 )
{
goto and_right_1;
}
else
{
goto and_left_1;
}
and_right_1:;
Py_DECREF( tmp_and_left_value_1 );
tmp_subscribed_name_1 = GET_STRING_DICT_VALUE( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_connections );
if (unlikely( tmp_subscribed_name_1 == NULL ))
{
tmp_subscribed_name_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_connections );
}
if ( tmp_subscribed_name_1 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "connections" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 18;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_subscript_name_1 = par_using;
if ( tmp_subscript_name_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "using" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 18;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_source_name_8 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_1, tmp_subscript_name_1 );
if ( tmp_source_name_8 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 18;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_source_name_7 = LOOKUP_ATTRIBUTE( tmp_source_name_8, const_str_plain_features );
Py_DECREF( tmp_source_name_8 );
if ( tmp_source_name_7 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 18;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_operand_name_1 = LOOKUP_ATTRIBUTE( tmp_source_name_7, const_str_plain_can_defer_constraint_checks );
Py_DECREF( tmp_source_name_7 );
if ( tmp_operand_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 18;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_and_right_value_1 = UNARY_OPERATION( UNARY_NOT, tmp_operand_name_1 );
Py_DECREF( tmp_operand_name_1 );
if ( tmp_and_right_value_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 18;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
Py_INCREF( tmp_and_right_value_1 );
tmp_cond_value_1 = tmp_and_right_value_1;
goto and_end_1;
and_left_1:;
tmp_cond_value_1 = tmp_and_left_value_1;
and_end_1:;
tmp_cond_truth_1 = CHECK_IF_TRUE( tmp_cond_value_1 );
if ( tmp_cond_truth_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_cond_value_1 );
exception_lineno = 18;
type_description_1 = "oooo";
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_9 = par_collector;
if ( tmp_source_name_9 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "collector" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 19;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_called_name_2 = LOOKUP_ATTRIBUTE( tmp_source_name_9, const_str_plain_add_field_update );
if ( tmp_called_name_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 19;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_args_element_name_1 = par_field;
if ( tmp_args_element_name_1 == NULL )
{
Py_DECREF( tmp_called_name_2 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "field" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 19;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_args_element_name_2 = Py_None;
tmp_args_element_name_3 = par_sub_objs;
if ( tmp_args_element_name_3 == NULL )
{
Py_DECREF( tmp_called_name_2 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "sub_objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 19;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
frame_fe5fd8468a25eeb05511be662f519940->m_frame.f_lineno = 19;
{
PyObject *call_args[] = { tmp_args_element_name_1, tmp_args_element_name_2, tmp_args_element_name_3 };
tmp_unused = CALL_FUNCTION_WITH_ARGS3( tmp_called_name_2, call_args );
}
Py_DECREF( tmp_called_name_2 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 19;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
Py_DECREF( tmp_unused );
branch_no_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_fe5fd8468a25eeb05511be662f519940 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto frame_no_exception_1;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_fe5fd8468a25eeb05511be662f519940 );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( frame_fe5fd8468a25eeb05511be662f519940, exception_lineno );
}
else if ( exception_tb->tb_frame != &frame_fe5fd8468a25eeb05511be662f519940->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, frame_fe5fd8468a25eeb05511be662f519940, exception_lineno );
}
// Attachs locals to frame if any.
Nuitka_Frame_AttachLocals(
(struct Nuitka_FrameObject *)frame_fe5fd8468a25eeb05511be662f519940,
type_description_1,
par_collector,
par_field,
par_sub_objs,
par_using
);
// Release cached frame.
if ( frame_fe5fd8468a25eeb05511be662f519940 == cache_frame_fe5fd8468a25eeb05511be662f519940 )
{
Py_DECREF( frame_fe5fd8468a25eeb05511be662f519940 );
}
cache_frame_fe5fd8468a25eeb05511be662f519940 = NULL;
assertFrameObject( frame_fe5fd8468a25eeb05511be662f519940 );
// Put the previous frame back on top.
popFrameStack();
// Return the error.
goto try_except_handler_1;
frame_no_exception_1:;
tmp_return_value = Py_None;
Py_INCREF( tmp_return_value );
goto try_return_handler_1;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_2_CASCADE );
return NULL;
// Return handler code:
try_return_handler_1:;
Py_XDECREF( par_collector );
par_collector = NULL;
Py_XDECREF( par_field );
par_field = NULL;
Py_XDECREF( par_sub_objs );
par_sub_objs = NULL;
Py_XDECREF( par_using );
par_using = NULL;
goto function_return_exit;
// Exception handler code:
try_except_handler_1:;
exception_keeper_type_1 = exception_type;
exception_keeper_value_1 = exception_value;
exception_keeper_tb_1 = exception_tb;
exception_keeper_lineno_1 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( par_collector );
par_collector = NULL;
Py_XDECREF( par_field );
par_field = NULL;
Py_XDECREF( par_sub_objs );
par_sub_objs = NULL;
Py_XDECREF( par_using );
par_using = NULL;
// Re-raise.
exception_type = exception_keeper_type_1;
exception_value = exception_keeper_value_1;
exception_tb = exception_keeper_tb_1;
exception_lineno = exception_keeper_lineno_1;
goto function_exception_exit;
// End of try:
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_2_CASCADE );
return NULL;
function_exception_exit:
assert( exception_type );
RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
return NULL;
function_return_exit:
CHECK_OBJECT( tmp_return_value );
assert( had_error || !ERROR_OCCURRED() );
return tmp_return_value;
}
static PyObject *impl_django$db$models$deletion$$$function_3_PROTECT( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
{
// Preserve error status for checks
#ifndef __NUITKA_NO_ASSERT__
NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
#endif
// Local variable declarations.
PyObject *par_collector = python_pars[ 0 ];
PyObject *par_field = python_pars[ 1 ];
PyObject *par_sub_objs = python_pars[ 2 ];
PyObject *par_using = python_pars[ 3 ];
PyObject *exception_type = NULL;
PyObject *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
PyObject *tmp_args_element_name_1;
PyObject *tmp_args_element_name_2;
PyObject *tmp_called_name_1;
PyObject *tmp_left_name_1;
PyObject *tmp_raise_type_1;
PyObject *tmp_right_name_1;
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_source_name_6;
PyObject *tmp_subscribed_name_1;
PyObject *tmp_subscript_name_1;
PyObject *tmp_tuple_element_1;
static struct Nuitka_FrameObject *cache_frame_2da8fa3bec250901b606518977497807 = NULL;
struct Nuitka_FrameObject *frame_2da8fa3bec250901b606518977497807;
NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
// Actual function code.
// Tried code:
MAKE_OR_REUSE_FRAME( cache_frame_2da8fa3bec250901b606518977497807, codeobj_2da8fa3bec250901b606518977497807, module_django$db$models$deletion, sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *) );
frame_2da8fa3bec250901b606518977497807 = cache_frame_2da8fa3bec250901b606518977497807;
// Push the new frame as the currently active one.
pushFrameStack( frame_2da8fa3bec250901b606518977497807 );
// Mark the frame object as in use, ref count 1 will be up for reuse.
assert( Py_REFCNT( frame_2da8fa3bec250901b606518977497807 ) == 2 ); // Frame stack
// Framed code:
tmp_called_name_1 = GET_STRING_DICT_VALUE( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_ProtectedError );
if (unlikely( tmp_called_name_1 == NULL ))
{
tmp_called_name_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_ProtectedError );
}
if ( tmp_called_name_1 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "ProtectedError" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 23;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_left_name_1 = const_str_digest_23b8da73b6bb6e424df48db928e9ddf2;
tmp_right_name_1 = PyTuple_New( 3 );
tmp_source_name_3 = par_field;
CHECK_OBJECT( tmp_source_name_3 );
tmp_source_name_2 = LOOKUP_ATTRIBUTE( tmp_source_name_3, const_str_plain_remote_field );
if ( tmp_source_name_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_right_name_1 );
exception_lineno = 26;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_source_name_1 = LOOKUP_ATTRIBUTE( tmp_source_name_2, const_str_plain_model );
Py_DECREF( tmp_source_name_2 );
if ( tmp_source_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_right_name_1 );
exception_lineno = 26;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_tuple_element_1 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain___name__ );
Py_DECREF( tmp_source_name_1 );
if ( tmp_tuple_element_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_right_name_1 );
exception_lineno = 26;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
PyTuple_SET_ITEM( tmp_right_name_1, 0, tmp_tuple_element_1 );
tmp_subscribed_name_1 = par_sub_objs;
if ( tmp_subscribed_name_1 == NULL )
{
Py_DECREF( tmp_right_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "sub_objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 26;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_subscript_name_1 = const_int_0;
tmp_source_name_5 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_1, tmp_subscript_name_1 );
if ( tmp_source_name_5 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_right_name_1 );
exception_lineno = 26;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_source_name_4 = LOOKUP_ATTRIBUTE_CLASS_SLOT( tmp_source_name_5 );
Py_DECREF( tmp_source_name_5 );
if ( tmp_source_name_4 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_right_name_1 );
exception_lineno = 26;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_tuple_element_1 = LOOKUP_ATTRIBUTE( tmp_source_name_4, const_str_plain___name__ );
Py_DECREF( tmp_source_name_4 );
if ( tmp_tuple_element_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_right_name_1 );
exception_lineno = 26;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
PyTuple_SET_ITEM( tmp_right_name_1, 1, tmp_tuple_element_1 );
tmp_source_name_6 = par_field;
if ( tmp_source_name_6 == NULL )
{
Py_DECREF( tmp_right_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "field" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 26;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_tuple_element_1 = LOOKUP_ATTRIBUTE( tmp_source_name_6, const_str_plain_name );
if ( tmp_tuple_element_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_right_name_1 );
exception_lineno = 26;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
PyTuple_SET_ITEM( tmp_right_name_1, 2, tmp_tuple_element_1 );
tmp_args_element_name_1 = BINARY_OPERATION_REMAINDER( tmp_left_name_1, tmp_right_name_1 );
Py_DECREF( tmp_right_name_1 );
if ( tmp_args_element_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 24;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_args_element_name_2 = par_sub_objs;
if ( tmp_args_element_name_2 == NULL )
{
Py_DECREF( tmp_args_element_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "sub_objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 28;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
frame_2da8fa3bec250901b606518977497807->m_frame.f_lineno = 23;
{
PyObject *call_args[] = { tmp_args_element_name_1, tmp_args_element_name_2 };
tmp_raise_type_1 = CALL_FUNCTION_WITH_ARGS2( tmp_called_name_1, call_args );
}
Py_DECREF( tmp_args_element_name_1 );
if ( tmp_raise_type_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 23;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
exception_type = tmp_raise_type_1;
exception_lineno = 23;
RAISE_EXCEPTION_WITH_TYPE( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooo";
goto frame_exception_exit_1;
#if 0
RESTORE_FRAME_EXCEPTION( frame_2da8fa3bec250901b606518977497807 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto frame_no_exception_1;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_2da8fa3bec250901b606518977497807 );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( frame_2da8fa3bec250901b606518977497807, exception_lineno );
}
else if ( exception_tb->tb_frame != &frame_2da8fa3bec250901b606518977497807->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, frame_2da8fa3bec250901b606518977497807, exception_lineno );
}
// Attachs locals to frame if any.
Nuitka_Frame_AttachLocals(
(struct Nuitka_FrameObject *)frame_2da8fa3bec250901b606518977497807,
type_description_1,
par_collector,
par_field,
par_sub_objs,
par_using
);
// Release cached frame.
if ( frame_2da8fa3bec250901b606518977497807 == cache_frame_2da8fa3bec250901b606518977497807 )
{
Py_DECREF( frame_2da8fa3bec250901b606518977497807 );
}
cache_frame_2da8fa3bec250901b606518977497807 = NULL;
assertFrameObject( frame_2da8fa3bec250901b606518977497807 );
// Put the previous frame back on top.
popFrameStack();
// Return the error.
goto try_except_handler_1;
frame_no_exception_1:;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_3_PROTECT );
return NULL;
// Exception handler code:
try_except_handler_1:;
exception_keeper_type_1 = exception_type;
exception_keeper_value_1 = exception_value;
exception_keeper_tb_1 = exception_tb;
exception_keeper_lineno_1 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( par_collector );
par_collector = NULL;
Py_XDECREF( par_field );
par_field = NULL;
Py_XDECREF( par_sub_objs );
par_sub_objs = NULL;
Py_XDECREF( par_using );
par_using = NULL;
// Re-raise.
exception_type = exception_keeper_type_1;
exception_value = exception_keeper_value_1;
exception_tb = exception_keeper_tb_1;
exception_lineno = exception_keeper_lineno_1;
goto function_exception_exit;
// End of try:
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_3_PROTECT );
return NULL;
function_exception_exit:
assert( exception_type );
RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
return NULL;
}
static PyObject *impl_django$db$models$deletion$$$function_4_SET( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
{
// Preserve error status for checks
#ifndef __NUITKA_NO_ASSERT__
NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
#endif
// Local variable declarations.
struct Nuitka_CellObject *par_value = PyCell_NEW1( python_pars[ 0 ] );
PyObject *var_set_on_delete = NULL;
PyObject *exception_type = NULL;
PyObject *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
PyObject *tmp_args_element_name_1;
PyObject *tmp_assattr_name_1;
PyObject *tmp_assattr_target_1;
PyObject *tmp_assign_source_1;
PyObject *tmp_assign_source_2;
PyObject *tmp_called_name_1;
int tmp_cond_truth_1;
PyObject *tmp_cond_value_1;
bool tmp_result;
PyObject *tmp_return_value;
static struct Nuitka_FrameObject *cache_frame_4c958942f740ab9933b111ab3c2bb6b8 = NULL;
struct Nuitka_FrameObject *frame_4c958942f740ab9933b111ab3c2bb6b8;
NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
tmp_return_value = NULL;
// Actual function code.
// Tried code:
MAKE_OR_REUSE_FRAME( cache_frame_4c958942f740ab9933b111ab3c2bb6b8, codeobj_4c958942f740ab9933b111ab3c2bb6b8, module_django$db$models$deletion, sizeof(void *)+sizeof(void *) );
frame_4c958942f740ab9933b111ab3c2bb6b8 = cache_frame_4c958942f740ab9933b111ab3c2bb6b8;
// Push the new frame as the currently active one.
pushFrameStack( frame_4c958942f740ab9933b111ab3c2bb6b8 );
// Mark the frame object as in use, ref count 1 will be up for reuse.
assert( Py_REFCNT( frame_4c958942f740ab9933b111ab3c2bb6b8 ) == 2 ); // Frame stack
// Framed code:
tmp_called_name_1 = LOOKUP_BUILTIN( const_str_plain_callable );
assert( tmp_called_name_1 != NULL );
if ( par_value == NULL )
{
tmp_args_element_name_1 = NULL;
}
else
{
tmp_args_element_name_1 = PyCell_GET( par_value );
}
if ( tmp_args_element_name_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "value" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 33;
type_description_1 = "co";
goto frame_exception_exit_1;
}
frame_4c958942f740ab9933b111ab3c2bb6b8->m_frame.f_lineno = 33;
{
PyObject *call_args[] = { tmp_args_element_name_1 };
tmp_cond_value_1 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_1, call_args );
}
if ( tmp_cond_value_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 33;
type_description_1 = "co";
goto frame_exception_exit_1;
}
tmp_cond_truth_1 = CHECK_IF_TRUE( tmp_cond_value_1 );
if ( tmp_cond_truth_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_cond_value_1 );
exception_lineno = 33;
type_description_1 = "co";
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_assign_source_1 = MAKE_FUNCTION_django$db$models$deletion$$$function_4_SET$$$function_1_set_on_delete( par_value );
assert( var_set_on_delete == NULL );
var_set_on_delete = tmp_assign_source_1;
goto branch_end_1;
branch_no_1:;
tmp_assign_source_2 = MAKE_FUNCTION_django$db$models$deletion$$$function_4_SET$$$function_2_set_on_delete( par_value );
assert( var_set_on_delete == NULL );
var_set_on_delete = tmp_assign_source_2;
branch_end_1:;
tmp_assattr_name_1 = MAKE_FUNCTION_django$db$models$deletion$$$function_4_SET$$$function_3_lambda( par_value );
tmp_assattr_target_1 = var_set_on_delete;
CHECK_OBJECT( tmp_assattr_target_1 );
tmp_result = SET_ATTRIBUTE( tmp_assattr_target_1, const_str_plain_deconstruct, tmp_assattr_name_1 );
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_assattr_name_1 );
exception_lineno = 39;
type_description_1 = "co";
goto frame_exception_exit_1;
}
Py_DECREF( tmp_assattr_name_1 );
tmp_return_value = var_set_on_delete;
if ( tmp_return_value == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "set_on_delete" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 40;
type_description_1 = "co";
goto frame_exception_exit_1;
}
Py_INCREF( tmp_return_value );
goto frame_return_exit_1;
#if 0
RESTORE_FRAME_EXCEPTION( frame_4c958942f740ab9933b111ab3c2bb6b8 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto frame_no_exception_1;
frame_return_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_4c958942f740ab9933b111ab3c2bb6b8 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto try_return_handler_1;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_4c958942f740ab9933b111ab3c2bb6b8 );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( frame_4c958942f740ab9933b111ab3c2bb6b8, exception_lineno );
}
else if ( exception_tb->tb_frame != &frame_4c958942f740ab9933b111ab3c2bb6b8->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, frame_4c958942f740ab9933b111ab3c2bb6b8, exception_lineno );
}
// Attachs locals to frame if any.
Nuitka_Frame_AttachLocals(
(struct Nuitka_FrameObject *)frame_4c958942f740ab9933b111ab3c2bb6b8,
type_description_1,
par_value,
var_set_on_delete
);
// Release cached frame.
if ( frame_4c958942f740ab9933b111ab3c2bb6b8 == cache_frame_4c958942f740ab9933b111ab3c2bb6b8 )
{
Py_DECREF( frame_4c958942f740ab9933b111ab3c2bb6b8 );
}
cache_frame_4c958942f740ab9933b111ab3c2bb6b8 = NULL;
assertFrameObject( frame_4c958942f740ab9933b111ab3c2bb6b8 );
// Put the previous frame back on top.
popFrameStack();
// Return the error.
goto try_except_handler_1;
frame_no_exception_1:;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_4_SET );
return NULL;
// Return handler code:
try_return_handler_1:;
CHECK_OBJECT( (PyObject *)par_value );
Py_DECREF( par_value );
par_value = NULL;
Py_XDECREF( var_set_on_delete );
var_set_on_delete = NULL;
goto function_return_exit;
// Exception handler code:
try_except_handler_1:;
exception_keeper_type_1 = exception_type;
exception_keeper_value_1 = exception_value;
exception_keeper_tb_1 = exception_tb;
exception_keeper_lineno_1 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
CHECK_OBJECT( (PyObject *)par_value );
Py_DECREF( par_value );
par_value = NULL;
Py_XDECREF( var_set_on_delete );
var_set_on_delete = NULL;
// Re-raise.
exception_type = exception_keeper_type_1;
exception_value = exception_keeper_value_1;
exception_tb = exception_keeper_tb_1;
exception_lineno = exception_keeper_lineno_1;
goto function_exception_exit;
// End of try:
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_4_SET );
return NULL;
function_exception_exit:
assert( exception_type );
RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
return NULL;
function_return_exit:
CHECK_OBJECT( tmp_return_value );
assert( had_error || !ERROR_OCCURRED() );
return tmp_return_value;
}
static PyObject *impl_django$db$models$deletion$$$function_4_SET$$$function_1_set_on_delete( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
{
// Preserve error status for checks
#ifndef __NUITKA_NO_ASSERT__
NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
#endif
// Local variable declarations.
PyObject *par_collector = python_pars[ 0 ];
PyObject *par_field = python_pars[ 1 ];
PyObject *par_sub_objs = python_pars[ 2 ];
PyObject *par_using = python_pars[ 3 ];
PyObject *exception_type = NULL;
PyObject *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
PyObject *tmp_args_element_name_1;
PyObject *tmp_args_element_name_2;
PyObject *tmp_args_element_name_3;
PyObject *tmp_called_name_1;
PyObject *tmp_called_name_2;
PyObject *tmp_return_value;
PyObject *tmp_source_name_1;
NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
static struct Nuitka_FrameObject *cache_frame_4bbbe6a77682e8d72ff63d99850f6a2e = NULL;
struct Nuitka_FrameObject *frame_4bbbe6a77682e8d72ff63d99850f6a2e;
NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
tmp_return_value = NULL;
// Actual function code.
// Tried code:
MAKE_OR_REUSE_FRAME( cache_frame_4bbbe6a77682e8d72ff63d99850f6a2e, codeobj_4bbbe6a77682e8d72ff63d99850f6a2e, module_django$db$models$deletion, sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *) );
frame_4bbbe6a77682e8d72ff63d99850f6a2e = cache_frame_4bbbe6a77682e8d72ff63d99850f6a2e;
// Push the new frame as the currently active one.
pushFrameStack( frame_4bbbe6a77682e8d72ff63d99850f6a2e );
// Mark the frame object as in use, ref count 1 will be up for reuse.
assert( Py_REFCNT( frame_4bbbe6a77682e8d72ff63d99850f6a2e ) == 2 ); // Frame stack
// Framed code:
tmp_source_name_1 = par_collector;
CHECK_OBJECT( tmp_source_name_1 );
tmp_called_name_1 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_add_field_update );
if ( tmp_called_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 35;
type_description_1 = "ooooc";
goto frame_exception_exit_1;
}
tmp_args_element_name_1 = par_field;
if ( tmp_args_element_name_1 == NULL )
{
Py_DECREF( tmp_called_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "field" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 35;
type_description_1 = "ooooc";
goto frame_exception_exit_1;
}
if ( self->m_closure[0] == NULL )
{
tmp_called_name_2 = NULL;
}
else
{
tmp_called_name_2 = PyCell_GET( self->m_closure[0] );
}
if ( tmp_called_name_2 == NULL )
{
Py_DECREF( tmp_called_name_1 );
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "free variable '%s' referenced before assignment in enclosing scope", "value" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 35;
type_description_1 = "ooooc";
goto frame_exception_exit_1;
}
frame_4bbbe6a77682e8d72ff63d99850f6a2e->m_frame.f_lineno = 35;
tmp_args_element_name_2 = CALL_FUNCTION_NO_ARGS( tmp_called_name_2 );
if ( tmp_args_element_name_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_1 );
exception_lineno = 35;
type_description_1 = "ooooc";
goto frame_exception_exit_1;
}
tmp_args_element_name_3 = par_sub_objs;
if ( tmp_args_element_name_3 == NULL )
{
Py_DECREF( tmp_called_name_1 );
Py_DECREF( tmp_args_element_name_2 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "sub_objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 35;
type_description_1 = "ooooc";
goto frame_exception_exit_1;
}
frame_4bbbe6a77682e8d72ff63d99850f6a2e->m_frame.f_lineno = 35;
{
PyObject *call_args[] = { tmp_args_element_name_1, tmp_args_element_name_2, tmp_args_element_name_3 };
tmp_unused = CALL_FUNCTION_WITH_ARGS3( tmp_called_name_1, call_args );
}
Py_DECREF( tmp_called_name_1 );
Py_DECREF( tmp_args_element_name_2 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 35;
type_description_1 = "ooooc";
goto frame_exception_exit_1;
}
Py_DECREF( tmp_unused );
#if 0
RESTORE_FRAME_EXCEPTION( frame_4bbbe6a77682e8d72ff63d99850f6a2e );
#endif
// Put the previous frame back on top.
popFrameStack();
goto frame_no_exception_1;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_4bbbe6a77682e8d72ff63d99850f6a2e );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( frame_4bbbe6a77682e8d72ff63d99850f6a2e, exception_lineno );
}
else if ( exception_tb->tb_frame != &frame_4bbbe6a77682e8d72ff63d99850f6a2e->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, frame_4bbbe6a77682e8d72ff63d99850f6a2e, exception_lineno );
}
// Attachs locals to frame if any.
Nuitka_Frame_AttachLocals(
(struct Nuitka_FrameObject *)frame_4bbbe6a77682e8d72ff63d99850f6a2e,
type_description_1,
par_collector,
par_field,
par_sub_objs,
par_using,
self->m_closure[0]
);
// Release cached frame.
if ( frame_4bbbe6a77682e8d72ff63d99850f6a2e == cache_frame_4bbbe6a77682e8d72ff63d99850f6a2e )
{
Py_DECREF( frame_4bbbe6a77682e8d72ff63d99850f6a2e );
}
cache_frame_4bbbe6a77682e8d72ff63d99850f6a2e = NULL;
assertFrameObject( frame_4bbbe6a77682e8d72ff63d99850f6a2e );
// Put the previous frame back on top.
popFrameStack();
// Return the error.
goto try_except_handler_1;
frame_no_exception_1:;
tmp_return_value = Py_None;
Py_INCREF( tmp_return_value );
goto try_return_handler_1;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_4_SET$$$function_1_set_on_delete );
return NULL;
// Return handler code:
try_return_handler_1:;
Py_XDECREF( par_collector );
par_collector = NULL;
Py_XDECREF( par_field );
par_field = NULL;
Py_XDECREF( par_sub_objs );
par_sub_objs = NULL;
Py_XDECREF( par_using );
par_using = NULL;
goto function_return_exit;
// Exception handler code:
try_except_handler_1:;
exception_keeper_type_1 = exception_type;
exception_keeper_value_1 = exception_value;
exception_keeper_tb_1 = exception_tb;
exception_keeper_lineno_1 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( par_collector );
par_collector = NULL;
Py_XDECREF( par_field );
par_field = NULL;
Py_XDECREF( par_sub_objs );
par_sub_objs = NULL;
Py_XDECREF( par_using );
par_using = NULL;
// Re-raise.
exception_type = exception_keeper_type_1;
exception_value = exception_keeper_value_1;
exception_tb = exception_keeper_tb_1;
exception_lineno = exception_keeper_lineno_1;
goto function_exception_exit;
// End of try:
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_4_SET$$$function_1_set_on_delete );
return NULL;
function_exception_exit:
assert( exception_type );
RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
return NULL;
function_return_exit:
CHECK_OBJECT( tmp_return_value );
assert( had_error || !ERROR_OCCURRED() );
return tmp_return_value;
}
static PyObject *impl_django$db$models$deletion$$$function_4_SET$$$function_2_set_on_delete( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
{
// Preserve error status for checks
#ifndef __NUITKA_NO_ASSERT__
NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
#endif
// Local variable declarations.
PyObject *par_collector = python_pars[ 0 ];
PyObject *par_field = python_pars[ 1 ];
PyObject *par_sub_objs = python_pars[ 2 ];
PyObject *par_using = python_pars[ 3 ];
PyObject *exception_type = NULL;
PyObject *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
PyObject *tmp_args_element_name_1;
PyObject *tmp_args_element_name_2;
PyObject *tmp_args_element_name_3;
PyObject *tmp_called_name_1;
PyObject *tmp_return_value;
PyObject *tmp_source_name_1;
NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
static struct Nuitka_FrameObject *cache_frame_0b5cd91cb73546ecb3383c870bbbce8b = NULL;
struct Nuitka_FrameObject *frame_0b5cd91cb73546ecb3383c870bbbce8b;
NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
tmp_return_value = NULL;
// Actual function code.
// Tried code:
MAKE_OR_REUSE_FRAME( cache_frame_0b5cd91cb73546ecb3383c870bbbce8b, codeobj_0b5cd91cb73546ecb3383c870bbbce8b, module_django$db$models$deletion, sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *) );
frame_0b5cd91cb73546ecb3383c870bbbce8b = cache_frame_0b5cd91cb73546ecb3383c870bbbce8b;
// Push the new frame as the currently active one.
pushFrameStack( frame_0b5cd91cb73546ecb3383c870bbbce8b );
// Mark the frame object as in use, ref count 1 will be up for reuse.
assert( Py_REFCNT( frame_0b5cd91cb73546ecb3383c870bbbce8b ) == 2 ); // Frame stack
// Framed code:
tmp_source_name_1 = par_collector;
CHECK_OBJECT( tmp_source_name_1 );
tmp_called_name_1 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_add_field_update );
if ( tmp_called_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 38;
type_description_1 = "ooooc";
goto frame_exception_exit_1;
}
tmp_args_element_name_1 = par_field;
if ( tmp_args_element_name_1 == NULL )
{
Py_DECREF( tmp_called_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "field" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 38;
type_description_1 = "ooooc";
goto frame_exception_exit_1;
}
if ( self->m_closure[0] == NULL )
{
tmp_args_element_name_2 = NULL;
}
else
{
tmp_args_element_name_2 = PyCell_GET( self->m_closure[0] );
}
if ( tmp_args_element_name_2 == NULL )
{
Py_DECREF( tmp_called_name_1 );
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "free variable '%s' referenced before assignment in enclosing scope", "value" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 38;
type_description_1 = "ooooc";
goto frame_exception_exit_1;
}
tmp_args_element_name_3 = par_sub_objs;
if ( tmp_args_element_name_3 == NULL )
{
Py_DECREF( tmp_called_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "sub_objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 38;
type_description_1 = "ooooc";
goto frame_exception_exit_1;
}
frame_0b5cd91cb73546ecb3383c870bbbce8b->m_frame.f_lineno = 38;
{
PyObject *call_args[] = { tmp_args_element_name_1, tmp_args_element_name_2, tmp_args_element_name_3 };
tmp_unused = CALL_FUNCTION_WITH_ARGS3( tmp_called_name_1, call_args );
}
Py_DECREF( tmp_called_name_1 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 38;
type_description_1 = "ooooc";
goto frame_exception_exit_1;
}
Py_DECREF( tmp_unused );
#if 0
RESTORE_FRAME_EXCEPTION( frame_0b5cd91cb73546ecb3383c870bbbce8b );
#endif
// Put the previous frame back on top.
popFrameStack();
goto frame_no_exception_1;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_0b5cd91cb73546ecb3383c870bbbce8b );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( frame_0b5cd91cb73546ecb3383c870bbbce8b, exception_lineno );
}
else if ( exception_tb->tb_frame != &frame_0b5cd91cb73546ecb3383c870bbbce8b->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, frame_0b5cd91cb73546ecb3383c870bbbce8b, exception_lineno );
}
// Attachs locals to frame if any.
Nuitka_Frame_AttachLocals(
(struct Nuitka_FrameObject *)frame_0b5cd91cb73546ecb3383c870bbbce8b,
type_description_1,
par_collector,
par_field,
par_sub_objs,
par_using,
self->m_closure[0]
);
// Release cached frame.
if ( frame_0b5cd91cb73546ecb3383c870bbbce8b == cache_frame_0b5cd91cb73546ecb3383c870bbbce8b )
{
Py_DECREF( frame_0b5cd91cb73546ecb3383c870bbbce8b );
}
cache_frame_0b5cd91cb73546ecb3383c870bbbce8b = NULL;
assertFrameObject( frame_0b5cd91cb73546ecb3383c870bbbce8b );
// Put the previous frame back on top.
popFrameStack();
// Return the error.
goto try_except_handler_1;
frame_no_exception_1:;
tmp_return_value = Py_None;
Py_INCREF( tmp_return_value );
goto try_return_handler_1;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_4_SET$$$function_2_set_on_delete );
return NULL;
// Return handler code:
try_return_handler_1:;
Py_XDECREF( par_collector );
par_collector = NULL;
Py_XDECREF( par_field );
par_field = NULL;
Py_XDECREF( par_sub_objs );
par_sub_objs = NULL;
Py_XDECREF( par_using );
par_using = NULL;
goto function_return_exit;
// Exception handler code:
try_except_handler_1:;
exception_keeper_type_1 = exception_type;
exception_keeper_value_1 = exception_value;
exception_keeper_tb_1 = exception_tb;
exception_keeper_lineno_1 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( par_collector );
par_collector = NULL;
Py_XDECREF( par_field );
par_field = NULL;
Py_XDECREF( par_sub_objs );
par_sub_objs = NULL;
Py_XDECREF( par_using );
par_using = NULL;
// Re-raise.
exception_type = exception_keeper_type_1;
exception_value = exception_keeper_value_1;
exception_tb = exception_keeper_tb_1;
exception_lineno = exception_keeper_lineno_1;
goto function_exception_exit;
// End of try:
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_4_SET$$$function_2_set_on_delete );
return NULL;
function_exception_exit:
assert( exception_type );
RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
return NULL;
function_return_exit:
CHECK_OBJECT( tmp_return_value );
assert( had_error || !ERROR_OCCURRED() );
return tmp_return_value;
}
static PyObject *impl_django$db$models$deletion$$$function_4_SET$$$function_3_lambda( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
{
// Preserve error status for checks
#ifndef __NUITKA_NO_ASSERT__
NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
#endif
// Local variable declarations.
PyObject *exception_type = NULL;
PyObject *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
PyObject *tmp_return_value;
PyObject *tmp_tuple_element_1;
PyObject *tmp_tuple_element_2;
static struct Nuitka_FrameObject *cache_frame_af9bcfcc848055391ca50c1e06838db9 = NULL;
struct Nuitka_FrameObject *frame_af9bcfcc848055391ca50c1e06838db9;
NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
tmp_return_value = NULL;
// Actual function code.
MAKE_OR_REUSE_FRAME( cache_frame_af9bcfcc848055391ca50c1e06838db9, codeobj_af9bcfcc848055391ca50c1e06838db9, module_django$db$models$deletion, sizeof(void *) );
frame_af9bcfcc848055391ca50c1e06838db9 = cache_frame_af9bcfcc848055391ca50c1e06838db9;
// Push the new frame as the currently active one.
pushFrameStack( frame_af9bcfcc848055391ca50c1e06838db9 );
// Mark the frame object as in use, ref count 1 will be up for reuse.
assert( Py_REFCNT( frame_af9bcfcc848055391ca50c1e06838db9 ) == 2 ); // Frame stack
// Framed code:
tmp_return_value = PyTuple_New( 3 );
tmp_tuple_element_1 = const_str_digest_9cb311616f5ee2b71697f34f3227f4c5;
Py_INCREF( tmp_tuple_element_1 );
PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 );
tmp_tuple_element_1 = PyTuple_New( 1 );
if ( self->m_closure[0] == NULL )
{
tmp_tuple_element_2 = NULL;
}
else
{
tmp_tuple_element_2 = PyCell_GET( self->m_closure[0] );
}
if ( tmp_tuple_element_2 == NULL )
{
Py_DECREF( tmp_return_value );
Py_DECREF( tmp_tuple_element_1 );
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "free variable '%s' referenced before assignment in enclosing scope", "value" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 39;
type_description_1 = "c";
goto frame_exception_exit_1;
}
Py_INCREF( tmp_tuple_element_2 );
PyTuple_SET_ITEM( tmp_tuple_element_1, 0, tmp_tuple_element_2 );
PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 );
tmp_tuple_element_1 = PyDict_New();
PyTuple_SET_ITEM( tmp_return_value, 2, tmp_tuple_element_1 );
goto frame_return_exit_1;
#if 0
RESTORE_FRAME_EXCEPTION( frame_af9bcfcc848055391ca50c1e06838db9 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto frame_no_exception_1;
frame_return_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_af9bcfcc848055391ca50c1e06838db9 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto function_return_exit;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_af9bcfcc848055391ca50c1e06838db9 );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( frame_af9bcfcc848055391ca50c1e06838db9, exception_lineno );
}
else if ( exception_tb->tb_frame != &frame_af9bcfcc848055391ca50c1e06838db9->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, frame_af9bcfcc848055391ca50c1e06838db9, exception_lineno );
}
// Attachs locals to frame if any.
Nuitka_Frame_AttachLocals(
(struct Nuitka_FrameObject *)frame_af9bcfcc848055391ca50c1e06838db9,
type_description_1,
self->m_closure[0]
);
// Release cached frame.
if ( frame_af9bcfcc848055391ca50c1e06838db9 == cache_frame_af9bcfcc848055391ca50c1e06838db9 )
{
Py_DECREF( frame_af9bcfcc848055391ca50c1e06838db9 );
}
cache_frame_af9bcfcc848055391ca50c1e06838db9 = NULL;
assertFrameObject( frame_af9bcfcc848055391ca50c1e06838db9 );
// Put the previous frame back on top.
popFrameStack();
// Return the error.
goto function_exception_exit;
frame_no_exception_1:;
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_4_SET$$$function_3_lambda );
return NULL;
function_exception_exit:
assert( exception_type );
RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
return NULL;
function_return_exit:
CHECK_OBJECT( tmp_return_value );
assert( had_error || !ERROR_OCCURRED() );
return tmp_return_value;
}
static PyObject *impl_django$db$models$deletion$$$function_5_SET_NULL( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
{
// Preserve error status for checks
#ifndef __NUITKA_NO_ASSERT__
NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
#endif
// Local variable declarations.
PyObject *par_collector = python_pars[ 0 ];
PyObject *par_field = python_pars[ 1 ];
PyObject *par_sub_objs = python_pars[ 2 ];
PyObject *par_using = python_pars[ 3 ];
PyObject *exception_type = NULL;
PyObject *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
PyObject *tmp_args_element_name_1;
PyObject *tmp_args_element_name_2;
PyObject *tmp_args_element_name_3;
PyObject *tmp_called_name_1;
PyObject *tmp_return_value;
PyObject *tmp_source_name_1;
NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
static struct Nuitka_FrameObject *cache_frame_5dcad26cc3b905ae41d0893ea74b9e28 = NULL;
struct Nuitka_FrameObject *frame_5dcad26cc3b905ae41d0893ea74b9e28;
NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
tmp_return_value = NULL;
// Actual function code.
// Tried code:
MAKE_OR_REUSE_FRAME( cache_frame_5dcad26cc3b905ae41d0893ea74b9e28, codeobj_5dcad26cc3b905ae41d0893ea74b9e28, module_django$db$models$deletion, sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *) );
frame_5dcad26cc3b905ae41d0893ea74b9e28 = cache_frame_5dcad26cc3b905ae41d0893ea74b9e28;
// Push the new frame as the currently active one.
pushFrameStack( frame_5dcad26cc3b905ae41d0893ea74b9e28 );
// Mark the frame object as in use, ref count 1 will be up for reuse.
assert( Py_REFCNT( frame_5dcad26cc3b905ae41d0893ea74b9e28 ) == 2 ); // Frame stack
// Framed code:
tmp_source_name_1 = par_collector;
CHECK_OBJECT( tmp_source_name_1 );
tmp_called_name_1 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_add_field_update );
if ( tmp_called_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 44;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_args_element_name_1 = par_field;
if ( tmp_args_element_name_1 == NULL )
{
Py_DECREF( tmp_called_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "field" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 44;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_args_element_name_2 = Py_None;
tmp_args_element_name_3 = par_sub_objs;
if ( tmp_args_element_name_3 == NULL )
{
Py_DECREF( tmp_called_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "sub_objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 44;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
frame_5dcad26cc3b905ae41d0893ea74b9e28->m_frame.f_lineno = 44;
{
PyObject *call_args[] = { tmp_args_element_name_1, tmp_args_element_name_2, tmp_args_element_name_3 };
tmp_unused = CALL_FUNCTION_WITH_ARGS3( tmp_called_name_1, call_args );
}
Py_DECREF( tmp_called_name_1 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 44;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
Py_DECREF( tmp_unused );
#if 0
RESTORE_FRAME_EXCEPTION( frame_5dcad26cc3b905ae41d0893ea74b9e28 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto frame_no_exception_1;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_5dcad26cc3b905ae41d0893ea74b9e28 );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( frame_5dcad26cc3b905ae41d0893ea74b9e28, exception_lineno );
}
else if ( exception_tb->tb_frame != &frame_5dcad26cc3b905ae41d0893ea74b9e28->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, frame_5dcad26cc3b905ae41d0893ea74b9e28, exception_lineno );
}
// Attachs locals to frame if any.
Nuitka_Frame_AttachLocals(
(struct Nuitka_FrameObject *)frame_5dcad26cc3b905ae41d0893ea74b9e28,
type_description_1,
par_collector,
par_field,
par_sub_objs,
par_using
);
// Release cached frame.
if ( frame_5dcad26cc3b905ae41d0893ea74b9e28 == cache_frame_5dcad26cc3b905ae41d0893ea74b9e28 )
{
Py_DECREF( frame_5dcad26cc3b905ae41d0893ea74b9e28 );
}
cache_frame_5dcad26cc3b905ae41d0893ea74b9e28 = NULL;
assertFrameObject( frame_5dcad26cc3b905ae41d0893ea74b9e28 );
// Put the previous frame back on top.
popFrameStack();
// Return the error.
goto try_except_handler_1;
frame_no_exception_1:;
tmp_return_value = Py_None;
Py_INCREF( tmp_return_value );
goto try_return_handler_1;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_5_SET_NULL );
return NULL;
// Return handler code:
try_return_handler_1:;
Py_XDECREF( par_collector );
par_collector = NULL;
Py_XDECREF( par_field );
par_field = NULL;
Py_XDECREF( par_sub_objs );
par_sub_objs = NULL;
Py_XDECREF( par_using );
par_using = NULL;
goto function_return_exit;
// Exception handler code:
try_except_handler_1:;
exception_keeper_type_1 = exception_type;
exception_keeper_value_1 = exception_value;
exception_keeper_tb_1 = exception_tb;
exception_keeper_lineno_1 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( par_collector );
par_collector = NULL;
Py_XDECREF( par_field );
par_field = NULL;
Py_XDECREF( par_sub_objs );
par_sub_objs = NULL;
Py_XDECREF( par_using );
par_using = NULL;
// Re-raise.
exception_type = exception_keeper_type_1;
exception_value = exception_keeper_value_1;
exception_tb = exception_keeper_tb_1;
exception_lineno = exception_keeper_lineno_1;
goto function_exception_exit;
// End of try:
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_5_SET_NULL );
return NULL;
function_exception_exit:
assert( exception_type );
RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
return NULL;
function_return_exit:
CHECK_OBJECT( tmp_return_value );
assert( had_error || !ERROR_OCCURRED() );
return tmp_return_value;
}
static PyObject *impl_django$db$models$deletion$$$function_6_SET_DEFAULT( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
{
// Preserve error status for checks
#ifndef __NUITKA_NO_ASSERT__
NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
#endif
// Local variable declarations.
PyObject *par_collector = python_pars[ 0 ];
PyObject *par_field = python_pars[ 1 ];
PyObject *par_sub_objs = python_pars[ 2 ];
PyObject *par_using = python_pars[ 3 ];
PyObject *exception_type = NULL;
PyObject *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
PyObject *tmp_args_element_name_1;
PyObject *tmp_args_element_name_2;
PyObject *tmp_args_element_name_3;
PyObject *tmp_called_instance_1;
PyObject *tmp_called_name_1;
PyObject *tmp_return_value;
PyObject *tmp_source_name_1;
NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
static struct Nuitka_FrameObject *cache_frame_e15a0ab237ab5954be0dac3bc9648c0e = NULL;
struct Nuitka_FrameObject *frame_e15a0ab237ab5954be0dac3bc9648c0e;
NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
tmp_return_value = NULL;
// Actual function code.
// Tried code:
MAKE_OR_REUSE_FRAME( cache_frame_e15a0ab237ab5954be0dac3bc9648c0e, codeobj_e15a0ab237ab5954be0dac3bc9648c0e, module_django$db$models$deletion, sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *) );
frame_e15a0ab237ab5954be0dac3bc9648c0e = cache_frame_e15a0ab237ab5954be0dac3bc9648c0e;
// Push the new frame as the currently active one.
pushFrameStack( frame_e15a0ab237ab5954be0dac3bc9648c0e );
// Mark the frame object as in use, ref count 1 will be up for reuse.
assert( Py_REFCNT( frame_e15a0ab237ab5954be0dac3bc9648c0e ) == 2 ); // Frame stack
// Framed code:
tmp_source_name_1 = par_collector;
CHECK_OBJECT( tmp_source_name_1 );
tmp_called_name_1 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_add_field_update );
if ( tmp_called_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 48;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_args_element_name_1 = par_field;
if ( tmp_args_element_name_1 == NULL )
{
Py_DECREF( tmp_called_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "field" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 48;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_called_instance_1 = par_field;
if ( tmp_called_instance_1 == NULL )
{
Py_DECREF( tmp_called_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "field" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 48;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
frame_e15a0ab237ab5954be0dac3bc9648c0e->m_frame.f_lineno = 48;
tmp_args_element_name_2 = CALL_METHOD_NO_ARGS( tmp_called_instance_1, const_str_plain_get_default );
if ( tmp_args_element_name_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_1 );
exception_lineno = 48;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_args_element_name_3 = par_sub_objs;
if ( tmp_args_element_name_3 == NULL )
{
Py_DECREF( tmp_called_name_1 );
Py_DECREF( tmp_args_element_name_2 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "sub_objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 48;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
frame_e15a0ab237ab5954be0dac3bc9648c0e->m_frame.f_lineno = 48;
{
PyObject *call_args[] = { tmp_args_element_name_1, tmp_args_element_name_2, tmp_args_element_name_3 };
tmp_unused = CALL_FUNCTION_WITH_ARGS3( tmp_called_name_1, call_args );
}
Py_DECREF( tmp_called_name_1 );
Py_DECREF( tmp_args_element_name_2 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 48;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
Py_DECREF( tmp_unused );
#if 0
RESTORE_FRAME_EXCEPTION( frame_e15a0ab237ab5954be0dac3bc9648c0e );
#endif
// Put the previous frame back on top.
popFrameStack();
goto frame_no_exception_1;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_e15a0ab237ab5954be0dac3bc9648c0e );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( frame_e15a0ab237ab5954be0dac3bc9648c0e, exception_lineno );
}
else if ( exception_tb->tb_frame != &frame_e15a0ab237ab5954be0dac3bc9648c0e->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, frame_e15a0ab237ab5954be0dac3bc9648c0e, exception_lineno );
}
// Attachs locals to frame if any.
Nuitka_Frame_AttachLocals(
(struct Nuitka_FrameObject *)frame_e15a0ab237ab5954be0dac3bc9648c0e,
type_description_1,
par_collector,
par_field,
par_sub_objs,
par_using
);
// Release cached frame.
if ( frame_e15a0ab237ab5954be0dac3bc9648c0e == cache_frame_e15a0ab237ab5954be0dac3bc9648c0e )
{
Py_DECREF( frame_e15a0ab237ab5954be0dac3bc9648c0e );
}
cache_frame_e15a0ab237ab5954be0dac3bc9648c0e = NULL;
assertFrameObject( frame_e15a0ab237ab5954be0dac3bc9648c0e );
// Put the previous frame back on top.
popFrameStack();
// Return the error.
goto try_except_handler_1;
frame_no_exception_1:;
tmp_return_value = Py_None;
Py_INCREF( tmp_return_value );
goto try_return_handler_1;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_6_SET_DEFAULT );
return NULL;
// Return handler code:
try_return_handler_1:;
Py_XDECREF( par_collector );
par_collector = NULL;
Py_XDECREF( par_field );
par_field = NULL;
Py_XDECREF( par_sub_objs );
par_sub_objs = NULL;
Py_XDECREF( par_using );
par_using = NULL;
goto function_return_exit;
// Exception handler code:
try_except_handler_1:;
exception_keeper_type_1 = exception_type;
exception_keeper_value_1 = exception_value;
exception_keeper_tb_1 = exception_tb;
exception_keeper_lineno_1 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( par_collector );
par_collector = NULL;
Py_XDECREF( par_field );
par_field = NULL;
Py_XDECREF( par_sub_objs );
par_sub_objs = NULL;
Py_XDECREF( par_using );
par_using = NULL;
// Re-raise.
exception_type = exception_keeper_type_1;
exception_value = exception_keeper_value_1;
exception_tb = exception_keeper_tb_1;
exception_lineno = exception_keeper_lineno_1;
goto function_exception_exit;
// End of try:
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_6_SET_DEFAULT );
return NULL;
function_exception_exit:
assert( exception_type );
RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
return NULL;
function_return_exit:
CHECK_OBJECT( tmp_return_value );
assert( had_error || !ERROR_OCCURRED() );
return tmp_return_value;
}
static PyObject *impl_django$db$models$deletion$$$function_7_DO_NOTHING( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
{
// Preserve error status for checks
#ifndef __NUITKA_NO_ASSERT__
NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
#endif
// Local variable declarations.
PyObject *par_collector = python_pars[ 0 ];
PyObject *par_field = python_pars[ 1 ];
PyObject *par_sub_objs = python_pars[ 2 ];
PyObject *par_using = python_pars[ 3 ];
PyObject *tmp_return_value;
tmp_return_value = NULL;
// Actual function code.
// Tried code:
tmp_return_value = Py_None;
Py_INCREF( tmp_return_value );
goto try_return_handler_1;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_7_DO_NOTHING );
return NULL;
// Return handler code:
try_return_handler_1:;
CHECK_OBJECT( (PyObject *)par_collector );
Py_DECREF( par_collector );
par_collector = NULL;
Py_XDECREF( par_field );
par_field = NULL;
Py_XDECREF( par_sub_objs );
par_sub_objs = NULL;
Py_XDECREF( par_using );
par_using = NULL;
goto function_return_exit;
// End of try:
CHECK_OBJECT( (PyObject *)par_collector );
Py_DECREF( par_collector );
par_collector = NULL;
Py_XDECREF( par_field );
par_field = NULL;
Py_XDECREF( par_sub_objs );
par_sub_objs = NULL;
Py_XDECREF( par_using );
par_using = NULL;
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_7_DO_NOTHING );
return NULL;
function_return_exit:
CHECK_OBJECT( tmp_return_value );
assert( had_error || !ERROR_OCCURRED() );
return tmp_return_value;
}
static PyObject *impl_django$db$models$deletion$$$function_8_get_candidate_relations_to_delete( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
{
// Preserve error status for checks
#ifndef __NUITKA_NO_ASSERT__
NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
#endif
// Local variable declarations.
PyObject *par_opts = python_pars[ 0 ];
PyObject *tmp_genexpr_1__$0 = NULL;
PyObject *exception_type = NULL;
PyObject *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
PyObject *tmp_assign_source_1;
PyObject *tmp_called_name_1;
PyObject *tmp_iter_arg_1;
PyObject *tmp_kw_name_1;
PyObject *tmp_outline_return_value_1;
PyObject *tmp_return_value;
PyObject *tmp_source_name_1;
static struct Nuitka_FrameObject *cache_frame_1d84a1db58e155104a4304b25b805bc2 = NULL;
struct Nuitka_FrameObject *frame_1d84a1db58e155104a4304b25b805bc2;
NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
tmp_return_value = NULL;
tmp_outline_return_value_1 = NULL;
// Actual function code.
// Tried code:
MAKE_OR_REUSE_FRAME( cache_frame_1d84a1db58e155104a4304b25b805bc2, codeobj_1d84a1db58e155104a4304b25b805bc2, module_django$db$models$deletion, sizeof(void *) );
frame_1d84a1db58e155104a4304b25b805bc2 = cache_frame_1d84a1db58e155104a4304b25b805bc2;
// Push the new frame as the currently active one.
pushFrameStack( frame_1d84a1db58e155104a4304b25b805bc2 );
// Mark the frame object as in use, ref count 1 will be up for reuse.
assert( Py_REFCNT( frame_1d84a1db58e155104a4304b25b805bc2 ) == 2 ); // Frame stack
// Framed code:
tmp_source_name_1 = par_opts;
CHECK_OBJECT( tmp_source_name_1 );
tmp_called_name_1 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_get_fields );
if ( tmp_called_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 59;
type_description_1 = "o";
goto frame_exception_exit_1;
}
tmp_kw_name_1 = PyDict_Copy( const_dict_6ee1bcc71367e6ed460b6341b211ffaf );
frame_1d84a1db58e155104a4304b25b805bc2->m_frame.f_lineno = 59;
tmp_iter_arg_1 = CALL_FUNCTION_WITH_KEYARGS( tmp_called_name_1, tmp_kw_name_1 );
Py_DECREF( tmp_called_name_1 );
Py_DECREF( tmp_kw_name_1 );
if ( tmp_iter_arg_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 59;
type_description_1 = "o";
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_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 59;
type_description_1 = "o";
goto frame_exception_exit_1;
}
assert( tmp_genexpr_1__$0 == NULL );
tmp_genexpr_1__$0 = tmp_assign_source_1;
// Tried code:
tmp_outline_return_value_1 = Nuitka_Generator_New(
django$db$models$deletion$$$function_8_get_candidate_relations_to_delete$$$genexpr_1_genexpr_context,
module_django$db$models$deletion,
const_str_angle_genexpr,
#if PYTHON_VERSION >= 350
const_str_digest_6a27259f36dfe26eb63bbecfd7d103bc,
#endif
codeobj_a11e5ebad594f04b3297d4c72617dd62,
1
);
((struct Nuitka_GeneratorObject *)tmp_outline_return_value_1)->m_closure[0] = PyCell_NEW0( tmp_genexpr_1__$0 );
assert( Py_SIZE( tmp_outline_return_value_1 ) >= 1 );
goto try_return_handler_2;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_8_get_candidate_relations_to_delete );
return NULL;
// Return handler code:
try_return_handler_2:;
CHECK_OBJECT( (PyObject *)tmp_genexpr_1__$0 );
Py_DECREF( tmp_genexpr_1__$0 );
tmp_genexpr_1__$0 = NULL;
goto outline_result_1;
// End of try:
CHECK_OBJECT( (PyObject *)tmp_genexpr_1__$0 );
Py_DECREF( tmp_genexpr_1__$0 );
tmp_genexpr_1__$0 = NULL;
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_8_get_candidate_relations_to_delete );
return NULL;
outline_result_1:;
tmp_return_value = tmp_outline_return_value_1;
goto frame_return_exit_1;
#if 0
RESTORE_FRAME_EXCEPTION( frame_1d84a1db58e155104a4304b25b805bc2 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto frame_no_exception_1;
frame_return_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_1d84a1db58e155104a4304b25b805bc2 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto try_return_handler_1;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_1d84a1db58e155104a4304b25b805bc2 );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( frame_1d84a1db58e155104a4304b25b805bc2, exception_lineno );
}
else if ( exception_tb->tb_frame != &frame_1d84a1db58e155104a4304b25b805bc2->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, frame_1d84a1db58e155104a4304b25b805bc2, exception_lineno );
}
// Attachs locals to frame if any.
Nuitka_Frame_AttachLocals(
(struct Nuitka_FrameObject *)frame_1d84a1db58e155104a4304b25b805bc2,
type_description_1,
par_opts
);
// Release cached frame.
if ( frame_1d84a1db58e155104a4304b25b805bc2 == cache_frame_1d84a1db58e155104a4304b25b805bc2 )
{
Py_DECREF( frame_1d84a1db58e155104a4304b25b805bc2 );
}
cache_frame_1d84a1db58e155104a4304b25b805bc2 = NULL;
assertFrameObject( frame_1d84a1db58e155104a4304b25b805bc2 );
// Put the previous frame back on top.
popFrameStack();
// Return the error.
goto try_except_handler_1;
frame_no_exception_1:;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_8_get_candidate_relations_to_delete );
return NULL;
// Return handler code:
try_return_handler_1:;
Py_XDECREF( par_opts );
par_opts = NULL;
goto function_return_exit;
// Exception handler code:
try_except_handler_1:;
exception_keeper_type_1 = exception_type;
exception_keeper_value_1 = exception_value;
exception_keeper_tb_1 = exception_tb;
exception_keeper_lineno_1 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( par_opts );
par_opts = NULL;
// Re-raise.
exception_type = exception_keeper_type_1;
exception_value = exception_keeper_value_1;
exception_tb = exception_keeper_tb_1;
exception_lineno = exception_keeper_lineno_1;
goto function_exception_exit;
// End of try:
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_8_get_candidate_relations_to_delete );
return NULL;
function_exception_exit:
assert( exception_type );
RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
return NULL;
function_return_exit:
CHECK_OBJECT( tmp_return_value );
assert( had_error || !ERROR_OCCURRED() );
return tmp_return_value;
}
#if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
struct django$db$models$deletion$$$function_8_get_candidate_relations_to_delete$$$genexpr_1_genexpr_locals {
PyObject *var_f
PyObject *tmp_iter_value_0
PyObject *exception_type
PyObject *exception_value
PyTracebackObject *exception_tb
int exception_lineno
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
int exception_keeper_lineno_1;
PyObject *exception_keeper_type_2;
PyObject *exception_keeper_value_2;
PyTracebackObject *exception_keeper_tb_2;
int exception_keeper_lineno_2;
int tmp_and_left_truth_1;
int tmp_and_left_truth_2;
PyObject *tmp_and_left_value_1;
PyObject *tmp_and_left_value_2;
PyObject *tmp_and_right_value_1;
PyObject *tmp_and_right_value_2;
PyObject *tmp_assign_source_1;
PyObject *tmp_assign_source_2;
int tmp_cond_truth_1;
PyObject *tmp_cond_value_1;
PyObject *tmp_expression_name_1;
PyObject *tmp_next_source_1;
PyObject *tmp_operand_name_1;
int tmp_or_left_truth_1;
PyObject *tmp_or_left_value_1;
PyObject *tmp_or_right_value_1;
PyObject *tmp_source_name_1;
PyObject *tmp_source_name_2;
PyObject *tmp_source_name_3;
PyObject *tmp_source_name_4;
char const *type_description_1
};
#endif
#if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
static PyObject *django$db$models$deletion$$$function_8_get_candidate_relations_to_delete$$$genexpr_1_genexpr_context( struct Nuitka_GeneratorObject *generator, PyObject *yield_return_value )
#else
static void django$db$models$deletion$$$function_8_get_candidate_relations_to_delete$$$genexpr_1_genexpr_context( struct Nuitka_GeneratorObject *generator )
#endif
{
CHECK_OBJECT( (PyObject *)generator );
assert( Nuitka_Generator_Check( (PyObject *)generator ) );
// Local variable initialization
PyObject *var_f = NULL;
PyObject *tmp_iter_value_0 = NULL;
PyObject *exception_type = NULL;
PyObject *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
PyObject *exception_keeper_type_2;
PyObject *exception_keeper_value_2;
PyTracebackObject *exception_keeper_tb_2;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_2;
int tmp_and_left_truth_1;
int tmp_and_left_truth_2;
PyObject *tmp_and_left_value_1;
PyObject *tmp_and_left_value_2;
PyObject *tmp_and_right_value_1;
PyObject *tmp_and_right_value_2;
PyObject *tmp_assign_source_1;
PyObject *tmp_assign_source_2;
int tmp_cond_truth_1;
PyObject *tmp_cond_value_1;
PyObject *tmp_expression_name_1;
PyObject *tmp_next_source_1;
PyObject *tmp_operand_name_1;
int tmp_or_left_truth_1;
PyObject *tmp_or_left_value_1;
PyObject *tmp_or_right_value_1;
PyObject *tmp_source_name_1;
PyObject *tmp_source_name_2;
PyObject *tmp_source_name_3;
PyObject *tmp_source_name_4;
NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
static struct Nuitka_FrameObject *cache_frame_generator = NULL;
NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
// Dispatch to yield based on return label index:
// Actual function code.
// Tried code:
MAKE_OR_REUSE_FRAME( cache_frame_generator, codeobj_a11e5ebad594f04b3297d4c72617dd62, module_django$db$models$deletion, sizeof(void *)+sizeof(void *) );
generator->m_frame = cache_frame_generator;
// Mark the frame object as in use, ref count 1 will be up for reuse.
Py_INCREF( generator->m_frame );
assert( Py_REFCNT( generator->m_frame ) == 2 ); // Frame stack
#if PYTHON_VERSION >= 340
generator->m_frame->m_frame.f_gen = (PyObject *)generator;
#endif
Py_CLEAR( generator->m_frame->m_frame.f_back );
generator->m_frame->m_frame.f_back = PyThreadState_GET()->frame;
Py_INCREF( generator->m_frame->m_frame.f_back );
PyThreadState_GET()->frame = &generator->m_frame->m_frame;
Py_INCREF( generator->m_frame );
Nuitka_Frame_MarkAsExecuting( generator->m_frame );
#if PYTHON_VERSION >= 300
// Accept currently existing exception as the one to publish again when we
// yield or yield from.
PyThreadState *thread_state = PyThreadState_GET();
generator->m_frame->m_frame.f_exc_type = thread_state->exc_type;
if ( generator->m_frame->m_frame.f_exc_type == Py_None ) generator->m_frame->m_frame.f_exc_type = NULL;
Py_XINCREF( generator->m_frame->m_frame.f_exc_type );
generator->m_frame->m_frame.f_exc_value = thread_state->exc_value;
Py_XINCREF( generator->m_frame->m_frame.f_exc_value );
generator->m_frame->m_frame.f_exc_traceback = thread_state->exc_traceback;
Py_XINCREF( generator->m_frame->m_frame.f_exc_traceback );
#endif
// Framed code:
// Tried code:
loop_start_1:;
if ( generator->m_closure[0] == NULL )
{
tmp_next_source_1 = NULL;
}
else
{
tmp_next_source_1 = PyCell_GET( generator->m_closure[0] );
}
CHECK_OBJECT( tmp_next_source_1 );
tmp_assign_source_1 = ITERATOR_NEXT( tmp_next_source_1 );
if ( tmp_assign_source_1 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_1;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "No";
exception_lineno = 59;
goto try_except_handler_2;
}
}
{
PyObject *old = tmp_iter_value_0;
tmp_iter_value_0 = tmp_assign_source_1;
Py_XDECREF( old );
}
tmp_assign_source_2 = tmp_iter_value_0;
CHECK_OBJECT( tmp_assign_source_2 );
{
PyObject *old = var_f;
var_f = tmp_assign_source_2;
Py_INCREF( var_f );
Py_XDECREF( old );
}
tmp_source_name_1 = var_f;
CHECK_OBJECT( tmp_source_name_1 );
tmp_and_left_value_1 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_auto_created );
if ( tmp_and_left_value_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 60;
type_description_1 = "No";
goto try_except_handler_2;
}
tmp_and_left_truth_1 = CHECK_IF_TRUE( tmp_and_left_value_1 );
if ( tmp_and_left_truth_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_and_left_value_1 );
exception_lineno = 60;
type_description_1 = "No";
goto try_except_handler_2;
}
if ( tmp_and_left_truth_1 == 1 )
{
goto and_right_1;
}
else
{
goto and_left_1;
}
and_right_1:;
Py_DECREF( tmp_and_left_value_1 );
tmp_source_name_2 = var_f;
if ( tmp_source_name_2 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "f" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 60;
type_description_1 = "No";
goto try_except_handler_2;
}
tmp_operand_name_1 = LOOKUP_ATTRIBUTE( tmp_source_name_2, const_str_plain_concrete );
if ( tmp_operand_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 60;
type_description_1 = "No";
goto try_except_handler_2;
}
tmp_and_left_value_2 = UNARY_OPERATION( UNARY_NOT, tmp_operand_name_1 );
Py_DECREF( tmp_operand_name_1 );
if ( tmp_and_left_value_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 60;
type_description_1 = "No";
goto try_except_handler_2;
}
tmp_and_left_truth_2 = CHECK_IF_TRUE( tmp_and_left_value_2 );
if ( tmp_and_left_truth_2 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 60;
type_description_1 = "No";
goto try_except_handler_2;
}
if ( tmp_and_left_truth_2 == 1 )
{
goto and_right_2;
}
else
{
goto and_left_2;
}
and_right_2:;
tmp_source_name_3 = var_f;
if ( tmp_source_name_3 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "f" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 60;
type_description_1 = "No";
goto try_except_handler_2;
}
tmp_or_left_value_1 = LOOKUP_ATTRIBUTE( tmp_source_name_3, const_str_plain_one_to_one );
if ( tmp_or_left_value_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 60;
type_description_1 = "No";
goto try_except_handler_2;
}
tmp_or_left_truth_1 = CHECK_IF_TRUE( tmp_or_left_value_1 );
if ( tmp_or_left_truth_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_or_left_value_1 );
exception_lineno = 60;
type_description_1 = "No";
goto try_except_handler_2;
}
if ( tmp_or_left_truth_1 == 1 )
{
goto or_left_1;
}
else
{
goto or_right_1;
}
or_right_1:;
Py_DECREF( tmp_or_left_value_1 );
tmp_source_name_4 = var_f;
if ( tmp_source_name_4 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "f" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 60;
type_description_1 = "No";
goto try_except_handler_2;
}
tmp_or_right_value_1 = LOOKUP_ATTRIBUTE( tmp_source_name_4, const_str_plain_one_to_many );
if ( tmp_or_right_value_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 60;
type_description_1 = "No";
goto try_except_handler_2;
}
tmp_and_right_value_2 = tmp_or_right_value_1;
goto or_end_1;
or_left_1:;
tmp_and_right_value_2 = tmp_or_left_value_1;
or_end_1:;
tmp_and_right_value_1 = tmp_and_right_value_2;
goto and_end_2;
and_left_2:;
Py_INCREF( tmp_and_left_value_2 );
tmp_and_right_value_1 = tmp_and_left_value_2;
and_end_2:;
tmp_cond_value_1 = tmp_and_right_value_1;
goto and_end_1;
and_left_1:;
tmp_cond_value_1 = tmp_and_left_value_1;
and_end_1:;
tmp_cond_truth_1 = CHECK_IF_TRUE( tmp_cond_value_1 );
if ( tmp_cond_truth_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_cond_value_1 );
exception_lineno = 60;
type_description_1 = "No";
goto try_except_handler_2;
}
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_expression_name_1 = var_f;
if ( tmp_expression_name_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "f" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 59;
type_description_1 = "No";
goto try_except_handler_2;
}
Py_INCREF( tmp_expression_name_1 );
tmp_unused = GENERATOR_YIELD( generator, tmp_expression_name_1 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 59;
type_description_1 = "No";
goto try_except_handler_2;
}
branch_no_1:;
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 59;
type_description_1 = "No";
goto try_except_handler_2;
}
goto loop_start_1;
loop_end_1:;
goto try_end_1;
// Exception handler code:
try_except_handler_2:;
exception_keeper_type_1 = exception_type;
exception_keeper_value_1 = exception_value;
exception_keeper_tb_1 = exception_tb;
exception_keeper_lineno_1 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_iter_value_0 );
tmp_iter_value_0 = NULL;
// Re-raise.
exception_type = exception_keeper_type_1;
exception_value = exception_keeper_value_1;
exception_tb = exception_keeper_tb_1;
exception_lineno = exception_keeper_lineno_1;
goto frame_exception_exit_1;
// End of try:
try_end_1:;
Nuitka_Frame_MarkAsNotExecuting( generator->m_frame );
#if PYTHON_VERSION >= 300
Py_CLEAR( generator->m_frame->m_frame.f_exc_type );
Py_CLEAR( generator->m_frame->m_frame.f_exc_value );
Py_CLEAR( generator->m_frame->m_frame.f_exc_traceback );
#endif
// Allow re-use of the frame again.
Py_DECREF( generator->m_frame );
goto frame_no_exception_1;
frame_exception_exit_1:;
// If it's not an exit exception, consider and create a traceback for it.
if ( !EXCEPTION_MATCH_GENERATOR( exception_type ) )
{
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( generator->m_frame, exception_lineno );
}
else if ( exception_tb->tb_frame != &generator->m_frame->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, generator->m_frame, exception_lineno );
}
Nuitka_Frame_AttachLocals(
(struct Nuitka_FrameObject *)generator->m_frame,
type_description_1,
NULL,
var_f
);
// Release cached frame.
if ( generator->m_frame == cache_frame_generator )
{
Py_DECREF( generator->m_frame );
}
cache_frame_generator = NULL;
assertFrameObject( generator->m_frame );
}
#if PYTHON_VERSION >= 300
Py_CLEAR( generator->m_frame->m_frame.f_exc_type );
Py_CLEAR( generator->m_frame->m_frame.f_exc_value );
Py_CLEAR( generator->m_frame->m_frame.f_exc_traceback );
#endif
Py_DECREF( generator->m_frame );
// Return the error.
goto try_except_handler_1;
frame_no_exception_1:;
goto try_end_2;
// Exception handler code:
try_except_handler_1:;
exception_keeper_type_2 = exception_type;
exception_keeper_value_2 = exception_value;
exception_keeper_tb_2 = exception_tb;
exception_keeper_lineno_2 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( var_f );
var_f = NULL;
// Re-raise.
exception_type = exception_keeper_type_2;
exception_value = exception_keeper_value_2;
exception_tb = exception_keeper_tb_2;
exception_lineno = exception_keeper_lineno_2;
goto function_exception_exit;
// End of try:
try_end_2:;
Py_XDECREF( tmp_iter_value_0 );
tmp_iter_value_0 = NULL;
Py_XDECREF( var_f );
var_f = NULL;
#if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
return NULL;
#else
generator->m_yielded = NULL;
return;
#endif
function_exception_exit:
assert( exception_type );
RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
#if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
return NULL;
#else
generator->m_yielded = NULL;
return;
#endif
}
static PyObject *impl_django$db$models$deletion$$$function_9___init__( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
{
// Preserve error status for checks
#ifndef __NUITKA_NO_ASSERT__
NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
#endif
// Local variable declarations.
PyObject *par_self = python_pars[ 0 ];
PyObject *par_using = python_pars[ 1 ];
PyObject *exception_type = NULL;
PyObject *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
PyObject *tmp_assattr_name_1;
PyObject *tmp_assattr_name_2;
PyObject *tmp_assattr_name_3;
PyObject *tmp_assattr_name_4;
PyObject *tmp_assattr_name_5;
PyObject *tmp_assattr_target_1;
PyObject *tmp_assattr_target_2;
PyObject *tmp_assattr_target_3;
PyObject *tmp_assattr_target_4;
PyObject *tmp_assattr_target_5;
PyObject *tmp_called_name_1;
bool tmp_result;
PyObject *tmp_return_value;
static struct Nuitka_FrameObject *cache_frame_04e7822706aae5b7e03c2d783b09c51b = NULL;
struct Nuitka_FrameObject *frame_04e7822706aae5b7e03c2d783b09c51b;
NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
tmp_return_value = NULL;
// Actual function code.
// Tried code:
MAKE_OR_REUSE_FRAME( cache_frame_04e7822706aae5b7e03c2d783b09c51b, codeobj_04e7822706aae5b7e03c2d783b09c51b, module_django$db$models$deletion, sizeof(void *)+sizeof(void *) );
frame_04e7822706aae5b7e03c2d783b09c51b = cache_frame_04e7822706aae5b7e03c2d783b09c51b;
// Push the new frame as the currently active one.
pushFrameStack( frame_04e7822706aae5b7e03c2d783b09c51b );
// Mark the frame object as in use, ref count 1 will be up for reuse.
assert( Py_REFCNT( frame_04e7822706aae5b7e03c2d783b09c51b ) == 2 ); // Frame stack
// Framed code:
tmp_assattr_name_1 = par_using;
CHECK_OBJECT( tmp_assattr_name_1 );
tmp_assattr_target_1 = par_self;
CHECK_OBJECT( tmp_assattr_target_1 );
tmp_result = SET_ATTRIBUTE( tmp_assattr_target_1, const_str_plain_using, tmp_assattr_name_1 );
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 66;
type_description_1 = "oo";
goto frame_exception_exit_1;
}
tmp_called_name_1 = GET_STRING_DICT_VALUE( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_OrderedDict );
if (unlikely( tmp_called_name_1 == NULL ))
{
tmp_called_name_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_OrderedDict );
}
if ( tmp_called_name_1 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "OrderedDict" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 68;
type_description_1 = "oo";
goto frame_exception_exit_1;
}
frame_04e7822706aae5b7e03c2d783b09c51b->m_frame.f_lineno = 68;
tmp_assattr_name_2 = CALL_FUNCTION_NO_ARGS( tmp_called_name_1 );
if ( tmp_assattr_name_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 68;
type_description_1 = "oo";
goto frame_exception_exit_1;
}
tmp_assattr_target_2 = par_self;
if ( tmp_assattr_target_2 == NULL )
{
Py_DECREF( tmp_assattr_name_2 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 68;
type_description_1 = "oo";
goto frame_exception_exit_1;
}
tmp_result = SET_ATTRIBUTE( tmp_assattr_target_2, const_str_plain_data, tmp_assattr_name_2 );
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_assattr_name_2 );
exception_lineno = 68;
type_description_1 = "oo";
goto frame_exception_exit_1;
}
Py_DECREF( tmp_assattr_name_2 );
tmp_assattr_name_3 = PyDict_New();
tmp_assattr_target_3 = par_self;
if ( tmp_assattr_target_3 == NULL )
{
Py_DECREF( tmp_assattr_name_3 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 69;
type_description_1 = "oo";
goto frame_exception_exit_1;
}
tmp_result = SET_ATTRIBUTE( tmp_assattr_target_3, const_str_plain_field_updates, tmp_assattr_name_3 );
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_assattr_name_3 );
exception_lineno = 69;
type_description_1 = "oo";
goto frame_exception_exit_1;
}
Py_DECREF( tmp_assattr_name_3 );
tmp_assattr_name_4 = PyList_New( 0 );
tmp_assattr_target_4 = par_self;
if ( tmp_assattr_target_4 == NULL )
{
Py_DECREF( tmp_assattr_name_4 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 72;
type_description_1 = "oo";
goto frame_exception_exit_1;
}
tmp_result = SET_ATTRIBUTE( tmp_assattr_target_4, const_str_plain_fast_deletes, tmp_assattr_name_4 );
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_assattr_name_4 );
exception_lineno = 72;
type_description_1 = "oo";
goto frame_exception_exit_1;
}
Py_DECREF( tmp_assattr_name_4 );
tmp_assattr_name_5 = PyDict_New();
tmp_assattr_target_5 = par_self;
if ( tmp_assattr_target_5 == NULL )
{
Py_DECREF( tmp_assattr_name_5 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 79;
type_description_1 = "oo";
goto frame_exception_exit_1;
}
tmp_result = SET_ATTRIBUTE( tmp_assattr_target_5, const_str_plain_dependencies, tmp_assattr_name_5 );
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_assattr_name_5 );
exception_lineno = 79;
type_description_1 = "oo";
goto frame_exception_exit_1;
}
Py_DECREF( tmp_assattr_name_5 );
#if 0
RESTORE_FRAME_EXCEPTION( frame_04e7822706aae5b7e03c2d783b09c51b );
#endif
// Put the previous frame back on top.
popFrameStack();
goto frame_no_exception_1;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_04e7822706aae5b7e03c2d783b09c51b );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( frame_04e7822706aae5b7e03c2d783b09c51b, exception_lineno );
}
else if ( exception_tb->tb_frame != &frame_04e7822706aae5b7e03c2d783b09c51b->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, frame_04e7822706aae5b7e03c2d783b09c51b, exception_lineno );
}
// Attachs locals to frame if any.
Nuitka_Frame_AttachLocals(
(struct Nuitka_FrameObject *)frame_04e7822706aae5b7e03c2d783b09c51b,
type_description_1,
par_self,
par_using
);
// Release cached frame.
if ( frame_04e7822706aae5b7e03c2d783b09c51b == cache_frame_04e7822706aae5b7e03c2d783b09c51b )
{
Py_DECREF( frame_04e7822706aae5b7e03c2d783b09c51b );
}
cache_frame_04e7822706aae5b7e03c2d783b09c51b = NULL;
assertFrameObject( frame_04e7822706aae5b7e03c2d783b09c51b );
// Put the previous frame back on top.
popFrameStack();
// Return the error.
goto try_except_handler_1;
frame_no_exception_1:;
tmp_return_value = Py_None;
Py_INCREF( tmp_return_value );
goto try_return_handler_1;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_9___init__ );
return NULL;
// Return handler code:
try_return_handler_1:;
Py_XDECREF( par_self );
par_self = NULL;
Py_XDECREF( par_using );
par_using = NULL;
goto function_return_exit;
// Exception handler code:
try_except_handler_1:;
exception_keeper_type_1 = exception_type;
exception_keeper_value_1 = exception_value;
exception_keeper_tb_1 = exception_tb;
exception_keeper_lineno_1 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( par_self );
par_self = NULL;
Py_XDECREF( par_using );
par_using = NULL;
// Re-raise.
exception_type = exception_keeper_type_1;
exception_value = exception_keeper_value_1;
exception_tb = exception_keeper_tb_1;
exception_lineno = exception_keeper_lineno_1;
goto function_exception_exit;
// End of try:
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_9___init__ );
return NULL;
function_exception_exit:
assert( exception_type );
RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
return NULL;
function_return_exit:
CHECK_OBJECT( tmp_return_value );
assert( had_error || !ERROR_OCCURRED() );
return tmp_return_value;
}
static PyObject *impl_django$db$models$deletion$$$function_10_add( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
{
// Preserve error status for checks
#ifndef __NUITKA_NO_ASSERT__
NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
#endif
// Local variable declarations.
PyObject *par_self = python_pars[ 0 ];
PyObject *par_objs = python_pars[ 1 ];
PyObject *par_source = python_pars[ 2 ];
PyObject *par_nullable = python_pars[ 3 ];
PyObject *par_reverse_dependency = python_pars[ 4 ];
PyObject *var_new_objs = NULL;
PyObject *var_model = NULL;
PyObject *var_instances = NULL;
PyObject *var_obj = NULL;
PyObject *tmp_for_loop_1__for_iterator = NULL;
PyObject *tmp_for_loop_1__iter_value = NULL;
PyObject *tmp_tuple_unpack_1__element_1 = NULL;
PyObject *tmp_tuple_unpack_1__element_2 = NULL;
PyObject *tmp_tuple_unpack_1__source_iter = NULL;
PyObject *exception_type = NULL;
PyObject *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
PyObject *exception_keeper_type_2;
PyObject *exception_keeper_value_2;
PyTracebackObject *exception_keeper_tb_2;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_2;
PyObject *exception_keeper_type_3;
PyObject *exception_keeper_value_3;
PyTracebackObject *exception_keeper_tb_3;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_3;
PyObject *exception_keeper_type_4;
PyObject *exception_keeper_value_4;
PyTracebackObject *exception_keeper_tb_4;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_4;
int tmp_and_left_truth_1;
PyObject *tmp_and_left_value_1;
PyObject *tmp_and_right_value_1;
PyObject *tmp_args_element_name_1;
PyObject *tmp_args_element_name_2;
PyObject *tmp_args_element_name_3;
PyObject *tmp_args_element_name_4;
PyObject *tmp_args_element_name_5;
PyObject *tmp_args_element_name_6;
PyObject *tmp_args_element_name_7;
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_called_name_1;
PyObject *tmp_called_name_2;
PyObject *tmp_called_name_3;
PyObject *tmp_called_name_4;
PyObject *tmp_called_name_5;
int tmp_cmp_NotIn_1;
PyObject *tmp_compare_left_1;
PyObject *tmp_compare_right_1;
PyObject *tmp_compexpr_left_1;
PyObject *tmp_compexpr_right_1;
int tmp_cond_truth_1;
int tmp_cond_truth_2;
int tmp_cond_truth_3;
PyObject *tmp_cond_value_1;
PyObject *tmp_cond_value_2;
PyObject *tmp_cond_value_3;
PyObject *tmp_iter_arg_1;
PyObject *tmp_iter_arg_2;
PyObject *tmp_iterator_attempt;
PyObject *tmp_iterator_name_1;
PyObject *tmp_next_source_1;
PyObject *tmp_operand_name_1;
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_source_name_6;
PyObject *tmp_source_name_7;
PyObject *tmp_source_name_8;
PyObject *tmp_source_name_9;
PyObject *tmp_source_name_10;
PyObject *tmp_source_name_11;
PyObject *tmp_source_name_12;
PyObject *tmp_subscribed_name_1;
PyObject *tmp_subscript_name_1;
PyObject *tmp_tuple_element_1;
PyObject *tmp_unpack_1;
PyObject *tmp_unpack_2;
NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
static struct Nuitka_FrameObject *cache_frame_29bdba5324aae2c24553ff6d5c9f67bb = NULL;
struct Nuitka_FrameObject *frame_29bdba5324aae2c24553ff6d5c9f67bb;
NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
tmp_return_value = NULL;
// Actual function code.
// Tried code:
MAKE_OR_REUSE_FRAME( cache_frame_29bdba5324aae2c24553ff6d5c9f67bb, codeobj_29bdba5324aae2c24553ff6d5c9f67bb, module_django$db$models$deletion, sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *) );
frame_29bdba5324aae2c24553ff6d5c9f67bb = cache_frame_29bdba5324aae2c24553ff6d5c9f67bb;
// Push the new frame as the currently active one.
pushFrameStack( frame_29bdba5324aae2c24553ff6d5c9f67bb );
// Mark the frame object as in use, ref count 1 will be up for reuse.
assert( Py_REFCNT( frame_29bdba5324aae2c24553ff6d5c9f67bb ) == 2 ); // Frame stack
// Framed code:
tmp_cond_value_1 = par_objs;
CHECK_OBJECT( tmp_cond_value_1 );
tmp_cond_truth_1 = CHECK_IF_TRUE( tmp_cond_value_1 );
if ( tmp_cond_truth_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 89;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
if ( tmp_cond_truth_1 == 1 )
{
goto branch_no_1;
}
else
{
goto branch_yes_1;
}
branch_yes_1:;
tmp_return_value = PyList_New( 0 );
goto frame_return_exit_1;
branch_no_1:;
tmp_assign_source_1 = PyList_New( 0 );
assert( var_new_objs == NULL );
var_new_objs = tmp_assign_source_1;
tmp_subscribed_name_1 = par_objs;
if ( tmp_subscribed_name_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 92;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
tmp_subscript_name_1 = const_int_0;
tmp_source_name_1 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_1, tmp_subscript_name_1 );
if ( tmp_source_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 92;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
tmp_assign_source_2 = LOOKUP_ATTRIBUTE_CLASS_SLOT( tmp_source_name_1 );
Py_DECREF( tmp_source_name_1 );
if ( tmp_assign_source_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 92;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
assert( var_model == NULL );
var_model = tmp_assign_source_2;
tmp_source_name_3 = par_self;
if ( tmp_source_name_3 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 93;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
tmp_source_name_2 = LOOKUP_ATTRIBUTE( tmp_source_name_3, const_str_plain_data );
if ( tmp_source_name_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 93;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
tmp_called_name_1 = LOOKUP_ATTRIBUTE( tmp_source_name_2, const_str_plain_setdefault );
Py_DECREF( tmp_source_name_2 );
if ( tmp_called_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 93;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
tmp_args_element_name_1 = var_model;
if ( tmp_args_element_name_1 == NULL )
{
Py_DECREF( tmp_called_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "model" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 93;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
tmp_args_element_name_2 = PySet_New( NULL );
frame_29bdba5324aae2c24553ff6d5c9f67bb->m_frame.f_lineno = 93;
{
PyObject *call_args[] = { tmp_args_element_name_1, tmp_args_element_name_2 };
tmp_assign_source_3 = CALL_FUNCTION_WITH_ARGS2( tmp_called_name_1, call_args );
}
Py_DECREF( tmp_called_name_1 );
Py_DECREF( tmp_args_element_name_2 );
if ( tmp_assign_source_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 93;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
assert( var_instances == NULL );
var_instances = tmp_assign_source_3;
tmp_iter_arg_1 = par_objs;
if ( tmp_iter_arg_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 94;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
tmp_assign_source_4 = MAKE_ITERATOR( tmp_iter_arg_1 );
if ( tmp_assign_source_4 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 94;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
assert( tmp_for_loop_1__for_iterator == NULL );
tmp_for_loop_1__for_iterator = tmp_assign_source_4;
// Tried code:
loop_start_1:;
tmp_next_source_1 = tmp_for_loop_1__for_iterator;
CHECK_OBJECT( tmp_next_source_1 );
tmp_assign_source_5 = ITERATOR_NEXT( tmp_next_source_1 );
if ( tmp_assign_source_5 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_1;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooo";
exception_lineno = 94;
goto try_except_handler_2;
}
}
{
PyObject *old = tmp_for_loop_1__iter_value;
tmp_for_loop_1__iter_value = tmp_assign_source_5;
Py_XDECREF( old );
}
tmp_assign_source_6 = tmp_for_loop_1__iter_value;
CHECK_OBJECT( tmp_assign_source_6 );
{
PyObject *old = var_obj;
var_obj = tmp_assign_source_6;
Py_INCREF( var_obj );
Py_XDECREF( old );
}
tmp_compare_left_1 = var_obj;
CHECK_OBJECT( tmp_compare_left_1 );
tmp_compare_right_1 = var_instances;
if ( tmp_compare_right_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "instances" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 95;
type_description_1 = "ooooooooo";
goto try_except_handler_2;
}
tmp_cmp_NotIn_1 = PySequence_Contains( tmp_compare_right_1, tmp_compare_left_1 );
assert( !(tmp_cmp_NotIn_1 == -1) );
if ( tmp_cmp_NotIn_1 == 0 )
{
goto branch_yes_2;
}
else
{
goto branch_no_2;
}
branch_yes_2:;
tmp_source_name_4 = var_new_objs;
if ( tmp_source_name_4 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "new_objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 96;
type_description_1 = "ooooooooo";
goto try_except_handler_2;
}
tmp_called_name_2 = LOOKUP_ATTRIBUTE( tmp_source_name_4, const_str_plain_append );
if ( tmp_called_name_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 96;
type_description_1 = "ooooooooo";
goto try_except_handler_2;
}
tmp_args_element_name_3 = var_obj;
if ( tmp_args_element_name_3 == NULL )
{
Py_DECREF( tmp_called_name_2 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "obj" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 96;
type_description_1 = "ooooooooo";
goto try_except_handler_2;
}
frame_29bdba5324aae2c24553ff6d5c9f67bb->m_frame.f_lineno = 96;
{
PyObject *call_args[] = { tmp_args_element_name_3 };
tmp_unused = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_2, call_args );
}
Py_DECREF( tmp_called_name_2 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 96;
type_description_1 = "ooooooooo";
goto try_except_handler_2;
}
Py_DECREF( tmp_unused );
branch_no_2:;
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 94;
type_description_1 = "ooooooooo";
goto try_except_handler_2;
}
goto loop_start_1;
loop_end_1:;
goto try_end_1;
// Exception handler code:
try_except_handler_2:;
exception_keeper_type_1 = exception_type;
exception_keeper_value_1 = exception_value;
exception_keeper_tb_1 = exception_tb;
exception_keeper_lineno_1 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_for_loop_1__iter_value );
tmp_for_loop_1__iter_value = NULL;
Py_XDECREF( tmp_for_loop_1__for_iterator );
tmp_for_loop_1__for_iterator = NULL;
// Re-raise.
exception_type = exception_keeper_type_1;
exception_value = exception_keeper_value_1;
exception_tb = exception_keeper_tb_1;
exception_lineno = exception_keeper_lineno_1;
goto frame_exception_exit_1;
// End of try:
try_end_1:;
Py_XDECREF( tmp_for_loop_1__iter_value );
tmp_for_loop_1__iter_value = NULL;
Py_XDECREF( tmp_for_loop_1__for_iterator );
tmp_for_loop_1__for_iterator = NULL;
tmp_source_name_5 = var_instances;
if ( tmp_source_name_5 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "instances" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 97;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
tmp_called_name_3 = LOOKUP_ATTRIBUTE( tmp_source_name_5, const_str_plain_update );
if ( tmp_called_name_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 97;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
tmp_args_element_name_4 = var_new_objs;
if ( tmp_args_element_name_4 == NULL )
{
Py_DECREF( tmp_called_name_3 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "new_objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 97;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
frame_29bdba5324aae2c24553ff6d5c9f67bb->m_frame.f_lineno = 97;
{
PyObject *call_args[] = { tmp_args_element_name_4 };
tmp_unused = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_3, call_args );
}
Py_DECREF( tmp_called_name_3 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 97;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
Py_DECREF( tmp_unused );
tmp_compexpr_left_1 = par_source;
if ( tmp_compexpr_left_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "source" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 101;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
tmp_compexpr_right_1 = Py_None;
tmp_and_left_value_1 = BOOL_FROM( tmp_compexpr_left_1 != tmp_compexpr_right_1 );
tmp_and_left_truth_1 = CHECK_IF_TRUE( tmp_and_left_value_1 );
assert( !(tmp_and_left_truth_1 == -1) );
if ( tmp_and_left_truth_1 == 1 )
{
goto and_right_1;
}
else
{
goto and_left_1;
}
and_right_1:;
tmp_operand_name_1 = par_nullable;
if ( tmp_operand_name_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "nullable" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 101;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
tmp_and_right_value_1 = UNARY_OPERATION( UNARY_NOT, tmp_operand_name_1 );
if ( tmp_and_right_value_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 101;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
tmp_cond_value_2 = tmp_and_right_value_1;
goto and_end_1;
and_left_1:;
tmp_cond_value_2 = tmp_and_left_value_1;
and_end_1:;
tmp_cond_truth_2 = CHECK_IF_TRUE( tmp_cond_value_2 );
if ( tmp_cond_truth_2 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 101;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
if ( tmp_cond_truth_2 == 1 )
{
goto branch_yes_3;
}
else
{
goto branch_no_3;
}
branch_yes_3:;
tmp_cond_value_3 = par_reverse_dependency;
if ( tmp_cond_value_3 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "reverse_dependency" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 102;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
tmp_cond_truth_3 = CHECK_IF_TRUE( tmp_cond_value_3 );
if ( tmp_cond_truth_3 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 102;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
if ( tmp_cond_truth_3 == 1 )
{
goto branch_yes_4;
}
else
{
goto branch_no_4;
}
branch_yes_4:;
// Tried code:
tmp_iter_arg_2 = PyTuple_New( 2 );
tmp_tuple_element_1 = var_model;
if ( tmp_tuple_element_1 == NULL )
{
Py_DECREF( tmp_iter_arg_2 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "model" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 103;
type_description_1 = "ooooooooo";
goto try_except_handler_3;
}
Py_INCREF( tmp_tuple_element_1 );
PyTuple_SET_ITEM( tmp_iter_arg_2, 0, tmp_tuple_element_1 );
tmp_tuple_element_1 = par_source;
if ( tmp_tuple_element_1 == NULL )
{
Py_DECREF( tmp_iter_arg_2 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "source" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 103;
type_description_1 = "ooooooooo";
goto try_except_handler_3;
}
Py_INCREF( tmp_tuple_element_1 );
PyTuple_SET_ITEM( tmp_iter_arg_2, 1, tmp_tuple_element_1 );
tmp_assign_source_7 = MAKE_ITERATOR( tmp_iter_arg_2 );
Py_DECREF( tmp_iter_arg_2 );
if ( tmp_assign_source_7 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 103;
type_description_1 = "ooooooooo";
goto try_except_handler_3;
}
assert( tmp_tuple_unpack_1__source_iter == NULL );
tmp_tuple_unpack_1__source_iter = tmp_assign_source_7;
// Tried code:
tmp_unpack_1 = tmp_tuple_unpack_1__source_iter;
CHECK_OBJECT( tmp_unpack_1 );
tmp_assign_source_8 = UNPACK_NEXT( tmp_unpack_1, 0, 2 );
if ( tmp_assign_source_8 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "ooooooooo";
exception_lineno = 103;
goto try_except_handler_4;
}
assert( tmp_tuple_unpack_1__element_1 == NULL );
tmp_tuple_unpack_1__element_1 = tmp_assign_source_8;
tmp_unpack_2 = tmp_tuple_unpack_1__source_iter;
CHECK_OBJECT( tmp_unpack_2 );
tmp_assign_source_9 = UNPACK_NEXT( tmp_unpack_2, 1, 2 );
if ( tmp_assign_source_9 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "ooooooooo";
exception_lineno = 103;
goto try_except_handler_4;
}
assert( tmp_tuple_unpack_1__element_2 == NULL );
tmp_tuple_unpack_1__element_2 = tmp_assign_source_9;
tmp_iterator_name_1 = tmp_tuple_unpack_1__source_iter;
CHECK_OBJECT( tmp_iterator_name_1 );
// Check if iterator has left-over elements.
CHECK_OBJECT( tmp_iterator_name_1 ); assert( HAS_ITERNEXT( tmp_iterator_name_1 ) );
tmp_iterator_attempt = (*Py_TYPE( tmp_iterator_name_1 )->tp_iternext)( tmp_iterator_name_1 );
if (likely( tmp_iterator_attempt == NULL ))
{
PyObject *error = GET_ERROR_OCCURRED();
if ( error != NULL )
{
if ( EXCEPTION_MATCH_BOOL_SINGLE( error, PyExc_StopIteration ))
{
CLEAR_ERROR_OCCURRED();
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooo";
exception_lineno = 103;
goto try_except_handler_4;
}
}
}
else
{
Py_DECREF( tmp_iterator_attempt );
// TODO: Could avoid PyErr_Format.
#if PYTHON_VERSION < 300
PyErr_Format( PyExc_ValueError, "too many values to unpack" );
#else
PyErr_Format( PyExc_ValueError, "too many values to unpack (expected 2)" );
#endif
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooo";
exception_lineno = 103;
goto try_except_handler_4;
}
goto try_end_2;
// Exception handler code:
try_except_handler_4:;
exception_keeper_type_2 = exception_type;
exception_keeper_value_2 = exception_value;
exception_keeper_tb_2 = exception_tb;
exception_keeper_lineno_2 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_1__source_iter );
tmp_tuple_unpack_1__source_iter = NULL;
// Re-raise.
exception_type = exception_keeper_type_2;
exception_value = exception_keeper_value_2;
exception_tb = exception_keeper_tb_2;
exception_lineno = exception_keeper_lineno_2;
goto try_except_handler_3;
// End of try:
try_end_2:;
goto try_end_3;
// Exception handler code:
try_except_handler_3:;
exception_keeper_type_3 = exception_type;
exception_keeper_value_3 = exception_value;
exception_keeper_tb_3 = exception_tb;
exception_keeper_lineno_3 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_1__element_1 );
tmp_tuple_unpack_1__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_1__element_2 );
tmp_tuple_unpack_1__element_2 = NULL;
// Re-raise.
exception_type = exception_keeper_type_3;
exception_value = exception_keeper_value_3;
exception_tb = exception_keeper_tb_3;
exception_lineno = exception_keeper_lineno_3;
goto frame_exception_exit_1;
// End of try:
try_end_3:;
Py_XDECREF( tmp_tuple_unpack_1__source_iter );
tmp_tuple_unpack_1__source_iter = NULL;
tmp_assign_source_10 = tmp_tuple_unpack_1__element_1;
CHECK_OBJECT( tmp_assign_source_10 );
{
PyObject *old = par_source;
par_source = tmp_assign_source_10;
Py_INCREF( par_source );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_1__element_1 );
tmp_tuple_unpack_1__element_1 = NULL;
tmp_assign_source_11 = tmp_tuple_unpack_1__element_2;
CHECK_OBJECT( tmp_assign_source_11 );
{
PyObject *old = var_model;
var_model = tmp_assign_source_11;
Py_INCREF( var_model );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_1__element_2 );
tmp_tuple_unpack_1__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_1__element_1 );
tmp_tuple_unpack_1__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_1__element_2 );
tmp_tuple_unpack_1__element_2 = NULL;
branch_no_4:;
tmp_source_name_8 = par_self;
if ( tmp_source_name_8 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 104;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
tmp_source_name_7 = LOOKUP_ATTRIBUTE( tmp_source_name_8, const_str_plain_dependencies );
if ( tmp_source_name_7 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 104;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
tmp_called_name_5 = LOOKUP_ATTRIBUTE( tmp_source_name_7, const_str_plain_setdefault );
Py_DECREF( tmp_source_name_7 );
if ( tmp_called_name_5 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 104;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
tmp_source_name_10 = par_source;
if ( tmp_source_name_10 == NULL )
{
Py_DECREF( tmp_called_name_5 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "source" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 105;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
tmp_source_name_9 = LOOKUP_ATTRIBUTE( tmp_source_name_10, const_str_plain__meta );
if ( tmp_source_name_9 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_5 );
exception_lineno = 105;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
tmp_args_element_name_5 = LOOKUP_ATTRIBUTE( tmp_source_name_9, const_str_plain_concrete_model );
Py_DECREF( tmp_source_name_9 );
if ( tmp_args_element_name_5 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_5 );
exception_lineno = 105;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
tmp_args_element_name_6 = PySet_New( NULL );
frame_29bdba5324aae2c24553ff6d5c9f67bb->m_frame.f_lineno = 104;
{
PyObject *call_args[] = { tmp_args_element_name_5, tmp_args_element_name_6 };
tmp_source_name_6 = CALL_FUNCTION_WITH_ARGS2( tmp_called_name_5, call_args );
}
Py_DECREF( tmp_called_name_5 );
Py_DECREF( tmp_args_element_name_5 );
Py_DECREF( tmp_args_element_name_6 );
if ( tmp_source_name_6 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 104;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
tmp_called_name_4 = LOOKUP_ATTRIBUTE( tmp_source_name_6, const_str_plain_add );
Py_DECREF( tmp_source_name_6 );
if ( tmp_called_name_4 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 104;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
tmp_source_name_12 = var_model;
if ( tmp_source_name_12 == NULL )
{
Py_DECREF( tmp_called_name_4 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "model" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 105;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
tmp_source_name_11 = LOOKUP_ATTRIBUTE( tmp_source_name_12, const_str_plain__meta );
if ( tmp_source_name_11 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_4 );
exception_lineno = 105;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
tmp_args_element_name_7 = LOOKUP_ATTRIBUTE( tmp_source_name_11, const_str_plain_concrete_model );
Py_DECREF( tmp_source_name_11 );
if ( tmp_args_element_name_7 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_4 );
exception_lineno = 105;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
frame_29bdba5324aae2c24553ff6d5c9f67bb->m_frame.f_lineno = 104;
{
PyObject *call_args[] = { tmp_args_element_name_7 };
tmp_unused = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_4, call_args );
}
Py_DECREF( tmp_called_name_4 );
Py_DECREF( tmp_args_element_name_7 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 104;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
Py_DECREF( tmp_unused );
branch_no_3:;
tmp_return_value = var_new_objs;
if ( tmp_return_value == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "new_objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 106;
type_description_1 = "ooooooooo";
goto frame_exception_exit_1;
}
Py_INCREF( tmp_return_value );
goto frame_return_exit_1;
#if 0
RESTORE_FRAME_EXCEPTION( frame_29bdba5324aae2c24553ff6d5c9f67bb );
#endif
// Put the previous frame back on top.
popFrameStack();
goto frame_no_exception_1;
frame_return_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_29bdba5324aae2c24553ff6d5c9f67bb );
#endif
// Put the previous frame back on top.
popFrameStack();
goto try_return_handler_1;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_29bdba5324aae2c24553ff6d5c9f67bb );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( frame_29bdba5324aae2c24553ff6d5c9f67bb, exception_lineno );
}
else if ( exception_tb->tb_frame != &frame_29bdba5324aae2c24553ff6d5c9f67bb->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, frame_29bdba5324aae2c24553ff6d5c9f67bb, exception_lineno );
}
// Attachs locals to frame if any.
Nuitka_Frame_AttachLocals(
(struct Nuitka_FrameObject *)frame_29bdba5324aae2c24553ff6d5c9f67bb,
type_description_1,
par_self,
par_objs,
par_source,
par_nullable,
par_reverse_dependency,
var_new_objs,
var_model,
var_instances,
var_obj
);
// Release cached frame.
if ( frame_29bdba5324aae2c24553ff6d5c9f67bb == cache_frame_29bdba5324aae2c24553ff6d5c9f67bb )
{
Py_DECREF( frame_29bdba5324aae2c24553ff6d5c9f67bb );
}
cache_frame_29bdba5324aae2c24553ff6d5c9f67bb = NULL;
assertFrameObject( frame_29bdba5324aae2c24553ff6d5c9f67bb );
// Put the previous frame back on top.
popFrameStack();
// Return the error.
goto try_except_handler_1;
frame_no_exception_1:;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_10_add );
return NULL;
// Return handler code:
try_return_handler_1:;
Py_XDECREF( par_self );
par_self = NULL;
Py_XDECREF( par_objs );
par_objs = NULL;
Py_XDECREF( par_source );
par_source = NULL;
Py_XDECREF( par_nullable );
par_nullable = NULL;
Py_XDECREF( par_reverse_dependency );
par_reverse_dependency = NULL;
Py_XDECREF( var_new_objs );
var_new_objs = NULL;
Py_XDECREF( var_model );
var_model = NULL;
Py_XDECREF( var_instances );
var_instances = NULL;
Py_XDECREF( var_obj );
var_obj = NULL;
goto function_return_exit;
// Exception handler code:
try_except_handler_1:;
exception_keeper_type_4 = exception_type;
exception_keeper_value_4 = exception_value;
exception_keeper_tb_4 = exception_tb;
exception_keeper_lineno_4 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( par_self );
par_self = NULL;
Py_XDECREF( par_objs );
par_objs = NULL;
Py_XDECREF( par_source );
par_source = NULL;
Py_XDECREF( par_nullable );
par_nullable = NULL;
Py_XDECREF( par_reverse_dependency );
par_reverse_dependency = NULL;
Py_XDECREF( var_new_objs );
var_new_objs = NULL;
Py_XDECREF( var_model );
var_model = NULL;
Py_XDECREF( var_instances );
var_instances = NULL;
Py_XDECREF( var_obj );
var_obj = NULL;
// Re-raise.
exception_type = exception_keeper_type_4;
exception_value = exception_keeper_value_4;
exception_tb = exception_keeper_tb_4;
exception_lineno = exception_keeper_lineno_4;
goto function_exception_exit;
// End of try:
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_10_add );
return NULL;
function_exception_exit:
assert( exception_type );
RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
return NULL;
function_return_exit:
CHECK_OBJECT( tmp_return_value );
assert( had_error || !ERROR_OCCURRED() );
return tmp_return_value;
}
static PyObject *impl_django$db$models$deletion$$$function_11_add_field_update( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
{
// Preserve error status for checks
#ifndef __NUITKA_NO_ASSERT__
NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
#endif
// Local variable declarations.
PyObject *par_self = python_pars[ 0 ];
PyObject *par_field = python_pars[ 1 ];
PyObject *par_value = python_pars[ 2 ];
PyObject *par_objs = python_pars[ 3 ];
PyObject *var_model = NULL;
PyObject *exception_type = NULL;
PyObject *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
PyObject *tmp_args_element_name_1;
PyObject *tmp_args_element_name_2;
PyObject *tmp_args_element_name_3;
PyObject *tmp_args_element_name_4;
PyObject *tmp_args_element_name_5;
PyObject *tmp_assign_source_1;
PyObject *tmp_called_name_1;
PyObject *tmp_called_name_2;
PyObject *tmp_called_name_3;
int tmp_cond_truth_1;
PyObject *tmp_cond_value_1;
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_subscribed_name_1;
PyObject *tmp_subscript_name_1;
PyObject *tmp_tuple_element_1;
NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
static struct Nuitka_FrameObject *cache_frame_c37c38be553a1b6c0f108c3733c05bf0 = NULL;
struct Nuitka_FrameObject *frame_c37c38be553a1b6c0f108c3733c05bf0;
NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
tmp_return_value = NULL;
// Actual function code.
// Tried code:
MAKE_OR_REUSE_FRAME( cache_frame_c37c38be553a1b6c0f108c3733c05bf0, codeobj_c37c38be553a1b6c0f108c3733c05bf0, module_django$db$models$deletion, sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *) );
frame_c37c38be553a1b6c0f108c3733c05bf0 = cache_frame_c37c38be553a1b6c0f108c3733c05bf0;
// Push the new frame as the currently active one.
pushFrameStack( frame_c37c38be553a1b6c0f108c3733c05bf0 );
// Mark the frame object as in use, ref count 1 will be up for reuse.
assert( Py_REFCNT( frame_c37c38be553a1b6c0f108c3733c05bf0 ) == 2 ); // Frame stack
// Framed code:
tmp_cond_value_1 = par_objs;
CHECK_OBJECT( tmp_cond_value_1 );
tmp_cond_truth_1 = CHECK_IF_TRUE( tmp_cond_value_1 );
if ( tmp_cond_truth_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 113;
type_description_1 = "ooooo";
goto frame_exception_exit_1;
}
if ( tmp_cond_truth_1 == 1 )
{
goto branch_no_1;
}
else
{
goto branch_yes_1;
}
branch_yes_1:;
tmp_return_value = Py_None;
Py_INCREF( tmp_return_value );
goto frame_return_exit_1;
branch_no_1:;
tmp_subscribed_name_1 = par_objs;
if ( tmp_subscribed_name_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 115;
type_description_1 = "ooooo";
goto frame_exception_exit_1;
}
tmp_subscript_name_1 = const_int_0;
tmp_source_name_1 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_1, tmp_subscript_name_1 );
if ( tmp_source_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 115;
type_description_1 = "ooooo";
goto frame_exception_exit_1;
}
tmp_assign_source_1 = LOOKUP_ATTRIBUTE_CLASS_SLOT( tmp_source_name_1 );
Py_DECREF( tmp_source_name_1 );
if ( tmp_assign_source_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 115;
type_description_1 = "ooooo";
goto frame_exception_exit_1;
}
assert( var_model == NULL );
var_model = tmp_assign_source_1;
tmp_source_name_5 = par_self;
if ( tmp_source_name_5 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 116;
type_description_1 = "ooooo";
goto frame_exception_exit_1;
}
tmp_source_name_4 = LOOKUP_ATTRIBUTE( tmp_source_name_5, const_str_plain_field_updates );
if ( tmp_source_name_4 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 116;
type_description_1 = "ooooo";
goto frame_exception_exit_1;
}
tmp_called_name_3 = LOOKUP_ATTRIBUTE( tmp_source_name_4, const_str_plain_setdefault );
Py_DECREF( tmp_source_name_4 );
if ( tmp_called_name_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 116;
type_description_1 = "ooooo";
goto frame_exception_exit_1;
}
tmp_args_element_name_1 = var_model;
if ( tmp_args_element_name_1 == NULL )
{
Py_DECREF( tmp_called_name_3 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "model" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 117;
type_description_1 = "ooooo";
goto frame_exception_exit_1;
}
tmp_args_element_name_2 = PyDict_New();
frame_c37c38be553a1b6c0f108c3733c05bf0->m_frame.f_lineno = 116;
{
PyObject *call_args[] = { tmp_args_element_name_1, tmp_args_element_name_2 };
tmp_source_name_3 = CALL_FUNCTION_WITH_ARGS2( tmp_called_name_3, call_args );
}
Py_DECREF( tmp_called_name_3 );
Py_DECREF( tmp_args_element_name_2 );
if ( tmp_source_name_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 116;
type_description_1 = "ooooo";
goto frame_exception_exit_1;
}
tmp_called_name_2 = LOOKUP_ATTRIBUTE( tmp_source_name_3, const_str_plain_setdefault );
Py_DECREF( tmp_source_name_3 );
if ( tmp_called_name_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 116;
type_description_1 = "ooooo";
goto frame_exception_exit_1;
}
tmp_args_element_name_3 = PyTuple_New( 2 );
tmp_tuple_element_1 = par_field;
if ( tmp_tuple_element_1 == NULL )
{
Py_DECREF( tmp_called_name_2 );
Py_DECREF( tmp_args_element_name_3 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "field" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 118;
type_description_1 = "ooooo";
goto frame_exception_exit_1;
}
Py_INCREF( tmp_tuple_element_1 );
PyTuple_SET_ITEM( tmp_args_element_name_3, 0, tmp_tuple_element_1 );
tmp_tuple_element_1 = par_value;
if ( tmp_tuple_element_1 == NULL )
{
Py_DECREF( tmp_called_name_2 );
Py_DECREF( tmp_args_element_name_3 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "value" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 118;
type_description_1 = "ooooo";
goto frame_exception_exit_1;
}
Py_INCREF( tmp_tuple_element_1 );
PyTuple_SET_ITEM( tmp_args_element_name_3, 1, tmp_tuple_element_1 );
tmp_args_element_name_4 = PySet_New( NULL );
frame_c37c38be553a1b6c0f108c3733c05bf0->m_frame.f_lineno = 116;
{
PyObject *call_args[] = { tmp_args_element_name_3, tmp_args_element_name_4 };
tmp_source_name_2 = CALL_FUNCTION_WITH_ARGS2( tmp_called_name_2, call_args );
}
Py_DECREF( tmp_called_name_2 );
Py_DECREF( tmp_args_element_name_3 );
Py_DECREF( tmp_args_element_name_4 );
if ( tmp_source_name_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 116;
type_description_1 = "ooooo";
goto frame_exception_exit_1;
}
tmp_called_name_1 = LOOKUP_ATTRIBUTE( tmp_source_name_2, const_str_plain_update );
Py_DECREF( tmp_source_name_2 );
if ( tmp_called_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 116;
type_description_1 = "ooooo";
goto frame_exception_exit_1;
}
tmp_args_element_name_5 = par_objs;
if ( tmp_args_element_name_5 == NULL )
{
Py_DECREF( tmp_called_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 118;
type_description_1 = "ooooo";
goto frame_exception_exit_1;
}
frame_c37c38be553a1b6c0f108c3733c05bf0->m_frame.f_lineno = 116;
{
PyObject *call_args[] = { tmp_args_element_name_5 };
tmp_unused = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_1, call_args );
}
Py_DECREF( tmp_called_name_1 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 116;
type_description_1 = "ooooo";
goto frame_exception_exit_1;
}
Py_DECREF( tmp_unused );
#if 0
RESTORE_FRAME_EXCEPTION( frame_c37c38be553a1b6c0f108c3733c05bf0 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto frame_no_exception_1;
frame_return_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_c37c38be553a1b6c0f108c3733c05bf0 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto try_return_handler_1;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_c37c38be553a1b6c0f108c3733c05bf0 );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( frame_c37c38be553a1b6c0f108c3733c05bf0, exception_lineno );
}
else if ( exception_tb->tb_frame != &frame_c37c38be553a1b6c0f108c3733c05bf0->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, frame_c37c38be553a1b6c0f108c3733c05bf0, exception_lineno );
}
// Attachs locals to frame if any.
Nuitka_Frame_AttachLocals(
(struct Nuitka_FrameObject *)frame_c37c38be553a1b6c0f108c3733c05bf0,
type_description_1,
par_self,
par_field,
par_value,
par_objs,
var_model
);
// Release cached frame.
if ( frame_c37c38be553a1b6c0f108c3733c05bf0 == cache_frame_c37c38be553a1b6c0f108c3733c05bf0 )
{
Py_DECREF( frame_c37c38be553a1b6c0f108c3733c05bf0 );
}
cache_frame_c37c38be553a1b6c0f108c3733c05bf0 = NULL;
assertFrameObject( frame_c37c38be553a1b6c0f108c3733c05bf0 );
// Put the previous frame back on top.
popFrameStack();
// Return the error.
goto try_except_handler_1;
frame_no_exception_1:;
tmp_return_value = Py_None;
Py_INCREF( tmp_return_value );
goto try_return_handler_1;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_11_add_field_update );
return NULL;
// Return handler code:
try_return_handler_1:;
Py_XDECREF( par_self );
par_self = NULL;
Py_XDECREF( par_field );
par_field = NULL;
Py_XDECREF( par_value );
par_value = NULL;
Py_XDECREF( par_objs );
par_objs = NULL;
Py_XDECREF( var_model );
var_model = NULL;
goto function_return_exit;
// Exception handler code:
try_except_handler_1:;
exception_keeper_type_1 = exception_type;
exception_keeper_value_1 = exception_value;
exception_keeper_tb_1 = exception_tb;
exception_keeper_lineno_1 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( par_self );
par_self = NULL;
Py_XDECREF( par_field );
par_field = NULL;
Py_XDECREF( par_value );
par_value = NULL;
Py_XDECREF( par_objs );
par_objs = NULL;
Py_XDECREF( var_model );
var_model = NULL;
// Re-raise.
exception_type = exception_keeper_type_1;
exception_value = exception_keeper_value_1;
exception_tb = exception_keeper_tb_1;
exception_lineno = exception_keeper_lineno_1;
goto function_exception_exit;
// End of try:
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_11_add_field_update );
return NULL;
function_exception_exit:
assert( exception_type );
RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
return NULL;
function_return_exit:
CHECK_OBJECT( tmp_return_value );
assert( had_error || !ERROR_OCCURRED() );
return tmp_return_value;
}
static PyObject *impl_django$db$models$deletion$$$function_12_can_fast_delete( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
{
// Preserve error status for checks
#ifndef __NUITKA_NO_ASSERT__
NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
#endif
// Local variable declarations.
PyObject *par_self = python_pars[ 0 ];
PyObject *par_objs = python_pars[ 1 ];
struct Nuitka_CellObject *par_from_field = PyCell_NEW1( python_pars[ 2 ] );
PyObject *var_model = NULL;
PyObject *var_opts = NULL;
PyObject *var_related = NULL;
PyObject *var_field = NULL;
PyObject *tmp_for_loop_1__for_iterator = NULL;
PyObject *tmp_for_loop_1__iter_value = NULL;
PyObject *tmp_for_loop_2__for_iterator = NULL;
PyObject *tmp_for_loop_2__iter_value = NULL;
PyObject *tmp_genexpr_1__$0 = NULL;
PyObject *exception_type = NULL;
PyObject *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
PyObject *exception_keeper_type_2;
PyObject *exception_keeper_value_2;
PyTracebackObject *exception_keeper_tb_2;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_2;
PyObject *exception_keeper_type_3;
PyObject *exception_keeper_value_3;
PyTracebackObject *exception_keeper_tb_3;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_3;
int tmp_and_left_truth_1;
int tmp_and_left_truth_2;
PyObject *tmp_and_left_value_1;
PyObject *tmp_and_left_value_2;
PyObject *tmp_and_right_value_1;
PyObject *tmp_and_right_value_2;
PyObject *tmp_args_element_name_1;
PyObject *tmp_args_element_name_2;
PyObject *tmp_args_element_name_3;
PyObject *tmp_args_element_name_4;
PyObject *tmp_args_element_name_5;
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_called_instance_1;
PyObject *tmp_called_name_1;
PyObject *tmp_called_name_2;
PyObject *tmp_called_name_3;
PyObject *tmp_called_name_4;
PyObject *tmp_called_name_5;
PyObject *tmp_compare_left_1;
PyObject *tmp_compare_right_1;
PyObject *tmp_compexpr_left_1;
PyObject *tmp_compexpr_right_1;
int tmp_cond_truth_1;
int tmp_cond_truth_2;
int tmp_cond_truth_3;
int tmp_cond_truth_4;
PyObject *tmp_cond_value_1;
PyObject *tmp_cond_value_2;
PyObject *tmp_cond_value_3;
PyObject *tmp_cond_value_4;
PyObject *tmp_hasattr_attr_1;
PyObject *tmp_hasattr_attr_2;
PyObject *tmp_hasattr_attr_3;
PyObject *tmp_hasattr_source_1;
PyObject *tmp_hasattr_value_1;
PyObject *tmp_hasattr_value_2;
bool tmp_isnot_1;
PyObject *tmp_iter_arg_1;
PyObject *tmp_iter_arg_2;
PyObject *tmp_iter_arg_3;
PyObject *tmp_next_source_1;
PyObject *tmp_next_source_2;
int tmp_or_left_truth_1;
int tmp_or_left_truth_2;
PyObject *tmp_or_left_value_1;
PyObject *tmp_or_left_value_2;
PyObject *tmp_or_right_value_1;
PyObject *tmp_or_right_value_2;
PyObject *tmp_outline_return_value_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;
PyObject *tmp_source_name_6;
PyObject *tmp_source_name_7;
PyObject *tmp_source_name_8;
PyObject *tmp_source_name_9;
PyObject *tmp_source_name_10;
PyObject *tmp_source_name_11;
PyObject *tmp_source_name_12;
PyObject *tmp_source_name_13;
PyObject *tmp_source_name_14;
PyObject *tmp_source_name_15;
PyObject *tmp_source_name_16;
PyObject *tmp_source_name_17;
PyObject *tmp_source_name_18;
static struct Nuitka_FrameObject *cache_frame_a4ac5ac02c2c8757e9123cd37f196656 = NULL;
struct Nuitka_FrameObject *frame_a4ac5ac02c2c8757e9123cd37f196656;
NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
tmp_return_value = NULL;
tmp_outline_return_value_1 = NULL;
// Actual function code.
// Tried code:
MAKE_OR_REUSE_FRAME( cache_frame_a4ac5ac02c2c8757e9123cd37f196656, codeobj_a4ac5ac02c2c8757e9123cd37f196656, module_django$db$models$deletion, sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *) );
frame_a4ac5ac02c2c8757e9123cd37f196656 = cache_frame_a4ac5ac02c2c8757e9123cd37f196656;
// Push the new frame as the currently active one.
pushFrameStack( frame_a4ac5ac02c2c8757e9123cd37f196656 );
// Mark the frame object as in use, ref count 1 will be up for reuse.
assert( Py_REFCNT( frame_a4ac5ac02c2c8757e9123cd37f196656 ) == 2 ); // Frame stack
// Framed code:
if ( par_from_field == NULL )
{
tmp_and_left_value_1 = NULL;
}
else
{
tmp_and_left_value_1 = PyCell_GET( par_from_field );
}
if ( tmp_and_left_value_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "from_field" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 131;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
tmp_and_left_truth_1 = CHECK_IF_TRUE( tmp_and_left_value_1 );
if ( tmp_and_left_truth_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 131;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
if ( tmp_and_left_truth_1 == 1 )
{
goto and_right_1;
}
else
{
goto and_left_1;
}
and_right_1:;
if ( par_from_field == NULL )
{
tmp_source_name_2 = NULL;
}
else
{
tmp_source_name_2 = PyCell_GET( par_from_field );
}
if ( tmp_source_name_2 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "from_field" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 131;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
tmp_source_name_1 = LOOKUP_ATTRIBUTE( tmp_source_name_2, const_str_plain_remote_field );
if ( tmp_source_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 131;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
tmp_compexpr_left_1 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_on_delete );
Py_DECREF( tmp_source_name_1 );
if ( tmp_compexpr_left_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 131;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
tmp_compexpr_right_1 = GET_STRING_DICT_VALUE( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_CASCADE );
if (unlikely( tmp_compexpr_right_1 == NULL ))
{
tmp_compexpr_right_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_CASCADE );
}
if ( tmp_compexpr_right_1 == NULL )
{
Py_DECREF( tmp_compexpr_left_1 );
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "CASCADE" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 131;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
tmp_and_right_value_1 = BOOL_FROM( tmp_compexpr_left_1 != tmp_compexpr_right_1 );
Py_DECREF( tmp_compexpr_left_1 );
tmp_cond_value_1 = tmp_and_right_value_1;
goto and_end_1;
and_left_1:;
tmp_cond_value_1 = tmp_and_left_value_1;
and_end_1:;
tmp_cond_truth_1 = CHECK_IF_TRUE( tmp_cond_value_1 );
if ( tmp_cond_truth_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 131;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
if ( tmp_cond_truth_1 == 1 )
{
goto branch_yes_1;
}
else
{
goto branch_no_1;
}
branch_yes_1:;
tmp_return_value = Py_False;
Py_INCREF( tmp_return_value );
goto frame_return_exit_1;
branch_no_1:;
tmp_hasattr_value_1 = par_objs;
if ( tmp_hasattr_value_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 133;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
tmp_hasattr_attr_1 = const_str_plain_model;
tmp_and_left_value_2 = BUILTIN_HASATTR( tmp_hasattr_value_1, tmp_hasattr_attr_1 );
if ( tmp_and_left_value_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 133;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
tmp_and_left_truth_2 = CHECK_IF_TRUE( tmp_and_left_value_2 );
if ( tmp_and_left_truth_2 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 133;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
if ( tmp_and_left_truth_2 == 1 )
{
goto and_right_2;
}
else
{
goto and_left_2;
}
and_right_2:;
tmp_hasattr_value_2 = par_objs;
if ( tmp_hasattr_value_2 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 133;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
tmp_hasattr_attr_2 = const_str_plain__raw_delete;
tmp_and_right_value_2 = BUILTIN_HASATTR( tmp_hasattr_value_2, tmp_hasattr_attr_2 );
if ( tmp_and_right_value_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 133;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
tmp_cond_value_2 = tmp_and_right_value_2;
goto and_end_2;
and_left_2:;
tmp_cond_value_2 = tmp_and_left_value_2;
and_end_2:;
tmp_cond_truth_2 = CHECK_IF_TRUE( tmp_cond_value_2 );
if ( tmp_cond_truth_2 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 133;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
if ( tmp_cond_truth_2 == 1 )
{
goto branch_no_2;
}
else
{
goto branch_yes_2;
}
branch_yes_2:;
tmp_return_value = Py_False;
Py_INCREF( tmp_return_value );
goto frame_return_exit_1;
branch_no_2:;
tmp_source_name_3 = par_objs;
if ( tmp_source_name_3 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 135;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
tmp_assign_source_1 = LOOKUP_ATTRIBUTE( tmp_source_name_3, const_str_plain_model );
if ( tmp_assign_source_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 135;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
assert( var_model == NULL );
var_model = tmp_assign_source_1;
tmp_source_name_5 = GET_STRING_DICT_VALUE( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_signals );
if (unlikely( tmp_source_name_5 == NULL ))
{
tmp_source_name_5 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_signals );
}
if ( tmp_source_name_5 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "signals" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 136;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
tmp_source_name_4 = LOOKUP_ATTRIBUTE( tmp_source_name_5, const_str_plain_pre_delete );
if ( tmp_source_name_4 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 136;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
tmp_called_name_1 = LOOKUP_ATTRIBUTE( tmp_source_name_4, const_str_plain_has_listeners );
Py_DECREF( tmp_source_name_4 );
if ( tmp_called_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 136;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
tmp_args_element_name_1 = var_model;
if ( tmp_args_element_name_1 == NULL )
{
Py_DECREF( tmp_called_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "model" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 136;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
frame_a4ac5ac02c2c8757e9123cd37f196656->m_frame.f_lineno = 136;
{
PyObject *call_args[] = { tmp_args_element_name_1 };
tmp_or_left_value_1 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_1, call_args );
}
Py_DECREF( tmp_called_name_1 );
if ( tmp_or_left_value_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 136;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
tmp_or_left_truth_1 = CHECK_IF_TRUE( tmp_or_left_value_1 );
if ( tmp_or_left_truth_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_or_left_value_1 );
exception_lineno = 138;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
if ( tmp_or_left_truth_1 == 1 )
{
goto or_left_1;
}
else
{
goto or_right_1;
}
or_right_1:;
Py_DECREF( tmp_or_left_value_1 );
tmp_source_name_7 = GET_STRING_DICT_VALUE( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_signals );
if (unlikely( tmp_source_name_7 == NULL ))
{
tmp_source_name_7 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_signals );
}
if ( tmp_source_name_7 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "signals" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 137;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
tmp_source_name_6 = LOOKUP_ATTRIBUTE( tmp_source_name_7, const_str_plain_post_delete );
if ( tmp_source_name_6 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 137;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
tmp_called_name_2 = LOOKUP_ATTRIBUTE( tmp_source_name_6, const_str_plain_has_listeners );
Py_DECREF( tmp_source_name_6 );
if ( tmp_called_name_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 137;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
tmp_args_element_name_2 = var_model;
if ( tmp_args_element_name_2 == NULL )
{
Py_DECREF( tmp_called_name_2 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "model" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 137;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
frame_a4ac5ac02c2c8757e9123cd37f196656->m_frame.f_lineno = 137;
{
PyObject *call_args[] = { tmp_args_element_name_2 };
tmp_or_left_value_2 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_2, call_args );
}
Py_DECREF( tmp_called_name_2 );
if ( tmp_or_left_value_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 137;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
tmp_or_left_truth_2 = CHECK_IF_TRUE( tmp_or_left_value_2 );
if ( tmp_or_left_truth_2 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_or_left_value_2 );
exception_lineno = 138;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
if ( tmp_or_left_truth_2 == 1 )
{
goto or_left_2;
}
else
{
goto or_right_2;
}
or_right_2:;
Py_DECREF( tmp_or_left_value_2 );
tmp_source_name_9 = GET_STRING_DICT_VALUE( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_signals );
if (unlikely( tmp_source_name_9 == NULL ))
{
tmp_source_name_9 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_signals );
}
if ( tmp_source_name_9 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "signals" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 138;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
tmp_source_name_8 = LOOKUP_ATTRIBUTE( tmp_source_name_9, const_str_plain_m2m_changed );
if ( tmp_source_name_8 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 138;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
tmp_called_name_3 = LOOKUP_ATTRIBUTE( tmp_source_name_8, const_str_plain_has_listeners );
Py_DECREF( tmp_source_name_8 );
if ( tmp_called_name_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 138;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
tmp_args_element_name_3 = var_model;
if ( tmp_args_element_name_3 == NULL )
{
Py_DECREF( tmp_called_name_3 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "model" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 138;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
frame_a4ac5ac02c2c8757e9123cd37f196656->m_frame.f_lineno = 138;
{
PyObject *call_args[] = { tmp_args_element_name_3 };
tmp_or_right_value_2 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_3, call_args );
}
Py_DECREF( tmp_called_name_3 );
if ( tmp_or_right_value_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 138;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
tmp_or_right_value_1 = tmp_or_right_value_2;
goto or_end_2;
or_left_2:;
tmp_or_right_value_1 = tmp_or_left_value_2;
or_end_2:;
tmp_cond_value_3 = tmp_or_right_value_1;
goto or_end_1;
or_left_1:;
tmp_cond_value_3 = tmp_or_left_value_1;
or_end_1:;
tmp_cond_truth_3 = CHECK_IF_TRUE( tmp_cond_value_3 );
if ( tmp_cond_truth_3 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_cond_value_3 );
exception_lineno = 138;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
Py_DECREF( tmp_cond_value_3 );
if ( tmp_cond_truth_3 == 1 )
{
goto branch_yes_3;
}
else
{
goto branch_no_3;
}
branch_yes_3:;
tmp_return_value = Py_False;
Py_INCREF( tmp_return_value );
goto frame_return_exit_1;
branch_no_3:;
tmp_source_name_10 = var_model;
if ( tmp_source_name_10 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "model" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 142;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
tmp_assign_source_2 = LOOKUP_ATTRIBUTE( tmp_source_name_10, const_str_plain__meta );
if ( tmp_assign_source_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 142;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
assert( var_opts == NULL );
var_opts = tmp_assign_source_2;
tmp_called_name_4 = LOOKUP_BUILTIN( const_str_plain_any );
assert( tmp_called_name_4 != NULL );
tmp_source_name_13 = var_opts;
CHECK_OBJECT( tmp_source_name_13 );
tmp_source_name_12 = LOOKUP_ATTRIBUTE( tmp_source_name_13, const_str_plain_concrete_model );
if ( tmp_source_name_12 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 143;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
tmp_source_name_11 = LOOKUP_ATTRIBUTE( tmp_source_name_12, const_str_plain__meta );
Py_DECREF( tmp_source_name_12 );
if ( tmp_source_name_11 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 143;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
tmp_called_instance_1 = LOOKUP_ATTRIBUTE( tmp_source_name_11, const_str_plain_parents );
Py_DECREF( tmp_source_name_11 );
if ( tmp_called_instance_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 143;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
frame_a4ac5ac02c2c8757e9123cd37f196656->m_frame.f_lineno = 143;
tmp_iter_arg_1 = CALL_METHOD_NO_ARGS( tmp_called_instance_1, const_str_plain_values );
Py_DECREF( tmp_called_instance_1 );
if ( tmp_iter_arg_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 143;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
tmp_assign_source_3 = MAKE_ITERATOR( tmp_iter_arg_1 );
Py_DECREF( tmp_iter_arg_1 );
if ( tmp_assign_source_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 143;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
assert( tmp_genexpr_1__$0 == NULL );
tmp_genexpr_1__$0 = tmp_assign_source_3;
// Tried code:
tmp_outline_return_value_1 = Nuitka_Generator_New(
django$db$models$deletion$$$function_12_can_fast_delete$$$genexpr_1_genexpr_context,
module_django$db$models$deletion,
const_str_angle_genexpr,
#if PYTHON_VERSION >= 350
const_str_digest_326cfea7fac86133f31d954412935b81,
#endif
codeobj_4b00f26fa23ce9cf84eb4ee268fff765,
2
);
((struct Nuitka_GeneratorObject *)tmp_outline_return_value_1)->m_closure[0] = par_from_field;
Py_INCREF( ((struct Nuitka_GeneratorObject *)tmp_outline_return_value_1)->m_closure[0] );
((struct Nuitka_GeneratorObject *)tmp_outline_return_value_1)->m_closure[1] = PyCell_NEW0( tmp_genexpr_1__$0 );
assert( Py_SIZE( tmp_outline_return_value_1 ) >= 2 );
goto try_return_handler_2;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_12_can_fast_delete );
return NULL;
// Return handler code:
try_return_handler_2:;
CHECK_OBJECT( (PyObject *)tmp_genexpr_1__$0 );
Py_DECREF( tmp_genexpr_1__$0 );
tmp_genexpr_1__$0 = NULL;
goto outline_result_1;
// End of try:
CHECK_OBJECT( (PyObject *)tmp_genexpr_1__$0 );
Py_DECREF( tmp_genexpr_1__$0 );
tmp_genexpr_1__$0 = NULL;
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_12_can_fast_delete );
return NULL;
outline_result_1:;
tmp_args_element_name_4 = tmp_outline_return_value_1;
frame_a4ac5ac02c2c8757e9123cd37f196656->m_frame.f_lineno = 143;
{
PyObject *call_args[] = { tmp_args_element_name_4 };
tmp_cond_value_4 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_4, call_args );
}
Py_DECREF( tmp_args_element_name_4 );
if ( tmp_cond_value_4 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 143;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
tmp_cond_truth_4 = CHECK_IF_TRUE( tmp_cond_value_4 );
if ( tmp_cond_truth_4 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_cond_value_4 );
exception_lineno = 143;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
Py_DECREF( tmp_cond_value_4 );
if ( tmp_cond_truth_4 == 1 )
{
goto branch_yes_4;
}
else
{
goto branch_no_4;
}
branch_yes_4:;
tmp_return_value = Py_False;
Py_INCREF( tmp_return_value );
goto frame_return_exit_1;
branch_no_4:;
tmp_called_name_5 = GET_STRING_DICT_VALUE( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_get_candidate_relations_to_delete );
if (unlikely( tmp_called_name_5 == NULL ))
{
tmp_called_name_5 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_get_candidate_relations_to_delete );
}
if ( tmp_called_name_5 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "get_candidate_relations_to_delete" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 147;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
tmp_args_element_name_5 = var_opts;
if ( tmp_args_element_name_5 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "opts" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 147;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
frame_a4ac5ac02c2c8757e9123cd37f196656->m_frame.f_lineno = 147;
{
PyObject *call_args[] = { tmp_args_element_name_5 };
tmp_iter_arg_2 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_5, call_args );
}
if ( tmp_iter_arg_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 147;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
tmp_assign_source_4 = MAKE_ITERATOR( tmp_iter_arg_2 );
Py_DECREF( tmp_iter_arg_2 );
if ( tmp_assign_source_4 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 147;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
assert( tmp_for_loop_1__for_iterator == NULL );
tmp_for_loop_1__for_iterator = tmp_assign_source_4;
// Tried code:
loop_start_1:;
tmp_next_source_1 = tmp_for_loop_1__for_iterator;
CHECK_OBJECT( tmp_next_source_1 );
tmp_assign_source_5 = ITERATOR_NEXT( tmp_next_source_1 );
if ( tmp_assign_source_5 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_1;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oocoooo";
exception_lineno = 147;
goto try_except_handler_3;
}
}
{
PyObject *old = tmp_for_loop_1__iter_value;
tmp_for_loop_1__iter_value = tmp_assign_source_5;
Py_XDECREF( old );
}
tmp_assign_source_6 = tmp_for_loop_1__iter_value;
CHECK_OBJECT( tmp_assign_source_6 );
{
PyObject *old = var_related;
var_related = tmp_assign_source_6;
Py_INCREF( var_related );
Py_XDECREF( old );
}
tmp_source_name_16 = var_related;
CHECK_OBJECT( tmp_source_name_16 );
tmp_source_name_15 = LOOKUP_ATTRIBUTE( tmp_source_name_16, const_str_plain_field );
if ( tmp_source_name_15 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 148;
type_description_1 = "oocoooo";
goto try_except_handler_3;
}
tmp_source_name_14 = LOOKUP_ATTRIBUTE( tmp_source_name_15, const_str_plain_remote_field );
Py_DECREF( tmp_source_name_15 );
if ( tmp_source_name_14 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 148;
type_description_1 = "oocoooo";
goto try_except_handler_3;
}
tmp_compare_left_1 = LOOKUP_ATTRIBUTE( tmp_source_name_14, const_str_plain_on_delete );
Py_DECREF( tmp_source_name_14 );
if ( tmp_compare_left_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 148;
type_description_1 = "oocoooo";
goto try_except_handler_3;
}
tmp_compare_right_1 = GET_STRING_DICT_VALUE( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_DO_NOTHING );
if (unlikely( tmp_compare_right_1 == NULL ))
{
tmp_compare_right_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_DO_NOTHING );
}
if ( tmp_compare_right_1 == NULL )
{
Py_DECREF( tmp_compare_left_1 );
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "DO_NOTHING" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 148;
type_description_1 = "oocoooo";
goto try_except_handler_3;
}
tmp_isnot_1 = ( tmp_compare_left_1 != tmp_compare_right_1 );
Py_DECREF( tmp_compare_left_1 );
if ( tmp_isnot_1 )
{
goto branch_yes_5;
}
else
{
goto branch_no_5;
}
branch_yes_5:;
tmp_return_value = Py_False;
Py_INCREF( tmp_return_value );
goto try_return_handler_3;
branch_no_5:;
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 147;
type_description_1 = "oocoooo";
goto try_except_handler_3;
}
goto loop_start_1;
loop_end_1:;
goto try_end_1;
// Return handler code:
try_return_handler_3:;
Py_XDECREF( tmp_for_loop_1__iter_value );
tmp_for_loop_1__iter_value = NULL;
Py_XDECREF( tmp_for_loop_1__for_iterator );
tmp_for_loop_1__for_iterator = NULL;
goto frame_return_exit_1;
// Exception handler code:
try_except_handler_3:;
exception_keeper_type_1 = exception_type;
exception_keeper_value_1 = exception_value;
exception_keeper_tb_1 = exception_tb;
exception_keeper_lineno_1 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_for_loop_1__iter_value );
tmp_for_loop_1__iter_value = NULL;
Py_XDECREF( tmp_for_loop_1__for_iterator );
tmp_for_loop_1__for_iterator = NULL;
// Re-raise.
exception_type = exception_keeper_type_1;
exception_value = exception_keeper_value_1;
exception_tb = exception_keeper_tb_1;
exception_lineno = exception_keeper_lineno_1;
goto frame_exception_exit_1;
// End of try:
try_end_1:;
Py_XDECREF( tmp_for_loop_1__iter_value );
tmp_for_loop_1__iter_value = NULL;
Py_XDECREF( tmp_for_loop_1__for_iterator );
tmp_for_loop_1__for_iterator = NULL;
tmp_source_name_18 = var_model;
if ( tmp_source_name_18 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "model" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 150;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
tmp_source_name_17 = LOOKUP_ATTRIBUTE( tmp_source_name_18, const_str_plain__meta );
if ( tmp_source_name_17 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 150;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
tmp_iter_arg_3 = LOOKUP_ATTRIBUTE( tmp_source_name_17, const_str_plain_private_fields );
Py_DECREF( tmp_source_name_17 );
if ( tmp_iter_arg_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 150;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
tmp_assign_source_7 = MAKE_ITERATOR( tmp_iter_arg_3 );
Py_DECREF( tmp_iter_arg_3 );
if ( tmp_assign_source_7 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 150;
type_description_1 = "oocoooo";
goto frame_exception_exit_1;
}
assert( tmp_for_loop_2__for_iterator == NULL );
tmp_for_loop_2__for_iterator = tmp_assign_source_7;
// Tried code:
loop_start_2:;
tmp_next_source_2 = tmp_for_loop_2__for_iterator;
CHECK_OBJECT( tmp_next_source_2 );
tmp_assign_source_8 = ITERATOR_NEXT( tmp_next_source_2 );
if ( tmp_assign_source_8 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_2;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oocoooo";
exception_lineno = 150;
goto try_except_handler_4;
}
}
{
PyObject *old = tmp_for_loop_2__iter_value;
tmp_for_loop_2__iter_value = tmp_assign_source_8;
Py_XDECREF( old );
}
tmp_assign_source_9 = tmp_for_loop_2__iter_value;
CHECK_OBJECT( tmp_assign_source_9 );
{
PyObject *old = var_field;
var_field = tmp_assign_source_9;
Py_INCREF( var_field );
Py_XDECREF( old );
}
tmp_hasattr_source_1 = var_field;
CHECK_OBJECT( tmp_hasattr_source_1 );
tmp_hasattr_attr_3 = const_str_plain_bulk_related_objects;
tmp_res = PyObject_HasAttr( tmp_hasattr_source_1, tmp_hasattr_attr_3 );
if ( tmp_res == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 151;
type_description_1 = "oocoooo";
goto try_except_handler_4;
}
if ( tmp_res == 1 )
{
goto branch_yes_6;
}
else
{
goto branch_no_6;
}
branch_yes_6:;
tmp_return_value = Py_False;
Py_INCREF( tmp_return_value );
goto try_return_handler_4;
branch_no_6:;
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 150;
type_description_1 = "oocoooo";
goto try_except_handler_4;
}
goto loop_start_2;
loop_end_2:;
goto try_end_2;
// Return handler code:
try_return_handler_4:;
CHECK_OBJECT( (PyObject *)tmp_for_loop_2__iter_value );
Py_DECREF( tmp_for_loop_2__iter_value );
tmp_for_loop_2__iter_value = NULL;
Py_XDECREF( tmp_for_loop_2__for_iterator );
tmp_for_loop_2__for_iterator = NULL;
goto frame_return_exit_1;
// Exception handler code:
try_except_handler_4:;
exception_keeper_type_2 = exception_type;
exception_keeper_value_2 = exception_value;
exception_keeper_tb_2 = exception_tb;
exception_keeper_lineno_2 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_for_loop_2__iter_value );
tmp_for_loop_2__iter_value = NULL;
Py_XDECREF( tmp_for_loop_2__for_iterator );
tmp_for_loop_2__for_iterator = NULL;
// Re-raise.
exception_type = exception_keeper_type_2;
exception_value = exception_keeper_value_2;
exception_tb = exception_keeper_tb_2;
exception_lineno = exception_keeper_lineno_2;
goto frame_exception_exit_1;
// End of try:
try_end_2:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_a4ac5ac02c2c8757e9123cd37f196656 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto frame_no_exception_1;
frame_return_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_a4ac5ac02c2c8757e9123cd37f196656 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto try_return_handler_1;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_a4ac5ac02c2c8757e9123cd37f196656 );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( frame_a4ac5ac02c2c8757e9123cd37f196656, exception_lineno );
}
else if ( exception_tb->tb_frame != &frame_a4ac5ac02c2c8757e9123cd37f196656->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, frame_a4ac5ac02c2c8757e9123cd37f196656, exception_lineno );
}
// Attachs locals to frame if any.
Nuitka_Frame_AttachLocals(
(struct Nuitka_FrameObject *)frame_a4ac5ac02c2c8757e9123cd37f196656,
type_description_1,
par_self,
par_objs,
par_from_field,
var_model,
var_opts,
var_related,
var_field
);
// Release cached frame.
if ( frame_a4ac5ac02c2c8757e9123cd37f196656 == cache_frame_a4ac5ac02c2c8757e9123cd37f196656 )
{
Py_DECREF( frame_a4ac5ac02c2c8757e9123cd37f196656 );
}
cache_frame_a4ac5ac02c2c8757e9123cd37f196656 = NULL;
assertFrameObject( frame_a4ac5ac02c2c8757e9123cd37f196656 );
// Put the previous frame back on top.
popFrameStack();
// Return the error.
goto try_except_handler_1;
frame_no_exception_1:;
Py_XDECREF( tmp_for_loop_2__iter_value );
tmp_for_loop_2__iter_value = NULL;
Py_XDECREF( tmp_for_loop_2__for_iterator );
tmp_for_loop_2__for_iterator = NULL;
tmp_return_value = Py_True;
Py_INCREF( tmp_return_value );
goto try_return_handler_1;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_12_can_fast_delete );
return NULL;
// Return handler code:
try_return_handler_1:;
Py_XDECREF( par_self );
par_self = NULL;
Py_XDECREF( par_objs );
par_objs = NULL;
CHECK_OBJECT( (PyObject *)par_from_field );
Py_DECREF( par_from_field );
par_from_field = NULL;
Py_XDECREF( var_model );
var_model = NULL;
Py_XDECREF( var_opts );
var_opts = NULL;
Py_XDECREF( var_related );
var_related = NULL;
Py_XDECREF( var_field );
var_field = NULL;
goto function_return_exit;
// Exception handler code:
try_except_handler_1:;
exception_keeper_type_3 = exception_type;
exception_keeper_value_3 = exception_value;
exception_keeper_tb_3 = exception_tb;
exception_keeper_lineno_3 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( par_self );
par_self = NULL;
Py_XDECREF( par_objs );
par_objs = NULL;
CHECK_OBJECT( (PyObject *)par_from_field );
Py_DECREF( par_from_field );
par_from_field = NULL;
Py_XDECREF( var_model );
var_model = NULL;
Py_XDECREF( var_opts );
var_opts = NULL;
Py_XDECREF( var_related );
var_related = NULL;
Py_XDECREF( var_field );
var_field = NULL;
// Re-raise.
exception_type = exception_keeper_type_3;
exception_value = exception_keeper_value_3;
exception_tb = exception_keeper_tb_3;
exception_lineno = exception_keeper_lineno_3;
goto function_exception_exit;
// End of try:
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_12_can_fast_delete );
return NULL;
function_exception_exit:
assert( exception_type );
RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
return NULL;
function_return_exit:
CHECK_OBJECT( tmp_return_value );
assert( had_error || !ERROR_OCCURRED() );
return tmp_return_value;
}
#if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
struct django$db$models$deletion$$$function_12_can_fast_delete$$$genexpr_1_genexpr_locals {
PyObject *var_link
PyObject *tmp_iter_value_0
PyObject *exception_type
PyObject *exception_value
PyTracebackObject *exception_tb
int exception_lineno
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
int exception_keeper_lineno_1;
PyObject *exception_keeper_type_2;
PyObject *exception_keeper_value_2;
PyTracebackObject *exception_keeper_tb_2;
int exception_keeper_lineno_2;
PyObject *tmp_assign_source_1;
PyObject *tmp_assign_source_2;
PyObject *tmp_compexpr_left_1;
PyObject *tmp_compexpr_right_1;
PyObject *tmp_expression_name_1;
PyObject *tmp_next_source_1;
char const *type_description_1
};
#endif
#if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
static PyObject *django$db$models$deletion$$$function_12_can_fast_delete$$$genexpr_1_genexpr_context( struct Nuitka_GeneratorObject *generator, PyObject *yield_return_value )
#else
static void django$db$models$deletion$$$function_12_can_fast_delete$$$genexpr_1_genexpr_context( struct Nuitka_GeneratorObject *generator )
#endif
{
CHECK_OBJECT( (PyObject *)generator );
assert( Nuitka_Generator_Check( (PyObject *)generator ) );
// Local variable initialization
PyObject *var_link = NULL;
PyObject *tmp_iter_value_0 = NULL;
PyObject *exception_type = NULL;
PyObject *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
PyObject *exception_keeper_type_2;
PyObject *exception_keeper_value_2;
PyTracebackObject *exception_keeper_tb_2;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_2;
PyObject *tmp_assign_source_1;
PyObject *tmp_assign_source_2;
PyObject *tmp_compexpr_left_1;
PyObject *tmp_compexpr_right_1;
PyObject *tmp_expression_name_1;
PyObject *tmp_next_source_1;
NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
static struct Nuitka_FrameObject *cache_frame_generator = NULL;
NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
// Dispatch to yield based on return label index:
// Actual function code.
// Tried code:
MAKE_OR_REUSE_FRAME( cache_frame_generator, codeobj_4b00f26fa23ce9cf84eb4ee268fff765, module_django$db$models$deletion, sizeof(void *)+sizeof(void *)+sizeof(void *) );
generator->m_frame = cache_frame_generator;
// Mark the frame object as in use, ref count 1 will be up for reuse.
Py_INCREF( generator->m_frame );
assert( Py_REFCNT( generator->m_frame ) == 2 ); // Frame stack
#if PYTHON_VERSION >= 340
generator->m_frame->m_frame.f_gen = (PyObject *)generator;
#endif
Py_CLEAR( generator->m_frame->m_frame.f_back );
generator->m_frame->m_frame.f_back = PyThreadState_GET()->frame;
Py_INCREF( generator->m_frame->m_frame.f_back );
PyThreadState_GET()->frame = &generator->m_frame->m_frame;
Py_INCREF( generator->m_frame );
Nuitka_Frame_MarkAsExecuting( generator->m_frame );
#if PYTHON_VERSION >= 300
// Accept currently existing exception as the one to publish again when we
// yield or yield from.
PyThreadState *thread_state = PyThreadState_GET();
generator->m_frame->m_frame.f_exc_type = thread_state->exc_type;
if ( generator->m_frame->m_frame.f_exc_type == Py_None ) generator->m_frame->m_frame.f_exc_type = NULL;
Py_XINCREF( generator->m_frame->m_frame.f_exc_type );
generator->m_frame->m_frame.f_exc_value = thread_state->exc_value;
Py_XINCREF( generator->m_frame->m_frame.f_exc_value );
generator->m_frame->m_frame.f_exc_traceback = thread_state->exc_traceback;
Py_XINCREF( generator->m_frame->m_frame.f_exc_traceback );
#endif
// Framed code:
// Tried code:
loop_start_1:;
if ( generator->m_closure[1] == NULL )
{
tmp_next_source_1 = NULL;
}
else
{
tmp_next_source_1 = PyCell_GET( generator->m_closure[1] );
}
CHECK_OBJECT( tmp_next_source_1 );
tmp_assign_source_1 = ITERATOR_NEXT( tmp_next_source_1 );
if ( tmp_assign_source_1 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_1;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "Noc";
exception_lineno = 143;
goto try_except_handler_2;
}
}
{
PyObject *old = tmp_iter_value_0;
tmp_iter_value_0 = tmp_assign_source_1;
Py_XDECREF( old );
}
tmp_assign_source_2 = tmp_iter_value_0;
CHECK_OBJECT( tmp_assign_source_2 );
{
PyObject *old = var_link;
var_link = tmp_assign_source_2;
Py_INCREF( var_link );
Py_XDECREF( old );
}
tmp_compexpr_left_1 = var_link;
CHECK_OBJECT( tmp_compexpr_left_1 );
if ( generator->m_closure[0] == NULL )
{
tmp_compexpr_right_1 = NULL;
}
else
{
tmp_compexpr_right_1 = PyCell_GET( generator->m_closure[0] );
}
if ( tmp_compexpr_right_1 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "free variable '%s' referenced before assignment in enclosing scope", "from_field" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 143;
type_description_1 = "Noc";
goto try_except_handler_2;
}
tmp_expression_name_1 = RICH_COMPARE_NE( tmp_compexpr_left_1, tmp_compexpr_right_1 );
if ( tmp_expression_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 143;
type_description_1 = "Noc";
goto try_except_handler_2;
}
tmp_unused = GENERATOR_YIELD( generator, tmp_expression_name_1 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 143;
type_description_1 = "Noc";
goto try_except_handler_2;
}
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 143;
type_description_1 = "Noc";
goto try_except_handler_2;
}
goto loop_start_1;
loop_end_1:;
goto try_end_1;
// Exception handler code:
try_except_handler_2:;
exception_keeper_type_1 = exception_type;
exception_keeper_value_1 = exception_value;
exception_keeper_tb_1 = exception_tb;
exception_keeper_lineno_1 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_iter_value_0 );
tmp_iter_value_0 = NULL;
// Re-raise.
exception_type = exception_keeper_type_1;
exception_value = exception_keeper_value_1;
exception_tb = exception_keeper_tb_1;
exception_lineno = exception_keeper_lineno_1;
goto frame_exception_exit_1;
// End of try:
try_end_1:;
Nuitka_Frame_MarkAsNotExecuting( generator->m_frame );
#if PYTHON_VERSION >= 300
Py_CLEAR( generator->m_frame->m_frame.f_exc_type );
Py_CLEAR( generator->m_frame->m_frame.f_exc_value );
Py_CLEAR( generator->m_frame->m_frame.f_exc_traceback );
#endif
// Allow re-use of the frame again.
Py_DECREF( generator->m_frame );
goto frame_no_exception_1;
frame_exception_exit_1:;
// If it's not an exit exception, consider and create a traceback for it.
if ( !EXCEPTION_MATCH_GENERATOR( exception_type ) )
{
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( generator->m_frame, exception_lineno );
}
else if ( exception_tb->tb_frame != &generator->m_frame->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, generator->m_frame, exception_lineno );
}
Nuitka_Frame_AttachLocals(
(struct Nuitka_FrameObject *)generator->m_frame,
type_description_1,
NULL,
var_link,
generator->m_closure[0]
);
// Release cached frame.
if ( generator->m_frame == cache_frame_generator )
{
Py_DECREF( generator->m_frame );
}
cache_frame_generator = NULL;
assertFrameObject( generator->m_frame );
}
#if PYTHON_VERSION >= 300
Py_CLEAR( generator->m_frame->m_frame.f_exc_type );
Py_CLEAR( generator->m_frame->m_frame.f_exc_value );
Py_CLEAR( generator->m_frame->m_frame.f_exc_traceback );
#endif
Py_DECREF( generator->m_frame );
// Return the error.
goto try_except_handler_1;
frame_no_exception_1:;
goto try_end_2;
// Exception handler code:
try_except_handler_1:;
exception_keeper_type_2 = exception_type;
exception_keeper_value_2 = exception_value;
exception_keeper_tb_2 = exception_tb;
exception_keeper_lineno_2 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( var_link );
var_link = NULL;
// Re-raise.
exception_type = exception_keeper_type_2;
exception_value = exception_keeper_value_2;
exception_tb = exception_keeper_tb_2;
exception_lineno = exception_keeper_lineno_2;
goto function_exception_exit;
// End of try:
try_end_2:;
Py_XDECREF( tmp_iter_value_0 );
tmp_iter_value_0 = NULL;
Py_XDECREF( var_link );
var_link = NULL;
#if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
return NULL;
#else
generator->m_yielded = NULL;
return;
#endif
function_exception_exit:
assert( exception_type );
RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
#if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
return NULL;
#else
generator->m_yielded = NULL;
return;
#endif
}
static PyObject *impl_django$db$models$deletion$$$function_13_get_del_batches( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
{
// Preserve error status for checks
#ifndef __NUITKA_NO_ASSERT__
NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
#endif
// Local variable declarations.
PyObject *par_self = python_pars[ 0 ];
PyObject *par_objs = python_pars[ 1 ];
PyObject *par_field = python_pars[ 2 ];
PyObject *var_conn_batch_size = NULL;
PyObject *outline_0_var_i = NULL;
PyObject *tmp_listcontraction_1__$0 = NULL;
PyObject *tmp_listcontraction_1__contraction = NULL;
PyObject *tmp_listcontraction_1__iter_value_0 = NULL;
PyObject *exception_type = NULL;
PyObject *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
PyObject *exception_keeper_type_2;
PyObject *exception_keeper_value_2;
PyTracebackObject *exception_keeper_tb_2;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_2;
PyObject *exception_keeper_type_3;
PyObject *exception_keeper_value_3;
PyTracebackObject *exception_keeper_tb_3;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_3;
PyObject *tmp_append_list_1;
PyObject *tmp_append_value_1;
PyObject *tmp_args_element_name_1;
PyObject *tmp_args_element_name_2;
PyObject *tmp_args_element_name_3;
PyObject *tmp_args_element_name_4;
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_called_name_1;
PyObject *tmp_called_name_2;
int tmp_cmp_Gt_1;
PyObject *tmp_compare_left_1;
PyObject *tmp_compare_right_1;
PyObject *tmp_iter_arg_1;
PyObject *tmp_left_name_1;
PyObject *tmp_len_arg_1;
PyObject *tmp_len_arg_2;
PyObject *tmp_list_element_1;
PyObject *tmp_list_element_2;
PyObject *tmp_next_source_1;
PyObject *tmp_outline_return_value_1;
int tmp_res;
PyObject *tmp_return_value;
PyObject *tmp_right_name_1;
PyObject *tmp_source_name_1;
PyObject *tmp_source_name_2;
PyObject *tmp_source_name_3;
PyObject *tmp_source_name_4;
PyObject *tmp_start_name_1;
PyObject *tmp_step_name_1;
PyObject *tmp_stop_name_1;
PyObject *tmp_subscribed_name_1;
PyObject *tmp_subscribed_name_2;
PyObject *tmp_subscript_name_1;
PyObject *tmp_subscript_name_2;
PyObject *tmp_xrange_high_1;
PyObject *tmp_xrange_low_1;
PyObject *tmp_xrange_step_1;
static struct Nuitka_FrameObject *cache_frame_3c1bb6457a1f70db422aa5e68969fc61_2 = NULL;
struct Nuitka_FrameObject *frame_3c1bb6457a1f70db422aa5e68969fc61_2;
static struct Nuitka_FrameObject *cache_frame_6f3ca5631f310a307e49f023c6b223c1 = NULL;
struct Nuitka_FrameObject *frame_6f3ca5631f310a307e49f023c6b223c1;
NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
NUITKA_MAY_BE_UNUSED char const *type_description_2 = NULL;
tmp_return_value = NULL;
tmp_outline_return_value_1 = NULL;
// Actual function code.
// Tried code:
MAKE_OR_REUSE_FRAME( cache_frame_6f3ca5631f310a307e49f023c6b223c1, codeobj_6f3ca5631f310a307e49f023c6b223c1, module_django$db$models$deletion, sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *) );
frame_6f3ca5631f310a307e49f023c6b223c1 = cache_frame_6f3ca5631f310a307e49f023c6b223c1;
// Push the new frame as the currently active one.
pushFrameStack( frame_6f3ca5631f310a307e49f023c6b223c1 );
// Mark the frame object as in use, ref count 1 will be up for reuse.
assert( Py_REFCNT( frame_6f3ca5631f310a307e49f023c6b223c1 ) == 2 ); // Frame stack
// Framed code:
tmp_called_name_1 = LOOKUP_BUILTIN( const_str_plain_max );
assert( tmp_called_name_1 != NULL );
tmp_subscribed_name_1 = GET_STRING_DICT_VALUE( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_connections );
if (unlikely( tmp_subscribed_name_1 == NULL ))
{
tmp_subscribed_name_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_connections );
}
if ( tmp_subscribed_name_1 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "connections" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 161;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_source_name_3 = par_self;
CHECK_OBJECT( tmp_source_name_3 );
tmp_subscript_name_1 = LOOKUP_ATTRIBUTE( tmp_source_name_3, const_str_plain_using );
if ( tmp_subscript_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 161;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_source_name_2 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_1, tmp_subscript_name_1 );
Py_DECREF( tmp_subscript_name_1 );
if ( tmp_source_name_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 161;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_source_name_1 = LOOKUP_ATTRIBUTE( tmp_source_name_2, const_str_plain_ops );
Py_DECREF( tmp_source_name_2 );
if ( tmp_source_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 161;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_called_name_2 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_bulk_batch_size );
Py_DECREF( tmp_source_name_1 );
if ( tmp_called_name_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 161;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_args_element_name_2 = PyList_New( 1 );
tmp_source_name_4 = par_field;
if ( tmp_source_name_4 == NULL )
{
Py_DECREF( tmp_called_name_2 );
Py_DECREF( tmp_args_element_name_2 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "field" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 161;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_list_element_1 = LOOKUP_ATTRIBUTE( tmp_source_name_4, const_str_plain_name );
if ( tmp_list_element_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_2 );
Py_DECREF( tmp_args_element_name_2 );
exception_lineno = 161;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
PyList_SET_ITEM( tmp_args_element_name_2, 0, tmp_list_element_1 );
tmp_args_element_name_3 = par_objs;
if ( tmp_args_element_name_3 == NULL )
{
Py_DECREF( tmp_called_name_2 );
Py_DECREF( tmp_args_element_name_2 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 161;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
frame_6f3ca5631f310a307e49f023c6b223c1->m_frame.f_lineno = 161;
{
PyObject *call_args[] = { tmp_args_element_name_2, tmp_args_element_name_3 };
tmp_args_element_name_1 = CALL_FUNCTION_WITH_ARGS2( tmp_called_name_2, call_args );
}
Py_DECREF( tmp_called_name_2 );
Py_DECREF( tmp_args_element_name_2 );
if ( tmp_args_element_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 161;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_args_element_name_4 = const_int_pos_1;
frame_6f3ca5631f310a307e49f023c6b223c1->m_frame.f_lineno = 160;
{
PyObject *call_args[] = { tmp_args_element_name_1, tmp_args_element_name_4 };
tmp_assign_source_1 = CALL_FUNCTION_WITH_ARGS2( tmp_called_name_1, call_args );
}
Py_DECREF( tmp_args_element_name_1 );
if ( tmp_assign_source_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 160;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
assert( var_conn_batch_size == NULL );
var_conn_batch_size = tmp_assign_source_1;
tmp_len_arg_1 = par_objs;
if ( tmp_len_arg_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 162;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_compare_left_1 = BUILTIN_LEN( tmp_len_arg_1 );
if ( tmp_compare_left_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 162;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_compare_right_1 = var_conn_batch_size;
if ( tmp_compare_right_1 == NULL )
{
Py_DECREF( tmp_compare_left_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "conn_batch_size" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 162;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_cmp_Gt_1 = RICH_COMPARE_BOOL_GT( tmp_compare_left_1, tmp_compare_right_1 );
if ( tmp_cmp_Gt_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_compare_left_1 );
exception_lineno = 162;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
Py_DECREF( tmp_compare_left_1 );
if ( tmp_cmp_Gt_1 == 1 )
{
goto branch_yes_1;
}
else
{
goto branch_no_1;
}
branch_yes_1:;
// Tried code:
tmp_xrange_low_1 = const_int_0;
tmp_len_arg_2 = par_objs;
if ( tmp_len_arg_2 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "free variable '%s' referenced before assignment in enclosing scope", "objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 164;
type_description_1 = "oooo";
goto try_except_handler_2;
}
tmp_xrange_high_1 = BUILTIN_LEN( tmp_len_arg_2 );
if ( tmp_xrange_high_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 164;
type_description_1 = "oooo";
goto try_except_handler_2;
}
tmp_xrange_step_1 = var_conn_batch_size;
if ( tmp_xrange_step_1 == NULL )
{
Py_DECREF( tmp_xrange_high_1 );
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "free variable '%s' referenced before assignment in enclosing scope", "conn_batch_size" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 164;
type_description_1 = "oooo";
goto try_except_handler_2;
}
tmp_iter_arg_1 = BUILTIN_XRANGE3( tmp_xrange_low_1, tmp_xrange_high_1, tmp_xrange_step_1 );
Py_DECREF( tmp_xrange_high_1 );
if ( tmp_iter_arg_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 164;
type_description_1 = "oooo";
goto try_except_handler_2;
}
tmp_assign_source_2 = MAKE_ITERATOR( tmp_iter_arg_1 );
Py_DECREF( tmp_iter_arg_1 );
if ( tmp_assign_source_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 163;
type_description_1 = "oooo";
goto try_except_handler_2;
}
assert( tmp_listcontraction_1__$0 == NULL );
tmp_listcontraction_1__$0 = tmp_assign_source_2;
tmp_assign_source_3 = PyList_New( 0 );
assert( tmp_listcontraction_1__contraction == NULL );
tmp_listcontraction_1__contraction = tmp_assign_source_3;
MAKE_OR_REUSE_FRAME( cache_frame_3c1bb6457a1f70db422aa5e68969fc61_2, codeobj_3c1bb6457a1f70db422aa5e68969fc61, module_django$db$models$deletion, sizeof(void *)+sizeof(void *)+sizeof(void *) );
frame_3c1bb6457a1f70db422aa5e68969fc61_2 = cache_frame_3c1bb6457a1f70db422aa5e68969fc61_2;
// Push the new frame as the currently active one.
pushFrameStack( frame_3c1bb6457a1f70db422aa5e68969fc61_2 );
// Mark the frame object as in use, ref count 1 will be up for reuse.
assert( Py_REFCNT( frame_3c1bb6457a1f70db422aa5e68969fc61_2 ) == 2 ); // Frame stack
// Framed code:
// Tried code:
loop_start_1:;
tmp_next_source_1 = tmp_listcontraction_1__$0;
CHECK_OBJECT( tmp_next_source_1 );
tmp_assign_source_4 = ITERATOR_NEXT( tmp_next_source_1 );
if ( tmp_assign_source_4 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_1;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_2 = "ooo";
exception_lineno = 163;
goto try_except_handler_3;
}
}
{
PyObject *old = tmp_listcontraction_1__iter_value_0;
tmp_listcontraction_1__iter_value_0 = tmp_assign_source_4;
Py_XDECREF( old );
}
tmp_assign_source_5 = tmp_listcontraction_1__iter_value_0;
CHECK_OBJECT( tmp_assign_source_5 );
{
PyObject *old = outline_0_var_i;
outline_0_var_i = tmp_assign_source_5;
Py_INCREF( outline_0_var_i );
Py_XDECREF( old );
}
tmp_append_list_1 = tmp_listcontraction_1__contraction;
CHECK_OBJECT( tmp_append_list_1 );
tmp_subscribed_name_2 = par_objs;
if ( tmp_subscribed_name_2 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "free variable '%s' referenced before assignment in enclosing scope", "objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 163;
type_description_2 = "ooo";
goto try_except_handler_3;
}
tmp_start_name_1 = outline_0_var_i;
CHECK_OBJECT( tmp_start_name_1 );
tmp_left_name_1 = outline_0_var_i;
CHECK_OBJECT( tmp_left_name_1 );
tmp_right_name_1 = var_conn_batch_size;
if ( tmp_right_name_1 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "free variable '%s' referenced before assignment in enclosing scope", "conn_batch_size" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 163;
type_description_2 = "ooo";
goto try_except_handler_3;
}
tmp_stop_name_1 = BINARY_OPERATION_ADD( tmp_left_name_1, tmp_right_name_1 );
if ( tmp_stop_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 163;
type_description_2 = "ooo";
goto try_except_handler_3;
}
tmp_step_name_1 = Py_None;
tmp_subscript_name_2 = MAKE_SLICEOBJ3( tmp_start_name_1, tmp_stop_name_1, tmp_step_name_1 );
Py_DECREF( tmp_stop_name_1 );
assert( tmp_subscript_name_2 != NULL );
tmp_append_value_1 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_2, tmp_subscript_name_2 );
Py_DECREF( tmp_subscript_name_2 );
if ( tmp_append_value_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 163;
type_description_2 = "ooo";
goto try_except_handler_3;
}
assert( PyList_Check( tmp_append_list_1 ) );
tmp_res = PyList_Append( tmp_append_list_1, tmp_append_value_1 );
Py_DECREF( tmp_append_value_1 );
if ( tmp_res == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 163;
type_description_2 = "ooo";
goto try_except_handler_3;
}
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 163;
type_description_2 = "ooo";
goto try_except_handler_3;
}
goto loop_start_1;
loop_end_1:;
tmp_outline_return_value_1 = tmp_listcontraction_1__contraction;
CHECK_OBJECT( tmp_outline_return_value_1 );
Py_INCREF( tmp_outline_return_value_1 );
goto try_return_handler_3;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_13_get_del_batches );
return NULL;
// Return handler code:
try_return_handler_3:;
Py_XDECREF( tmp_listcontraction_1__$0 );
tmp_listcontraction_1__$0 = NULL;
Py_XDECREF( tmp_listcontraction_1__contraction );
tmp_listcontraction_1__contraction = NULL;
Py_XDECREF( tmp_listcontraction_1__iter_value_0 );
tmp_listcontraction_1__iter_value_0 = NULL;
goto frame_return_exit_2;
// Exception handler code:
try_except_handler_3:;
exception_keeper_type_1 = exception_type;
exception_keeper_value_1 = exception_value;
exception_keeper_tb_1 = exception_tb;
exception_keeper_lineno_1 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_listcontraction_1__$0 );
tmp_listcontraction_1__$0 = NULL;
Py_XDECREF( tmp_listcontraction_1__contraction );
tmp_listcontraction_1__contraction = NULL;
Py_XDECREF( tmp_listcontraction_1__iter_value_0 );
tmp_listcontraction_1__iter_value_0 = NULL;
// Re-raise.
exception_type = exception_keeper_type_1;
exception_value = exception_keeper_value_1;
exception_tb = exception_keeper_tb_1;
exception_lineno = exception_keeper_lineno_1;
goto frame_exception_exit_2;
// End of try:
#if 0
RESTORE_FRAME_EXCEPTION( frame_3c1bb6457a1f70db422aa5e68969fc61_2 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto frame_no_exception_1;
frame_return_exit_2:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_3c1bb6457a1f70db422aa5e68969fc61_2 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto try_return_handler_2;
frame_exception_exit_2:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_3c1bb6457a1f70db422aa5e68969fc61_2 );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( frame_3c1bb6457a1f70db422aa5e68969fc61_2, exception_lineno );
}
else if ( exception_tb->tb_frame != &frame_3c1bb6457a1f70db422aa5e68969fc61_2->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, frame_3c1bb6457a1f70db422aa5e68969fc61_2, exception_lineno );
}
// Attachs locals to frame if any.
Nuitka_Frame_AttachLocals(
(struct Nuitka_FrameObject *)frame_3c1bb6457a1f70db422aa5e68969fc61_2,
type_description_2,
outline_0_var_i,
par_objs,
var_conn_batch_size
);
// Release cached frame.
if ( frame_3c1bb6457a1f70db422aa5e68969fc61_2 == cache_frame_3c1bb6457a1f70db422aa5e68969fc61_2 )
{
Py_DECREF( frame_3c1bb6457a1f70db422aa5e68969fc61_2 );
}
cache_frame_3c1bb6457a1f70db422aa5e68969fc61_2 = NULL;
assertFrameObject( frame_3c1bb6457a1f70db422aa5e68969fc61_2 );
// Put the previous frame back on top.
popFrameStack();
// Return the error.
goto nested_frame_exit_1;
frame_no_exception_1:;
goto skip_nested_handling_1;
nested_frame_exit_1:;
type_description_1 = "oooo";
goto try_except_handler_2;
skip_nested_handling_1:;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_13_get_del_batches );
return NULL;
// Return handler code:
try_return_handler_2:;
Py_XDECREF( outline_0_var_i );
outline_0_var_i = NULL;
goto outline_result_1;
// Exception handler code:
try_except_handler_2:;
exception_keeper_type_2 = exception_type;
exception_keeper_value_2 = exception_value;
exception_keeper_tb_2 = exception_tb;
exception_keeper_lineno_2 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( outline_0_var_i );
outline_0_var_i = NULL;
// Re-raise.
exception_type = exception_keeper_type_2;
exception_value = exception_keeper_value_2;
exception_tb = exception_keeper_tb_2;
exception_lineno = exception_keeper_lineno_2;
goto outline_exception_1;
// End of try:
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_13_get_del_batches );
return NULL;
outline_exception_1:;
exception_lineno = 163;
goto frame_exception_exit_1;
outline_result_1:;
tmp_return_value = tmp_outline_return_value_1;
goto frame_return_exit_1;
goto branch_end_1;
branch_no_1:;
tmp_return_value = PyList_New( 1 );
tmp_list_element_2 = par_objs;
if ( tmp_list_element_2 == NULL )
{
Py_DECREF( tmp_return_value );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 166;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
Py_INCREF( tmp_list_element_2 );
PyList_SET_ITEM( tmp_return_value, 0, tmp_list_element_2 );
goto frame_return_exit_1;
branch_end_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_6f3ca5631f310a307e49f023c6b223c1 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto frame_no_exception_2;
frame_return_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_6f3ca5631f310a307e49f023c6b223c1 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto try_return_handler_1;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_6f3ca5631f310a307e49f023c6b223c1 );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( frame_6f3ca5631f310a307e49f023c6b223c1, exception_lineno );
}
else if ( exception_tb->tb_frame != &frame_6f3ca5631f310a307e49f023c6b223c1->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, frame_6f3ca5631f310a307e49f023c6b223c1, exception_lineno );
}
// Attachs locals to frame if any.
Nuitka_Frame_AttachLocals(
(struct Nuitka_FrameObject *)frame_6f3ca5631f310a307e49f023c6b223c1,
type_description_1,
par_self,
par_objs,
par_field,
var_conn_batch_size
);
// Release cached frame.
if ( frame_6f3ca5631f310a307e49f023c6b223c1 == cache_frame_6f3ca5631f310a307e49f023c6b223c1 )
{
Py_DECREF( frame_6f3ca5631f310a307e49f023c6b223c1 );
}
cache_frame_6f3ca5631f310a307e49f023c6b223c1 = NULL;
assertFrameObject( frame_6f3ca5631f310a307e49f023c6b223c1 );
// Put the previous frame back on top.
popFrameStack();
// Return the error.
goto try_except_handler_1;
frame_no_exception_2:;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_13_get_del_batches );
return NULL;
// Return handler code:
try_return_handler_1:;
Py_XDECREF( par_self );
par_self = NULL;
Py_XDECREF( par_objs );
par_objs = NULL;
Py_XDECREF( par_field );
par_field = NULL;
Py_XDECREF( var_conn_batch_size );
var_conn_batch_size = NULL;
goto function_return_exit;
// Exception handler code:
try_except_handler_1:;
exception_keeper_type_3 = exception_type;
exception_keeper_value_3 = exception_value;
exception_keeper_tb_3 = exception_tb;
exception_keeper_lineno_3 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( par_self );
par_self = NULL;
Py_XDECREF( par_objs );
par_objs = NULL;
Py_XDECREF( par_field );
par_field = NULL;
Py_XDECREF( var_conn_batch_size );
var_conn_batch_size = NULL;
// Re-raise.
exception_type = exception_keeper_type_3;
exception_value = exception_keeper_value_3;
exception_tb = exception_keeper_tb_3;
exception_lineno = exception_keeper_lineno_3;
goto function_exception_exit;
// End of try:
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_13_get_del_batches );
return NULL;
function_exception_exit:
assert( exception_type );
RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
return NULL;
function_return_exit:
CHECK_OBJECT( tmp_return_value );
assert( had_error || !ERROR_OCCURRED() );
return tmp_return_value;
}
static PyObject *impl_django$db$models$deletion$$$function_14_collect( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
{
// Preserve error status for checks
#ifndef __NUITKA_NO_ASSERT__
NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
#endif
// Local variable declarations.
PyObject *par_self = python_pars[ 0 ];
PyObject *par_objs = python_pars[ 1 ];
PyObject *par_source = python_pars[ 2 ];
PyObject *par_nullable = python_pars[ 3 ];
PyObject *par_collect_related = python_pars[ 4 ];
PyObject *par_source_attr = python_pars[ 5 ];
PyObject *par_reverse_dependency = python_pars[ 6 ];
PyObject *par_keep_parents = python_pars[ 7 ];
PyObject *var_new_objs = NULL;
PyObject *var_model = NULL;
PyObject *var_concrete_model = NULL;
PyObject *var_ptr = NULL;
PyObject *var_parent_objs = NULL;
PyObject *var_parents = NULL;
PyObject *var_related = NULL;
PyObject *var_field = NULL;
PyObject *var_batches = NULL;
PyObject *var_batch = NULL;
PyObject *var_sub_objs = NULL;
PyObject *outline_0_var_obj = NULL;
PyObject *tmp_for_loop_1__for_iterator = NULL;
PyObject *tmp_for_loop_1__iter_value = NULL;
PyObject *tmp_for_loop_2__for_iterator = NULL;
PyObject *tmp_for_loop_2__iter_value = NULL;
PyObject *tmp_for_loop_3__for_iterator = NULL;
PyObject *tmp_for_loop_3__iter_value = NULL;
PyObject *tmp_for_loop_4__for_iterator = NULL;
PyObject *tmp_for_loop_4__iter_value = NULL;
PyObject *tmp_listcontraction_1__$0 = NULL;
PyObject *tmp_listcontraction_1__contraction = NULL;
PyObject *tmp_listcontraction_1__iter_value_0 = NULL;
PyObject *exception_type = NULL;
PyObject *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
PyObject *exception_keeper_type_2;
PyObject *exception_keeper_value_2;
PyTracebackObject *exception_keeper_tb_2;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_2;
PyObject *exception_keeper_type_3;
PyObject *exception_keeper_value_3;
PyTracebackObject *exception_keeper_tb_3;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_3;
PyObject *exception_keeper_type_4;
PyObject *exception_keeper_value_4;
PyTracebackObject *exception_keeper_tb_4;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_4;
PyObject *exception_keeper_type_5;
PyObject *exception_keeper_value_5;
PyTracebackObject *exception_keeper_tb_5;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_5;
PyObject *exception_keeper_type_6;
PyObject *exception_keeper_value_6;
PyTracebackObject *exception_keeper_tb_6;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_6;
PyObject *exception_keeper_type_7;
PyObject *exception_keeper_value_7;
PyTracebackObject *exception_keeper_tb_7;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_7;
int tmp_and_left_truth_1;
PyObject *tmp_and_left_value_1;
PyObject *tmp_and_right_value_1;
PyObject *tmp_append_list_1;
PyObject *tmp_append_value_1;
PyObject *tmp_args_element_name_1;
PyObject *tmp_args_element_name_2;
PyObject *tmp_args_element_name_3;
PyObject *tmp_args_element_name_4;
PyObject *tmp_args_element_name_5;
PyObject *tmp_args_element_name_6;
PyObject *tmp_args_element_name_7;
PyObject *tmp_args_element_name_8;
PyObject *tmp_args_element_name_9;
PyObject *tmp_args_element_name_10;
PyObject *tmp_args_element_name_11;
PyObject *tmp_args_element_name_12;
PyObject *tmp_args_element_name_13;
PyObject *tmp_args_element_name_14;
PyObject *tmp_args_element_name_15;
PyObject *tmp_args_name_1;
PyObject *tmp_args_name_2;
PyObject *tmp_args_name_3;
PyObject *tmp_args_name_4;
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_assign_source_13;
PyObject *tmp_assign_source_14;
PyObject *tmp_assign_source_15;
PyObject *tmp_assign_source_16;
PyObject *tmp_assign_source_17;
PyObject *tmp_assign_source_18;
PyObject *tmp_assign_source_19;
PyObject *tmp_assign_source_20;
PyObject *tmp_assign_source_21;
PyObject *tmp_assign_source_22;
PyObject *tmp_assign_source_23;
PyObject *tmp_assign_source_24;
PyObject *tmp_assign_source_25;
PyObject *tmp_called_name_1;
PyObject *tmp_called_name_2;
PyObject *tmp_called_name_3;
PyObject *tmp_called_name_4;
PyObject *tmp_called_name_5;
PyObject *tmp_called_name_6;
PyObject *tmp_called_name_7;
PyObject *tmp_called_name_8;
PyObject *tmp_called_name_9;
PyObject *tmp_called_name_10;
PyObject *tmp_called_name_11;
PyObject *tmp_called_name_12;
PyObject *tmp_called_name_13;
int tmp_cmp_Eq_1;
PyObject *tmp_compare_left_1;
PyObject *tmp_compare_right_1;
PyObject *tmp_compexpr_left_1;
PyObject *tmp_compexpr_right_1;
int tmp_cond_truth_1;
int tmp_cond_truth_2;
int tmp_cond_truth_3;
int tmp_cond_truth_4;
int tmp_cond_truth_5;
int tmp_cond_truth_6;
int tmp_cond_truth_7;
int tmp_cond_truth_8;
PyObject *tmp_cond_value_1;
PyObject *tmp_cond_value_2;
PyObject *tmp_cond_value_3;
PyObject *tmp_cond_value_4;
PyObject *tmp_cond_value_5;
PyObject *tmp_cond_value_6;
PyObject *tmp_cond_value_7;
PyObject *tmp_cond_value_8;
PyObject *tmp_dict_key_1;
PyObject *tmp_dict_key_2;
PyObject *tmp_dict_key_3;
PyObject *tmp_dict_key_4;
PyObject *tmp_dict_key_5;
PyObject *tmp_dict_key_6;
PyObject *tmp_dict_key_7;
PyObject *tmp_dict_key_8;
PyObject *tmp_dict_value_1;
PyObject *tmp_dict_value_2;
PyObject *tmp_dict_value_3;
PyObject *tmp_dict_value_4;
PyObject *tmp_dict_value_5;
PyObject *tmp_dict_value_6;
PyObject *tmp_dict_value_7;
PyObject *tmp_dict_value_8;
PyObject *tmp_getattr_attr_1;
PyObject *tmp_getattr_target_1;
PyObject *tmp_hasattr_attr_1;
PyObject *tmp_hasattr_source_1;
PyObject *tmp_iter_arg_1;
PyObject *tmp_iter_arg_2;
PyObject *tmp_iter_arg_3;
PyObject *tmp_iter_arg_4;
PyObject *tmp_iter_arg_5;
PyObject *tmp_kw_name_1;
PyObject *tmp_kw_name_2;
PyObject *tmp_kw_name_3;
PyObject *tmp_kw_name_4;
PyObject *tmp_next_source_1;
PyObject *tmp_next_source_2;
PyObject *tmp_next_source_3;
PyObject *tmp_next_source_4;
PyObject *tmp_next_source_5;
PyObject *tmp_outline_return_value_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;
PyObject *tmp_source_name_6;
PyObject *tmp_source_name_7;
PyObject *tmp_source_name_8;
PyObject *tmp_source_name_9;
PyObject *tmp_source_name_10;
PyObject *tmp_source_name_11;
PyObject *tmp_source_name_12;
PyObject *tmp_source_name_13;
PyObject *tmp_source_name_14;
PyObject *tmp_source_name_15;
PyObject *tmp_source_name_16;
PyObject *tmp_source_name_17;
PyObject *tmp_source_name_18;
PyObject *tmp_source_name_19;
PyObject *tmp_source_name_20;
PyObject *tmp_source_name_21;
PyObject *tmp_source_name_22;
PyObject *tmp_source_name_23;
PyObject *tmp_source_name_24;
PyObject *tmp_source_name_25;
PyObject *tmp_source_name_26;
PyObject *tmp_source_name_27;
PyObject *tmp_source_name_28;
PyObject *tmp_source_name_29;
PyObject *tmp_source_name_30;
PyObject *tmp_source_name_31;
PyObject *tmp_source_name_32;
PyObject *tmp_source_name_33;
PyObject *tmp_source_name_34;
PyObject *tmp_subscribed_name_1;
PyObject *tmp_subscript_name_1;
PyObject *tmp_tuple_element_1;
PyObject *tmp_tuple_element_2;
PyObject *tmp_tuple_element_3;
PyObject *tmp_tuple_element_4;
NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
static struct Nuitka_FrameObject *cache_frame_98425bf3c18878aa96d6f20a8d834c08_2 = NULL;
struct Nuitka_FrameObject *frame_98425bf3c18878aa96d6f20a8d834c08_2;
static struct Nuitka_FrameObject *cache_frame_a71d042c297bd0001c6b1b57573b0fc1 = NULL;
struct Nuitka_FrameObject *frame_a71d042c297bd0001c6b1b57573b0fc1;
NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
NUITKA_MAY_BE_UNUSED char const *type_description_2 = NULL;
tmp_return_value = NULL;
tmp_outline_return_value_1 = NULL;
// Actual function code.
// Tried code:
MAKE_OR_REUSE_FRAME( cache_frame_a71d042c297bd0001c6b1b57573b0fc1, codeobj_a71d042c297bd0001c6b1b57573b0fc1, module_django$db$models$deletion, sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *) );
frame_a71d042c297bd0001c6b1b57573b0fc1 = cache_frame_a71d042c297bd0001c6b1b57573b0fc1;
// Push the new frame as the currently active one.
pushFrameStack( frame_a71d042c297bd0001c6b1b57573b0fc1 );
// Mark the frame object as in use, ref count 1 will be up for reuse.
assert( Py_REFCNT( frame_a71d042c297bd0001c6b1b57573b0fc1 ) == 2 ); // Frame stack
// Framed code:
tmp_source_name_1 = par_self;
CHECK_OBJECT( tmp_source_name_1 );
tmp_called_name_1 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_can_fast_delete );
if ( tmp_called_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 187;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_args_element_name_1 = par_objs;
if ( tmp_args_element_name_1 == NULL )
{
Py_DECREF( tmp_called_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 187;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
frame_a71d042c297bd0001c6b1b57573b0fc1->m_frame.f_lineno = 187;
{
PyObject *call_args[] = { tmp_args_element_name_1 };
tmp_cond_value_1 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_1, call_args );
}
Py_DECREF( tmp_called_name_1 );
if ( tmp_cond_value_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 187;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_cond_truth_1 = CHECK_IF_TRUE( tmp_cond_value_1 );
if ( tmp_cond_truth_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_cond_value_1 );
exception_lineno = 187;
type_description_1 = "ooooooooooooooooooo";
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_3 = par_self;
if ( tmp_source_name_3 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 188;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_source_name_2 = LOOKUP_ATTRIBUTE( tmp_source_name_3, const_str_plain_fast_deletes );
if ( tmp_source_name_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 188;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_called_name_2 = LOOKUP_ATTRIBUTE( tmp_source_name_2, const_str_plain_append );
Py_DECREF( tmp_source_name_2 );
if ( tmp_called_name_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 188;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_args_element_name_2 = par_objs;
if ( tmp_args_element_name_2 == NULL )
{
Py_DECREF( tmp_called_name_2 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 188;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
frame_a71d042c297bd0001c6b1b57573b0fc1->m_frame.f_lineno = 188;
{
PyObject *call_args[] = { tmp_args_element_name_2 };
tmp_unused = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_2, call_args );
}
Py_DECREF( tmp_called_name_2 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 188;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
Py_DECREF( tmp_unused );
tmp_return_value = Py_None;
Py_INCREF( tmp_return_value );
goto frame_return_exit_1;
branch_no_1:;
tmp_source_name_4 = par_self;
if ( tmp_source_name_4 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 190;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_called_name_3 = LOOKUP_ATTRIBUTE( tmp_source_name_4, const_str_plain_add );
if ( tmp_called_name_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 190;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_args_name_1 = PyTuple_New( 3 );
tmp_tuple_element_1 = par_objs;
if ( tmp_tuple_element_1 == NULL )
{
Py_DECREF( tmp_called_name_3 );
Py_DECREF( tmp_args_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 190;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
Py_INCREF( tmp_tuple_element_1 );
PyTuple_SET_ITEM( tmp_args_name_1, 0, tmp_tuple_element_1 );
tmp_tuple_element_1 = par_source;
if ( tmp_tuple_element_1 == NULL )
{
Py_DECREF( tmp_called_name_3 );
Py_DECREF( tmp_args_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "source" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 190;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
Py_INCREF( tmp_tuple_element_1 );
PyTuple_SET_ITEM( tmp_args_name_1, 1, tmp_tuple_element_1 );
tmp_tuple_element_1 = par_nullable;
if ( tmp_tuple_element_1 == NULL )
{
Py_DECREF( tmp_called_name_3 );
Py_DECREF( tmp_args_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "nullable" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 190;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
Py_INCREF( tmp_tuple_element_1 );
PyTuple_SET_ITEM( tmp_args_name_1, 2, tmp_tuple_element_1 );
tmp_kw_name_1 = _PyDict_NewPresized( 1 );
tmp_dict_key_1 = const_str_plain_reverse_dependency;
tmp_dict_value_1 = par_reverse_dependency;
if ( tmp_dict_value_1 == NULL )
{
Py_DECREF( tmp_called_name_3 );
Py_DECREF( tmp_args_name_1 );
Py_DECREF( tmp_kw_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "reverse_dependency" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 191;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_res = PyDict_SetItem( tmp_kw_name_1, tmp_dict_key_1, tmp_dict_value_1 );
assert( !(tmp_res != 0) );
frame_a71d042c297bd0001c6b1b57573b0fc1->m_frame.f_lineno = 190;
tmp_assign_source_1 = CALL_FUNCTION( tmp_called_name_3, tmp_args_name_1, tmp_kw_name_1 );
Py_DECREF( tmp_called_name_3 );
Py_DECREF( tmp_args_name_1 );
Py_DECREF( tmp_kw_name_1 );
if ( tmp_assign_source_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 190;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
assert( var_new_objs == NULL );
var_new_objs = tmp_assign_source_1;
tmp_cond_value_2 = var_new_objs;
CHECK_OBJECT( tmp_cond_value_2 );
tmp_cond_truth_2 = CHECK_IF_TRUE( tmp_cond_value_2 );
if ( tmp_cond_truth_2 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 192;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
if ( tmp_cond_truth_2 == 1 )
{
goto branch_no_2;
}
else
{
goto branch_yes_2;
}
branch_yes_2:;
tmp_return_value = Py_None;
Py_INCREF( tmp_return_value );
goto frame_return_exit_1;
branch_no_2:;
tmp_subscribed_name_1 = var_new_objs;
if ( tmp_subscribed_name_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "new_objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 195;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_subscript_name_1 = const_int_0;
tmp_source_name_5 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_1, tmp_subscript_name_1 );
if ( tmp_source_name_5 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 195;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_assign_source_2 = LOOKUP_ATTRIBUTE_CLASS_SLOT( tmp_source_name_5 );
Py_DECREF( tmp_source_name_5 );
if ( tmp_assign_source_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 195;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
assert( var_model == NULL );
var_model = tmp_assign_source_2;
tmp_cond_value_3 = par_keep_parents;
if ( tmp_cond_value_3 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "keep_parents" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 197;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_cond_truth_3 = CHECK_IF_TRUE( tmp_cond_value_3 );
if ( tmp_cond_truth_3 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 197;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
if ( tmp_cond_truth_3 == 1 )
{
goto branch_no_3;
}
else
{
goto branch_yes_3;
}
branch_yes_3:;
tmp_source_name_7 = var_model;
if ( tmp_source_name_7 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "model" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 200;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_source_name_6 = LOOKUP_ATTRIBUTE( tmp_source_name_7, const_str_plain__meta );
if ( tmp_source_name_6 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 200;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_assign_source_3 = LOOKUP_ATTRIBUTE( tmp_source_name_6, const_str_plain_concrete_model );
Py_DECREF( tmp_source_name_6 );
if ( tmp_assign_source_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 200;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
assert( var_concrete_model == NULL );
var_concrete_model = tmp_assign_source_3;
tmp_source_name_8 = GET_STRING_DICT_VALUE( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_six );
if (unlikely( tmp_source_name_8 == NULL ))
{
tmp_source_name_8 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_six );
}
if ( tmp_source_name_8 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "six" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 201;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_called_name_4 = LOOKUP_ATTRIBUTE( tmp_source_name_8, const_str_plain_itervalues );
if ( tmp_called_name_4 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 201;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_source_name_10 = var_concrete_model;
if ( tmp_source_name_10 == NULL )
{
Py_DECREF( tmp_called_name_4 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "concrete_model" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 201;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_source_name_9 = LOOKUP_ATTRIBUTE( tmp_source_name_10, const_str_plain__meta );
if ( tmp_source_name_9 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_4 );
exception_lineno = 201;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_args_element_name_3 = LOOKUP_ATTRIBUTE( tmp_source_name_9, const_str_plain_parents );
Py_DECREF( tmp_source_name_9 );
if ( tmp_args_element_name_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_4 );
exception_lineno = 201;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
frame_a71d042c297bd0001c6b1b57573b0fc1->m_frame.f_lineno = 201;
{
PyObject *call_args[] = { tmp_args_element_name_3 };
tmp_iter_arg_1 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_4, call_args );
}
Py_DECREF( tmp_called_name_4 );
Py_DECREF( tmp_args_element_name_3 );
if ( tmp_iter_arg_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 201;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_assign_source_4 = MAKE_ITERATOR( tmp_iter_arg_1 );
Py_DECREF( tmp_iter_arg_1 );
if ( tmp_assign_source_4 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 201;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
assert( tmp_for_loop_1__for_iterator == NULL );
tmp_for_loop_1__for_iterator = tmp_assign_source_4;
// Tried code:
loop_start_1:;
tmp_next_source_1 = tmp_for_loop_1__for_iterator;
CHECK_OBJECT( tmp_next_source_1 );
tmp_assign_source_5 = ITERATOR_NEXT( tmp_next_source_1 );
if ( tmp_assign_source_5 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_1;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooooooooo";
exception_lineno = 201;
goto try_except_handler_2;
}
}
{
PyObject *old = tmp_for_loop_1__iter_value;
tmp_for_loop_1__iter_value = tmp_assign_source_5;
Py_XDECREF( old );
}
tmp_assign_source_6 = tmp_for_loop_1__iter_value;
CHECK_OBJECT( tmp_assign_source_6 );
{
PyObject *old = var_ptr;
var_ptr = tmp_assign_source_6;
Py_INCREF( var_ptr );
Py_XDECREF( old );
}
tmp_cond_value_4 = var_ptr;
CHECK_OBJECT( tmp_cond_value_4 );
tmp_cond_truth_4 = CHECK_IF_TRUE( tmp_cond_value_4 );
if ( tmp_cond_truth_4 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 202;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
if ( tmp_cond_truth_4 == 1 )
{
goto branch_yes_4;
}
else
{
goto branch_no_4;
}
branch_yes_4:;
// Tried code:
tmp_iter_arg_2 = var_new_objs;
if ( tmp_iter_arg_2 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "free variable '%s' referenced before assignment in enclosing scope", "new_objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 203;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_3;
}
tmp_assign_source_8 = MAKE_ITERATOR( tmp_iter_arg_2 );
if ( tmp_assign_source_8 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 203;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_3;
}
{
PyObject *old = tmp_listcontraction_1__$0;
tmp_listcontraction_1__$0 = tmp_assign_source_8;
Py_XDECREF( old );
}
tmp_assign_source_9 = PyList_New( 0 );
{
PyObject *old = tmp_listcontraction_1__contraction;
tmp_listcontraction_1__contraction = tmp_assign_source_9;
Py_XDECREF( old );
}
MAKE_OR_REUSE_FRAME( cache_frame_98425bf3c18878aa96d6f20a8d834c08_2, codeobj_98425bf3c18878aa96d6f20a8d834c08, module_django$db$models$deletion, sizeof(void *)+sizeof(void *)+sizeof(void *) );
frame_98425bf3c18878aa96d6f20a8d834c08_2 = cache_frame_98425bf3c18878aa96d6f20a8d834c08_2;
// Push the new frame as the currently active one.
pushFrameStack( frame_98425bf3c18878aa96d6f20a8d834c08_2 );
// Mark the frame object as in use, ref count 1 will be up for reuse.
assert( Py_REFCNT( frame_98425bf3c18878aa96d6f20a8d834c08_2 ) == 2 ); // Frame stack
// Framed code:
// Tried code:
loop_start_2:;
tmp_next_source_2 = tmp_listcontraction_1__$0;
CHECK_OBJECT( tmp_next_source_2 );
tmp_assign_source_10 = ITERATOR_NEXT( tmp_next_source_2 );
if ( tmp_assign_source_10 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_2;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_2 = "ooo";
exception_lineno = 203;
goto try_except_handler_4;
}
}
{
PyObject *old = tmp_listcontraction_1__iter_value_0;
tmp_listcontraction_1__iter_value_0 = tmp_assign_source_10;
Py_XDECREF( old );
}
tmp_assign_source_11 = tmp_listcontraction_1__iter_value_0;
CHECK_OBJECT( tmp_assign_source_11 );
{
PyObject *old = outline_0_var_obj;
outline_0_var_obj = tmp_assign_source_11;
Py_INCREF( outline_0_var_obj );
Py_XDECREF( old );
}
tmp_append_list_1 = tmp_listcontraction_1__contraction;
CHECK_OBJECT( tmp_append_list_1 );
tmp_getattr_target_1 = outline_0_var_obj;
CHECK_OBJECT( tmp_getattr_target_1 );
tmp_source_name_11 = var_ptr;
if ( tmp_source_name_11 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "free variable '%s' referenced before assignment in enclosing scope", "ptr" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 203;
type_description_2 = "ooo";
goto try_except_handler_4;
}
tmp_getattr_attr_1 = LOOKUP_ATTRIBUTE( tmp_source_name_11, const_str_plain_name );
if ( tmp_getattr_attr_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 203;
type_description_2 = "ooo";
goto try_except_handler_4;
}
tmp_append_value_1 = BUILTIN_GETATTR( tmp_getattr_target_1, tmp_getattr_attr_1, NULL );
Py_DECREF( tmp_getattr_attr_1 );
if ( tmp_append_value_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 203;
type_description_2 = "ooo";
goto try_except_handler_4;
}
assert( PyList_Check( tmp_append_list_1 ) );
tmp_res = PyList_Append( tmp_append_list_1, tmp_append_value_1 );
Py_DECREF( tmp_append_value_1 );
if ( tmp_res == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 203;
type_description_2 = "ooo";
goto try_except_handler_4;
}
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 203;
type_description_2 = "ooo";
goto try_except_handler_4;
}
goto loop_start_2;
loop_end_2:;
tmp_outline_return_value_1 = tmp_listcontraction_1__contraction;
CHECK_OBJECT( tmp_outline_return_value_1 );
Py_INCREF( tmp_outline_return_value_1 );
goto try_return_handler_4;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_14_collect );
return NULL;
// Return handler code:
try_return_handler_4:;
Py_XDECREF( tmp_listcontraction_1__$0 );
tmp_listcontraction_1__$0 = NULL;
Py_XDECREF( tmp_listcontraction_1__contraction );
tmp_listcontraction_1__contraction = NULL;
Py_XDECREF( tmp_listcontraction_1__iter_value_0 );
tmp_listcontraction_1__iter_value_0 = NULL;
goto frame_return_exit_2;
// Exception handler code:
try_except_handler_4:;
exception_keeper_type_1 = exception_type;
exception_keeper_value_1 = exception_value;
exception_keeper_tb_1 = exception_tb;
exception_keeper_lineno_1 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_listcontraction_1__$0 );
tmp_listcontraction_1__$0 = NULL;
Py_XDECREF( tmp_listcontraction_1__contraction );
tmp_listcontraction_1__contraction = NULL;
Py_XDECREF( tmp_listcontraction_1__iter_value_0 );
tmp_listcontraction_1__iter_value_0 = NULL;
// Re-raise.
exception_type = exception_keeper_type_1;
exception_value = exception_keeper_value_1;
exception_tb = exception_keeper_tb_1;
exception_lineno = exception_keeper_lineno_1;
goto frame_exception_exit_2;
// End of try:
#if 0
RESTORE_FRAME_EXCEPTION( frame_98425bf3c18878aa96d6f20a8d834c08_2 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto frame_no_exception_1;
frame_return_exit_2:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_98425bf3c18878aa96d6f20a8d834c08_2 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto try_return_handler_3;
frame_exception_exit_2:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_98425bf3c18878aa96d6f20a8d834c08_2 );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( frame_98425bf3c18878aa96d6f20a8d834c08_2, exception_lineno );
}
else if ( exception_tb->tb_frame != &frame_98425bf3c18878aa96d6f20a8d834c08_2->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, frame_98425bf3c18878aa96d6f20a8d834c08_2, exception_lineno );
}
// Attachs locals to frame if any.
Nuitka_Frame_AttachLocals(
(struct Nuitka_FrameObject *)frame_98425bf3c18878aa96d6f20a8d834c08_2,
type_description_2,
outline_0_var_obj,
var_new_objs,
var_ptr
);
// Release cached frame.
if ( frame_98425bf3c18878aa96d6f20a8d834c08_2 == cache_frame_98425bf3c18878aa96d6f20a8d834c08_2 )
{
Py_DECREF( frame_98425bf3c18878aa96d6f20a8d834c08_2 );
}
cache_frame_98425bf3c18878aa96d6f20a8d834c08_2 = NULL;
assertFrameObject( frame_98425bf3c18878aa96d6f20a8d834c08_2 );
// Put the previous frame back on top.
popFrameStack();
// Return the error.
goto nested_frame_exit_1;
frame_no_exception_1:;
goto skip_nested_handling_1;
nested_frame_exit_1:;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_3;
skip_nested_handling_1:;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_14_collect );
return NULL;
// Return handler code:
try_return_handler_3:;
Py_XDECREF( outline_0_var_obj );
outline_0_var_obj = NULL;
goto outline_result_1;
// Exception handler code:
try_except_handler_3:;
exception_keeper_type_2 = exception_type;
exception_keeper_value_2 = exception_value;
exception_keeper_tb_2 = exception_tb;
exception_keeper_lineno_2 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( outline_0_var_obj );
outline_0_var_obj = NULL;
// Re-raise.
exception_type = exception_keeper_type_2;
exception_value = exception_keeper_value_2;
exception_tb = exception_keeper_tb_2;
exception_lineno = exception_keeper_lineno_2;
goto outline_exception_1;
// End of try:
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_14_collect );
return NULL;
outline_exception_1:;
exception_lineno = 203;
goto try_except_handler_2;
outline_result_1:;
tmp_assign_source_7 = tmp_outline_return_value_1;
{
PyObject *old = var_parent_objs;
var_parent_objs = tmp_assign_source_7;
Py_XDECREF( old );
}
tmp_source_name_12 = par_self;
if ( tmp_source_name_12 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 204;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
tmp_called_name_5 = LOOKUP_ATTRIBUTE( tmp_source_name_12, const_str_plain_collect );
if ( tmp_called_name_5 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 204;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
tmp_args_name_2 = PyTuple_New( 1 );
tmp_tuple_element_2 = var_parent_objs;
if ( tmp_tuple_element_2 == NULL )
{
Py_DECREF( tmp_called_name_5 );
Py_DECREF( tmp_args_name_2 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "parent_objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 204;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
Py_INCREF( tmp_tuple_element_2 );
PyTuple_SET_ITEM( tmp_args_name_2, 0, tmp_tuple_element_2 );
tmp_kw_name_2 = _PyDict_NewPresized( 4 );
tmp_dict_key_2 = const_str_plain_source;
tmp_dict_value_2 = var_model;
if ( tmp_dict_value_2 == NULL )
{
Py_DECREF( tmp_called_name_5 );
Py_DECREF( tmp_args_name_2 );
Py_DECREF( tmp_kw_name_2 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "model" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 204;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
tmp_res = PyDict_SetItem( tmp_kw_name_2, tmp_dict_key_2, tmp_dict_value_2 );
assert( !(tmp_res != 0) );
tmp_dict_key_3 = const_str_plain_source_attr;
tmp_source_name_14 = var_ptr;
if ( tmp_source_name_14 == NULL )
{
Py_DECREF( tmp_called_name_5 );
Py_DECREF( tmp_args_name_2 );
Py_DECREF( tmp_kw_name_2 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ptr" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 205;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
tmp_source_name_13 = LOOKUP_ATTRIBUTE( tmp_source_name_14, const_str_plain_remote_field );
if ( tmp_source_name_13 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_5 );
Py_DECREF( tmp_args_name_2 );
Py_DECREF( tmp_kw_name_2 );
exception_lineno = 205;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
tmp_dict_value_3 = LOOKUP_ATTRIBUTE( tmp_source_name_13, const_str_plain_related_name );
Py_DECREF( tmp_source_name_13 );
if ( tmp_dict_value_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_5 );
Py_DECREF( tmp_args_name_2 );
Py_DECREF( tmp_kw_name_2 );
exception_lineno = 205;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
tmp_res = PyDict_SetItem( tmp_kw_name_2, tmp_dict_key_3, tmp_dict_value_3 );
Py_DECREF( tmp_dict_value_3 );
assert( !(tmp_res != 0) );
tmp_dict_key_4 = const_str_plain_collect_related;
tmp_dict_value_4 = Py_False;
tmp_res = PyDict_SetItem( tmp_kw_name_2, tmp_dict_key_4, tmp_dict_value_4 );
assert( !(tmp_res != 0) );
tmp_dict_key_5 = const_str_plain_reverse_dependency;
tmp_dict_value_5 = Py_True;
tmp_res = PyDict_SetItem( tmp_kw_name_2, tmp_dict_key_5, tmp_dict_value_5 );
assert( !(tmp_res != 0) );
frame_a71d042c297bd0001c6b1b57573b0fc1->m_frame.f_lineno = 204;
tmp_unused = CALL_FUNCTION( tmp_called_name_5, tmp_args_name_2, tmp_kw_name_2 );
Py_DECREF( tmp_called_name_5 );
Py_DECREF( tmp_args_name_2 );
Py_DECREF( tmp_kw_name_2 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 204;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
Py_DECREF( tmp_unused );
branch_no_4:;
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 201;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
goto loop_start_1;
loop_end_1:;
goto try_end_1;
// Exception handler code:
try_except_handler_2:;
exception_keeper_type_3 = exception_type;
exception_keeper_value_3 = exception_value;
exception_keeper_tb_3 = exception_tb;
exception_keeper_lineno_3 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_for_loop_1__iter_value );
tmp_for_loop_1__iter_value = NULL;
Py_XDECREF( tmp_for_loop_1__for_iterator );
tmp_for_loop_1__for_iterator = NULL;
// Re-raise.
exception_type = exception_keeper_type_3;
exception_value = exception_keeper_value_3;
exception_tb = exception_keeper_tb_3;
exception_lineno = exception_keeper_lineno_3;
goto frame_exception_exit_1;
// End of try:
try_end_1:;
Py_XDECREF( tmp_for_loop_1__iter_value );
tmp_for_loop_1__iter_value = NULL;
Py_XDECREF( tmp_for_loop_1__for_iterator );
tmp_for_loop_1__for_iterator = NULL;
branch_no_3:;
tmp_cond_value_5 = par_collect_related;
if ( tmp_cond_value_5 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "collect_related" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 208;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_cond_truth_5 = CHECK_IF_TRUE( tmp_cond_value_5 );
if ( tmp_cond_truth_5 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 208;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
if ( tmp_cond_truth_5 == 1 )
{
goto branch_yes_5;
}
else
{
goto branch_no_5;
}
branch_yes_5:;
tmp_source_name_16 = var_model;
if ( tmp_source_name_16 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "model" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 209;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_source_name_15 = LOOKUP_ATTRIBUTE( tmp_source_name_16, const_str_plain__meta );
if ( tmp_source_name_15 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 209;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_assign_source_12 = LOOKUP_ATTRIBUTE( tmp_source_name_15, const_str_plain_parents );
Py_DECREF( tmp_source_name_15 );
if ( tmp_assign_source_12 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 209;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
assert( var_parents == NULL );
var_parents = tmp_assign_source_12;
tmp_called_name_6 = GET_STRING_DICT_VALUE( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_get_candidate_relations_to_delete );
if (unlikely( tmp_called_name_6 == NULL ))
{
tmp_called_name_6 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_get_candidate_relations_to_delete );
}
if ( tmp_called_name_6 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "get_candidate_relations_to_delete" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 210;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_source_name_17 = var_model;
if ( tmp_source_name_17 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "model" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 210;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_args_element_name_4 = LOOKUP_ATTRIBUTE( tmp_source_name_17, const_str_plain__meta );
if ( tmp_args_element_name_4 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 210;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
frame_a71d042c297bd0001c6b1b57573b0fc1->m_frame.f_lineno = 210;
{
PyObject *call_args[] = { tmp_args_element_name_4 };
tmp_iter_arg_3 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_6, call_args );
}
Py_DECREF( tmp_args_element_name_4 );
if ( tmp_iter_arg_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 210;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_assign_source_13 = MAKE_ITERATOR( tmp_iter_arg_3 );
Py_DECREF( tmp_iter_arg_3 );
if ( tmp_assign_source_13 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 210;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
assert( tmp_for_loop_2__for_iterator == NULL );
tmp_for_loop_2__for_iterator = tmp_assign_source_13;
// Tried code:
loop_start_3:;
tmp_next_source_3 = tmp_for_loop_2__for_iterator;
CHECK_OBJECT( tmp_next_source_3 );
tmp_assign_source_14 = ITERATOR_NEXT( tmp_next_source_3 );
if ( tmp_assign_source_14 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_3;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooooooooo";
exception_lineno = 210;
goto try_except_handler_5;
}
}
{
PyObject *old = tmp_for_loop_2__iter_value;
tmp_for_loop_2__iter_value = tmp_assign_source_14;
Py_XDECREF( old );
}
tmp_assign_source_15 = tmp_for_loop_2__iter_value;
CHECK_OBJECT( tmp_assign_source_15 );
{
PyObject *old = var_related;
var_related = tmp_assign_source_15;
Py_INCREF( var_related );
Py_XDECREF( old );
}
tmp_and_left_value_1 = par_keep_parents;
if ( tmp_and_left_value_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "keep_parents" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 212;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_5;
}
tmp_and_left_truth_1 = CHECK_IF_TRUE( tmp_and_left_value_1 );
if ( tmp_and_left_truth_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 212;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_5;
}
if ( tmp_and_left_truth_1 == 1 )
{
goto and_right_1;
}
else
{
goto and_left_1;
}
and_right_1:;
tmp_source_name_18 = var_related;
CHECK_OBJECT( tmp_source_name_18 );
tmp_compexpr_left_1 = LOOKUP_ATTRIBUTE( tmp_source_name_18, const_str_plain_model );
if ( tmp_compexpr_left_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 212;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_5;
}
tmp_compexpr_right_1 = var_parents;
if ( tmp_compexpr_right_1 == NULL )
{
Py_DECREF( tmp_compexpr_left_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "parents" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 212;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_5;
}
tmp_and_right_value_1 = SEQUENCE_CONTAINS( tmp_compexpr_left_1, tmp_compexpr_right_1 );
Py_DECREF( tmp_compexpr_left_1 );
if ( tmp_and_right_value_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 212;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_5;
}
tmp_cond_value_6 = tmp_and_right_value_1;
goto and_end_1;
and_left_1:;
tmp_cond_value_6 = tmp_and_left_value_1;
and_end_1:;
tmp_cond_truth_6 = CHECK_IF_TRUE( tmp_cond_value_6 );
if ( tmp_cond_truth_6 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 212;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_5;
}
if ( tmp_cond_truth_6 == 1 )
{
goto branch_yes_6;
}
else
{
goto branch_no_6;
}
branch_yes_6:;
goto loop_start_3;
branch_no_6:;
tmp_source_name_19 = var_related;
if ( tmp_source_name_19 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "related" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 214;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_5;
}
tmp_assign_source_16 = LOOKUP_ATTRIBUTE( tmp_source_name_19, const_str_plain_field );
if ( tmp_assign_source_16 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 214;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_5;
}
{
PyObject *old = var_field;
var_field = tmp_assign_source_16;
Py_XDECREF( old );
}
tmp_source_name_21 = var_field;
CHECK_OBJECT( tmp_source_name_21 );
tmp_source_name_20 = LOOKUP_ATTRIBUTE( tmp_source_name_21, const_str_plain_remote_field );
if ( tmp_source_name_20 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 215;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_5;
}
tmp_compare_left_1 = LOOKUP_ATTRIBUTE( tmp_source_name_20, const_str_plain_on_delete );
Py_DECREF( tmp_source_name_20 );
if ( tmp_compare_left_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 215;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_5;
}
tmp_compare_right_1 = GET_STRING_DICT_VALUE( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_DO_NOTHING );
if (unlikely( tmp_compare_right_1 == NULL ))
{
tmp_compare_right_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_DO_NOTHING );
}
if ( tmp_compare_right_1 == NULL )
{
Py_DECREF( tmp_compare_left_1 );
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "DO_NOTHING" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 215;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_5;
}
tmp_cmp_Eq_1 = RICH_COMPARE_BOOL_EQ( tmp_compare_left_1, tmp_compare_right_1 );
if ( tmp_cmp_Eq_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_compare_left_1 );
exception_lineno = 215;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_5;
}
Py_DECREF( tmp_compare_left_1 );
if ( tmp_cmp_Eq_1 == 1 )
{
goto branch_yes_7;
}
else
{
goto branch_no_7;
}
branch_yes_7:;
goto loop_start_3;
branch_no_7:;
tmp_source_name_22 = par_self;
if ( tmp_source_name_22 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 217;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_5;
}
tmp_called_name_7 = LOOKUP_ATTRIBUTE( tmp_source_name_22, const_str_plain_get_del_batches );
if ( tmp_called_name_7 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 217;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_5;
}
tmp_args_element_name_5 = var_new_objs;
if ( tmp_args_element_name_5 == NULL )
{
Py_DECREF( tmp_called_name_7 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "new_objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 217;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_5;
}
tmp_args_element_name_6 = var_field;
if ( tmp_args_element_name_6 == NULL )
{
Py_DECREF( tmp_called_name_7 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "field" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 217;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_5;
}
frame_a71d042c297bd0001c6b1b57573b0fc1->m_frame.f_lineno = 217;
{
PyObject *call_args[] = { tmp_args_element_name_5, tmp_args_element_name_6 };
tmp_assign_source_17 = CALL_FUNCTION_WITH_ARGS2( tmp_called_name_7, call_args );
}
Py_DECREF( tmp_called_name_7 );
if ( tmp_assign_source_17 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 217;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_5;
}
{
PyObject *old = var_batches;
var_batches = tmp_assign_source_17;
Py_XDECREF( old );
}
tmp_iter_arg_4 = var_batches;
CHECK_OBJECT( tmp_iter_arg_4 );
tmp_assign_source_18 = MAKE_ITERATOR( tmp_iter_arg_4 );
if ( tmp_assign_source_18 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 218;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_5;
}
{
PyObject *old = tmp_for_loop_3__for_iterator;
tmp_for_loop_3__for_iterator = tmp_assign_source_18;
Py_XDECREF( old );
}
// Tried code:
loop_start_4:;
tmp_next_source_4 = tmp_for_loop_3__for_iterator;
CHECK_OBJECT( tmp_next_source_4 );
tmp_assign_source_19 = ITERATOR_NEXT( tmp_next_source_4 );
if ( tmp_assign_source_19 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_4;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooooooooo";
exception_lineno = 218;
goto try_except_handler_6;
}
}
{
PyObject *old = tmp_for_loop_3__iter_value;
tmp_for_loop_3__iter_value = tmp_assign_source_19;
Py_XDECREF( old );
}
tmp_assign_source_20 = tmp_for_loop_3__iter_value;
CHECK_OBJECT( tmp_assign_source_20 );
{
PyObject *old = var_batch;
var_batch = tmp_assign_source_20;
Py_INCREF( var_batch );
Py_XDECREF( old );
}
tmp_source_name_23 = par_self;
if ( tmp_source_name_23 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 219;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_6;
}
tmp_called_name_8 = LOOKUP_ATTRIBUTE( tmp_source_name_23, const_str_plain_related_objects );
if ( tmp_called_name_8 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 219;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_6;
}
tmp_args_element_name_7 = var_related;
if ( tmp_args_element_name_7 == NULL )
{
Py_DECREF( tmp_called_name_8 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "related" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 219;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_6;
}
tmp_args_element_name_8 = var_batch;
if ( tmp_args_element_name_8 == NULL )
{
Py_DECREF( tmp_called_name_8 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "batch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 219;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_6;
}
frame_a71d042c297bd0001c6b1b57573b0fc1->m_frame.f_lineno = 219;
{
PyObject *call_args[] = { tmp_args_element_name_7, tmp_args_element_name_8 };
tmp_assign_source_21 = CALL_FUNCTION_WITH_ARGS2( tmp_called_name_8, call_args );
}
Py_DECREF( tmp_called_name_8 );
if ( tmp_assign_source_21 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 219;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_6;
}
{
PyObject *old = var_sub_objs;
var_sub_objs = tmp_assign_source_21;
Py_XDECREF( old );
}
tmp_source_name_24 = par_self;
if ( tmp_source_name_24 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 220;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_6;
}
tmp_called_name_9 = LOOKUP_ATTRIBUTE( tmp_source_name_24, const_str_plain_can_fast_delete );
if ( tmp_called_name_9 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 220;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_6;
}
tmp_args_name_3 = PyTuple_New( 1 );
tmp_tuple_element_3 = var_sub_objs;
if ( tmp_tuple_element_3 == NULL )
{
Py_DECREF( tmp_called_name_9 );
Py_DECREF( tmp_args_name_3 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "sub_objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 220;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_6;
}
Py_INCREF( tmp_tuple_element_3 );
PyTuple_SET_ITEM( tmp_args_name_3, 0, tmp_tuple_element_3 );
tmp_kw_name_3 = _PyDict_NewPresized( 1 );
tmp_dict_key_6 = const_str_plain_from_field;
tmp_dict_value_6 = var_field;
if ( tmp_dict_value_6 == NULL )
{
Py_DECREF( tmp_called_name_9 );
Py_DECREF( tmp_args_name_3 );
Py_DECREF( tmp_kw_name_3 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "field" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 220;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_6;
}
tmp_res = PyDict_SetItem( tmp_kw_name_3, tmp_dict_key_6, tmp_dict_value_6 );
assert( !(tmp_res != 0) );
frame_a71d042c297bd0001c6b1b57573b0fc1->m_frame.f_lineno = 220;
tmp_cond_value_7 = CALL_FUNCTION( tmp_called_name_9, tmp_args_name_3, tmp_kw_name_3 );
Py_DECREF( tmp_called_name_9 );
Py_DECREF( tmp_args_name_3 );
Py_DECREF( tmp_kw_name_3 );
if ( tmp_cond_value_7 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 220;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_6;
}
tmp_cond_truth_7 = CHECK_IF_TRUE( tmp_cond_value_7 );
if ( tmp_cond_truth_7 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_cond_value_7 );
exception_lineno = 220;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_6;
}
Py_DECREF( tmp_cond_value_7 );
if ( tmp_cond_truth_7 == 1 )
{
goto branch_yes_8;
}
else
{
goto branch_no_8;
}
branch_yes_8:;
tmp_source_name_26 = par_self;
if ( tmp_source_name_26 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 221;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_6;
}
tmp_source_name_25 = LOOKUP_ATTRIBUTE( tmp_source_name_26, const_str_plain_fast_deletes );
if ( tmp_source_name_25 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 221;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_6;
}
tmp_called_name_10 = LOOKUP_ATTRIBUTE( tmp_source_name_25, const_str_plain_append );
Py_DECREF( tmp_source_name_25 );
if ( tmp_called_name_10 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 221;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_6;
}
tmp_args_element_name_9 = var_sub_objs;
if ( tmp_args_element_name_9 == NULL )
{
Py_DECREF( tmp_called_name_10 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "sub_objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 221;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_6;
}
frame_a71d042c297bd0001c6b1b57573b0fc1->m_frame.f_lineno = 221;
{
PyObject *call_args[] = { tmp_args_element_name_9 };
tmp_unused = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_10, call_args );
}
Py_DECREF( tmp_called_name_10 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 221;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_6;
}
Py_DECREF( tmp_unused );
goto branch_end_8;
branch_no_8:;
tmp_cond_value_8 = var_sub_objs;
if ( tmp_cond_value_8 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "sub_objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 222;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_6;
}
tmp_cond_truth_8 = CHECK_IF_TRUE( tmp_cond_value_8 );
if ( tmp_cond_truth_8 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 222;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_6;
}
if ( tmp_cond_truth_8 == 1 )
{
goto branch_yes_9;
}
else
{
goto branch_no_9;
}
branch_yes_9:;
tmp_source_name_28 = var_field;
if ( tmp_source_name_28 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "field" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 223;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_6;
}
tmp_source_name_27 = LOOKUP_ATTRIBUTE( tmp_source_name_28, const_str_plain_remote_field );
if ( tmp_source_name_27 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 223;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_6;
}
tmp_called_name_11 = LOOKUP_ATTRIBUTE( tmp_source_name_27, const_str_plain_on_delete );
Py_DECREF( tmp_source_name_27 );
if ( tmp_called_name_11 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 223;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_6;
}
tmp_args_element_name_10 = par_self;
if ( tmp_args_element_name_10 == NULL )
{
Py_DECREF( tmp_called_name_11 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 223;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_6;
}
tmp_args_element_name_11 = var_field;
if ( tmp_args_element_name_11 == NULL )
{
Py_DECREF( tmp_called_name_11 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "field" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 223;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_6;
}
tmp_args_element_name_12 = var_sub_objs;
if ( tmp_args_element_name_12 == NULL )
{
Py_DECREF( tmp_called_name_11 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "sub_objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 223;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_6;
}
tmp_source_name_29 = par_self;
if ( tmp_source_name_29 == NULL )
{
Py_DECREF( tmp_called_name_11 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 223;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_6;
}
tmp_args_element_name_13 = LOOKUP_ATTRIBUTE( tmp_source_name_29, const_str_plain_using );
if ( tmp_args_element_name_13 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_11 );
exception_lineno = 223;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_6;
}
frame_a71d042c297bd0001c6b1b57573b0fc1->m_frame.f_lineno = 223;
{
PyObject *call_args[] = { tmp_args_element_name_10, tmp_args_element_name_11, tmp_args_element_name_12, tmp_args_element_name_13 };
tmp_unused = CALL_FUNCTION_WITH_ARGS4( tmp_called_name_11, call_args );
}
Py_DECREF( tmp_called_name_11 );
Py_DECREF( tmp_args_element_name_13 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 223;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_6;
}
Py_DECREF( tmp_unused );
branch_no_9:;
branch_end_8:;
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 218;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_6;
}
goto loop_start_4;
loop_end_4:;
goto try_end_2;
// Exception handler code:
try_except_handler_6:;
exception_keeper_type_4 = exception_type;
exception_keeper_value_4 = exception_value;
exception_keeper_tb_4 = exception_tb;
exception_keeper_lineno_4 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_for_loop_3__iter_value );
tmp_for_loop_3__iter_value = NULL;
Py_XDECREF( tmp_for_loop_3__for_iterator );
tmp_for_loop_3__for_iterator = NULL;
// Re-raise.
exception_type = exception_keeper_type_4;
exception_value = exception_keeper_value_4;
exception_tb = exception_keeper_tb_4;
exception_lineno = exception_keeper_lineno_4;
goto try_except_handler_5;
// End of try:
try_end_2:;
Py_XDECREF( tmp_for_loop_3__iter_value );
tmp_for_loop_3__iter_value = NULL;
Py_XDECREF( tmp_for_loop_3__for_iterator );
tmp_for_loop_3__for_iterator = NULL;
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 210;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_5;
}
goto loop_start_3;
loop_end_3:;
goto try_end_3;
// Exception handler code:
try_except_handler_5:;
exception_keeper_type_5 = exception_type;
exception_keeper_value_5 = exception_value;
exception_keeper_tb_5 = exception_tb;
exception_keeper_lineno_5 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_for_loop_2__iter_value );
tmp_for_loop_2__iter_value = NULL;
Py_XDECREF( tmp_for_loop_2__for_iterator );
tmp_for_loop_2__for_iterator = NULL;
// Re-raise.
exception_type = exception_keeper_type_5;
exception_value = exception_keeper_value_5;
exception_tb = exception_keeper_tb_5;
exception_lineno = exception_keeper_lineno_5;
goto frame_exception_exit_1;
// End of try:
try_end_3:;
Py_XDECREF( tmp_for_loop_2__iter_value );
tmp_for_loop_2__iter_value = NULL;
Py_XDECREF( tmp_for_loop_2__for_iterator );
tmp_for_loop_2__for_iterator = NULL;
tmp_source_name_31 = var_model;
if ( tmp_source_name_31 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "model" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 224;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_source_name_30 = LOOKUP_ATTRIBUTE( tmp_source_name_31, const_str_plain__meta );
if ( tmp_source_name_30 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 224;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_iter_arg_5 = LOOKUP_ATTRIBUTE( tmp_source_name_30, const_str_plain_private_fields );
Py_DECREF( tmp_source_name_30 );
if ( tmp_iter_arg_5 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 224;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_assign_source_22 = MAKE_ITERATOR( tmp_iter_arg_5 );
Py_DECREF( tmp_iter_arg_5 );
if ( tmp_assign_source_22 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 224;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
assert( tmp_for_loop_4__for_iterator == NULL );
tmp_for_loop_4__for_iterator = tmp_assign_source_22;
// Tried code:
loop_start_5:;
tmp_next_source_5 = tmp_for_loop_4__for_iterator;
CHECK_OBJECT( tmp_next_source_5 );
tmp_assign_source_23 = ITERATOR_NEXT( tmp_next_source_5 );
if ( tmp_assign_source_23 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_5;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooooooooo";
exception_lineno = 224;
goto try_except_handler_7;
}
}
{
PyObject *old = tmp_for_loop_4__iter_value;
tmp_for_loop_4__iter_value = tmp_assign_source_23;
Py_XDECREF( old );
}
tmp_assign_source_24 = tmp_for_loop_4__iter_value;
CHECK_OBJECT( tmp_assign_source_24 );
{
PyObject *old = var_field;
var_field = tmp_assign_source_24;
Py_INCREF( var_field );
Py_XDECREF( old );
}
tmp_hasattr_source_1 = var_field;
CHECK_OBJECT( tmp_hasattr_source_1 );
tmp_hasattr_attr_1 = const_str_plain_bulk_related_objects;
tmp_res = PyObject_HasAttr( tmp_hasattr_source_1, tmp_hasattr_attr_1 );
if ( tmp_res == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 225;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_7;
}
if ( tmp_res == 1 )
{
goto branch_yes_10;
}
else
{
goto branch_no_10;
}
branch_yes_10:;
tmp_source_name_32 = var_field;
CHECK_OBJECT( tmp_source_name_32 );
tmp_called_name_12 = LOOKUP_ATTRIBUTE( tmp_source_name_32, const_str_plain_bulk_related_objects );
if ( tmp_called_name_12 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 227;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_7;
}
tmp_args_element_name_14 = var_new_objs;
if ( tmp_args_element_name_14 == NULL )
{
Py_DECREF( tmp_called_name_12 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "new_objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 227;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_7;
}
tmp_source_name_33 = par_self;
if ( tmp_source_name_33 == NULL )
{
Py_DECREF( tmp_called_name_12 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 227;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_7;
}
tmp_args_element_name_15 = LOOKUP_ATTRIBUTE( tmp_source_name_33, const_str_plain_using );
if ( tmp_args_element_name_15 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_12 );
exception_lineno = 227;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_7;
}
frame_a71d042c297bd0001c6b1b57573b0fc1->m_frame.f_lineno = 227;
{
PyObject *call_args[] = { tmp_args_element_name_14, tmp_args_element_name_15 };
tmp_assign_source_25 = CALL_FUNCTION_WITH_ARGS2( tmp_called_name_12, call_args );
}
Py_DECREF( tmp_called_name_12 );
Py_DECREF( tmp_args_element_name_15 );
if ( tmp_assign_source_25 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 227;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_7;
}
{
PyObject *old = var_sub_objs;
var_sub_objs = tmp_assign_source_25;
Py_XDECREF( old );
}
tmp_source_name_34 = par_self;
if ( tmp_source_name_34 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 228;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_7;
}
tmp_called_name_13 = LOOKUP_ATTRIBUTE( tmp_source_name_34, const_str_plain_collect );
if ( tmp_called_name_13 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 228;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_7;
}
tmp_args_name_4 = PyTuple_New( 1 );
tmp_tuple_element_4 = var_sub_objs;
if ( tmp_tuple_element_4 == NULL )
{
Py_DECREF( tmp_called_name_13 );
Py_DECREF( tmp_args_name_4 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "sub_objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 228;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_7;
}
Py_INCREF( tmp_tuple_element_4 );
PyTuple_SET_ITEM( tmp_args_name_4, 0, tmp_tuple_element_4 );
tmp_kw_name_4 = _PyDict_NewPresized( 2 );
tmp_dict_key_7 = const_str_plain_source;
tmp_dict_value_7 = var_model;
if ( tmp_dict_value_7 == NULL )
{
Py_DECREF( tmp_called_name_13 );
Py_DECREF( tmp_args_name_4 );
Py_DECREF( tmp_kw_name_4 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "model" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 228;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_7;
}
tmp_res = PyDict_SetItem( tmp_kw_name_4, tmp_dict_key_7, tmp_dict_value_7 );
assert( !(tmp_res != 0) );
tmp_dict_key_8 = const_str_plain_nullable;
tmp_dict_value_8 = Py_True;
tmp_res = PyDict_SetItem( tmp_kw_name_4, tmp_dict_key_8, tmp_dict_value_8 );
assert( !(tmp_res != 0) );
frame_a71d042c297bd0001c6b1b57573b0fc1->m_frame.f_lineno = 228;
tmp_unused = CALL_FUNCTION( tmp_called_name_13, tmp_args_name_4, tmp_kw_name_4 );
Py_DECREF( tmp_called_name_13 );
Py_DECREF( tmp_args_name_4 );
Py_DECREF( tmp_kw_name_4 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 228;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_7;
}
Py_DECREF( tmp_unused );
branch_no_10:;
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 224;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_7;
}
goto loop_start_5;
loop_end_5:;
goto try_end_4;
// Exception handler code:
try_except_handler_7:;
exception_keeper_type_6 = exception_type;
exception_keeper_value_6 = exception_value;
exception_keeper_tb_6 = exception_tb;
exception_keeper_lineno_6 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_for_loop_4__iter_value );
tmp_for_loop_4__iter_value = NULL;
Py_XDECREF( tmp_for_loop_4__for_iterator );
tmp_for_loop_4__for_iterator = NULL;
// Re-raise.
exception_type = exception_keeper_type_6;
exception_value = exception_keeper_value_6;
exception_tb = exception_keeper_tb_6;
exception_lineno = exception_keeper_lineno_6;
goto frame_exception_exit_1;
// End of try:
try_end_4:;
Py_XDECREF( tmp_for_loop_4__iter_value );
tmp_for_loop_4__iter_value = NULL;
Py_XDECREF( tmp_for_loop_4__for_iterator );
tmp_for_loop_4__for_iterator = NULL;
branch_no_5:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_a71d042c297bd0001c6b1b57573b0fc1 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto frame_no_exception_2;
frame_return_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_a71d042c297bd0001c6b1b57573b0fc1 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto try_return_handler_1;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_a71d042c297bd0001c6b1b57573b0fc1 );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( frame_a71d042c297bd0001c6b1b57573b0fc1, exception_lineno );
}
else if ( exception_tb->tb_frame != &frame_a71d042c297bd0001c6b1b57573b0fc1->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, frame_a71d042c297bd0001c6b1b57573b0fc1, exception_lineno );
}
// Attachs locals to frame if any.
Nuitka_Frame_AttachLocals(
(struct Nuitka_FrameObject *)frame_a71d042c297bd0001c6b1b57573b0fc1,
type_description_1,
par_self,
par_objs,
par_source,
par_nullable,
par_collect_related,
par_source_attr,
par_reverse_dependency,
par_keep_parents,
var_new_objs,
var_model,
var_concrete_model,
var_ptr,
var_parent_objs,
var_parents,
var_related,
var_field,
var_batches,
var_batch,
var_sub_objs
);
// Release cached frame.
if ( frame_a71d042c297bd0001c6b1b57573b0fc1 == cache_frame_a71d042c297bd0001c6b1b57573b0fc1 )
{
Py_DECREF( frame_a71d042c297bd0001c6b1b57573b0fc1 );
}
cache_frame_a71d042c297bd0001c6b1b57573b0fc1 = NULL;
assertFrameObject( frame_a71d042c297bd0001c6b1b57573b0fc1 );
// Put the previous frame back on top.
popFrameStack();
// Return the error.
goto try_except_handler_1;
frame_no_exception_2:;
tmp_return_value = Py_None;
Py_INCREF( tmp_return_value );
goto try_return_handler_1;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_14_collect );
return NULL;
// Return handler code:
try_return_handler_1:;
Py_XDECREF( par_self );
par_self = NULL;
Py_XDECREF( par_objs );
par_objs = NULL;
Py_XDECREF( par_source );
par_source = NULL;
Py_XDECREF( par_nullable );
par_nullable = NULL;
Py_XDECREF( par_collect_related );
par_collect_related = NULL;
Py_XDECREF( par_source_attr );
par_source_attr = NULL;
Py_XDECREF( par_reverse_dependency );
par_reverse_dependency = NULL;
Py_XDECREF( par_keep_parents );
par_keep_parents = NULL;
Py_XDECREF( var_new_objs );
var_new_objs = NULL;
Py_XDECREF( var_model );
var_model = NULL;
Py_XDECREF( var_concrete_model );
var_concrete_model = NULL;
Py_XDECREF( var_ptr );
var_ptr = NULL;
Py_XDECREF( var_parent_objs );
var_parent_objs = NULL;
Py_XDECREF( var_parents );
var_parents = NULL;
Py_XDECREF( var_related );
var_related = NULL;
Py_XDECREF( var_field );
var_field = NULL;
Py_XDECREF( var_batches );
var_batches = NULL;
Py_XDECREF( var_batch );
var_batch = NULL;
Py_XDECREF( var_sub_objs );
var_sub_objs = NULL;
goto function_return_exit;
// Exception handler code:
try_except_handler_1:;
exception_keeper_type_7 = exception_type;
exception_keeper_value_7 = exception_value;
exception_keeper_tb_7 = exception_tb;
exception_keeper_lineno_7 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( par_self );
par_self = NULL;
Py_XDECREF( par_objs );
par_objs = NULL;
Py_XDECREF( par_source );
par_source = NULL;
Py_XDECREF( par_nullable );
par_nullable = NULL;
Py_XDECREF( par_collect_related );
par_collect_related = NULL;
Py_XDECREF( par_source_attr );
par_source_attr = NULL;
Py_XDECREF( par_reverse_dependency );
par_reverse_dependency = NULL;
Py_XDECREF( par_keep_parents );
par_keep_parents = NULL;
Py_XDECREF( var_new_objs );
var_new_objs = NULL;
Py_XDECREF( var_model );
var_model = NULL;
Py_XDECREF( var_concrete_model );
var_concrete_model = NULL;
Py_XDECREF( var_ptr );
var_ptr = NULL;
Py_XDECREF( var_parent_objs );
var_parent_objs = NULL;
Py_XDECREF( var_parents );
var_parents = NULL;
Py_XDECREF( var_related );
var_related = NULL;
Py_XDECREF( var_field );
var_field = NULL;
Py_XDECREF( var_batches );
var_batches = NULL;
Py_XDECREF( var_batch );
var_batch = NULL;
Py_XDECREF( var_sub_objs );
var_sub_objs = NULL;
// Re-raise.
exception_type = exception_keeper_type_7;
exception_value = exception_keeper_value_7;
exception_tb = exception_keeper_tb_7;
exception_lineno = exception_keeper_lineno_7;
goto function_exception_exit;
// End of try:
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_14_collect );
return NULL;
function_exception_exit:
assert( exception_type );
RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
return NULL;
function_return_exit:
CHECK_OBJECT( tmp_return_value );
assert( had_error || !ERROR_OCCURRED() );
return tmp_return_value;
}
static PyObject *impl_django$db$models$deletion$$$function_15_related_objects( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
{
// Preserve error status for checks
#ifndef __NUITKA_NO_ASSERT__
NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
#endif
// Local variable declarations.
PyObject *par_self = python_pars[ 0 ];
PyObject *par_related = python_pars[ 1 ];
PyObject *par_objs = python_pars[ 2 ];
PyObject *exception_type = NULL;
PyObject *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
PyObject *tmp_args_element_name_1;
PyObject *tmp_called_name_1;
PyObject *tmp_dict_key_1;
PyObject *tmp_dict_value_1;
PyObject *tmp_dircall_arg1_1;
PyObject *tmp_dircall_arg2_1;
PyObject *tmp_left_name_1;
int tmp_res;
PyObject *tmp_return_value;
PyObject *tmp_right_name_1;
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_source_name_6;
PyObject *tmp_source_name_7;
static struct Nuitka_FrameObject *cache_frame_fa0d05ef46f92604e6acafcaa709d060 = NULL;
struct Nuitka_FrameObject *frame_fa0d05ef46f92604e6acafcaa709d060;
NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
tmp_return_value = NULL;
// Actual function code.
// Tried code:
MAKE_OR_REUSE_FRAME( cache_frame_fa0d05ef46f92604e6acafcaa709d060, codeobj_fa0d05ef46f92604e6acafcaa709d060, module_django$db$models$deletion, sizeof(void *)+sizeof(void *)+sizeof(void *) );
frame_fa0d05ef46f92604e6acafcaa709d060 = cache_frame_fa0d05ef46f92604e6acafcaa709d060;
// Push the new frame as the currently active one.
pushFrameStack( frame_fa0d05ef46f92604e6acafcaa709d060 );
// Mark the frame object as in use, ref count 1 will be up for reuse.
assert( Py_REFCNT( frame_fa0d05ef46f92604e6acafcaa709d060 ) == 2 ); // Frame stack
// Framed code:
tmp_source_name_4 = par_related;
CHECK_OBJECT( tmp_source_name_4 );
tmp_source_name_3 = LOOKUP_ATTRIBUTE( tmp_source_name_4, const_str_plain_related_model );
if ( tmp_source_name_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 234;
type_description_1 = "ooo";
goto frame_exception_exit_1;
}
tmp_source_name_2 = LOOKUP_ATTRIBUTE( tmp_source_name_3, const_str_plain__base_manager );
Py_DECREF( tmp_source_name_3 );
if ( tmp_source_name_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 234;
type_description_1 = "ooo";
goto frame_exception_exit_1;
}
tmp_called_name_1 = LOOKUP_ATTRIBUTE( tmp_source_name_2, const_str_plain_using );
Py_DECREF( tmp_source_name_2 );
if ( tmp_called_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 234;
type_description_1 = "ooo";
goto frame_exception_exit_1;
}
tmp_source_name_5 = par_self;
if ( tmp_source_name_5 == NULL )
{
Py_DECREF( tmp_called_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 234;
type_description_1 = "ooo";
goto frame_exception_exit_1;
}
tmp_args_element_name_1 = LOOKUP_ATTRIBUTE( tmp_source_name_5, const_str_plain_using );
if ( tmp_args_element_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_1 );
exception_lineno = 234;
type_description_1 = "ooo";
goto frame_exception_exit_1;
}
frame_fa0d05ef46f92604e6acafcaa709d060->m_frame.f_lineno = 234;
{
PyObject *call_args[] = { tmp_args_element_name_1 };
tmp_source_name_1 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_1, call_args );
}
Py_DECREF( tmp_called_name_1 );
Py_DECREF( tmp_args_element_name_1 );
if ( tmp_source_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 234;
type_description_1 = "ooo";
goto frame_exception_exit_1;
}
tmp_dircall_arg1_1 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_filter );
Py_DECREF( tmp_source_name_1 );
if ( tmp_dircall_arg1_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 234;
type_description_1 = "ooo";
goto frame_exception_exit_1;
}
tmp_dircall_arg2_1 = _PyDict_NewPresized( 1 );
tmp_left_name_1 = const_str_digest_d716329e951eca08639438a76ba8d694;
tmp_source_name_7 = par_related;
if ( tmp_source_name_7 == NULL )
{
Py_DECREF( tmp_dircall_arg1_1 );
Py_DECREF( tmp_dircall_arg2_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "related" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 235;
type_description_1 = "ooo";
goto frame_exception_exit_1;
}
tmp_source_name_6 = LOOKUP_ATTRIBUTE( tmp_source_name_7, const_str_plain_field );
if ( tmp_source_name_6 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_dircall_arg1_1 );
Py_DECREF( tmp_dircall_arg2_1 );
exception_lineno = 235;
type_description_1 = "ooo";
goto frame_exception_exit_1;
}
tmp_right_name_1 = LOOKUP_ATTRIBUTE( tmp_source_name_6, const_str_plain_name );
Py_DECREF( tmp_source_name_6 );
if ( tmp_right_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_dircall_arg1_1 );
Py_DECREF( tmp_dircall_arg2_1 );
exception_lineno = 235;
type_description_1 = "ooo";
goto frame_exception_exit_1;
}
tmp_dict_key_1 = BINARY_OPERATION_REMAINDER( tmp_left_name_1, tmp_right_name_1 );
Py_DECREF( tmp_right_name_1 );
if ( tmp_dict_key_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_dircall_arg1_1 );
Py_DECREF( tmp_dircall_arg2_1 );
exception_lineno = 235;
type_description_1 = "ooo";
goto frame_exception_exit_1;
}
tmp_dict_value_1 = par_objs;
if ( tmp_dict_value_1 == NULL )
{
Py_DECREF( tmp_dircall_arg1_1 );
Py_DECREF( tmp_dircall_arg2_1 );
Py_DECREF( tmp_dict_key_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "objs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 235;
type_description_1 = "ooo";
goto frame_exception_exit_1;
}
tmp_res = PyDict_SetItem( tmp_dircall_arg2_1, tmp_dict_key_1, tmp_dict_value_1 );
Py_DECREF( tmp_dict_key_1 );
if ( tmp_res != 0 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_dircall_arg1_1 );
Py_DECREF( tmp_dircall_arg2_1 );
exception_lineno = 235;
type_description_1 = "ooo";
goto frame_exception_exit_1;
}
{
PyObject *dir_call_args[] = {tmp_dircall_arg1_1, tmp_dircall_arg2_1};
tmp_return_value = impl___internal__$$$function_8_complex_call_helper_star_dict( dir_call_args );
}
if ( tmp_return_value == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 234;
type_description_1 = "ooo";
goto frame_exception_exit_1;
}
goto frame_return_exit_1;
#if 0
RESTORE_FRAME_EXCEPTION( frame_fa0d05ef46f92604e6acafcaa709d060 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto frame_no_exception_1;
frame_return_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_fa0d05ef46f92604e6acafcaa709d060 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto try_return_handler_1;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_fa0d05ef46f92604e6acafcaa709d060 );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( frame_fa0d05ef46f92604e6acafcaa709d060, exception_lineno );
}
else if ( exception_tb->tb_frame != &frame_fa0d05ef46f92604e6acafcaa709d060->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, frame_fa0d05ef46f92604e6acafcaa709d060, exception_lineno );
}
// Attachs locals to frame if any.
Nuitka_Frame_AttachLocals(
(struct Nuitka_FrameObject *)frame_fa0d05ef46f92604e6acafcaa709d060,
type_description_1,
par_self,
par_related,
par_objs
);
// Release cached frame.
if ( frame_fa0d05ef46f92604e6acafcaa709d060 == cache_frame_fa0d05ef46f92604e6acafcaa709d060 )
{
Py_DECREF( frame_fa0d05ef46f92604e6acafcaa709d060 );
}
cache_frame_fa0d05ef46f92604e6acafcaa709d060 = NULL;
assertFrameObject( frame_fa0d05ef46f92604e6acafcaa709d060 );
// Put the previous frame back on top.
popFrameStack();
// Return the error.
goto try_except_handler_1;
frame_no_exception_1:;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_15_related_objects );
return NULL;
// Return handler code:
try_return_handler_1:;
Py_XDECREF( par_self );
par_self = NULL;
Py_XDECREF( par_related );
par_related = NULL;
Py_XDECREF( par_objs );
par_objs = NULL;
goto function_return_exit;
// Exception handler code:
try_except_handler_1:;
exception_keeper_type_1 = exception_type;
exception_keeper_value_1 = exception_value;
exception_keeper_tb_1 = exception_tb;
exception_keeper_lineno_1 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( par_self );
par_self = NULL;
Py_XDECREF( par_related );
par_related = NULL;
Py_XDECREF( par_objs );
par_objs = NULL;
// Re-raise.
exception_type = exception_keeper_type_1;
exception_value = exception_keeper_value_1;
exception_tb = exception_keeper_tb_1;
exception_lineno = exception_keeper_lineno_1;
goto function_exception_exit;
// End of try:
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_15_related_objects );
return NULL;
function_exception_exit:
assert( exception_type );
RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
return NULL;
function_return_exit:
CHECK_OBJECT( tmp_return_value );
assert( had_error || !ERROR_OCCURRED() );
return tmp_return_value;
}
static PyObject *impl_django$db$models$deletion$$$function_16_instances_with_model( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
{
// Preserve error status for checks
#ifndef __NUITKA_NO_ASSERT__
NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
#endif
// Local variable declarations.
struct Nuitka_CellObject *par_self = PyCell_NEW1( python_pars[ 0 ] );
PyObject *tmp_return_value;
tmp_return_value = NULL;
// Actual function code.
// Tried code:
tmp_return_value = Nuitka_Generator_New(
django$db$models$deletion$$$function_16_instances_with_model$$$genobj_1_instances_with_model_context,
module_django$db$models$deletion,
const_str_plain_instances_with_model,
#if PYTHON_VERSION >= 350
const_str_digest_e21eecfbf3e2cc513aaf495b8aa3812a,
#endif
codeobj_754aafcc5876f7f866cf01b2a209ba26,
1
);
((struct Nuitka_GeneratorObject *)tmp_return_value)->m_closure[0] = par_self;
Py_INCREF( ((struct Nuitka_GeneratorObject *)tmp_return_value)->m_closure[0] );
assert( Py_SIZE( tmp_return_value ) >= 1 );
goto try_return_handler_1;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_16_instances_with_model );
return NULL;
// Return handler code:
try_return_handler_1:;
CHECK_OBJECT( (PyObject *)par_self );
Py_DECREF( par_self );
par_self = NULL;
goto function_return_exit;
// End of try:
CHECK_OBJECT( (PyObject *)par_self );
Py_DECREF( par_self );
par_self = NULL;
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_16_instances_with_model );
return NULL;
function_return_exit:
CHECK_OBJECT( tmp_return_value );
assert( had_error || !ERROR_OCCURRED() );
return tmp_return_value;
}
#if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
struct django$db$models$deletion$$$function_16_instances_with_model$$$genobj_1_instances_with_model_locals {
PyObject *var_model
PyObject *var_instances
PyObject *var_obj
PyObject *tmp_for_loop_1__for_iterator
PyObject *tmp_for_loop_1__iter_value
PyObject *tmp_for_loop_2__for_iterator
PyObject *tmp_for_loop_2__iter_value
PyObject *tmp_tuple_unpack_1__element_1
PyObject *tmp_tuple_unpack_1__element_2
PyObject *tmp_tuple_unpack_1__source_iter
PyObject *exception_type
PyObject *exception_value
PyTracebackObject *exception_tb
int exception_lineno
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
int exception_keeper_lineno_1;
PyObject *exception_keeper_type_2;
PyObject *exception_keeper_value_2;
PyTracebackObject *exception_keeper_tb_2;
int exception_keeper_lineno_2;
PyObject *exception_keeper_type_3;
PyObject *exception_keeper_value_3;
PyTracebackObject *exception_keeper_tb_3;
int exception_keeper_lineno_3;
PyObject *exception_keeper_type_4;
PyObject *exception_keeper_value_4;
PyTracebackObject *exception_keeper_tb_4;
int exception_keeper_lineno_4;
PyObject *exception_keeper_type_5;
PyObject *exception_keeper_value_5;
PyTracebackObject *exception_keeper_tb_5;
int exception_keeper_lineno_5;
PyObject *tmp_args_element_name_1;
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_called_name_1;
PyObject *tmp_expression_name_1;
PyObject *tmp_iter_arg_1;
PyObject *tmp_iter_arg_2;
PyObject *tmp_iter_arg_3;
PyObject *tmp_iterator_attempt;
PyObject *tmp_iterator_name_1;
PyObject *tmp_next_source_1;
PyObject *tmp_next_source_2;
PyObject *tmp_source_name_1;
PyObject *tmp_source_name_2;
PyObject *tmp_tuple_element_1;
PyObject *tmp_unpack_1;
PyObject *tmp_unpack_2;
char const *type_description_1
};
#endif
#if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
static PyObject *django$db$models$deletion$$$function_16_instances_with_model$$$genobj_1_instances_with_model_context( struct Nuitka_GeneratorObject *generator, PyObject *yield_return_value )
#else
static void django$db$models$deletion$$$function_16_instances_with_model$$$genobj_1_instances_with_model_context( struct Nuitka_GeneratorObject *generator )
#endif
{
CHECK_OBJECT( (PyObject *)generator );
assert( Nuitka_Generator_Check( (PyObject *)generator ) );
// Local variable initialization
PyObject *var_model = NULL;
PyObject *var_instances = NULL;
PyObject *var_obj = NULL;
PyObject *tmp_for_loop_1__for_iterator = NULL;
PyObject *tmp_for_loop_1__iter_value = NULL;
PyObject *tmp_for_loop_2__for_iterator = NULL;
PyObject *tmp_for_loop_2__iter_value = NULL;
PyObject *tmp_tuple_unpack_1__element_1 = NULL;
PyObject *tmp_tuple_unpack_1__element_2 = NULL;
PyObject *tmp_tuple_unpack_1__source_iter = NULL;
PyObject *exception_type = NULL;
PyObject *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
PyObject *exception_keeper_type_2;
PyObject *exception_keeper_value_2;
PyTracebackObject *exception_keeper_tb_2;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_2;
PyObject *exception_keeper_type_3;
PyObject *exception_keeper_value_3;
PyTracebackObject *exception_keeper_tb_3;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_3;
PyObject *exception_keeper_type_4;
PyObject *exception_keeper_value_4;
PyTracebackObject *exception_keeper_tb_4;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_4;
PyObject *exception_keeper_type_5;
PyObject *exception_keeper_value_5;
PyTracebackObject *exception_keeper_tb_5;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_5;
PyObject *tmp_args_element_name_1;
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_called_name_1;
PyObject *tmp_expression_name_1;
PyObject *tmp_iter_arg_1;
PyObject *tmp_iter_arg_2;
PyObject *tmp_iter_arg_3;
PyObject *tmp_iterator_attempt;
PyObject *tmp_iterator_name_1;
PyObject *tmp_next_source_1;
PyObject *tmp_next_source_2;
PyObject *tmp_source_name_1;
PyObject *tmp_source_name_2;
PyObject *tmp_tuple_element_1;
PyObject *tmp_unpack_1;
PyObject *tmp_unpack_2;
NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
static struct Nuitka_FrameObject *cache_frame_generator = NULL;
NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
// Dispatch to yield based on return label index:
// Actual function code.
// Tried code:
MAKE_OR_REUSE_FRAME( cache_frame_generator, codeobj_754aafcc5876f7f866cf01b2a209ba26, module_django$db$models$deletion, sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *) );
generator->m_frame = cache_frame_generator;
// Mark the frame object as in use, ref count 1 will be up for reuse.
Py_INCREF( generator->m_frame );
assert( Py_REFCNT( generator->m_frame ) == 2 ); // Frame stack
#if PYTHON_VERSION >= 340
generator->m_frame->m_frame.f_gen = (PyObject *)generator;
#endif
Py_CLEAR( generator->m_frame->m_frame.f_back );
generator->m_frame->m_frame.f_back = PyThreadState_GET()->frame;
Py_INCREF( generator->m_frame->m_frame.f_back );
PyThreadState_GET()->frame = &generator->m_frame->m_frame;
Py_INCREF( generator->m_frame );
Nuitka_Frame_MarkAsExecuting( generator->m_frame );
#if PYTHON_VERSION >= 300
// Accept currently existing exception as the one to publish again when we
// yield or yield from.
PyThreadState *thread_state = PyThreadState_GET();
generator->m_frame->m_frame.f_exc_type = thread_state->exc_type;
if ( generator->m_frame->m_frame.f_exc_type == Py_None ) generator->m_frame->m_frame.f_exc_type = NULL;
Py_XINCREF( generator->m_frame->m_frame.f_exc_type );
generator->m_frame->m_frame.f_exc_value = thread_state->exc_value;
Py_XINCREF( generator->m_frame->m_frame.f_exc_value );
generator->m_frame->m_frame.f_exc_traceback = thread_state->exc_traceback;
Py_XINCREF( generator->m_frame->m_frame.f_exc_traceback );
#endif
// Framed code:
tmp_source_name_1 = GET_STRING_DICT_VALUE( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_six );
if (unlikely( tmp_source_name_1 == NULL ))
{
tmp_source_name_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_six );
}
if ( tmp_source_name_1 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "six" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 239;
type_description_1 = "cooo";
goto frame_exception_exit_1;
}
tmp_called_name_1 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_iteritems );
if ( tmp_called_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 239;
type_description_1 = "cooo";
goto frame_exception_exit_1;
}
if ( generator->m_closure[0] == NULL )
{
tmp_source_name_2 = NULL;
}
else
{
tmp_source_name_2 = PyCell_GET( generator->m_closure[0] );
}
if ( tmp_source_name_2 == NULL )
{
Py_DECREF( tmp_called_name_1 );
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "free variable '%s' referenced before assignment in enclosing scope", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 239;
type_description_1 = "cooo";
goto frame_exception_exit_1;
}
tmp_args_element_name_1 = LOOKUP_ATTRIBUTE( tmp_source_name_2, const_str_plain_data );
if ( tmp_args_element_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_1 );
exception_lineno = 239;
type_description_1 = "cooo";
goto frame_exception_exit_1;
}
generator->m_frame->m_frame.f_lineno = 239;
{
PyObject *call_args[] = { tmp_args_element_name_1 };
tmp_iter_arg_1 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_1, call_args );
}
Py_DECREF( tmp_called_name_1 );
Py_DECREF( tmp_args_element_name_1 );
if ( tmp_iter_arg_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 239;
type_description_1 = "cooo";
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_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 239;
type_description_1 = "cooo";
goto frame_exception_exit_1;
}
assert( tmp_for_loop_1__for_iterator == NULL );
tmp_for_loop_1__for_iterator = tmp_assign_source_1;
// Tried code:
loop_start_1:;
tmp_next_source_1 = tmp_for_loop_1__for_iterator;
CHECK_OBJECT( tmp_next_source_1 );
tmp_assign_source_2 = ITERATOR_NEXT( tmp_next_source_1 );
if ( tmp_assign_source_2 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_1;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "cooo";
exception_lineno = 239;
goto try_except_handler_2;
}
}
{
PyObject *old = tmp_for_loop_1__iter_value;
tmp_for_loop_1__iter_value = tmp_assign_source_2;
Py_XDECREF( old );
}
// Tried code:
tmp_iter_arg_2 = tmp_for_loop_1__iter_value;
CHECK_OBJECT( tmp_iter_arg_2 );
tmp_assign_source_3 = MAKE_ITERATOR( tmp_iter_arg_2 );
if ( tmp_assign_source_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 239;
type_description_1 = "cooo";
goto try_except_handler_3;
}
{
PyObject *old = tmp_tuple_unpack_1__source_iter;
tmp_tuple_unpack_1__source_iter = tmp_assign_source_3;
Py_XDECREF( old );
}
// Tried code:
tmp_unpack_1 = tmp_tuple_unpack_1__source_iter;
CHECK_OBJECT( tmp_unpack_1 );
tmp_assign_source_4 = UNPACK_NEXT( tmp_unpack_1, 0, 2 );
if ( tmp_assign_source_4 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "cooo";
exception_lineno = 239;
goto try_except_handler_4;
}
{
PyObject *old = tmp_tuple_unpack_1__element_1;
tmp_tuple_unpack_1__element_1 = tmp_assign_source_4;
Py_XDECREF( old );
}
tmp_unpack_2 = tmp_tuple_unpack_1__source_iter;
CHECK_OBJECT( tmp_unpack_2 );
tmp_assign_source_5 = UNPACK_NEXT( tmp_unpack_2, 1, 2 );
if ( tmp_assign_source_5 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "cooo";
exception_lineno = 239;
goto try_except_handler_4;
}
{
PyObject *old = tmp_tuple_unpack_1__element_2;
tmp_tuple_unpack_1__element_2 = tmp_assign_source_5;
Py_XDECREF( old );
}
tmp_iterator_name_1 = tmp_tuple_unpack_1__source_iter;
CHECK_OBJECT( tmp_iterator_name_1 );
// Check if iterator has left-over elements.
CHECK_OBJECT( tmp_iterator_name_1 ); assert( HAS_ITERNEXT( tmp_iterator_name_1 ) );
tmp_iterator_attempt = (*Py_TYPE( tmp_iterator_name_1 )->tp_iternext)( tmp_iterator_name_1 );
if (likely( tmp_iterator_attempt == NULL ))
{
PyObject *error = GET_ERROR_OCCURRED();
if ( error != NULL )
{
if ( EXCEPTION_MATCH_BOOL_SINGLE( error, PyExc_StopIteration ))
{
CLEAR_ERROR_OCCURRED();
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "cooo";
exception_lineno = 239;
goto try_except_handler_4;
}
}
}
else
{
Py_DECREF( tmp_iterator_attempt );
// TODO: Could avoid PyErr_Format.
#if PYTHON_VERSION < 300
PyErr_Format( PyExc_ValueError, "too many values to unpack" );
#else
PyErr_Format( PyExc_ValueError, "too many values to unpack (expected 2)" );
#endif
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "cooo";
exception_lineno = 239;
goto try_except_handler_4;
}
goto try_end_1;
// Exception handler code:
try_except_handler_4:;
exception_keeper_type_1 = exception_type;
exception_keeper_value_1 = exception_value;
exception_keeper_tb_1 = exception_tb;
exception_keeper_lineno_1 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_1__source_iter );
tmp_tuple_unpack_1__source_iter = NULL;
// Re-raise.
exception_type = exception_keeper_type_1;
exception_value = exception_keeper_value_1;
exception_tb = exception_keeper_tb_1;
exception_lineno = exception_keeper_lineno_1;
goto try_except_handler_3;
// End of try:
try_end_1:;
goto try_end_2;
// Exception handler code:
try_except_handler_3:;
exception_keeper_type_2 = exception_type;
exception_keeper_value_2 = exception_value;
exception_keeper_tb_2 = exception_tb;
exception_keeper_lineno_2 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_1__element_1 );
tmp_tuple_unpack_1__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_1__element_2 );
tmp_tuple_unpack_1__element_2 = NULL;
// Re-raise.
exception_type = exception_keeper_type_2;
exception_value = exception_keeper_value_2;
exception_tb = exception_keeper_tb_2;
exception_lineno = exception_keeper_lineno_2;
goto try_except_handler_2;
// End of try:
try_end_2:;
Py_XDECREF( tmp_tuple_unpack_1__source_iter );
tmp_tuple_unpack_1__source_iter = NULL;
tmp_assign_source_6 = tmp_tuple_unpack_1__element_1;
CHECK_OBJECT( tmp_assign_source_6 );
{
PyObject *old = var_model;
var_model = tmp_assign_source_6;
Py_INCREF( var_model );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_1__element_1 );
tmp_tuple_unpack_1__element_1 = NULL;
tmp_assign_source_7 = tmp_tuple_unpack_1__element_2;
CHECK_OBJECT( tmp_assign_source_7 );
{
PyObject *old = var_instances;
var_instances = tmp_assign_source_7;
Py_INCREF( var_instances );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_1__element_2 );
tmp_tuple_unpack_1__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_1__element_1 );
tmp_tuple_unpack_1__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_1__element_2 );
tmp_tuple_unpack_1__element_2 = NULL;
tmp_iter_arg_3 = var_instances;
if ( tmp_iter_arg_3 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "instances" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 240;
type_description_1 = "cooo";
goto try_except_handler_2;
}
tmp_assign_source_8 = MAKE_ITERATOR( tmp_iter_arg_3 );
if ( tmp_assign_source_8 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 240;
type_description_1 = "cooo";
goto try_except_handler_2;
}
{
PyObject *old = tmp_for_loop_2__for_iterator;
tmp_for_loop_2__for_iterator = tmp_assign_source_8;
Py_XDECREF( old );
}
// Tried code:
loop_start_2:;
tmp_next_source_2 = tmp_for_loop_2__for_iterator;
CHECK_OBJECT( tmp_next_source_2 );
tmp_assign_source_9 = ITERATOR_NEXT( tmp_next_source_2 );
if ( tmp_assign_source_9 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_2;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "cooo";
exception_lineno = 240;
goto try_except_handler_5;
}
}
{
PyObject *old = tmp_for_loop_2__iter_value;
tmp_for_loop_2__iter_value = tmp_assign_source_9;
Py_XDECREF( old );
}
tmp_assign_source_10 = tmp_for_loop_2__iter_value;
CHECK_OBJECT( tmp_assign_source_10 );
{
PyObject *old = var_obj;
var_obj = tmp_assign_source_10;
Py_INCREF( var_obj );
Py_XDECREF( old );
}
tmp_expression_name_1 = PyTuple_New( 2 );
tmp_tuple_element_1 = var_model;
if ( tmp_tuple_element_1 == NULL )
{
Py_DECREF( tmp_expression_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "model" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 241;
type_description_1 = "cooo";
goto try_except_handler_5;
}
Py_INCREF( tmp_tuple_element_1 );
PyTuple_SET_ITEM( tmp_expression_name_1, 0, tmp_tuple_element_1 );
tmp_tuple_element_1 = var_obj;
CHECK_OBJECT( tmp_tuple_element_1 );
Py_INCREF( tmp_tuple_element_1 );
PyTuple_SET_ITEM( tmp_expression_name_1, 1, tmp_tuple_element_1 );
tmp_unused = GENERATOR_YIELD( generator, tmp_expression_name_1 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 241;
type_description_1 = "cooo";
goto try_except_handler_5;
}
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 240;
type_description_1 = "cooo";
goto try_except_handler_5;
}
goto loop_start_2;
loop_end_2:;
goto try_end_3;
// Exception handler code:
try_except_handler_5:;
exception_keeper_type_3 = exception_type;
exception_keeper_value_3 = exception_value;
exception_keeper_tb_3 = exception_tb;
exception_keeper_lineno_3 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_for_loop_2__iter_value );
tmp_for_loop_2__iter_value = NULL;
Py_XDECREF( tmp_for_loop_2__for_iterator );
tmp_for_loop_2__for_iterator = NULL;
// Re-raise.
exception_type = exception_keeper_type_3;
exception_value = exception_keeper_value_3;
exception_tb = exception_keeper_tb_3;
exception_lineno = exception_keeper_lineno_3;
goto try_except_handler_2;
// End of try:
try_end_3:;
Py_XDECREF( tmp_for_loop_2__iter_value );
tmp_for_loop_2__iter_value = NULL;
Py_XDECREF( tmp_for_loop_2__for_iterator );
tmp_for_loop_2__for_iterator = NULL;
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 239;
type_description_1 = "cooo";
goto try_except_handler_2;
}
goto loop_start_1;
loop_end_1:;
goto try_end_4;
// Exception handler code:
try_except_handler_2:;
exception_keeper_type_4 = exception_type;
exception_keeper_value_4 = exception_value;
exception_keeper_tb_4 = exception_tb;
exception_keeper_lineno_4 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_for_loop_1__iter_value );
tmp_for_loop_1__iter_value = NULL;
Py_XDECREF( tmp_for_loop_1__for_iterator );
tmp_for_loop_1__for_iterator = NULL;
// Re-raise.
exception_type = exception_keeper_type_4;
exception_value = exception_keeper_value_4;
exception_tb = exception_keeper_tb_4;
exception_lineno = exception_keeper_lineno_4;
goto frame_exception_exit_1;
// End of try:
try_end_4:;
Nuitka_Frame_MarkAsNotExecuting( generator->m_frame );
#if PYTHON_VERSION >= 300
Py_CLEAR( generator->m_frame->m_frame.f_exc_type );
Py_CLEAR( generator->m_frame->m_frame.f_exc_value );
Py_CLEAR( generator->m_frame->m_frame.f_exc_traceback );
#endif
// Allow re-use of the frame again.
Py_DECREF( generator->m_frame );
goto frame_no_exception_1;
frame_exception_exit_1:;
// If it's not an exit exception, consider and create a traceback for it.
if ( !EXCEPTION_MATCH_GENERATOR( exception_type ) )
{
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( generator->m_frame, exception_lineno );
}
else if ( exception_tb->tb_frame != &generator->m_frame->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, generator->m_frame, exception_lineno );
}
Nuitka_Frame_AttachLocals(
(struct Nuitka_FrameObject *)generator->m_frame,
type_description_1,
generator->m_closure[0],
var_model,
var_instances,
var_obj
);
// Release cached frame.
if ( generator->m_frame == cache_frame_generator )
{
Py_DECREF( generator->m_frame );
}
cache_frame_generator = NULL;
assertFrameObject( generator->m_frame );
}
#if PYTHON_VERSION >= 300
Py_CLEAR( generator->m_frame->m_frame.f_exc_type );
Py_CLEAR( generator->m_frame->m_frame.f_exc_value );
Py_CLEAR( generator->m_frame->m_frame.f_exc_traceback );
#endif
Py_DECREF( generator->m_frame );
// Return the error.
goto try_except_handler_1;
frame_no_exception_1:;
goto try_end_5;
// Exception handler code:
try_except_handler_1:;
exception_keeper_type_5 = exception_type;
exception_keeper_value_5 = exception_value;
exception_keeper_tb_5 = exception_tb;
exception_keeper_lineno_5 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( var_model );
var_model = NULL;
Py_XDECREF( var_instances );
var_instances = NULL;
Py_XDECREF( var_obj );
var_obj = NULL;
// Re-raise.
exception_type = exception_keeper_type_5;
exception_value = exception_keeper_value_5;
exception_tb = exception_keeper_tb_5;
exception_lineno = exception_keeper_lineno_5;
goto function_exception_exit;
// End of try:
try_end_5:;
Py_XDECREF( tmp_for_loop_1__iter_value );
tmp_for_loop_1__iter_value = NULL;
Py_XDECREF( tmp_for_loop_1__for_iterator );
tmp_for_loop_1__for_iterator = NULL;
Py_XDECREF( var_model );
var_model = NULL;
Py_XDECREF( var_instances );
var_instances = NULL;
Py_XDECREF( var_obj );
var_obj = NULL;
#if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
return NULL;
#else
generator->m_yielded = NULL;
return;
#endif
function_exception_exit:
assert( exception_type );
RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
#if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
return NULL;
#else
generator->m_yielded = NULL;
return;
#endif
}
static PyObject *impl_django$db$models$deletion$$$function_17_sort( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
{
// Preserve error status for checks
#ifndef __NUITKA_NO_ASSERT__
NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
#endif
// Local variable declarations.
struct Nuitka_CellObject *par_self = PyCell_NEW1( python_pars[ 0 ] );
PyObject *var_sorted_models = NULL;
PyObject *var_concrete_models = NULL;
PyObject *var_models = NULL;
PyObject *var_found = NULL;
PyObject *var_model = NULL;
PyObject *var_dependencies = NULL;
PyObject *tmp_for_loop_1__for_iterator = NULL;
PyObject *tmp_for_loop_1__iter_value = NULL;
PyObject *tmp_genexpr_1__$0 = NULL;
PyObject *exception_type = NULL;
PyObject *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
PyObject *exception_keeper_type_2;
PyObject *exception_keeper_value_2;
PyTracebackObject *exception_keeper_tb_2;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_2;
int tmp_and_left_truth_1;
PyObject *tmp_and_left_value_1;
PyObject *tmp_and_right_value_1;
PyObject *tmp_args_element_name_1;
PyObject *tmp_args_element_name_2;
PyObject *tmp_args_element_name_3;
PyObject *tmp_args_element_name_4;
PyObject *tmp_args_element_name_5;
PyObject *tmp_assattr_name_1;
PyObject *tmp_assattr_target_1;
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_called_name_1;
PyObject *tmp_called_name_2;
PyObject *tmp_called_name_3;
PyObject *tmp_called_name_4;
PyObject *tmp_called_name_5;
int tmp_cmp_In_1;
int tmp_cmp_Lt_1;
PyObject *tmp_compare_left_1;
PyObject *tmp_compare_left_2;
PyObject *tmp_compare_right_1;
PyObject *tmp_compare_right_2;
int tmp_cond_truth_1;
int tmp_cond_truth_2;
PyObject *tmp_cond_value_1;
PyObject *tmp_cond_value_2;
PyObject *tmp_iter_arg_1;
PyObject *tmp_iter_arg_2;
PyObject *tmp_len_arg_1;
PyObject *tmp_len_arg_2;
PyObject *tmp_list_arg_1;
PyObject *tmp_next_source_1;
PyObject *tmp_outline_return_value_1;
bool tmp_result;
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_source_name_6;
PyObject *tmp_source_name_7;
PyObject *tmp_source_name_8;
PyObject *tmp_source_name_9;
PyObject *tmp_source_name_10;
NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
static struct Nuitka_FrameObject *cache_frame_3024af40360f1e53d055413e8dcd6901 = NULL;
struct Nuitka_FrameObject *frame_3024af40360f1e53d055413e8dcd6901;
NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
tmp_return_value = NULL;
tmp_outline_return_value_1 = NULL;
// Actual function code.
tmp_assign_source_1 = PyList_New( 0 );
assert( var_sorted_models == NULL );
var_sorted_models = tmp_assign_source_1;
tmp_assign_source_2 = PySet_New( NULL );
assert( var_concrete_models == NULL );
var_concrete_models = tmp_assign_source_2;
// Tried code:
MAKE_OR_REUSE_FRAME( cache_frame_3024af40360f1e53d055413e8dcd6901, codeobj_3024af40360f1e53d055413e8dcd6901, module_django$db$models$deletion, sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *) );
frame_3024af40360f1e53d055413e8dcd6901 = cache_frame_3024af40360f1e53d055413e8dcd6901;
// Push the new frame as the currently active one.
pushFrameStack( frame_3024af40360f1e53d055413e8dcd6901 );
// Mark the frame object as in use, ref count 1 will be up for reuse.
assert( Py_REFCNT( frame_3024af40360f1e53d055413e8dcd6901 ) == 2 ); // Frame stack
// Framed code:
if ( par_self == NULL )
{
tmp_source_name_1 = NULL;
}
else
{
tmp_source_name_1 = PyCell_GET( par_self );
}
if ( tmp_source_name_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 246;
type_description_1 = "coooooo";
goto frame_exception_exit_1;
}
tmp_list_arg_1 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_data );
if ( tmp_list_arg_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 246;
type_description_1 = "coooooo";
goto frame_exception_exit_1;
}
tmp_assign_source_3 = PySequence_List( tmp_list_arg_1 );
Py_DECREF( tmp_list_arg_1 );
if ( tmp_assign_source_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 246;
type_description_1 = "coooooo";
goto frame_exception_exit_1;
}
assert( var_models == NULL );
var_models = tmp_assign_source_3;
loop_start_1:;
tmp_len_arg_1 = var_sorted_models;
if ( tmp_len_arg_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "sorted_models" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 247;
type_description_1 = "coooooo";
goto frame_exception_exit_1;
}
tmp_compare_left_1 = BUILTIN_LEN( tmp_len_arg_1 );
if ( tmp_compare_left_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 247;
type_description_1 = "coooooo";
goto frame_exception_exit_1;
}
tmp_len_arg_2 = var_models;
if ( tmp_len_arg_2 == NULL )
{
Py_DECREF( tmp_compare_left_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "models" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 247;
type_description_1 = "coooooo";
goto frame_exception_exit_1;
}
tmp_compare_right_1 = BUILTIN_LEN( tmp_len_arg_2 );
if ( tmp_compare_right_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_compare_left_1 );
exception_lineno = 247;
type_description_1 = "coooooo";
goto frame_exception_exit_1;
}
tmp_cmp_Lt_1 = RICH_COMPARE_BOOL_LT( tmp_compare_left_1, tmp_compare_right_1 );
if ( tmp_cmp_Lt_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_compare_left_1 );
Py_DECREF( tmp_compare_right_1 );
exception_lineno = 247;
type_description_1 = "coooooo";
goto frame_exception_exit_1;
}
Py_DECREF( tmp_compare_left_1 );
Py_DECREF( tmp_compare_right_1 );
if ( tmp_cmp_Lt_1 == 1 )
{
goto branch_no_1;
}
else
{
goto branch_yes_1;
}
branch_yes_1:;
goto loop_end_1;
branch_no_1:;
tmp_assign_source_4 = Py_False;
{
PyObject *old = var_found;
var_found = tmp_assign_source_4;
Py_INCREF( var_found );
Py_XDECREF( old );
}
tmp_iter_arg_1 = var_models;
if ( tmp_iter_arg_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "models" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 249;
type_description_1 = "coooooo";
goto frame_exception_exit_1;
}
tmp_assign_source_5 = MAKE_ITERATOR( tmp_iter_arg_1 );
if ( tmp_assign_source_5 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 249;
type_description_1 = "coooooo";
goto frame_exception_exit_1;
}
{
PyObject *old = tmp_for_loop_1__for_iterator;
tmp_for_loop_1__for_iterator = tmp_assign_source_5;
Py_XDECREF( old );
}
// Tried code:
loop_start_2:;
tmp_next_source_1 = tmp_for_loop_1__for_iterator;
CHECK_OBJECT( tmp_next_source_1 );
tmp_assign_source_6 = ITERATOR_NEXT( tmp_next_source_1 );
if ( tmp_assign_source_6 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_2;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "coooooo";
exception_lineno = 249;
goto try_except_handler_2;
}
}
{
PyObject *old = tmp_for_loop_1__iter_value;
tmp_for_loop_1__iter_value = tmp_assign_source_6;
Py_XDECREF( old );
}
tmp_assign_source_7 = tmp_for_loop_1__iter_value;
CHECK_OBJECT( tmp_assign_source_7 );
{
PyObject *old = var_model;
var_model = tmp_assign_source_7;
Py_INCREF( var_model );
Py_XDECREF( old );
}
tmp_compare_left_2 = var_model;
CHECK_OBJECT( tmp_compare_left_2 );
tmp_compare_right_2 = var_sorted_models;
if ( tmp_compare_right_2 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "sorted_models" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 250;
type_description_1 = "coooooo";
goto try_except_handler_2;
}
tmp_cmp_In_1 = PySequence_Contains( tmp_compare_right_2, tmp_compare_left_2 );
assert( !(tmp_cmp_In_1 == -1) );
if ( tmp_cmp_In_1 == 1 )
{
goto branch_yes_2;
}
else
{
goto branch_no_2;
}
branch_yes_2:;
goto loop_start_2;
branch_no_2:;
if ( par_self == NULL )
{
tmp_source_name_3 = NULL;
}
else
{
tmp_source_name_3 = PyCell_GET( par_self );
}
if ( tmp_source_name_3 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 252;
type_description_1 = "coooooo";
goto try_except_handler_2;
}
tmp_source_name_2 = LOOKUP_ATTRIBUTE( tmp_source_name_3, const_str_plain_dependencies );
if ( tmp_source_name_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 252;
type_description_1 = "coooooo";
goto try_except_handler_2;
}
tmp_called_name_1 = LOOKUP_ATTRIBUTE( tmp_source_name_2, const_str_plain_get );
Py_DECREF( tmp_source_name_2 );
if ( tmp_called_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 252;
type_description_1 = "coooooo";
goto try_except_handler_2;
}
tmp_source_name_5 = var_model;
if ( tmp_source_name_5 == NULL )
{
Py_DECREF( tmp_called_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "model" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 252;
type_description_1 = "coooooo";
goto try_except_handler_2;
}
tmp_source_name_4 = LOOKUP_ATTRIBUTE( tmp_source_name_5, const_str_plain__meta );
if ( tmp_source_name_4 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_1 );
exception_lineno = 252;
type_description_1 = "coooooo";
goto try_except_handler_2;
}
tmp_args_element_name_1 = LOOKUP_ATTRIBUTE( tmp_source_name_4, const_str_plain_concrete_model );
Py_DECREF( tmp_source_name_4 );
if ( tmp_args_element_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_1 );
exception_lineno = 252;
type_description_1 = "coooooo";
goto try_except_handler_2;
}
frame_3024af40360f1e53d055413e8dcd6901->m_frame.f_lineno = 252;
{
PyObject *call_args[] = { tmp_args_element_name_1 };
tmp_assign_source_8 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_1, call_args );
}
Py_DECREF( tmp_called_name_1 );
Py_DECREF( tmp_args_element_name_1 );
if ( tmp_assign_source_8 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 252;
type_description_1 = "coooooo";
goto try_except_handler_2;
}
{
PyObject *old = var_dependencies;
var_dependencies = tmp_assign_source_8;
Py_XDECREF( old );
}
tmp_and_left_value_1 = var_dependencies;
CHECK_OBJECT( tmp_and_left_value_1 );
tmp_and_left_truth_1 = CHECK_IF_TRUE( tmp_and_left_value_1 );
if ( tmp_and_left_truth_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 253;
type_description_1 = "coooooo";
goto try_except_handler_2;
}
if ( tmp_and_left_truth_1 == 1 )
{
goto and_right_1;
}
else
{
goto and_left_1;
}
and_right_1:;
tmp_source_name_6 = var_dependencies;
CHECK_OBJECT( tmp_source_name_6 );
tmp_called_name_2 = LOOKUP_ATTRIBUTE( tmp_source_name_6, const_str_plain_difference );
if ( tmp_called_name_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 253;
type_description_1 = "coooooo";
goto try_except_handler_2;
}
tmp_args_element_name_2 = var_concrete_models;
if ( tmp_args_element_name_2 == NULL )
{
Py_DECREF( tmp_called_name_2 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "concrete_models" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 253;
type_description_1 = "coooooo";
goto try_except_handler_2;
}
frame_3024af40360f1e53d055413e8dcd6901->m_frame.f_lineno = 253;
{
PyObject *call_args[] = { tmp_args_element_name_2 };
tmp_and_right_value_1 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_2, call_args );
}
Py_DECREF( tmp_called_name_2 );
if ( tmp_and_right_value_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 253;
type_description_1 = "coooooo";
goto try_except_handler_2;
}
tmp_cond_value_1 = tmp_and_right_value_1;
goto and_end_1;
and_left_1:;
Py_INCREF( tmp_and_left_value_1 );
tmp_cond_value_1 = tmp_and_left_value_1;
and_end_1:;
tmp_cond_truth_1 = CHECK_IF_TRUE( tmp_cond_value_1 );
if ( tmp_cond_truth_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_cond_value_1 );
exception_lineno = 253;
type_description_1 = "coooooo";
goto try_except_handler_2;
}
Py_DECREF( tmp_cond_value_1 );
if ( tmp_cond_truth_1 == 1 )
{
goto branch_no_3;
}
else
{
goto branch_yes_3;
}
branch_yes_3:;
tmp_source_name_7 = var_sorted_models;
if ( tmp_source_name_7 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "sorted_models" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 254;
type_description_1 = "coooooo";
goto try_except_handler_2;
}
tmp_called_name_3 = LOOKUP_ATTRIBUTE( tmp_source_name_7, const_str_plain_append );
if ( tmp_called_name_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 254;
type_description_1 = "coooooo";
goto try_except_handler_2;
}
tmp_args_element_name_3 = var_model;
if ( tmp_args_element_name_3 == NULL )
{
Py_DECREF( tmp_called_name_3 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "model" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 254;
type_description_1 = "coooooo";
goto try_except_handler_2;
}
frame_3024af40360f1e53d055413e8dcd6901->m_frame.f_lineno = 254;
{
PyObject *call_args[] = { tmp_args_element_name_3 };
tmp_unused = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_3, call_args );
}
Py_DECREF( tmp_called_name_3 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 254;
type_description_1 = "coooooo";
goto try_except_handler_2;
}
Py_DECREF( tmp_unused );
tmp_source_name_8 = var_concrete_models;
if ( tmp_source_name_8 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "concrete_models" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 255;
type_description_1 = "coooooo";
goto try_except_handler_2;
}
tmp_called_name_4 = LOOKUP_ATTRIBUTE( tmp_source_name_8, const_str_plain_add );
if ( tmp_called_name_4 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 255;
type_description_1 = "coooooo";
goto try_except_handler_2;
}
tmp_source_name_10 = var_model;
if ( tmp_source_name_10 == NULL )
{
Py_DECREF( tmp_called_name_4 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "model" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 255;
type_description_1 = "coooooo";
goto try_except_handler_2;
}
tmp_source_name_9 = LOOKUP_ATTRIBUTE( tmp_source_name_10, const_str_plain__meta );
if ( tmp_source_name_9 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_4 );
exception_lineno = 255;
type_description_1 = "coooooo";
goto try_except_handler_2;
}
tmp_args_element_name_4 = LOOKUP_ATTRIBUTE( tmp_source_name_9, const_str_plain_concrete_model );
Py_DECREF( tmp_source_name_9 );
if ( tmp_args_element_name_4 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_4 );
exception_lineno = 255;
type_description_1 = "coooooo";
goto try_except_handler_2;
}
frame_3024af40360f1e53d055413e8dcd6901->m_frame.f_lineno = 255;
{
PyObject *call_args[] = { tmp_args_element_name_4 };
tmp_unused = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_4, call_args );
}
Py_DECREF( tmp_called_name_4 );
Py_DECREF( tmp_args_element_name_4 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 255;
type_description_1 = "coooooo";
goto try_except_handler_2;
}
Py_DECREF( tmp_unused );
tmp_assign_source_9 = Py_True;
{
PyObject *old = var_found;
var_found = tmp_assign_source_9;
Py_INCREF( var_found );
Py_XDECREF( old );
}
branch_no_3:;
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 249;
type_description_1 = "coooooo";
goto try_except_handler_2;
}
goto loop_start_2;
loop_end_2:;
goto try_end_1;
// Exception handler code:
try_except_handler_2:;
exception_keeper_type_1 = exception_type;
exception_keeper_value_1 = exception_value;
exception_keeper_tb_1 = exception_tb;
exception_keeper_lineno_1 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_for_loop_1__iter_value );
tmp_for_loop_1__iter_value = NULL;
Py_XDECREF( tmp_for_loop_1__for_iterator );
tmp_for_loop_1__for_iterator = NULL;
// Re-raise.
exception_type = exception_keeper_type_1;
exception_value = exception_keeper_value_1;
exception_tb = exception_keeper_tb_1;
exception_lineno = exception_keeper_lineno_1;
goto frame_exception_exit_1;
// End of try:
try_end_1:;
Py_XDECREF( tmp_for_loop_1__iter_value );
tmp_for_loop_1__iter_value = NULL;
Py_XDECREF( tmp_for_loop_1__for_iterator );
tmp_for_loop_1__for_iterator = NULL;
tmp_cond_value_2 = var_found;
if ( tmp_cond_value_2 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "found" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 257;
type_description_1 = "coooooo";
goto frame_exception_exit_1;
}
tmp_cond_truth_2 = CHECK_IF_TRUE( tmp_cond_value_2 );
if ( tmp_cond_truth_2 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 257;
type_description_1 = "coooooo";
goto frame_exception_exit_1;
}
if ( tmp_cond_truth_2 == 1 )
{
goto branch_no_4;
}
else
{
goto branch_yes_4;
}
branch_yes_4:;
tmp_return_value = Py_None;
Py_INCREF( tmp_return_value );
goto frame_return_exit_1;
branch_no_4:;
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 247;
type_description_1 = "coooooo";
goto frame_exception_exit_1;
}
goto loop_start_1;
loop_end_1:;
tmp_called_name_5 = GET_STRING_DICT_VALUE( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_OrderedDict );
if (unlikely( tmp_called_name_5 == NULL ))
{
tmp_called_name_5 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_OrderedDict );
}
if ( tmp_called_name_5 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "OrderedDict" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 259;
type_description_1 = "coooooo";
goto frame_exception_exit_1;
}
tmp_iter_arg_2 = var_sorted_models;
if ( tmp_iter_arg_2 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "sorted_models" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 260;
type_description_1 = "coooooo";
goto frame_exception_exit_1;
}
tmp_assign_source_10 = MAKE_ITERATOR( tmp_iter_arg_2 );
if ( tmp_assign_source_10 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 259;
type_description_1 = "coooooo";
goto frame_exception_exit_1;
}
assert( tmp_genexpr_1__$0 == NULL );
tmp_genexpr_1__$0 = tmp_assign_source_10;
// Tried code:
tmp_outline_return_value_1 = Nuitka_Generator_New(
django$db$models$deletion$$$function_17_sort$$$genexpr_1_genexpr_context,
module_django$db$models$deletion,
const_str_angle_genexpr,
#if PYTHON_VERSION >= 350
const_str_digest_ee0f69070b25f713a9c5066608df3f60,
#endif
codeobj_ca681f1e72441112db196f9175e5fa01,
2
);
((struct Nuitka_GeneratorObject *)tmp_outline_return_value_1)->m_closure[0] = PyCell_NEW0( tmp_genexpr_1__$0 );
((struct Nuitka_GeneratorObject *)tmp_outline_return_value_1)->m_closure[1] = par_self;
Py_INCREF( ((struct Nuitka_GeneratorObject *)tmp_outline_return_value_1)->m_closure[1] );
assert( Py_SIZE( tmp_outline_return_value_1 ) >= 2 );
goto try_return_handler_3;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_17_sort );
return NULL;
// Return handler code:
try_return_handler_3:;
CHECK_OBJECT( (PyObject *)tmp_genexpr_1__$0 );
Py_DECREF( tmp_genexpr_1__$0 );
tmp_genexpr_1__$0 = NULL;
goto outline_result_1;
// End of try:
CHECK_OBJECT( (PyObject *)tmp_genexpr_1__$0 );
Py_DECREF( tmp_genexpr_1__$0 );
tmp_genexpr_1__$0 = NULL;
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_17_sort );
return NULL;
outline_result_1:;
tmp_args_element_name_5 = tmp_outline_return_value_1;
frame_3024af40360f1e53d055413e8dcd6901->m_frame.f_lineno = 259;
{
PyObject *call_args[] = { tmp_args_element_name_5 };
tmp_assattr_name_1 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_5, call_args );
}
Py_DECREF( tmp_args_element_name_5 );
if ( tmp_assattr_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 259;
type_description_1 = "coooooo";
goto frame_exception_exit_1;
}
if ( par_self == NULL )
{
tmp_assattr_target_1 = NULL;
}
else
{
tmp_assattr_target_1 = PyCell_GET( par_self );
}
if ( tmp_assattr_target_1 == NULL )
{
Py_DECREF( tmp_assattr_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 259;
type_description_1 = "coooooo";
goto frame_exception_exit_1;
}
tmp_result = SET_ATTRIBUTE( tmp_assattr_target_1, const_str_plain_data, tmp_assattr_name_1 );
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_assattr_name_1 );
exception_lineno = 259;
type_description_1 = "coooooo";
goto frame_exception_exit_1;
}
Py_DECREF( tmp_assattr_name_1 );
#if 0
RESTORE_FRAME_EXCEPTION( frame_3024af40360f1e53d055413e8dcd6901 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto frame_no_exception_1;
frame_return_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_3024af40360f1e53d055413e8dcd6901 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto try_return_handler_1;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_3024af40360f1e53d055413e8dcd6901 );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( frame_3024af40360f1e53d055413e8dcd6901, exception_lineno );
}
else if ( exception_tb->tb_frame != &frame_3024af40360f1e53d055413e8dcd6901->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, frame_3024af40360f1e53d055413e8dcd6901, exception_lineno );
}
// Attachs locals to frame if any.
Nuitka_Frame_AttachLocals(
(struct Nuitka_FrameObject *)frame_3024af40360f1e53d055413e8dcd6901,
type_description_1,
par_self,
var_sorted_models,
var_concrete_models,
var_models,
var_found,
var_model,
var_dependencies
);
// Release cached frame.
if ( frame_3024af40360f1e53d055413e8dcd6901 == cache_frame_3024af40360f1e53d055413e8dcd6901 )
{
Py_DECREF( frame_3024af40360f1e53d055413e8dcd6901 );
}
cache_frame_3024af40360f1e53d055413e8dcd6901 = NULL;
assertFrameObject( frame_3024af40360f1e53d055413e8dcd6901 );
// Put the previous frame back on top.
popFrameStack();
// Return the error.
goto try_except_handler_1;
frame_no_exception_1:;
tmp_return_value = Py_None;
Py_INCREF( tmp_return_value );
goto try_return_handler_1;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_17_sort );
return NULL;
// Return handler code:
try_return_handler_1:;
CHECK_OBJECT( (PyObject *)par_self );
Py_DECREF( par_self );
par_self = NULL;
Py_XDECREF( var_sorted_models );
var_sorted_models = NULL;
Py_XDECREF( var_concrete_models );
var_concrete_models = NULL;
Py_XDECREF( var_models );
var_models = NULL;
Py_XDECREF( var_found );
var_found = NULL;
Py_XDECREF( var_model );
var_model = NULL;
Py_XDECREF( var_dependencies );
var_dependencies = NULL;
goto function_return_exit;
// Exception handler code:
try_except_handler_1:;
exception_keeper_type_2 = exception_type;
exception_keeper_value_2 = exception_value;
exception_keeper_tb_2 = exception_tb;
exception_keeper_lineno_2 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
CHECK_OBJECT( (PyObject *)par_self );
Py_DECREF( par_self );
par_self = NULL;
Py_XDECREF( var_sorted_models );
var_sorted_models = NULL;
Py_XDECREF( var_concrete_models );
var_concrete_models = NULL;
Py_XDECREF( var_models );
var_models = NULL;
Py_XDECREF( var_found );
var_found = NULL;
Py_XDECREF( var_model );
var_model = NULL;
Py_XDECREF( var_dependencies );
var_dependencies = NULL;
// Re-raise.
exception_type = exception_keeper_type_2;
exception_value = exception_keeper_value_2;
exception_tb = exception_keeper_tb_2;
exception_lineno = exception_keeper_lineno_2;
goto function_exception_exit;
// End of try:
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_17_sort );
return NULL;
function_exception_exit:
assert( exception_type );
RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
return NULL;
function_return_exit:
CHECK_OBJECT( tmp_return_value );
assert( had_error || !ERROR_OCCURRED() );
return tmp_return_value;
}
#if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
struct django$db$models$deletion$$$function_17_sort$$$genexpr_1_genexpr_locals {
PyObject *var_model
PyObject *tmp_iter_value_0
PyObject *exception_type
PyObject *exception_value
PyTracebackObject *exception_tb
int exception_lineno
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
int exception_keeper_lineno_1;
PyObject *exception_keeper_type_2;
PyObject *exception_keeper_value_2;
PyTracebackObject *exception_keeper_tb_2;
int exception_keeper_lineno_2;
PyObject *tmp_assign_source_1;
PyObject *tmp_assign_source_2;
PyObject *tmp_expression_name_1;
PyObject *tmp_next_source_1;
PyObject *tmp_source_name_1;
PyObject *tmp_subscribed_name_1;
PyObject *tmp_subscript_name_1;
PyObject *tmp_tuple_element_1;
char const *type_description_1
};
#endif
#if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
static PyObject *django$db$models$deletion$$$function_17_sort$$$genexpr_1_genexpr_context( struct Nuitka_GeneratorObject *generator, PyObject *yield_return_value )
#else
static void django$db$models$deletion$$$function_17_sort$$$genexpr_1_genexpr_context( struct Nuitka_GeneratorObject *generator )
#endif
{
CHECK_OBJECT( (PyObject *)generator );
assert( Nuitka_Generator_Check( (PyObject *)generator ) );
// Local variable initialization
PyObject *var_model = NULL;
PyObject *tmp_iter_value_0 = NULL;
PyObject *exception_type = NULL;
PyObject *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
PyObject *exception_keeper_type_2;
PyObject *exception_keeper_value_2;
PyTracebackObject *exception_keeper_tb_2;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_2;
PyObject *tmp_assign_source_1;
PyObject *tmp_assign_source_2;
PyObject *tmp_expression_name_1;
PyObject *tmp_next_source_1;
PyObject *tmp_source_name_1;
PyObject *tmp_subscribed_name_1;
PyObject *tmp_subscript_name_1;
PyObject *tmp_tuple_element_1;
NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
static struct Nuitka_FrameObject *cache_frame_generator = NULL;
NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
// Dispatch to yield based on return label index:
// Actual function code.
// Tried code:
MAKE_OR_REUSE_FRAME( cache_frame_generator, codeobj_ca681f1e72441112db196f9175e5fa01, module_django$db$models$deletion, sizeof(void *)+sizeof(void *)+sizeof(void *) );
generator->m_frame = cache_frame_generator;
// Mark the frame object as in use, ref count 1 will be up for reuse.
Py_INCREF( generator->m_frame );
assert( Py_REFCNT( generator->m_frame ) == 2 ); // Frame stack
#if PYTHON_VERSION >= 340
generator->m_frame->m_frame.f_gen = (PyObject *)generator;
#endif
Py_CLEAR( generator->m_frame->m_frame.f_back );
generator->m_frame->m_frame.f_back = PyThreadState_GET()->frame;
Py_INCREF( generator->m_frame->m_frame.f_back );
PyThreadState_GET()->frame = &generator->m_frame->m_frame;
Py_INCREF( generator->m_frame );
Nuitka_Frame_MarkAsExecuting( generator->m_frame );
#if PYTHON_VERSION >= 300
// Accept currently existing exception as the one to publish again when we
// yield or yield from.
PyThreadState *thread_state = PyThreadState_GET();
generator->m_frame->m_frame.f_exc_type = thread_state->exc_type;
if ( generator->m_frame->m_frame.f_exc_type == Py_None ) generator->m_frame->m_frame.f_exc_type = NULL;
Py_XINCREF( generator->m_frame->m_frame.f_exc_type );
generator->m_frame->m_frame.f_exc_value = thread_state->exc_value;
Py_XINCREF( generator->m_frame->m_frame.f_exc_value );
generator->m_frame->m_frame.f_exc_traceback = thread_state->exc_traceback;
Py_XINCREF( generator->m_frame->m_frame.f_exc_traceback );
#endif
// Framed code:
// Tried code:
loop_start_1:;
if ( generator->m_closure[0] == NULL )
{
tmp_next_source_1 = NULL;
}
else
{
tmp_next_source_1 = PyCell_GET( generator->m_closure[0] );
}
CHECK_OBJECT( tmp_next_source_1 );
tmp_assign_source_1 = ITERATOR_NEXT( tmp_next_source_1 );
if ( tmp_assign_source_1 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_1;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "Noc";
exception_lineno = 259;
goto try_except_handler_2;
}
}
{
PyObject *old = tmp_iter_value_0;
tmp_iter_value_0 = tmp_assign_source_1;
Py_XDECREF( old );
}
tmp_assign_source_2 = tmp_iter_value_0;
CHECK_OBJECT( tmp_assign_source_2 );
{
PyObject *old = var_model;
var_model = tmp_assign_source_2;
Py_INCREF( var_model );
Py_XDECREF( old );
}
tmp_expression_name_1 = PyTuple_New( 2 );
tmp_tuple_element_1 = var_model;
CHECK_OBJECT( tmp_tuple_element_1 );
Py_INCREF( tmp_tuple_element_1 );
PyTuple_SET_ITEM( tmp_expression_name_1, 0, tmp_tuple_element_1 );
if ( generator->m_closure[1] == NULL )
{
tmp_source_name_1 = NULL;
}
else
{
tmp_source_name_1 = PyCell_GET( generator->m_closure[1] );
}
if ( tmp_source_name_1 == NULL )
{
Py_DECREF( tmp_expression_name_1 );
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "free variable '%s' referenced before assignment in enclosing scope", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 259;
type_description_1 = "Noc";
goto try_except_handler_2;
}
tmp_subscribed_name_1 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_data );
if ( tmp_subscribed_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_expression_name_1 );
exception_lineno = 259;
type_description_1 = "Noc";
goto try_except_handler_2;
}
tmp_subscript_name_1 = var_model;
if ( tmp_subscript_name_1 == NULL )
{
Py_DECREF( tmp_expression_name_1 );
Py_DECREF( tmp_subscribed_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "model" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 259;
type_description_1 = "Noc";
goto try_except_handler_2;
}
tmp_tuple_element_1 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_1, tmp_subscript_name_1 );
Py_DECREF( tmp_subscribed_name_1 );
if ( tmp_tuple_element_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_expression_name_1 );
exception_lineno = 259;
type_description_1 = "Noc";
goto try_except_handler_2;
}
PyTuple_SET_ITEM( tmp_expression_name_1, 1, tmp_tuple_element_1 );
tmp_unused = GENERATOR_YIELD( generator, tmp_expression_name_1 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 259;
type_description_1 = "Noc";
goto try_except_handler_2;
}
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 259;
type_description_1 = "Noc";
goto try_except_handler_2;
}
goto loop_start_1;
loop_end_1:;
goto try_end_1;
// Exception handler code:
try_except_handler_2:;
exception_keeper_type_1 = exception_type;
exception_keeper_value_1 = exception_value;
exception_keeper_tb_1 = exception_tb;
exception_keeper_lineno_1 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_iter_value_0 );
tmp_iter_value_0 = NULL;
// Re-raise.
exception_type = exception_keeper_type_1;
exception_value = exception_keeper_value_1;
exception_tb = exception_keeper_tb_1;
exception_lineno = exception_keeper_lineno_1;
goto frame_exception_exit_1;
// End of try:
try_end_1:;
Nuitka_Frame_MarkAsNotExecuting( generator->m_frame );
#if PYTHON_VERSION >= 300
Py_CLEAR( generator->m_frame->m_frame.f_exc_type );
Py_CLEAR( generator->m_frame->m_frame.f_exc_value );
Py_CLEAR( generator->m_frame->m_frame.f_exc_traceback );
#endif
// Allow re-use of the frame again.
Py_DECREF( generator->m_frame );
goto frame_no_exception_1;
frame_exception_exit_1:;
// If it's not an exit exception, consider and create a traceback for it.
if ( !EXCEPTION_MATCH_GENERATOR( exception_type ) )
{
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( generator->m_frame, exception_lineno );
}
else if ( exception_tb->tb_frame != &generator->m_frame->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, generator->m_frame, exception_lineno );
}
Nuitka_Frame_AttachLocals(
(struct Nuitka_FrameObject *)generator->m_frame,
type_description_1,
NULL,
var_model,
generator->m_closure[1]
);
// Release cached frame.
if ( generator->m_frame == cache_frame_generator )
{
Py_DECREF( generator->m_frame );
}
cache_frame_generator = NULL;
assertFrameObject( generator->m_frame );
}
#if PYTHON_VERSION >= 300
Py_CLEAR( generator->m_frame->m_frame.f_exc_type );
Py_CLEAR( generator->m_frame->m_frame.f_exc_value );
Py_CLEAR( generator->m_frame->m_frame.f_exc_traceback );
#endif
Py_DECREF( generator->m_frame );
// Return the error.
goto try_except_handler_1;
frame_no_exception_1:;
goto try_end_2;
// Exception handler code:
try_except_handler_1:;
exception_keeper_type_2 = exception_type;
exception_keeper_value_2 = exception_value;
exception_keeper_tb_2 = exception_tb;
exception_keeper_lineno_2 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( var_model );
var_model = NULL;
// Re-raise.
exception_type = exception_keeper_type_2;
exception_value = exception_keeper_value_2;
exception_tb = exception_keeper_tb_2;
exception_lineno = exception_keeper_lineno_2;
goto function_exception_exit;
// End of try:
try_end_2:;
Py_XDECREF( tmp_iter_value_0 );
tmp_iter_value_0 = NULL;
Py_XDECREF( var_model );
var_model = NULL;
#if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
return NULL;
#else
generator->m_yielded = NULL;
return;
#endif
function_exception_exit:
assert( exception_type );
RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
#if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
return NULL;
#else
generator->m_yielded = NULL;
return;
#endif
}
static PyObject *impl_django$db$models$deletion$$$function_18_delete( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
{
// Preserve error status for checks
#ifndef __NUITKA_NO_ASSERT__
NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
#endif
// Local variable declarations.
PyObject *par_self = python_pars[ 0 ];
PyObject *var_model = NULL;
PyObject *var_instances = NULL;
PyObject *var_deleted_counter = NULL;
PyObject *var_obj = NULL;
PyObject *var_qs = NULL;
PyObject *var_count = NULL;
PyObject *var_instances_for_fieldvalues = NULL;
PyObject *var_query = NULL;
PyObject *var_field = NULL;
PyObject *var_value = NULL;
PyObject *var_pk_list = NULL;
PyObject *var_instance = NULL;
PyObject *outline_0_var_obj = NULL;
PyObject *outline_1_var_obj = NULL;
PyObject *tmp_for_loop_10__for_iterator = NULL;
PyObject *tmp_for_loop_10__iter_value = NULL;
PyObject *tmp_for_loop_11__for_iterator = NULL;
PyObject *tmp_for_loop_11__iter_value = NULL;
PyObject *tmp_for_loop_12__for_iterator = NULL;
PyObject *tmp_for_loop_12__iter_value = NULL;
PyObject *tmp_for_loop_13__for_iterator = NULL;
PyObject *tmp_for_loop_13__iter_value = NULL;
PyObject *tmp_for_loop_1__for_iterator = NULL;
PyObject *tmp_for_loop_1__iter_value = NULL;
PyObject *tmp_for_loop_2__for_iterator = NULL;
PyObject *tmp_for_loop_2__iter_value = NULL;
PyObject *tmp_for_loop_3__for_iterator = NULL;
PyObject *tmp_for_loop_3__iter_value = NULL;
PyObject *tmp_for_loop_4__for_iterator = NULL;
PyObject *tmp_for_loop_4__iter_value = NULL;
PyObject *tmp_for_loop_5__for_iterator = NULL;
PyObject *tmp_for_loop_5__iter_value = NULL;
PyObject *tmp_for_loop_6__for_iterator = NULL;
PyObject *tmp_for_loop_6__iter_value = NULL;
PyObject *tmp_for_loop_7__for_iterator = NULL;
PyObject *tmp_for_loop_7__iter_value = NULL;
PyObject *tmp_for_loop_8__for_iterator = NULL;
PyObject *tmp_for_loop_8__iter_value = NULL;
PyObject *tmp_for_loop_9__for_iterator = NULL;
PyObject *tmp_for_loop_9__iter_value = NULL;
PyObject *tmp_inplace_assign_subscr_1__subscript = NULL;
PyObject *tmp_inplace_assign_subscr_1__target = NULL;
PyObject *tmp_inplace_assign_subscr_2__subscript = NULL;
PyObject *tmp_inplace_assign_subscr_2__target = NULL;
PyObject *tmp_listcontraction_1__$0 = NULL;
PyObject *tmp_listcontraction_1__contraction = NULL;
PyObject *tmp_listcontraction_1__iter_value_0 = NULL;
PyObject *tmp_listcontraction_2__$0 = NULL;
PyObject *tmp_listcontraction_2__contraction = NULL;
PyObject *tmp_listcontraction_2__iter_value_0 = NULL;
PyObject *tmp_tuple_unpack_10__element_1 = NULL;
PyObject *tmp_tuple_unpack_10__element_2 = NULL;
PyObject *tmp_tuple_unpack_10__source_iter = NULL;
PyObject *tmp_tuple_unpack_1__element_1 = NULL;
PyObject *tmp_tuple_unpack_1__element_2 = NULL;
PyObject *tmp_tuple_unpack_1__source_iter = NULL;
PyObject *tmp_tuple_unpack_2__element_1 = NULL;
PyObject *tmp_tuple_unpack_2__element_2 = NULL;
PyObject *tmp_tuple_unpack_2__source_iter = NULL;
PyObject *tmp_tuple_unpack_3__element_1 = NULL;
PyObject *tmp_tuple_unpack_3__element_2 = NULL;
PyObject *tmp_tuple_unpack_3__source_iter = NULL;
PyObject *tmp_tuple_unpack_4__element_1 = NULL;
PyObject *tmp_tuple_unpack_4__element_2 = NULL;
PyObject *tmp_tuple_unpack_4__source_iter = NULL;
PyObject *tmp_tuple_unpack_5__element_1 = NULL;
PyObject *tmp_tuple_unpack_5__element_2 = NULL;
PyObject *tmp_tuple_unpack_5__source_iter = NULL;
PyObject *tmp_tuple_unpack_6__element_1 = NULL;
PyObject *tmp_tuple_unpack_6__element_2 = NULL;
PyObject *tmp_tuple_unpack_6__source_iter = NULL;
PyObject *tmp_tuple_unpack_7__element_1 = NULL;
PyObject *tmp_tuple_unpack_7__element_2 = NULL;
PyObject *tmp_tuple_unpack_7__source_iter = NULL;
PyObject *tmp_tuple_unpack_8__element_1 = NULL;
PyObject *tmp_tuple_unpack_8__element_2 = NULL;
PyObject *tmp_tuple_unpack_8__source_iter = NULL;
PyObject *tmp_tuple_unpack_9__element_1 = NULL;
PyObject *tmp_tuple_unpack_9__element_2 = NULL;
PyObject *tmp_tuple_unpack_9__source_iter = NULL;
PyObject *tmp_with_1__enter = NULL;
PyObject *tmp_with_1__exit = NULL;
PyObject *tmp_with_1__indicator = NULL;
PyObject *tmp_with_1__source = NULL;
PyObject *exception_type = NULL;
PyObject *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
PyObject *exception_keeper_type_2;
PyObject *exception_keeper_value_2;
PyTracebackObject *exception_keeper_tb_2;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_2;
PyObject *exception_keeper_type_3;
PyObject *exception_keeper_value_3;
PyTracebackObject *exception_keeper_tb_3;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_3;
PyObject *exception_keeper_type_4;
PyObject *exception_keeper_value_4;
PyTracebackObject *exception_keeper_tb_4;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_4;
PyObject *exception_keeper_type_5;
PyObject *exception_keeper_value_5;
PyTracebackObject *exception_keeper_tb_5;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_5;
PyObject *exception_keeper_type_6;
PyObject *exception_keeper_value_6;
PyTracebackObject *exception_keeper_tb_6;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_6;
PyObject *exception_keeper_type_7;
PyObject *exception_keeper_value_7;
PyTracebackObject *exception_keeper_tb_7;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_7;
PyObject *exception_keeper_type_8;
PyObject *exception_keeper_value_8;
PyTracebackObject *exception_keeper_tb_8;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_8;
PyObject *exception_keeper_type_9;
PyObject *exception_keeper_value_9;
PyTracebackObject *exception_keeper_tb_9;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_9;
PyObject *exception_keeper_type_10;
PyObject *exception_keeper_value_10;
PyTracebackObject *exception_keeper_tb_10;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_10;
PyObject *exception_keeper_type_11;
PyObject *exception_keeper_value_11;
PyTracebackObject *exception_keeper_tb_11;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_11;
PyObject *exception_keeper_type_12;
PyObject *exception_keeper_value_12;
PyTracebackObject *exception_keeper_tb_12;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_12;
PyObject *exception_keeper_type_13;
PyObject *exception_keeper_value_13;
PyTracebackObject *exception_keeper_tb_13;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_13;
PyObject *exception_keeper_type_14;
PyObject *exception_keeper_value_14;
PyTracebackObject *exception_keeper_tb_14;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_14;
PyObject *exception_keeper_type_15;
PyObject *exception_keeper_value_15;
PyTracebackObject *exception_keeper_tb_15;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_15;
PyObject *exception_keeper_type_16;
PyObject *exception_keeper_value_16;
PyTracebackObject *exception_keeper_tb_16;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_16;
PyObject *exception_keeper_type_17;
PyObject *exception_keeper_value_17;
PyTracebackObject *exception_keeper_tb_17;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_17;
PyObject *exception_keeper_type_18;
PyObject *exception_keeper_value_18;
PyTracebackObject *exception_keeper_tb_18;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_18;
PyObject *exception_keeper_type_19;
PyObject *exception_keeper_value_19;
PyTracebackObject *exception_keeper_tb_19;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_19;
PyObject *exception_keeper_type_20;
PyObject *exception_keeper_value_20;
PyTracebackObject *exception_keeper_tb_20;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_20;
PyObject *exception_keeper_type_21;
PyObject *exception_keeper_value_21;
PyTracebackObject *exception_keeper_tb_21;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_21;
PyObject *exception_keeper_type_22;
PyObject *exception_keeper_value_22;
PyTracebackObject *exception_keeper_tb_22;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_22;
PyObject *exception_keeper_type_23;
PyObject *exception_keeper_value_23;
PyTracebackObject *exception_keeper_tb_23;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_23;
PyObject *exception_keeper_type_24;
PyObject *exception_keeper_value_24;
PyTracebackObject *exception_keeper_tb_24;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_24;
PyObject *exception_keeper_type_25;
PyObject *exception_keeper_value_25;
PyTracebackObject *exception_keeper_tb_25;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_25;
PyObject *exception_keeper_type_26;
PyObject *exception_keeper_value_26;
PyTracebackObject *exception_keeper_tb_26;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_26;
PyObject *exception_keeper_type_27;
PyObject *exception_keeper_value_27;
PyTracebackObject *exception_keeper_tb_27;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_27;
PyObject *exception_keeper_type_28;
PyObject *exception_keeper_value_28;
PyTracebackObject *exception_keeper_tb_28;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_28;
PyObject *exception_keeper_type_29;
PyObject *exception_keeper_value_29;
PyTracebackObject *exception_keeper_tb_29;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_29;
PyObject *exception_keeper_type_30;
PyObject *exception_keeper_value_30;
PyTracebackObject *exception_keeper_tb_30;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_30;
PyObject *exception_keeper_type_31;
PyObject *exception_keeper_value_31;
PyTracebackObject *exception_keeper_tb_31;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_31;
PyObject *exception_keeper_type_32;
PyObject *exception_keeper_value_32;
PyTracebackObject *exception_keeper_tb_32;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_32;
PyObject *exception_keeper_type_33;
PyObject *exception_keeper_value_33;
PyTracebackObject *exception_keeper_tb_33;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_33;
PyObject *exception_keeper_type_34;
PyObject *exception_keeper_value_34;
PyTracebackObject *exception_keeper_tb_34;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_34;
PyObject *exception_keeper_type_35;
PyObject *exception_keeper_value_35;
PyTracebackObject *exception_keeper_tb_35;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_35;
PyObject *exception_keeper_type_36;
PyObject *exception_keeper_value_36;
PyTracebackObject *exception_keeper_tb_36;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_36;
PyObject *exception_keeper_type_37;
PyObject *exception_keeper_value_37;
PyTracebackObject *exception_keeper_tb_37;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_37;
PyObject *exception_keeper_type_38;
PyObject *exception_keeper_value_38;
PyTracebackObject *exception_keeper_tb_38;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_38;
PyObject *exception_keeper_type_39;
PyObject *exception_keeper_value_39;
PyTracebackObject *exception_keeper_tb_39;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_39;
PyObject *exception_keeper_type_40;
PyObject *exception_keeper_value_40;
PyTracebackObject *exception_keeper_tb_40;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_40;
PyObject *exception_keeper_type_41;
PyObject *exception_keeper_value_41;
PyTracebackObject *exception_keeper_tb_41;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_41;
PyObject *exception_keeper_type_42;
PyObject *exception_keeper_value_42;
PyTracebackObject *exception_keeper_tb_42;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_42;
PyObject *exception_keeper_type_43;
PyObject *exception_keeper_value_43;
PyTracebackObject *exception_keeper_tb_43;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_43;
PyObject *exception_keeper_type_44;
PyObject *exception_keeper_value_44;
PyTracebackObject *exception_keeper_tb_44;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_44;
PyObject *exception_preserved_type_1;
PyObject *exception_preserved_value_1;
PyTracebackObject *exception_preserved_tb_1;
PyObject *tmp_append_list_1;
PyObject *tmp_append_list_2;
PyObject *tmp_append_value_1;
PyObject *tmp_append_value_2;
PyObject *tmp_args_element_name_1;
PyObject *tmp_args_element_name_2;
PyObject *tmp_args_element_name_3;
PyObject *tmp_args_element_name_4;
PyObject *tmp_args_element_name_5;
PyObject *tmp_args_element_name_6;
PyObject *tmp_args_element_name_7;
PyObject *tmp_args_element_name_8;
PyObject *tmp_args_element_name_9;
PyObject *tmp_args_element_name_10;
PyObject *tmp_args_element_name_11;
PyObject *tmp_args_element_name_12;
PyObject *tmp_args_element_name_13;
PyObject *tmp_args_element_name_14;
PyObject *tmp_args_element_name_15;
PyObject *tmp_args_element_name_16;
PyObject *tmp_args_element_name_17;
PyObject *tmp_args_name_1;
PyObject *tmp_ass_subscribed_1;
PyObject *tmp_ass_subscribed_2;
PyObject *tmp_ass_subscribed_3;
PyObject *tmp_ass_subscript_1;
PyObject *tmp_ass_subscript_2;
PyObject *tmp_ass_subscript_3;
PyObject *tmp_ass_subvalue_1;
PyObject *tmp_ass_subvalue_2;
PyObject *tmp_ass_subvalue_3;
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_assign_source_13;
PyObject *tmp_assign_source_14;
PyObject *tmp_assign_source_15;
PyObject *tmp_assign_source_16;
PyObject *tmp_assign_source_17;
PyObject *tmp_assign_source_18;
PyObject *tmp_assign_source_19;
PyObject *tmp_assign_source_20;
PyObject *tmp_assign_source_21;
PyObject *tmp_assign_source_22;
PyObject *tmp_assign_source_23;
PyObject *tmp_assign_source_24;
PyObject *tmp_assign_source_25;
PyObject *tmp_assign_source_26;
PyObject *tmp_assign_source_27;
PyObject *tmp_assign_source_28;
PyObject *tmp_assign_source_29;
PyObject *tmp_assign_source_30;
PyObject *tmp_assign_source_31;
PyObject *tmp_assign_source_32;
PyObject *tmp_assign_source_33;
PyObject *tmp_assign_source_34;
PyObject *tmp_assign_source_35;
PyObject *tmp_assign_source_36;
PyObject *tmp_assign_source_37;
PyObject *tmp_assign_source_38;
PyObject *tmp_assign_source_39;
PyObject *tmp_assign_source_40;
PyObject *tmp_assign_source_41;
PyObject *tmp_assign_source_42;
PyObject *tmp_assign_source_43;
PyObject *tmp_assign_source_44;
PyObject *tmp_assign_source_45;
PyObject *tmp_assign_source_46;
PyObject *tmp_assign_source_47;
PyObject *tmp_assign_source_48;
PyObject *tmp_assign_source_49;
PyObject *tmp_assign_source_50;
PyObject *tmp_assign_source_51;
PyObject *tmp_assign_source_52;
PyObject *tmp_assign_source_53;
PyObject *tmp_assign_source_54;
PyObject *tmp_assign_source_55;
PyObject *tmp_assign_source_56;
PyObject *tmp_assign_source_57;
PyObject *tmp_assign_source_58;
PyObject *tmp_assign_source_59;
PyObject *tmp_assign_source_60;
PyObject *tmp_assign_source_61;
PyObject *tmp_assign_source_62;
PyObject *tmp_assign_source_63;
PyObject *tmp_assign_source_64;
PyObject *tmp_assign_source_65;
PyObject *tmp_assign_source_66;
PyObject *tmp_assign_source_67;
PyObject *tmp_assign_source_68;
PyObject *tmp_assign_source_69;
PyObject *tmp_assign_source_70;
PyObject *tmp_assign_source_71;
PyObject *tmp_assign_source_72;
PyObject *tmp_assign_source_73;
PyObject *tmp_assign_source_74;
PyObject *tmp_assign_source_75;
PyObject *tmp_assign_source_76;
PyObject *tmp_assign_source_77;
PyObject *tmp_assign_source_78;
PyObject *tmp_assign_source_79;
PyObject *tmp_assign_source_80;
PyObject *tmp_assign_source_81;
PyObject *tmp_assign_source_82;
PyObject *tmp_assign_source_83;
PyObject *tmp_assign_source_84;
PyObject *tmp_assign_source_85;
PyObject *tmp_assign_source_86;
PyObject *tmp_assign_source_87;
PyObject *tmp_assign_source_88;
PyObject *tmp_assign_source_89;
PyObject *tmp_assign_source_90;
PyObject *tmp_assign_source_91;
PyObject *tmp_assign_source_92;
PyObject *tmp_assign_source_93;
PyObject *tmp_assign_source_94;
PyObject *tmp_assign_source_95;
PyObject *tmp_assign_source_96;
PyObject *tmp_assign_source_97;
PyObject *tmp_assign_source_98;
PyObject *tmp_assign_source_99;
PyObject *tmp_assign_source_100;
PyObject *tmp_assign_source_101;
PyObject *tmp_assign_source_102;
PyObject *tmp_called_instance_1;
PyObject *tmp_called_instance_2;
PyObject *tmp_called_instance_3;
PyObject *tmp_called_instance_4;
PyObject *tmp_called_instance_5;
PyObject *tmp_called_name_1;
PyObject *tmp_called_name_2;
PyObject *tmp_called_name_3;
PyObject *tmp_called_name_4;
PyObject *tmp_called_name_5;
PyObject *tmp_called_name_6;
PyObject *tmp_called_name_7;
PyObject *tmp_called_name_8;
PyObject *tmp_called_name_9;
PyObject *tmp_called_name_10;
PyObject *tmp_called_name_11;
PyObject *tmp_called_name_12;
PyObject *tmp_called_name_13;
PyObject *tmp_called_name_14;
PyObject *tmp_called_name_15;
PyObject *tmp_called_name_16;
PyObject *tmp_called_name_17;
PyObject *tmp_called_name_18;
PyObject *tmp_called_name_19;
PyObject *tmp_called_name_20;
PyObject *tmp_called_name_21;
PyObject *tmp_called_name_22;
PyObject *tmp_compare_left_1;
PyObject *tmp_compare_left_2;
PyObject *tmp_compare_left_3;
PyObject *tmp_compare_right_1;
PyObject *tmp_compare_right_2;
PyObject *tmp_compare_right_3;
int tmp_cond_truth_1;
int tmp_cond_truth_2;
int tmp_cond_truth_3;
PyObject *tmp_cond_value_1;
PyObject *tmp_cond_value_2;
PyObject *tmp_cond_value_3;
PyObject *tmp_dict_key_1;
PyObject *tmp_dict_key_2;
PyObject *tmp_dict_key_3;
PyObject *tmp_dict_key_4;
PyObject *tmp_dict_key_5;
PyObject *tmp_dict_key_6;
PyObject *tmp_dict_key_7;
PyObject *tmp_dict_key_8;
PyObject *tmp_dict_key_9;
PyObject *tmp_dict_key_10;
PyObject *tmp_dict_key_11;
PyObject *tmp_dict_seq_1;
PyObject *tmp_dict_value_1;
PyObject *tmp_dict_value_2;
PyObject *tmp_dict_value_3;
PyObject *tmp_dict_value_4;
PyObject *tmp_dict_value_5;
PyObject *tmp_dict_value_6;
PyObject *tmp_dict_value_7;
PyObject *tmp_dict_value_8;
PyObject *tmp_dict_value_9;
PyObject *tmp_dict_value_10;
PyObject *tmp_dict_value_11;
int tmp_exc_match_exception_match_1;
bool tmp_is_1;
bool tmp_is_2;
PyObject *tmp_iter_arg_1;
PyObject *tmp_iter_arg_2;
PyObject *tmp_iter_arg_3;
PyObject *tmp_iter_arg_4;
PyObject *tmp_iter_arg_5;
PyObject *tmp_iter_arg_6;
PyObject *tmp_iter_arg_7;
PyObject *tmp_iter_arg_8;
PyObject *tmp_iter_arg_9;
PyObject *tmp_iter_arg_10;
PyObject *tmp_iter_arg_11;
PyObject *tmp_iter_arg_12;
PyObject *tmp_iter_arg_13;
PyObject *tmp_iter_arg_14;
PyObject *tmp_iter_arg_15;
PyObject *tmp_iter_arg_16;
PyObject *tmp_iter_arg_17;
PyObject *tmp_iter_arg_18;
PyObject *tmp_iter_arg_19;
PyObject *tmp_iter_arg_20;
PyObject *tmp_iter_arg_21;
PyObject *tmp_iter_arg_22;
PyObject *tmp_iter_arg_23;
PyObject *tmp_iter_arg_24;
PyObject *tmp_iter_arg_25;
PyObject *tmp_iterator_attempt;
PyObject *tmp_iterator_name_1;
PyObject *tmp_iterator_name_2;
PyObject *tmp_iterator_name_3;
PyObject *tmp_iterator_name_4;
PyObject *tmp_iterator_name_5;
PyObject *tmp_iterator_name_6;
PyObject *tmp_iterator_name_7;
PyObject *tmp_iterator_name_8;
PyObject *tmp_iterator_name_9;
PyObject *tmp_iterator_name_10;
PyObject *tmp_kw_name_1;
PyObject *tmp_kw_name_2;
PyObject *tmp_kw_name_3;
PyObject *tmp_kw_name_4;
PyObject *tmp_kw_name_5;
PyObject *tmp_left_name_1;
PyObject *tmp_left_name_2;
PyObject *tmp_next_source_1;
PyObject *tmp_next_source_2;
PyObject *tmp_next_source_3;
PyObject *tmp_next_source_4;
PyObject *tmp_next_source_5;
PyObject *tmp_next_source_6;
PyObject *tmp_next_source_7;
PyObject *tmp_next_source_8;
PyObject *tmp_next_source_9;
PyObject *tmp_next_source_10;
PyObject *tmp_next_source_11;
PyObject *tmp_next_source_12;
PyObject *tmp_next_source_13;
PyObject *tmp_next_source_14;
PyObject *tmp_next_source_15;
PyObject *tmp_outline_return_value_1;
PyObject *tmp_outline_return_value_2;
int tmp_res;
bool tmp_result;
PyObject *tmp_return_value;
PyObject *tmp_right_name_1;
PyObject *tmp_right_name_2;
PyObject *tmp_setattr_attr_1;
PyObject *tmp_setattr_attr_2;
PyObject *tmp_setattr_target_1;
PyObject *tmp_setattr_target_2;
PyObject *tmp_setattr_value_1;
PyObject *tmp_setattr_value_2;
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_source_name_6;
PyObject *tmp_source_name_7;
PyObject *tmp_source_name_8;
PyObject *tmp_source_name_9;
PyObject *tmp_source_name_10;
PyObject *tmp_source_name_11;
PyObject *tmp_source_name_12;
PyObject *tmp_source_name_13;
PyObject *tmp_source_name_14;
PyObject *tmp_source_name_15;
PyObject *tmp_source_name_16;
PyObject *tmp_source_name_17;
PyObject *tmp_source_name_18;
PyObject *tmp_source_name_19;
PyObject *tmp_source_name_20;
PyObject *tmp_source_name_21;
PyObject *tmp_source_name_22;
PyObject *tmp_source_name_23;
PyObject *tmp_source_name_24;
PyObject *tmp_source_name_25;
PyObject *tmp_source_name_26;
PyObject *tmp_source_name_27;
PyObject *tmp_source_name_28;
PyObject *tmp_source_name_29;
PyObject *tmp_source_name_30;
PyObject *tmp_source_name_31;
PyObject *tmp_source_name_32;
PyObject *tmp_source_name_33;
PyObject *tmp_source_name_34;
PyObject *tmp_source_name_35;
PyObject *tmp_source_name_36;
PyObject *tmp_source_name_37;
PyObject *tmp_source_name_38;
PyObject *tmp_source_name_39;
PyObject *tmp_source_name_40;
PyObject *tmp_source_name_41;
PyObject *tmp_source_name_42;
PyObject *tmp_source_name_43;
PyObject *tmp_source_name_44;
PyObject *tmp_source_name_45;
PyObject *tmp_source_name_46;
PyObject *tmp_source_name_47;
PyObject *tmp_source_name_48;
PyObject *tmp_source_name_49;
PyObject *tmp_subscribed_name_1;
PyObject *tmp_subscribed_name_2;
PyObject *tmp_subscript_name_1;
PyObject *tmp_subscript_name_2;
PyObject *tmp_sum_sequence_1;
PyObject *tmp_tuple_element_1;
PyObject *tmp_tuple_element_2;
PyObject *tmp_unpack_1;
PyObject *tmp_unpack_2;
PyObject *tmp_unpack_3;
PyObject *tmp_unpack_4;
PyObject *tmp_unpack_5;
PyObject *tmp_unpack_6;
PyObject *tmp_unpack_7;
PyObject *tmp_unpack_8;
PyObject *tmp_unpack_9;
PyObject *tmp_unpack_10;
PyObject *tmp_unpack_11;
PyObject *tmp_unpack_12;
PyObject *tmp_unpack_13;
PyObject *tmp_unpack_14;
PyObject *tmp_unpack_15;
PyObject *tmp_unpack_16;
PyObject *tmp_unpack_17;
PyObject *tmp_unpack_18;
PyObject *tmp_unpack_19;
PyObject *tmp_unpack_20;
NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
static struct Nuitka_FrameObject *cache_frame_564feb323b16cc532f21be0bd5a6c08f_2 = NULL;
struct Nuitka_FrameObject *frame_564feb323b16cc532f21be0bd5a6c08f_2;
static struct Nuitka_FrameObject *cache_frame_9f9f08f015e7aca9bdfd4554bcb4e2d4_3 = NULL;
struct Nuitka_FrameObject *frame_9f9f08f015e7aca9bdfd4554bcb4e2d4_3;
static struct Nuitka_FrameObject *cache_frame_54ec43c561ef94893d9bbef71a219f87 = NULL;
struct Nuitka_FrameObject *frame_54ec43c561ef94893d9bbef71a219f87;
NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
NUITKA_MAY_BE_UNUSED char const *type_description_2 = NULL;
NUITKA_MAY_BE_UNUSED char const *type_description_3 = NULL;
tmp_return_value = NULL;
tmp_outline_return_value_1 = NULL;
tmp_outline_return_value_2 = NULL;
// Actual function code.
// Tried code:
MAKE_OR_REUSE_FRAME( cache_frame_54ec43c561ef94893d9bbef71a219f87, codeobj_54ec43c561ef94893d9bbef71a219f87, module_django$db$models$deletion, sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *) );
frame_54ec43c561ef94893d9bbef71a219f87 = cache_frame_54ec43c561ef94893d9bbef71a219f87;
// Push the new frame as the currently active one.
pushFrameStack( frame_54ec43c561ef94893d9bbef71a219f87 );
// Mark the frame object as in use, ref count 1 will be up for reuse.
assert( Py_REFCNT( frame_54ec43c561ef94893d9bbef71a219f87 ) == 2 ); // Frame stack
// Framed code:
tmp_source_name_1 = par_self;
CHECK_OBJECT( tmp_source_name_1 );
tmp_called_instance_1 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_data );
if ( tmp_called_instance_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 264;
type_description_1 = "ooooooooooooo";
goto frame_exception_exit_1;
}
frame_54ec43c561ef94893d9bbef71a219f87->m_frame.f_lineno = 264;
tmp_iter_arg_1 = CALL_METHOD_NO_ARGS( tmp_called_instance_1, const_str_plain_items );
Py_DECREF( tmp_called_instance_1 );
if ( tmp_iter_arg_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 264;
type_description_1 = "ooooooooooooo";
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_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 264;
type_description_1 = "ooooooooooooo";
goto frame_exception_exit_1;
}
assert( tmp_for_loop_1__for_iterator == NULL );
tmp_for_loop_1__for_iterator = tmp_assign_source_1;
// Tried code:
loop_start_1:;
tmp_next_source_1 = tmp_for_loop_1__for_iterator;
CHECK_OBJECT( tmp_next_source_1 );
tmp_assign_source_2 = ITERATOR_NEXT( tmp_next_source_1 );
if ( tmp_assign_source_2 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_1;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooo";
exception_lineno = 264;
goto try_except_handler_2;
}
}
{
PyObject *old = tmp_for_loop_1__iter_value;
tmp_for_loop_1__iter_value = tmp_assign_source_2;
Py_XDECREF( old );
}
// Tried code:
tmp_iter_arg_2 = tmp_for_loop_1__iter_value;
CHECK_OBJECT( tmp_iter_arg_2 );
tmp_assign_source_3 = MAKE_ITERATOR( tmp_iter_arg_2 );
if ( tmp_assign_source_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 264;
type_description_1 = "ooooooooooooo";
goto try_except_handler_3;
}
{
PyObject *old = tmp_tuple_unpack_1__source_iter;
tmp_tuple_unpack_1__source_iter = tmp_assign_source_3;
Py_XDECREF( old );
}
// Tried code:
tmp_unpack_1 = tmp_tuple_unpack_1__source_iter;
CHECK_OBJECT( tmp_unpack_1 );
tmp_assign_source_4 = UNPACK_NEXT( tmp_unpack_1, 0, 2 );
if ( tmp_assign_source_4 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "ooooooooooooo";
exception_lineno = 264;
goto try_except_handler_4;
}
{
PyObject *old = tmp_tuple_unpack_1__element_1;
tmp_tuple_unpack_1__element_1 = tmp_assign_source_4;
Py_XDECREF( old );
}
tmp_unpack_2 = tmp_tuple_unpack_1__source_iter;
CHECK_OBJECT( tmp_unpack_2 );
tmp_assign_source_5 = UNPACK_NEXT( tmp_unpack_2, 1, 2 );
if ( tmp_assign_source_5 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "ooooooooooooo";
exception_lineno = 264;
goto try_except_handler_4;
}
{
PyObject *old = tmp_tuple_unpack_1__element_2;
tmp_tuple_unpack_1__element_2 = tmp_assign_source_5;
Py_XDECREF( old );
}
tmp_iterator_name_1 = tmp_tuple_unpack_1__source_iter;
CHECK_OBJECT( tmp_iterator_name_1 );
// Check if iterator has left-over elements.
CHECK_OBJECT( tmp_iterator_name_1 ); assert( HAS_ITERNEXT( tmp_iterator_name_1 ) );
tmp_iterator_attempt = (*Py_TYPE( tmp_iterator_name_1 )->tp_iternext)( tmp_iterator_name_1 );
if (likely( tmp_iterator_attempt == NULL ))
{
PyObject *error = GET_ERROR_OCCURRED();
if ( error != NULL )
{
if ( EXCEPTION_MATCH_BOOL_SINGLE( error, PyExc_StopIteration ))
{
CLEAR_ERROR_OCCURRED();
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooo";
exception_lineno = 264;
goto try_except_handler_4;
}
}
}
else
{
Py_DECREF( tmp_iterator_attempt );
// TODO: Could avoid PyErr_Format.
#if PYTHON_VERSION < 300
PyErr_Format( PyExc_ValueError, "too many values to unpack" );
#else
PyErr_Format( PyExc_ValueError, "too many values to unpack (expected 2)" );
#endif
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooo";
exception_lineno = 264;
goto try_except_handler_4;
}
goto try_end_1;
// Exception handler code:
try_except_handler_4:;
exception_keeper_type_1 = exception_type;
exception_keeper_value_1 = exception_value;
exception_keeper_tb_1 = exception_tb;
exception_keeper_lineno_1 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_1__source_iter );
tmp_tuple_unpack_1__source_iter = NULL;
// Re-raise.
exception_type = exception_keeper_type_1;
exception_value = exception_keeper_value_1;
exception_tb = exception_keeper_tb_1;
exception_lineno = exception_keeper_lineno_1;
goto try_except_handler_3;
// End of try:
try_end_1:;
goto try_end_2;
// Exception handler code:
try_except_handler_3:;
exception_keeper_type_2 = exception_type;
exception_keeper_value_2 = exception_value;
exception_keeper_tb_2 = exception_tb;
exception_keeper_lineno_2 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_1__element_1 );
tmp_tuple_unpack_1__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_1__element_2 );
tmp_tuple_unpack_1__element_2 = NULL;
// Re-raise.
exception_type = exception_keeper_type_2;
exception_value = exception_keeper_value_2;
exception_tb = exception_keeper_tb_2;
exception_lineno = exception_keeper_lineno_2;
goto try_except_handler_2;
// End of try:
try_end_2:;
Py_XDECREF( tmp_tuple_unpack_1__source_iter );
tmp_tuple_unpack_1__source_iter = NULL;
tmp_assign_source_6 = tmp_tuple_unpack_1__element_1;
CHECK_OBJECT( tmp_assign_source_6 );
{
PyObject *old = var_model;
var_model = tmp_assign_source_6;
Py_INCREF( var_model );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_1__element_1 );
tmp_tuple_unpack_1__element_1 = NULL;
tmp_assign_source_7 = tmp_tuple_unpack_1__element_2;
CHECK_OBJECT( tmp_assign_source_7 );
{
PyObject *old = var_instances;
var_instances = tmp_assign_source_7;
Py_INCREF( var_instances );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_1__element_2 );
tmp_tuple_unpack_1__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_1__element_1 );
tmp_tuple_unpack_1__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_1__element_2 );
tmp_tuple_unpack_1__element_2 = NULL;
tmp_called_name_1 = LOOKUP_BUILTIN( const_str_plain_sorted );
assert( tmp_called_name_1 != NULL );
tmp_args_name_1 = PyTuple_New( 1 );
tmp_tuple_element_1 = var_instances;
if ( tmp_tuple_element_1 == NULL )
{
Py_DECREF( tmp_args_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "instances" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 265;
type_description_1 = "ooooooooooooo";
goto try_except_handler_2;
}
Py_INCREF( tmp_tuple_element_1 );
PyTuple_SET_ITEM( tmp_args_name_1, 0, tmp_tuple_element_1 );
tmp_kw_name_1 = _PyDict_NewPresized( 1 );
tmp_dict_key_1 = const_str_plain_key;
tmp_called_name_2 = GET_STRING_DICT_VALUE( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_attrgetter );
if (unlikely( tmp_called_name_2 == NULL ))
{
tmp_called_name_2 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_attrgetter );
}
if ( tmp_called_name_2 == NULL )
{
Py_DECREF( tmp_args_name_1 );
Py_DECREF( tmp_kw_name_1 );
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "attrgetter" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 265;
type_description_1 = "ooooooooooooo";
goto try_except_handler_2;
}
frame_54ec43c561ef94893d9bbef71a219f87->m_frame.f_lineno = 265;
tmp_dict_value_1 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_2, &PyTuple_GET_ITEM( const_tuple_str_plain_pk_tuple, 0 ) );
if ( tmp_dict_value_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_args_name_1 );
Py_DECREF( tmp_kw_name_1 );
exception_lineno = 265;
type_description_1 = "ooooooooooooo";
goto try_except_handler_2;
}
tmp_res = PyDict_SetItem( tmp_kw_name_1, tmp_dict_key_1, tmp_dict_value_1 );
Py_DECREF( tmp_dict_value_1 );
assert( !(tmp_res != 0) );
frame_54ec43c561ef94893d9bbef71a219f87->m_frame.f_lineno = 265;
tmp_ass_subvalue_1 = CALL_FUNCTION( tmp_called_name_1, tmp_args_name_1, tmp_kw_name_1 );
Py_DECREF( tmp_args_name_1 );
Py_DECREF( tmp_kw_name_1 );
if ( tmp_ass_subvalue_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 265;
type_description_1 = "ooooooooooooo";
goto try_except_handler_2;
}
tmp_source_name_2 = par_self;
if ( tmp_source_name_2 == NULL )
{
Py_DECREF( tmp_ass_subvalue_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 265;
type_description_1 = "ooooooooooooo";
goto try_except_handler_2;
}
tmp_ass_subscribed_1 = LOOKUP_ATTRIBUTE( tmp_source_name_2, const_str_plain_data );
if ( tmp_ass_subscribed_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_ass_subvalue_1 );
exception_lineno = 265;
type_description_1 = "ooooooooooooo";
goto try_except_handler_2;
}
tmp_ass_subscript_1 = var_model;
if ( tmp_ass_subscript_1 == NULL )
{
Py_DECREF( tmp_ass_subvalue_1 );
Py_DECREF( tmp_ass_subscribed_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "model" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 265;
type_description_1 = "ooooooooooooo";
goto try_except_handler_2;
}
tmp_result = SET_SUBSCRIPT( tmp_ass_subscribed_1, tmp_ass_subscript_1, tmp_ass_subvalue_1 );
Py_DECREF( tmp_ass_subscribed_1 );
Py_DECREF( tmp_ass_subvalue_1 );
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 265;
type_description_1 = "ooooooooooooo";
goto try_except_handler_2;
}
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 264;
type_description_1 = "ooooooooooooo";
goto try_except_handler_2;
}
goto loop_start_1;
loop_end_1:;
goto try_end_3;
// Exception handler code:
try_except_handler_2:;
exception_keeper_type_3 = exception_type;
exception_keeper_value_3 = exception_value;
exception_keeper_tb_3 = exception_tb;
exception_keeper_lineno_3 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_for_loop_1__iter_value );
tmp_for_loop_1__iter_value = NULL;
Py_XDECREF( tmp_for_loop_1__for_iterator );
tmp_for_loop_1__for_iterator = NULL;
// Re-raise.
exception_type = exception_keeper_type_3;
exception_value = exception_keeper_value_3;
exception_tb = exception_keeper_tb_3;
exception_lineno = exception_keeper_lineno_3;
goto frame_exception_exit_1;
// End of try:
try_end_3:;
Py_XDECREF( tmp_for_loop_1__iter_value );
tmp_for_loop_1__iter_value = NULL;
Py_XDECREF( tmp_for_loop_1__for_iterator );
tmp_for_loop_1__for_iterator = NULL;
tmp_called_instance_2 = par_self;
if ( tmp_called_instance_2 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 270;
type_description_1 = "ooooooooooooo";
goto frame_exception_exit_1;
}
frame_54ec43c561ef94893d9bbef71a219f87->m_frame.f_lineno = 270;
tmp_unused = CALL_METHOD_NO_ARGS( tmp_called_instance_2, const_str_plain_sort );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 270;
type_description_1 = "ooooooooooooo";
goto frame_exception_exit_1;
}
Py_DECREF( tmp_unused );
tmp_called_name_3 = GET_STRING_DICT_VALUE( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_Counter );
if (unlikely( tmp_called_name_3 == NULL ))
{
tmp_called_name_3 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_Counter );
}
if ( tmp_called_name_3 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "Counter" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 272;
type_description_1 = "ooooooooooooo";
goto frame_exception_exit_1;
}
frame_54ec43c561ef94893d9bbef71a219f87->m_frame.f_lineno = 272;
tmp_assign_source_8 = CALL_FUNCTION_NO_ARGS( tmp_called_name_3 );
if ( tmp_assign_source_8 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 272;
type_description_1 = "ooooooooooooo";
goto frame_exception_exit_1;
}
assert( var_deleted_counter == NULL );
var_deleted_counter = tmp_assign_source_8;
// Tried code:
tmp_source_name_3 = GET_STRING_DICT_VALUE( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_transaction );
if (unlikely( tmp_source_name_3 == NULL ))
{
tmp_source_name_3 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_transaction );
}
if ( tmp_source_name_3 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "transaction" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 274;
type_description_1 = "ooooooooooooo";
goto try_except_handler_5;
}
tmp_called_name_4 = LOOKUP_ATTRIBUTE( tmp_source_name_3, const_str_plain_atomic );
if ( tmp_called_name_4 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 274;
type_description_1 = "ooooooooooooo";
goto try_except_handler_5;
}
tmp_kw_name_2 = _PyDict_NewPresized( 2 );
tmp_dict_key_2 = const_str_plain_using;
tmp_source_name_4 = par_self;
if ( tmp_source_name_4 == NULL )
{
Py_DECREF( tmp_called_name_4 );
Py_DECREF( tmp_kw_name_2 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 274;
type_description_1 = "ooooooooooooo";
goto try_except_handler_5;
}
tmp_dict_value_2 = LOOKUP_ATTRIBUTE( tmp_source_name_4, const_str_plain_using );
if ( tmp_dict_value_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_4 );
Py_DECREF( tmp_kw_name_2 );
exception_lineno = 274;
type_description_1 = "ooooooooooooo";
goto try_except_handler_5;
}
tmp_res = PyDict_SetItem( tmp_kw_name_2, tmp_dict_key_2, tmp_dict_value_2 );
Py_DECREF( tmp_dict_value_2 );
assert( !(tmp_res != 0) );
tmp_dict_key_3 = const_str_plain_savepoint;
tmp_dict_value_3 = Py_False;
tmp_res = PyDict_SetItem( tmp_kw_name_2, tmp_dict_key_3, tmp_dict_value_3 );
assert( !(tmp_res != 0) );
frame_54ec43c561ef94893d9bbef71a219f87->m_frame.f_lineno = 274;
tmp_assign_source_9 = CALL_FUNCTION_WITH_KEYARGS( tmp_called_name_4, tmp_kw_name_2 );
Py_DECREF( tmp_called_name_4 );
Py_DECREF( tmp_kw_name_2 );
if ( tmp_assign_source_9 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 274;
type_description_1 = "ooooooooooooo";
goto try_except_handler_5;
}
assert( tmp_with_1__source == NULL );
tmp_with_1__source = tmp_assign_source_9;
tmp_source_name_5 = tmp_with_1__source;
CHECK_OBJECT( tmp_source_name_5 );
tmp_assign_source_10 = LOOKUP_SPECIAL( tmp_source_name_5, const_str_plain___exit__ );
if ( tmp_assign_source_10 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 274;
type_description_1 = "ooooooooooooo";
goto try_except_handler_5;
}
assert( tmp_with_1__exit == NULL );
tmp_with_1__exit = tmp_assign_source_10;
tmp_source_name_6 = tmp_with_1__source;
CHECK_OBJECT( tmp_source_name_6 );
tmp_called_name_5 = LOOKUP_SPECIAL( tmp_source_name_6, const_str_plain___enter__ );
if ( tmp_called_name_5 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 274;
type_description_1 = "ooooooooooooo";
goto try_except_handler_5;
}
frame_54ec43c561ef94893d9bbef71a219f87->m_frame.f_lineno = 274;
tmp_assign_source_11 = CALL_FUNCTION_NO_ARGS( tmp_called_name_5 );
Py_DECREF( tmp_called_name_5 );
if ( tmp_assign_source_11 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 274;
type_description_1 = "ooooooooooooo";
goto try_except_handler_5;
}
assert( tmp_with_1__enter == NULL );
tmp_with_1__enter = tmp_assign_source_11;
tmp_assign_source_12 = Py_True;
assert( tmp_with_1__indicator == NULL );
Py_INCREF( tmp_assign_source_12 );
tmp_with_1__indicator = tmp_assign_source_12;
// Tried code:
// Tried code:
tmp_called_instance_3 = par_self;
if ( tmp_called_instance_3 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 276;
type_description_1 = "ooooooooooooo";
goto try_except_handler_7;
}
frame_54ec43c561ef94893d9bbef71a219f87->m_frame.f_lineno = 276;
tmp_iter_arg_3 = CALL_METHOD_NO_ARGS( tmp_called_instance_3, const_str_plain_instances_with_model );
if ( tmp_iter_arg_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 276;
type_description_1 = "ooooooooooooo";
goto try_except_handler_7;
}
tmp_assign_source_13 = MAKE_ITERATOR( tmp_iter_arg_3 );
Py_DECREF( tmp_iter_arg_3 );
if ( tmp_assign_source_13 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 276;
type_description_1 = "ooooooooooooo";
goto try_except_handler_7;
}
assert( tmp_for_loop_2__for_iterator == NULL );
tmp_for_loop_2__for_iterator = tmp_assign_source_13;
// Tried code:
loop_start_2:;
tmp_next_source_2 = tmp_for_loop_2__for_iterator;
CHECK_OBJECT( tmp_next_source_2 );
tmp_assign_source_14 = ITERATOR_NEXT( tmp_next_source_2 );
if ( tmp_assign_source_14 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_2;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooo";
exception_lineno = 276;
goto try_except_handler_8;
}
}
{
PyObject *old = tmp_for_loop_2__iter_value;
tmp_for_loop_2__iter_value = tmp_assign_source_14;
Py_XDECREF( old );
}
// Tried code:
tmp_iter_arg_4 = tmp_for_loop_2__iter_value;
CHECK_OBJECT( tmp_iter_arg_4 );
tmp_assign_source_15 = MAKE_ITERATOR( tmp_iter_arg_4 );
if ( tmp_assign_source_15 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 276;
type_description_1 = "ooooooooooooo";
goto try_except_handler_9;
}
{
PyObject *old = tmp_tuple_unpack_2__source_iter;
tmp_tuple_unpack_2__source_iter = tmp_assign_source_15;
Py_XDECREF( old );
}
// Tried code:
tmp_unpack_3 = tmp_tuple_unpack_2__source_iter;
CHECK_OBJECT( tmp_unpack_3 );
tmp_assign_source_16 = UNPACK_NEXT( tmp_unpack_3, 0, 2 );
if ( tmp_assign_source_16 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "ooooooooooooo";
exception_lineno = 276;
goto try_except_handler_10;
}
{
PyObject *old = tmp_tuple_unpack_2__element_1;
tmp_tuple_unpack_2__element_1 = tmp_assign_source_16;
Py_XDECREF( old );
}
tmp_unpack_4 = tmp_tuple_unpack_2__source_iter;
CHECK_OBJECT( tmp_unpack_4 );
tmp_assign_source_17 = UNPACK_NEXT( tmp_unpack_4, 1, 2 );
if ( tmp_assign_source_17 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "ooooooooooooo";
exception_lineno = 276;
goto try_except_handler_10;
}
{
PyObject *old = tmp_tuple_unpack_2__element_2;
tmp_tuple_unpack_2__element_2 = tmp_assign_source_17;
Py_XDECREF( old );
}
tmp_iterator_name_2 = tmp_tuple_unpack_2__source_iter;
CHECK_OBJECT( tmp_iterator_name_2 );
// Check if iterator has left-over elements.
CHECK_OBJECT( tmp_iterator_name_2 ); assert( HAS_ITERNEXT( tmp_iterator_name_2 ) );
tmp_iterator_attempt = (*Py_TYPE( tmp_iterator_name_2 )->tp_iternext)( tmp_iterator_name_2 );
if (likely( tmp_iterator_attempt == NULL ))
{
PyObject *error = GET_ERROR_OCCURRED();
if ( error != NULL )
{
if ( EXCEPTION_MATCH_BOOL_SINGLE( error, PyExc_StopIteration ))
{
CLEAR_ERROR_OCCURRED();
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooo";
exception_lineno = 276;
goto try_except_handler_10;
}
}
}
else
{
Py_DECREF( tmp_iterator_attempt );
// TODO: Could avoid PyErr_Format.
#if PYTHON_VERSION < 300
PyErr_Format( PyExc_ValueError, "too many values to unpack" );
#else
PyErr_Format( PyExc_ValueError, "too many values to unpack (expected 2)" );
#endif
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooo";
exception_lineno = 276;
goto try_except_handler_10;
}
goto try_end_4;
// Exception handler code:
try_except_handler_10:;
exception_keeper_type_4 = exception_type;
exception_keeper_value_4 = exception_value;
exception_keeper_tb_4 = exception_tb;
exception_keeper_lineno_4 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_2__source_iter );
tmp_tuple_unpack_2__source_iter = NULL;
// Re-raise.
exception_type = exception_keeper_type_4;
exception_value = exception_keeper_value_4;
exception_tb = exception_keeper_tb_4;
exception_lineno = exception_keeper_lineno_4;
goto try_except_handler_9;
// End of try:
try_end_4:;
goto try_end_5;
// Exception handler code:
try_except_handler_9:;
exception_keeper_type_5 = exception_type;
exception_keeper_value_5 = exception_value;
exception_keeper_tb_5 = exception_tb;
exception_keeper_lineno_5 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_2__element_1 );
tmp_tuple_unpack_2__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_2__element_2 );
tmp_tuple_unpack_2__element_2 = NULL;
// Re-raise.
exception_type = exception_keeper_type_5;
exception_value = exception_keeper_value_5;
exception_tb = exception_keeper_tb_5;
exception_lineno = exception_keeper_lineno_5;
goto try_except_handler_8;
// End of try:
try_end_5:;
Py_XDECREF( tmp_tuple_unpack_2__source_iter );
tmp_tuple_unpack_2__source_iter = NULL;
tmp_assign_source_18 = tmp_tuple_unpack_2__element_1;
CHECK_OBJECT( tmp_assign_source_18 );
{
PyObject *old = var_model;
var_model = tmp_assign_source_18;
Py_INCREF( var_model );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_2__element_1 );
tmp_tuple_unpack_2__element_1 = NULL;
tmp_assign_source_19 = tmp_tuple_unpack_2__element_2;
CHECK_OBJECT( tmp_assign_source_19 );
{
PyObject *old = var_obj;
var_obj = tmp_assign_source_19;
Py_INCREF( var_obj );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_2__element_2 );
tmp_tuple_unpack_2__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_2__element_1 );
tmp_tuple_unpack_2__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_2__element_2 );
tmp_tuple_unpack_2__element_2 = NULL;
tmp_source_name_8 = var_model;
if ( tmp_source_name_8 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "model" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 277;
type_description_1 = "ooooooooooooo";
goto try_except_handler_8;
}
tmp_source_name_7 = LOOKUP_ATTRIBUTE( tmp_source_name_8, const_str_plain__meta );
if ( tmp_source_name_7 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 277;
type_description_1 = "ooooooooooooo";
goto try_except_handler_8;
}
tmp_cond_value_1 = LOOKUP_ATTRIBUTE( tmp_source_name_7, const_str_plain_auto_created );
Py_DECREF( tmp_source_name_7 );
if ( tmp_cond_value_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 277;
type_description_1 = "ooooooooooooo";
goto try_except_handler_8;
}
tmp_cond_truth_1 = CHECK_IF_TRUE( tmp_cond_value_1 );
if ( tmp_cond_truth_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_cond_value_1 );
exception_lineno = 277;
type_description_1 = "ooooooooooooo";
goto try_except_handler_8;
}
Py_DECREF( tmp_cond_value_1 );
if ( tmp_cond_truth_1 == 1 )
{
goto branch_no_1;
}
else
{
goto branch_yes_1;
}
branch_yes_1:;
tmp_source_name_10 = GET_STRING_DICT_VALUE( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_signals );
if (unlikely( tmp_source_name_10 == NULL ))
{
tmp_source_name_10 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_signals );
}
if ( tmp_source_name_10 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "signals" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 278;
type_description_1 = "ooooooooooooo";
goto try_except_handler_8;
}
tmp_source_name_9 = LOOKUP_ATTRIBUTE( tmp_source_name_10, const_str_plain_pre_delete );
if ( tmp_source_name_9 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 278;
type_description_1 = "ooooooooooooo";
goto try_except_handler_8;
}
tmp_called_name_6 = LOOKUP_ATTRIBUTE( tmp_source_name_9, const_str_plain_send );
Py_DECREF( tmp_source_name_9 );
if ( tmp_called_name_6 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 278;
type_description_1 = "ooooooooooooo";
goto try_except_handler_8;
}
tmp_kw_name_3 = _PyDict_NewPresized( 3 );
tmp_dict_key_4 = const_str_plain_sender;
tmp_dict_value_4 = var_model;
if ( tmp_dict_value_4 == NULL )
{
Py_DECREF( tmp_called_name_6 );
Py_DECREF( tmp_kw_name_3 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "model" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 279;
type_description_1 = "ooooooooooooo";
goto try_except_handler_8;
}
tmp_res = PyDict_SetItem( tmp_kw_name_3, tmp_dict_key_4, tmp_dict_value_4 );
assert( !(tmp_res != 0) );
tmp_dict_key_5 = const_str_plain_instance;
tmp_dict_value_5 = var_obj;
if ( tmp_dict_value_5 == NULL )
{
Py_DECREF( tmp_called_name_6 );
Py_DECREF( tmp_kw_name_3 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "obj" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 279;
type_description_1 = "ooooooooooooo";
goto try_except_handler_8;
}
tmp_res = PyDict_SetItem( tmp_kw_name_3, tmp_dict_key_5, tmp_dict_value_5 );
assert( !(tmp_res != 0) );
tmp_dict_key_6 = const_str_plain_using;
tmp_source_name_11 = par_self;
if ( tmp_source_name_11 == NULL )
{
Py_DECREF( tmp_called_name_6 );
Py_DECREF( tmp_kw_name_3 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 279;
type_description_1 = "ooooooooooooo";
goto try_except_handler_8;
}
tmp_dict_value_6 = LOOKUP_ATTRIBUTE( tmp_source_name_11, const_str_plain_using );
if ( tmp_dict_value_6 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_6 );
Py_DECREF( tmp_kw_name_3 );
exception_lineno = 279;
type_description_1 = "ooooooooooooo";
goto try_except_handler_8;
}
tmp_res = PyDict_SetItem( tmp_kw_name_3, tmp_dict_key_6, tmp_dict_value_6 );
Py_DECREF( tmp_dict_value_6 );
assert( !(tmp_res != 0) );
frame_54ec43c561ef94893d9bbef71a219f87->m_frame.f_lineno = 278;
tmp_unused = CALL_FUNCTION_WITH_KEYARGS( tmp_called_name_6, tmp_kw_name_3 );
Py_DECREF( tmp_called_name_6 );
Py_DECREF( tmp_kw_name_3 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 278;
type_description_1 = "ooooooooooooo";
goto try_except_handler_8;
}
Py_DECREF( tmp_unused );
branch_no_1:;
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 276;
type_description_1 = "ooooooooooooo";
goto try_except_handler_8;
}
goto loop_start_2;
loop_end_2:;
goto try_end_6;
// Exception handler code:
try_except_handler_8:;
exception_keeper_type_6 = exception_type;
exception_keeper_value_6 = exception_value;
exception_keeper_tb_6 = exception_tb;
exception_keeper_lineno_6 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_for_loop_2__iter_value );
tmp_for_loop_2__iter_value = NULL;
Py_XDECREF( tmp_for_loop_2__for_iterator );
tmp_for_loop_2__for_iterator = NULL;
// Re-raise.
exception_type = exception_keeper_type_6;
exception_value = exception_keeper_value_6;
exception_tb = exception_keeper_tb_6;
exception_lineno = exception_keeper_lineno_6;
goto try_except_handler_7;
// End of try:
try_end_6:;
Py_XDECREF( tmp_for_loop_2__iter_value );
tmp_for_loop_2__iter_value = NULL;
Py_XDECREF( tmp_for_loop_2__for_iterator );
tmp_for_loop_2__for_iterator = NULL;
tmp_source_name_12 = par_self;
if ( tmp_source_name_12 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 283;
type_description_1 = "ooooooooooooo";
goto try_except_handler_7;
}
tmp_iter_arg_5 = LOOKUP_ATTRIBUTE( tmp_source_name_12, const_str_plain_fast_deletes );
if ( tmp_iter_arg_5 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 283;
type_description_1 = "ooooooooooooo";
goto try_except_handler_7;
}
tmp_assign_source_20 = MAKE_ITERATOR( tmp_iter_arg_5 );
Py_DECREF( tmp_iter_arg_5 );
if ( tmp_assign_source_20 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 283;
type_description_1 = "ooooooooooooo";
goto try_except_handler_7;
}
assert( tmp_for_loop_3__for_iterator == NULL );
tmp_for_loop_3__for_iterator = tmp_assign_source_20;
// Tried code:
loop_start_3:;
tmp_next_source_3 = tmp_for_loop_3__for_iterator;
CHECK_OBJECT( tmp_next_source_3 );
tmp_assign_source_21 = ITERATOR_NEXT( tmp_next_source_3 );
if ( tmp_assign_source_21 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_3;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooo";
exception_lineno = 283;
goto try_except_handler_11;
}
}
{
PyObject *old = tmp_for_loop_3__iter_value;
tmp_for_loop_3__iter_value = tmp_assign_source_21;
Py_XDECREF( old );
}
tmp_assign_source_22 = tmp_for_loop_3__iter_value;
CHECK_OBJECT( tmp_assign_source_22 );
{
PyObject *old = var_qs;
var_qs = tmp_assign_source_22;
Py_INCREF( var_qs );
Py_XDECREF( old );
}
tmp_source_name_13 = var_qs;
CHECK_OBJECT( tmp_source_name_13 );
tmp_called_name_7 = LOOKUP_ATTRIBUTE( tmp_source_name_13, const_str_plain__raw_delete );
if ( tmp_called_name_7 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 284;
type_description_1 = "ooooooooooooo";
goto try_except_handler_11;
}
tmp_kw_name_4 = _PyDict_NewPresized( 1 );
tmp_dict_key_7 = const_str_plain_using;
tmp_source_name_14 = par_self;
if ( tmp_source_name_14 == NULL )
{
Py_DECREF( tmp_called_name_7 );
Py_DECREF( tmp_kw_name_4 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 284;
type_description_1 = "ooooooooooooo";
goto try_except_handler_11;
}
tmp_dict_value_7 = LOOKUP_ATTRIBUTE( tmp_source_name_14, const_str_plain_using );
if ( tmp_dict_value_7 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_7 );
Py_DECREF( tmp_kw_name_4 );
exception_lineno = 284;
type_description_1 = "ooooooooooooo";
goto try_except_handler_11;
}
tmp_res = PyDict_SetItem( tmp_kw_name_4, tmp_dict_key_7, tmp_dict_value_7 );
Py_DECREF( tmp_dict_value_7 );
assert( !(tmp_res != 0) );
frame_54ec43c561ef94893d9bbef71a219f87->m_frame.f_lineno = 284;
tmp_assign_source_23 = CALL_FUNCTION_WITH_KEYARGS( tmp_called_name_7, tmp_kw_name_4 );
Py_DECREF( tmp_called_name_7 );
Py_DECREF( tmp_kw_name_4 );
if ( tmp_assign_source_23 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 284;
type_description_1 = "ooooooooooooo";
goto try_except_handler_11;
}
{
PyObject *old = var_count;
var_count = tmp_assign_source_23;
Py_XDECREF( old );
}
tmp_assign_source_24 = var_deleted_counter;
if ( tmp_assign_source_24 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "deleted_counter" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 285;
type_description_1 = "ooooooooooooo";
goto try_except_handler_11;
}
{
PyObject *old = tmp_inplace_assign_subscr_1__target;
tmp_inplace_assign_subscr_1__target = tmp_assign_source_24;
Py_INCREF( tmp_inplace_assign_subscr_1__target );
Py_XDECREF( old );
}
// Tried code:
tmp_source_name_17 = var_qs;
if ( tmp_source_name_17 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "qs" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 285;
type_description_1 = "ooooooooooooo";
goto try_except_handler_12;
}
tmp_source_name_16 = LOOKUP_ATTRIBUTE( tmp_source_name_17, const_str_plain_model );
if ( tmp_source_name_16 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 285;
type_description_1 = "ooooooooooooo";
goto try_except_handler_12;
}
tmp_source_name_15 = LOOKUP_ATTRIBUTE( tmp_source_name_16, const_str_plain__meta );
Py_DECREF( tmp_source_name_16 );
if ( tmp_source_name_15 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 285;
type_description_1 = "ooooooooooooo";
goto try_except_handler_12;
}
tmp_assign_source_25 = LOOKUP_ATTRIBUTE( tmp_source_name_15, const_str_plain_label );
Py_DECREF( tmp_source_name_15 );
if ( tmp_assign_source_25 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 285;
type_description_1 = "ooooooooooooo";
goto try_except_handler_12;
}
{
PyObject *old = tmp_inplace_assign_subscr_1__subscript;
tmp_inplace_assign_subscr_1__subscript = tmp_assign_source_25;
Py_XDECREF( old );
}
tmp_subscribed_name_1 = tmp_inplace_assign_subscr_1__target;
CHECK_OBJECT( tmp_subscribed_name_1 );
tmp_subscript_name_1 = tmp_inplace_assign_subscr_1__subscript;
CHECK_OBJECT( tmp_subscript_name_1 );
tmp_left_name_1 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_1, tmp_subscript_name_1 );
if ( tmp_left_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 285;
type_description_1 = "ooooooooooooo";
goto try_except_handler_12;
}
tmp_right_name_1 = var_count;
if ( tmp_right_name_1 == NULL )
{
Py_DECREF( tmp_left_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "count" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 285;
type_description_1 = "ooooooooooooo";
goto try_except_handler_12;
}
tmp_ass_subvalue_2 = BINARY_OPERATION( PyNumber_InPlaceAdd, tmp_left_name_1, tmp_right_name_1 );
Py_DECREF( tmp_left_name_1 );
if ( tmp_ass_subvalue_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 285;
type_description_1 = "ooooooooooooo";
goto try_except_handler_12;
}
tmp_ass_subscribed_2 = tmp_inplace_assign_subscr_1__target;
CHECK_OBJECT( tmp_ass_subscribed_2 );
tmp_ass_subscript_2 = tmp_inplace_assign_subscr_1__subscript;
CHECK_OBJECT( tmp_ass_subscript_2 );
tmp_result = SET_SUBSCRIPT( tmp_ass_subscribed_2, tmp_ass_subscript_2, tmp_ass_subvalue_2 );
Py_DECREF( tmp_ass_subvalue_2 );
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 285;
type_description_1 = "ooooooooooooo";
goto try_except_handler_12;
}
goto try_end_7;
// Exception handler code:
try_except_handler_12:;
exception_keeper_type_7 = exception_type;
exception_keeper_value_7 = exception_value;
exception_keeper_tb_7 = exception_tb;
exception_keeper_lineno_7 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_inplace_assign_subscr_1__target );
tmp_inplace_assign_subscr_1__target = NULL;
Py_XDECREF( tmp_inplace_assign_subscr_1__subscript );
tmp_inplace_assign_subscr_1__subscript = NULL;
// Re-raise.
exception_type = exception_keeper_type_7;
exception_value = exception_keeper_value_7;
exception_tb = exception_keeper_tb_7;
exception_lineno = exception_keeper_lineno_7;
goto try_except_handler_11;
// End of try:
try_end_7:;
Py_XDECREF( tmp_inplace_assign_subscr_1__target );
tmp_inplace_assign_subscr_1__target = NULL;
Py_XDECREF( tmp_inplace_assign_subscr_1__subscript );
tmp_inplace_assign_subscr_1__subscript = NULL;
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 283;
type_description_1 = "ooooooooooooo";
goto try_except_handler_11;
}
goto loop_start_3;
loop_end_3:;
goto try_end_8;
// Exception handler code:
try_except_handler_11:;
exception_keeper_type_8 = exception_type;
exception_keeper_value_8 = exception_value;
exception_keeper_tb_8 = exception_tb;
exception_keeper_lineno_8 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_for_loop_3__iter_value );
tmp_for_loop_3__iter_value = NULL;
Py_XDECREF( tmp_for_loop_3__for_iterator );
tmp_for_loop_3__for_iterator = NULL;
// Re-raise.
exception_type = exception_keeper_type_8;
exception_value = exception_keeper_value_8;
exception_tb = exception_keeper_tb_8;
exception_lineno = exception_keeper_lineno_8;
goto try_except_handler_7;
// End of try:
try_end_8:;
Py_XDECREF( tmp_for_loop_3__iter_value );
tmp_for_loop_3__iter_value = NULL;
Py_XDECREF( tmp_for_loop_3__for_iterator );
tmp_for_loop_3__for_iterator = NULL;
tmp_source_name_18 = GET_STRING_DICT_VALUE( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_six );
if (unlikely( tmp_source_name_18 == NULL ))
{
tmp_source_name_18 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_six );
}
if ( tmp_source_name_18 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "six" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 288;
type_description_1 = "ooooooooooooo";
goto try_except_handler_7;
}
tmp_called_name_8 = LOOKUP_ATTRIBUTE( tmp_source_name_18, const_str_plain_iteritems );
if ( tmp_called_name_8 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 288;
type_description_1 = "ooooooooooooo";
goto try_except_handler_7;
}
tmp_source_name_19 = par_self;
if ( tmp_source_name_19 == NULL )
{
Py_DECREF( tmp_called_name_8 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 288;
type_description_1 = "ooooooooooooo";
goto try_except_handler_7;
}
tmp_args_element_name_1 = LOOKUP_ATTRIBUTE( tmp_source_name_19, const_str_plain_field_updates );
if ( tmp_args_element_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_8 );
exception_lineno = 288;
type_description_1 = "ooooooooooooo";
goto try_except_handler_7;
}
frame_54ec43c561ef94893d9bbef71a219f87->m_frame.f_lineno = 288;
{
PyObject *call_args[] = { tmp_args_element_name_1 };
tmp_iter_arg_6 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_8, call_args );
}
Py_DECREF( tmp_called_name_8 );
Py_DECREF( tmp_args_element_name_1 );
if ( tmp_iter_arg_6 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 288;
type_description_1 = "ooooooooooooo";
goto try_except_handler_7;
}
tmp_assign_source_26 = MAKE_ITERATOR( tmp_iter_arg_6 );
Py_DECREF( tmp_iter_arg_6 );
if ( tmp_assign_source_26 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 288;
type_description_1 = "ooooooooooooo";
goto try_except_handler_7;
}
assert( tmp_for_loop_4__for_iterator == NULL );
tmp_for_loop_4__for_iterator = tmp_assign_source_26;
// Tried code:
loop_start_4:;
tmp_next_source_4 = tmp_for_loop_4__for_iterator;
CHECK_OBJECT( tmp_next_source_4 );
tmp_assign_source_27 = ITERATOR_NEXT( tmp_next_source_4 );
if ( tmp_assign_source_27 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_4;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooo";
exception_lineno = 288;
goto try_except_handler_13;
}
}
{
PyObject *old = tmp_for_loop_4__iter_value;
tmp_for_loop_4__iter_value = tmp_assign_source_27;
Py_XDECREF( old );
}
// Tried code:
tmp_iter_arg_7 = tmp_for_loop_4__iter_value;
CHECK_OBJECT( tmp_iter_arg_7 );
tmp_assign_source_28 = MAKE_ITERATOR( tmp_iter_arg_7 );
if ( tmp_assign_source_28 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 288;
type_description_1 = "ooooooooooooo";
goto try_except_handler_14;
}
{
PyObject *old = tmp_tuple_unpack_3__source_iter;
tmp_tuple_unpack_3__source_iter = tmp_assign_source_28;
Py_XDECREF( old );
}
// Tried code:
tmp_unpack_5 = tmp_tuple_unpack_3__source_iter;
CHECK_OBJECT( tmp_unpack_5 );
tmp_assign_source_29 = UNPACK_NEXT( tmp_unpack_5, 0, 2 );
if ( tmp_assign_source_29 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "ooooooooooooo";
exception_lineno = 288;
goto try_except_handler_15;
}
{
PyObject *old = tmp_tuple_unpack_3__element_1;
tmp_tuple_unpack_3__element_1 = tmp_assign_source_29;
Py_XDECREF( old );
}
tmp_unpack_6 = tmp_tuple_unpack_3__source_iter;
CHECK_OBJECT( tmp_unpack_6 );
tmp_assign_source_30 = UNPACK_NEXT( tmp_unpack_6, 1, 2 );
if ( tmp_assign_source_30 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "ooooooooooooo";
exception_lineno = 288;
goto try_except_handler_15;
}
{
PyObject *old = tmp_tuple_unpack_3__element_2;
tmp_tuple_unpack_3__element_2 = tmp_assign_source_30;
Py_XDECREF( old );
}
tmp_iterator_name_3 = tmp_tuple_unpack_3__source_iter;
CHECK_OBJECT( tmp_iterator_name_3 );
// Check if iterator has left-over elements.
CHECK_OBJECT( tmp_iterator_name_3 ); assert( HAS_ITERNEXT( tmp_iterator_name_3 ) );
tmp_iterator_attempt = (*Py_TYPE( tmp_iterator_name_3 )->tp_iternext)( tmp_iterator_name_3 );
if (likely( tmp_iterator_attempt == NULL ))
{
PyObject *error = GET_ERROR_OCCURRED();
if ( error != NULL )
{
if ( EXCEPTION_MATCH_BOOL_SINGLE( error, PyExc_StopIteration ))
{
CLEAR_ERROR_OCCURRED();
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooo";
exception_lineno = 288;
goto try_except_handler_15;
}
}
}
else
{
Py_DECREF( tmp_iterator_attempt );
// TODO: Could avoid PyErr_Format.
#if PYTHON_VERSION < 300
PyErr_Format( PyExc_ValueError, "too many values to unpack" );
#else
PyErr_Format( PyExc_ValueError, "too many values to unpack (expected 2)" );
#endif
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooo";
exception_lineno = 288;
goto try_except_handler_15;
}
goto try_end_9;
// Exception handler code:
try_except_handler_15:;
exception_keeper_type_9 = exception_type;
exception_keeper_value_9 = exception_value;
exception_keeper_tb_9 = exception_tb;
exception_keeper_lineno_9 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_3__source_iter );
tmp_tuple_unpack_3__source_iter = NULL;
// Re-raise.
exception_type = exception_keeper_type_9;
exception_value = exception_keeper_value_9;
exception_tb = exception_keeper_tb_9;
exception_lineno = exception_keeper_lineno_9;
goto try_except_handler_14;
// End of try:
try_end_9:;
goto try_end_10;
// Exception handler code:
try_except_handler_14:;
exception_keeper_type_10 = exception_type;
exception_keeper_value_10 = exception_value;
exception_keeper_tb_10 = exception_tb;
exception_keeper_lineno_10 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_3__element_1 );
tmp_tuple_unpack_3__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_3__element_2 );
tmp_tuple_unpack_3__element_2 = NULL;
// Re-raise.
exception_type = exception_keeper_type_10;
exception_value = exception_keeper_value_10;
exception_tb = exception_keeper_tb_10;
exception_lineno = exception_keeper_lineno_10;
goto try_except_handler_13;
// End of try:
try_end_10:;
Py_XDECREF( tmp_tuple_unpack_3__source_iter );
tmp_tuple_unpack_3__source_iter = NULL;
tmp_assign_source_31 = tmp_tuple_unpack_3__element_1;
CHECK_OBJECT( tmp_assign_source_31 );
{
PyObject *old = var_model;
var_model = tmp_assign_source_31;
Py_INCREF( var_model );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_3__element_1 );
tmp_tuple_unpack_3__element_1 = NULL;
tmp_assign_source_32 = tmp_tuple_unpack_3__element_2;
CHECK_OBJECT( tmp_assign_source_32 );
{
PyObject *old = var_instances_for_fieldvalues;
var_instances_for_fieldvalues = tmp_assign_source_32;
Py_INCREF( var_instances_for_fieldvalues );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_3__element_2 );
tmp_tuple_unpack_3__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_3__element_1 );
tmp_tuple_unpack_3__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_3__element_2 );
tmp_tuple_unpack_3__element_2 = NULL;
tmp_source_name_20 = GET_STRING_DICT_VALUE( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_sql );
if (unlikely( tmp_source_name_20 == NULL ))
{
tmp_source_name_20 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_sql );
}
if ( tmp_source_name_20 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "sql" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 289;
type_description_1 = "ooooooooooooo";
goto try_except_handler_13;
}
tmp_called_name_9 = LOOKUP_ATTRIBUTE( tmp_source_name_20, const_str_plain_UpdateQuery );
if ( tmp_called_name_9 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 289;
type_description_1 = "ooooooooooooo";
goto try_except_handler_13;
}
tmp_args_element_name_2 = var_model;
if ( tmp_args_element_name_2 == NULL )
{
Py_DECREF( tmp_called_name_9 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "model" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 289;
type_description_1 = "ooooooooooooo";
goto try_except_handler_13;
}
frame_54ec43c561ef94893d9bbef71a219f87->m_frame.f_lineno = 289;
{
PyObject *call_args[] = { tmp_args_element_name_2 };
tmp_assign_source_33 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_9, call_args );
}
Py_DECREF( tmp_called_name_9 );
if ( tmp_assign_source_33 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 289;
type_description_1 = "ooooooooooooo";
goto try_except_handler_13;
}
{
PyObject *old = var_query;
var_query = tmp_assign_source_33;
Py_XDECREF( old );
}
tmp_source_name_21 = GET_STRING_DICT_VALUE( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_six );
if (unlikely( tmp_source_name_21 == NULL ))
{
tmp_source_name_21 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_six );
}
if ( tmp_source_name_21 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "six" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 290;
type_description_1 = "ooooooooooooo";
goto try_except_handler_13;
}
tmp_called_name_10 = LOOKUP_ATTRIBUTE( tmp_source_name_21, const_str_plain_iteritems );
if ( tmp_called_name_10 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 290;
type_description_1 = "ooooooooooooo";
goto try_except_handler_13;
}
tmp_args_element_name_3 = var_instances_for_fieldvalues;
if ( tmp_args_element_name_3 == NULL )
{
Py_DECREF( tmp_called_name_10 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "instances_for_fieldvalues" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 290;
type_description_1 = "ooooooooooooo";
goto try_except_handler_13;
}
frame_54ec43c561ef94893d9bbef71a219f87->m_frame.f_lineno = 290;
{
PyObject *call_args[] = { tmp_args_element_name_3 };
tmp_iter_arg_8 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_10, call_args );
}
Py_DECREF( tmp_called_name_10 );
if ( tmp_iter_arg_8 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 290;
type_description_1 = "ooooooooooooo";
goto try_except_handler_13;
}
tmp_assign_source_34 = MAKE_ITERATOR( tmp_iter_arg_8 );
Py_DECREF( tmp_iter_arg_8 );
if ( tmp_assign_source_34 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 290;
type_description_1 = "ooooooooooooo";
goto try_except_handler_13;
}
{
PyObject *old = tmp_for_loop_5__for_iterator;
tmp_for_loop_5__for_iterator = tmp_assign_source_34;
Py_XDECREF( old );
}
// Tried code:
loop_start_5:;
tmp_next_source_5 = tmp_for_loop_5__for_iterator;
CHECK_OBJECT( tmp_next_source_5 );
tmp_assign_source_35 = ITERATOR_NEXT( tmp_next_source_5 );
if ( tmp_assign_source_35 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_5;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooo";
exception_lineno = 290;
goto try_except_handler_16;
}
}
{
PyObject *old = tmp_for_loop_5__iter_value;
tmp_for_loop_5__iter_value = tmp_assign_source_35;
Py_XDECREF( old );
}
// Tried code:
tmp_iter_arg_9 = tmp_for_loop_5__iter_value;
CHECK_OBJECT( tmp_iter_arg_9 );
tmp_assign_source_36 = MAKE_ITERATOR( tmp_iter_arg_9 );
if ( tmp_assign_source_36 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 290;
type_description_1 = "ooooooooooooo";
goto try_except_handler_17;
}
{
PyObject *old = tmp_tuple_unpack_4__source_iter;
tmp_tuple_unpack_4__source_iter = tmp_assign_source_36;
Py_XDECREF( old );
}
// Tried code:
tmp_unpack_7 = tmp_tuple_unpack_4__source_iter;
CHECK_OBJECT( tmp_unpack_7 );
tmp_assign_source_37 = UNPACK_NEXT( tmp_unpack_7, 0, 2 );
if ( tmp_assign_source_37 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "ooooooooooooo";
exception_lineno = 290;
goto try_except_handler_18;
}
{
PyObject *old = tmp_tuple_unpack_4__element_1;
tmp_tuple_unpack_4__element_1 = tmp_assign_source_37;
Py_XDECREF( old );
}
tmp_unpack_8 = tmp_tuple_unpack_4__source_iter;
CHECK_OBJECT( tmp_unpack_8 );
tmp_assign_source_38 = UNPACK_NEXT( tmp_unpack_8, 1, 2 );
if ( tmp_assign_source_38 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "ooooooooooooo";
exception_lineno = 290;
goto try_except_handler_18;
}
{
PyObject *old = tmp_tuple_unpack_4__element_2;
tmp_tuple_unpack_4__element_2 = tmp_assign_source_38;
Py_XDECREF( old );
}
tmp_iterator_name_4 = tmp_tuple_unpack_4__source_iter;
CHECK_OBJECT( tmp_iterator_name_4 );
// Check if iterator has left-over elements.
CHECK_OBJECT( tmp_iterator_name_4 ); assert( HAS_ITERNEXT( tmp_iterator_name_4 ) );
tmp_iterator_attempt = (*Py_TYPE( tmp_iterator_name_4 )->tp_iternext)( tmp_iterator_name_4 );
if (likely( tmp_iterator_attempt == NULL ))
{
PyObject *error = GET_ERROR_OCCURRED();
if ( error != NULL )
{
if ( EXCEPTION_MATCH_BOOL_SINGLE( error, PyExc_StopIteration ))
{
CLEAR_ERROR_OCCURRED();
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooo";
exception_lineno = 290;
goto try_except_handler_18;
}
}
}
else
{
Py_DECREF( tmp_iterator_attempt );
// TODO: Could avoid PyErr_Format.
#if PYTHON_VERSION < 300
PyErr_Format( PyExc_ValueError, "too many values to unpack" );
#else
PyErr_Format( PyExc_ValueError, "too many values to unpack (expected 2)" );
#endif
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooo";
exception_lineno = 290;
goto try_except_handler_18;
}
goto try_end_11;
// Exception handler code:
try_except_handler_18:;
exception_keeper_type_11 = exception_type;
exception_keeper_value_11 = exception_value;
exception_keeper_tb_11 = exception_tb;
exception_keeper_lineno_11 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_4__source_iter );
tmp_tuple_unpack_4__source_iter = NULL;
// Re-raise.
exception_type = exception_keeper_type_11;
exception_value = exception_keeper_value_11;
exception_tb = exception_keeper_tb_11;
exception_lineno = exception_keeper_lineno_11;
goto try_except_handler_17;
// End of try:
try_end_11:;
Py_XDECREF( tmp_tuple_unpack_4__source_iter );
tmp_tuple_unpack_4__source_iter = NULL;
// Tried code:
tmp_iter_arg_10 = tmp_tuple_unpack_4__element_1;
CHECK_OBJECT( tmp_iter_arg_10 );
tmp_assign_source_39 = MAKE_ITERATOR( tmp_iter_arg_10 );
if ( tmp_assign_source_39 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 290;
type_description_1 = "ooooooooooooo";
goto try_except_handler_19;
}
{
PyObject *old = tmp_tuple_unpack_5__source_iter;
tmp_tuple_unpack_5__source_iter = tmp_assign_source_39;
Py_XDECREF( old );
}
// Tried code:
tmp_unpack_9 = tmp_tuple_unpack_5__source_iter;
CHECK_OBJECT( tmp_unpack_9 );
tmp_assign_source_40 = UNPACK_NEXT( tmp_unpack_9, 0, 2 );
if ( tmp_assign_source_40 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "ooooooooooooo";
exception_lineno = 290;
goto try_except_handler_20;
}
{
PyObject *old = tmp_tuple_unpack_5__element_1;
tmp_tuple_unpack_5__element_1 = tmp_assign_source_40;
Py_XDECREF( old );
}
tmp_unpack_10 = tmp_tuple_unpack_5__source_iter;
CHECK_OBJECT( tmp_unpack_10 );
tmp_assign_source_41 = UNPACK_NEXT( tmp_unpack_10, 1, 2 );
if ( tmp_assign_source_41 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "ooooooooooooo";
exception_lineno = 290;
goto try_except_handler_20;
}
{
PyObject *old = tmp_tuple_unpack_5__element_2;
tmp_tuple_unpack_5__element_2 = tmp_assign_source_41;
Py_XDECREF( old );
}
tmp_iterator_name_5 = tmp_tuple_unpack_5__source_iter;
CHECK_OBJECT( tmp_iterator_name_5 );
// Check if iterator has left-over elements.
CHECK_OBJECT( tmp_iterator_name_5 ); assert( HAS_ITERNEXT( tmp_iterator_name_5 ) );
tmp_iterator_attempt = (*Py_TYPE( tmp_iterator_name_5 )->tp_iternext)( tmp_iterator_name_5 );
if (likely( tmp_iterator_attempt == NULL ))
{
PyObject *error = GET_ERROR_OCCURRED();
if ( error != NULL )
{
if ( EXCEPTION_MATCH_BOOL_SINGLE( error, PyExc_StopIteration ))
{
CLEAR_ERROR_OCCURRED();
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooo";
exception_lineno = 290;
goto try_except_handler_20;
}
}
}
else
{
Py_DECREF( tmp_iterator_attempt );
// TODO: Could avoid PyErr_Format.
#if PYTHON_VERSION < 300
PyErr_Format( PyExc_ValueError, "too many values to unpack" );
#else
PyErr_Format( PyExc_ValueError, "too many values to unpack (expected 2)" );
#endif
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooo";
exception_lineno = 290;
goto try_except_handler_20;
}
goto try_end_12;
// Exception handler code:
try_except_handler_20:;
exception_keeper_type_12 = exception_type;
exception_keeper_value_12 = exception_value;
exception_keeper_tb_12 = exception_tb;
exception_keeper_lineno_12 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_5__source_iter );
tmp_tuple_unpack_5__source_iter = NULL;
// Re-raise.
exception_type = exception_keeper_type_12;
exception_value = exception_keeper_value_12;
exception_tb = exception_keeper_tb_12;
exception_lineno = exception_keeper_lineno_12;
goto try_except_handler_19;
// End of try:
try_end_12:;
goto try_end_13;
// Exception handler code:
try_except_handler_19:;
exception_keeper_type_13 = exception_type;
exception_keeper_value_13 = exception_value;
exception_keeper_tb_13 = exception_tb;
exception_keeper_lineno_13 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_5__element_1 );
tmp_tuple_unpack_5__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_5__element_2 );
tmp_tuple_unpack_5__element_2 = NULL;
// Re-raise.
exception_type = exception_keeper_type_13;
exception_value = exception_keeper_value_13;
exception_tb = exception_keeper_tb_13;
exception_lineno = exception_keeper_lineno_13;
goto try_except_handler_17;
// End of try:
try_end_13:;
goto try_end_14;
// Exception handler code:
try_except_handler_17:;
exception_keeper_type_14 = exception_type;
exception_keeper_value_14 = exception_value;
exception_keeper_tb_14 = exception_tb;
exception_keeper_lineno_14 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_4__element_1 );
tmp_tuple_unpack_4__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_4__element_2 );
tmp_tuple_unpack_4__element_2 = NULL;
// Re-raise.
exception_type = exception_keeper_type_14;
exception_value = exception_keeper_value_14;
exception_tb = exception_keeper_tb_14;
exception_lineno = exception_keeper_lineno_14;
goto try_except_handler_16;
// End of try:
try_end_14:;
Py_XDECREF( tmp_tuple_unpack_5__source_iter );
tmp_tuple_unpack_5__source_iter = NULL;
tmp_assign_source_42 = tmp_tuple_unpack_5__element_1;
CHECK_OBJECT( tmp_assign_source_42 );
{
PyObject *old = var_field;
var_field = tmp_assign_source_42;
Py_INCREF( var_field );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_5__element_1 );
tmp_tuple_unpack_5__element_1 = NULL;
tmp_assign_source_43 = tmp_tuple_unpack_5__element_2;
CHECK_OBJECT( tmp_assign_source_43 );
{
PyObject *old = var_value;
var_value = tmp_assign_source_43;
Py_INCREF( var_value );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_5__element_2 );
tmp_tuple_unpack_5__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_5__element_1 );
tmp_tuple_unpack_5__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_5__element_2 );
tmp_tuple_unpack_5__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_4__element_1 );
tmp_tuple_unpack_4__element_1 = NULL;
tmp_assign_source_44 = tmp_tuple_unpack_4__element_2;
CHECK_OBJECT( tmp_assign_source_44 );
{
PyObject *old = var_instances;
var_instances = tmp_assign_source_44;
Py_INCREF( var_instances );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_4__element_2 );
tmp_tuple_unpack_4__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_4__element_1 );
tmp_tuple_unpack_4__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_4__element_2 );
tmp_tuple_unpack_4__element_2 = NULL;
tmp_source_name_22 = var_query;
if ( tmp_source_name_22 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "query" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 291;
type_description_1 = "ooooooooooooo";
goto try_except_handler_16;
}
tmp_called_name_11 = LOOKUP_ATTRIBUTE( tmp_source_name_22, const_str_plain_update_batch );
if ( tmp_called_name_11 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 291;
type_description_1 = "ooooooooooooo";
goto try_except_handler_16;
}
// Tried code:
tmp_iter_arg_11 = var_instances;
if ( tmp_iter_arg_11 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "free variable '%s' referenced before assignment in enclosing scope", "instances" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 291;
type_description_1 = "ooooooooooooo";
goto try_except_handler_21;
}
tmp_assign_source_45 = MAKE_ITERATOR( tmp_iter_arg_11 );
if ( tmp_assign_source_45 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 291;
type_description_1 = "ooooooooooooo";
goto try_except_handler_21;
}
{
PyObject *old = tmp_listcontraction_1__$0;
tmp_listcontraction_1__$0 = tmp_assign_source_45;
Py_XDECREF( old );
}
tmp_assign_source_46 = PyList_New( 0 );
{
PyObject *old = tmp_listcontraction_1__contraction;
tmp_listcontraction_1__contraction = tmp_assign_source_46;
Py_XDECREF( old );
}
MAKE_OR_REUSE_FRAME( cache_frame_564feb323b16cc532f21be0bd5a6c08f_2, codeobj_564feb323b16cc532f21be0bd5a6c08f, module_django$db$models$deletion, sizeof(void *)+sizeof(void *) );
frame_564feb323b16cc532f21be0bd5a6c08f_2 = cache_frame_564feb323b16cc532f21be0bd5a6c08f_2;
// Push the new frame as the currently active one.
pushFrameStack( frame_564feb323b16cc532f21be0bd5a6c08f_2 );
// Mark the frame object as in use, ref count 1 will be up for reuse.
assert( Py_REFCNT( frame_564feb323b16cc532f21be0bd5a6c08f_2 ) == 2 ); // Frame stack
// Framed code:
// Tried code:
loop_start_6:;
tmp_next_source_6 = tmp_listcontraction_1__$0;
CHECK_OBJECT( tmp_next_source_6 );
tmp_assign_source_47 = ITERATOR_NEXT( tmp_next_source_6 );
if ( tmp_assign_source_47 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_6;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_2 = "oo";
exception_lineno = 291;
goto try_except_handler_22;
}
}
{
PyObject *old = tmp_listcontraction_1__iter_value_0;
tmp_listcontraction_1__iter_value_0 = tmp_assign_source_47;
Py_XDECREF( old );
}
tmp_assign_source_48 = tmp_listcontraction_1__iter_value_0;
CHECK_OBJECT( tmp_assign_source_48 );
{
PyObject *old = outline_0_var_obj;
outline_0_var_obj = tmp_assign_source_48;
Py_INCREF( outline_0_var_obj );
Py_XDECREF( old );
}
tmp_append_list_1 = tmp_listcontraction_1__contraction;
CHECK_OBJECT( tmp_append_list_1 );
tmp_source_name_23 = outline_0_var_obj;
CHECK_OBJECT( tmp_source_name_23 );
tmp_append_value_1 = LOOKUP_ATTRIBUTE( tmp_source_name_23, const_str_plain_pk );
if ( tmp_append_value_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 291;
type_description_2 = "oo";
goto try_except_handler_22;
}
assert( PyList_Check( tmp_append_list_1 ) );
tmp_res = PyList_Append( tmp_append_list_1, tmp_append_value_1 );
Py_DECREF( tmp_append_value_1 );
if ( tmp_res == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 291;
type_description_2 = "oo";
goto try_except_handler_22;
}
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 291;
type_description_2 = "oo";
goto try_except_handler_22;
}
goto loop_start_6;
loop_end_6:;
tmp_outline_return_value_1 = tmp_listcontraction_1__contraction;
CHECK_OBJECT( tmp_outline_return_value_1 );
Py_INCREF( tmp_outline_return_value_1 );
goto try_return_handler_22;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_18_delete );
return NULL;
// Return handler code:
try_return_handler_22:;
Py_XDECREF( tmp_listcontraction_1__$0 );
tmp_listcontraction_1__$0 = NULL;
Py_XDECREF( tmp_listcontraction_1__contraction );
tmp_listcontraction_1__contraction = NULL;
Py_XDECREF( tmp_listcontraction_1__iter_value_0 );
tmp_listcontraction_1__iter_value_0 = NULL;
goto frame_return_exit_2;
// Exception handler code:
try_except_handler_22:;
exception_keeper_type_15 = exception_type;
exception_keeper_value_15 = exception_value;
exception_keeper_tb_15 = exception_tb;
exception_keeper_lineno_15 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_listcontraction_1__$0 );
tmp_listcontraction_1__$0 = NULL;
Py_XDECREF( tmp_listcontraction_1__contraction );
tmp_listcontraction_1__contraction = NULL;
Py_XDECREF( tmp_listcontraction_1__iter_value_0 );
tmp_listcontraction_1__iter_value_0 = NULL;
// Re-raise.
exception_type = exception_keeper_type_15;
exception_value = exception_keeper_value_15;
exception_tb = exception_keeper_tb_15;
exception_lineno = exception_keeper_lineno_15;
goto frame_exception_exit_2;
// End of try:
#if 0
RESTORE_FRAME_EXCEPTION( frame_564feb323b16cc532f21be0bd5a6c08f_2 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto frame_no_exception_1;
frame_return_exit_2:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_564feb323b16cc532f21be0bd5a6c08f_2 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto try_return_handler_21;
frame_exception_exit_2:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_564feb323b16cc532f21be0bd5a6c08f_2 );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( frame_564feb323b16cc532f21be0bd5a6c08f_2, exception_lineno );
}
else if ( exception_tb->tb_frame != &frame_564feb323b16cc532f21be0bd5a6c08f_2->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, frame_564feb323b16cc532f21be0bd5a6c08f_2, exception_lineno );
}
// Attachs locals to frame if any.
Nuitka_Frame_AttachLocals(
(struct Nuitka_FrameObject *)frame_564feb323b16cc532f21be0bd5a6c08f_2,
type_description_2,
outline_0_var_obj,
var_instances
);
// Release cached frame.
if ( frame_564feb323b16cc532f21be0bd5a6c08f_2 == cache_frame_564feb323b16cc532f21be0bd5a6c08f_2 )
{
Py_DECREF( frame_564feb323b16cc532f21be0bd5a6c08f_2 );
}
cache_frame_564feb323b16cc532f21be0bd5a6c08f_2 = NULL;
assertFrameObject( frame_564feb323b16cc532f21be0bd5a6c08f_2 );
// Put the previous frame back on top.
popFrameStack();
// Return the error.
goto nested_frame_exit_1;
frame_no_exception_1:;
goto skip_nested_handling_1;
nested_frame_exit_1:;
type_description_1 = "ooooooooooooo";
goto try_except_handler_21;
skip_nested_handling_1:;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_18_delete );
return NULL;
// Return handler code:
try_return_handler_21:;
Py_XDECREF( outline_0_var_obj );
outline_0_var_obj = NULL;
goto outline_result_1;
// Exception handler code:
try_except_handler_21:;
exception_keeper_type_16 = exception_type;
exception_keeper_value_16 = exception_value;
exception_keeper_tb_16 = exception_tb;
exception_keeper_lineno_16 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( outline_0_var_obj );
outline_0_var_obj = NULL;
// Re-raise.
exception_type = exception_keeper_type_16;
exception_value = exception_keeper_value_16;
exception_tb = exception_keeper_tb_16;
exception_lineno = exception_keeper_lineno_16;
goto outline_exception_1;
// End of try:
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_18_delete );
return NULL;
outline_exception_1:;
exception_lineno = 291;
goto try_except_handler_16;
outline_result_1:;
tmp_args_element_name_4 = tmp_outline_return_value_1;
tmp_args_element_name_5 = _PyDict_NewPresized( 1 );
tmp_source_name_24 = var_field;
if ( tmp_source_name_24 == NULL )
{
Py_DECREF( tmp_called_name_11 );
Py_DECREF( tmp_args_element_name_4 );
Py_DECREF( tmp_args_element_name_5 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "field" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 292;
type_description_1 = "ooooooooooooo";
goto try_except_handler_16;
}
tmp_dict_key_8 = LOOKUP_ATTRIBUTE( tmp_source_name_24, const_str_plain_name );
if ( tmp_dict_key_8 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_11 );
Py_DECREF( tmp_args_element_name_4 );
Py_DECREF( tmp_args_element_name_5 );
exception_lineno = 292;
type_description_1 = "ooooooooooooo";
goto try_except_handler_16;
}
tmp_dict_value_8 = var_value;
if ( tmp_dict_value_8 == NULL )
{
Py_DECREF( tmp_called_name_11 );
Py_DECREF( tmp_args_element_name_4 );
Py_DECREF( tmp_args_element_name_5 );
Py_DECREF( tmp_dict_key_8 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "value" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 292;
type_description_1 = "ooooooooooooo";
goto try_except_handler_16;
}
tmp_res = PyDict_SetItem( tmp_args_element_name_5, tmp_dict_key_8, tmp_dict_value_8 );
Py_DECREF( tmp_dict_key_8 );
if ( tmp_res != 0 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_11 );
Py_DECREF( tmp_args_element_name_4 );
Py_DECREF( tmp_args_element_name_5 );
exception_lineno = 292;
type_description_1 = "ooooooooooooo";
goto try_except_handler_16;
}
tmp_source_name_25 = par_self;
if ( tmp_source_name_25 == NULL )
{
Py_DECREF( tmp_called_name_11 );
Py_DECREF( tmp_args_element_name_4 );
Py_DECREF( tmp_args_element_name_5 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 292;
type_description_1 = "ooooooooooooo";
goto try_except_handler_16;
}
tmp_args_element_name_6 = LOOKUP_ATTRIBUTE( tmp_source_name_25, const_str_plain_using );
if ( tmp_args_element_name_6 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_11 );
Py_DECREF( tmp_args_element_name_4 );
Py_DECREF( tmp_args_element_name_5 );
exception_lineno = 292;
type_description_1 = "ooooooooooooo";
goto try_except_handler_16;
}
frame_54ec43c561ef94893d9bbef71a219f87->m_frame.f_lineno = 291;
{
PyObject *call_args[] = { tmp_args_element_name_4, tmp_args_element_name_5, tmp_args_element_name_6 };
tmp_unused = CALL_FUNCTION_WITH_ARGS3( tmp_called_name_11, call_args );
}
Py_DECREF( tmp_called_name_11 );
Py_DECREF( tmp_args_element_name_4 );
Py_DECREF( tmp_args_element_name_5 );
Py_DECREF( tmp_args_element_name_6 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 291;
type_description_1 = "ooooooooooooo";
goto try_except_handler_16;
}
Py_DECREF( tmp_unused );
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 290;
type_description_1 = "ooooooooooooo";
goto try_except_handler_16;
}
goto loop_start_5;
loop_end_5:;
goto try_end_15;
// Exception handler code:
try_except_handler_16:;
exception_keeper_type_17 = exception_type;
exception_keeper_value_17 = exception_value;
exception_keeper_tb_17 = exception_tb;
exception_keeper_lineno_17 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_for_loop_5__iter_value );
tmp_for_loop_5__iter_value = NULL;
Py_XDECREF( tmp_for_loop_5__for_iterator );
tmp_for_loop_5__for_iterator = NULL;
// Re-raise.
exception_type = exception_keeper_type_17;
exception_value = exception_keeper_value_17;
exception_tb = exception_keeper_tb_17;
exception_lineno = exception_keeper_lineno_17;
goto try_except_handler_13;
// End of try:
try_end_15:;
Py_XDECREF( tmp_for_loop_5__iter_value );
tmp_for_loop_5__iter_value = NULL;
Py_XDECREF( tmp_for_loop_5__for_iterator );
tmp_for_loop_5__for_iterator = NULL;
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 288;
type_description_1 = "ooooooooooooo";
goto try_except_handler_13;
}
goto loop_start_4;
loop_end_4:;
goto try_end_16;
// Exception handler code:
try_except_handler_13:;
exception_keeper_type_18 = exception_type;
exception_keeper_value_18 = exception_value;
exception_keeper_tb_18 = exception_tb;
exception_keeper_lineno_18 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_for_loop_4__iter_value );
tmp_for_loop_4__iter_value = NULL;
Py_XDECREF( tmp_for_loop_4__for_iterator );
tmp_for_loop_4__for_iterator = NULL;
// Re-raise.
exception_type = exception_keeper_type_18;
exception_value = exception_keeper_value_18;
exception_tb = exception_keeper_tb_18;
exception_lineno = exception_keeper_lineno_18;
goto try_except_handler_7;
// End of try:
try_end_16:;
Py_XDECREF( tmp_for_loop_4__iter_value );
tmp_for_loop_4__iter_value = NULL;
Py_XDECREF( tmp_for_loop_4__for_iterator );
tmp_for_loop_4__for_iterator = NULL;
tmp_source_name_26 = GET_STRING_DICT_VALUE( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_six );
if (unlikely( tmp_source_name_26 == NULL ))
{
tmp_source_name_26 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_six );
}
if ( tmp_source_name_26 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "six" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 295;
type_description_1 = "ooooooooooooo";
goto try_except_handler_7;
}
tmp_called_name_12 = LOOKUP_ATTRIBUTE( tmp_source_name_26, const_str_plain_itervalues );
if ( tmp_called_name_12 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 295;
type_description_1 = "ooooooooooooo";
goto try_except_handler_7;
}
tmp_source_name_27 = par_self;
if ( tmp_source_name_27 == NULL )
{
Py_DECREF( tmp_called_name_12 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 295;
type_description_1 = "ooooooooooooo";
goto try_except_handler_7;
}
tmp_args_element_name_7 = LOOKUP_ATTRIBUTE( tmp_source_name_27, const_str_plain_data );
if ( tmp_args_element_name_7 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_12 );
exception_lineno = 295;
type_description_1 = "ooooooooooooo";
goto try_except_handler_7;
}
frame_54ec43c561ef94893d9bbef71a219f87->m_frame.f_lineno = 295;
{
PyObject *call_args[] = { tmp_args_element_name_7 };
tmp_iter_arg_12 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_12, call_args );
}
Py_DECREF( tmp_called_name_12 );
Py_DECREF( tmp_args_element_name_7 );
if ( tmp_iter_arg_12 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 295;
type_description_1 = "ooooooooooooo";
goto try_except_handler_7;
}
tmp_assign_source_49 = MAKE_ITERATOR( tmp_iter_arg_12 );
Py_DECREF( tmp_iter_arg_12 );
if ( tmp_assign_source_49 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 295;
type_description_1 = "ooooooooooooo";
goto try_except_handler_7;
}
assert( tmp_for_loop_6__for_iterator == NULL );
tmp_for_loop_6__for_iterator = tmp_assign_source_49;
// Tried code:
loop_start_7:;
tmp_next_source_7 = tmp_for_loop_6__for_iterator;
CHECK_OBJECT( tmp_next_source_7 );
tmp_assign_source_50 = ITERATOR_NEXT( tmp_next_source_7 );
if ( tmp_assign_source_50 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_7;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooo";
exception_lineno = 295;
goto try_except_handler_23;
}
}
{
PyObject *old = tmp_for_loop_6__iter_value;
tmp_for_loop_6__iter_value = tmp_assign_source_50;
Py_XDECREF( old );
}
tmp_assign_source_51 = tmp_for_loop_6__iter_value;
CHECK_OBJECT( tmp_assign_source_51 );
{
PyObject *old = var_instances;
var_instances = tmp_assign_source_51;
Py_INCREF( var_instances );
Py_XDECREF( old );
}
tmp_called_instance_4 = var_instances;
CHECK_OBJECT( tmp_called_instance_4 );
frame_54ec43c561ef94893d9bbef71a219f87->m_frame.f_lineno = 296;
tmp_unused = CALL_METHOD_NO_ARGS( tmp_called_instance_4, const_str_plain_reverse );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 296;
type_description_1 = "ooooooooooooo";
goto try_except_handler_23;
}
Py_DECREF( tmp_unused );
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 295;
type_description_1 = "ooooooooooooo";
goto try_except_handler_23;
}
goto loop_start_7;
loop_end_7:;
goto try_end_17;
// Exception handler code:
try_except_handler_23:;
exception_keeper_type_19 = exception_type;
exception_keeper_value_19 = exception_value;
exception_keeper_tb_19 = exception_tb;
exception_keeper_lineno_19 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_for_loop_6__iter_value );
tmp_for_loop_6__iter_value = NULL;
Py_XDECREF( tmp_for_loop_6__for_iterator );
tmp_for_loop_6__for_iterator = NULL;
// Re-raise.
exception_type = exception_keeper_type_19;
exception_value = exception_keeper_value_19;
exception_tb = exception_keeper_tb_19;
exception_lineno = exception_keeper_lineno_19;
goto try_except_handler_7;
// End of try:
try_end_17:;
Py_XDECREF( tmp_for_loop_6__iter_value );
tmp_for_loop_6__iter_value = NULL;
Py_XDECREF( tmp_for_loop_6__for_iterator );
tmp_for_loop_6__for_iterator = NULL;
tmp_source_name_28 = GET_STRING_DICT_VALUE( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_six );
if (unlikely( tmp_source_name_28 == NULL ))
{
tmp_source_name_28 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_six );
}
if ( tmp_source_name_28 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "six" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 299;
type_description_1 = "ooooooooooooo";
goto try_except_handler_7;
}
tmp_called_name_13 = LOOKUP_ATTRIBUTE( tmp_source_name_28, const_str_plain_iteritems );
if ( tmp_called_name_13 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 299;
type_description_1 = "ooooooooooooo";
goto try_except_handler_7;
}
tmp_source_name_29 = par_self;
if ( tmp_source_name_29 == NULL )
{
Py_DECREF( tmp_called_name_13 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 299;
type_description_1 = "ooooooooooooo";
goto try_except_handler_7;
}
tmp_args_element_name_8 = LOOKUP_ATTRIBUTE( tmp_source_name_29, const_str_plain_data );
if ( tmp_args_element_name_8 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_13 );
exception_lineno = 299;
type_description_1 = "ooooooooooooo";
goto try_except_handler_7;
}
frame_54ec43c561ef94893d9bbef71a219f87->m_frame.f_lineno = 299;
{
PyObject *call_args[] = { tmp_args_element_name_8 };
tmp_iter_arg_13 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_13, call_args );
}
Py_DECREF( tmp_called_name_13 );
Py_DECREF( tmp_args_element_name_8 );
if ( tmp_iter_arg_13 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 299;
type_description_1 = "ooooooooooooo";
goto try_except_handler_7;
}
tmp_assign_source_52 = MAKE_ITERATOR( tmp_iter_arg_13 );
Py_DECREF( tmp_iter_arg_13 );
if ( tmp_assign_source_52 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 299;
type_description_1 = "ooooooooooooo";
goto try_except_handler_7;
}
assert( tmp_for_loop_7__for_iterator == NULL );
tmp_for_loop_7__for_iterator = tmp_assign_source_52;
// Tried code:
loop_start_8:;
tmp_next_source_8 = tmp_for_loop_7__for_iterator;
CHECK_OBJECT( tmp_next_source_8 );
tmp_assign_source_53 = ITERATOR_NEXT( tmp_next_source_8 );
if ( tmp_assign_source_53 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_8;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooo";
exception_lineno = 299;
goto try_except_handler_24;
}
}
{
PyObject *old = tmp_for_loop_7__iter_value;
tmp_for_loop_7__iter_value = tmp_assign_source_53;
Py_XDECREF( old );
}
// Tried code:
tmp_iter_arg_14 = tmp_for_loop_7__iter_value;
CHECK_OBJECT( tmp_iter_arg_14 );
tmp_assign_source_54 = MAKE_ITERATOR( tmp_iter_arg_14 );
if ( tmp_assign_source_54 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 299;
type_description_1 = "ooooooooooooo";
goto try_except_handler_25;
}
{
PyObject *old = tmp_tuple_unpack_6__source_iter;
tmp_tuple_unpack_6__source_iter = tmp_assign_source_54;
Py_XDECREF( old );
}
// Tried code:
tmp_unpack_11 = tmp_tuple_unpack_6__source_iter;
CHECK_OBJECT( tmp_unpack_11 );
tmp_assign_source_55 = UNPACK_NEXT( tmp_unpack_11, 0, 2 );
if ( tmp_assign_source_55 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "ooooooooooooo";
exception_lineno = 299;
goto try_except_handler_26;
}
{
PyObject *old = tmp_tuple_unpack_6__element_1;
tmp_tuple_unpack_6__element_1 = tmp_assign_source_55;
Py_XDECREF( old );
}
tmp_unpack_12 = tmp_tuple_unpack_6__source_iter;
CHECK_OBJECT( tmp_unpack_12 );
tmp_assign_source_56 = UNPACK_NEXT( tmp_unpack_12, 1, 2 );
if ( tmp_assign_source_56 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "ooooooooooooo";
exception_lineno = 299;
goto try_except_handler_26;
}
{
PyObject *old = tmp_tuple_unpack_6__element_2;
tmp_tuple_unpack_6__element_2 = tmp_assign_source_56;
Py_XDECREF( old );
}
tmp_iterator_name_6 = tmp_tuple_unpack_6__source_iter;
CHECK_OBJECT( tmp_iterator_name_6 );
// Check if iterator has left-over elements.
CHECK_OBJECT( tmp_iterator_name_6 ); assert( HAS_ITERNEXT( tmp_iterator_name_6 ) );
tmp_iterator_attempt = (*Py_TYPE( tmp_iterator_name_6 )->tp_iternext)( tmp_iterator_name_6 );
if (likely( tmp_iterator_attempt == NULL ))
{
PyObject *error = GET_ERROR_OCCURRED();
if ( error != NULL )
{
if ( EXCEPTION_MATCH_BOOL_SINGLE( error, PyExc_StopIteration ))
{
CLEAR_ERROR_OCCURRED();
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooo";
exception_lineno = 299;
goto try_except_handler_26;
}
}
}
else
{
Py_DECREF( tmp_iterator_attempt );
// TODO: Could avoid PyErr_Format.
#if PYTHON_VERSION < 300
PyErr_Format( PyExc_ValueError, "too many values to unpack" );
#else
PyErr_Format( PyExc_ValueError, "too many values to unpack (expected 2)" );
#endif
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooo";
exception_lineno = 299;
goto try_except_handler_26;
}
goto try_end_18;
// Exception handler code:
try_except_handler_26:;
exception_keeper_type_20 = exception_type;
exception_keeper_value_20 = exception_value;
exception_keeper_tb_20 = exception_tb;
exception_keeper_lineno_20 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_6__source_iter );
tmp_tuple_unpack_6__source_iter = NULL;
// Re-raise.
exception_type = exception_keeper_type_20;
exception_value = exception_keeper_value_20;
exception_tb = exception_keeper_tb_20;
exception_lineno = exception_keeper_lineno_20;
goto try_except_handler_25;
// End of try:
try_end_18:;
goto try_end_19;
// Exception handler code:
try_except_handler_25:;
exception_keeper_type_21 = exception_type;
exception_keeper_value_21 = exception_value;
exception_keeper_tb_21 = exception_tb;
exception_keeper_lineno_21 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_6__element_1 );
tmp_tuple_unpack_6__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_6__element_2 );
tmp_tuple_unpack_6__element_2 = NULL;
// Re-raise.
exception_type = exception_keeper_type_21;
exception_value = exception_keeper_value_21;
exception_tb = exception_keeper_tb_21;
exception_lineno = exception_keeper_lineno_21;
goto try_except_handler_24;
// End of try:
try_end_19:;
Py_XDECREF( tmp_tuple_unpack_6__source_iter );
tmp_tuple_unpack_6__source_iter = NULL;
tmp_assign_source_57 = tmp_tuple_unpack_6__element_1;
CHECK_OBJECT( tmp_assign_source_57 );
{
PyObject *old = var_model;
var_model = tmp_assign_source_57;
Py_INCREF( var_model );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_6__element_1 );
tmp_tuple_unpack_6__element_1 = NULL;
tmp_assign_source_58 = tmp_tuple_unpack_6__element_2;
CHECK_OBJECT( tmp_assign_source_58 );
{
PyObject *old = var_instances;
var_instances = tmp_assign_source_58;
Py_INCREF( var_instances );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_6__element_2 );
tmp_tuple_unpack_6__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_6__element_1 );
tmp_tuple_unpack_6__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_6__element_2 );
tmp_tuple_unpack_6__element_2 = NULL;
tmp_source_name_30 = GET_STRING_DICT_VALUE( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_sql );
if (unlikely( tmp_source_name_30 == NULL ))
{
tmp_source_name_30 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_sql );
}
if ( tmp_source_name_30 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "sql" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 300;
type_description_1 = "ooooooooooooo";
goto try_except_handler_24;
}
tmp_called_name_14 = LOOKUP_ATTRIBUTE( tmp_source_name_30, const_str_plain_DeleteQuery );
if ( tmp_called_name_14 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 300;
type_description_1 = "ooooooooooooo";
goto try_except_handler_24;
}
tmp_args_element_name_9 = var_model;
if ( tmp_args_element_name_9 == NULL )
{
Py_DECREF( tmp_called_name_14 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "model" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 300;
type_description_1 = "ooooooooooooo";
goto try_except_handler_24;
}
frame_54ec43c561ef94893d9bbef71a219f87->m_frame.f_lineno = 300;
{
PyObject *call_args[] = { tmp_args_element_name_9 };
tmp_assign_source_59 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_14, call_args );
}
Py_DECREF( tmp_called_name_14 );
if ( tmp_assign_source_59 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 300;
type_description_1 = "ooooooooooooo";
goto try_except_handler_24;
}
{
PyObject *old = var_query;
var_query = tmp_assign_source_59;
Py_XDECREF( old );
}
// Tried code:
tmp_iter_arg_15 = var_instances;
if ( tmp_iter_arg_15 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "free variable '%s' referenced before assignment in enclosing scope", "instances" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 301;
type_description_1 = "ooooooooooooo";
goto try_except_handler_27;
}
tmp_assign_source_61 = MAKE_ITERATOR( tmp_iter_arg_15 );
if ( tmp_assign_source_61 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 301;
type_description_1 = "ooooooooooooo";
goto try_except_handler_27;
}
{
PyObject *old = tmp_listcontraction_2__$0;
tmp_listcontraction_2__$0 = tmp_assign_source_61;
Py_XDECREF( old );
}
tmp_assign_source_62 = PyList_New( 0 );
{
PyObject *old = tmp_listcontraction_2__contraction;
tmp_listcontraction_2__contraction = tmp_assign_source_62;
Py_XDECREF( old );
}
MAKE_OR_REUSE_FRAME( cache_frame_9f9f08f015e7aca9bdfd4554bcb4e2d4_3, codeobj_9f9f08f015e7aca9bdfd4554bcb4e2d4, module_django$db$models$deletion, sizeof(void *)+sizeof(void *) );
frame_9f9f08f015e7aca9bdfd4554bcb4e2d4_3 = cache_frame_9f9f08f015e7aca9bdfd4554bcb4e2d4_3;
// Push the new frame as the currently active one.
pushFrameStack( frame_9f9f08f015e7aca9bdfd4554bcb4e2d4_3 );
// Mark the frame object as in use, ref count 1 will be up for reuse.
assert( Py_REFCNT( frame_9f9f08f015e7aca9bdfd4554bcb4e2d4_3 ) == 2 ); // Frame stack
// Framed code:
// Tried code:
loop_start_9:;
tmp_next_source_9 = tmp_listcontraction_2__$0;
CHECK_OBJECT( tmp_next_source_9 );
tmp_assign_source_63 = ITERATOR_NEXT( tmp_next_source_9 );
if ( tmp_assign_source_63 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_9;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_2 = "oo";
exception_lineno = 301;
goto try_except_handler_28;
}
}
{
PyObject *old = tmp_listcontraction_2__iter_value_0;
tmp_listcontraction_2__iter_value_0 = tmp_assign_source_63;
Py_XDECREF( old );
}
tmp_assign_source_64 = tmp_listcontraction_2__iter_value_0;
CHECK_OBJECT( tmp_assign_source_64 );
{
PyObject *old = outline_1_var_obj;
outline_1_var_obj = tmp_assign_source_64;
Py_INCREF( outline_1_var_obj );
Py_XDECREF( old );
}
tmp_append_list_2 = tmp_listcontraction_2__contraction;
CHECK_OBJECT( tmp_append_list_2 );
tmp_source_name_31 = outline_1_var_obj;
CHECK_OBJECT( tmp_source_name_31 );
tmp_append_value_2 = LOOKUP_ATTRIBUTE( tmp_source_name_31, const_str_plain_pk );
if ( tmp_append_value_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 301;
type_description_2 = "oo";
goto try_except_handler_28;
}
assert( PyList_Check( tmp_append_list_2 ) );
tmp_res = PyList_Append( tmp_append_list_2, tmp_append_value_2 );
Py_DECREF( tmp_append_value_2 );
if ( tmp_res == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 301;
type_description_2 = "oo";
goto try_except_handler_28;
}
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 301;
type_description_2 = "oo";
goto try_except_handler_28;
}
goto loop_start_9;
loop_end_9:;
tmp_outline_return_value_2 = tmp_listcontraction_2__contraction;
CHECK_OBJECT( tmp_outline_return_value_2 );
Py_INCREF( tmp_outline_return_value_2 );
goto try_return_handler_28;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_18_delete );
return NULL;
// Return handler code:
try_return_handler_28:;
Py_XDECREF( tmp_listcontraction_2__$0 );
tmp_listcontraction_2__$0 = NULL;
Py_XDECREF( tmp_listcontraction_2__contraction );
tmp_listcontraction_2__contraction = NULL;
Py_XDECREF( tmp_listcontraction_2__iter_value_0 );
tmp_listcontraction_2__iter_value_0 = NULL;
goto frame_return_exit_3;
// Exception handler code:
try_except_handler_28:;
exception_keeper_type_22 = exception_type;
exception_keeper_value_22 = exception_value;
exception_keeper_tb_22 = exception_tb;
exception_keeper_lineno_22 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_listcontraction_2__$0 );
tmp_listcontraction_2__$0 = NULL;
Py_XDECREF( tmp_listcontraction_2__contraction );
tmp_listcontraction_2__contraction = NULL;
Py_XDECREF( tmp_listcontraction_2__iter_value_0 );
tmp_listcontraction_2__iter_value_0 = NULL;
// Re-raise.
exception_type = exception_keeper_type_22;
exception_value = exception_keeper_value_22;
exception_tb = exception_keeper_tb_22;
exception_lineno = exception_keeper_lineno_22;
goto frame_exception_exit_3;
// End of try:
#if 0
RESTORE_FRAME_EXCEPTION( frame_9f9f08f015e7aca9bdfd4554bcb4e2d4_3 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto frame_no_exception_2;
frame_return_exit_3:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_9f9f08f015e7aca9bdfd4554bcb4e2d4_3 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto try_return_handler_27;
frame_exception_exit_3:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_9f9f08f015e7aca9bdfd4554bcb4e2d4_3 );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( frame_9f9f08f015e7aca9bdfd4554bcb4e2d4_3, exception_lineno );
}
else if ( exception_tb->tb_frame != &frame_9f9f08f015e7aca9bdfd4554bcb4e2d4_3->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, frame_9f9f08f015e7aca9bdfd4554bcb4e2d4_3, exception_lineno );
}
// Attachs locals to frame if any.
Nuitka_Frame_AttachLocals(
(struct Nuitka_FrameObject *)frame_9f9f08f015e7aca9bdfd4554bcb4e2d4_3,
type_description_2,
outline_1_var_obj,
var_instances
);
// Release cached frame.
if ( frame_9f9f08f015e7aca9bdfd4554bcb4e2d4_3 == cache_frame_9f9f08f015e7aca9bdfd4554bcb4e2d4_3 )
{
Py_DECREF( frame_9f9f08f015e7aca9bdfd4554bcb4e2d4_3 );
}
cache_frame_9f9f08f015e7aca9bdfd4554bcb4e2d4_3 = NULL;
assertFrameObject( frame_9f9f08f015e7aca9bdfd4554bcb4e2d4_3 );
// Put the previous frame back on top.
popFrameStack();
// Return the error.
goto nested_frame_exit_2;
frame_no_exception_2:;
goto skip_nested_handling_2;
nested_frame_exit_2:;
type_description_1 = "ooooooooooooo";
goto try_except_handler_27;
skip_nested_handling_2:;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_18_delete );
return NULL;
// Return handler code:
try_return_handler_27:;
Py_XDECREF( outline_1_var_obj );
outline_1_var_obj = NULL;
goto outline_result_2;
// Exception handler code:
try_except_handler_27:;
exception_keeper_type_23 = exception_type;
exception_keeper_value_23 = exception_value;
exception_keeper_tb_23 = exception_tb;
exception_keeper_lineno_23 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( outline_1_var_obj );
outline_1_var_obj = NULL;
// Re-raise.
exception_type = exception_keeper_type_23;
exception_value = exception_keeper_value_23;
exception_tb = exception_keeper_tb_23;
exception_lineno = exception_keeper_lineno_23;
goto outline_exception_2;
// End of try:
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_18_delete );
return NULL;
outline_exception_2:;
exception_lineno = 301;
goto try_except_handler_24;
outline_result_2:;
tmp_assign_source_60 = tmp_outline_return_value_2;
{
PyObject *old = var_pk_list;
var_pk_list = tmp_assign_source_60;
Py_XDECREF( old );
}
tmp_source_name_32 = var_query;
if ( tmp_source_name_32 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "query" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 302;
type_description_1 = "ooooooooooooo";
goto try_except_handler_24;
}
tmp_called_name_15 = LOOKUP_ATTRIBUTE( tmp_source_name_32, const_str_plain_delete_batch );
if ( tmp_called_name_15 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 302;
type_description_1 = "ooooooooooooo";
goto try_except_handler_24;
}
tmp_args_element_name_10 = var_pk_list;
if ( tmp_args_element_name_10 == NULL )
{
Py_DECREF( tmp_called_name_15 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "pk_list" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 302;
type_description_1 = "ooooooooooooo";
goto try_except_handler_24;
}
tmp_source_name_33 = par_self;
if ( tmp_source_name_33 == NULL )
{
Py_DECREF( tmp_called_name_15 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 302;
type_description_1 = "ooooooooooooo";
goto try_except_handler_24;
}
tmp_args_element_name_11 = LOOKUP_ATTRIBUTE( tmp_source_name_33, const_str_plain_using );
if ( tmp_args_element_name_11 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_15 );
exception_lineno = 302;
type_description_1 = "ooooooooooooo";
goto try_except_handler_24;
}
frame_54ec43c561ef94893d9bbef71a219f87->m_frame.f_lineno = 302;
{
PyObject *call_args[] = { tmp_args_element_name_10, tmp_args_element_name_11 };
tmp_assign_source_65 = CALL_FUNCTION_WITH_ARGS2( tmp_called_name_15, call_args );
}
Py_DECREF( tmp_called_name_15 );
Py_DECREF( tmp_args_element_name_11 );
if ( tmp_assign_source_65 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 302;
type_description_1 = "ooooooooooooo";
goto try_except_handler_24;
}
{
PyObject *old = var_count;
var_count = tmp_assign_source_65;
Py_XDECREF( old );
}
tmp_assign_source_66 = var_deleted_counter;
if ( tmp_assign_source_66 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "deleted_counter" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 303;
type_description_1 = "ooooooooooooo";
goto try_except_handler_24;
}
{
PyObject *old = tmp_inplace_assign_subscr_2__target;
tmp_inplace_assign_subscr_2__target = tmp_assign_source_66;
Py_INCREF( tmp_inplace_assign_subscr_2__target );
Py_XDECREF( old );
}
// Tried code:
tmp_source_name_35 = var_model;
if ( tmp_source_name_35 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "model" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 303;
type_description_1 = "ooooooooooooo";
goto try_except_handler_29;
}
tmp_source_name_34 = LOOKUP_ATTRIBUTE( tmp_source_name_35, const_str_plain__meta );
if ( tmp_source_name_34 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 303;
type_description_1 = "ooooooooooooo";
goto try_except_handler_29;
}
tmp_assign_source_67 = LOOKUP_ATTRIBUTE( tmp_source_name_34, const_str_plain_label );
Py_DECREF( tmp_source_name_34 );
if ( tmp_assign_source_67 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 303;
type_description_1 = "ooooooooooooo";
goto try_except_handler_29;
}
{
PyObject *old = tmp_inplace_assign_subscr_2__subscript;
tmp_inplace_assign_subscr_2__subscript = tmp_assign_source_67;
Py_XDECREF( old );
}
tmp_subscribed_name_2 = tmp_inplace_assign_subscr_2__target;
CHECK_OBJECT( tmp_subscribed_name_2 );
tmp_subscript_name_2 = tmp_inplace_assign_subscr_2__subscript;
CHECK_OBJECT( tmp_subscript_name_2 );
tmp_left_name_2 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_2, tmp_subscript_name_2 );
if ( tmp_left_name_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 303;
type_description_1 = "ooooooooooooo";
goto try_except_handler_29;
}
tmp_right_name_2 = var_count;
if ( tmp_right_name_2 == NULL )
{
Py_DECREF( tmp_left_name_2 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "count" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 303;
type_description_1 = "ooooooooooooo";
goto try_except_handler_29;
}
tmp_ass_subvalue_3 = BINARY_OPERATION( PyNumber_InPlaceAdd, tmp_left_name_2, tmp_right_name_2 );
Py_DECREF( tmp_left_name_2 );
if ( tmp_ass_subvalue_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 303;
type_description_1 = "ooooooooooooo";
goto try_except_handler_29;
}
tmp_ass_subscribed_3 = tmp_inplace_assign_subscr_2__target;
CHECK_OBJECT( tmp_ass_subscribed_3 );
tmp_ass_subscript_3 = tmp_inplace_assign_subscr_2__subscript;
CHECK_OBJECT( tmp_ass_subscript_3 );
tmp_result = SET_SUBSCRIPT( tmp_ass_subscribed_3, tmp_ass_subscript_3, tmp_ass_subvalue_3 );
Py_DECREF( tmp_ass_subvalue_3 );
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 303;
type_description_1 = "ooooooooooooo";
goto try_except_handler_29;
}
goto try_end_20;
// Exception handler code:
try_except_handler_29:;
exception_keeper_type_24 = exception_type;
exception_keeper_value_24 = exception_value;
exception_keeper_tb_24 = exception_tb;
exception_keeper_lineno_24 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_inplace_assign_subscr_2__target );
tmp_inplace_assign_subscr_2__target = NULL;
Py_XDECREF( tmp_inplace_assign_subscr_2__subscript );
tmp_inplace_assign_subscr_2__subscript = NULL;
// Re-raise.
exception_type = exception_keeper_type_24;
exception_value = exception_keeper_value_24;
exception_tb = exception_keeper_tb_24;
exception_lineno = exception_keeper_lineno_24;
goto try_except_handler_24;
// End of try:
try_end_20:;
Py_XDECREF( tmp_inplace_assign_subscr_2__target );
tmp_inplace_assign_subscr_2__target = NULL;
Py_XDECREF( tmp_inplace_assign_subscr_2__subscript );
tmp_inplace_assign_subscr_2__subscript = NULL;
tmp_source_name_37 = var_model;
if ( tmp_source_name_37 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "model" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 305;
type_description_1 = "ooooooooooooo";
goto try_except_handler_24;
}
tmp_source_name_36 = LOOKUP_ATTRIBUTE( tmp_source_name_37, const_str_plain__meta );
if ( tmp_source_name_36 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 305;
type_description_1 = "ooooooooooooo";
goto try_except_handler_24;
}
tmp_cond_value_2 = LOOKUP_ATTRIBUTE( tmp_source_name_36, const_str_plain_auto_created );
Py_DECREF( tmp_source_name_36 );
if ( tmp_cond_value_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 305;
type_description_1 = "ooooooooooooo";
goto try_except_handler_24;
}
tmp_cond_truth_2 = CHECK_IF_TRUE( tmp_cond_value_2 );
if ( tmp_cond_truth_2 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_cond_value_2 );
exception_lineno = 305;
type_description_1 = "ooooooooooooo";
goto try_except_handler_24;
}
Py_DECREF( tmp_cond_value_2 );
if ( tmp_cond_truth_2 == 1 )
{
goto branch_no_2;
}
else
{
goto branch_yes_2;
}
branch_yes_2:;
tmp_iter_arg_16 = var_instances;
if ( tmp_iter_arg_16 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "instances" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 306;
type_description_1 = "ooooooooooooo";
goto try_except_handler_24;
}
tmp_assign_source_68 = MAKE_ITERATOR( tmp_iter_arg_16 );
if ( tmp_assign_source_68 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 306;
type_description_1 = "ooooooooooooo";
goto try_except_handler_24;
}
{
PyObject *old = tmp_for_loop_8__for_iterator;
tmp_for_loop_8__for_iterator = tmp_assign_source_68;
Py_XDECREF( old );
}
// Tried code:
loop_start_10:;
tmp_next_source_10 = tmp_for_loop_8__for_iterator;
CHECK_OBJECT( tmp_next_source_10 );
tmp_assign_source_69 = ITERATOR_NEXT( tmp_next_source_10 );
if ( tmp_assign_source_69 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_10;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooo";
exception_lineno = 306;
goto try_except_handler_30;
}
}
{
PyObject *old = tmp_for_loop_8__iter_value;
tmp_for_loop_8__iter_value = tmp_assign_source_69;
Py_XDECREF( old );
}
tmp_assign_source_70 = tmp_for_loop_8__iter_value;
CHECK_OBJECT( tmp_assign_source_70 );
{
PyObject *old = var_obj;
var_obj = tmp_assign_source_70;
Py_INCREF( var_obj );
Py_XDECREF( old );
}
tmp_source_name_39 = GET_STRING_DICT_VALUE( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_signals );
if (unlikely( tmp_source_name_39 == NULL ))
{
tmp_source_name_39 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_signals );
}
if ( tmp_source_name_39 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "signals" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 307;
type_description_1 = "ooooooooooooo";
goto try_except_handler_30;
}
tmp_source_name_38 = LOOKUP_ATTRIBUTE( tmp_source_name_39, const_str_plain_post_delete );
if ( tmp_source_name_38 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 307;
type_description_1 = "ooooooooooooo";
goto try_except_handler_30;
}
tmp_called_name_16 = LOOKUP_ATTRIBUTE( tmp_source_name_38, const_str_plain_send );
Py_DECREF( tmp_source_name_38 );
if ( tmp_called_name_16 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 307;
type_description_1 = "ooooooooooooo";
goto try_except_handler_30;
}
tmp_kw_name_5 = _PyDict_NewPresized( 3 );
tmp_dict_key_9 = const_str_plain_sender;
tmp_dict_value_9 = var_model;
if ( tmp_dict_value_9 == NULL )
{
Py_DECREF( tmp_called_name_16 );
Py_DECREF( tmp_kw_name_5 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "model" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 308;
type_description_1 = "ooooooooooooo";
goto try_except_handler_30;
}
tmp_res = PyDict_SetItem( tmp_kw_name_5, tmp_dict_key_9, tmp_dict_value_9 );
assert( !(tmp_res != 0) );
tmp_dict_key_10 = const_str_plain_instance;
tmp_dict_value_10 = var_obj;
if ( tmp_dict_value_10 == NULL )
{
Py_DECREF( tmp_called_name_16 );
Py_DECREF( tmp_kw_name_5 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "obj" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 308;
type_description_1 = "ooooooooooooo";
goto try_except_handler_30;
}
tmp_res = PyDict_SetItem( tmp_kw_name_5, tmp_dict_key_10, tmp_dict_value_10 );
assert( !(tmp_res != 0) );
tmp_dict_key_11 = const_str_plain_using;
tmp_source_name_40 = par_self;
if ( tmp_source_name_40 == NULL )
{
Py_DECREF( tmp_called_name_16 );
Py_DECREF( tmp_kw_name_5 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 308;
type_description_1 = "ooooooooooooo";
goto try_except_handler_30;
}
tmp_dict_value_11 = LOOKUP_ATTRIBUTE( tmp_source_name_40, const_str_plain_using );
if ( tmp_dict_value_11 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_16 );
Py_DECREF( tmp_kw_name_5 );
exception_lineno = 308;
type_description_1 = "ooooooooooooo";
goto try_except_handler_30;
}
tmp_res = PyDict_SetItem( tmp_kw_name_5, tmp_dict_key_11, tmp_dict_value_11 );
Py_DECREF( tmp_dict_value_11 );
assert( !(tmp_res != 0) );
frame_54ec43c561ef94893d9bbef71a219f87->m_frame.f_lineno = 307;
tmp_unused = CALL_FUNCTION_WITH_KEYARGS( tmp_called_name_16, tmp_kw_name_5 );
Py_DECREF( tmp_called_name_16 );
Py_DECREF( tmp_kw_name_5 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 307;
type_description_1 = "ooooooooooooo";
goto try_except_handler_30;
}
Py_DECREF( tmp_unused );
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 306;
type_description_1 = "ooooooooooooo";
goto try_except_handler_30;
}
goto loop_start_10;
loop_end_10:;
goto try_end_21;
// Exception handler code:
try_except_handler_30:;
exception_keeper_type_25 = exception_type;
exception_keeper_value_25 = exception_value;
exception_keeper_tb_25 = exception_tb;
exception_keeper_lineno_25 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_for_loop_8__iter_value );
tmp_for_loop_8__iter_value = NULL;
Py_XDECREF( tmp_for_loop_8__for_iterator );
tmp_for_loop_8__for_iterator = NULL;
// Re-raise.
exception_type = exception_keeper_type_25;
exception_value = exception_keeper_value_25;
exception_tb = exception_keeper_tb_25;
exception_lineno = exception_keeper_lineno_25;
goto try_except_handler_24;
// End of try:
try_end_21:;
Py_XDECREF( tmp_for_loop_8__iter_value );
tmp_for_loop_8__iter_value = NULL;
Py_XDECREF( tmp_for_loop_8__for_iterator );
tmp_for_loop_8__for_iterator = NULL;
branch_no_2:;
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 299;
type_description_1 = "ooooooooooooo";
goto try_except_handler_24;
}
goto loop_start_8;
loop_end_8:;
goto try_end_22;
// Exception handler code:
try_except_handler_24:;
exception_keeper_type_26 = exception_type;
exception_keeper_value_26 = exception_value;
exception_keeper_tb_26 = exception_tb;
exception_keeper_lineno_26 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_for_loop_7__iter_value );
tmp_for_loop_7__iter_value = NULL;
Py_XDECREF( tmp_for_loop_7__for_iterator );
tmp_for_loop_7__for_iterator = NULL;
// Re-raise.
exception_type = exception_keeper_type_26;
exception_value = exception_keeper_value_26;
exception_tb = exception_keeper_tb_26;
exception_lineno = exception_keeper_lineno_26;
goto try_except_handler_7;
// End of try:
try_end_22:;
Py_XDECREF( tmp_for_loop_7__iter_value );
tmp_for_loop_7__iter_value = NULL;
Py_XDECREF( tmp_for_loop_7__for_iterator );
tmp_for_loop_7__for_iterator = NULL;
goto try_end_23;
// Exception handler code:
try_except_handler_7:;
exception_keeper_type_27 = exception_type;
exception_keeper_value_27 = exception_value;
exception_keeper_tb_27 = exception_tb;
exception_keeper_lineno_27 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
// Preserve existing published exception.
exception_preserved_type_1 = PyThreadState_GET()->exc_type;
Py_XINCREF( exception_preserved_type_1 );
exception_preserved_value_1 = PyThreadState_GET()->exc_value;
Py_XINCREF( exception_preserved_value_1 );
exception_preserved_tb_1 = (PyTracebackObject *)PyThreadState_GET()->exc_traceback;
Py_XINCREF( exception_preserved_tb_1 );
if ( exception_keeper_tb_27 == NULL )
{
exception_keeper_tb_27 = MAKE_TRACEBACK( frame_54ec43c561ef94893d9bbef71a219f87, exception_keeper_lineno_27 );
}
else if ( exception_keeper_lineno_27 != 0 )
{
exception_keeper_tb_27 = ADD_TRACEBACK( exception_keeper_tb_27, frame_54ec43c561ef94893d9bbef71a219f87, exception_keeper_lineno_27 );
}
NORMALIZE_EXCEPTION( &exception_keeper_type_27, &exception_keeper_value_27, &exception_keeper_tb_27 );
PyException_SetTraceback( exception_keeper_value_27, (PyObject *)exception_keeper_tb_27 );
PUBLISH_EXCEPTION( &exception_keeper_type_27, &exception_keeper_value_27, &exception_keeper_tb_27 );
// Tried code:
tmp_compare_left_1 = PyThreadState_GET()->exc_type;
tmp_compare_right_1 = PyExc_BaseException;
tmp_exc_match_exception_match_1 = EXCEPTION_MATCH_BOOL( tmp_compare_left_1, tmp_compare_right_1 );
if ( tmp_exc_match_exception_match_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 274;
type_description_1 = "ooooooooooooo";
goto try_except_handler_31;
}
if ( tmp_exc_match_exception_match_1 == 1 )
{
goto branch_yes_3;
}
else
{
goto branch_no_3;
}
branch_yes_3:;
tmp_assign_source_71 = Py_False;
{
PyObject *old = tmp_with_1__indicator;
tmp_with_1__indicator = tmp_assign_source_71;
Py_INCREF( tmp_with_1__indicator );
Py_XDECREF( old );
}
tmp_called_name_17 = tmp_with_1__exit;
CHECK_OBJECT( tmp_called_name_17 );
tmp_args_element_name_12 = PyThreadState_GET()->exc_type;
tmp_args_element_name_13 = PyThreadState_GET()->exc_value;
tmp_args_element_name_14 = PyThreadState_GET()->exc_traceback;
frame_54ec43c561ef94893d9bbef71a219f87->m_frame.f_lineno = 274;
{
PyObject *call_args[] = { tmp_args_element_name_12, tmp_args_element_name_13, tmp_args_element_name_14 };
tmp_cond_value_3 = CALL_FUNCTION_WITH_ARGS3( tmp_called_name_17, call_args );
}
if ( tmp_cond_value_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 274;
type_description_1 = "ooooooooooooo";
goto try_except_handler_31;
}
tmp_cond_truth_3 = CHECK_IF_TRUE( tmp_cond_value_3 );
if ( tmp_cond_truth_3 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_cond_value_3 );
exception_lineno = 274;
type_description_1 = "ooooooooooooo";
goto try_except_handler_31;
}
Py_DECREF( tmp_cond_value_3 );
if ( tmp_cond_truth_3 == 1 )
{
goto branch_no_4;
}
else
{
goto branch_yes_4;
}
branch_yes_4:;
tmp_result = RERAISE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
if (unlikely( tmp_result == false ))
{
exception_lineno = 274;
}
if (exception_tb && exception_tb->tb_frame == &frame_54ec43c561ef94893d9bbef71a219f87->m_frame) frame_54ec43c561ef94893d9bbef71a219f87->m_frame.f_lineno = exception_tb->tb_lineno;
type_description_1 = "ooooooooooooo";
goto try_except_handler_31;
branch_no_4:;
goto branch_end_3;
branch_no_3:;
tmp_result = RERAISE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
if (unlikely( tmp_result == false ))
{
exception_lineno = 274;
}
if (exception_tb && exception_tb->tb_frame == &frame_54ec43c561ef94893d9bbef71a219f87->m_frame) frame_54ec43c561ef94893d9bbef71a219f87->m_frame.f_lineno = exception_tb->tb_lineno;
type_description_1 = "ooooooooooooo";
goto try_except_handler_31;
branch_end_3:;
goto try_end_24;
// Exception handler code:
try_except_handler_31:;
exception_keeper_type_28 = exception_type;
exception_keeper_value_28 = exception_value;
exception_keeper_tb_28 = exception_tb;
exception_keeper_lineno_28 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
// Restore previous exception.
SET_CURRENT_EXCEPTION( exception_preserved_type_1, exception_preserved_value_1, exception_preserved_tb_1 );
// Re-raise.
exception_type = exception_keeper_type_28;
exception_value = exception_keeper_value_28;
exception_tb = exception_keeper_tb_28;
exception_lineno = exception_keeper_lineno_28;
goto try_except_handler_6;
// End of try:
try_end_24:;
// Restore previous exception.
SET_CURRENT_EXCEPTION( exception_preserved_type_1, exception_preserved_value_1, exception_preserved_tb_1 );
goto try_end_23;
// exception handler codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_18_delete );
return NULL;
// End of try:
try_end_23:;
goto try_end_25;
// Exception handler code:
try_except_handler_6:;
exception_keeper_type_29 = exception_type;
exception_keeper_value_29 = exception_value;
exception_keeper_tb_29 = exception_tb;
exception_keeper_lineno_29 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
tmp_compare_left_2 = tmp_with_1__indicator;
CHECK_OBJECT( tmp_compare_left_2 );
tmp_compare_right_2 = Py_True;
tmp_is_1 = ( tmp_compare_left_2 == tmp_compare_right_2 );
if ( tmp_is_1 )
{
goto branch_yes_5;
}
else
{
goto branch_no_5;
}
branch_yes_5:;
tmp_called_name_18 = tmp_with_1__exit;
CHECK_OBJECT( tmp_called_name_18 );
frame_54ec43c561ef94893d9bbef71a219f87->m_frame.f_lineno = 274;
tmp_unused = CALL_FUNCTION_WITH_ARGS3( tmp_called_name_18, &PyTuple_GET_ITEM( const_tuple_none_none_none_tuple, 0 ) );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( exception_keeper_type_29 );
Py_XDECREF( exception_keeper_value_29 );
Py_XDECREF( exception_keeper_tb_29 );
exception_lineno = 274;
type_description_1 = "ooooooooooooo";
goto try_except_handler_5;
}
Py_DECREF( tmp_unused );
branch_no_5:;
// Re-raise.
exception_type = exception_keeper_type_29;
exception_value = exception_keeper_value_29;
exception_tb = exception_keeper_tb_29;
exception_lineno = exception_keeper_lineno_29;
goto try_except_handler_5;
// End of try:
try_end_25:;
tmp_compare_left_3 = tmp_with_1__indicator;
CHECK_OBJECT( tmp_compare_left_3 );
tmp_compare_right_3 = Py_True;
tmp_is_2 = ( tmp_compare_left_3 == tmp_compare_right_3 );
if ( tmp_is_2 )
{
goto branch_yes_6;
}
else
{
goto branch_no_6;
}
branch_yes_6:;
tmp_called_name_19 = tmp_with_1__exit;
CHECK_OBJECT( tmp_called_name_19 );
frame_54ec43c561ef94893d9bbef71a219f87->m_frame.f_lineno = 274;
tmp_unused = CALL_FUNCTION_WITH_ARGS3( tmp_called_name_19, &PyTuple_GET_ITEM( const_tuple_none_none_none_tuple, 0 ) );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 274;
type_description_1 = "ooooooooooooo";
goto try_except_handler_5;
}
Py_DECREF( tmp_unused );
branch_no_6:;
goto try_end_26;
// Exception handler code:
try_except_handler_5:;
exception_keeper_type_30 = exception_type;
exception_keeper_value_30 = exception_value;
exception_keeper_tb_30 = exception_tb;
exception_keeper_lineno_30 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_with_1__source );
tmp_with_1__source = NULL;
Py_XDECREF( tmp_with_1__enter );
tmp_with_1__enter = NULL;
Py_XDECREF( tmp_with_1__exit );
tmp_with_1__exit = NULL;
Py_XDECREF( tmp_with_1__indicator );
tmp_with_1__indicator = NULL;
// Re-raise.
exception_type = exception_keeper_type_30;
exception_value = exception_keeper_value_30;
exception_tb = exception_keeper_tb_30;
exception_lineno = exception_keeper_lineno_30;
goto frame_exception_exit_1;
// End of try:
try_end_26:;
Py_XDECREF( tmp_with_1__source );
tmp_with_1__source = NULL;
Py_XDECREF( tmp_with_1__enter );
tmp_with_1__enter = NULL;
Py_XDECREF( tmp_with_1__exit );
tmp_with_1__exit = NULL;
Py_XDECREF( tmp_with_1__indicator );
tmp_with_1__indicator = NULL;
tmp_source_name_41 = GET_STRING_DICT_VALUE( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_six );
if (unlikely( tmp_source_name_41 == NULL ))
{
tmp_source_name_41 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_six );
}
if ( tmp_source_name_41 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "six" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 312;
type_description_1 = "ooooooooooooo";
goto frame_exception_exit_1;
}
tmp_called_name_20 = LOOKUP_ATTRIBUTE( tmp_source_name_41, const_str_plain_iteritems );
if ( tmp_called_name_20 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 312;
type_description_1 = "ooooooooooooo";
goto frame_exception_exit_1;
}
tmp_source_name_42 = par_self;
if ( tmp_source_name_42 == NULL )
{
Py_DECREF( tmp_called_name_20 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 312;
type_description_1 = "ooooooooooooo";
goto frame_exception_exit_1;
}
tmp_args_element_name_15 = LOOKUP_ATTRIBUTE( tmp_source_name_42, const_str_plain_field_updates );
if ( tmp_args_element_name_15 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_20 );
exception_lineno = 312;
type_description_1 = "ooooooooooooo";
goto frame_exception_exit_1;
}
frame_54ec43c561ef94893d9bbef71a219f87->m_frame.f_lineno = 312;
{
PyObject *call_args[] = { tmp_args_element_name_15 };
tmp_iter_arg_17 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_20, call_args );
}
Py_DECREF( tmp_called_name_20 );
Py_DECREF( tmp_args_element_name_15 );
if ( tmp_iter_arg_17 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 312;
type_description_1 = "ooooooooooooo";
goto frame_exception_exit_1;
}
tmp_assign_source_72 = MAKE_ITERATOR( tmp_iter_arg_17 );
Py_DECREF( tmp_iter_arg_17 );
if ( tmp_assign_source_72 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 312;
type_description_1 = "ooooooooooooo";
goto frame_exception_exit_1;
}
assert( tmp_for_loop_9__for_iterator == NULL );
tmp_for_loop_9__for_iterator = tmp_assign_source_72;
// Tried code:
loop_start_11:;
tmp_next_source_11 = tmp_for_loop_9__for_iterator;
CHECK_OBJECT( tmp_next_source_11 );
tmp_assign_source_73 = ITERATOR_NEXT( tmp_next_source_11 );
if ( tmp_assign_source_73 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_11;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooo";
exception_lineno = 312;
goto try_except_handler_32;
}
}
{
PyObject *old = tmp_for_loop_9__iter_value;
tmp_for_loop_9__iter_value = tmp_assign_source_73;
Py_XDECREF( old );
}
// Tried code:
tmp_iter_arg_18 = tmp_for_loop_9__iter_value;
CHECK_OBJECT( tmp_iter_arg_18 );
tmp_assign_source_74 = MAKE_ITERATOR( tmp_iter_arg_18 );
if ( tmp_assign_source_74 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 312;
type_description_1 = "ooooooooooooo";
goto try_except_handler_33;
}
{
PyObject *old = tmp_tuple_unpack_7__source_iter;
tmp_tuple_unpack_7__source_iter = tmp_assign_source_74;
Py_XDECREF( old );
}
// Tried code:
tmp_unpack_13 = tmp_tuple_unpack_7__source_iter;
CHECK_OBJECT( tmp_unpack_13 );
tmp_assign_source_75 = UNPACK_NEXT( tmp_unpack_13, 0, 2 );
if ( tmp_assign_source_75 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "ooooooooooooo";
exception_lineno = 312;
goto try_except_handler_34;
}
{
PyObject *old = tmp_tuple_unpack_7__element_1;
tmp_tuple_unpack_7__element_1 = tmp_assign_source_75;
Py_XDECREF( old );
}
tmp_unpack_14 = tmp_tuple_unpack_7__source_iter;
CHECK_OBJECT( tmp_unpack_14 );
tmp_assign_source_76 = UNPACK_NEXT( tmp_unpack_14, 1, 2 );
if ( tmp_assign_source_76 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "ooooooooooooo";
exception_lineno = 312;
goto try_except_handler_34;
}
{
PyObject *old = tmp_tuple_unpack_7__element_2;
tmp_tuple_unpack_7__element_2 = tmp_assign_source_76;
Py_XDECREF( old );
}
tmp_iterator_name_7 = tmp_tuple_unpack_7__source_iter;
CHECK_OBJECT( tmp_iterator_name_7 );
// Check if iterator has left-over elements.
CHECK_OBJECT( tmp_iterator_name_7 ); assert( HAS_ITERNEXT( tmp_iterator_name_7 ) );
tmp_iterator_attempt = (*Py_TYPE( tmp_iterator_name_7 )->tp_iternext)( tmp_iterator_name_7 );
if (likely( tmp_iterator_attempt == NULL ))
{
PyObject *error = GET_ERROR_OCCURRED();
if ( error != NULL )
{
if ( EXCEPTION_MATCH_BOOL_SINGLE( error, PyExc_StopIteration ))
{
CLEAR_ERROR_OCCURRED();
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooo";
exception_lineno = 312;
goto try_except_handler_34;
}
}
}
else
{
Py_DECREF( tmp_iterator_attempt );
// TODO: Could avoid PyErr_Format.
#if PYTHON_VERSION < 300
PyErr_Format( PyExc_ValueError, "too many values to unpack" );
#else
PyErr_Format( PyExc_ValueError, "too many values to unpack (expected 2)" );
#endif
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooo";
exception_lineno = 312;
goto try_except_handler_34;
}
goto try_end_27;
// Exception handler code:
try_except_handler_34:;
exception_keeper_type_31 = exception_type;
exception_keeper_value_31 = exception_value;
exception_keeper_tb_31 = exception_tb;
exception_keeper_lineno_31 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_7__source_iter );
tmp_tuple_unpack_7__source_iter = NULL;
// Re-raise.
exception_type = exception_keeper_type_31;
exception_value = exception_keeper_value_31;
exception_tb = exception_keeper_tb_31;
exception_lineno = exception_keeper_lineno_31;
goto try_except_handler_33;
// End of try:
try_end_27:;
goto try_end_28;
// Exception handler code:
try_except_handler_33:;
exception_keeper_type_32 = exception_type;
exception_keeper_value_32 = exception_value;
exception_keeper_tb_32 = exception_tb;
exception_keeper_lineno_32 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_7__element_1 );
tmp_tuple_unpack_7__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_7__element_2 );
tmp_tuple_unpack_7__element_2 = NULL;
// Re-raise.
exception_type = exception_keeper_type_32;
exception_value = exception_keeper_value_32;
exception_tb = exception_keeper_tb_32;
exception_lineno = exception_keeper_lineno_32;
goto try_except_handler_32;
// End of try:
try_end_28:;
Py_XDECREF( tmp_tuple_unpack_7__source_iter );
tmp_tuple_unpack_7__source_iter = NULL;
tmp_assign_source_77 = tmp_tuple_unpack_7__element_1;
CHECK_OBJECT( tmp_assign_source_77 );
{
PyObject *old = var_model;
var_model = tmp_assign_source_77;
Py_INCREF( var_model );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_7__element_1 );
tmp_tuple_unpack_7__element_1 = NULL;
tmp_assign_source_78 = tmp_tuple_unpack_7__element_2;
CHECK_OBJECT( tmp_assign_source_78 );
{
PyObject *old = var_instances_for_fieldvalues;
var_instances_for_fieldvalues = tmp_assign_source_78;
Py_INCREF( var_instances_for_fieldvalues );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_7__element_2 );
tmp_tuple_unpack_7__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_7__element_1 );
tmp_tuple_unpack_7__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_7__element_2 );
tmp_tuple_unpack_7__element_2 = NULL;
tmp_source_name_43 = GET_STRING_DICT_VALUE( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_six );
if (unlikely( tmp_source_name_43 == NULL ))
{
tmp_source_name_43 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_six );
}
if ( tmp_source_name_43 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "six" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 313;
type_description_1 = "ooooooooooooo";
goto try_except_handler_32;
}
tmp_called_name_21 = LOOKUP_ATTRIBUTE( tmp_source_name_43, const_str_plain_iteritems );
if ( tmp_called_name_21 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 313;
type_description_1 = "ooooooooooooo";
goto try_except_handler_32;
}
tmp_args_element_name_16 = var_instances_for_fieldvalues;
if ( tmp_args_element_name_16 == NULL )
{
Py_DECREF( tmp_called_name_21 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "instances_for_fieldvalues" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 313;
type_description_1 = "ooooooooooooo";
goto try_except_handler_32;
}
frame_54ec43c561ef94893d9bbef71a219f87->m_frame.f_lineno = 313;
{
PyObject *call_args[] = { tmp_args_element_name_16 };
tmp_iter_arg_19 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_21, call_args );
}
Py_DECREF( tmp_called_name_21 );
if ( tmp_iter_arg_19 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 313;
type_description_1 = "ooooooooooooo";
goto try_except_handler_32;
}
tmp_assign_source_79 = MAKE_ITERATOR( tmp_iter_arg_19 );
Py_DECREF( tmp_iter_arg_19 );
if ( tmp_assign_source_79 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 313;
type_description_1 = "ooooooooooooo";
goto try_except_handler_32;
}
{
PyObject *old = tmp_for_loop_10__for_iterator;
tmp_for_loop_10__for_iterator = tmp_assign_source_79;
Py_XDECREF( old );
}
// Tried code:
loop_start_12:;
tmp_next_source_12 = tmp_for_loop_10__for_iterator;
CHECK_OBJECT( tmp_next_source_12 );
tmp_assign_source_80 = ITERATOR_NEXT( tmp_next_source_12 );
if ( tmp_assign_source_80 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_12;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooo";
exception_lineno = 313;
goto try_except_handler_35;
}
}
{
PyObject *old = tmp_for_loop_10__iter_value;
tmp_for_loop_10__iter_value = tmp_assign_source_80;
Py_XDECREF( old );
}
// Tried code:
tmp_iter_arg_20 = tmp_for_loop_10__iter_value;
CHECK_OBJECT( tmp_iter_arg_20 );
tmp_assign_source_81 = MAKE_ITERATOR( tmp_iter_arg_20 );
if ( tmp_assign_source_81 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 313;
type_description_1 = "ooooooooooooo";
goto try_except_handler_36;
}
{
PyObject *old = tmp_tuple_unpack_8__source_iter;
tmp_tuple_unpack_8__source_iter = tmp_assign_source_81;
Py_XDECREF( old );
}
// Tried code:
tmp_unpack_15 = tmp_tuple_unpack_8__source_iter;
CHECK_OBJECT( tmp_unpack_15 );
tmp_assign_source_82 = UNPACK_NEXT( tmp_unpack_15, 0, 2 );
if ( tmp_assign_source_82 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "ooooooooooooo";
exception_lineno = 313;
goto try_except_handler_37;
}
{
PyObject *old = tmp_tuple_unpack_8__element_1;
tmp_tuple_unpack_8__element_1 = tmp_assign_source_82;
Py_XDECREF( old );
}
tmp_unpack_16 = tmp_tuple_unpack_8__source_iter;
CHECK_OBJECT( tmp_unpack_16 );
tmp_assign_source_83 = UNPACK_NEXT( tmp_unpack_16, 1, 2 );
if ( tmp_assign_source_83 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "ooooooooooooo";
exception_lineno = 313;
goto try_except_handler_37;
}
{
PyObject *old = tmp_tuple_unpack_8__element_2;
tmp_tuple_unpack_8__element_2 = tmp_assign_source_83;
Py_XDECREF( old );
}
tmp_iterator_name_8 = tmp_tuple_unpack_8__source_iter;
CHECK_OBJECT( tmp_iterator_name_8 );
// Check if iterator has left-over elements.
CHECK_OBJECT( tmp_iterator_name_8 ); assert( HAS_ITERNEXT( tmp_iterator_name_8 ) );
tmp_iterator_attempt = (*Py_TYPE( tmp_iterator_name_8 )->tp_iternext)( tmp_iterator_name_8 );
if (likely( tmp_iterator_attempt == NULL ))
{
PyObject *error = GET_ERROR_OCCURRED();
if ( error != NULL )
{
if ( EXCEPTION_MATCH_BOOL_SINGLE( error, PyExc_StopIteration ))
{
CLEAR_ERROR_OCCURRED();
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooo";
exception_lineno = 313;
goto try_except_handler_37;
}
}
}
else
{
Py_DECREF( tmp_iterator_attempt );
// TODO: Could avoid PyErr_Format.
#if PYTHON_VERSION < 300
PyErr_Format( PyExc_ValueError, "too many values to unpack" );
#else
PyErr_Format( PyExc_ValueError, "too many values to unpack (expected 2)" );
#endif
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooo";
exception_lineno = 313;
goto try_except_handler_37;
}
goto try_end_29;
// Exception handler code:
try_except_handler_37:;
exception_keeper_type_33 = exception_type;
exception_keeper_value_33 = exception_value;
exception_keeper_tb_33 = exception_tb;
exception_keeper_lineno_33 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_8__source_iter );
tmp_tuple_unpack_8__source_iter = NULL;
// Re-raise.
exception_type = exception_keeper_type_33;
exception_value = exception_keeper_value_33;
exception_tb = exception_keeper_tb_33;
exception_lineno = exception_keeper_lineno_33;
goto try_except_handler_36;
// End of try:
try_end_29:;
Py_XDECREF( tmp_tuple_unpack_8__source_iter );
tmp_tuple_unpack_8__source_iter = NULL;
// Tried code:
tmp_iter_arg_21 = tmp_tuple_unpack_8__element_1;
CHECK_OBJECT( tmp_iter_arg_21 );
tmp_assign_source_84 = MAKE_ITERATOR( tmp_iter_arg_21 );
if ( tmp_assign_source_84 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 313;
type_description_1 = "ooooooooooooo";
goto try_except_handler_38;
}
{
PyObject *old = tmp_tuple_unpack_9__source_iter;
tmp_tuple_unpack_9__source_iter = tmp_assign_source_84;
Py_XDECREF( old );
}
// Tried code:
tmp_unpack_17 = tmp_tuple_unpack_9__source_iter;
CHECK_OBJECT( tmp_unpack_17 );
tmp_assign_source_85 = UNPACK_NEXT( tmp_unpack_17, 0, 2 );
if ( tmp_assign_source_85 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "ooooooooooooo";
exception_lineno = 313;
goto try_except_handler_39;
}
{
PyObject *old = tmp_tuple_unpack_9__element_1;
tmp_tuple_unpack_9__element_1 = tmp_assign_source_85;
Py_XDECREF( old );
}
tmp_unpack_18 = tmp_tuple_unpack_9__source_iter;
CHECK_OBJECT( tmp_unpack_18 );
tmp_assign_source_86 = UNPACK_NEXT( tmp_unpack_18, 1, 2 );
if ( tmp_assign_source_86 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "ooooooooooooo";
exception_lineno = 313;
goto try_except_handler_39;
}
{
PyObject *old = tmp_tuple_unpack_9__element_2;
tmp_tuple_unpack_9__element_2 = tmp_assign_source_86;
Py_XDECREF( old );
}
tmp_iterator_name_9 = tmp_tuple_unpack_9__source_iter;
CHECK_OBJECT( tmp_iterator_name_9 );
// Check if iterator has left-over elements.
CHECK_OBJECT( tmp_iterator_name_9 ); assert( HAS_ITERNEXT( tmp_iterator_name_9 ) );
tmp_iterator_attempt = (*Py_TYPE( tmp_iterator_name_9 )->tp_iternext)( tmp_iterator_name_9 );
if (likely( tmp_iterator_attempt == NULL ))
{
PyObject *error = GET_ERROR_OCCURRED();
if ( error != NULL )
{
if ( EXCEPTION_MATCH_BOOL_SINGLE( error, PyExc_StopIteration ))
{
CLEAR_ERROR_OCCURRED();
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooo";
exception_lineno = 313;
goto try_except_handler_39;
}
}
}
else
{
Py_DECREF( tmp_iterator_attempt );
// TODO: Could avoid PyErr_Format.
#if PYTHON_VERSION < 300
PyErr_Format( PyExc_ValueError, "too many values to unpack" );
#else
PyErr_Format( PyExc_ValueError, "too many values to unpack (expected 2)" );
#endif
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooo";
exception_lineno = 313;
goto try_except_handler_39;
}
goto try_end_30;
// Exception handler code:
try_except_handler_39:;
exception_keeper_type_34 = exception_type;
exception_keeper_value_34 = exception_value;
exception_keeper_tb_34 = exception_tb;
exception_keeper_lineno_34 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_9__source_iter );
tmp_tuple_unpack_9__source_iter = NULL;
// Re-raise.
exception_type = exception_keeper_type_34;
exception_value = exception_keeper_value_34;
exception_tb = exception_keeper_tb_34;
exception_lineno = exception_keeper_lineno_34;
goto try_except_handler_38;
// End of try:
try_end_30:;
goto try_end_31;
// Exception handler code:
try_except_handler_38:;
exception_keeper_type_35 = exception_type;
exception_keeper_value_35 = exception_value;
exception_keeper_tb_35 = exception_tb;
exception_keeper_lineno_35 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_9__element_1 );
tmp_tuple_unpack_9__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_9__element_2 );
tmp_tuple_unpack_9__element_2 = NULL;
// Re-raise.
exception_type = exception_keeper_type_35;
exception_value = exception_keeper_value_35;
exception_tb = exception_keeper_tb_35;
exception_lineno = exception_keeper_lineno_35;
goto try_except_handler_36;
// End of try:
try_end_31:;
goto try_end_32;
// Exception handler code:
try_except_handler_36:;
exception_keeper_type_36 = exception_type;
exception_keeper_value_36 = exception_value;
exception_keeper_tb_36 = exception_tb;
exception_keeper_lineno_36 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_8__element_1 );
tmp_tuple_unpack_8__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_8__element_2 );
tmp_tuple_unpack_8__element_2 = NULL;
// Re-raise.
exception_type = exception_keeper_type_36;
exception_value = exception_keeper_value_36;
exception_tb = exception_keeper_tb_36;
exception_lineno = exception_keeper_lineno_36;
goto try_except_handler_35;
// End of try:
try_end_32:;
Py_XDECREF( tmp_tuple_unpack_9__source_iter );
tmp_tuple_unpack_9__source_iter = NULL;
tmp_assign_source_87 = tmp_tuple_unpack_9__element_1;
CHECK_OBJECT( tmp_assign_source_87 );
{
PyObject *old = var_field;
var_field = tmp_assign_source_87;
Py_INCREF( var_field );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_9__element_1 );
tmp_tuple_unpack_9__element_1 = NULL;
tmp_assign_source_88 = tmp_tuple_unpack_9__element_2;
CHECK_OBJECT( tmp_assign_source_88 );
{
PyObject *old = var_value;
var_value = tmp_assign_source_88;
Py_INCREF( var_value );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_9__element_2 );
tmp_tuple_unpack_9__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_9__element_1 );
tmp_tuple_unpack_9__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_9__element_2 );
tmp_tuple_unpack_9__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_8__element_1 );
tmp_tuple_unpack_8__element_1 = NULL;
tmp_assign_source_89 = tmp_tuple_unpack_8__element_2;
CHECK_OBJECT( tmp_assign_source_89 );
{
PyObject *old = var_instances;
var_instances = tmp_assign_source_89;
Py_INCREF( var_instances );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_8__element_2 );
tmp_tuple_unpack_8__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_8__element_1 );
tmp_tuple_unpack_8__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_8__element_2 );
tmp_tuple_unpack_8__element_2 = NULL;
tmp_iter_arg_22 = var_instances;
if ( tmp_iter_arg_22 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "instances" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 314;
type_description_1 = "ooooooooooooo";
goto try_except_handler_35;
}
tmp_assign_source_90 = MAKE_ITERATOR( tmp_iter_arg_22 );
if ( tmp_assign_source_90 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 314;
type_description_1 = "ooooooooooooo";
goto try_except_handler_35;
}
{
PyObject *old = tmp_for_loop_11__for_iterator;
tmp_for_loop_11__for_iterator = tmp_assign_source_90;
Py_XDECREF( old );
}
// Tried code:
loop_start_13:;
tmp_next_source_13 = tmp_for_loop_11__for_iterator;
CHECK_OBJECT( tmp_next_source_13 );
tmp_assign_source_91 = ITERATOR_NEXT( tmp_next_source_13 );
if ( tmp_assign_source_91 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_13;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooo";
exception_lineno = 314;
goto try_except_handler_40;
}
}
{
PyObject *old = tmp_for_loop_11__iter_value;
tmp_for_loop_11__iter_value = tmp_assign_source_91;
Py_XDECREF( old );
}
tmp_assign_source_92 = tmp_for_loop_11__iter_value;
CHECK_OBJECT( tmp_assign_source_92 );
{
PyObject *old = var_obj;
var_obj = tmp_assign_source_92;
Py_INCREF( var_obj );
Py_XDECREF( old );
}
tmp_setattr_target_1 = var_obj;
CHECK_OBJECT( tmp_setattr_target_1 );
tmp_source_name_44 = var_field;
if ( tmp_source_name_44 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "field" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 315;
type_description_1 = "ooooooooooooo";
goto try_except_handler_40;
}
tmp_setattr_attr_1 = LOOKUP_ATTRIBUTE( tmp_source_name_44, const_str_plain_attname );
if ( tmp_setattr_attr_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 315;
type_description_1 = "ooooooooooooo";
goto try_except_handler_40;
}
tmp_setattr_value_1 = var_value;
if ( tmp_setattr_value_1 == NULL )
{
Py_DECREF( tmp_setattr_attr_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "value" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 315;
type_description_1 = "ooooooooooooo";
goto try_except_handler_40;
}
tmp_unused = BUILTIN_SETATTR( tmp_setattr_target_1, tmp_setattr_attr_1, tmp_setattr_value_1 );
Py_DECREF( tmp_setattr_attr_1 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 315;
type_description_1 = "ooooooooooooo";
goto try_except_handler_40;
}
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 314;
type_description_1 = "ooooooooooooo";
goto try_except_handler_40;
}
goto loop_start_13;
loop_end_13:;
goto try_end_33;
// Exception handler code:
try_except_handler_40:;
exception_keeper_type_37 = exception_type;
exception_keeper_value_37 = exception_value;
exception_keeper_tb_37 = exception_tb;
exception_keeper_lineno_37 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_for_loop_11__iter_value );
tmp_for_loop_11__iter_value = NULL;
Py_XDECREF( tmp_for_loop_11__for_iterator );
tmp_for_loop_11__for_iterator = NULL;
// Re-raise.
exception_type = exception_keeper_type_37;
exception_value = exception_keeper_value_37;
exception_tb = exception_keeper_tb_37;
exception_lineno = exception_keeper_lineno_37;
goto try_except_handler_35;
// End of try:
try_end_33:;
Py_XDECREF( tmp_for_loop_11__iter_value );
tmp_for_loop_11__iter_value = NULL;
Py_XDECREF( tmp_for_loop_11__for_iterator );
tmp_for_loop_11__for_iterator = NULL;
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 313;
type_description_1 = "ooooooooooooo";
goto try_except_handler_35;
}
goto loop_start_12;
loop_end_12:;
goto try_end_34;
// Exception handler code:
try_except_handler_35:;
exception_keeper_type_38 = exception_type;
exception_keeper_value_38 = exception_value;
exception_keeper_tb_38 = exception_tb;
exception_keeper_lineno_38 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_for_loop_10__iter_value );
tmp_for_loop_10__iter_value = NULL;
Py_XDECREF( tmp_for_loop_10__for_iterator );
tmp_for_loop_10__for_iterator = NULL;
// Re-raise.
exception_type = exception_keeper_type_38;
exception_value = exception_keeper_value_38;
exception_tb = exception_keeper_tb_38;
exception_lineno = exception_keeper_lineno_38;
goto try_except_handler_32;
// End of try:
try_end_34:;
Py_XDECREF( tmp_for_loop_10__iter_value );
tmp_for_loop_10__iter_value = NULL;
Py_XDECREF( tmp_for_loop_10__for_iterator );
tmp_for_loop_10__for_iterator = NULL;
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 312;
type_description_1 = "ooooooooooooo";
goto try_except_handler_32;
}
goto loop_start_11;
loop_end_11:;
goto try_end_35;
// Exception handler code:
try_except_handler_32:;
exception_keeper_type_39 = exception_type;
exception_keeper_value_39 = exception_value;
exception_keeper_tb_39 = exception_tb;
exception_keeper_lineno_39 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_for_loop_9__iter_value );
tmp_for_loop_9__iter_value = NULL;
Py_XDECREF( tmp_for_loop_9__for_iterator );
tmp_for_loop_9__for_iterator = NULL;
// Re-raise.
exception_type = exception_keeper_type_39;
exception_value = exception_keeper_value_39;
exception_tb = exception_keeper_tb_39;
exception_lineno = exception_keeper_lineno_39;
goto frame_exception_exit_1;
// End of try:
try_end_35:;
Py_XDECREF( tmp_for_loop_9__iter_value );
tmp_for_loop_9__iter_value = NULL;
Py_XDECREF( tmp_for_loop_9__for_iterator );
tmp_for_loop_9__for_iterator = NULL;
tmp_source_name_45 = GET_STRING_DICT_VALUE( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_six );
if (unlikely( tmp_source_name_45 == NULL ))
{
tmp_source_name_45 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_six );
}
if ( tmp_source_name_45 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "six" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 316;
type_description_1 = "ooooooooooooo";
goto frame_exception_exit_1;
}
tmp_called_name_22 = LOOKUP_ATTRIBUTE( tmp_source_name_45, const_str_plain_iteritems );
if ( tmp_called_name_22 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 316;
type_description_1 = "ooooooooooooo";
goto frame_exception_exit_1;
}
tmp_source_name_46 = par_self;
if ( tmp_source_name_46 == NULL )
{
Py_DECREF( tmp_called_name_22 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 316;
type_description_1 = "ooooooooooooo";
goto frame_exception_exit_1;
}
tmp_args_element_name_17 = LOOKUP_ATTRIBUTE( tmp_source_name_46, const_str_plain_data );
if ( tmp_args_element_name_17 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_22 );
exception_lineno = 316;
type_description_1 = "ooooooooooooo";
goto frame_exception_exit_1;
}
frame_54ec43c561ef94893d9bbef71a219f87->m_frame.f_lineno = 316;
{
PyObject *call_args[] = { tmp_args_element_name_17 };
tmp_iter_arg_23 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_22, call_args );
}
Py_DECREF( tmp_called_name_22 );
Py_DECREF( tmp_args_element_name_17 );
if ( tmp_iter_arg_23 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 316;
type_description_1 = "ooooooooooooo";
goto frame_exception_exit_1;
}
tmp_assign_source_93 = MAKE_ITERATOR( tmp_iter_arg_23 );
Py_DECREF( tmp_iter_arg_23 );
if ( tmp_assign_source_93 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 316;
type_description_1 = "ooooooooooooo";
goto frame_exception_exit_1;
}
assert( tmp_for_loop_12__for_iterator == NULL );
tmp_for_loop_12__for_iterator = tmp_assign_source_93;
// Tried code:
loop_start_14:;
tmp_next_source_14 = tmp_for_loop_12__for_iterator;
CHECK_OBJECT( tmp_next_source_14 );
tmp_assign_source_94 = ITERATOR_NEXT( tmp_next_source_14 );
if ( tmp_assign_source_94 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_14;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooo";
exception_lineno = 316;
goto try_except_handler_41;
}
}
{
PyObject *old = tmp_for_loop_12__iter_value;
tmp_for_loop_12__iter_value = tmp_assign_source_94;
Py_XDECREF( old );
}
// Tried code:
tmp_iter_arg_24 = tmp_for_loop_12__iter_value;
CHECK_OBJECT( tmp_iter_arg_24 );
tmp_assign_source_95 = MAKE_ITERATOR( tmp_iter_arg_24 );
if ( tmp_assign_source_95 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 316;
type_description_1 = "ooooooooooooo";
goto try_except_handler_42;
}
{
PyObject *old = tmp_tuple_unpack_10__source_iter;
tmp_tuple_unpack_10__source_iter = tmp_assign_source_95;
Py_XDECREF( old );
}
// Tried code:
tmp_unpack_19 = tmp_tuple_unpack_10__source_iter;
CHECK_OBJECT( tmp_unpack_19 );
tmp_assign_source_96 = UNPACK_NEXT( tmp_unpack_19, 0, 2 );
if ( tmp_assign_source_96 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "ooooooooooooo";
exception_lineno = 316;
goto try_except_handler_43;
}
{
PyObject *old = tmp_tuple_unpack_10__element_1;
tmp_tuple_unpack_10__element_1 = tmp_assign_source_96;
Py_XDECREF( old );
}
tmp_unpack_20 = tmp_tuple_unpack_10__source_iter;
CHECK_OBJECT( tmp_unpack_20 );
tmp_assign_source_97 = UNPACK_NEXT( tmp_unpack_20, 1, 2 );
if ( tmp_assign_source_97 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "ooooooooooooo";
exception_lineno = 316;
goto try_except_handler_43;
}
{
PyObject *old = tmp_tuple_unpack_10__element_2;
tmp_tuple_unpack_10__element_2 = tmp_assign_source_97;
Py_XDECREF( old );
}
tmp_iterator_name_10 = tmp_tuple_unpack_10__source_iter;
CHECK_OBJECT( tmp_iterator_name_10 );
// Check if iterator has left-over elements.
CHECK_OBJECT( tmp_iterator_name_10 ); assert( HAS_ITERNEXT( tmp_iterator_name_10 ) );
tmp_iterator_attempt = (*Py_TYPE( tmp_iterator_name_10 )->tp_iternext)( tmp_iterator_name_10 );
if (likely( tmp_iterator_attempt == NULL ))
{
PyObject *error = GET_ERROR_OCCURRED();
if ( error != NULL )
{
if ( EXCEPTION_MATCH_BOOL_SINGLE( error, PyExc_StopIteration ))
{
CLEAR_ERROR_OCCURRED();
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooo";
exception_lineno = 316;
goto try_except_handler_43;
}
}
}
else
{
Py_DECREF( tmp_iterator_attempt );
// TODO: Could avoid PyErr_Format.
#if PYTHON_VERSION < 300
PyErr_Format( PyExc_ValueError, "too many values to unpack" );
#else
PyErr_Format( PyExc_ValueError, "too many values to unpack (expected 2)" );
#endif
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooo";
exception_lineno = 316;
goto try_except_handler_43;
}
goto try_end_36;
// Exception handler code:
try_except_handler_43:;
exception_keeper_type_40 = exception_type;
exception_keeper_value_40 = exception_value;
exception_keeper_tb_40 = exception_tb;
exception_keeper_lineno_40 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_10__source_iter );
tmp_tuple_unpack_10__source_iter = NULL;
// Re-raise.
exception_type = exception_keeper_type_40;
exception_value = exception_keeper_value_40;
exception_tb = exception_keeper_tb_40;
exception_lineno = exception_keeper_lineno_40;
goto try_except_handler_42;
// End of try:
try_end_36:;
goto try_end_37;
// Exception handler code:
try_except_handler_42:;
exception_keeper_type_41 = exception_type;
exception_keeper_value_41 = exception_value;
exception_keeper_tb_41 = exception_tb;
exception_keeper_lineno_41 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_10__element_1 );
tmp_tuple_unpack_10__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_10__element_2 );
tmp_tuple_unpack_10__element_2 = NULL;
// Re-raise.
exception_type = exception_keeper_type_41;
exception_value = exception_keeper_value_41;
exception_tb = exception_keeper_tb_41;
exception_lineno = exception_keeper_lineno_41;
goto try_except_handler_41;
// End of try:
try_end_37:;
Py_XDECREF( tmp_tuple_unpack_10__source_iter );
tmp_tuple_unpack_10__source_iter = NULL;
tmp_assign_source_98 = tmp_tuple_unpack_10__element_1;
CHECK_OBJECT( tmp_assign_source_98 );
{
PyObject *old = var_model;
var_model = tmp_assign_source_98;
Py_INCREF( var_model );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_10__element_1 );
tmp_tuple_unpack_10__element_1 = NULL;
tmp_assign_source_99 = tmp_tuple_unpack_10__element_2;
CHECK_OBJECT( tmp_assign_source_99 );
{
PyObject *old = var_instances;
var_instances = tmp_assign_source_99;
Py_INCREF( var_instances );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_10__element_2 );
tmp_tuple_unpack_10__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_10__element_1 );
tmp_tuple_unpack_10__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_10__element_2 );
tmp_tuple_unpack_10__element_2 = NULL;
tmp_iter_arg_25 = var_instances;
if ( tmp_iter_arg_25 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "instances" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 317;
type_description_1 = "ooooooooooooo";
goto try_except_handler_41;
}
tmp_assign_source_100 = MAKE_ITERATOR( tmp_iter_arg_25 );
if ( tmp_assign_source_100 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 317;
type_description_1 = "ooooooooooooo";
goto try_except_handler_41;
}
{
PyObject *old = tmp_for_loop_13__for_iterator;
tmp_for_loop_13__for_iterator = tmp_assign_source_100;
Py_XDECREF( old );
}
// Tried code:
loop_start_15:;
tmp_next_source_15 = tmp_for_loop_13__for_iterator;
CHECK_OBJECT( tmp_next_source_15 );
tmp_assign_source_101 = ITERATOR_NEXT( tmp_next_source_15 );
if ( tmp_assign_source_101 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_15;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooo";
exception_lineno = 317;
goto try_except_handler_44;
}
}
{
PyObject *old = tmp_for_loop_13__iter_value;
tmp_for_loop_13__iter_value = tmp_assign_source_101;
Py_XDECREF( old );
}
tmp_assign_source_102 = tmp_for_loop_13__iter_value;
CHECK_OBJECT( tmp_assign_source_102 );
{
PyObject *old = var_instance;
var_instance = tmp_assign_source_102;
Py_INCREF( var_instance );
Py_XDECREF( old );
}
tmp_setattr_target_2 = var_instance;
CHECK_OBJECT( tmp_setattr_target_2 );
tmp_source_name_49 = var_model;
if ( tmp_source_name_49 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "model" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 318;
type_description_1 = "ooooooooooooo";
goto try_except_handler_44;
}
tmp_source_name_48 = LOOKUP_ATTRIBUTE( tmp_source_name_49, const_str_plain__meta );
if ( tmp_source_name_48 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 318;
type_description_1 = "ooooooooooooo";
goto try_except_handler_44;
}
tmp_source_name_47 = LOOKUP_ATTRIBUTE( tmp_source_name_48, const_str_plain_pk );
Py_DECREF( tmp_source_name_48 );
if ( tmp_source_name_47 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 318;
type_description_1 = "ooooooooooooo";
goto try_except_handler_44;
}
tmp_setattr_attr_2 = LOOKUP_ATTRIBUTE( tmp_source_name_47, const_str_plain_attname );
Py_DECREF( tmp_source_name_47 );
if ( tmp_setattr_attr_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 318;
type_description_1 = "ooooooooooooo";
goto try_except_handler_44;
}
tmp_setattr_value_2 = Py_None;
tmp_unused = BUILTIN_SETATTR( tmp_setattr_target_2, tmp_setattr_attr_2, tmp_setattr_value_2 );
Py_DECREF( tmp_setattr_attr_2 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 318;
type_description_1 = "ooooooooooooo";
goto try_except_handler_44;
}
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 317;
type_description_1 = "ooooooooooooo";
goto try_except_handler_44;
}
goto loop_start_15;
loop_end_15:;
goto try_end_38;
// Exception handler code:
try_except_handler_44:;
exception_keeper_type_42 = exception_type;
exception_keeper_value_42 = exception_value;
exception_keeper_tb_42 = exception_tb;
exception_keeper_lineno_42 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_for_loop_13__iter_value );
tmp_for_loop_13__iter_value = NULL;
Py_XDECREF( tmp_for_loop_13__for_iterator );
tmp_for_loop_13__for_iterator = NULL;
// Re-raise.
exception_type = exception_keeper_type_42;
exception_value = exception_keeper_value_42;
exception_tb = exception_keeper_tb_42;
exception_lineno = exception_keeper_lineno_42;
goto try_except_handler_41;
// End of try:
try_end_38:;
Py_XDECREF( tmp_for_loop_13__iter_value );
tmp_for_loop_13__iter_value = NULL;
Py_XDECREF( tmp_for_loop_13__for_iterator );
tmp_for_loop_13__for_iterator = NULL;
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 316;
type_description_1 = "ooooooooooooo";
goto try_except_handler_41;
}
goto loop_start_14;
loop_end_14:;
goto try_end_39;
// Exception handler code:
try_except_handler_41:;
exception_keeper_type_43 = exception_type;
exception_keeper_value_43 = exception_value;
exception_keeper_tb_43 = exception_tb;
exception_keeper_lineno_43 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_for_loop_12__iter_value );
tmp_for_loop_12__iter_value = NULL;
Py_XDECREF( tmp_for_loop_12__for_iterator );
tmp_for_loop_12__for_iterator = NULL;
// Re-raise.
exception_type = exception_keeper_type_43;
exception_value = exception_keeper_value_43;
exception_tb = exception_keeper_tb_43;
exception_lineno = exception_keeper_lineno_43;
goto frame_exception_exit_1;
// End of try:
try_end_39:;
Py_XDECREF( tmp_for_loop_12__iter_value );
tmp_for_loop_12__iter_value = NULL;
Py_XDECREF( tmp_for_loop_12__for_iterator );
tmp_for_loop_12__for_iterator = NULL;
tmp_return_value = PyTuple_New( 2 );
tmp_called_instance_5 = var_deleted_counter;
if ( tmp_called_instance_5 == NULL )
{
Py_DECREF( tmp_return_value );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "deleted_counter" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 319;
type_description_1 = "ooooooooooooo";
goto frame_exception_exit_1;
}
frame_54ec43c561ef94893d9bbef71a219f87->m_frame.f_lineno = 319;
tmp_sum_sequence_1 = CALL_METHOD_NO_ARGS( tmp_called_instance_5, const_str_plain_values );
if ( tmp_sum_sequence_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_return_value );
exception_lineno = 319;
type_description_1 = "ooooooooooooo";
goto frame_exception_exit_1;
}
tmp_tuple_element_2 = BUILTIN_SUM1( tmp_sum_sequence_1 );
Py_DECREF( tmp_sum_sequence_1 );
if ( tmp_tuple_element_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_return_value );
exception_lineno = 319;
type_description_1 = "ooooooooooooo";
goto frame_exception_exit_1;
}
PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_2 );
tmp_dict_seq_1 = var_deleted_counter;
if ( tmp_dict_seq_1 == NULL )
{
Py_DECREF( tmp_return_value );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "deleted_counter" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 319;
type_description_1 = "ooooooooooooo";
goto frame_exception_exit_1;
}
tmp_tuple_element_2 = TO_DICT( tmp_dict_seq_1, NULL );
if ( tmp_tuple_element_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_return_value );
exception_lineno = 319;
type_description_1 = "ooooooooooooo";
goto frame_exception_exit_1;
}
PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_2 );
goto frame_return_exit_1;
#if 1
RESTORE_FRAME_EXCEPTION( frame_54ec43c561ef94893d9bbef71a219f87 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto frame_no_exception_3;
frame_return_exit_1:;
#if 1
RESTORE_FRAME_EXCEPTION( frame_54ec43c561ef94893d9bbef71a219f87 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto try_return_handler_1;
frame_exception_exit_1:;
#if 1
RESTORE_FRAME_EXCEPTION( frame_54ec43c561ef94893d9bbef71a219f87 );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( frame_54ec43c561ef94893d9bbef71a219f87, exception_lineno );
}
else if ( exception_tb->tb_frame != &frame_54ec43c561ef94893d9bbef71a219f87->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, frame_54ec43c561ef94893d9bbef71a219f87, exception_lineno );
}
// Attachs locals to frame if any.
Nuitka_Frame_AttachLocals(
(struct Nuitka_FrameObject *)frame_54ec43c561ef94893d9bbef71a219f87,
type_description_1,
par_self,
var_model,
var_instances,
var_deleted_counter,
var_obj,
var_qs,
var_count,
var_instances_for_fieldvalues,
var_query,
var_field,
var_value,
var_pk_list,
var_instance
);
// Release cached frame.
if ( frame_54ec43c561ef94893d9bbef71a219f87 == cache_frame_54ec43c561ef94893d9bbef71a219f87 )
{
Py_DECREF( frame_54ec43c561ef94893d9bbef71a219f87 );
}
cache_frame_54ec43c561ef94893d9bbef71a219f87 = NULL;
assertFrameObject( frame_54ec43c561ef94893d9bbef71a219f87 );
// Put the previous frame back on top.
popFrameStack();
// Return the error.
goto try_except_handler_1;
frame_no_exception_3:;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_18_delete );
return NULL;
// Return handler code:
try_return_handler_1:;
Py_XDECREF( par_self );
par_self = NULL;
Py_XDECREF( var_model );
var_model = NULL;
Py_XDECREF( var_instances );
var_instances = NULL;
Py_XDECREF( var_deleted_counter );
var_deleted_counter = NULL;
Py_XDECREF( var_obj );
var_obj = NULL;
Py_XDECREF( var_qs );
var_qs = NULL;
Py_XDECREF( var_count );
var_count = NULL;
Py_XDECREF( var_instances_for_fieldvalues );
var_instances_for_fieldvalues = NULL;
Py_XDECREF( var_query );
var_query = NULL;
Py_XDECREF( var_field );
var_field = NULL;
Py_XDECREF( var_value );
var_value = NULL;
Py_XDECREF( var_pk_list );
var_pk_list = NULL;
Py_XDECREF( var_instance );
var_instance = NULL;
goto function_return_exit;
// Exception handler code:
try_except_handler_1:;
exception_keeper_type_44 = exception_type;
exception_keeper_value_44 = exception_value;
exception_keeper_tb_44 = exception_tb;
exception_keeper_lineno_44 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( par_self );
par_self = NULL;
Py_XDECREF( var_model );
var_model = NULL;
Py_XDECREF( var_instances );
var_instances = NULL;
Py_XDECREF( var_deleted_counter );
var_deleted_counter = NULL;
Py_XDECREF( var_obj );
var_obj = NULL;
Py_XDECREF( var_qs );
var_qs = NULL;
Py_XDECREF( var_count );
var_count = NULL;
Py_XDECREF( var_instances_for_fieldvalues );
var_instances_for_fieldvalues = NULL;
Py_XDECREF( var_query );
var_query = NULL;
Py_XDECREF( var_field );
var_field = NULL;
Py_XDECREF( var_value );
var_value = NULL;
Py_XDECREF( var_pk_list );
var_pk_list = NULL;
Py_XDECREF( var_instance );
var_instance = NULL;
// Re-raise.
exception_type = exception_keeper_type_44;
exception_value = exception_keeper_value_44;
exception_tb = exception_keeper_tb_44;
exception_lineno = exception_keeper_lineno_44;
goto function_exception_exit;
// End of try:
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$db$models$deletion$$$function_18_delete );
return NULL;
function_exception_exit:
assert( exception_type );
RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
return NULL;
function_return_exit:
CHECK_OBJECT( tmp_return_value );
assert( had_error || !ERROR_OCCURRED() );
return tmp_return_value;
}
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_10_add( PyObject *defaults )
{
struct Nuitka_FunctionObject *result = Nuitka_Function_New(
impl_django$db$models$deletion$$$function_10_add,
const_str_plain_add,
#if PYTHON_VERSION >= 330
const_str_digest_2e2a525b1b4e0c41a738de210e98b08d,
#endif
codeobj_29bdba5324aae2c24553ff6d5c9f67bb,
defaults,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_django$db$models$deletion,
const_str_digest_e1d442fac25913f8e85f0c8374277763,
0
);
return (PyObject *)result;
}
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_11_add_field_update( )
{
struct Nuitka_FunctionObject *result = Nuitka_Function_New(
impl_django$db$models$deletion$$$function_11_add_field_update,
const_str_plain_add_field_update,
#if PYTHON_VERSION >= 330
const_str_digest_299987120dd75516a372f40806f51910,
#endif
codeobj_c37c38be553a1b6c0f108c3733c05bf0,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_django$db$models$deletion,
const_str_digest_10c7762372a358852f82c6bd65871a4c,
0
);
return (PyObject *)result;
}
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_12_can_fast_delete( PyObject *defaults )
{
struct Nuitka_FunctionObject *result = Nuitka_Function_New(
impl_django$db$models$deletion$$$function_12_can_fast_delete,
const_str_plain_can_fast_delete,
#if PYTHON_VERSION >= 330
const_str_digest_2e9b1c68970bea3034a67c68850448ee,
#endif
codeobj_a4ac5ac02c2c8757e9123cd37f196656,
defaults,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_django$db$models$deletion,
const_str_digest_c881c9d0889ca7c54ae2f5e14c9867eb,
0
);
return (PyObject *)result;
}
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_13_get_del_batches( )
{
struct Nuitka_FunctionObject *result = Nuitka_Function_New(
impl_django$db$models$deletion$$$function_13_get_del_batches,
const_str_plain_get_del_batches,
#if PYTHON_VERSION >= 330
const_str_digest_6b5e14ab7f9b2cf9216c0b090d2dc992,
#endif
codeobj_6f3ca5631f310a307e49f023c6b223c1,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_django$db$models$deletion,
const_str_digest_e393693c8d3429bd871c35d225c2632a,
0
);
return (PyObject *)result;
}
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_14_collect( PyObject *defaults )
{
struct Nuitka_FunctionObject *result = Nuitka_Function_New(
impl_django$db$models$deletion$$$function_14_collect,
const_str_plain_collect,
#if PYTHON_VERSION >= 330
const_str_digest_85cd31bd2bdae1f31ac2d01dbdfcece0,
#endif
codeobj_a71d042c297bd0001c6b1b57573b0fc1,
defaults,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_django$db$models$deletion,
const_str_digest_230446a2965d8c36febdb9fab47679c7,
0
);
return (PyObject *)result;
}
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_15_related_objects( )
{
struct Nuitka_FunctionObject *result = Nuitka_Function_New(
impl_django$db$models$deletion$$$function_15_related_objects,
const_str_plain_related_objects,
#if PYTHON_VERSION >= 330
const_str_digest_52c67151f8dbe568410e1068fb45d022,
#endif
codeobj_fa0d05ef46f92604e6acafcaa709d060,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_django$db$models$deletion,
const_str_digest_8d75dab84a5137dd7de48ade8741da90,
0
);
return (PyObject *)result;
}
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_16_instances_with_model( )
{
struct Nuitka_FunctionObject *result = Nuitka_Function_New(
impl_django$db$models$deletion$$$function_16_instances_with_model,
const_str_plain_instances_with_model,
#if PYTHON_VERSION >= 330
const_str_digest_e21eecfbf3e2cc513aaf495b8aa3812a,
#endif
codeobj_754aafcc5876f7f866cf01b2a209ba26,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_django$db$models$deletion,
Py_None,
0
);
return (PyObject *)result;
}
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_17_sort( )
{
struct Nuitka_FunctionObject *result = Nuitka_Function_New(
impl_django$db$models$deletion$$$function_17_sort,
const_str_plain_sort,
#if PYTHON_VERSION >= 330
const_str_digest_4f0b04eb363db51d0f7d8ba74d06c571,
#endif
codeobj_3024af40360f1e53d055413e8dcd6901,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_django$db$models$deletion,
Py_None,
0
);
return (PyObject *)result;
}
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_18_delete( )
{
struct Nuitka_FunctionObject *result = Nuitka_Function_New(
impl_django$db$models$deletion$$$function_18_delete,
const_str_plain_delete,
#if PYTHON_VERSION >= 330
const_str_digest_2892d778c404230192a65706efdb587e,
#endif
codeobj_54ec43c561ef94893d9bbef71a219f87,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_django$db$models$deletion,
Py_None,
0
);
return (PyObject *)result;
}
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_1___init__( )
{
struct Nuitka_FunctionObject *result = Nuitka_Function_New(
impl_django$db$models$deletion$$$function_1___init__,
const_str_plain___init__,
#if PYTHON_VERSION >= 330
const_str_digest_5f5d2c1b0e46dd2d1920137e41b63ca4,
#endif
codeobj_ab1bfafe331c310312d94db8b929ec6d,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_django$db$models$deletion,
Py_None,
0
);
return (PyObject *)result;
}
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_2_CASCADE( )
{
struct Nuitka_FunctionObject *result = Nuitka_Function_New(
impl_django$db$models$deletion$$$function_2_CASCADE,
const_str_plain_CASCADE,
#if PYTHON_VERSION >= 330
NULL,
#endif
codeobj_fe5fd8468a25eeb05511be662f519940,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_django$db$models$deletion,
Py_None,
0
);
return (PyObject *)result;
}
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_3_PROTECT( )
{
struct Nuitka_FunctionObject *result = Nuitka_Function_New(
impl_django$db$models$deletion$$$function_3_PROTECT,
const_str_plain_PROTECT,
#if PYTHON_VERSION >= 330
NULL,
#endif
codeobj_2da8fa3bec250901b606518977497807,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_django$db$models$deletion,
Py_None,
0
);
return (PyObject *)result;
}
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_4_SET( )
{
struct Nuitka_FunctionObject *result = Nuitka_Function_New(
impl_django$db$models$deletion$$$function_4_SET,
const_str_plain_SET,
#if PYTHON_VERSION >= 330
NULL,
#endif
codeobj_4c958942f740ab9933b111ab3c2bb6b8,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_django$db$models$deletion,
Py_None,
0
);
return (PyObject *)result;
}
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_4_SET$$$function_1_set_on_delete( struct Nuitka_CellObject *closure_value )
{
struct Nuitka_FunctionObject *result = Nuitka_Function_New(
impl_django$db$models$deletion$$$function_4_SET$$$function_1_set_on_delete,
const_str_plain_set_on_delete,
#if PYTHON_VERSION >= 330
const_str_digest_01cd8491ff6ab307c2be3f0c42c6482c,
#endif
codeobj_4bbbe6a77682e8d72ff63d99850f6a2e,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_django$db$models$deletion,
Py_None,
1
);
result->m_closure[0] = closure_value;
Py_INCREF( result->m_closure[0] );
return (PyObject *)result;
}
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_4_SET$$$function_2_set_on_delete( struct Nuitka_CellObject *closure_value )
{
struct Nuitka_FunctionObject *result = Nuitka_Function_New(
impl_django$db$models$deletion$$$function_4_SET$$$function_2_set_on_delete,
const_str_plain_set_on_delete,
#if PYTHON_VERSION >= 330
const_str_digest_01cd8491ff6ab307c2be3f0c42c6482c,
#endif
codeobj_0b5cd91cb73546ecb3383c870bbbce8b,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_django$db$models$deletion,
Py_None,
1
);
result->m_closure[0] = closure_value;
Py_INCREF( result->m_closure[0] );
return (PyObject *)result;
}
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_4_SET$$$function_3_lambda( struct Nuitka_CellObject *closure_value )
{
struct Nuitka_FunctionObject *result = Nuitka_Function_New(
impl_django$db$models$deletion$$$function_4_SET$$$function_3_lambda,
const_str_angle_lambda,
#if PYTHON_VERSION >= 330
const_str_digest_67f0e3ff968d7b1cfe7a777af84ab064,
#endif
codeobj_af9bcfcc848055391ca50c1e06838db9,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_django$db$models$deletion,
Py_None,
1
);
result->m_closure[0] = closure_value;
Py_INCREF( result->m_closure[0] );
return (PyObject *)result;
}
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_5_SET_NULL( )
{
struct Nuitka_FunctionObject *result = Nuitka_Function_New(
impl_django$db$models$deletion$$$function_5_SET_NULL,
const_str_plain_SET_NULL,
#if PYTHON_VERSION >= 330
NULL,
#endif
codeobj_5dcad26cc3b905ae41d0893ea74b9e28,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_django$db$models$deletion,
Py_None,
0
);
return (PyObject *)result;
}
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_6_SET_DEFAULT( )
{
struct Nuitka_FunctionObject *result = Nuitka_Function_New(
impl_django$db$models$deletion$$$function_6_SET_DEFAULT,
const_str_plain_SET_DEFAULT,
#if PYTHON_VERSION >= 330
NULL,
#endif
codeobj_e15a0ab237ab5954be0dac3bc9648c0e,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_django$db$models$deletion,
Py_None,
0
);
return (PyObject *)result;
}
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_7_DO_NOTHING( )
{
struct Nuitka_FunctionObject *result = Nuitka_Function_New(
impl_django$db$models$deletion$$$function_7_DO_NOTHING,
const_str_plain_DO_NOTHING,
#if PYTHON_VERSION >= 330
NULL,
#endif
codeobj_a6b2853858fd7876502e41f7330ad59d,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_django$db$models$deletion,
Py_None,
0
);
return (PyObject *)result;
}
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_8_get_candidate_relations_to_delete( )
{
struct Nuitka_FunctionObject *result = Nuitka_Function_New(
impl_django$db$models$deletion$$$function_8_get_candidate_relations_to_delete,
const_str_plain_get_candidate_relations_to_delete,
#if PYTHON_VERSION >= 330
NULL,
#endif
codeobj_1d84a1db58e155104a4304b25b805bc2,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_django$db$models$deletion,
Py_None,
0
);
return (PyObject *)result;
}
static PyObject *MAKE_FUNCTION_django$db$models$deletion$$$function_9___init__( )
{
struct Nuitka_FunctionObject *result = Nuitka_Function_New(
impl_django$db$models$deletion$$$function_9___init__,
const_str_plain___init__,
#if PYTHON_VERSION >= 330
const_str_digest_936f3643509ceeb465bd0e37fbfc266f,
#endif
codeobj_04e7822706aae5b7e03c2d783b09c51b,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_django$db$models$deletion,
Py_None,
0
);
return (PyObject *)result;
}
#if PYTHON_VERSION >= 300
static struct PyModuleDef mdef_django$db$models$deletion =
{
PyModuleDef_HEAD_INIT,
"django.db.models.deletion", /* m_name */
NULL, /* m_doc */
-1, /* m_size */
NULL, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
#endif
#if PYTHON_VERSION >= 300
extern PyObject *metapath_based_loader;
#endif
#if PYTHON_VERSION >= 330
extern PyObject *const_str_plain___loader__;
#endif
extern void _initCompiledCellType();
extern void _initCompiledGeneratorType();
extern void _initCompiledFunctionType();
extern void _initCompiledMethodType();
extern void _initCompiledFrameType();
#if PYTHON_VERSION >= 350
extern void _initCompiledCoroutineTypes();
#endif
#if PYTHON_VERSION >= 360
extern void _initCompiledAsyncgenTypes();
#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( django$db$models$deletion )
{
#if defined(_NUITKA_EXE) || PYTHON_VERSION >= 300
static bool _init_done = false;
// Modules might be imported repeatedly, which is to be ignored.
if ( _init_done )
{
return MOD_RETURN_VALUE( module_django$db$models$deletion );
}
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();
createGlobalConstants();
/* Initialize the compiled types of Nuitka. */
_initCompiledCellType();
_initCompiledGeneratorType();
_initCompiledFunctionType();
_initCompiledMethodType();
_initCompiledFrameType();
#if PYTHON_VERSION >= 350
_initCompiledCoroutineTypes();
#endif
#if PYTHON_VERSION >= 360
_initCompiledAsyncgenTypes();
#endif
#if PYTHON_VERSION < 300
_initSlotCompare();
#endif
#if PYTHON_VERSION >= 270
_initSlotIternext();
#endif
patchBuiltinModule();
patchTypeComparison();
// Enable meta path based loader if not already done.
setupMetaPathBasedLoader();
#if PYTHON_VERSION >= 300
patchInspectModule();
#endif
#endif
/* The constants only used by this module are created now. */
#ifdef _NUITKA_TRACE
puts("django.db.models.deletion: Calling createModuleConstants().");
#endif
createModuleConstants();
/* The code objects used by this module are created now. */
#ifdef _NUITKA_TRACE
puts("django.db.models.deletion: Calling createModuleCodeObjects().");
#endif
createModuleCodeObjects();
// puts( "in initdjango$db$models$deletion" );
// 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_django$db$models$deletion = Py_InitModule4(
"django.db.models.deletion", // 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_django$db$models$deletion = PyModule_Create( &mdef_django$db$models$deletion );
#endif
moduledict_django$db$models$deletion = MODULE_DICT( module_django$db$models$deletion );
CHECK_OBJECT( module_django$db$models$deletion );
// 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_dd38da9eafc032377ee2d8f2b673b5a7, module_django$db$models$deletion );
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.
if ( GET_STRING_DICT_VALUE( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain___builtins__ ) == NULL )
{
PyObject *value = (PyObject *)builtin_module;
// Check if main module, not a dict then but the module itself.
#if !defined(_NUITKA_EXE) || !0
value = PyModule_GetDict( value );
#endif
UPDATE_STRING_DICT0( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain___builtins__, value );
}
#if PYTHON_VERSION >= 330
UPDATE_STRING_DICT0( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain___loader__, metapath_based_loader );
#endif
// Temp variables if any
PyObject *outline_0_var___class__ = NULL;
PyObject *outline_0_var___qualname__ = NULL;
PyObject *outline_0_var___module__ = NULL;
PyObject *outline_0_var___init__ = NULL;
PyObject *outline_1_var___class__ = NULL;
PyObject *outline_1_var___qualname__ = NULL;
PyObject *outline_1_var___module__ = NULL;
PyObject *outline_1_var___init__ = NULL;
PyObject *outline_1_var_add = NULL;
PyObject *outline_1_var_add_field_update = NULL;
PyObject *outline_1_var_can_fast_delete = NULL;
PyObject *outline_1_var_get_del_batches = NULL;
PyObject *outline_1_var_collect = NULL;
PyObject *outline_1_var_related_objects = NULL;
PyObject *outline_1_var_instances_with_model = NULL;
PyObject *outline_1_var_sort = NULL;
PyObject *outline_1_var_delete = NULL;
PyObject *tmp_class_creation_1__bases = NULL;
PyObject *tmp_class_creation_1__class_decl_dict = NULL;
PyObject *tmp_class_creation_1__metaclass = NULL;
PyObject *tmp_class_creation_1__prepared = NULL;
PyObject *tmp_class_creation_2__bases = NULL;
PyObject *tmp_class_creation_2__class_decl_dict = NULL;
PyObject *tmp_class_creation_2__metaclass = NULL;
PyObject *tmp_class_creation_2__prepared = NULL;
PyObject *tmp_import_from_1__module = NULL;
PyObject *tmp_import_from_2__module = NULL;
PyObject *tmp_import_from_3__module = NULL;
PyObject *exception_type = NULL;
PyObject *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
PyObject *exception_keeper_type_2;
PyObject *exception_keeper_value_2;
PyTracebackObject *exception_keeper_tb_2;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_2;
PyObject *exception_keeper_type_3;
PyObject *exception_keeper_value_3;
PyTracebackObject *exception_keeper_tb_3;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_3;
PyObject *exception_keeper_type_4;
PyObject *exception_keeper_value_4;
PyTracebackObject *exception_keeper_tb_4;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_4;
PyObject *exception_keeper_type_5;
PyObject *exception_keeper_value_5;
PyTracebackObject *exception_keeper_tb_5;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_5;
PyObject *exception_keeper_type_6;
PyObject *exception_keeper_value_6;
PyTracebackObject *exception_keeper_tb_6;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_6;
PyObject *exception_keeper_type_7;
PyObject *exception_keeper_value_7;
PyTracebackObject *exception_keeper_tb_7;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_7;
PyObject *tmp_args_element_name_1;
PyObject *tmp_args_element_name_2;
PyObject *tmp_args_name_1;
PyObject *tmp_args_name_2;
PyObject *tmp_args_name_3;
PyObject *tmp_args_name_4;
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_assign_source_13;
PyObject *tmp_assign_source_14;
PyObject *tmp_assign_source_15;
PyObject *tmp_assign_source_16;
PyObject *tmp_assign_source_17;
PyObject *tmp_assign_source_18;
PyObject *tmp_assign_source_19;
PyObject *tmp_assign_source_20;
PyObject *tmp_assign_source_21;
PyObject *tmp_assign_source_22;
PyObject *tmp_assign_source_23;
PyObject *tmp_assign_source_24;
PyObject *tmp_assign_source_25;
PyObject *tmp_assign_source_26;
PyObject *tmp_assign_source_27;
PyObject *tmp_assign_source_28;
PyObject *tmp_assign_source_29;
PyObject *tmp_assign_source_30;
PyObject *tmp_assign_source_31;
PyObject *tmp_assign_source_32;
PyObject *tmp_assign_source_33;
PyObject *tmp_assign_source_34;
PyObject *tmp_assign_source_35;
PyObject *tmp_assign_source_36;
PyObject *tmp_assign_source_37;
PyObject *tmp_assign_source_38;
PyObject *tmp_assign_source_39;
PyObject *tmp_assign_source_40;
PyObject *tmp_assign_source_41;
PyObject *tmp_assign_source_42;
PyObject *tmp_assign_source_43;
PyObject *tmp_assign_source_44;
PyObject *tmp_assign_source_45;
PyObject *tmp_assign_source_46;
PyObject *tmp_assign_source_47;
PyObject *tmp_assign_source_48;
PyObject *tmp_assign_source_49;
PyObject *tmp_assign_source_50;
PyObject *tmp_assign_source_51;
PyObject *tmp_assign_source_52;
PyObject *tmp_bases_name_1;
PyObject *tmp_bases_name_2;
PyObject *tmp_called_name_1;
PyObject *tmp_called_name_2;
PyObject *tmp_called_name_3;
PyObject *tmp_called_name_4;
PyObject *tmp_called_name_5;
int tmp_cmp_In_1;
int tmp_cmp_In_2;
int tmp_cmp_In_3;
int tmp_cmp_In_4;
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;
int tmp_cond_truth_2;
PyObject *tmp_cond_value_1;
PyObject *tmp_cond_value_2;
PyObject *tmp_defaults_1;
PyObject *tmp_defaults_2;
PyObject *tmp_defaults_3;
PyObject *tmp_dict_name_1;
PyObject *tmp_dict_name_2;
PyObject *tmp_dictdel_dict;
PyObject *tmp_dictdel_key;
PyObject *tmp_fromlist_name_1;
PyObject *tmp_fromlist_name_2;
PyObject *tmp_fromlist_name_3;
PyObject *tmp_fromlist_name_4;
PyObject *tmp_fromlist_name_5;
PyObject *tmp_globals_name_1;
PyObject *tmp_globals_name_2;
PyObject *tmp_globals_name_3;
PyObject *tmp_globals_name_4;
PyObject *tmp_globals_name_5;
PyObject *tmp_hasattr_attr_1;
PyObject *tmp_hasattr_attr_2;
PyObject *tmp_hasattr_source_1;
PyObject *tmp_hasattr_source_2;
PyObject *tmp_import_name_from_1;
PyObject *tmp_import_name_from_2;
PyObject *tmp_import_name_from_3;
PyObject *tmp_import_name_from_4;
PyObject *tmp_import_name_from_5;
PyObject *tmp_import_name_from_6;
PyObject *tmp_import_name_from_7;
PyObject *tmp_import_name_from_8;
PyObject *tmp_import_name_from_9;
PyObject *tmp_key_name_1;
PyObject *tmp_key_name_2;
PyObject *tmp_kw_name_1;
PyObject *tmp_kw_name_2;
PyObject *tmp_kw_name_3;
PyObject *tmp_kw_name_4;
PyObject *tmp_level_name_1;
PyObject *tmp_level_name_2;
PyObject *tmp_level_name_3;
PyObject *tmp_level_name_4;
PyObject *tmp_level_name_5;
PyObject *tmp_locals_name_1;
PyObject *tmp_locals_name_2;
PyObject *tmp_locals_name_3;
PyObject *tmp_locals_name_4;
PyObject *tmp_locals_name_5;
PyObject *tmp_metaclass_name_1;
PyObject *tmp_metaclass_name_2;
PyObject *tmp_name_name_1;
PyObject *tmp_name_name_2;
PyObject *tmp_name_name_3;
PyObject *tmp_name_name_4;
PyObject *tmp_name_name_5;
PyObject *tmp_outline_return_value_1;
PyObject *tmp_outline_return_value_2;
int tmp_res;
bool tmp_result;
PyObject *tmp_set_locals;
PyObject *tmp_source_name_1;
PyObject *tmp_source_name_2;
PyObject *tmp_subscribed_name_1;
PyObject *tmp_subscribed_name_2;
PyObject *tmp_subscript_name_1;
PyObject *tmp_subscript_name_2;
PyObject *tmp_tuple_element_1;
PyObject *tmp_tuple_element_2;
PyObject *tmp_tuple_element_3;
PyObject *tmp_tuple_element_4;
PyObject *tmp_tuple_element_5;
PyObject *tmp_type_arg_1;
PyObject *tmp_type_arg_2;
struct Nuitka_FrameObject *frame_3373b6532797b8bba981ca5cb6bcd3ab;
NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
tmp_outline_return_value_1 = NULL;
tmp_outline_return_value_2 = NULL;
// Locals dictionary setup.
PyObject *locals_dict_1 = PyDict_New();
// Locals dictionary setup.
PyObject *locals_dict_2 = PyDict_New();
// Module code.
tmp_assign_source_1 = Py_None;
UPDATE_STRING_DICT0( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain___doc__, tmp_assign_source_1 );
tmp_assign_source_2 = module_filename_obj;
UPDATE_STRING_DICT0( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain___file__, tmp_assign_source_2 );
tmp_assign_source_3 = metapath_based_loader;
UPDATE_STRING_DICT0( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain___loader__, tmp_assign_source_3 );
// Frame without reuse.
frame_3373b6532797b8bba981ca5cb6bcd3ab = MAKE_MODULE_FRAME( codeobj_3373b6532797b8bba981ca5cb6bcd3ab, module_django$db$models$deletion );
// Push the new frame as the currently active one, and we should be exclusively
// owning it.
pushFrameStack( frame_3373b6532797b8bba981ca5cb6bcd3ab );
assert( Py_REFCNT( frame_3373b6532797b8bba981ca5cb6bcd3ab ) == 2 );
// Framed code:
frame_3373b6532797b8bba981ca5cb6bcd3ab->m_frame.f_lineno = 1;
{
PyObject *module = PyImport_ImportModule("importlib._bootstrap");
if (likely( module != NULL ))
{
tmp_called_name_1 = PyObject_GetAttr( module, const_str_plain_ModuleSpec );
}
else
{
tmp_called_name_1 = NULL;
}
}
if ( tmp_called_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 1;
goto frame_exception_exit_1;
}
tmp_args_element_name_1 = const_str_digest_dd38da9eafc032377ee2d8f2b673b5a7;
tmp_args_element_name_2 = metapath_based_loader;
frame_3373b6532797b8bba981ca5cb6bcd3ab->m_frame.f_lineno = 1;
{
PyObject *call_args[] = { tmp_args_element_name_1, tmp_args_element_name_2 };
tmp_assign_source_4 = CALL_FUNCTION_WITH_ARGS2( tmp_called_name_1, call_args );
}
if ( tmp_assign_source_4 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 1;
goto frame_exception_exit_1;
}
UPDATE_STRING_DICT1( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain___spec__, tmp_assign_source_4 );
tmp_assign_source_5 = Py_None;
UPDATE_STRING_DICT0( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain___cached__, tmp_assign_source_5 );
tmp_assign_source_6 = const_str_digest_76151557ac4cfbca827b761e50d5fea2;
UPDATE_STRING_DICT0( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain___package__, tmp_assign_source_6 );
tmp_name_name_1 = const_str_plain_collections;
tmp_globals_name_1 = (PyObject *)moduledict_django$db$models$deletion;
tmp_locals_name_1 = Py_None;
tmp_fromlist_name_1 = const_tuple_str_plain_Counter_str_plain_OrderedDict_tuple;
tmp_level_name_1 = const_int_0;
frame_3373b6532797b8bba981ca5cb6bcd3ab->m_frame.f_lineno = 1;
tmp_assign_source_7 = IMPORT_MODULE5( tmp_name_name_1, tmp_globals_name_1, tmp_locals_name_1, tmp_fromlist_name_1, tmp_level_name_1 );
if ( tmp_assign_source_7 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 1;
goto frame_exception_exit_1;
}
assert( tmp_import_from_1__module == NULL );
tmp_import_from_1__module = tmp_assign_source_7;
// Tried code:
tmp_import_name_from_1 = tmp_import_from_1__module;
CHECK_OBJECT( tmp_import_name_from_1 );
tmp_assign_source_8 = IMPORT_NAME( tmp_import_name_from_1, const_str_plain_Counter );
if ( tmp_assign_source_8 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 1;
goto try_except_handler_1;
}
UPDATE_STRING_DICT1( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_Counter, tmp_assign_source_8 );
tmp_import_name_from_2 = tmp_import_from_1__module;
CHECK_OBJECT( tmp_import_name_from_2 );
tmp_assign_source_9 = IMPORT_NAME( tmp_import_name_from_2, const_str_plain_OrderedDict );
if ( tmp_assign_source_9 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 1;
goto try_except_handler_1;
}
UPDATE_STRING_DICT1( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_OrderedDict, tmp_assign_source_9 );
goto try_end_1;
// Exception handler code:
try_except_handler_1:;
exception_keeper_type_1 = exception_type;
exception_keeper_value_1 = exception_value;
exception_keeper_tb_1 = exception_tb;
exception_keeper_lineno_1 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_import_from_1__module );
tmp_import_from_1__module = NULL;
// Re-raise.
exception_type = exception_keeper_type_1;
exception_value = exception_keeper_value_1;
exception_tb = exception_keeper_tb_1;
exception_lineno = exception_keeper_lineno_1;
goto frame_exception_exit_1;
// End of try:
try_end_1:;
Py_XDECREF( tmp_import_from_1__module );
tmp_import_from_1__module = NULL;
tmp_name_name_2 = const_str_plain_operator;
tmp_globals_name_2 = (PyObject *)moduledict_django$db$models$deletion;
tmp_locals_name_2 = Py_None;
tmp_fromlist_name_2 = const_tuple_str_plain_attrgetter_tuple;
tmp_level_name_2 = const_int_0;
frame_3373b6532797b8bba981ca5cb6bcd3ab->m_frame.f_lineno = 2;
tmp_import_name_from_3 = IMPORT_MODULE5( tmp_name_name_2, tmp_globals_name_2, tmp_locals_name_2, tmp_fromlist_name_2, tmp_level_name_2 );
if ( tmp_import_name_from_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 2;
goto frame_exception_exit_1;
}
tmp_assign_source_10 = IMPORT_NAME( tmp_import_name_from_3, const_str_plain_attrgetter );
Py_DECREF( tmp_import_name_from_3 );
if ( tmp_assign_source_10 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 2;
goto frame_exception_exit_1;
}
UPDATE_STRING_DICT1( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_attrgetter, tmp_assign_source_10 );
tmp_name_name_3 = const_str_digest_3a59af3086b40e635cf46a918dad8363;
tmp_globals_name_3 = (PyObject *)moduledict_django$db$models$deletion;
tmp_locals_name_3 = Py_None;
tmp_fromlist_name_3 = const_tuple_2121a1e03240e6f8803ed7ddee9cba88_tuple;
tmp_level_name_3 = const_int_0;
frame_3373b6532797b8bba981ca5cb6bcd3ab->m_frame.f_lineno = 4;
tmp_assign_source_11 = IMPORT_MODULE5( tmp_name_name_3, tmp_globals_name_3, tmp_locals_name_3, tmp_fromlist_name_3, tmp_level_name_3 );
if ( tmp_assign_source_11 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 4;
goto frame_exception_exit_1;
}
assert( tmp_import_from_2__module == NULL );
tmp_import_from_2__module = tmp_assign_source_11;
// Tried code:
tmp_import_name_from_4 = tmp_import_from_2__module;
CHECK_OBJECT( tmp_import_name_from_4 );
tmp_assign_source_12 = IMPORT_NAME( tmp_import_name_from_4, const_str_plain_IntegrityError );
if ( tmp_assign_source_12 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 4;
goto try_except_handler_2;
}
UPDATE_STRING_DICT1( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_IntegrityError, tmp_assign_source_12 );
tmp_import_name_from_5 = tmp_import_from_2__module;
CHECK_OBJECT( tmp_import_name_from_5 );
tmp_assign_source_13 = IMPORT_NAME( tmp_import_name_from_5, const_str_plain_connections );
if ( tmp_assign_source_13 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 4;
goto try_except_handler_2;
}
UPDATE_STRING_DICT1( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_connections, tmp_assign_source_13 );
tmp_import_name_from_6 = tmp_import_from_2__module;
CHECK_OBJECT( tmp_import_name_from_6 );
tmp_assign_source_14 = IMPORT_NAME( tmp_import_name_from_6, const_str_plain_transaction );
if ( tmp_assign_source_14 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 4;
goto try_except_handler_2;
}
UPDATE_STRING_DICT1( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_transaction, tmp_assign_source_14 );
goto try_end_2;
// Exception handler code:
try_except_handler_2:;
exception_keeper_type_2 = exception_type;
exception_keeper_value_2 = exception_value;
exception_keeper_tb_2 = exception_tb;
exception_keeper_lineno_2 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_import_from_2__module );
tmp_import_from_2__module = NULL;
// Re-raise.
exception_type = exception_keeper_type_2;
exception_value = exception_keeper_value_2;
exception_tb = exception_keeper_tb_2;
exception_lineno = exception_keeper_lineno_2;
goto frame_exception_exit_1;
// End of try:
try_end_2:;
Py_XDECREF( tmp_import_from_2__module );
tmp_import_from_2__module = NULL;
tmp_name_name_4 = const_str_digest_76151557ac4cfbca827b761e50d5fea2;
tmp_globals_name_4 = (PyObject *)moduledict_django$db$models$deletion;
tmp_locals_name_4 = Py_None;
tmp_fromlist_name_4 = const_tuple_str_plain_signals_str_plain_sql_tuple;
tmp_level_name_4 = const_int_0;
frame_3373b6532797b8bba981ca5cb6bcd3ab->m_frame.f_lineno = 5;
tmp_assign_source_15 = IMPORT_MODULE5( tmp_name_name_4, tmp_globals_name_4, tmp_locals_name_4, tmp_fromlist_name_4, tmp_level_name_4 );
if ( tmp_assign_source_15 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 5;
goto frame_exception_exit_1;
}
assert( tmp_import_from_3__module == NULL );
tmp_import_from_3__module = tmp_assign_source_15;
// Tried code:
tmp_import_name_from_7 = tmp_import_from_3__module;
CHECK_OBJECT( tmp_import_name_from_7 );
tmp_assign_source_16 = IMPORT_NAME( tmp_import_name_from_7, const_str_plain_signals );
if ( tmp_assign_source_16 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 5;
goto try_except_handler_3;
}
UPDATE_STRING_DICT1( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_signals, tmp_assign_source_16 );
tmp_import_name_from_8 = tmp_import_from_3__module;
CHECK_OBJECT( tmp_import_name_from_8 );
tmp_assign_source_17 = IMPORT_NAME( tmp_import_name_from_8, const_str_plain_sql );
if ( tmp_assign_source_17 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 5;
goto try_except_handler_3;
}
UPDATE_STRING_DICT1( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_sql, tmp_assign_source_17 );
goto try_end_3;
// Exception handler code:
try_except_handler_3:;
exception_keeper_type_3 = exception_type;
exception_keeper_value_3 = exception_value;
exception_keeper_tb_3 = exception_tb;
exception_keeper_lineno_3 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_import_from_3__module );
tmp_import_from_3__module = NULL;
// Re-raise.
exception_type = exception_keeper_type_3;
exception_value = exception_keeper_value_3;
exception_tb = exception_keeper_tb_3;
exception_lineno = exception_keeper_lineno_3;
goto frame_exception_exit_1;
// End of try:
try_end_3:;
Py_XDECREF( tmp_import_from_3__module );
tmp_import_from_3__module = NULL;
tmp_name_name_5 = const_str_digest_467c9722f19d9d40d148689532cdc0b1;
tmp_globals_name_5 = (PyObject *)moduledict_django$db$models$deletion;
tmp_locals_name_5 = Py_None;
tmp_fromlist_name_5 = const_tuple_str_plain_six_tuple;
tmp_level_name_5 = const_int_0;
frame_3373b6532797b8bba981ca5cb6bcd3ab->m_frame.f_lineno = 6;
tmp_import_name_from_9 = IMPORT_MODULE5( tmp_name_name_5, tmp_globals_name_5, tmp_locals_name_5, tmp_fromlist_name_5, tmp_level_name_5 );
if ( tmp_import_name_from_9 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 6;
goto frame_exception_exit_1;
}
tmp_assign_source_18 = IMPORT_NAME( tmp_import_name_from_9, const_str_plain_six );
Py_DECREF( tmp_import_name_from_9 );
if ( tmp_assign_source_18 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 6;
goto frame_exception_exit_1;
}
UPDATE_STRING_DICT1( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_six, tmp_assign_source_18 );
// Tried code:
tmp_assign_source_19 = PyTuple_New( 1 );
tmp_tuple_element_1 = GET_STRING_DICT_VALUE( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_IntegrityError );
if (unlikely( tmp_tuple_element_1 == NULL ))
{
tmp_tuple_element_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_IntegrityError );
}
if ( tmp_tuple_element_1 == NULL )
{
Py_DECREF( tmp_assign_source_19 );
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "IntegrityError" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 9;
goto try_except_handler_4;
}
Py_INCREF( tmp_tuple_element_1 );
PyTuple_SET_ITEM( tmp_assign_source_19, 0, tmp_tuple_element_1 );
assert( tmp_class_creation_1__bases == NULL );
tmp_class_creation_1__bases = tmp_assign_source_19;
tmp_assign_source_20 = PyDict_New();
assert( tmp_class_creation_1__class_decl_dict == NULL );
tmp_class_creation_1__class_decl_dict = tmp_assign_source_20;
tmp_compare_left_1 = const_str_plain_metaclass;
tmp_compare_right_1 = tmp_class_creation_1__class_decl_dict;
CHECK_OBJECT( tmp_compare_right_1 );
tmp_cmp_In_1 = PySequence_Contains( tmp_compare_right_1, tmp_compare_left_1 );
assert( !(tmp_cmp_In_1 == -1) );
if ( tmp_cmp_In_1 == 1 )
{
goto condexpr_true_1;
}
else
{
goto condexpr_false_1;
}
condexpr_true_1:;
tmp_dict_name_1 = tmp_class_creation_1__class_decl_dict;
CHECK_OBJECT( tmp_dict_name_1 );
tmp_key_name_1 = const_str_plain_metaclass;
tmp_metaclass_name_1 = DICT_GET_ITEM( tmp_dict_name_1, tmp_key_name_1 );
if ( tmp_metaclass_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 9;
goto try_except_handler_4;
}
goto condexpr_end_1;
condexpr_false_1:;
tmp_cond_value_1 = tmp_class_creation_1__bases;
CHECK_OBJECT( tmp_cond_value_1 );
tmp_cond_truth_1 = CHECK_IF_TRUE( tmp_cond_value_1 );
if ( tmp_cond_truth_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 9;
goto try_except_handler_4;
}
if ( tmp_cond_truth_1 == 1 )
{
goto condexpr_true_2;
}
else
{
goto condexpr_false_2;
}
condexpr_true_2:;
tmp_subscribed_name_1 = tmp_class_creation_1__bases;
CHECK_OBJECT( tmp_subscribed_name_1 );
tmp_subscript_name_1 = const_int_0;
tmp_type_arg_1 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_1, tmp_subscript_name_1 );
if ( tmp_type_arg_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 9;
goto try_except_handler_4;
}
tmp_metaclass_name_1 = BUILTIN_TYPE1( tmp_type_arg_1 );
Py_DECREF( tmp_type_arg_1 );
if ( tmp_metaclass_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 9;
goto try_except_handler_4;
}
goto condexpr_end_2;
condexpr_false_2:;
tmp_metaclass_name_1 = (PyObject *)&PyType_Type;
Py_INCREF( tmp_metaclass_name_1 );
condexpr_end_2:;
condexpr_end_1:;
tmp_bases_name_1 = tmp_class_creation_1__bases;
CHECK_OBJECT( tmp_bases_name_1 );
tmp_assign_source_21 = SELECT_METACLASS( tmp_metaclass_name_1, tmp_bases_name_1 );
if ( tmp_assign_source_21 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_metaclass_name_1 );
exception_lineno = 9;
goto try_except_handler_4;
}
Py_DECREF( tmp_metaclass_name_1 );
assert( tmp_class_creation_1__metaclass == NULL );
tmp_class_creation_1__metaclass = tmp_assign_source_21;
tmp_compare_left_2 = const_str_plain_metaclass;
tmp_compare_right_2 = tmp_class_creation_1__class_decl_dict;
CHECK_OBJECT( tmp_compare_right_2 );
tmp_cmp_In_2 = PySequence_Contains( tmp_compare_right_2, tmp_compare_left_2 );
assert( !(tmp_cmp_In_2 == -1) );
if ( tmp_cmp_In_2 == 1 )
{
goto branch_yes_1;
}
else
{
goto branch_no_1;
}
branch_yes_1:;
tmp_dictdel_dict = tmp_class_creation_1__class_decl_dict;
CHECK_OBJECT( tmp_dictdel_dict );
tmp_dictdel_key = const_str_plain_metaclass;
tmp_result = DICT_REMOVE_ITEM( tmp_dictdel_dict, tmp_dictdel_key );
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 9;
goto try_except_handler_4;
}
branch_no_1:;
tmp_hasattr_source_1 = tmp_class_creation_1__metaclass;
CHECK_OBJECT( tmp_hasattr_source_1 );
tmp_hasattr_attr_1 = const_str_plain___prepare__;
tmp_res = PyObject_HasAttr( tmp_hasattr_source_1, tmp_hasattr_attr_1 );
if ( tmp_res == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 9;
goto try_except_handler_4;
}
if ( tmp_res == 1 )
{
goto condexpr_true_3;
}
else
{
goto condexpr_false_3;
}
condexpr_true_3:;
tmp_source_name_1 = tmp_class_creation_1__metaclass;
CHECK_OBJECT( tmp_source_name_1 );
tmp_called_name_2 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain___prepare__ );
if ( tmp_called_name_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 9;
goto try_except_handler_4;
}
tmp_args_name_1 = PyTuple_New( 2 );
tmp_tuple_element_2 = const_str_plain_ProtectedError;
Py_INCREF( tmp_tuple_element_2 );
PyTuple_SET_ITEM( tmp_args_name_1, 0, tmp_tuple_element_2 );
tmp_tuple_element_2 = tmp_class_creation_1__bases;
CHECK_OBJECT( tmp_tuple_element_2 );
Py_INCREF( tmp_tuple_element_2 );
PyTuple_SET_ITEM( tmp_args_name_1, 1, tmp_tuple_element_2 );
tmp_kw_name_1 = tmp_class_creation_1__class_decl_dict;
CHECK_OBJECT( tmp_kw_name_1 );
frame_3373b6532797b8bba981ca5cb6bcd3ab->m_frame.f_lineno = 9;
tmp_assign_source_22 = CALL_FUNCTION( tmp_called_name_2, tmp_args_name_1, tmp_kw_name_1 );
Py_DECREF( tmp_called_name_2 );
Py_DECREF( tmp_args_name_1 );
if ( tmp_assign_source_22 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 9;
goto try_except_handler_4;
}
goto condexpr_end_3;
condexpr_false_3:;
tmp_assign_source_22 = PyDict_New();
condexpr_end_3:;
assert( tmp_class_creation_1__prepared == NULL );
tmp_class_creation_1__prepared = tmp_assign_source_22;
tmp_set_locals = tmp_class_creation_1__prepared;
CHECK_OBJECT( tmp_set_locals );
Py_DECREF(locals_dict_1);
locals_dict_1 = tmp_set_locals;
Py_INCREF( tmp_set_locals );
tmp_assign_source_24 = const_str_digest_dd38da9eafc032377ee2d8f2b673b5a7;
assert( outline_0_var___module__ == NULL );
Py_INCREF( tmp_assign_source_24 );
outline_0_var___module__ = tmp_assign_source_24;
tmp_assign_source_25 = const_str_plain_ProtectedError;
assert( outline_0_var___qualname__ == NULL );
Py_INCREF( tmp_assign_source_25 );
outline_0_var___qualname__ = tmp_assign_source_25;
tmp_assign_source_26 = MAKE_FUNCTION_django$db$models$deletion$$$function_1___init__( );
assert( outline_0_var___init__ == NULL );
outline_0_var___init__ = tmp_assign_source_26;
// Tried code:
tmp_called_name_3 = tmp_class_creation_1__metaclass;
CHECK_OBJECT( tmp_called_name_3 );
tmp_args_name_2 = PyTuple_New( 3 );
tmp_tuple_element_3 = const_str_plain_ProtectedError;
Py_INCREF( tmp_tuple_element_3 );
PyTuple_SET_ITEM( tmp_args_name_2, 0, tmp_tuple_element_3 );
tmp_tuple_element_3 = tmp_class_creation_1__bases;
CHECK_OBJECT( tmp_tuple_element_3 );
Py_INCREF( tmp_tuple_element_3 );
PyTuple_SET_ITEM( tmp_args_name_2, 1, tmp_tuple_element_3 );
tmp_tuple_element_3 = locals_dict_1;
Py_INCREF( tmp_tuple_element_3 );
if ( outline_0_var___qualname__ != NULL )
{
int res = PyObject_SetItem(
tmp_tuple_element_3,
const_str_plain___qualname__,
outline_0_var___qualname__
);
tmp_result = res == 0;
}
else
{
PyObject *test_value = PyObject_GetItem(
tmp_tuple_element_3,
const_str_plain___qualname__
);
if ( test_value )
{
Py_DECREF( test_value );
int res = PyObject_DelItem(
tmp_tuple_element_3,
const_str_plain___qualname__
);
tmp_result = res == 0;
}
else
{
CLEAR_ERROR_OCCURRED();
tmp_result = true;
}
}
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_args_name_2 );
Py_DECREF( tmp_tuple_element_3 );
exception_lineno = 9;
goto try_except_handler_5;
}
if ( outline_0_var___module__ != NULL )
{
int res = PyObject_SetItem(
tmp_tuple_element_3,
const_str_plain___module__,
outline_0_var___module__
);
tmp_result = res == 0;
}
else
{
PyObject *test_value = PyObject_GetItem(
tmp_tuple_element_3,
const_str_plain___module__
);
if ( test_value )
{
Py_DECREF( test_value );
int res = PyObject_DelItem(
tmp_tuple_element_3,
const_str_plain___module__
);
tmp_result = res == 0;
}
else
{
CLEAR_ERROR_OCCURRED();
tmp_result = true;
}
}
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_args_name_2 );
Py_DECREF( tmp_tuple_element_3 );
exception_lineno = 9;
goto try_except_handler_5;
}
if ( outline_0_var___init__ != NULL )
{
int res = PyObject_SetItem(
tmp_tuple_element_3,
const_str_plain___init__,
outline_0_var___init__
);
tmp_result = res == 0;
}
else
{
PyObject *test_value = PyObject_GetItem(
tmp_tuple_element_3,
const_str_plain___init__
);
if ( test_value )
{
Py_DECREF( test_value );
int res = PyObject_DelItem(
tmp_tuple_element_3,
const_str_plain___init__
);
tmp_result = res == 0;
}
else
{
CLEAR_ERROR_OCCURRED();
tmp_result = true;
}
}
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_args_name_2 );
Py_DECREF( tmp_tuple_element_3 );
exception_lineno = 9;
goto try_except_handler_5;
}
PyTuple_SET_ITEM( tmp_args_name_2, 2, tmp_tuple_element_3 );
tmp_kw_name_2 = tmp_class_creation_1__class_decl_dict;
CHECK_OBJECT( tmp_kw_name_2 );
frame_3373b6532797b8bba981ca5cb6bcd3ab->m_frame.f_lineno = 9;
tmp_assign_source_27 = CALL_FUNCTION( tmp_called_name_3, tmp_args_name_2, tmp_kw_name_2 );
Py_DECREF( tmp_args_name_2 );
if ( tmp_assign_source_27 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 9;
goto try_except_handler_5;
}
assert( outline_0_var___class__ == NULL );
outline_0_var___class__ = tmp_assign_source_27;
tmp_outline_return_value_1 = outline_0_var___class__;
CHECK_OBJECT( tmp_outline_return_value_1 );
Py_INCREF( tmp_outline_return_value_1 );
goto try_return_handler_5;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion );
return MOD_RETURN_VALUE( NULL );
// Return handler code:
try_return_handler_5:;
CHECK_OBJECT( (PyObject *)outline_0_var___class__ );
Py_DECREF( outline_0_var___class__ );
outline_0_var___class__ = NULL;
Py_XDECREF( outline_0_var___qualname__ );
outline_0_var___qualname__ = NULL;
Py_XDECREF( outline_0_var___module__ );
outline_0_var___module__ = NULL;
Py_XDECREF( outline_0_var___init__ );
outline_0_var___init__ = NULL;
goto outline_result_1;
// Exception handler code:
try_except_handler_5:;
exception_keeper_type_4 = exception_type;
exception_keeper_value_4 = exception_value;
exception_keeper_tb_4 = exception_tb;
exception_keeper_lineno_4 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( outline_0_var___qualname__ );
outline_0_var___qualname__ = NULL;
Py_XDECREF( outline_0_var___module__ );
outline_0_var___module__ = NULL;
Py_XDECREF( outline_0_var___init__ );
outline_0_var___init__ = NULL;
// Re-raise.
exception_type = exception_keeper_type_4;
exception_value = exception_keeper_value_4;
exception_tb = exception_keeper_tb_4;
exception_lineno = exception_keeper_lineno_4;
goto outline_exception_1;
// End of try:
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$db$models$deletion );
return MOD_RETURN_VALUE( NULL );
outline_exception_1:;
exception_lineno = 9;
goto try_except_handler_4;
outline_result_1:;
tmp_assign_source_23 = tmp_outline_return_value_1;
UPDATE_STRING_DICT1( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_ProtectedError, tmp_assign_source_23 );
goto try_end_4;
// Exception handler code:
try_except_handler_4:;
exception_keeper_type_5 = exception_type;
exception_keeper_value_5 = exception_value;
exception_keeper_tb_5 = exception_tb;
exception_keeper_lineno_5 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_class_creation_1__bases );
tmp_class_creation_1__bases = NULL;
Py_XDECREF( tmp_class_creation_1__class_decl_dict );
tmp_class_creation_1__class_decl_dict = NULL;
Py_XDECREF( tmp_class_creation_1__metaclass );
tmp_class_creation_1__metaclass = NULL;
Py_XDECREF( tmp_class_creation_1__prepared );
tmp_class_creation_1__prepared = NULL;
// Re-raise.
exception_type = exception_keeper_type_5;
exception_value = exception_keeper_value_5;
exception_tb = exception_keeper_tb_5;
exception_lineno = exception_keeper_lineno_5;
goto frame_exception_exit_1;
// End of try:
try_end_4:;
Py_XDECREF( tmp_class_creation_1__bases );
tmp_class_creation_1__bases = NULL;
Py_XDECREF( tmp_class_creation_1__class_decl_dict );
tmp_class_creation_1__class_decl_dict = NULL;
Py_XDECREF( tmp_class_creation_1__metaclass );
tmp_class_creation_1__metaclass = NULL;
Py_XDECREF( tmp_class_creation_1__prepared );
tmp_class_creation_1__prepared = NULL;
tmp_assign_source_28 = MAKE_FUNCTION_django$db$models$deletion$$$function_2_CASCADE( );
UPDATE_STRING_DICT1( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_CASCADE, tmp_assign_source_28 );
tmp_assign_source_29 = MAKE_FUNCTION_django$db$models$deletion$$$function_3_PROTECT( );
UPDATE_STRING_DICT1( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_PROTECT, tmp_assign_source_29 );
tmp_assign_source_30 = MAKE_FUNCTION_django$db$models$deletion$$$function_4_SET( );
UPDATE_STRING_DICT1( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_SET, tmp_assign_source_30 );
tmp_assign_source_31 = MAKE_FUNCTION_django$db$models$deletion$$$function_5_SET_NULL( );
UPDATE_STRING_DICT1( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_SET_NULL, tmp_assign_source_31 );
tmp_assign_source_32 = MAKE_FUNCTION_django$db$models$deletion$$$function_6_SET_DEFAULT( );
UPDATE_STRING_DICT1( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_SET_DEFAULT, tmp_assign_source_32 );
tmp_assign_source_33 = MAKE_FUNCTION_django$db$models$deletion$$$function_7_DO_NOTHING( );
UPDATE_STRING_DICT1( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_DO_NOTHING, tmp_assign_source_33 );
tmp_assign_source_34 = MAKE_FUNCTION_django$db$models$deletion$$$function_8_get_candidate_relations_to_delete( );
UPDATE_STRING_DICT1( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_get_candidate_relations_to_delete, tmp_assign_source_34 );
tmp_assign_source_35 = const_tuple_type_object_tuple;
assert( tmp_class_creation_2__bases == NULL );
Py_INCREF( tmp_assign_source_35 );
tmp_class_creation_2__bases = tmp_assign_source_35;
tmp_assign_source_36 = PyDict_New();
assert( tmp_class_creation_2__class_decl_dict == NULL );
tmp_class_creation_2__class_decl_dict = tmp_assign_source_36;
// Tried code:
tmp_compare_left_3 = const_str_plain_metaclass;
tmp_compare_right_3 = tmp_class_creation_2__class_decl_dict;
CHECK_OBJECT( tmp_compare_right_3 );
tmp_cmp_In_3 = PySequence_Contains( tmp_compare_right_3, tmp_compare_left_3 );
assert( !(tmp_cmp_In_3 == -1) );
if ( tmp_cmp_In_3 == 1 )
{
goto condexpr_true_4;
}
else
{
goto condexpr_false_4;
}
condexpr_true_4:;
tmp_dict_name_2 = tmp_class_creation_2__class_decl_dict;
CHECK_OBJECT( tmp_dict_name_2 );
tmp_key_name_2 = const_str_plain_metaclass;
tmp_metaclass_name_2 = DICT_GET_ITEM( tmp_dict_name_2, tmp_key_name_2 );
if ( tmp_metaclass_name_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 64;
goto try_except_handler_6;
}
goto condexpr_end_4;
condexpr_false_4:;
tmp_cond_value_2 = tmp_class_creation_2__bases;
CHECK_OBJECT( tmp_cond_value_2 );
tmp_cond_truth_2 = CHECK_IF_TRUE( tmp_cond_value_2 );
if ( tmp_cond_truth_2 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 64;
goto try_except_handler_6;
}
if ( tmp_cond_truth_2 == 1 )
{
goto condexpr_true_5;
}
else
{
goto condexpr_false_5;
}
condexpr_true_5:;
tmp_subscribed_name_2 = tmp_class_creation_2__bases;
CHECK_OBJECT( tmp_subscribed_name_2 );
tmp_subscript_name_2 = const_int_0;
tmp_type_arg_2 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_2, tmp_subscript_name_2 );
if ( tmp_type_arg_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 64;
goto try_except_handler_6;
}
tmp_metaclass_name_2 = BUILTIN_TYPE1( tmp_type_arg_2 );
Py_DECREF( tmp_type_arg_2 );
if ( tmp_metaclass_name_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 64;
goto try_except_handler_6;
}
goto condexpr_end_5;
condexpr_false_5:;
tmp_metaclass_name_2 = (PyObject *)&PyType_Type;
Py_INCREF( tmp_metaclass_name_2 );
condexpr_end_5:;
condexpr_end_4:;
tmp_bases_name_2 = tmp_class_creation_2__bases;
CHECK_OBJECT( tmp_bases_name_2 );
tmp_assign_source_37 = SELECT_METACLASS( tmp_metaclass_name_2, tmp_bases_name_2 );
if ( tmp_assign_source_37 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_metaclass_name_2 );
exception_lineno = 64;
goto try_except_handler_6;
}
Py_DECREF( tmp_metaclass_name_2 );
assert( tmp_class_creation_2__metaclass == NULL );
tmp_class_creation_2__metaclass = tmp_assign_source_37;
tmp_compare_left_4 = const_str_plain_metaclass;
tmp_compare_right_4 = tmp_class_creation_2__class_decl_dict;
CHECK_OBJECT( tmp_compare_right_4 );
tmp_cmp_In_4 = PySequence_Contains( tmp_compare_right_4, tmp_compare_left_4 );
assert( !(tmp_cmp_In_4 == -1) );
if ( tmp_cmp_In_4 == 1 )
{
goto branch_yes_2;
}
else
{
goto branch_no_2;
}
branch_yes_2:;
tmp_dictdel_dict = tmp_class_creation_2__class_decl_dict;
CHECK_OBJECT( tmp_dictdel_dict );
tmp_dictdel_key = const_str_plain_metaclass;
tmp_result = DICT_REMOVE_ITEM( tmp_dictdel_dict, tmp_dictdel_key );
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 64;
goto try_except_handler_6;
}
branch_no_2:;
tmp_hasattr_source_2 = tmp_class_creation_2__metaclass;
CHECK_OBJECT( tmp_hasattr_source_2 );
tmp_hasattr_attr_2 = const_str_plain___prepare__;
tmp_res = PyObject_HasAttr( tmp_hasattr_source_2, tmp_hasattr_attr_2 );
if ( tmp_res == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 64;
goto try_except_handler_6;
}
if ( tmp_res == 1 )
{
goto condexpr_true_6;
}
else
{
goto condexpr_false_6;
}
condexpr_true_6:;
tmp_source_name_2 = tmp_class_creation_2__metaclass;
CHECK_OBJECT( tmp_source_name_2 );
tmp_called_name_4 = LOOKUP_ATTRIBUTE( tmp_source_name_2, const_str_plain___prepare__ );
if ( tmp_called_name_4 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 64;
goto try_except_handler_6;
}
tmp_args_name_3 = PyTuple_New( 2 );
tmp_tuple_element_4 = const_str_plain_Collector;
Py_INCREF( tmp_tuple_element_4 );
PyTuple_SET_ITEM( tmp_args_name_3, 0, tmp_tuple_element_4 );
tmp_tuple_element_4 = tmp_class_creation_2__bases;
CHECK_OBJECT( tmp_tuple_element_4 );
Py_INCREF( tmp_tuple_element_4 );
PyTuple_SET_ITEM( tmp_args_name_3, 1, tmp_tuple_element_4 );
tmp_kw_name_3 = tmp_class_creation_2__class_decl_dict;
CHECK_OBJECT( tmp_kw_name_3 );
frame_3373b6532797b8bba981ca5cb6bcd3ab->m_frame.f_lineno = 64;
tmp_assign_source_38 = CALL_FUNCTION( tmp_called_name_4, tmp_args_name_3, tmp_kw_name_3 );
Py_DECREF( tmp_called_name_4 );
Py_DECREF( tmp_args_name_3 );
if ( tmp_assign_source_38 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 64;
goto try_except_handler_6;
}
goto condexpr_end_6;
condexpr_false_6:;
tmp_assign_source_38 = PyDict_New();
condexpr_end_6:;
assert( tmp_class_creation_2__prepared == NULL );
tmp_class_creation_2__prepared = tmp_assign_source_38;
tmp_set_locals = tmp_class_creation_2__prepared;
CHECK_OBJECT( tmp_set_locals );
Py_DECREF(locals_dict_2);
locals_dict_2 = tmp_set_locals;
Py_INCREF( tmp_set_locals );
tmp_assign_source_40 = const_str_digest_dd38da9eafc032377ee2d8f2b673b5a7;
assert( outline_1_var___module__ == NULL );
Py_INCREF( tmp_assign_source_40 );
outline_1_var___module__ = tmp_assign_source_40;
tmp_assign_source_41 = const_str_plain_Collector;
assert( outline_1_var___qualname__ == NULL );
Py_INCREF( tmp_assign_source_41 );
outline_1_var___qualname__ = tmp_assign_source_41;
tmp_assign_source_42 = MAKE_FUNCTION_django$db$models$deletion$$$function_9___init__( );
assert( outline_1_var___init__ == NULL );
outline_1_var___init__ = tmp_assign_source_42;
tmp_defaults_1 = const_tuple_none_false_false_tuple;
Py_INCREF( tmp_defaults_1 );
tmp_assign_source_43 = MAKE_FUNCTION_django$db$models$deletion$$$function_10_add( tmp_defaults_1 );
assert( outline_1_var_add == NULL );
outline_1_var_add = tmp_assign_source_43;
tmp_assign_source_44 = MAKE_FUNCTION_django$db$models$deletion$$$function_11_add_field_update( );
assert( outline_1_var_add_field_update == NULL );
outline_1_var_add_field_update = tmp_assign_source_44;
tmp_defaults_2 = const_tuple_none_tuple;
Py_INCREF( tmp_defaults_2 );
tmp_assign_source_45 = MAKE_FUNCTION_django$db$models$deletion$$$function_12_can_fast_delete( tmp_defaults_2 );
assert( outline_1_var_can_fast_delete == NULL );
outline_1_var_can_fast_delete = tmp_assign_source_45;
tmp_assign_source_46 = MAKE_FUNCTION_django$db$models$deletion$$$function_13_get_del_batches( );
assert( outline_1_var_get_del_batches == NULL );
outline_1_var_get_del_batches = tmp_assign_source_46;
tmp_defaults_3 = const_tuple_none_false_true_none_false_false_tuple;
Py_INCREF( tmp_defaults_3 );
tmp_assign_source_47 = MAKE_FUNCTION_django$db$models$deletion$$$function_14_collect( tmp_defaults_3 );
assert( outline_1_var_collect == NULL );
outline_1_var_collect = tmp_assign_source_47;
tmp_assign_source_48 = MAKE_FUNCTION_django$db$models$deletion$$$function_15_related_objects( );
assert( outline_1_var_related_objects == NULL );
outline_1_var_related_objects = tmp_assign_source_48;
tmp_assign_source_49 = MAKE_FUNCTION_django$db$models$deletion$$$function_16_instances_with_model( );
assert( outline_1_var_instances_with_model == NULL );
outline_1_var_instances_with_model = tmp_assign_source_49;
tmp_assign_source_50 = MAKE_FUNCTION_django$db$models$deletion$$$function_17_sort( );
assert( outline_1_var_sort == NULL );
outline_1_var_sort = tmp_assign_source_50;
tmp_assign_source_51 = MAKE_FUNCTION_django$db$models$deletion$$$function_18_delete( );
assert( outline_1_var_delete == NULL );
outline_1_var_delete = tmp_assign_source_51;
// Tried code:
tmp_called_name_5 = tmp_class_creation_2__metaclass;
CHECK_OBJECT( tmp_called_name_5 );
tmp_args_name_4 = PyTuple_New( 3 );
tmp_tuple_element_5 = const_str_plain_Collector;
Py_INCREF( tmp_tuple_element_5 );
PyTuple_SET_ITEM( tmp_args_name_4, 0, tmp_tuple_element_5 );
tmp_tuple_element_5 = tmp_class_creation_2__bases;
CHECK_OBJECT( tmp_tuple_element_5 );
Py_INCREF( tmp_tuple_element_5 );
PyTuple_SET_ITEM( tmp_args_name_4, 1, tmp_tuple_element_5 );
tmp_tuple_element_5 = locals_dict_2;
Py_INCREF( tmp_tuple_element_5 );
if ( outline_1_var___qualname__ != NULL )
{
int res = PyObject_SetItem(
tmp_tuple_element_5,
const_str_plain___qualname__,
outline_1_var___qualname__
);
tmp_result = res == 0;
}
else
{
PyObject *test_value = PyObject_GetItem(
tmp_tuple_element_5,
const_str_plain___qualname__
);
if ( test_value )
{
Py_DECREF( test_value );
int res = PyObject_DelItem(
tmp_tuple_element_5,
const_str_plain___qualname__
);
tmp_result = res == 0;
}
else
{
CLEAR_ERROR_OCCURRED();
tmp_result = true;
}
}
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_args_name_4 );
Py_DECREF( tmp_tuple_element_5 );
exception_lineno = 64;
goto try_except_handler_7;
}
if ( outline_1_var___module__ != NULL )
{
int res = PyObject_SetItem(
tmp_tuple_element_5,
const_str_plain___module__,
outline_1_var___module__
);
tmp_result = res == 0;
}
else
{
PyObject *test_value = PyObject_GetItem(
tmp_tuple_element_5,
const_str_plain___module__
);
if ( test_value )
{
Py_DECREF( test_value );
int res = PyObject_DelItem(
tmp_tuple_element_5,
const_str_plain___module__
);
tmp_result = res == 0;
}
else
{
CLEAR_ERROR_OCCURRED();
tmp_result = true;
}
}
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_args_name_4 );
Py_DECREF( tmp_tuple_element_5 );
exception_lineno = 64;
goto try_except_handler_7;
}
if ( outline_1_var___init__ != NULL )
{
int res = PyObject_SetItem(
tmp_tuple_element_5,
const_str_plain___init__,
outline_1_var___init__
);
tmp_result = res == 0;
}
else
{
PyObject *test_value = PyObject_GetItem(
tmp_tuple_element_5,
const_str_plain___init__
);
if ( test_value )
{
Py_DECREF( test_value );
int res = PyObject_DelItem(
tmp_tuple_element_5,
const_str_plain___init__
);
tmp_result = res == 0;
}
else
{
CLEAR_ERROR_OCCURRED();
tmp_result = true;
}
}
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_args_name_4 );
Py_DECREF( tmp_tuple_element_5 );
exception_lineno = 64;
goto try_except_handler_7;
}
if ( outline_1_var_add != NULL )
{
int res = PyObject_SetItem(
tmp_tuple_element_5,
const_str_plain_add,
outline_1_var_add
);
tmp_result = res == 0;
}
else
{
PyObject *test_value = PyObject_GetItem(
tmp_tuple_element_5,
const_str_plain_add
);
if ( test_value )
{
Py_DECREF( test_value );
int res = PyObject_DelItem(
tmp_tuple_element_5,
const_str_plain_add
);
tmp_result = res == 0;
}
else
{
CLEAR_ERROR_OCCURRED();
tmp_result = true;
}
}
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_args_name_4 );
Py_DECREF( tmp_tuple_element_5 );
exception_lineno = 64;
goto try_except_handler_7;
}
if ( outline_1_var_add_field_update != NULL )
{
int res = PyObject_SetItem(
tmp_tuple_element_5,
const_str_plain_add_field_update,
outline_1_var_add_field_update
);
tmp_result = res == 0;
}
else
{
PyObject *test_value = PyObject_GetItem(
tmp_tuple_element_5,
const_str_plain_add_field_update
);
if ( test_value )
{
Py_DECREF( test_value );
int res = PyObject_DelItem(
tmp_tuple_element_5,
const_str_plain_add_field_update
);
tmp_result = res == 0;
}
else
{
CLEAR_ERROR_OCCURRED();
tmp_result = true;
}
}
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_args_name_4 );
Py_DECREF( tmp_tuple_element_5 );
exception_lineno = 64;
goto try_except_handler_7;
}
if ( outline_1_var_can_fast_delete != NULL )
{
int res = PyObject_SetItem(
tmp_tuple_element_5,
const_str_plain_can_fast_delete,
outline_1_var_can_fast_delete
);
tmp_result = res == 0;
}
else
{
PyObject *test_value = PyObject_GetItem(
tmp_tuple_element_5,
const_str_plain_can_fast_delete
);
if ( test_value )
{
Py_DECREF( test_value );
int res = PyObject_DelItem(
tmp_tuple_element_5,
const_str_plain_can_fast_delete
);
tmp_result = res == 0;
}
else
{
CLEAR_ERROR_OCCURRED();
tmp_result = true;
}
}
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_args_name_4 );
Py_DECREF( tmp_tuple_element_5 );
exception_lineno = 64;
goto try_except_handler_7;
}
if ( outline_1_var_get_del_batches != NULL )
{
int res = PyObject_SetItem(
tmp_tuple_element_5,
const_str_plain_get_del_batches,
outline_1_var_get_del_batches
);
tmp_result = res == 0;
}
else
{
PyObject *test_value = PyObject_GetItem(
tmp_tuple_element_5,
const_str_plain_get_del_batches
);
if ( test_value )
{
Py_DECREF( test_value );
int res = PyObject_DelItem(
tmp_tuple_element_5,
const_str_plain_get_del_batches
);
tmp_result = res == 0;
}
else
{
CLEAR_ERROR_OCCURRED();
tmp_result = true;
}
}
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_args_name_4 );
Py_DECREF( tmp_tuple_element_5 );
exception_lineno = 64;
goto try_except_handler_7;
}
if ( outline_1_var_collect != NULL )
{
int res = PyObject_SetItem(
tmp_tuple_element_5,
const_str_plain_collect,
outline_1_var_collect
);
tmp_result = res == 0;
}
else
{
PyObject *test_value = PyObject_GetItem(
tmp_tuple_element_5,
const_str_plain_collect
);
if ( test_value )
{
Py_DECREF( test_value );
int res = PyObject_DelItem(
tmp_tuple_element_5,
const_str_plain_collect
);
tmp_result = res == 0;
}
else
{
CLEAR_ERROR_OCCURRED();
tmp_result = true;
}
}
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_args_name_4 );
Py_DECREF( tmp_tuple_element_5 );
exception_lineno = 64;
goto try_except_handler_7;
}
if ( outline_1_var_related_objects != NULL )
{
int res = PyObject_SetItem(
tmp_tuple_element_5,
const_str_plain_related_objects,
outline_1_var_related_objects
);
tmp_result = res == 0;
}
else
{
PyObject *test_value = PyObject_GetItem(
tmp_tuple_element_5,
const_str_plain_related_objects
);
if ( test_value )
{
Py_DECREF( test_value );
int res = PyObject_DelItem(
tmp_tuple_element_5,
const_str_plain_related_objects
);
tmp_result = res == 0;
}
else
{
CLEAR_ERROR_OCCURRED();
tmp_result = true;
}
}
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_args_name_4 );
Py_DECREF( tmp_tuple_element_5 );
exception_lineno = 64;
goto try_except_handler_7;
}
if ( outline_1_var_instances_with_model != NULL )
{
int res = PyObject_SetItem(
tmp_tuple_element_5,
const_str_plain_instances_with_model,
outline_1_var_instances_with_model
);
tmp_result = res == 0;
}
else
{
PyObject *test_value = PyObject_GetItem(
tmp_tuple_element_5,
const_str_plain_instances_with_model
);
if ( test_value )
{
Py_DECREF( test_value );
int res = PyObject_DelItem(
tmp_tuple_element_5,
const_str_plain_instances_with_model
);
tmp_result = res == 0;
}
else
{
CLEAR_ERROR_OCCURRED();
tmp_result = true;
}
}
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_args_name_4 );
Py_DECREF( tmp_tuple_element_5 );
exception_lineno = 64;
goto try_except_handler_7;
}
if ( outline_1_var_sort != NULL )
{
int res = PyObject_SetItem(
tmp_tuple_element_5,
const_str_plain_sort,
outline_1_var_sort
);
tmp_result = res == 0;
}
else
{
PyObject *test_value = PyObject_GetItem(
tmp_tuple_element_5,
const_str_plain_sort
);
if ( test_value )
{
Py_DECREF( test_value );
int res = PyObject_DelItem(
tmp_tuple_element_5,
const_str_plain_sort
);
tmp_result = res == 0;
}
else
{
CLEAR_ERROR_OCCURRED();
tmp_result = true;
}
}
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_args_name_4 );
Py_DECREF( tmp_tuple_element_5 );
exception_lineno = 64;
goto try_except_handler_7;
}
if ( outline_1_var_delete != NULL )
{
int res = PyObject_SetItem(
tmp_tuple_element_5,
const_str_plain_delete,
outline_1_var_delete
);
tmp_result = res == 0;
}
else
{
PyObject *test_value = PyObject_GetItem(
tmp_tuple_element_5,
const_str_plain_delete
);
if ( test_value )
{
Py_DECREF( test_value );
int res = PyObject_DelItem(
tmp_tuple_element_5,
const_str_plain_delete
);
tmp_result = res == 0;
}
else
{
CLEAR_ERROR_OCCURRED();
tmp_result = true;
}
}
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_args_name_4 );
Py_DECREF( tmp_tuple_element_5 );
exception_lineno = 64;
goto try_except_handler_7;
}
PyTuple_SET_ITEM( tmp_args_name_4, 2, tmp_tuple_element_5 );
tmp_kw_name_4 = tmp_class_creation_2__class_decl_dict;
CHECK_OBJECT( tmp_kw_name_4 );
frame_3373b6532797b8bba981ca5cb6bcd3ab->m_frame.f_lineno = 64;
tmp_assign_source_52 = CALL_FUNCTION( tmp_called_name_5, tmp_args_name_4, tmp_kw_name_4 );
Py_DECREF( tmp_args_name_4 );
if ( tmp_assign_source_52 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 64;
goto try_except_handler_7;
}
assert( outline_1_var___class__ == NULL );
outline_1_var___class__ = tmp_assign_source_52;
tmp_outline_return_value_2 = outline_1_var___class__;
CHECK_OBJECT( tmp_outline_return_value_2 );
Py_INCREF( tmp_outline_return_value_2 );
goto try_return_handler_7;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$db$models$deletion );
return MOD_RETURN_VALUE( NULL );
// Return handler code:
try_return_handler_7:;
CHECK_OBJECT( (PyObject *)outline_1_var___class__ );
Py_DECREF( outline_1_var___class__ );
outline_1_var___class__ = NULL;
Py_XDECREF( outline_1_var___qualname__ );
outline_1_var___qualname__ = NULL;
Py_XDECREF( outline_1_var___module__ );
outline_1_var___module__ = NULL;
Py_XDECREF( outline_1_var___init__ );
outline_1_var___init__ = NULL;
Py_XDECREF( outline_1_var_add );
outline_1_var_add = NULL;
Py_XDECREF( outline_1_var_add_field_update );
outline_1_var_add_field_update = NULL;
Py_XDECREF( outline_1_var_can_fast_delete );
outline_1_var_can_fast_delete = NULL;
Py_XDECREF( outline_1_var_get_del_batches );
outline_1_var_get_del_batches = NULL;
Py_XDECREF( outline_1_var_collect );
outline_1_var_collect = NULL;
Py_XDECREF( outline_1_var_related_objects );
outline_1_var_related_objects = NULL;
Py_XDECREF( outline_1_var_instances_with_model );
outline_1_var_instances_with_model = NULL;
Py_XDECREF( outline_1_var_sort );
outline_1_var_sort = NULL;
Py_XDECREF( outline_1_var_delete );
outline_1_var_delete = NULL;
goto outline_result_2;
// Exception handler code:
try_except_handler_7:;
exception_keeper_type_6 = exception_type;
exception_keeper_value_6 = exception_value;
exception_keeper_tb_6 = exception_tb;
exception_keeper_lineno_6 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( outline_1_var___qualname__ );
outline_1_var___qualname__ = NULL;
Py_XDECREF( outline_1_var___module__ );
outline_1_var___module__ = NULL;
Py_XDECREF( outline_1_var___init__ );
outline_1_var___init__ = NULL;
Py_XDECREF( outline_1_var_add );
outline_1_var_add = NULL;
Py_XDECREF( outline_1_var_add_field_update );
outline_1_var_add_field_update = NULL;
Py_XDECREF( outline_1_var_can_fast_delete );
outline_1_var_can_fast_delete = NULL;
Py_XDECREF( outline_1_var_get_del_batches );
outline_1_var_get_del_batches = NULL;
Py_XDECREF( outline_1_var_collect );
outline_1_var_collect = NULL;
Py_XDECREF( outline_1_var_related_objects );
outline_1_var_related_objects = NULL;
Py_XDECREF( outline_1_var_instances_with_model );
outline_1_var_instances_with_model = NULL;
Py_XDECREF( outline_1_var_sort );
outline_1_var_sort = NULL;
Py_XDECREF( outline_1_var_delete );
outline_1_var_delete = NULL;
// Re-raise.
exception_type = exception_keeper_type_6;
exception_value = exception_keeper_value_6;
exception_tb = exception_keeper_tb_6;
exception_lineno = exception_keeper_lineno_6;
goto outline_exception_2;
// End of try:
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$db$models$deletion );
return MOD_RETURN_VALUE( NULL );
outline_exception_2:;
exception_lineno = 64;
goto try_except_handler_6;
outline_result_2:;
tmp_assign_source_39 = tmp_outline_return_value_2;
UPDATE_STRING_DICT1( moduledict_django$db$models$deletion, (Nuitka_StringObject *)const_str_plain_Collector, tmp_assign_source_39 );
goto try_end_5;
// Exception handler code:
try_except_handler_6:;
exception_keeper_type_7 = exception_type;
exception_keeper_value_7 = exception_value;
exception_keeper_tb_7 = exception_tb;
exception_keeper_lineno_7 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_class_creation_2__bases );
tmp_class_creation_2__bases = NULL;
Py_XDECREF( tmp_class_creation_2__class_decl_dict );
tmp_class_creation_2__class_decl_dict = NULL;
Py_XDECREF( tmp_class_creation_2__metaclass );
tmp_class_creation_2__metaclass = NULL;
Py_XDECREF( tmp_class_creation_2__prepared );
tmp_class_creation_2__prepared = NULL;
// Re-raise.
exception_type = exception_keeper_type_7;
exception_value = exception_keeper_value_7;
exception_tb = exception_keeper_tb_7;
exception_lineno = exception_keeper_lineno_7;
goto frame_exception_exit_1;
// End of try:
try_end_5:;
// Restore frame exception if necessary.
#if 0
RESTORE_FRAME_EXCEPTION( frame_3373b6532797b8bba981ca5cb6bcd3ab );
#endif
popFrameStack();
assertFrameObject( frame_3373b6532797b8bba981ca5cb6bcd3ab );
goto frame_no_exception_1;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_3373b6532797b8bba981ca5cb6bcd3ab );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( frame_3373b6532797b8bba981ca5cb6bcd3ab, exception_lineno );
}
else if ( exception_tb->tb_frame != &frame_3373b6532797b8bba981ca5cb6bcd3ab->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, frame_3373b6532797b8bba981ca5cb6bcd3ab, exception_lineno );
}
// Put the previous frame back on top.
popFrameStack();
// Return the error.
goto module_exception_exit;
frame_no_exception_1:;
Py_XDECREF( tmp_class_creation_2__bases );
tmp_class_creation_2__bases = NULL;
Py_XDECREF( tmp_class_creation_2__class_decl_dict );
tmp_class_creation_2__class_decl_dict = NULL;
Py_XDECREF( tmp_class_creation_2__metaclass );
tmp_class_creation_2__metaclass = NULL;
Py_XDECREF( tmp_class_creation_2__prepared );
tmp_class_creation_2__prepared = NULL;
return MOD_RETURN_VALUE( module_django$db$models$deletion );
module_exception_exit:
RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
return MOD_RETURN_VALUE( NULL );
}
| 32.277617 | 434 | 0.704793 | [
"object",
"model"
] |
e8726f4da6184f032172f69cde818835b36278ad | 1,096 | hpp | C++ | Game/Utility.hpp | Mateusz00/Space-Invasion | a5c2b501454377f7496db91abbdebcb97ab3c814 | [
"BSD-2-Clause"
] | null | null | null | Game/Utility.hpp | Mateusz00/Space-Invasion | a5c2b501454377f7496db91abbdebcb97ab3c814 | [
"BSD-2-Clause"
] | 1 | 2018-11-18T14:48:56.000Z | 2018-11-26T19:21:07.000Z | Game/Utility.hpp | Mateusz00/2D-Fighter-Jet-Game | a5c2b501454377f7496db91abbdebcb97ab3c814 | [
"BSD-2-Clause"
] | null | null | null | #ifndef UTILITY_HPP
#define UTILITY_HPP
#include <SFML/Graphics/Sprite.hpp>
#include <SFML/Graphics/Text.hpp>
#include <SFML/Graphics/Shape.hpp>
#include <SFML/System/Vector2.hpp>
#include <SFML/Window/Keyboard.hpp>
#include <sstream>
#include <string>
#include <unordered_map>
struct StringKeyMap
{
StringKeyMap();
std::unordered_map<std::string, sf::Keyboard::Key> stringToKey;
};
template <typename T>
void centerOrigin(T&);
template <typename Obj, typename Txt>
void centerText(const Obj&, Txt&);
template <typename T>
std::string toString(const T& value);
std::string toString(sf::Keyboard::Key);
sf::Keyboard::Key toKey(const std::string&);
int randomInt(int minNumber, int maxNumberIncluded);
float vectorLength(sf::Vector2f position);
sf::Vector2f unitVector(sf::Vector2f distance);
sf::Vector2f unitVector(float x, float y);
float toRadian(float degree);
float toDegree(float rad);
bool isInRange(int low, int high, int number);
#include "Utility.inl"
#endif // UTILITY_HPP
| 26.731707 | 68 | 0.687956 | [
"shape"
] |
e877d4d3d5afc93c652e1c5655c555db5f048a33 | 692 | cc | C++ | Geometry/ForwardGeometry/plugins/moduleDB.cc | nistefan/cmssw | ea13af97f7f2117a4f590a5e654e06ecd9825a5b | [
"Apache-2.0"
] | 3 | 2018-08-24T19:10:26.000Z | 2019-02-19T11:45:32.000Z | Geometry/ForwardGeometry/plugins/moduleDB.cc | nistefan/cmssw | ea13af97f7f2117a4f590a5e654e06ecd9825a5b | [
"Apache-2.0"
] | 3 | 2018-08-23T13:40:24.000Z | 2019-12-05T21:16:03.000Z | Geometry/ForwardGeometry/plugins/moduleDB.cc | nistefan/cmssw | ea13af97f7f2117a4f590a5e654e06ecd9825a5b | [
"Apache-2.0"
] | 5 | 2018-08-21T16:37:52.000Z | 2020-01-09T13:33:17.000Z | #include "Geometry/ForwardGeometry/interface/ZdcGeometry.h"
#include "Geometry/ForwardGeometry/interface/CastorGeometry.h"
#include "Geometry/CaloEventSetup/interface/CaloGeometryDBEP.h"
#include "Geometry/CaloEventSetup/interface/CaloGeometryDBReader.h"
template class CaloGeometryDBEP< ZdcGeometry , CaloGeometryDBReader > ;
template class CaloGeometryDBEP< CastorGeometry , CaloGeometryDBReader > ;
typedef CaloGeometryDBEP< ZdcGeometry , CaloGeometryDBReader > ZdcGeometryFromDBEP ;
DEFINE_FWK_EVENTSETUP_MODULE(ZdcGeometryFromDBEP);
typedef CaloGeometryDBEP< CastorGeometry , CaloGeometryDBReader > CastorGeometryFromDBEP ;
DEFINE_FWK_EVENTSETUP_MODULE(CastorGeometryFromDBEP);
| 40.705882 | 90 | 0.854046 | [
"geometry"
] |
e8784a781febdbf74c786b823af873a9dfa69a8a | 1,632 | hpp | C++ | core/include/TXPK/Math/MathExtension.hpp | Seng3694/TXPK | 76a5441dc70b4a5d5d2596525de950a2d2e65aab | [
"MIT"
] | 6 | 2019-01-05T08:14:02.000Z | 2021-12-02T18:29:35.000Z | core/include/TXPK/Math/MathExtension.hpp | lineCode/TXPK | 20d4cd75611a44babf2bf41d5359141020dc6684 | [
"MIT"
] | 1 | 2018-03-28T06:33:08.000Z | 2018-03-29T08:22:43.000Z | core/include/TXPK/Math/MathExtension.hpp | Seng3694/TexturePacker | 76a5441dc70b4a5d5d2596525de950a2d2e65aab | [
"MIT"
] | 2 | 2018-12-11T01:11:20.000Z | 2020-10-30T08:14:04.000Z | #pragma once
#include <algorithm>
#include <cmath>
#include <vector>
namespace txpk
{
/**
* \brief A macro which returns the larger value.
* \param lhs The first value.
* \param rhs The second value.
* \return Returns the larger value.
*/
#define MAX(lhs, rhs) (lhs > rhs ? lhs : rhs)
/**
* \brief A macro which returns the smaller value.
* \param lhs The first value.
* \param rhs The second value.
* \return Returns the smaller value.
*/
#define MIN(lhs, rhs) (lhs < rhs ? lhs : rhs)
/**
* \brief Checks whether the number is prime or not.
* \param number The number to check.
* \return Returns true if the number is prime.
*/
bool is_prime(int number);
/**
* \brief Calculates the largest prime factor of the number.
* \param number The number to calculate the prime factor from.
* \return Returns the prime factor.
*/
int largest_prime_factor(int number);
/**
* \brief Calculates all prime factors of the number.
* \param number The number to calculate the prime factors from.
* \return Returns a vector with the prime factors.
*/
std::vector<int> get_prime_factors(int number);
/**
* \brief Calculates two large factors which multiplied result in the number.
* The function calculates the prime factors and multiplies the smallest factors until there are just factors left.
* examples:
* number=8 => prime factors => 2*2*2 => resulting factors => 4*2
* number=12 => prime factors => 2*2*3 => resulting factors => 4*3
* \param number The number to calculate the factors from.
* \return Returns a vector with the two factors.
*/
std::vector<int> get_two_large_factors(int number);
}
| 30.792453 | 115 | 0.704044 | [
"vector"
] |
e87a3264f58fe61bc7e19045fa87554abc263740 | 31,932 | cpp | C++ | src/RelayComms.cpp | getbraincloud/braincloud-cpp | c7bc42e7bb2cc4d03d25348e1a6ecc77ee54db9e | [
"Apache-2.0"
] | null | null | null | src/RelayComms.cpp | getbraincloud/braincloud-cpp | c7bc42e7bb2cc4d03d25348e1a6ecc77ee54db9e | [
"Apache-2.0"
] | 20 | 2018-01-11T22:18:50.000Z | 2020-12-09T13:41:22.000Z | src/RelayComms.cpp | getbraincloud/braincloud-cpp | c7bc42e7bb2cc4d03d25348e1a6ecc77ee54db9e | [
"Apache-2.0"
] | 16 | 2018-01-09T16:01:36.000Z | 2022-03-15T00:51:59.000Z | // Copyright 2020 bitHeads, Inc. All Rights Reserved.
#include "braincloud/BrainCloudClient.h"
#include "braincloud/IRelayConnectCallback.h"
#include "braincloud/IRelayCallback.h"
#include "braincloud/IRelaySystemCallback.h"
#include "braincloud/internal/IRelayTCPSocket.h"
#include "braincloud/internal/IRelayUDPSocket.h"
#if (TARGET_OS_WATCH != 1)
#include "braincloud/internal/IWebSocket.h"
#endif
#include "braincloud/internal/RelayComms.h"
#include <algorithm>
#include <iostream>
#include <cstring>
#if !defined(WIN32)
#include <arpa/inet.h>
#endif
#define VERBOSE_LOG 0
static const int CONTROL_BYTES_SIZE = 1;
static const int MAX_PACKET_ID_HISTORY = 60 * 10; // So we last 10 seconds at 60 fps
static const int MAX_PLAYERS = 40;
static const int INVALID_NET_ID = MAX_PLAYERS;
// Messages sent from Client to Relay-Server
static const int CL2RS_CONNECT = 0;
static const int CL2RS_DISCONNECT = 1;
static const int CL2RS_RELAY = 2;
static const int CL2RS_ACK = 3;
static const int CL2RS_PING = 4;
static const int CL2RS_RSMG_ACK = 5;
// Messages sent from Relay-Server to Client
static const int RS2CL_RSMG = 0;
static const int RS2CL_DISCONNECT = 1;
static const int RS2CL_RELAY = 2;
static const int RS2CL_ACK = 3;
static const int RS2CL_PONG = 4;
static const int RELIABLE_BIT = 0x8000;
static const int ORDERED_BIT = 0x4000;
static const long CONNECT_RESEND_INTERVAL_MS = 500;
static const long MAX_RELIABLE_RESEND_INTERVAL_MS = 500;
static const int MAX_PACKET_ID = 0xFFF;
static const int PACKET_LOWER_THRESHOLD = MAX_PACKET_ID * 25 / 100;
static const int PACKET_HIGHER_THRESHOLD = MAX_PACKET_ID * 75 / 100;
static const int MAX_PACKET_SIZE = 1024;
static const int TIMEOUT_SECONDS = 10;
static const double RELIABLE_RESEND_INTERVALS[] = {
50.0, 50.0, // High priority 1 and 2
150.0, // Normal priority
500.0 // Low priority
};
static std::string extractProfileIdFromCxId(const std::string &cxId)
{
auto first = cxId.find_first_of(':');
auto last = cxId.find_last_of(':');
if (first == last) return ""; // If : not found, it should it npos for both too.
if (last - first < 2) return "";
return cxId.substr(first + 1, last - first - 1);
}
namespace BrainCloud
{
int RelayComms::Event::allocCount = 0;
int RelayComms::Packet::allocCount = 0;
RelayComms::RelayComms(BrainCloudClient* in_client)
: m_client(in_client)
, m_isInitialized(false)
{
m_isConnected = false;
m_isSocketConnected = false;
m_pingInterval = std::chrono::milliseconds(1000);
}
RelayComms::~RelayComms()
{
disconnect();
}
void RelayComms::initialize()
{
m_isInitialized = true;
}
bool RelayComms::isInitialized()
{
return m_isInitialized;
}
void RelayComms::shutdown()
{
resetCommunication();
m_isInitialized = false;
}
void RelayComms::resetCommunication()
{
disconnect();
}
void RelayComms::enableLogging(bool shouldEnable)
{
m_loggingEnabled = shouldEnable;
}
void RelayComms::connect(eRelayConnectionType in_connectionType, const std::string& host, int port, const std::string& passcode, const std::string& lobbyId, IRelayConnectCallback* in_callback)
{
if (m_isSocketConnected)
{
disconnect();
}
m_connectionType = in_connectionType;
m_connectOptions.host = host;
m_connectOptions.port = port;
m_connectOptions.passcode = passcode;
m_connectOptions.lobbyId = lobbyId;
m_pRelayConnectCallback = in_callback;
m_ping = 999;
m_pingInFlight = false;
m_netId = -1;
m_ownerProfileId.clear();
m_profileIdToNetId.clear();
m_netIdToProfileId.clear();
m_ownerCxId.clear();
m_cxIdToNetId.clear();
m_netIdToCxId.clear();
m_sendPacketId.clear();
m_recvPacketId.clear();
m_reliables.clear();
m_orderedReliablePackets.clear();
m_eventPool.reclaim();
m_packetPool.reclaim();
m_rsmgHistory.clear();
switch (m_connectionType)
{
case eRelayConnectionType::TCP:
{
m_pSocket = IRelayTCPSocket::create(host, port, MAX_PACKET_SIZE);
break;
}
case eRelayConnectionType::UDP:
{
m_pSocket = IRelayUDPSocket::create(host, port, MAX_PACKET_SIZE);
m_lastRecvTime = std::chrono::system_clock::now();
break;
}
default:
{
disconnect();
queueErrorEvent("Protocol Unimplemented");
break;
}
}
}
void RelayComms::disconnect()
{
m_isConnected = false;
m_isSocketConnected = false;
m_resendConnectRequest = false;
// Close socket
delete m_pSocket;
m_pSocket = nullptr;
m_sendPacketId.clear();
m_recvPacketId.clear();
m_rsmgHistory.clear();
m_reliables.clear();
m_orderedReliablePackets.clear();
m_packetPool.reclaim();
}
bool RelayComms::isConnected() const
{
return m_isConnected;
}
int RelayComms::getPing() const
{
return m_ping;
}
void RelayComms::setPingInterval(int in_intervalMS)
{
m_pingInterval = std::chrono::milliseconds(in_intervalMS);
}
const std::string& RelayComms::getOwnerProfileId() const
{
return m_ownerProfileId;
}
const std::string& RelayComms::getOwnerCxId() const
{
return m_ownerCxId;
}
const std::string& RelayComms::getProfileIdForNetId(int in_netId) const
{
auto it = m_netIdToProfileId.find(in_netId);
if (it == m_netIdToProfileId.end())
{
static std::string empty;
return empty;
}
return it->second;
}
int RelayComms::getNetIdForProfileId(const std::string& in_profileId) const
{
auto it = m_profileIdToNetId.find(in_profileId);
if (it == m_profileIdToNetId.end()) return INVALID_NET_ID;
return it->second;
}
const std::string& RelayComms::getCxIdForNetId(int in_netId) const
{
auto it = m_netIdToCxId.find(in_netId);
if (it == m_netIdToCxId.end())
{
static std::string empty;
return empty;
}
return it->second;
}
int RelayComms::getNetIdForCxId(const std::string& in_cxId) const
{
auto it = m_cxIdToNetId.find(in_cxId);
if (it == m_cxIdToNetId.end()) return INVALID_NET_ID;
return it->second;
}
void RelayComms::registerRelayCallback(IRelayCallback* in_callback)
{
m_pRelayCallback = in_callback;
}
void RelayComms::deregisterRelayCallback()
{
m_pRelayCallback = nullptr;
}
void RelayComms::registerSystemCallback(IRelaySystemCallback* in_callback)
{
m_pSystemCallback = in_callback;
}
void RelayComms::deregisterSystemCallback()
{
m_pSystemCallback = nullptr;
}
Json::Value RelayComms::buildConnectionRequest()
{
Json::Value request;
m_cxId = m_client->getRTTService()->getRTTConnectionId();
request["lobbyId"] = m_connectOptions.lobbyId;
request["cxId"] = m_cxId;
request["passcode"] = m_connectOptions.passcode;
request["version"] = m_client->getBrainCloudClientVersion();
return request;
}
void RelayComms::send(const uint8_t* in_data, int in_size, uint64_t in_playerMask, bool in_reliable, bool in_ordered, eRelayChannel in_channel)
{
if (!isConnected()) return;
if (in_size > 1024)
{
disconnect();
queueErrorEvent("Relay Error: Packet is too big " + std::to_string(in_size) + " > max 1024");
return;
}
// Allocate buffer
auto totalSize = in_size + 11;
auto pPacket = m_packetPool.alloc();
pPacket->data.resize(totalSize);
// Size
auto len = htons((u_short)totalSize);
memcpy(pPacket->data.data(), &len, 2);
// NetId
pPacket->data[2] = (uint8_t)CL2RS_RELAY;
// Reliable header
uint16_t rh = 0;
if (in_reliable) rh |= RELIABLE_BIT;
if (in_ordered) rh |= ORDERED_BIT;
rh |= ((uint16_t)in_channel << 12) & 0x3000;
// Store inverted player mask
uint64_t playerMask = 0;
for (uint64_t i = 0, len = (uint64_t)MAX_PLAYERS; i < len; ++i)
{
playerMask |= ((in_playerMask >> ((uint64_t)MAX_PLAYERS - i - 1)) & 1) << i;
}
playerMask = (playerMask << 8) & 0x0000FFFFFFFFFF00;
// AckId without packet id
uint64_t ackIdWithoutPacketId = (((uint64_t)rh << 48) & 0xFFFF000000000000) | playerMask;
// Packet Id
int packetId = 0;
auto it = m_sendPacketId.find(ackIdWithoutPacketId);
if (it != m_sendPacketId.end())
{
packetId = it->second;
}
m_sendPacketId[ackIdWithoutPacketId] = (packetId + 1) & MAX_PACKET_ID;
// Add packet id to the header, then encode
rh |= packetId;
auto rhBE = htons((u_short)rh);
auto playerMask0BE = (uint64_t)ntohs((u_short)((playerMask >> 32) & 0xFFFF));
auto playerMask1BE = (uint64_t)ntohs((u_short)((playerMask >> 16) & 0xFFFF));
auto playerMask2BE = (uint64_t)ntohs((u_short)((playerMask) & 0xFFFF));
memcpy(pPacket->data.data() + 3, &rhBE, 2);
memcpy(pPacket->data.data() + 5, &playerMask0BE, 2);
memcpy(pPacket->data.data() + 7, &playerMask1BE, 2);
memcpy(pPacket->data.data() + 9, &playerMask2BE, 2);
// Rest of data
memcpy(pPacket->data.data() + 11, in_data, in_size);
// Send
send(pPacket->data.data(), (int)pPacket->data.size());
// UDP, store reliable in send map
if (in_reliable)
{
pPacket->id = packetId;
pPacket->lastResendTime = std::chrono::system_clock::now();
pPacket->timeSinceFirstSend = pPacket->lastResendTime;
pPacket->resendInterval = RELIABLE_RESEND_INTERVALS[(int)in_channel];
uint64_t ackId = *(uint64_t*)(pPacket->data.data() + 3);
m_reliables[ackId] = pPacket;
}
else
{
m_packetPool.free(pPacket);
}
}
void RelayComms::sendPing()
{
if (m_pingInFlight)
{
return;
}
m_pingInFlight = true;
m_lastPingTime = std::chrono::system_clock::now();
uint8_t data[5];
*(uint16_t*)(data) = (uint16_t)htons((u_short)5);
data[2] = CL2RS_PING;
*(uint16_t*)(data + 3) = (uint16_t)htons((u_short)m_ping);
send(data, 5);
}
void RelayComms::send(int netId, const Json::Value& json)
{
Json::FastWriter writer;
send(netId, writer.write(json));
}
void RelayComms::send(int netId, const std::string& text)
{
#if VERBOSE_LOG
if (m_loggingEnabled)
{
std::cout << "RELAY SEND: " << text << std::endl;
}
#endif
auto totalSize = text.length() + 3;
std::vector<uint8_t> buffer(totalSize);
auto len = htons((u_short)totalSize);
memcpy(buffer.data(), &len, 2);
buffer[2] = (uint8_t)netId;
memcpy(buffer.data() + 3, text.data(), text.length());
send(buffer.data(), (int)buffer.size());
}
void RelayComms::send(const uint8_t* in_data, int in_size)
{
if (m_pSocket)
{
m_pSocket->send(in_data, in_size);
}
}
void RelayComms::onRecv(const uint8_t* in_data, int in_size)
{
m_lastRecvTime = std::chrono::system_clock::now();
if (in_size < 3)
{
disconnect();
queueErrorEvent("Relay Recv Error: packet cannot be smaller than 3 bytes");
return;
}
int size = (int)ntohs(*(u_short*)in_data);
int controlByte = (int)in_data[2];
if (size < in_size)
{
disconnect();
queueErrorEvent("Relay Recv Error: Packet is smaller than header's size");
return;
}
if (controlByte == RS2CL_RSMG)
{
if (size < 5)
{
disconnect();
queueErrorEvent("Relay Recv Error: RSMG cannot be smaller than 5 bytes");
return;
}
onRSMG(in_data + 3, size - 3);
}
else if (controlByte == RS2CL_DISCONNECT)
{
disconnect();
queueErrorEvent("Relay: Disconnected by server");
}
else if (controlByte == RS2CL_PONG)
{
onPONG();
}
else if (controlByte == RS2CL_ACK)
{
if (size < 11)
{
disconnect();
queueErrorEvent("Relay Recv Error: ack packet cannot be smaller than 5 bytes");
return;
}
if (m_connectionType == eRelayConnectionType::UDP)
{
onAck(in_data + 3);
}
}
else if (controlByte == RS2CL_RELAY)
{
if (size < 11)
{
disconnect();
queueErrorEvent("Relay Recv Error: relay packet cannot be smaller than 5 bytes");
return;
}
onRelay(in_data + 3, in_size - 3);
}
else
{
disconnect();
queueErrorEvent("Relay Recv Error: Unknown control byte: " + std::to_string(controlByte));
}
}
void RelayComms::sendRSMGAck(int rsmgPacketId)
{
#if VERBOSE_LOG
if (m_loggingEnabled)
{
std::cout << "#RELAY SEND: RSMG ACK" << std::endl;
}
#endif
uint8_t data[5];
*(uint16_t*)(data) = (uint16_t)htons((u_short)5);
data[2] = CL2RS_RSMG_ACK;
*(uint16_t*)(data + 3) = (uint16_t)htons((u_short)rsmgPacketId);
send(data, 5);
}
void RelayComms::sendAck(const uint8_t* in_data)
{
uint8_t data[11];
*(uint16_t*)(data) = (uint16_t)htons((u_short)11);
data[2] = CL2RS_ACK;
memcpy(data + 3, in_data, 8);
send(data, 11);
}
void RelayComms::onRSMG(const uint8_t* in_data, int in_size)
{
int rsmgPacketId = (int)ntohs(*(u_short*)in_data);
std::string jsonString((char*)in_data + 2, (char*)in_data + in_size);
if (m_loggingEnabled)
{
std::cout << "RELAY System Msg: " << jsonString << std::endl;
}
if (m_connectionType == eRelayConnectionType::UDP)
{
// Send ack, always. Even if we already received it
sendRSMGAck(rsmgPacketId);
// If already received, we ignore
for (int packetId : m_rsmgHistory)
{
if (packetId == rsmgPacketId)
{
#if VERBOSE_LOG
if (m_loggingEnabled)
{
std::cout << "RELAY Duplicated System Msg" << std::endl;
}
#endif
return;
}
}
// Add to history
m_rsmgHistory.push_back(rsmgPacketId);
// Crop to max history
while ((int)m_rsmgHistory.size() > MAX_RSMG_HISTORY)
{
m_rsmgHistory.erase(m_rsmgHistory.begin());
}
}
Json::Value json;
Json::Reader reader;
reader.parse(jsonString, json);
auto op = json["op"].asString();
if (op == "CONNECT")
{
auto netId = json["netId"].asInt();
auto cxId = json["cxId"].asString();
auto profileId = extractProfileIdFromCxId(cxId);
m_netIdToCxId[netId] = cxId;
m_cxIdToNetId[cxId] = netId;
m_netIdToProfileId[netId] = profileId;
m_profileIdToNetId[profileId] = netId;
if (cxId == m_cxId)
{
m_netId = netId;
m_ownerCxId = json["ownerCxId"].asString();
m_ownerProfileId = extractProfileIdFromCxId(m_ownerCxId);
m_lastPingTime = std::chrono::system_clock::now();
m_isConnected = true;
m_resendConnectRequest = false;
queueConnectSuccessEvent(jsonString);
}
}
else if (op == "NET_ID")
{
auto netId = json["netId"].asInt();
auto cxId = json["cxId"].asString();
auto profileId = extractProfileIdFromCxId(cxId);
m_netIdToCxId[netId] = cxId;
m_cxIdToNetId[cxId] = netId;
m_netIdToProfileId[netId] = profileId;
m_profileIdToNetId[profileId] = netId;
}
else if (op == "MIGRATE_OWNER")
{
auto cxId = json["cxId"].asString();
m_ownerCxId = cxId;
m_ownerProfileId = extractProfileIdFromCxId(m_ownerCxId);
}
else if (op == "DISCONNECT")
{
auto cxId = json["cxId"].asString();
if (m_cxId == cxId)
{
// We are the one that got disconnected!
disconnect();
queueErrorEvent("Disconnected by server");
return;
}
}
queueSystemEvent(jsonString);
}
void RelayComms::onPONG()
{
if (m_pingInFlight)
{
m_pingInFlight = false;
m_ping = (int)std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - m_lastPingTime).count();
#if VERBOSE_LOG
if (m_loggingEnabled)
{
std::cout << "RELAY PONG: " << m_ping << std::endl;
}
#endif
}
}
void RelayComms::onAck(const uint8_t* in_data)
{
auto ackId = *(uint64_t*)in_data;
auto it = m_reliables.find(ackId);
if (it != m_reliables.end())
{
auto pPacket = it->second;
#if VERBOSE_LOG
if (m_loggingEnabled)
{
auto rh = (int)ntohs(*(u_short*)in_data);
auto packetId = rh & 0xFFF;
std::cout << "Acked packet id: " << packetId << std::endl;
}
#endif
m_packetPool.free(pPacket);
m_reliables.erase(it);
}
}
static bool packetLE(int a, int b)
{
if (a > PACKET_HIGHER_THRESHOLD && b <= PACKET_LOWER_THRESHOLD)
{
return true;
}
if (b > PACKET_HIGHER_THRESHOLD && a <= PACKET_LOWER_THRESHOLD)
{
return false;
}
return a <= b;
}
void RelayComms::onRelay(const uint8_t* in_data, int in_size)
{
auto rh = (int)ntohs(*(u_short*)in_data);
auto playerMask0 = (uint64_t)ntohs(*(u_short*)(in_data + 2));
auto playerMask1 = (uint64_t)ntohs(*(u_short*)(in_data + 4));
auto playerMask2 = (uint64_t)ntohs(*(u_short*)(in_data + 6));
auto ackId =
(((uint64_t)rh << 48) & 0xFFFF000000000000) |
(((uint64_t)playerMask0 << 32) & 0x0000FFFF00000000) |
(((uint64_t)playerMask1 << 16) & 0x00000000FFFF0000) |
(((uint64_t)playerMask2) & 0x000000000000FFFF);
uint64_t ackIdWithoutPacketId = ackId & 0xF000FFFFFFFFFFFF;
auto reliable = rh & RELIABLE_BIT ? true : false;
auto ordered = rh & ORDERED_BIT ? true : false;
auto channel = (rh >> 12) & 0x3;
auto packetId = rh & 0xFFF;
auto netId = (uint8_t)(playerMask2 & 0x00FF);
// Reconstruct ack id without packet id
if (m_connectionType == eRelayConnectionType::UDP)
{
// Ack reliables, always. An ack might have been previously dropped.
if (reliable)
{
sendAck(in_data);
}
if (ordered)
{
int prevPacketId = MAX_PACKET_ID;
auto it = m_recvPacketId.find(ackIdWithoutPacketId);
if (it != m_recvPacketId.end())
{
prevPacketId = it->second;
}
if (reliable)
{
if (packetLE(packetId, prevPacketId))
{
// We already received that packet if it's lower than the last confirmed
// packetId. This must be a duplicate
#if VERBOSE_LOG
if (m_loggingEnabled)
{
std::cout << "Duplicated packet from " << (int)netId << ". got " << packetId << std::endl;
}
#endif
return;
}
// Check if it's out of order, then save it for later
auto& orderedReliablePackets = m_orderedReliablePackets[ackIdWithoutPacketId];
if (packetId != ((prevPacketId + 1) & MAX_PACKET_ID))
{
if ((int)orderedReliablePackets.size() > MAX_PACKET_ID_HISTORY)
{
disconnect();
queueErrorEvent("Relay disconnected, too many queued out of order packets.");
return;
}
int insertIdx = 0;
for (; insertIdx < (int)orderedReliablePackets.size(); ++insertIdx)
{
auto pPacket = orderedReliablePackets[insertIdx];
if (pPacket->id == packetId)
{
#if VERBOSE_LOG
if (m_loggingEnabled)
{
std::cout << "Duplicated packet from " << (int)netId << ". got " << packetId << std::endl;
}
#endif
return;
}
if (packetLE(packetId, pPacket->id)) break;
}
auto pNewPacket = m_packetPool.alloc();
pNewPacket->id = packetId;
pNewPacket->netId = netId;
pNewPacket->data.assign(in_data + 8, in_data + in_size);
orderedReliablePackets.insert(orderedReliablePackets.begin() + insertIdx, pNewPacket);
#if VERBOSE_LOG
if (m_loggingEnabled)
{
std::cout << "Queuing out of order reliable from " << (int)netId << ". got " << packetId << std::endl;
}
#endif
return;
}
// It's in order, queue event
m_recvPacketId[ackIdWithoutPacketId] = packetId;
queueRelayEvent(netId, in_data + 8, in_size - 8);
// Empty previously queued packets if they follow this one
while (!orderedReliablePackets.empty())
{
auto pPacket = orderedReliablePackets.front();
if (pPacket->id == ((packetId + 1) & MAX_PACKET_ID))
{
queueRelayEvent(pPacket->netId, pPacket->data.data(), (int)pPacket->data.size());
orderedReliablePackets.erase(orderedReliablePackets.begin());
packetId = pPacket->id;
m_recvPacketId[ackIdWithoutPacketId] = packetId;
m_packetPool.free(pPacket);
continue;
}
break; // Out of order
}
return;
}
else
{
if (packetLE(packetId, prevPacketId))
{
// Just drop out of order packets for unreliables
#if VERBOSE_LOG
if (m_loggingEnabled)
{
std::cout << "Out of order packet from " << (int)netId << ". Expecting " << ((prevPacketId + 1) & MAX_PACKET_ID) << ", got " << packetId << std::endl;
}
#endif
return;
}
m_recvPacketId[ackIdWithoutPacketId] = packetId;
}
}
}
queueRelayEvent(netId, in_data + 8, in_size - 8);
}
void RelayComms::runCallbacks()
{
auto now = std::chrono::system_clock::now();
// Update socket
if (m_pSocket)
{
if (m_pSocket->isConnected())
{
// Peek messages
int packetSize;
const uint8_t* pPacketData;
while (m_pSocket && (pPacketData = m_pSocket->peek(packetSize)))
{
onRecv(pPacketData, packetSize);
}
// Check for connect request resend
if (m_connectionType == eRelayConnectionType::UDP &&
m_resendConnectRequest &&
now - m_lastConnectResendTime > std::chrono::milliseconds(CONNECT_RESEND_INTERVAL_MS))
{
m_lastConnectResendTime = now;
send(CL2RS_CONNECT, buildConnectionRequest());
}
// Ping. Which also works as an heartbeat
if (now - m_lastPingTime >= m_pingInterval)
{
sendPing();
}
// Process reliable resends
if (m_connectionType == eRelayConnectionType::UDP)
{
for (auto it = m_reliables.begin(); it != m_reliables.end(); ++it)
{
auto pPacket = it->second;
if (pPacket->timeSinceFirstSend - now > std::chrono::seconds(10))
{
disconnect();
queueErrorEvent("Relay disconnected, too many packet lost");
break;
}
if (now - pPacket->lastResendTime >= std::chrono::milliseconds((int)pPacket->resendInterval))
{
pPacket->lastResendTime = now;
pPacket->resendInterval = std::min<double>((double)pPacket->resendInterval * 1.25, (double)MAX_RELIABLE_RESEND_INTERVAL_MS);
send(pPacket->data.data(), (int)pPacket->data.size());
#if VERBOSE_LOG
if (m_loggingEnabled)
{
std::cout << "Resend reliable (" << pPacket->id << ", " << std::chrono::duration_cast<std::chrono::milliseconds>(pPacket->timeSinceFirstSend - now).count() << "ms)" << std::endl;
}
#endif
}
}
}
// Check if we timeout
if (m_connectionType == eRelayConnectionType::UDP &&
m_pSocket &&
now - m_lastRecvTime > std::chrono::seconds(TIMEOUT_SECONDS))
{
disconnect();
queueErrorEvent("Relay Socket Timeout");
}
}
else if (!m_pSocket->isValid())
{
disconnect();
queueErrorEvent("Relay Socket Error: failed to connect");
}
else
{
m_pSocket->updateConnection();
if (m_pSocket->isConnected())
{
m_isSocketConnected = true;
if (m_loggingEnabled)
{
std::cout << "Relay Socket Connected" << std::endl;
}
send(CL2RS_CONNECT, buildConnectionRequest());
if (m_connectionType == eRelayConnectionType::UDP)
{
m_resendConnectRequest = true;
m_lastConnectResendTime = now;
}
}
}
}
// Perform event callbacks
{
m_eventsCopy = m_events;
m_events.clear();
for (auto pEvent : m_eventsCopy)
{
switch (pEvent->type)
{
case EventType::ConnectSuccess:
if (m_pRelayConnectCallback)
{
m_pRelayConnectCallback->relayConnectSuccess(pEvent->message);
}
break;
case EventType::ConnectFailure:
if (m_pRelayConnectCallback)
{
if (m_loggingEnabled)
{
std::cout << "Relay: " << pEvent->message << std::endl;
}
m_pRelayConnectCallback->relayConnectFailure(pEvent->message);
}
break;
case EventType::System:
if (m_pSystemCallback)
{
m_pSystemCallback->relaySystemCallback(pEvent->message);
}
break;
case EventType::Relay:
if (m_pRelayCallback)
{
m_pRelayCallback->relayCallback(pEvent->netId, pEvent->data.data(), (int)pEvent->data.size());
}
break;
}
m_eventPool.free(pEvent);
}
}
// Report debug info on memory (Lets only do that when connected)
#if VERBOSE_LOG
if (m_isConnected && m_loggingEnabled)
{
static auto lastPoolReportingTime = now;
if (now - lastPoolReportingTime > std::chrono::seconds(5))
{
lastPoolReportingTime = now;
std::cout << "Relay Pool sizes: (Events = " << m_eventPool.size() << "," << Event::allocCount << ") (Packets = " << m_packetPool.size() << "," << Packet::allocCount << ")" << std::endl;
}
}
#endif
}
void RelayComms::queueConnectSuccessEvent(const std::string& jsonString)
{
auto pEvent = m_eventPool.alloc();
pEvent->type = EventType::ConnectSuccess;
pEvent->message = jsonString;
m_events.push_back(pEvent);
}
void RelayComms::queueErrorEvent(const std::string& message)
{
auto pEvent = m_eventPool.alloc();
pEvent->type = EventType::ConnectFailure;
pEvent->message = message;
m_events.push_back(pEvent);
}
void RelayComms::queueSystemEvent(const std::string& jsonString)
{
auto pEvent = m_eventPool.alloc();
pEvent->type = EventType::System;
pEvent->message = jsonString;
m_events.push_back(pEvent);
}
void RelayComms::queueRelayEvent(int netId, const uint8_t* pData, int size)
{
auto pEvent = m_eventPool.alloc();
pEvent->type = EventType::Relay;
pEvent->netId = netId;
pEvent->data.assign(pData, pData + size);
m_events.push_back(pEvent);
}
};
| 32.885685 | 210 | 0.517913 | [
"vector"
] |
e87e6333294682e3027d11a04c943ff22d6c76a8 | 895 | cpp | C++ | RandomSamples/Beta.cpp | fcooper8472/CppRandomNumbers | 91ae5132d70982619bba4424833ab6fd622106e1 | [
"MIT"
] | null | null | null | RandomSamples/Beta.cpp | fcooper8472/CppRandomNumbers | 91ae5132d70982619bba4424833ab6fd622106e1 | [
"MIT"
] | null | null | null | RandomSamples/Beta.cpp | fcooper8472/CppRandomNumbers | 91ae5132d70982619bba4424833ab6fd622106e1 | [
"MIT"
] | null | null | null | #include "../Utilities.hpp" // This is just for testing and can be removed
#include <random>
int main() {
// Seed a Mersenne twister with a 'true' random seed from random_device
std::random_device rd{};
std::mt19937 gen{rd()};
// Params
const std::size_t n = 100'000;
const double alpha = 1.23;
const double beta = 2.34;
// No beta distribution in the standard library, so construct samples using two Gammas
std::gamma_distribution<double> dis_alpha(alpha, 1.0);
std::gamma_distribution<double> dis_beta(beta, 1.0);
// Create and fill the vector
std::vector<double> vec(n);
for (double &x : vec) {
const double alpha_sample = dis_alpha(gen);
x = alpha_sample / (alpha_sample + dis_beta(gen));
}
PrintVectorToFile("Beta_alpha=1.23_beta=2.34", vec); // This is just for testing and can be removed
return 0;
} | 30.862069 | 104 | 0.658101 | [
"vector"
] |
e87efe8804731bf3a43e8a36c2d75429d57ea07a | 29,559 | cpp | C++ | winguest/winguestdll/deploy.cpp | fengjixuchui/napoca | ed26609ab9a3ea12d12882b311dcb332dc759d32 | [
"Apache-2.0"
] | 170 | 2020-07-30T15:04:59.000Z | 2022-03-24T10:59:29.000Z | winguest/winguestdll/deploy.cpp | a-cristi/napoca | ed6691125bf703366581e47a1fe789167009c24a | [
"Apache-2.0"
] | 3 | 2020-08-10T09:16:56.000Z | 2022-02-18T21:40:43.000Z | winguest/winguestdll/deploy.cpp | a-cristi/napoca | ed6691125bf703366581e47a1fe789167009c24a | [
"Apache-2.0"
] | 44 | 2020-07-30T15:06:55.000Z | 2022-02-25T08:55:55.000Z | /*
* Copyright (c) 2020 Bitdefender
* SPDX-License-Identifier: Apache-2.0
*/
/** @file deploy.cpp
* @brief Hypervisor common deployment
*/
#include <string>
#include <regex>
#include <fstream>
#include <ntstatus.h>
#define WIN32_NO_STATUS
#include <windows.h>
typedef unsigned __int64 QWORD;
typedef _Return_type_success_(return >= 0) long NTSTATUS;
#include "winguest_status.h"
#include "deploy.h"
#include "deploy_validation.h"
#include "deploy_legacy.h"
#include "deploy_uefi.h"
#include "helpers.h"
#include "reg_opts.h"
#include "crc32.h"
#include "consts.h"
extern "C" {
#include "_external/buildsystem/interface/c/userdata.h"
#include "autogen/napoca_cmdline.h"
}
#include "trace.h"
#include "deploy.tmh"
#define EFI_CONFIG_BINARIES_FOLDER L"Efi\\"
#define LEGACY_CONFIG_BINARIES_FOLDER L"Legacy\\"
LD_INSTALL_FILE gInstallFiles[] =
{
#include "autogen/install_files.h"
};
DWORD gInstallFilesCount = _countof(gInstallFiles);
BOOLEAN gHypervisorConfigured;
std::wstring gSdkDirs[SDK_DIR_MAX_ID];
typedef struct _LM_CMDLINE_MACRO
{
char* Name;
char* Body;
}LM_CMDLINE_MACRO;
static LM_CMDLINE_MACRO gCmdlineMacros[] =
{
#include "autogen/cmdline_templates.h"
};
static UD_VAR_INFO HvCommandLineVariablesInfo[] = UD_VAR_INFO_TABLE;
/**
* @brief Copy a list of files
*
* @param[in] List List of installation files and metadata
* @param[in] NumberOfElements Count of items in List
* @param[in] DestinationDir Folder where the files will be copied
* @param[in] Flags Flags that must be matched in order to copy the files. A file must have all required flags set in order to be copied
*
* @return STATUS_SUCCESS
* @return OTHER Other potential internal error
*/
NTSTATUS
CopyListOfFiles(
_In_ LD_INSTALL_FILE *List,
_In_ DWORD NumberOfElements,
_In_ std::wstring const& DestinationDir,
_In_ LD_INSTALL_FILE_FLAGS Flags
)
{
std::wstring sourceFullPath;
DWORD lastErr = ERROR_SUCCESS;
std::wstring destinationFullPath;
BOOLEAN uefi = IsUefiBootedOs();
// copy each file
for (DWORD i = 0; i < NumberOfElements; i++)
{
if ((List[i].Flags.Raw & Flags.Raw) != Flags.Raw && Flags.Raw != 0)
{
continue;
}
if (gSdkDirs[List[i].SourceDir].empty() || gSdkDirs[List[i].SourceDir][0] == L'\0')
{
continue;
}
if (List[i].DestinationFileName == NULL || List[i].SourceFileName == NULL || gSdkDirs[List[i].SourceDir].empty())
{
return STATUS_FILE_INVALID;
}
sourceFullPath = gSdkDirs[List[i].SourceDir] + List[i].SourceFileName;
destinationFullPath = DestinationDir + List[i].DestinationFileName;
if (!uefi)
{
SetFileAttributes(destinationFullPath.c_str(), FILE_ATTRIBUTE_NORMAL);
}
LogVerbose("Copying %S -> %S\n", sourceFullPath.c_str(), destinationFullPath.c_str());
if (!CopyFile(sourceFullPath.c_str(), destinationFullPath.c_str(), FALSE))
{
lastErr = GetLastError();
LogFuncErrorLastErr(lastErr, "CopyFile");
return WIN32_TO_NTSTATUS(lastErr);
}
if (!uefi)
{
if (!SetFileAttributes(destinationFullPath.c_str(), LEGACY_INSTALL_FILES_FILE_ATTRIBUTES))
{
lastErr = GetLastError();
LogFuncErrorLastErr(lastErr, "SetFileAttributes");
}
}
}
return STATUS_SUCCESS;
}
/**
* @brief Retrieve a file from the installation list by the unique identifier
*
* @param[in] UniqueId Identifier that uniquely identifies a file in the list
*
* @return File The requested file
* @return NULL No file matched the id
*/
LD_INSTALL_FILE*
GetInstallFileForUniqueId(
_In_ LD_UNIQUE_ID UniqueId
)
{
for (DWORD i = 0; i < gInstallFilesCount; i++)
if (gInstallFiles[i].UniqueId == UniqueId)
return &gInstallFiles[i];
return NULL;
}
/**
* @brief Retrieve files from the installation list by their module identifier and flags
*
* @param[in] LdModId Identifier that identifies the module for which the files can be used
* @param[in] WantedFlags Flags that must be matched by the files
* @param[in] UnwantedFlags Flags that must not be matched by the files
* @param[in] Continuation The last retrieved file for a new point to start the search in case more than one is required
*
* @return File The requested file
* @return NULL No (new) file matched the id
*/
LD_INSTALL_FILE*
GetInstallFileForModId(
_In_ LD_MODID LdModId,
_In_opt_ LD_INSTALL_FILE_FLAGS* WantedFlags,
_In_opt_ LD_INSTALL_FILE_FLAGS* UnwantedFlags,
_Inout_opt_ DWORD* Continuation
)
{
DWORD start = Continuation ? *Continuation : 0;
if (Continuation)
{
start = *Continuation;
}
for (DWORD i = start; i < gInstallFilesCount; i++)
{
if (gInstallFiles[i].LdModId == LdModId)
{
if (
((!WantedFlags) || ((WantedFlags->Raw & gInstallFiles[i].Flags.Raw) == WantedFlags->Raw)) &&
((!UnwantedFlags) || ((UnwantedFlags->Raw & gInstallFiles[i].Flags.Raw) == 0))
)
{
if (Continuation)
{
*Continuation = i + 1;
}
return &gInstallFiles[i];
}
}
}
return NULL;
}
/**
* @brief Retrieve a file from a custom list by the unique identifier
*
* @param[in] List Custom file list
* @param[in] UniqueId Identifier that uniquely identifies a file in the list
*
* @return File The requested file
* @return NULL No file matched the id
*/
CHANGED_ITEM*
GetChangedItemForId(
_In_ CHANGED_LIST& List,
_In_ LD_UNIQUE_ID UniqueId
)
{
for (DWORD i = 0; i < List.size(); i++)
if (List[i].Id == UniqueId)
return &List[i];
return NULL;
}
/**
* @brief Retrieve version metadata from the registry in order to check which files changed after an update
*
* @param[in] SubKey Registry Key where the data is stored
* @param[in] Value Registry Value where the data is stored
* @param[out] ChangedList List of files with version metadata
*
* @return STATUS_SUCCESS
* @return OTHER Other potential internal error
*/
NTSTATUS
GetChangesListFromRegistry(
_In_ const std::wstring& SubKey,
_In_ const std::wstring& Value,
_Out_ CHANGED_LIST& ChangedList
)
{
LONG retCode = ERROR_SUCCESS;
ChangedList.clear();
//
// Request the size of the binary data, in bytes
//
DWORD dataSize{};
retCode = RegGetValue(
HKEY_LOCAL_MACHINE,
SubKey.c_str(),
Value.c_str(),
RRF_RT_ANY, //REG_BINARY, //RRF_RT_REG_BINARY,
nullptr,
nullptr,
&dataSize);
if (retCode == ERROR_SUCCESS)
{
//
// Allocate room for the result binary data
//
ChangedList.resize(dataSize / sizeof(CHANGED_ITEM)); // we need number of elements
//
// Read the binary data from the registry into the vector object
//
retCode = RegGetValue(
HKEY_LOCAL_MACHINE,
SubKey.c_str(),
Value.c_str(),
RRF_RT_ANY, //REG_BINARY, //RRF_RT_REG_BINARY,
nullptr,
&ChangedList[0],
&dataSize);
}
else if (retCode == ERROR_FILE_NOT_FOUND)
{
retCode = ERROR_SUCCESS;
}
return (retCode == ERROR_SUCCESS) ? STATUS_SUCCESS : STATUS_UPDATE_FILE_ERROR;
}
/**
* @brief Store version metadata from the registry in order to check which files changed after an update
*
* @param[in] SubKey Registry Key where the data is stored
* @param[in] Value Registry Value where the data is stored
* @param[out] ChangedList List of files with version metadata
*
* @return STATUS_SUCCESS
* @return OTHER Other potential internal error
*/
NTSTATUS
PutChangesListInRegistry(
_In_ const std::wstring& SubKey,
_In_ const std::wstring& Value,
_In_ const CHANGED_LIST& ChangedList
)
{
LONG retCode = ERROR_SUCCESS;
retCode = RegSetKeyValue(
HKEY_LOCAL_MACHINE,
SubKey.c_str(),
Value.c_str(),
RRF_RT_ANY,//REG_BINARY,
&ChangedList[0],
(DWORD)(ChangedList.size() * sizeof(CHANGED_ITEM)));
return (retCode == ERROR_SUCCESS) ? STATUS_SUCCESS : STATUS_UPDATE_FILE_ERROR;
}
/**
* @brief Update version metadata in order to check which files changed after an update
*
* @param[in] InstallFiles List of installation files
* @param[in] InstallFilesCount Count of InstallFiles
* @param[out] ChangedList List of files with version metadata
*
* @return STATUS_SUCCESS
* @return OTHER Other potential internal error
*/
NTSTATUS
UpdateChangesList(
_In_ const LD_INSTALL_FILE* InstallFiles,
_In_ DWORD InstallFilesCount,
_Out_ CHANGED_LIST& ChangedList
)
{
NTSTATUS status = STATUS_SUCCESS;
const LD_INSTALL_FILE* oneFile = NULL;
std::wstring sourceFullPath;
for (DWORD i = 0; i < InstallFilesCount; i++)
{
std::ifstream inFile;
oneFile = &InstallFiles[i];
if (gSdkDirs[oneFile->SourceDir].empty() || gSdkDirs[oneFile->SourceDir][0] == L'\0')
{
continue;
}
if (oneFile->SourceFileName == NULL || gSdkDirs[oneFile->SourceDir].empty())
{
continue;
}
sourceFullPath = gSdkDirs[oneFile->SourceDir] + oneFile->SourceFileName;
inFile.open(sourceFullPath.c_str(), std::ios::in | std::ios::binary);
if (inFile.is_open())
{
// Stop eating new lines in binary mode!!!
inFile.unsetf(std::ios::skipws);
// get its size:
std::streampos fileSize;
inFile.seekg(0, std::ios::end);
fileSize = inFile.tellg();
inFile.seekg(0, std::ios::beg);
// reserve capacity
std::vector<unsigned char> vec;
vec.reserve((std::vector<unsigned char>::size_type)(fileSize));
vec.insert(vec.begin(),
std::istream_iterator<unsigned char>(inFile),
std::istream_iterator<unsigned char>()
);
// update hash if an entry exists
bool found = false;
for (auto&& chgItem : ChangedList)
{
if (chgItem.Id == oneFile->UniqueId)
{
chgItem.CurrentHash = Crc32(0, vec.data(), vec.size());
found = true;
break;
}
}
// add a new entry if one is not found
if (!found)
{
CHANGED_ITEM chgItem;
chgItem.Id = oneFile->UniqueId;
chgItem.CurrentHash = Crc32(0, vec.data(), vec.size());
chgItem.PrevHash = chgItem.CurrentHash;
ChangedList.push_back(chgItem);
}
inFile.close();
}
}
for (const CHANGED_ITEM& chgItem : ChangedList)
{
LogInfo("Id 0x%llx PrevHash 0x%llx CurrentHash 0x%llx\n", chgItem.Id, chgItem.PrevHash, chgItem.CurrentHash);
}
return status;
}
/**
* @brief Get an update completion status that can be returned to the integrator
*
* @param[in] InitialStatus Status returned by update APIs
* @param[in] Components Flags that identify which components were updated
*
* @return STATUS_UPDATE_RECOMMENDS_REBOOT A reboot should be performed after the update in order to fully load the updates because they could not be updated due to unforseen circumstances
* @return STATUS_UPDATE_REQUIRES_REBOOT A reboot must be performed after the update in order to load the updates or fix critical security vulnerabilities
* @return STATUS_UPDATE_REQUEST_REBOOT_FOR_UPDATE A reboot should be performed in order to finish the update
* @return STATUS_UPDATE_FILE_ERROR Inconsistent internal file metadata
* @return OTHER Other potential internal error
*/
NTSTATUS
DetermineUpdateStatus(
_In_ NTSTATUS InitialStatus,
_In_ DWORD Components
)
{
NTSTATUS status = STATUS_SUCCESS;
CHANGED_LIST changedList = {};
// Determine a list of different files since previous successful update
status = GetChangesListFromRegistry(REG_SUBKEY_GENERAL_SETTINGS, REG_VALUE_CHANGES_LIST, changedList);
if (!NT_SUCCESS(status))
{
LogFuncErrorStatus(status, "GetChangesListFromRegistry");
return status;
}
// update the list with new hashes
status = UpdateChangesList(gInstallFiles, gInstallFilesCount, changedList);
if (!NT_SUCCESS(status))
{
LogFuncErrorStatus(status, "UpdateChangesList");
return status;
}
if (Components != 0)
{
switch (InitialStatus)
{
case STATUS_UPDATE_RECOMMENDS_REBOOT:
case STATUS_UPDATE_REQUIRES_REBOOT:
case STATUS_UPDATE_REQUEST_REBOOT_FOR_UPDATE:
status = InitialStatus;
LogInfo("Override initial status 0x%x to 0x%x\n", InitialStatus, status);
break;
case CX_STATUS_NOT_SUPPORTED: // intro / exceptii incompatibile cu hv / hvi => reboot ar trebui sa rezolve
case CX_STATUS_INSUFFICIENT_RESOURCES: // nu mai avem memorie in hv sa facem update => dupa reboot se rezolva
// add here other technology error codes that might be resolved by a reboot
status = STATUS_UPDATE_RECOMMENDS_REBOOT;
LogInfo("Override initial status 0x%x to 0x%x\n", InitialStatus, status);
break;
case CX_STATUS_OBJECT_TYPE_MISMATCH: // fisiere invalide (exceptii) => reboot nu rezolva nimic
// case STATUS_INVALID_OBJECT_TYPE: // fisiere invalide (exceptii) => reboot nu rezolva nimic
// case STATUS_INCONSISTENT_DATA_VALUE: // fisiere invalide (exceptii) => reboot nu rezolva nimic
default:
// add here any other technology error codes that will not be resolved by a reboot
// these errors will be forwarded to integrators
if (!NT_SUCCESS(InitialStatus))
{
LogFuncErrorStatus(InitialStatus, "DetermineUpdateStatus");
return InitialStatus;
}
}
for (DWORD i = undefinedId; i < maxuniqueid; i++)
{
CHANGED_ITEM* item = NULL;
item = GetChangedItemForId(changedList, static_cast<LD_UNIQUE_ID>(i));
switch (i)
{
case napocabin:
case introcorebin:
if ((Components & FLAG_UPDATE_COMPONENT_BASE) == 0)
{
break;
}
if (item == NULL)
{
status = STATUS_UPDATE_FILE_ERROR;
break;
}
// in this case we need to recommend a reboot since napoca, intro cannot be updated on the fly
if (item->PrevHash != item->CurrentHash)
{
status = min(status, STATUS_UPDATE_RECOMMENDS_REBOOT);
item->PrevHash = item->CurrentHash;
}
break;
break;
break;
case exceptionsbin:
case introliveupdtbin:
if ((Components & FLAG_UPDATE_COMPONENT_INTRO_UPDATES) == 0)
{
break;
}
if (item == NULL)
{
status = STATUS_UPDATE_FILE_ERROR;
break;
}
// same as for introcore
if (item->PrevHash != item->CurrentHash)
{
item->PrevHash = item->CurrentHash;
}
break;
default:
break;
}
}
}
// discard errors
PutChangesListInRegistry(REG_SUBKEY_GENERAL_SETTINGS, REG_VALUE_CHANGES_LIST, changedList);
return status;
}
/**
* @brief Load version metadata from the registry and compute changed metadata for installation files
*
* @param[out] ChangedList List of files with version metadata
*
* @return STATUS_SUCCESS
* @return OTHER Other potential internal error
*/
static
NTSTATUS
_DetermineChangedList(
_Out_ CHANGED_LIST* ChangedList
)
{
NTSTATUS status;
// We assume ChangedList is not NULL, this function being an internal function.
// Determine a list of different files since previous successful update
status = GetChangesListFromRegistry(REG_SUBKEY_GENERAL_SETTINGS, REG_VALUE_CHANGES_LIST, *ChangedList);
if (!NT_SUCCESS(status))
{
LogFuncErrorStatus(status, "GetChangesListFromRegistry");
return status;
}
// update the list with new hashes
status = UpdateChangesList(gInstallFiles, gInstallFilesCount, *ChangedList);
if (!NT_SUCCESS(status))
{
LogFuncErrorStatus(status, "UpdateChangesList");
return status;
}
return STATUS_SUCCESS;
}
/**
* @brief Check if the introspection engine must be reloaded from the disk because there is a new version
*
* @param[out] Flag Will add MC_FLAG_REQUEST_MODULE_LOAD_FROM_DISK to the flags in request module updates
*
* @return STATUS_SUCCESS
* @return OTHER Other potential internal error
*/
NTSTATUS
DetermineIntroUpdate(
_Out_ unsigned long long *Flag
)
{
// We assume Flag is not NULL, this function being an internal function.
NTSTATUS status = STATUS_SUCCESS;
CHANGED_LIST changedList;
status = _DetermineChangedList(&changedList);
if (!NT_SUCCESS(status))
{
LogFuncErrorStatus(status, "DetermineChangedList");
*Flag = MC_FLAG_REQUEST_MODULE_LOAD_FROM_DISK;
}
else
{
CHANGED_ITEM* item = NULL;
item = GetChangedItemForId(changedList, introcorebin);
if (item->PrevHash == item->CurrentHash)
{
// hashes are the same, so do not reload introcore
*Flag = 0;
}
else
{
// hashes changed, so reload introcorebin from disk, flag remains MC_FLAG_REQUEST_MODULE_LOAD_FROM_DISK
*Flag = MC_FLAG_REQUEST_MODULE_LOAD_FROM_DISK;
}
}
return status;
}
/**
* @brief Set the path where the Napoca SDK is located in order to be able to locate required files
*
* @param[in] SDKPath Path to the Napoca SDK
*/
void
SetSDKPath(
std::wstring const& SDKPath
)
{
auto uefi = IsUefiBootedOs();
gSdkDirs[SDK_DIR_HV] = SDKPath;
gSdkDirs[uefi ? SDK_DIR_EFI : SDK_DIR_MBR] = gSdkDirs[SDK_DIR_HV] + (uefi ? EFI_CONFIG_BINARIES_FOLDER : LEGACY_CONFIG_BINARIES_FOLDER);
}
/**
* @brief Set the path where the Introspection updates are located in order to be able to locate required files
*
* @param[in] UpdatesIntroPath Path to the Introspection updates
*/
void
SetUpdatesIntroDir(
std::wstring const& UpdatesIntroPath
)
{
gSdkDirs[SDK_DIR_UPDATES_INTRO] = UpdatesIntroPath;
}
/**
* @brief Expand Napoca HV command line macros to full variable names
*
* @param[in] Input Command line containing macros
* @param[out] Result Updated command line with expanded macros
*
* @return STATUS_SUCCESS
* @return OTHER Other potential internal error
*/
NTSTATUS
ExpandCmdlineMacros(
_In_ std::string const &Input,
_Out_ std::string &Result
)
{
std::regex rx;
std::string result = Input;
for (DWORD i = 0; i < _countof(gCmdlineMacros); i++)
{
rx = std::string("\\b(") + gCmdlineMacros[i].Name + ")\\b";
result = std::regex_replace(result, rx, gCmdlineMacros[i].Body);
}
Result.swap(result);
return STATUS_SUCCESS;
}
/**
* @brief Load a command line from disk
*
* @param[in] CmdLine Unique identifier to know which command line is required
*
* @return STATUS_SUCCESS
* @return OTHER Other potential internal error
*/
NTSTATUS
LoadConfigData(
_In_ LD_UNIQUE_ID CmdLine
)
{
NTSTATUS status = STATUS_UNSUCCESSFUL;
DWORD lastErr = ERROR_SUCCESS;
LD_INSTALL_FILE* cmd = NULL;
std::wstring cmdPath;
HANDLE cmdFile = INVALID_HANDLE_VALUE;
LARGE_INTEGER cmdFileSize;
std::string cmdDefaultBuf;
DWORD nrOfBytes = 0;
UD_NUMBER consumed;
// get the filepath for the final cmd line
cmd = GetInstallFileForUniqueId(CmdLine);
if (!cmd)
{
status = STATUS_FILE_NOT_AVAILABLE;
LogFuncErrorStatus(status, "GetInstallFileForUniqueId");
return status;
}
cmdPath = gSdkDirs[cmd->SourceDir];
cmdPath += cmd->SourceFileName;
cmdFile = CreateFile(
cmdPath.c_str(),
GENERIC_READ,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
if (cmdFile == INVALID_HANDLE_VALUE)
{
status = WIN32_TO_NTSTATUS(lastErr = GetLastError());
LogFuncErrorLastErr(lastErr, "CreateFile");
goto cleanup;
}
if (!GetFileSizeEx(cmdFile, &cmdFileSize))
{
status = WIN32_TO_NTSTATUS(lastErr = GetLastError());
LogFuncErrorLastErr(lastErr, "GetFileSizeEx");
goto cleanup;
}
if (cmdFileSize.HighPart != 0 || cmdFileSize.LowPart == 0 || cmdFileSize.LowPart > 4 * ONE_MEGABYTE)
{
status = STATUS_FILE_CORRUPT_ERROR;
goto cleanup;
}
cmdDefaultBuf.resize(cmdFileSize.LowPart);
if (!ReadFile(cmdFile, &cmdDefaultBuf[0], cmdFileSize.LowPart, &nrOfBytes, NULL))
{
status = WIN32_TO_NTSTATUS(lastErr = GetLastError());
LogFuncErrorLastErr(lastErr, "ReadFile");
goto cleanup;
}
if (!UdMatchVariablesFromText(HvCommandLineVariablesInfo, _countof(HvCommandLineVariablesInfo), const_cast<char*>(cmdDefaultBuf.c_str()), cmdFileSize.LowPart, &consumed))
{
status = STATUS_FILE_CORRUPT_ERROR;
LogFuncErrorStatus(status, "UdMatchVariablesFromText");
goto cleanup;
}
status = STATUS_SUCCESS;
cleanup:
if (cmdFile != INVALID_HANDLE_VALUE)
{
CloseHandle(cmdFile);
}
return status;
}
/**
* @brief Create the final command line module file from the default one and overrides
*
* @param[in] Update If TRUE, use the previous final command line as a starting point, otherwise use the defaults
* @param[in] CustomCmdLine Custom overrides to be applied to the command line
*
* @return STATUS_SUCCESS
* @return OTHER Other potential internal error
*/
NTSTATUS
CreateFinalConfigData(
_In_ BOOLEAN Update,
_In_opt_ std::string const& CustomCmdLine
)
{
NTSTATUS status = STATUS_SUCCESS;
DWORD lastErr = ERROR_SUCCESS;
LD_INSTALL_FILE* defaultCmd = NULL;
LD_INSTALL_FILE* finalCmd = NULL;
std::wstring defaultCmdPath;
std::wstring finalCmdPath;
HANDLE cmdDefaultFile = INVALID_HANDLE_VALUE;
HANDLE cmdFinalFile = INVALID_HANDLE_VALUE;
std::string cmdFinalBuf;
UD_NUMBER consumed = 0;
QWORD newSize = 0;
DWORD nrOfBytes = 0;
finalCmd = GetInstallFileForUniqueId(finalCmdLine);
if (!finalCmd)
{
status = STATUS_FILE_NOT_AVAILABLE;
LogFuncErrorStatus(status, "GetInstallFileForUniqueId");
goto cleanup;
}
defaultCmd = Update
? finalCmd
: GetInstallFileForUniqueId(defaultCmdLine);
if (!defaultCmd)
{
status = STATUS_FILE_NOT_AVAILABLE;
LogFuncErrorStatus(status, "GetInstallFileForUniqueId");
goto cleanup;
}
defaultCmdPath = gSdkDirs[defaultCmd->SourceDir];
defaultCmdPath += defaultCmd->SourceFileName;
finalCmdPath = gSdkDirs[finalCmd->SourceDir];
finalCmdPath += finalCmd->SourceFileName;
if (defaultCmd != finalCmd && CustomCmdLine.empty())
{
// We don't need to alter the default command line. Just copy it and return.
if (!CopyFile(defaultCmdPath.c_str(), finalCmdPath.c_str(), FALSE))
{
status = WIN32_TO_NTSTATUS(lastErr = GetLastError());
LogFuncErrorLastErr(lastErr, "CopyFile");
goto cleanup;
}
goto cleanup;
}
if (Update)
{
status = LoadConfigData(finalCmdLine);
if (!NT_SUCCESS(status))
{
LogWarning("Failed to load final cmd line\n");
}
}
// if is NOT an update or we failed to load the finalcmdline -> load the default one
if (!Update || !NT_SUCCESS(status))
{
status = LoadConfigData(defaultCmdLine);
if (!NT_SUCCESS(status))
{
LogFuncErrorStatus(status, "LoadConfigData");
goto cleanup;
}
}
if (!CustomCmdLine.empty())
{
std::string expandedCmdline;
status = ExpandCmdlineMacros(CustomCmdLine, expandedCmdline);
if (!NT_SUCCESS(status))
{
LogFuncErrorStatus(status, "ExpandCmdlineMacros");
goto cleanup;
}
if (expandedCmdline.length() > 0)
{
if (!UdMatchVariablesFromText(HvCommandLineVariablesInfo, _countof(HvCommandLineVariablesInfo), (char*)expandedCmdline.c_str(), expandedCmdline.length(), &consumed))
{
status = STATUS_FILE_CORRUPT_ERROR;
LogFuncErrorStatus(status, "UdMatchVariablesFromText");
goto cleanup;
}
}
}
UdDumpVariablesToText(HvCommandLineVariablesInfo, _countof(HvCommandLineVariablesInfo), NULL, 0, &newSize);
if (newSize <= 1 || newSize > 4 * ONE_MEGABYTE)
{
status = STATUS_INVALID_BUFFER_SIZE;
LogFuncErrorStatus(status, "UdDumpVariablesToText");
goto cleanup;
}
cmdFinalBuf.resize(static_cast<DWORD>(newSize) - 1);
if (!UdDumpVariablesToText(HvCommandLineVariablesInfo, _countof(HvCommandLineVariablesInfo), &cmdFinalBuf[0], newSize, (UD_NUMBER*)&consumed))
{
status = STATUS_VARIABLE_NOT_FOUND;
LogFuncErrorStatus(status, "UdDumpVariablesToText");
goto cleanup;
}
cmdFinalFile = CreateFile(
finalCmdPath.c_str(),
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL);
if (cmdFinalFile == INVALID_HANDLE_VALUE)
{
status = WIN32_TO_NTSTATUS(lastErr = GetLastError());
LogFuncErrorLastErr(lastErr, "CreateFile");
goto cleanup;
}
if (!WriteFile(cmdFinalFile, cmdFinalBuf.c_str(), static_cast<DWORD>(cmdFinalBuf.size()), &nrOfBytes, NULL))
{
status = WIN32_TO_NTSTATUS(lastErr = GetLastError());
LogFuncErrorLastErr(lastErr, "WriteFile");
goto cleanup;
}
status = STATUS_SUCCESS;
cleanup:
if (cmdFinalFile != INVALID_HANDLE_VALUE)
{
CloseHandle(cmdFinalFile);
}
if (cmdDefaultFile != INVALID_HANDLE_VALUE)
{
CloseHandle(cmdDefaultFile);
}
return status;
}
/**
* @brief Deploy/Remove the hypervisor (UEFI/legacy boot)
*
* @param[in] Enable If TRUE, install the hypervisor. IF FALSE, uninstall.
*
* @return STATUS_SUCCESS
* @return OTHER Other potential internal error
*/
NTSTATUS
ConfigureBoot(
__in BOOLEAN Enable
)
{
LogVerbose("%sconfiguring hypervisor", Enable ? "" : "de");
return IsUefiBootedOs()
? ConfigureUefiBoot(Enable)
: ConfigureLegacyBoot(Enable);
}
/**
* @brief Update only installed files without full reconfiguration
*
* @param[in] Flags Flags that specify which files must be updated
*
* @return STATUS_SUCCESS
* @return OTHER Other potential internal error
*/
NTSTATUS
UpdateBootFiles(
LD_INSTALL_FILE_FLAGS Flags
)
{
if (!gHypervisorConfigured)
return STATUS_SUCCESS;
return IsUefiBootedOs()
? DeployUefiBootFiles(Flags)
: DeployGrubBootFiles(Flags, FALSE);
}
| 30.662863 | 198 | 0.602185 | [
"object",
"vector"
] |
e881fbfb993c09f43e613ca0659a552a78c8e9eb | 1,445 | cpp | C++ | booster.cpp | darkoppressor/huberts-island-adventure-mouse-o-war | 9ff8d9e2c2b388bf762a0e463238794fb0233df8 | [
"MIT"
] | null | null | null | booster.cpp | darkoppressor/huberts-island-adventure-mouse-o-war | 9ff8d9e2c2b388bf762a0e463238794fb0233df8 | [
"MIT"
] | null | null | null | booster.cpp | darkoppressor/huberts-island-adventure-mouse-o-war | 9ff8d9e2c2b388bf762a0e463238794fb0233df8 | [
"MIT"
] | null | null | null | /* Copyright (c) 2012-2013 Cheese and Bacon Games, LLC */
/* See the file docs/COPYING.txt for copying permission. */
#include "booster.h"
#include "world.h"
#include "render.h"
#include "item_sprites.h"
#include "mirror.h"
#include "enumerations.h"
using namespace std;
Booster::Booster(double get_x,double get_y,double get_speed,short get_direction){
x=get_x;
y=get_y;
speed=get_speed;
direction=get_direction;
frame=0;
frame_counter=0;
}
void Booster::animate(){
/**if(frame!=0){
frame_counter++;
if(frame_counter>=1){
frame_counter=0;
frame++;
if(frame>SPRING_SPRITES-1){
frame=0;
}
}
}*/
}
void Booster::render(bool mirrored){
if(x>=player.camera_x-BOOSTER_W && x<=player.camera_x+player.camera_w && y>=player.camera_y-BOOSTER_H && y<=player.camera_y+player.camera_h){
double render_x=x;
double render_y=y;
if(mirrored && touching_mirror(x+MIRROR_DISTANCE_X,y+MIRROR_DISTANCE_Y,BOOSTER_W,BOOSTER_H)){
render_x+=MIRROR_DISTANCE_X;
render_y+=MIRROR_DISTANCE_Y;
}
bool flip=false;
if(direction==LEFT){
flip=true;
}
render_sprite((int)((int)render_x-(int)player.camera_x),(int)((int)render_y-(int)player.camera_y),image.sprite_sheet_booster,&sprites_booster[frame],1.0,1.0,1.0,0.0,COLOR_WHITE,flip);
}
}
| 25.350877 | 191 | 0.63045 | [
"render"
] |
e89741d20837fa0320bf3cf873b286a3bb25f721 | 8,762 | cpp | C++ | src/super_transit.cpp | xaanimus/super_transit_calculator | 2cd979e41427e47c9db4f3872919a3e589d90bb2 | [
"MIT"
] | null | null | null | src/super_transit.cpp | xaanimus/super_transit_calculator | 2cd979e41427e47c9db4f3872919a3e589d90bb2 | [
"MIT"
] | null | null | null | src/super_transit.cpp | xaanimus/super_transit_calculator | 2cd979e41427e47c9db4f3872919a3e589d90bb2 | [
"MIT"
] | null | null | null | #include <memory>
#include <queue>
#include <map>
#include <iostream>
#include <json.hpp>
#include "super_transit.hpp"
#include "node_database.hpp"
using namespace stransit;
using namespace std::literals;
using json = nlohmann::json;
struct node_wrapper {
node_wrapper(node* ptr_, std::chrono::minutes time_): ptr(ptr_), total_time(time_) {}
node* ptr;
std::chrono::minutes total_time;
};
class node_priority_compare {
public:
bool operator() (const node_wrapper& a, const node_wrapper& b) {
return a.total_time > b.total_time;
}
};
using node_priority_queue = std::priority_queue<node_wrapper, std::vector<node_wrapper>,
node_priority_compare>;
/**
* Performs search algorithm
*/
static void perform_search(node_database& db) {
node_priority_queue pq;
pq.emplace(&db.starting_node(), db.starting_node().time());
while (!pq.empty() && !db.done_searching()) {
node* n = pq.top().ptr;
pq.pop();
for (auto& n_edge: n->neighbors()) {
std::chrono::minutes new_time = n->time() + n_edge.time_interval;
optional_edge prev = {n_edge.time_interval, n};
node& neighbor = n_edge.neighbor;
if (!neighbor.visited) {
neighbor.visited = true;
neighbor.set_time(new_time);
neighbor.set_previous(prev);
pq.emplace(&neighbor, neighbor.time() + db.heuristic(neighbor));
} else if (new_time < neighbor.time()) {
neighbor.set_time(new_time);
neighbor.set_previous(prev);
}
}
}
}
//TODO fix the exceptions
std::map<std::string, geo_coords> make_stop_locations(const std::string& stop_locations) {
try {
std::map<std::string, geo_coords> result;
json j = json::parse(stop_locations);
if (!j.is_array()) {
throw "stop_locations json not array.";
}
for (auto& elem : j) {
std::string name = elem["Name"].get<std::string>();
double lon = elem["Longitude"].get<double>();
double lat = elem["Latitude"].get<double>();
result[name] = geo_coords(lon, lat);
}
return result;
} catch (...) {
throw "Error parsing";
}
}
/**Throws*/
time_hm parse_time(std::string str) {
std::string::size_type colon_pos = str.find(":");
std::string hour_string = str.substr(0, colon_pos);
std::string min_string = str.substr(colon_pos + 1, 2);
std::string meridian_string = str.substr(colon_pos + 3, 2);
int hour, minute;
try {
hour = std::stoi(hour_string);
minute = std::stoi(min_string);
} catch (...) {
throw "error parsing hour and minute";
}
//check bounds
if (hour < 0 || hour > 12 || minute < 0 || minute >= 60) {
throw "out of bounds time";
}
if (meridian_string == "AM") {
if (hour == 12) {
hour = 0;
}
} else if (meridian_string == "PM") {
if (hour != 12) {
hour += 12;
}
} else {
throw "bad meridian";
}
return {std::chrono::hours(hour), std::chrono::minutes(minute)};
}
using schedules_iterator = std::vector<stop_info_schedule>::iterator;
schedules_iterator find_matching_schedule(schedules_iterator begin, schedules_iterator end,
const stop_info& stop) {
return std::find_if(begin, end,
[&stop](const stop_info_schedule& schedule) -> bool {
return schedule.route_number == stop.route_number &&
schedule.day.overlap(stop.day) &&
schedule.direction == stop.direction;
});
}
static void insert_stop_sorted(std::vector<stop_info>& stops, stop_info stop) {
for (auto itr = stops.begin(); itr < stops.end(); itr++) {
if (stop.time_of_stop.compare(itr->time_of_stop).count() < 0) {
stops.insert(itr, stop);
return;
}
}
stops.push_back(stop);
}
void transit_info::add_stop(const stop_info& stop) {
schedules_iterator itr;
itr = find_matching_schedule(stop_schedules.begin(),
stop_schedules.end(), stop);
if (itr == stop_schedules.end()) {
stop_info_schedule new_schedule = {
.route_number = stop.route_number,
.day = stop.day,
.direction = stop.direction,
.stops = {stop}
};
stop_schedules.push_back(new_schedule);
return;
}
while (itr < stop_schedules.end()) {
insert_stop_sorted(itr->stops, stop);
itr = find_matching_schedule(++itr,
stop_schedules.end(), stop);
}
}
transit_info stransit::generate_transit_info_from_json(const std::string& stop_schedule,
const std::string& stop_locations) {
std::map<std::string, geo_coords> locations = make_stop_locations(stop_locations);
transit_info result;
json j = json::parse(stop_schedule);
if (!j.is_array()) {
throw "stop_schedule json not array.";
}
for (json& elem : j) {
if (!( elem["Stop"].is_string() &&
elem["Route"].is_number() &&
elem["Day"].is_string() &&
elem["Direction"].is_string() &&
elem["Time"].is_string() ))
{
continue;
}
std::string name = elem["Stop"];
int route = elem["Route"];
std::string day_str = elem["Day"];
std::string direction = elem["Direction"];
std::string time_str = elem["Time"];
time_hm t = parse_time(time_str);
geo_coords loc = locations.at(name);
day_set day = day_set(day_str);
stop_info stop = {
.name = name,
.route_number = route,
.day = day,
.direction = direction,
.time_of_stop = t,
.location = loc
};
result.add_stop(stop);
}
return result;
}
std::vector<stransit::trip> stransit::get_trips(stransit::trip_options options) {
node_database db(options.info, options.max_wait_time, options.max_walk_dist,
options.start_position, options.end_position,
options.start_day, options.start_time, options.max_num_walking_stops);
perform_search(db);
std::vector<node*> solved = db.solved_nodes();
std::vector<stransit::trip> result_trips;
//make trips from solved nodes
for (node* n : solved) {
trip result;
miles dist_walk_to_destination = n->location().distance_to(options.end_position);
std::chrono::minutes time_walk_to_destination = walking_time(dist_walk_to_destination);
time_hm time_of_arrival = n->time_of_stop().add(time_walk_to_destination);
result.duration_of_travel = n->time() + time_walk_to_destination;
result.waypoints.push_back({
.name = "Destination",
.time = time_of_arrival,
.point_kind = trip::trip_waypoint::waypoint_finish,
.path_to_next = {0min, miles(0), ""}
});
trip::trip_waypoint first_point = {
.name = n->name(),
.time = n->time_of_stop(),
.point_kind = trip::trip_waypoint::waypoint_stop,
.path_to_next = {
.period_of_travel = time_walk_to_destination,
.length_of_travel = dist_walk_to_destination,
.description = "TODO modify to provide description. ie take bus 2"
}
};
//std move
result.waypoints.insert(result.waypoints.begin(), first_point);
optional_edge current_edge = n->previous();
while (current_edge.neighbor != nullptr) {
trip::trip_waypoint point = {
.name = current_edge.neighbor->name(),
.time = current_edge.neighbor->time_of_stop(),
.point_kind = trip::trip_waypoint::waypoint_stop,
.path_to_next = {
.period_of_travel = current_edge.time_interval,
.length_of_travel = walking_distance_for_time(current_edge.time_interval),
.description = "TODO modify to provide description. ie take bus 2"
}
};
//std move
result.waypoints.insert(result.waypoints.begin(), point);
current_edge = current_edge.neighbor->previous();
}
result_trips.push_back(result);
}
return result_trips;
}
| 31.978102 | 95 | 0.567336 | [
"vector"
] |
e899c351233b27c3197c1f514b2aab27572d1c14 | 347 | hpp | C++ | include/server/handlers/algorithm_handler.hpp | TheMarex/charge | 85e35f7a6c8b8c161ecd851124d1363d5a450573 | [
"BSD-2-Clause"
] | 13 | 2018-03-09T14:37:31.000Z | 2021-07-27T06:56:35.000Z | include/server/handlers/algorithm_handler.hpp | AlexBlazee/charge | 85e35f7a6c8b8c161ecd851124d1363d5a450573 | [
"BSD-2-Clause"
] | null | null | null | include/server/handlers/algorithm_handler.hpp | AlexBlazee/charge | 85e35f7a6c8b8c161ecd851124d1363d5a450573 | [
"BSD-2-Clause"
] | 10 | 2018-04-14T02:27:32.000Z | 2021-06-13T23:30:44.000Z | #ifndef CHARGE_SERVER_HANDLERS_ALGORITHM_HANDLER_HPP
#define CHARGE_SERVER_HANDLERS_ALGORITHM_HANDLER_HPP
#include "server/route_result.hpp"
namespace charge::server::handlers
{
class AlgorithmHandler {
public:
virtual std::vector<RouteResult> route(std::uint32_t start, std::uint32_t target, bool search_space) const = 0;
};
}
#endif
| 20.411765 | 115 | 0.795389 | [
"vector"
] |
e89b6618ab51a8ce249e8dda140a4fe6bdc67ebe | 1,718 | cpp | C++ | Level-2/21. Graphs/Sentence Similarity.cpp | anubhvshrma18/PepCoding | 1d5ebd43e768ad923bf007c8dd584e217df1f017 | [
"Apache-2.0"
] | 22 | 2021-06-02T04:25:55.000Z | 2022-01-30T06:25:07.000Z | Level-2/21. Graphs/Sentence Similarity.cpp | amitdubey6261/PepCoding | 1d5ebd43e768ad923bf007c8dd584e217df1f017 | [
"Apache-2.0"
] | 2 | 2021-10-17T19:26:10.000Z | 2022-01-14T18:18:12.000Z | Level-2/21. Graphs/Sentence Similarity.cpp | amitdubey6261/PepCoding | 1d5ebd43e768ad923bf007c8dd584e217df1f017 | [
"Apache-2.0"
] | 8 | 2021-07-21T09:55:15.000Z | 2022-01-31T10:32:51.000Z | #include<bits/stdc++.h>
using namespace std;
map<string,string> p;
map<string,int> r;
string find(string x){
if(p[x]==x){
return x;
}
return p[x]=find(p[x]);
}
bool areSentencesSimilarTwo(vector<string> &words1, vector<string> &words2, vector<vector<string>> &pairs){
//
for(int i=0;i<pairs.size();i++){
string w1=pairs[i][0];
string w2=pairs[i][1];
if(p.find(w1)==p.end()){
p[w1]=w1;
r[w1]=0;
}
if(p.find(w2)==p.end()){
p[w2]=w2;
r[w2]=0;
}
string lx=find(w1);
string ly=find(w2);
if(lx!=ly){
if(r[lx]<r[ly]){
p[lx]=ly;
}
else if(r[lx] > r[ly]){
p[ly]=lx;
}
else{
p[lx]=ly;
r[ly]++;
}
}
}
if(words1.size() != words2.size()){
return false;
}
for(int i=0;i<words1.size();i++){
string w1= words1[i];
string w2=words2[i];
if(w1==w2){
continue;
}
if(p.find(w1)==p.end() || p.find(w2)==p.end() || p[w1]!=p[w2] ){
return false;
}
}
return true;
}
int main(){
int n;;
cin >> n;
vector<string> a(n),b(n);
for(int i=0;i<n;i++){
cin >> a[i];
}
for(int i=0;i<n;i++){
cin >> b[i];
}
int m;
cin >> m;
vector<vector<string>> pair(m,vector<string>(2));
for(int i=0;i<m;i++){
cin >> pair[i][0] >> pair[i][1];
}
if(areSentencesSimilarTwo(a,b,pair)){
cout << "true" << endl;
}
else{
cout << "false" << endl;
}
} | 18.673913 | 107 | 0.406868 | [
"vector"
] |
e89dc64cbc2bb37a043d001f9a114eeed265e768 | 2,039 | cpp | C++ | SubtreeQueries.cpp | Azura-yuwi/Code | 2226034e7c5abd228abb06e565fd3dcfd36a4692 | [
"MIT"
] | null | null | null | SubtreeQueries.cpp | Azura-yuwi/Code | 2226034e7c5abd228abb06e565fd3dcfd36a4692 | [
"MIT"
] | null | null | null | SubtreeQueries.cpp | Azura-yuwi/Code | 2226034e7c5abd228abb06e565fd3dcfd36a4692 | [
"MIT"
] | null | null | null | //USACO Euler Tour Technique
//CSES Tree Algorthms
//DFS + segtree
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_tuple
ll val[200005];
int en[200005]; // end of subtree
int st[200005]; //start = pos
vector<int> adj[200005];
int on;
void dfs(int src, int p)
{
st[src] = on++;
for(int i : adj[src])
{
if(i != p)
{
dfs(i, src);
}
}
en[src] = on - 1;
}
template<class T> struct segment_tree
{
const T INF = 0;
int n; vector<T> segTree;
T func(T a, T b)
{
return a+b;
}
void init(int size)
{
n = size;
segTree.assign(2*n, INF);
}
void upd(int p, T v)
{
segTree[p += n] = v;
for(p /= 2; p > 0; p /= 2)
{
segTree[p] = func(segTree[2*p], segTree[2*p+1]);
}
}
T query(int l, int r) //interval [l, r)
{
T ans = INF;
for(l += n, r += n; l < r; l /= 2, r /= 2)
{
if(l&1)
{
ans = func(ans, segTree[l++]); //same as func(ans, segTree[l]); l++
}
if(r&1)
{
ans = func(ans, segTree[--r]); //same as func(ans, segTree[r-1]); r--;
}
}
return ans;
}
};
segment_tree<ll> tree;
int main()
{
int n,q; cin >> n >> q;
for(int i = 0; i < n; i++)
{
cin >> val[i];
}
for(int i = 1; i < n; i++)
{
int a,b; cin >> a >> b;
adj[a-1].pb(b-1);
adj[b-1].pb(a-1);
}
on = 0;
dfs(0,0);
tree.init(n);
for(int i = 0; i < n; i++)
{
tree.upd(st[i], val[i]);
}
for(int i = 0; i < q; i++)
{
int type; cin >> type;
if(type == 1)
{
int a; ll b; cin >> a >> b;
tree.upd(st[a-1], b);
}
else
{
int a; cin >> a;
cout << tree.query(st[a-1], en[a-1]+1) << endl;
}
}
} | 16.577236 | 86 | 0.399215 | [
"vector"
] |
e8ac5f1eb1d3b3630f6abe8f015586a30921d20d | 3,306 | cpp | C++ | willow/src/transforms/autodiff/safeaddfwdoutputstitcher.cpp | gglin001/popart | 3225214343f6d98550b6620e809a3544e8bcbfc6 | [
"MIT"
] | 61 | 2020-07-06T17:11:46.000Z | 2022-03-12T14:42:51.000Z | willow/src/transforms/autodiff/safeaddfwdoutputstitcher.cpp | gglin001/popart | 3225214343f6d98550b6620e809a3544e8bcbfc6 | [
"MIT"
] | 1 | 2021-02-25T01:30:29.000Z | 2021-11-09T11:13:14.000Z | willow/src/transforms/autodiff/safeaddfwdoutputstitcher.cpp | gglin001/popart | 3225214343f6d98550b6620e809a3544e8bcbfc6 | [
"MIT"
] | 6 | 2020-07-15T12:33:13.000Z | 2021-11-07T06:55:00.000Z | // Copyright (c) 2021 Graphcore Ltd. All rights reserved.
#include <transforms/autodiff/safeaddfwdoutputstitcher.hpp>
#include <list>
#include <popart/graph.hpp>
#include <popart/logging.hpp>
#include <popart/op/call.hpp>
#include <transforms/autodiff/backwardsgraphcreatorhelper.hpp>
namespace popart {
SafeAddFwdOutputStitcher::SafeAddFwdOutputStitcher(AutodiffIrInterface &dep)
: Stitcher{dep}, addFwdOutputStitcher{dep},
recomputeStitcher{dep, RecomputeStitcher::StitchIndexMode::Minimal} {}
BwdGraphInfo SafeAddFwdOutputStitcher::stitch(
const GraphId &fwdGraphId,
const BwdGraphInfo &bwdGraphInfo,
const nonstd::optional<std::vector<InIndex>> &optStitchIndices) {
std::vector<InIndex> stitchIndices =
getStitchIndices(fwdGraphId, bwdGraphInfo, optStitchIndices);
// Split the indices into those to be stitched by the AddFwdOutputStitcher
// and those to be stitched by the RecomputeStitcher (never give
// AddFwdOutputStitcher an input it can't stitch).
std::vector<InIndex> addFwdStitchIndices;
std::vector<InIndex> recomputeStitchIndices;
for (InIndex stitchIndex : stitchIndices) {
const auto &expInput = bwdGraphInfo.expectedInputs.at(stitchIndex);
if (addFwdOutputStitcher.isStitchable(fwdGraphId, bwdGraphInfo, expInput)) {
addFwdStitchIndices.push_back(stitchIndex);
} else {
recomputeStitchIndices.push_back(stitchIndex);
}
}
auto result = addFwdOutputStitcher.stitch(
fwdGraphId, bwdGraphInfo, addFwdStitchIndices);
// NOTE: We are implicitly making the assumption that it is safe to use the
// indices in recomputeStitchIndices because AddFwdOutputStitcher doesn't
// change the backward graph's inputs, and hence indices are unchange.
// We check that assumption here in the interest of defensive programming.
if (bwdGraphInfo.expectedInputs != result.expectedInputs) {
throw internal_error("[SafeAddFwdOutputStitcher] AddFwdOutputStitcher has "
"unexpectedly changed the backwards graph inputs "
"(was: {}, now: {})",
bwdGraphInfo.expectedInputs,
result.expectedInputs);
}
result = recomputeStitcher.stitch(fwdGraphId, result, recomputeStitchIndices);
return result;
}
bool SafeAddFwdOutputStitcher::isDefaultStitch(
const GraphId &fwdGraphId,
const BwdGraphInfo &bwdGraphInfo,
const ExpectedConnection &expInput) {
auto &ir = dep.get();
auto &fwdGraph = ir.getGraph(fwdGraphId);
const auto &fwdId = expInput.fwdId;
const auto &type = expInput.type;
if (type != ExpectedConnectionType::Fwd) {
// We can only stitch non-gradient inputs.
return false;
}
auto isFwdInput = fwdGraph.hasInputId(fwdId);
auto isFwdOutput = fwdGraph.hasOutputId(fwdId);
if (isFwdInput || isFwdOutput) {
// Don't stitch things that don't need stitching.
return false;
}
return true;
}
bool SafeAddFwdOutputStitcher::isStitchable(
const GraphId &fwdGraphId,
const BwdGraphInfo &bwdGraphInfo,
const ExpectedConnection &expInput) {
const auto &type = expInput.type;
if (type != ExpectedConnectionType::Fwd) {
// We can only stitch non-gradient inputs.
return false;
}
return true;
}
} // namespace popart
| 31.788462 | 80 | 0.724138 | [
"vector"
] |
e8b434ca4570e3beb62c10ba2973eb61c9db2387 | 1,715 | cpp | C++ | algorithms/binarySearch/problems/031_array_division.cpp | hariharanragothaman/Learning-STL | 7e5f58083212d04b93159d44e1812069171aa349 | [
"MIT"
] | 2 | 2021-04-21T07:59:45.000Z | 2021-05-13T05:53:00.000Z | algorithms/binarySearch/problems/031_array_division.cpp | hariharanragothaman/Learning-STL | 7e5f58083212d04b93159d44e1812069171aa349 | [
"MIT"
] | null | null | null | algorithms/binarySearch/problems/031_array_division.cpp | hariharanragothaman/Learning-STL | 7e5f58083212d04b93159d44e1812069171aa349 | [
"MIT"
] | 1 | 2021-04-17T15:32:18.000Z | 2021-04-17T15:32:18.000Z | /*
* This problem is from CSES
* Similar Binary earch problems
* 1. Factory machines CSES
* 2. beautiful item in each query leetcode
* 3. 1201C - CF
*/
// Ref: https://usaco.guide/problems/cses-1620-factory-machines/solution
#include "bits/stdc++.h"
using namespace std;
#define ENABLEFASTIO() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl "\n"
#define int long long
//#define LOCAL
#ifdef LOCAL
ifstream i_data("../io/data.in");
ofstream o_data("../io/data.out");
#define cin i_data
#define cout o_data
#else
// Submit to Online Judge
#endif
/*
* For each product you need to make
* ans / k[i] jumps to make a product
* So we can binary search for the ans across the entire sample space.
*/
bool check(int pivot, vector<int> arr, int n, int k)
{
int cnt = 0;
int so_far = 0;
for(int i=0; i<n; i++)
{
if(arr[i] > pivot)
return false;
// This is the one that's actually doing the splitting
if(so_far + arr[i] > pivot)
{
so_far = 0; // so_far how many splits we are.. caluclation
cnt++;
}
so_far += arr[i];
}
if(so_far)
cnt++;
return cnt <= k;
}
int32_t main()
{
ENABLEFASTIO();
int n;
int k;
cin >> n >> k;
vector<int> arr(n, 0);
for(int i=0; i<n; i++) cin >> arr[i];
int low = 0;
int high = 1e18;
int ans = high;
while(low <= high)
{
int pivot = (low + high) >> 1;
if(check(pivot, arr, n, k))
{
ans = pivot;
high = pivot-1;
}
else
{
low = pivot+1;
}
}
cout << ans << endl;
return 0;
}
| 19.712644 | 84 | 0.54519 | [
"vector"
] |
e8bb397729e8cb2bb675fc44fbfab3f01266be9a | 33,497 | cpp | C++ | qmex.cpp | huangqinjin/QMEX | ac0ddb9eed05768c0ff58d68d5a623bb710a2701 | [
"BSL-1.0"
] | null | null | null | qmex.cpp | huangqinjin/QMEX | ac0ddb9eed05768c0ff58d68d5a623bb710a2701 | [
"BSL-1.0"
] | null | null | null | qmex.cpp | huangqinjin/QMEX | ac0ddb9eed05768c0ff58d68d5a623bb710a2701 | [
"BSL-1.0"
] | null | null | null |
//
// Copyright (c) 2018-2020 Huang Qinjin (huangqinjin@gmail.com)
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// https://www.boost.org/LICENSE_1_0.txt)
//
#include <algorithm>
#include <limits>
#include <vector>
#include <new>
#include <climits>
#include <cassert>
#include "qmex.hpp"
#include "lua.hpp"
using namespace qmex;
#ifdef _WIN32
#pragma comment(lib, "Shlwapi.lib")
extern "C" int __stdcall PathMatchSpecA(const char* pszFile, const char* pszSpec);
#else
#include <fnmatch.h>
#endif
namespace
{
bool MatchString(const char* pattern, const char* s) noexcept
{
#ifdef _WIN32
return PathMatchSpecA(s, pattern) != 0;
#else
return fnmatch(pattern, s, FNM_NOESCAPE | FNM_CASEFOLD) == 0;
#endif
}
int factor(int precision = Number::precision) noexcept
{
int f = 1;
for (int i = 0; i < precision; ++i)
f *= 10;
return f;
}
const char* const TypeName[] = {
"NIL",
"NUMBER",
"STRING",
};
const char* const OpName[] = {
"MH",
"EQ",
"LT",
"LE",
"GT",
"GE",
};
const int TypeKinds = sizeof(TypeName) / sizeof(TypeName[0]);
const int OpKinds = sizeof(OpName) / sizeof(OpName[0]);
struct StringGuard
{
char* const q;
char const b;
operator char*() const { return q; }
~StringGuard() { if (q) *q = b; }
StringGuard(const char* p, char c = '\0')
: q(const_cast<char*>(p)), b(p ? *p : '\0')
{
if (q) *q = c;
}
};
struct LuaStack
{
lua_State* const L;
const int s;
int n;
LuaStack(lua_State* L, int n) : L(L), s(lua_gettop(L)), n(n) {}
~LuaStack() { lua_pop(L, n); assert(lua_gettop(L) == s); }
};
struct LuaExpr
{
const char* expr;
std::size_t len;
explicit LuaExpr(const char* expr) : expr(expr), len(0) {}
static const char* read(lua_State* L, void* ud, size_t* size) noexcept
{
LuaExpr* t = static_cast<LuaExpr*>(ud);
if (t->expr == nullptr) return nullptr;
if (t->len == 0)
{
t->len = std::strlen(t->expr);
*size = 7;
return "return ";
}
*size = t->len;
const char* expr = t->expr;
t->expr = nullptr;
return expr;
}
};
void LuaValue(lua_State* L, int cache, KeyValue& kv) noexcept(false)
{
if (kv.type == NUMBER || (kv.type == NIL && lua_type(L, -1) == LUA_TNUMBER))
{
int isnum = 0;
lua_Number n = lua_tonumberx(L, -1, &isnum);
if (isnum) { kv.val.n = n; kv.type = NUMBER; }
else goto error;
}
else if (lua_isstring(L, -1))
{
kv.type = STRING;
kv.val.s = lua_tostring(L, -1);
lua_pushvalue(L, -1);
lua_seti(L, cache, (lua_Integer)(intptr_t)kv.val.s); //TODO keep pointer valid
}
else error:
{
const char* types[] = {
"NONE",
"NIL",
"BOOLEAN",
"LIGHTUSERDATA",
"NUMBER",
"STRING",
"TABLE",
"FUNCTION",
"USERDATA",
"THREAD",
};
int t = lua_type(L, -1) + 1;
if (t < 0 || t >= sizeof(types) / sizeof(types[0]))
{
char buf[200];
snprintf(buf, sizeof(buf), "unknown lua type %d, requires NUMBER or STRING", t - 1);
throw LuaError(buf);
}
else
{
char buf[200];
snprintf(buf, sizeof(buf), "wrong lua type %s, requires NUMBER or STRING", types[t]);
throw LuaError(buf);
}
}
}
void EvalLua(lua_State* L, int local, const char* expr, KeyValue& kv, int id) noexcept(false)
{
LuaExpr t(expr);
LuaStack s(L, 2);
lua_pushfstring(L, "%s:%d", kv.key, id);
lua_pushvalue(L, -1);
if (lua_gettable(L, local) != LUA_TFUNCTION)
{
lua_pop(L, 1);
if (lua_load(L, &LuaExpr::read, &t, kv.key, "t"))
throw LuaError(lua_tostring(L, -1));
lua_pushvalue(L, -1);
lua_insert(L, -3);
lua_settable(L, local);
lua_pushvalue(L, -1);
}
if (lua_pcall(L, 0, 1, 0))
throw LuaError(lua_tostring(L, -1));
++s.n;
lua_geti(L, -1, 1);
LuaValue(L, local, kv);
}
void CallLua(lua_State* L, int local, const char* expr, KeyValue& kv, LuaJIT* jit) noexcept(false) try
{
LuaStack s(L, 1);
if (lua_getfield(L, local, expr) != LUA_TFUNCTION)
{
lua_pop(L, 1);
LuaExpr t(expr);
if (lua_load(L, &LuaExpr::read, &t, kv.key, "t") || lua_pcall(L, 0, 1, 0))
throw LuaError(lua_tostring(L, -1));
lua_pushvalue(L, -1);
lua_setfield(L, local, expr);
}
if (lua_pcall(L, 0, 1, 0))
throw LuaError(lua_tostring(L, -1));
jit = nullptr;
LuaValue(L, local, kv);
}
catch (LuaError&)
{
if (jit)
{
jit->jit(L, expr);
CallLua(L, local, expr, kv, nullptr);
}
else
{
throw;
}
}
}
Number Number::inf() noexcept
{
Number n;
n.n = (std::numeric_limits<integer>::max)();
return n;
}
Number Number::neginf() noexcept
{
Number n;
n.n = (std::numeric_limits<integer>::min)();
return n;
}
bool Number::operator==(const Number& other) const noexcept { return n == other.n; }
bool Number::operator!=(const Number& other) const noexcept { return n != other.n; }
bool Number::operator<=(const Number& other) const noexcept { return n <= other.n; }
bool Number::operator< (const Number& other) const noexcept { return n < other.n; }
bool Number::operator>=(const Number& other) const noexcept { return n >= other.n; }
bool Number::operator> (const Number& other) const noexcept { return n > other.n; }
Number::Number() noexcept : n(0) {}
Number::Number(double d) noexcept(false) { *this = d; }
Number::Number(String s) noexcept(false) { *this = s; }
Number& Number::operator=(double d) noexcept(false)
{
if (d != d) throw std::invalid_argument("NaN not NUMBER");
d *= factor();
if (d >= 0) d += 0.5; // rounding
else d -= 0.5;
if (d >= inf().n) n = inf().n;
else if (d <= neginf().n) n = neginf().n;
else n = static_cast<integer>(d);
return *this;
}
Number& Number::operator=(String s) noexcept(false)
{
if (!s || !*s) throw std::invalid_argument("NIL not NUMBER");
const char* infs[] = {
"inf",
"infinity",
};
for (int i = 0; i < sizeof(infs) / sizeof(infs[0]); ++i)
{
const char* p = infs[i];
const char* q = s;
if (*q == '-') ++q;
while (*p && *q && (*p == *q || (*p - 'i' + 'I' == *q)))
++p, ++q;
if (*p == *q)
{
if (*s == '-') n = neginf().n;
else n = inf().n;
return *this;
}
}
errno = 0;
char* end;
long l, m = 0;
if (*s != '-' && (*s < '0' || *s > '9'))
goto error;
l = std::strtol(s, &end, 0);
if (*end != '.' && *end != '\0') goto error;
if (end[0] == '.' && end[1] != '\0') // fraction part, only supports base-10
{
const char* p = end;
while (*++p) if (*p < '0' || *p > '9') goto error;
if (errno != ERANGE)
{
char buf[precision + 1] = { 0 };
int i = 0;
while (i < precision && *++end) buf[i++] = *end;
while (i < precision) buf[i++] = '0';
m = std::strtol(buf, nullptr, 10);
}
}
if (*s == '-')
{
if (l <= (LONG_MIN + m) / factor()) l = LONG_MIN;
else l = l * factor() - m;
}
else
{
if (l >= (LONG_MAX - m) / factor()) l = LONG_MAX;
else l = l * factor() + m;
}
if (l == LONG_MAX || l >= inf().n) n = inf().n;
else if (l == LONG_MIN || l <= neginf().n) n = neginf().n;
else n = static_cast<integer>(l);
return *this;
error:
throw std::invalid_argument('`' + std::string(s) + "` not NUMBER");
}
Number::operator double() const noexcept
{
if (n == inf().n) return std::numeric_limits<double>::infinity();
if (n == neginf().n) return -std::numeric_limits<double>::infinity();
return n * 1.0 / factor();
}
Number::operator std::string() const noexcept
{
std::string s(toString(nullptr, 0), '\0');
toString(&s[0], s.size() + 1);
return s;
}
std::size_t Number::toString(char buf[], std::size_t bufsz) const noexcept
{
if (n == 0)
return snprintf(buf, bufsz, "0");
if (n == inf().n)
return snprintf(buf, bufsz, "inf");
if (n == neginf().n)
return snprintf(buf, bufsz, "-inf");
integer m = n;
int f = factor(1);
int p = precision;
while (p > 0 && (m % f) == 0) --p, m /= f;
if (p == 0)
return snprintf(buf, bufsz, "%d", m);
f = factor(p);
bool normal = false;
if (m > 0 && m < f) m += f;
else if (m < 0 && -m < f) m -= f;
else normal = true;
std::size_t len = snprintf(buf, bufsz, "%d", m) + 1;
if (buf == nullptr || bufsz <= 1) return len;
if (!normal && buf[0] != '-') buf[0] = '0';
if (!normal && buf[0] == '-' && buf[1] != '\0') buf[1] = '0';
if (bufsz + p <= len) return len;
char* end = &buf[(std::min)(len, bufsz)];
char* s = end;
while (s != &buf[len - p - 1])
{
s[0] = s[-1];
--s;
}
*s = '.';
*end = '\0';
return len;
}
const char* qmex::toString(Type type) noexcept
{
int ordinal = (int)type;
if (ordinal < 0 || ordinal >= TypeKinds)
return nullptr;
return TypeName[ordinal];
}
const char* qmex::toString(Op op) noexcept
{
int ordinal = (int)op;
if (ordinal < 0 || ordinal >= OpKinds)
return nullptr;
return OpName[ordinal];
}
std::string Value::toString(Type type) const noexcept
{
if (type == STRING) return s ? s : "";
if (type == NUMBER) return n;
return "";
}
std::string KeyValue::toString() const noexcept
{
if (type == NIL || (type == STRING && !val.s)) return key;
std::size_t keylen = std::strlen(key), vallen;
if (type == STRING) vallen = std::strlen(val.s);
else vallen = val.n.toString(nullptr, 0);
std::string s(keylen + 1 + vallen, '\0');
std::strcpy(&s[0], key);
s[keylen] = ':';
if (type == STRING) std::strcpy(&s[keylen + 1], val.s);
else val.n.toString(&s[keylen + 1], vallen + 1);
return s;
}
Criteria::Criteria(String key) noexcept(false)
{
if (!key || !*key) throw CriteriaFormatError("NIL invalid Criteria");
int ordinal = 0;
std::size_t len = std::strlen(key);
if (len < 4) goto error;
while (ordinal < OpKinds)
{
if (std::strcmp(&key[len - 2], OpName[ordinal]))
++ordinal;
else
break;
}
if (ordinal >= OpKinds) goto error;
this->key = key;
this->op = (Op)ordinal;
if (ordinal == MH) this->val.s = "";
return;
error:
throw CriteriaFormatError('`' + std::string(key) + "` invalid Criteria format");
}
Criteria::Criteria(String key, String val) noexcept(false)
{
*this = Criteria(key);
bind(val);
}
void Criteria::bind(String val) noexcept(false)
{
if (op == MH)
{
if (!val || !*val) throw ValueTypeError("Criteria [" + std::string(key) + "] requires non-NIL");
this->val.s = val;
}
else try
{
this->val.n = val;
}
catch (std::exception& e)
{
throw ValueTypeError("Criteria [" + std::string(key) + "] requires NUMBER\n" + e.what());
}
}
void Criteria::bind(Number val) noexcept(false)
{
if (op == MH)
throw ValueTypeError("Criteria [" + std::string(key) + "] requires STRING");
this->val.n = val;
}
double (Criteria::max)() noexcept
{
return std::numeric_limits<double>::infinity();
}
double (Criteria::min)() noexcept
{
return 0;
}
double Criteria::distance(const KeyValue& q) noexcept(false)
{
if (const char* s = q.key)
{
const char* p = key;
while (*p && *s && *p == *s) ++p, ++s;
if (p[0] == '\0' || p[1] == '\0' || p[2] == '\0' || p[3] != '\0')
return -1; // key mismatch
}
if (q.key == nullptr) return -1; // key mismatch
Number qn;
String qs;
Criteria t(*this);
if (q.type == NUMBER) t.bind(q.val.n);
else if (q.type == STRING) t.bind(q.val.s);
else t.bind((String)nullptr);
if (op == MH) qs = t.val.s;
else qn = t.val.n;
switch (op)
{
case MH:
for (String p = val.s; ;)
{
if (StringGuard s = std::strchr(p, '|'))
{
if (MatchString(p, qs)) return 0;
p = s + 1;
}
else
{
return MatchString(p, qs) ? 0 : (max)();
}
}
case EQ: return qn.n == val.n.n ? 0 : (max)();
case LT: return qn.n < val.n.n ? (double)val.n.n - (double)qn.n : (max)();
case LE: return qn.n <= val.n.n ? (double)val.n.n - (double)qn.n : (max)();
case GT: return qn.n > val.n.n ? (double)qn.n - (double)val.n.n : (max)();
case GE: return qn.n >= val.n.n ? (double)qn.n - (double)val.n.n : (max)();
}
return 0;
}
struct Table::Context
{
std::vector<String> cells;
int rows;
int cols;
int criteria;
bool ownL;
bool init;
lua_State* L;
LuaJIT* jit;
Context() noexcept : ownL(false), init(false) {}
~Context() noexcept { clear(); }
void clear() noexcept
{
cells.clear();
rows = 0;
cols = 0;
criteria = 0;
if (init && L && lua_getglobal(L, "QMEX_G") == LUA_TTABLE)
{
lua_pushnil(L);
lua_seti(L, -2, (lua_Integer)(intptr_t)this);
lua_pop(L, 1);
}
if (ownL && L)
{
lua_close(L);
}
ownL = false;
init = false;
L = nullptr;
}
void g() noexcept
{
if (lua_getglobal(L, "QMEX_G") != LUA_TTABLE)
{
lua_pop(L, 1);
lua_createtable(L, 0, 2);
lua_pushvalue(L, -1);
lua_setglobal(L, "QMEX_G");
}
}
int local() noexcept
{
g();
lua_geti(L, -1, (lua_Integer)(intptr_t)this);
lua_remove(L, -2);
return lua_gettop(L);
}
lua_State* lua() noexcept
{
if (L == nullptr)
{
ownL = true;
L = luaL_newstate();
luaL_openlibs(L);
jit = nullptr;
}
if (!init)
{
LuaStack s(L, 1);
g();
lua_newtable(L);
lua_seti(L, -2, (lua_Integer)(intptr_t)this);
init = true;
}
return L;
}
};
Table::Table() noexcept : ctx(new Context) {}
Table::~Table() noexcept { delete ctx; }
void Table::clear() noexcept { ctx->clear(); }
int Table::rows() const noexcept { return ctx->rows; }
int Table::cols() const noexcept { return ctx->cols; }
int Table::criteria() const noexcept { return ctx->criteria; }
String Table::cell(int i, int j) const noexcept(false)
{
if (i < 0 || i >= ctx->rows || j < 0 || j >= ctx->cols)
{
char buf[200];
snprintf(buf, sizeof(buf), "index (%d,%d) out of range %dx%d", i, j, ctx->rows, ctx->cols);
throw std::out_of_range(buf);
}
return ctx->cells[i * ctx->cols + j];
}
void Table::print(FILE* f) const noexcept
{
for (int i = 0; i < ctx->rows; ++i)
{
for (int j = 0; j < ctx->cols; ++j)
{
if (j == ctx->criteria)
std::fprintf(f, "%s ", "=");
std::fprintf(f, "%s ", cell(i, j));
}
std::fputc('\n', f);
}
}
void Table::parse(char* buf, std::size_t bufsz, lua_State* L, LuaJIT* jit) noexcept(false)
{
if (buf == nullptr || bufsz == 0 || buf[bufsz - 1] != '\0')
throw std::invalid_argument("invalid buffer input for table parse");
clear();
ctx->L = L;
ctx->jit = jit;
int j = 0, criteria = 0;
String cell = nullptr;
for (std::size_t i = 0; i < bufsz; ++i)
{
switch (char& c = buf[i])
{
case '\0':
case '\n':
if (j != 0)
{
if (ctx->cols == 0)
ctx->cols = j;
if (criteria == 0 || criteria == j)
{
char str[200];
snprintf(str, sizeof(str), "Table has no data at row %d", ctx->rows);
throw TableFormatError(str);
}
if (ctx->cols != j)
{
char str[200];
snprintf(str, sizeof(str), "Table has %d columns but %d at row %d", ctx->cols, j, ctx->rows);
throw TableFormatError(str);
}
++ctx->rows;
j = 0;
criteria = 0;
}
case ' ':
case '\t':
//case ',':
case '=':
if (c == '=' && criteria == 0)
{
criteria = j;
if (ctx->criteria == 0)
ctx->criteria = j;
if (ctx->criteria != j)
{
char str[200];
snprintf(str, sizeof(str), "Table has %d criteria but %d at row %d", ctx->criteria, j, ctx->rows);
throw TableFormatError(str);
}
else if (j == 0)
{
char str[200];
snprintf(str, sizeof(str), "Table has no criteria at row %d", ctx->rows);
throw TableFormatError(str);
}
}
if (cell)
{
ctx->cells.push_back(cell);
cell = nullptr;
c = '\0';
}
break;
default:
if (!cell) // start a new cell
{
cell = &c;
++j;
}
}
}
assert(ctx->cells.size() == ctx->rows * ctx->cols);
if (ctx->cells.empty()) throw TableFormatError("Table is empty");
}
namespace
{
struct QueryInfo : Criteria
{
int index; // of matched kvs[], -1 not matched yet, -2 no match found.
int count;
QueryInfo(Criteria c) : Criteria(c), index(-1), count(0) {}
};
}
int Table::query(const KeyValue kvs[], std::size_t num, unsigned options) noexcept(false)
{
int min_i = 0;
if (ctx->rows <= 1) return min_i;
std::vector<QueryInfo> info;
info.reserve(ctx->criteria);
for (int j = 0; j < ctx->criteria; ++j) try
{
info.push_back(Criteria(cell(0, j)));
}
catch (CriteriaFormatError& e)
{
char buf[200];
snprintf(buf, sizeof(buf), "Table row:%d, col:%d\n", 0, j + 1);
throw TableFormatError(std::string(buf) + e.what());
}
int matched = 0;
double min_d = (Criteria::max)();
for (int i = 1; i < ctx->rows; ++i)
{
double sum_d = 0;
for (int j = 0; j < (int)info.size(); ++j)
{
if (info[j].index == -2) continue;
try
{
info[j].bind(cell(i, j));
}
catch (std::exception& e)
{
char buf[200];
snprintf(buf, sizeof(buf), "Table row:%d, col:%d\n", i, j + 1);
throw TableFormatError(std::string(buf) + e.what());
}
if (info[j].index >= 0)
{
double d = info[j].distance(kvs[info[j].index]);
if (d < 0) continue; // never happen
sum_d += d;
if (sum_d >= min_d) goto next;
continue;
}
for (std::size_t k = 0; k < num; ++k)
{
double d = info[j].distance(kvs[k]);
if (d < 0) continue; // key mismatch
info[j].index = (int)k;
sum_d += d;
++matched;
if (sum_d >= min_d) goto next;
break;
}
if (info[j].index == -1)
{
info[j].index = -2; // no match found
if (!(options & QUERY_SUBSET))
{
std::string msg = "Query requires Criteria [" + std::string(info[j].key);
msg.resize(msg.size() - 2);
msg[msg.size() - 1] = ']';
throw TooFewKeys(msg);
}
}
}
if (!(options & QUERY_SUPERSET))
{
options |= QUERY_SUPERSET;
for (std::size_t j = 0; j < info.size(); ++j)
{
if (info[j].index < 0 || info[j].index >= (int)info.size())
continue;
info[info[j].index].count += 1;
}
for (std::size_t j = 0; j < (std::min)(info.size(), num); ++j)
{
if (info[j].count == 0)
throw TooManyKeys('[' + std::string(kvs[j].key) + "] not Criteria");
}
}
if (matched == 0)
break;
if (sum_d < min_d)
{
min_d = sum_d;
min_i = i;
if (min_d == 0) // current row is the best match already
break;
}
next:
;
}
return min_i;
}
void Table::verify(int row, KeyValue kvs[], std::size_t num, unsigned options) noexcept(false)
{
bool lua = false;
for (std::size_t k = 0; k < num; ++k)
{
if ((options & QUERY_SUPERSET) && kvs[k].type == NIL) continue;
bool matched = false;
for (int j = ctx->criteria; j < ctx->cols; ++j)
{
if (std::strcmp(cell(0, j), kvs[k].key)) continue;
matched = true;
if (kvs[k].type == NIL) break;
if (!lua)
{
String val = cell(row, j);
lua = val[0] == '{' || val[0] == '[';
if (lua)
{
context(kvs, num);
context(nullptr, 0);
}
}
KeyValue kv = kvs[k];
retrieve(row, j, kv);
if (kv.type == NUMBER)
{
if (kv.val.n != kvs[k].val.n)
{
char buf[200];
snprintf(buf, sizeof(buf), "Table row:%d, col:%d[%s], NUMBER %s != %s",
row, j + 1, kv.key, std::string(kv.val.n).c_str(), std::string(kvs[k].val.n).c_str());
throw TableDataError(std::string(buf));
}
}
else if (!kvs[k].val.s || !*kvs[k].val.s)
{
char buf[200];
snprintf(buf, sizeof(buf), "Table row:%d, col:%d[%s], STRING `%s` != NIL",
row, j + 1, kv.key, kv.val.s);
throw TableDataError(std::string(buf));
}
else if (std::strcmp(kv.val.s, kvs[k].val.s))
{
char buf[200];
snprintf(buf, sizeof(buf), "Table row:%d, col:%d[%s], STRING `%s` != `%s`",
row, j + 1, kv.key, kv.val.s, kvs[k].val.s);
throw TableDataError(std::string(buf));
}
break;
}
if (!matched && !(options & QUERY_SUPERSET))
throw TooManyKeys("Table no data column [" + std::string(kvs[k].key) + ']');
}
}
void Table::retrieve(int row, KeyValue kvs[], std::size_t num, unsigned options) noexcept(false)
{
bool lua = false;
for (std::size_t k = 0; k < num; ++k)
{
bool matched = false;
for (int j = ctx->criteria; j < ctx->cols; ++j)
{
if (std::strcmp(cell(0, j), kvs[k].key)) continue;
if (!lua)
{
String val = cell(row, j);
lua = val[0] == '{' || val[0] == '[';
if (lua)
{
context(kvs, num);
context(nullptr, 0);
}
}
retrieve(row, j, kvs[k]);
matched = true;
break;
}
if (!matched && !(options & QUERY_SUPERSET))
throw TooManyKeys("Retrieve ["+ std::string(kvs[k].key) + "] failed");
}
}
bool Table::retrieve(int i, int j, KeyValue& kv) noexcept(false) try
{
String val = cell(i, j);
bool lua = val[0] == '{' || val[0] == '[';
if (lua)
{
{
LuaStack s(ctx->lua(), 1);
if (lua_getglobal(ctx->lua(), kv.key) != LUA_TNIL)
{
int cache = ctx->local();
lua_pushvalue(ctx->lua(), -2);
s.n += 2;
LuaValue(ctx->lua(), cache, kv);
return lua;
}
}
for (int k = j - 1; k >= ctx->criteria; --k)
{
KeyValue ks(cell(0, k));
if (retrieve(i, k, ks)) break;
else context(&ks, 1);
}
}
if (val[0] == '{')
{
LuaStack s(ctx->lua(), 1);
EvalLua(ctx->lua(), ctx->local(), val, kv, i);
}
else if (val[0] == '[')
{
StringGuard _(val + std::strlen(val) - 1);
LuaStack s(ctx->lua(), 1);
CallLua(ctx->lua(), ctx->local(), val + 1, kv, ctx->jit);
}
else if (kv.type == NUMBER)
{
kv.val.n = val;
}
else
{
kv.val.s = val;
kv.type = STRING;
}
if (lua) context(&kv, 1);
return lua;
}
catch (std::exception& e)
{
char buf[200];
snprintf(buf, sizeof(buf), "Table row:%d, col:%d[%s]\n", i, j + 1, kv.key);
throw TableDataError(std::string(buf) + e.what());
}
void Table::context(const KeyValue kvs[], std::size_t num) noexcept
{
if (!kvs || !num)
{
for (int j = ctx->criteria; j < ctx->cols; ++j)
{
KeyValue kv(cell(0, j));
context(&kv, 1);
}
return;
}
for (std::size_t i = 0; i < num; ++i)
{
if (kvs[i].type == NUMBER)
lua_pushnumber(ctx->lua(), kvs[i].val.n);
else if (kvs[i].type == STRING)
lua_pushstring(ctx->lua(), kvs[i].val.s);
else
lua_pushnil(ctx->lua());
lua_setglobal(ctx->lua(), kvs[i].key);
}
}
namespace
{
struct LuaTable : Table, LuaJIT
{
int ref;
bool valid;
LuaTable() : ref(0), valid(false) {}
void release(lua_State* L)
{
if (valid) luaL_unref(L, LUA_REGISTRYINDEX, ref);
valid = false;
}
void jit(lua_State* L, const char* name) override
{
LuaStack s(L, 1);
if (lua_rawgeti(L, LUA_REGISTRYINDEX, ref) == LUA_TTABLE)
{
lua_getfield(L, -1, "jit");
lua_insert(L, -2);
lua_pushstring(L, name);
if (lua_pcall(L, 2, 1, 0))
throw LuaError(lua_tostring(L, -1));
}
else
{
throw LuaError("JIT not TABLE");
}
}
};
int newjit(lua_State* L)
{
lua_createtable(L, 0, 1);
return 1;
}
int newtable(lua_State* L)
{
new (lua_newuserdata(L, sizeof(LuaTable))) LuaTable;
luaL_setmetatable(L, "qmex::Table");
return 1;
}
LuaTable* totable(lua_State* L)
{
return (LuaTable*)luaL_checkudata(L, 1, "qmex::Table");
}
bool isclosed(LuaTable* t)
{
for (std::size_t i = 0; i < sizeof(LuaTable); ++i)
if (reinterpret_cast<unsigned char*>(t)[i])
return false;
return true;
}
LuaTable* checktable(lua_State* L)
{
LuaTable* t = totable(L);
if (isclosed(t))
luaL_error(L, "attempt to use a closed table");
return t;
}
int deltable(lua_State* L)
{
LuaTable* t = totable(L);
if (!isclosed(t))
{
t->release(L);
t->~LuaTable();
std::memset(t, 0, sizeof(LuaTable));
lua_pushnil(L);
lua_setuservalue(L, 1);
}
return 0;
}
std::vector<KeyValue> tokvs(lua_State* L, int idx)
{
std::vector<KeyValue> kvs;
kvs.reserve(lua_rawlen(L, idx));
lua_pushnil(L);
while (lua_next(L, idx))
{
if (lua_type(L, -2) != LUA_TSTRING) continue;
switch (lua_type(L, -1))
{
case LUA_TNUMBER:
kvs.push_back(KeyValue(lua_tostring(L, -2), lua_tonumber(L, -1)));
break;
case LUA_TSTRING:
kvs.push_back(KeyValue(lua_tostring(L, -2), lua_tostring(L, -1)));
break;
case LUA_TNIL:
kvs.push_back(KeyValue(lua_tostring(L, -2)));
break;
}
lua_pop(L, 1);
}
return kvs;
}
int parse(lua_State* L) try
{
LuaTable* t = checktable(L);
std::size_t len = 0;
const char* data = luaL_checklstring(L, 2, &len);
const bool jit = lua_gettop(L) >= 3;
if (jit) luaL_checktype(L, 3, LUA_TTABLE);
t->release(L);
if (jit)
{
lua_pushvalue(L, 3);
t->ref = luaL_ref(L, LUA_REGISTRYINDEX);
t->valid = true;
}
void* buf = lua_newuserdatauv(L, len + 1, 0);
std::memcpy(buf, data, len + 1);
lua_setuservalue(L, 1);
t->parse((char*)buf, len + 1, L, jit ? t : nullptr);
return 0;
}
catch (std::exception& e)
{
return luaL_error(L, "%s", e.what());
}
int query(lua_State* L) try
{
LuaTable* t = checktable(L);
luaL_checktype(L, 2, LUA_TTABLE);
unsigned options = (unsigned)luaL_optinteger(L, 3, QUERY_EXACTLY);
std::vector<KeyValue> kvs = tokvs(L, 2);
int row = t->query(kvs.empty() ? nullptr : &kvs[0], kvs.size(), options);
lua_pushinteger(L, row);
return 1;
}
catch (std::exception& e)
{
return luaL_error(L, "%s", e.what());
}
int verify(lua_State* L) try
{
LuaTable* t = checktable(L);
int row = (int)luaL_checkinteger(L, 2);
luaL_checktype(L, 3, LUA_TTABLE);
unsigned options = (unsigned)luaL_optinteger(L, 4, QUERY_SUBSET);
std::vector<KeyValue> kvs = tokvs(L, 3);
t->verify(row, kvs.empty() ? nullptr : &kvs[0], kvs.size(), options);
return 0;
}
catch (std::exception& e)
{
return luaL_error(L, "%s", e.what());
}
int retrieve(lua_State* L) try
{
LuaTable* t = checktable(L);
int row = (int)luaL_checkinteger(L, 2);
luaL_checktype(L, 3, LUA_TTABLE);
unsigned options = (unsigned)luaL_optinteger(L, 4, QUERY_SUBSET);
std::vector<KeyValue> kvs = tokvs(L, 3);
t->retrieve(row, kvs.empty() ? nullptr : &kvs[0], kvs.size(), options);
for (std::size_t i = 0; i < kvs.size(); ++i)
{
lua_pushstring(L, kvs[i].key);
if (kvs[i].type == NUMBER)
lua_pushnumber(L, kvs[i].val.n);
else if (kvs[i].type == STRING)
lua_pushstring(L, kvs[i].val.s);
else
lua_pushnil(L);
lua_settable(L, 3);
}
return 0;
}
catch (std::exception& e)
{
return luaL_error(L, "%s", e.what());
}
}
extern "C" int luaopen_qmex(lua_State* L)
{
if (luaL_newmetatable(L, "qmex::Table"))
{
const luaL_Reg metameth[] = {
{"__index", nullptr}, // place holder
{"__gc", deltable},
{"__close", deltable},
{"parse", parse},
{"query", query},
{"verify", verify},
{"retrieve", retrieve},
{nullptr, nullptr}
};
luaL_setfuncs(L, metameth, 0);
}
lua_setfield(L, -1, "__index");
lua_createtable(L, 0, 2 + TypeKinds + OpKinds + 3);
lua_pushliteral(L, "LuaJIT");
lua_pushcfunction(L, newjit);
lua_settable(L, -3);
lua_pushliteral(L, "Table");
lua_pushcfunction(L, newtable);
lua_settable(L, -3);
for (int i = 0; i < TypeKinds; ++i)
{
lua_pushstring(L, TypeName[i]);
lua_pushinteger(L, i);
lua_settable(L, -3);
}
for (int i = 0; i < OpKinds; ++i)
{
lua_pushstring(L, OpName[i]);
lua_pushinteger(L, i);
lua_settable(L, -3);
}
const char* const options[] = {
"QUERY_EXACTLY",
"QUERY_SUBSET",
"QUERY_SUPERSET",
};
for (int i = 0; i < sizeof(options) / sizeof(options[0]); ++i)
{
lua_pushstring(L, options[i]);
lua_pushinteger(L, i);
lua_settable(L, -3);
}
return 1;
}
| 26.970209 | 118 | 0.465594 | [
"vector"
] |
e8bb89916d395c1ec91ff1f29d8c2416c6ba3e32 | 3,328 | cc | C++ | 2017/puzzle-23-01.cc | matt-gretton-dann/advent-of-code | aae3bc7556b70286a48b6970884f00f6068f3017 | [
"Apache-2.0"
] | null | null | null | 2017/puzzle-23-01.cc | matt-gretton-dann/advent-of-code | aae3bc7556b70286a48b6970884f00f6068f3017 | [
"Apache-2.0"
] | null | null | null | 2017/puzzle-23-01.cc | matt-gretton-dann/advent-of-code | aae3bc7556b70286a48b6970884f00f6068f3017 | [
"Apache-2.0"
] | null | null | null | #include <iostream>
#include <map>
#include <regex>
#include <string>
#include <variant>
#include <vector>
using Int = long;
using Register = char;
using Operand = std::variant<Register, Int, std::monostate>;
enum class Opcode { set, sub, mul, jnz };
auto to_opcode(std::string const& s) -> Opcode
{
if (s == "set") {
return Opcode::set;
}
if (s == "sub") {
return Opcode::sub;
}
if (s == "mul") {
return Opcode::mul;
}
if (s == "jnz") {
return Opcode::jnz;
}
abort();
}
static auto operand(std::string const& s, std::size_t idx) -> std::pair<Operand, std::size_t>
{
if (idx >= s.size()) {
return {std::monostate{}, idx};
}
if (s[idx] >= 'a' && s[idx] <= 'z') {
return {s[idx], idx + 1};
}
std::size_t end{0};
auto v{std::stol(s.substr(idx), &end)};
return {v, idx + end};
}
struct Instruction
{
auto opcode() const noexcept -> Opcode { return opcode_; }
auto op1() const noexcept -> Operand { return op1_; }
auto op2() const noexcept -> Operand { return op2_; }
static auto instruction(std::string const& s) -> Instruction
{
auto opcode{to_opcode(s.substr(0, 3))};
auto [op1, idx] = operand(s, 4);
auto [op2, idx2] = operand(s, idx + 1);
return {opcode, op1, op2};
}
private:
Instruction(Opcode opcode, Operand op1, Operand op2) : opcode_(opcode), op1_(op1), op2_(op2) {}
Opcode opcode_;
Operand op1_;
Operand op2_;
};
using Instructions = std::vector<Instruction>;
struct State
{
explicit State(Instructions const& instructions) : instructions_(instructions) {}
void execute()
{
while (pc_ >= 0 && pc_ < instructions_.size()) {
auto const& instruction{instructions_[pc_]};
switch (instruction.opcode()) {
case Opcode::sub:
set(instruction.op1(), value(instruction.op1()) - value(instruction.op2()));
break;
case Opcode::jnz:
if (value(instruction.op1()) != 0) {
pc_ += value(instruction.op2()) - 1;
}
break;
case Opcode::mul:
set(instruction.op1(), value(instruction.op1()) * value(instruction.op2()));
++mul_count_;
break;
case Opcode::set:
set(instruction.op1(), value(instruction.op2()));
break;
default:
abort();
}
++pc_;
}
std::cout << "Mul executed: " << mul_count_ << " times.\n";
}
void set(Register r, Int value) { registers_.insert_or_assign(r, value); }
private:
void set(Operand const& op, Int value)
{
if (std::holds_alternative<Register>(op)) {
registers_.insert_or_assign(std::get<Register>(op), value);
}
else {
abort();
}
}
auto value(Operand const& op) const -> Int
{
if (std::holds_alternative<Register>(op)) {
auto it{registers_.find(std::get<Register>(op))};
return it == registers_.end() ? 0 : it->second;
}
if (std::holds_alternative<Int>(op)) {
return std::get<Int>(op);
}
abort();
}
Instructions instructions_;
std::map<Register, Int> registers_;
Int pc_{0};
Int mul_count_{0};
};
auto main() -> int
{
Instructions instructions;
std::string line;
while (std::getline(std::cin, line) && !line.empty()) {
instructions.push_back(Instruction::instruction(line));
}
State cpu{instructions};
cpu.execute();
return 0;
}
| 23.111111 | 97 | 0.597656 | [
"vector"
] |
e8bf21f482630ce89b934057a440c1bee325a382 | 1,709 | cpp | C++ | March Challenge 2021 Division 3/XOR.cpp | Yashdew/DSA | d211d3b53acd28879233e55b77745b60ff44410f | [
"MIT"
] | 4 | 2021-04-13T11:04:45.000Z | 2021-12-06T16:32:28.000Z | March Challenge 2021 Division 3/XOR.cpp | Yashdew/DSA | d211d3b53acd28879233e55b77745b60ff44410f | [
"MIT"
] | null | null | null | March Challenge 2021 Division 3/XOR.cpp | Yashdew/DSA | d211d3b53acd28879233e55b77745b60ff44410f | [
"MIT"
] | null | null | null | #include <bits/stdc++.h>
using namespace std;
string Binary(long long int n)
{
string s = bitset<64> (n).to_string();
const auto loc1 = s.find('1');
if(loc1 != string::npos)
return s.substr(loc1);
return "0";
}
int main()
{
long long int testCases;
cin >> testCases;
while (testCases--)
{
long long int Cvalue=0;
cin>>Cvalue;
vector<long long int> A, B;
string C = Binary(Cvalue);
if(C.length()>1 && C[0]=='1')
{
if(C[0]=='1')
{
A.push_back(1);
B.push_back(0);
}
for(long long int temp=1;temp<C.length();temp++)
{
if(C[temp]=='1')
{
A.push_back(0);
B.push_back(1);
}
else if (C[temp]=='0')
{
A.push_back(1);
B.push_back(1);
}
}
string Astr,Bstr;
for(long long int i=0;i<A.size();i++)
{
string stri = to_string(A[i]);
Astr+=string(stri);
}
for(long long int i=0;i<B.size();i++)
{
string stri = to_string(B[i]);
Bstr+=stri;
}
long long int Avalue = stoi(Astr,nullptr,2);
long long int Bvalue = stoi(Bstr,nullptr,2);
cout<<Avalue*Bvalue<<endl;
A.clear();
B.clear();
}
else if(C.size()==1 && C[0]=='1')
{
cout<<0<<endl;
}
}
return 0;
}
| 23.094595 | 60 | 0.380339 | [
"vector"
] |
e8c2df9adbf18d4874d75927b4d0ee718e259e73 | 1,400 | cpp | C++ | CONTESTS/CODEFORCES/381 740 div2/C. Alyona and mex array stimulation .cpp | priojeetpriyom/competitive-programming | 0024328972d4e14c04c0fd5d6dd3cdf131d84f9d | [
"MIT"
] | 1 | 2021-11-22T02:26:43.000Z | 2021-11-22T02:26:43.000Z | CONTESTS/CODEFORCES/381 740 div2/C. Alyona and mex array stimulation .cpp | priojeetpriyom/competitive-programming | 0024328972d4e14c04c0fd5d6dd3cdf131d84f9d | [
"MIT"
] | null | null | null | CONTESTS/CODEFORCES/381 740 div2/C. Alyona and mex array stimulation .cpp | priojeetpriyom/competitive-programming | 0024328972d4e14c04c0fd5d6dd3cdf131d84f9d | [
"MIT"
] | null | null | null | #include <bits/stdc++.h>
using namespace std;
vector < pair<int,int> > query[100010];
int ara[100010];
int main()
{
// freopen("myOut.txt", "w", stdout);
memset(ara, -1, sizeof(ara));
int n,m, ans=INT_MAX;
int mx=1;
scanf("%d %d", &n, &m);
// for(int i=0; i<n; i++)
// scanf("%d", &ara[i]);
int l,r;
for(int i=0; i<m; i++)
{
scanf("%d %d", &l, &r);
ans = min(ans, (r-l)+1);
if(l==r)
{
ara[l] = 0;
}
else
{
mx = max(mx, r-l);
query[r-l].push_back(make_pair(l-1,r-1) );
}
}
for(int i=1; i<=mx; i++)
{
int len = query[i].size();
for(int j=0; j< len; j++)
{
l = query[i][j].first;
r = query[i][j].second;
int temp = -1;
for(int k =l; k<=r; k++)
{
temp = max(ara[k], temp);
}
temp++;
for(int k =l; k<=r; k++)
{
if(ara[k] == -1)
{
ara[k] = (temp++) %1000000001;
}
}
}
}
for(int i=0; i< n; i++)
if(ara[i]== -1)
ara[i] =0;
printf("%d\n",ans);
for(int i=0; i<n; i++)
printf("%d ", ara[i]);
return 0;
}
| 21.875 | 55 | 0.331429 | [
"vector"
] |
e8c2ef830d44075e04ad8b96678bab2564598e6f | 1,924 | cpp | C++ | testStdStaticVector.cpp | Aditya90/BoostWorkspace | 7167971d3f6ede9cdd4fd7ff8e482ba9543d71bf | [
"MIT"
] | null | null | null | testStdStaticVector.cpp | Aditya90/BoostWorkspace | 7167971d3f6ede9cdd4fd7ff8e482ba9543d71bf | [
"MIT"
] | null | null | null | testStdStaticVector.cpp | Aditya90/BoostWorkspace | 7167971d3f6ede9cdd4fd7ff8e482ba9543d71bf | [
"MIT"
] | null | null | null | #include "boost/container/static_vector.hpp"
#include <iostream>
class Circle
{
private:
unsigned int radius_{0};
std::string nameCircle_{};
public:
Circle() = delete;
Circle(unsigned int radius, std::string name) : radius_(radius), nameCircle_(name) {}
virtual ~Circle() = default;
friend std::ostream &operator<<(std::ostream &output, const Circle &D)
{
output << "Name : " << D.nameCircle_ << std::endl;
output << "Radius : " << D.radius_ << std::endl;
return output;
}
};
template <class DataType>
void staticVectorPrintInfo(DataType &dataObject)
{
std::cout << "Capacity : " << dataObject.capacity() << std::endl;
std::cout << "Max Size : " << dataObject.max_size() << std::endl;
std::cout << "Size : " << dataObject.size() << std::endl;
for (const auto &element : dataObject)
{
std::cout << "Value in static vector : " << element << std::endl;
}
// Throws an exception
// std::cout << "Value in static vector : " << dataObject.at(6) << std::endl;
// Fails assertion
// std::cout << "Value in static vector : " << dataObject[6] << std::endl;
}
int main()
{
{
using IntStaticVector = boost::container::static_vector<int, 50>;
IntStaticVector staticIntVector(5);
// std::bad_alloc
// IntStaticVector staticIntVector(51);
staticVectorPrintInfo<IntStaticVector>(staticIntVector);
// Throws an exception
// std::cout << "Value in static vector : " << staticIntVector.at(6) << std::endl;
// Fails assertion
// std::cout << "Value in static vector : " << staticIntVector[6] << std::endl;
}
{
using CircleStaticVector = boost::container::static_vector<Circle, 50>;
CircleStaticVector staticIntVector(6, {5, "Circle"});
staticVectorPrintInfo<CircleStaticVector>(staticIntVector);
}
return 1;
} | 28.294118 | 90 | 0.609148 | [
"vector"
] |
e8c6006e9f06d5a4590387889a2aa317eb574b84 | 283 | cpp | C++ | fire/Sphere_Quat.cpp | FashGek/chazelle-triangulation | 3ef89edb225dbfdd09ce8fde103fe657d01bcc98 | [
"MIT"
] | 1 | 2020-10-20T04:19:49.000Z | 2020-10-20T04:19:49.000Z | fire/Sphere_Quat.cpp | FashGek/chazelle-triangulation | 3ef89edb225dbfdd09ce8fde103fe657d01bcc98 | [
"MIT"
] | null | null | null | fire/Sphere_Quat.cpp | FashGek/chazelle-triangulation | 3ef89edb225dbfdd09ce8fde103fe657d01bcc98 | [
"MIT"
] | 1 | 2020-10-20T04:20:18.000Z | 2020-10-20T04:20:18.000Z | #include "stdafx.h"
#include "Sphere_Quat.h"
#include "Sphere.h"
#include "Quat.h"
Sphere transform_sphere(SphereCR s, real scale, QuatCR rot, Vec3CR W) {return Sphere(transform_vector(s.c * scale, rot) + W, s.r * scale);} // transform a sphere by an angle preserving transform | 47.166667 | 194 | 0.724382 | [
"transform"
] |
e8c7e5013533fe0391a3b7c144c093d229e45bfb | 28,506 | cpp | C++ | moos-ivp/ivp/src/uSimMarine/USM_MOOSApp.cpp | EasternEdgeRobotics/2018 | 24df2fe56fa6d172ba3c34c1a97f249dbd796787 | [
"MIT"
] | null | null | null | moos-ivp/ivp/src/uSimMarine/USM_MOOSApp.cpp | EasternEdgeRobotics/2018 | 24df2fe56fa6d172ba3c34c1a97f249dbd796787 | [
"MIT"
] | null | null | null | moos-ivp/ivp/src/uSimMarine/USM_MOOSApp.cpp | EasternEdgeRobotics/2018 | 24df2fe56fa6d172ba3c34c1a97f249dbd796787 | [
"MIT"
] | null | null | null | /*****************************************************************/
/* NAME: Michael Benjamin */
/* ORGN: Dept of Mechanical Eng / CSAIL, MIT Cambridge MA */
/* FILE: USM_MOOSApp.cpp */
/* DATE: Oct 25th 2004 */
/* */
/* This file is part of MOOS-IvP */
/* */
/* MOOS-IvP is free software: you can redistribute it and/or */
/* modify it under the terms of the GNU General Public License */
/* as published by the Free Software Foundation, either version */
/* 3 of the License, or (at your option) any later version. */
/* */
/* MOOS-IvP is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty */
/* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */
/* the GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public */
/* License along with MOOS-IvP. If not, see */
/* <http://www.gnu.org/licenses/>. */
/*****************************************************************/
#include <iostream>
#include <math.h>
#include "USM_MOOSApp.h"
#include "MBUtils.h"
#include "ACTable.h"
#include "AngleUtils.h"
// As of Release 15.4 this is now set in CMake, defaulting to be defined
// #define USE_UTM
using namespace std;
//------------------------------------------------------------------------
// Constructor
USM_MOOSApp::USM_MOOSApp()
{
m_sim_prefix = "USM";
m_reset_count = 0;
m_geo_ok = false;
buoyancy_requested = false;
trim_requested = false;
buoyancy_delay = 5;
max_trim_delay = 10;
last_report = 0;
report_interval = 5;
last_report = 0;
report_interval = 5;
pitch_tolerance = 5;
m_obstacle_hit = false;
m_thrust_mode_reverse = false;
m_thrust_mode_differential = false;
}
//------------------------------------------------------------------------
// Procedure: OnNewMail
bool USM_MOOSApp::OnNewMail(MOOSMSG_LIST &NewMail)
{
AppCastingMOOSApp::OnNewMail(NewMail);
MOOSMSG_LIST::iterator p;
for(p=NewMail.begin(); p!=NewMail.end(); p++) {
CMOOSMsg &msg = *p;
string key = msg.GetKey();
double dval = msg.GetDouble();
string sval = msg.GetString();
if(key == "DESIRED_THRUST") {
if(m_thrust_mode_differential == false)
m_model.setThrust(dval);
}
else if(key == "DESIRED_RUDDER") {
if(m_thrust_mode_differential == false)
m_model.setRudder(dval, MOOSTime());
}
else if(key == "DESIRED_THRUST_L") {
if(m_thrust_mode_differential == true)
m_model.setThrustLeft(dval);
}
else if(key == "DESIRED_THRUST_R") {
if(m_thrust_mode_differential == true)
m_model.setThrustRight(dval);
}
else if(key == "DESIRED_ELEVATOR")
m_model.setElevator(dval);
else if(key == "USM_SIM_PAUSED")
m_model.setPaused(toupper(sval) == "TRUE");
else if(key == "THRUST_MODE_REVERSE") {
m_thrust_mode_reverse = false;
if(tolower(sval) == "true")
m_thrust_mode_reverse = true;
m_model.setThrustModeReverse(m_thrust_mode_reverse);
}
else if(key == "THRUST_MODE_DIFFERENTIAL") {
setBooleanOnString(m_thrust_mode_differential, sval);
if(m_thrust_mode_differential)
m_model.setThrustModeDiff("differential");
else
m_model.setThrustModeDiff("normal");
}
else if((key == "USM_BUOYANCY_RATE") || // Deprecated
(key == "BUOYANCY_RATE"))
m_model.setParam("buoyancy_rate", dval);
else if((key == "USM_FORCE_THETA") || // Deprecated
(key == "ROTATE_SPEED"))
m_model.setParam("rotate_speed", dval);
else if((key == "USM_FORCE_X") || // Deprecated
(key == "CURRENT_X") ||
(key == "DRIFT_X")) {
m_srcs_drift.insert(msg.GetSource());
m_model.setParam("drift_x", dval);
}
else if((key == "USM_FORCE_Y") || // Deprecated
(key == "CURRENT_Y") ||
(key == "DRIFT_Y")) {
m_srcs_drift.insert(msg.GetSource());
m_model.setParam("drift_y", dval);
}
else if((key == "USM_FORCE_VECTOR") || // Deprecated
(key == "DRIFT_VECTOR")) {
m_srcs_drift.insert(msg.GetSource());
m_model.setDriftVector(sval, false);
}
else if((key == "USM_FORCE_VECTOR_ADD") || // Deprecated
(key == "DRIFT_VECTOR_ADD")) {
m_srcs_drift.insert(msg.GetSource());
m_model.setDriftVector(sval, true);
}
else if((key == "USM_FORCE_VECTOR_MULT") || // Deprecated
(key == "DRIFT_VECTOR_MULT")) {
m_srcs_drift.insert(msg.GetSource());
m_model.magDriftVector(dval);
}
else if((key == "USM_WATER_DEPTH") || // Deprecated
(key == "WATER_DEPTH"))
m_model.setParam("water_depth", dval);
else if(key == "USM_RESET") {
m_reset_count++;
Notify("USM_RESET_COUNT", m_reset_count);
m_model.initPosition(sval);
}
else if(key == "OBSTACLE_HIT") {
if(dval != 0)
m_obstacle_hit = true;
}
// Added buoyancy and trim control and sonar handshake. HS 2012-07-22
else if (key == "BUOYANCY_CONTROL") {
if(MOOSStrCmp(sval,"true")) {
// Set buoyancy to zero to simulate trim
m_model.setParam("buoyancy_rate", 0.0);
buoyancy_request_time = MOOSTime();
std::string buoyancy_status="status=1,error=0,progressing,buoyancy=0.0";
Notify("BUOYANCY_REPORT",buoyancy_status);
buoyancy_requested = true;
last_report = buoyancy_request_time;
}
}
else if(key == "TRIM_CONTROL") {
if(MOOSStrCmp(sval,"true")) {
trim_request_time = MOOSTime();
std::string trim_status="status=1,error=0,progressing,trim_pitch=0.0,trim_roll=0.0";
Notify("TRIM_REPORT",trim_status);
trim_requested = true;
last_report = trim_request_time;
}
}
#if 0 // OLD
// Added buoyancy and trim control and sonar handshake. HS 2012-07-22
else if(key == "BUOYANCY_CONTROL") {
if(MOOSStrCmp(sval,"true")) {
// Set buoyancy to zero to simulate trim
m_model.setParam("buoyancy_rate", 0.0);
buoyancy_request_time = MOOSTime();
std::string buoyancy_status="status=1,error=0,progressing,buoyancy=0.0";
Notify("BUOYANCY_REPORT",buoyancy_status);
buoyancy_requested = true;
}
}
else if(key == "TRIM_CONTROL") {
if(MOOSStrCmp(sval,"true")) {
trim_request_time = MOOSTime();
string trim_status="status=1,error=0,progressing,trim_pitch=0.0,trim_roll=0.0";
Notify("TRIM_REPORT",trim_status);
trim_requested = true;
}
}
else
reportRunWarning("Unhandled mail: " + key);
# endif // OLD
}
return(true);
}
//------------------------------------------------------------------------
// Procedure: OnStartUp
// Note:
bool USM_MOOSApp::OnStartUp()
{
AppCastingMOOSApp::OnStartUp();
m_model.resetTime(m_curr_time);
STRING_LIST sParams;
if(!m_MissionReader.GetConfiguration(GetAppName(), sParams))
reportConfigWarning("No config block found for " + GetAppName());
STRING_LIST::iterator p;
for(p = sParams.begin();p!=sParams.end();p++) {
string orig = *p;
string line = *p;
string param = toupper(biteStringX(line, '='));
string value = line;
double dval = atof(value.c_str());
// Handle and warn of deprecated configuration parameters.
param = handleConfigDeprecations(param);
bool handled = false;
if((param == "START_X") && isNumber(value))
handled = m_model.setParam(param, dval);
else if((param == "START_Y") && isNumber(value))
handled = m_model.setParam(param, dval);
else if((param == "START_HEADING") && isNumber(value))
handled = m_model.setParam(param, dval);
else if((param == "START_SPEED") && isNumber(value))
handled = m_model.setParam(param, dval);
else if((param == "START_DEPTH") && isNumber(value))
handled = m_model.setParam(param, dval);
else if((param == "BUOYANCY_RATE") && isNumber(value))
handled = m_model.setParam(param, dval);
else if((param == "DRIFT_X") && isNumber(value))
handled = m_model.setParam("drift_x", dval);
else if((param == "DRIFT_Y") && isNumber(value))
handled = m_model.setParam("drift_y", dval);
else if((param == "ROTATE_SPEED") && isNumber(value))
handled = m_model.setParam("rotate_speed", dval);
else if((param == "MAX_ACCELERATION") && isNumber(value))
handled = m_model.setParam("max_acceleration", dval);
else if((param == "MAX_DECELERATION") && isNumber(value))
handled = m_model.setParam("max_deceleration", dval);
else if((param == "MAX_DEPTH_RATE") && isNumber(value))
handled = m_model.setParam("max_depth_rate", dval);
else if((param == "MAX_DEPTH_RATE_SPEED") && isNumber(value))
handled = m_model.setParam("max_depth_rate_speed", dval);
else if((param == "MAX_RUDDER_DEGS_PER_SEC") && isNumber(value))
handled = m_model.setMaxRudderDegreesPerSec(dval);
else if((param == "PREFIX") && !strContainsWhite(value)) {
m_sim_prefix = value;
handled = true;
}
else if(param == "DRIFT_VECTOR")
handled = m_model.setDriftVector(value);
else if((param == "SIM_PAUSE") && isBoolean(value)) {
m_model.setPaused(tolower(value) == "true");
handled = true;
}
else if((param == "DUAL_STATE") && isBoolean(value)) {
m_model.setDualState(tolower(value) == "true");
handled = true;
}
else if(param == "START_POS")
handled = m_model.initPosition(value);
else if((param == "THRUST_REFLECT") && isBoolean(value)) {
m_model.setThrustReflect(tolower(value)=="true");
handled = true;
}
else if((param == "THRUST_FACTOR") && isNumber(value))
m_model.setThrustFactor(dval);
else if(param == "THRUST_MAP")
handled = handleThrustMapping(value);
else if((param == "TURN_RATE") && isNumber(value))
handled = m_model.setParam("turn_rate", dval);
else if((param == "DEFAULT_WATER_DEPTH") && isNumber(value))
handled = m_model.setParam("water_depth", dval);
else if((param == "TRIM_TOLERANCE") && isNumber(value)) {
pitch_tolerance = dval;
handled = true;
}
else if((param == "MAX_TRIM_DELAY") && isNumber(value)) {
max_trim_delay = dval;
handled = true;
}
if(!handled)
reportUnhandledConfigWarning(orig);
}
// look for latitude, longitude global variables
double latOrigin, longOrigin;
if(!m_MissionReader.GetValue("LatOrigin", latOrigin)) {
MOOSTrace("uSimMarine: LatOrigin not set in *.moos file.\n");
m_geo_ok = false;
}
else if(!m_MissionReader.GetValue("LongOrigin", longOrigin)) {
MOOSTrace("uSimMarine: LongOrigin not set in *.moos file\n");
m_geo_ok = false;
}
else {
m_geo_ok = true;
// initialize m_geodesy
if(!m_geodesy.Initialise(latOrigin, longOrigin)) {
MOOSTrace("uSimMarine: Geodesy init failed.\n");
m_geo_ok = false;
}
}
cacheStartingInfo();
registerVariables();
MOOSTrace("uSimMarine started \n");
return(true);
}
//------------------------------------------------------------------------
// Procedure: OnConnectToServer
// Note:
bool USM_MOOSApp::OnConnectToServer()
{
registerVariables();
MOOSTrace("Sim connected\n");
return(true);
}
//------------------------------------------------------------------------
// Procedure: cacheStartingInfo()
void USM_MOOSApp::cacheStartingInfo()
{
NodeRecord record = m_model.getNodeRecord();
double nav_x = record.getX();
double nav_y = record.getY();
double depth = m_model.getWaterDepth();
double nav_depth = record.getDepth();
double nav_alt = depth - nav_depth;
double nav_lat = 0;
double nav_lon = 0;
if(m_geo_ok) {
#ifdef USE_UTM
m_geodesy.UTM2LatLong(nav_x, nav_y, nav_lat, nav_lon);
#else
m_geodesy.LocalGrid2LatLong(nav_x, nav_y, nav_lat, nav_lon);
#endif
}
m_start_nav_x = doubleToStringX(nav_x,2);
m_start_nav_y = doubleToStringX(nav_y,2);
m_start_nav_lat = doubleToStringX(nav_lat,8);
m_start_nav_lon = doubleToStringX(nav_lon,8);
m_start_nav_spd = doubleToStringX(record.getSpeed(),2);
m_start_nav_hdg = doubleToStringX(record.getHeading(),1);
m_start_nav_dep = doubleToStringX(record.getDepth(),2);
m_start_nav_alt = doubleToStringX(nav_alt,2);
m_start_buoyrate = doubleToStringX(m_model.getBuoyancyRate(),8);
m_start_drift_x = doubleToStringX(m_model.getDriftX(),4);
m_start_drift_y = doubleToStringX(m_model.getDriftY(),4);
m_start_drift_mag = doubleToStringX(m_model.getDriftMag(),4);
m_start_drift_ang = doubleToStringX(m_model.getDriftAng(),4);
m_start_rotate_spd = doubleToStringX(m_model.getRotateSpd(),4);
}
//------------------------------------------------------------------------
// Procedure: registerVariables
void USM_MOOSApp::registerVariables()
{
AppCastingMOOSApp::RegisterVariables();
Register("DESIRED_RUDDER", 0);
Register("DESIRED_THRUST", 0);
Register("DESIRED_ELEVATOR", 0);
Register("DESIRED_THRUST_L", 0);
Register("DESIRED_THRUST_R", 0);
Register("USM_BUOYANCY_RATE", 0); // Deprecated
Register("BUOYANCY_RATE", 0);
Register("USM_WATER_DEPTH", 0); // Deprecated
Register("WATER_DEPTH", 0);
Register("USM_FORCE_X", 0); // Deprecated
Register("CURRENT_X",0);
Register("DRIFT_X",0);
Register("USM_FORCE_Y", 0); // Dperecated
Register("CURRENT_Y",0);
Register("DRIFT_Y",0);
Register("USM_FORCE_VECTOR", 0); // Deprecated
Register("DRIFT_VECTOR", 0);
Register("USM_FORCE_VECTOR_ADD", 0); // Deprecated
Register("DRIFT_VECTOR_ADD", 0);
Register("USM_FORCE_VECTOR_MULT", 0); // Deprecated
Register("DRIFT_VECTOR_MULT", 0);
Register("USM_FORCE_THETA", 0); // Deprecated
Register("ROTATE_SPEED", 0);
Register("USM_SIM_PAUSED", 0);
Register("USM_RESET", 0);
Register("OBSTACLE_HIT", 0);
// Added buoyancy and trim control and sonar handshake
Register("TRIM_CONTROL",0);
Register("BUOYANCY_CONTROL",0);
Register("THRUST_MODE_REVERSE",0);
Register("THRUST_MODE_DIFFERENTIAL",0);
}
//------------------------------------------------------------------------
// Procedure: Iterate
// Note: This is where it all happens.
bool USM_MOOSApp::Iterate()
{
AppCastingMOOSApp::Iterate();
if(!m_obstacle_hit)
m_model.propagate(m_curr_time);
NodeRecord record = m_model.getNodeRecord();
double pitch_degrees = record.getPitch()*180.0/M_PI;
#if 1
if(m_thrust_mode_reverse) {
record.setHeading(angle360(record.getHeading()+180));
record.setHeadingOG(angle360(record.getHeadingOG()+180));
record.setThrustModeReverse(true);
double pi = 3.1415926;
double new_yaw = record.getYaw() + pi;
if(new_yaw > (2* pi))
new_yaw = new_yaw - (2 * pi);
record.setYaw(new_yaw);
}
#endif
// buoyancy and trim control
if(buoyancy_requested) {
if(m_curr_time-buoyancy_request_time >= buoyancy_delay) {
string buoyancy_status="status=2,error=0,completed,buoyancy=0.0";
Notify("BUOYANCY_REPORT",buoyancy_status);
buoyancy_requested = false;
}
else if(m_curr_time - last_report >= report_interval) {
string buoyancy_status="status=1,error=0,progressing,buoyancy=0.0";
Notify("BUOYANCY_REPORT",buoyancy_status);
last_report = m_curr_time;
}
}
if(trim_requested) {
if(((fabs(pitch_degrees) <= pitch_tolerance)
&& (m_curr_time-trim_request_time >= buoyancy_delay))
|| (m_curr_time-trim_request_time) >= max_trim_delay) {
string trim_status="status=2,error=0,completed,trim_pitch="
+ doubleToString(pitch_degrees) + ",trim_roll=0.0";
Notify("TRIM_REPORT",trim_status);
trim_requested = false;
}
else if((m_curr_time - last_report) >= report_interval) {
string trim_status="status=1,error=0,progressing,trim_pitch="
+ doubleToString(pitch_degrees) + ",trim_roll=0.0";
Notify("TRIM_REPORT",trim_status);
last_report = m_curr_time;
}
}
postNodeRecordUpdate(m_sim_prefix, record);
if(m_model.usingDualState()) {
NodeRecord record_gt = m_model.getNodeRecordGT();
postNodeRecordUpdate(m_sim_prefix+"_GT", record_gt);
}
if(m_model.isDriftFresh()) {
Notify("USM_FSUMMARY", m_model.getDriftSummary());
Notify("USM_DRIFT_SUMMARY", m_model.getDriftSummary());
m_model.setDriftFresh(false);
}
AppCastingMOOSApp::PostReport();
return(true);
}
//------------------------------------------------------------------------
// Procedure: postNodeRecordUpdate
void USM_MOOSApp::postNodeRecordUpdate(string prefix,
const NodeRecord &record)
{
double nav_x = record.getX();
double nav_y = record.getY();
Notify(prefix+"_X", nav_x, m_curr_time);
Notify(prefix+"_Y", nav_y, m_curr_time);
if(m_geo_ok) {
double lat, lon;
#ifdef USE_UTM
m_geodesy.UTM2LatLong(nav_x, nav_y, lat, lon);
#else
m_geodesy.LocalGrid2LatLong(nav_x, nav_y, lat, lon);
#endif
Notify(prefix+"_LAT", lat, m_curr_time);
Notify(prefix+"_LONG", lon, m_curr_time);
}
double new_speed = record.getSpeed();
new_speed = snapToStep(new_speed, 0.01);
Notify(prefix+"_HEADING", record.getHeading(), m_curr_time);
Notify(prefix+"_SPEED", new_speed, m_curr_time);
Notify(prefix+"_DEPTH", record.getDepth(), m_curr_time);
// Added by HS 120124 to make it work ok with iHuxley
Notify("SIMULATION_MODE","TRUE", m_curr_time);
Notify(prefix+"_Z", -record.getDepth(), m_curr_time);
Notify(prefix+"_PITCH", record.getPitch(), m_curr_time);
Notify(prefix+"_YAW", record.getYaw(), m_curr_time);
Notify("TRUE_X", nav_x, m_curr_time);
Notify("TRUE_Y", nav_y, m_curr_time);
double hog = angle360(record.getHeadingOG());
double sog = record.getSpeedOG();
Notify(prefix+"_HEADING_OVER_GROUND", hog, m_curr_time);
Notify(prefix+"_SPEED_OVER_GROUND", sog, m_curr_time);
if(record.isSetAltitude())
Notify(prefix+"_ALTITUDE", record.getAltitude(), m_curr_time);
}
//--------------------------------------------------------------------
// Procedure: handleThrustMapping
//
bool USM_MOOSApp::handleThrustMapping(string mapping)
{
if(mapping == "")
return(false);
vector<string> svector = parseString(mapping, ',');
unsigned int i, vsize = svector.size();
for(i=0; i<vsize; i++) {
string thrust = biteStringX(svector[i], ':');
string speed = svector[i];
if(!isNumber(thrust) || !isNumber(speed))
return(false);
double dthrust = atof(thrust.c_str());
double dspeed = atof(speed.c_str());
bool ok = m_model.addThrustMapping(dthrust, dspeed);
if(!ok)
return(false);
}
return(true);
}
//--------------------------------------------------------------------
// Procedure: handleConfigDeprecations
//
string USM_MOOSApp::handleConfigDeprecations(string param)
{
string new_param = param;
param = toupper(param);
if(param == "FORCE_X")
new_param = "DRIFT_X";
else if(param == "FORCE_Y")
new_param = "DRIFT_Y";
else if(param == "STARTHEADING")
new_param = "START_HEADING";
else if(param == "STARTDEPTH")
new_param = "START_DEPTH";
else if(param == "STARTSPEED")
new_param = "START_SPEED";
else if(param == "FORCE_THETA")
new_param = "ROTATE_SPEED";
else if(param == "FORCE_VECTOR")
new_param = "DRIFT_VECTOR";
if(param != new_param)
reportConfigWarning(param + " is deprecated. Use instead: " + new_param);
return(new_param);
}
//------------------------------------------------------------------------
// Procedure: buildReport
// Note: A virtual function of the AppCastingMOOSApp superclass,
// conditionally invoked if either a terminal or appcast
// report is needed.
//
// Datum: 43.825300, -71.087589, (MIT Sailing Pavilion)
//
// Starting Pose Current Pose
// -------- ---------- -------- -----------
// Heading: 180 Heading: 134.8
// Speed: 0 Speed: 1.2
// Depth: 0 Depth: 37.2
// Altitude: 58 Altitude: 20.8
// (X,Y): 0,0 (X,Y): -4.93,-96.05
// Lat: 43.8253 Lat: 43.82443465
// Lon: -70.3304 Lon: -70.33044214
// External Drift X Y | Mag Ang | Rotate | Source(s)
// -------------- -- -- | --- --- | ------ | -----------
// Starting 0 0 | 0 0 | 0 | init_config
// Present 0 0 | 0 0 | 0 | n/a
//
// Dual state: true
//
// DESIRED_THRUST=24 ==> Speed=1.2
// Using Thrust Factor: false
// Positive Thrust Map: 0:1, 20:2.4, 50:4.2, 80:4.8, 100:5.0
// Negative Thrust Map: -100:-3.5, -75:-3.2, -10:-2,
// Max Acceleration: 0
// Max Deceleration: 0.5
//
// DESIRED_ELEVATOR=-12 ==> Depth=37.2
// Max Depth Rate: 0.5
// Max Depth Rate Speed: 2.0
// Water depth: 58
bool USM_MOOSApp::buildReport()
{
NodeRecord record = m_model.getNodeRecord();
double nav_x = record.getX();
double nav_y = record.getY();
double nav_alt = m_model.getWaterDepth() - record.getDepth();
if(nav_alt < 0)
nav_alt = 0;
NodeRecord record_gt = m_model.getNodeRecordGT();
double nav_x_gt = record_gt.getX();
double nav_y_gt = record_gt.getY();
double nav_alt_gt = m_model.getWaterDepth() - record_gt.getDepth();
if(nav_alt_gt < 0)
nav_alt_gt = 0;
bool dual_state = m_model.usingDualState();
double nav_lat = 0;
double nav_lon = 0;
double nav_lat_gt = 0;
double nav_lon_gt = 0;
if(m_geo_ok) {
#ifdef USE_UTM
m_geodesy.UTM2LatLong(nav_x, nav_y, nav_lat, nav_lon);
m_geodesy.UTM2LatLong(nav_x_gt, nav_y_gt, nav_lat_gt, nav_lon_gt);
#else
m_geodesy.LocalGrid2LatLong(nav_x_gt, nav_y_gt, nav_lat_gt, nav_lon_gt);
m_geodesy.LocalGrid2LatLong(nav_x_gt, nav_y_gt, nav_lat_gt, nav_lon_gt);
#endif
}
string datum_lat = doubleToStringX(m_geodesy.GetOriginLatitude(),9);
string datum_lon = doubleToStringX(m_geodesy.GetOriginLongitude(),9);
m_msgs << "Datum: " + datum_lat + "," + datum_lon;
m_msgs << endl << endl;
// Part 1: Pose Information ===========================================
ACTable actab(6,1);
actab << "Start | Pose | Current | Pose (NAV) | Current | Pose (GT)";
actab.addHeaderLines();
actab.setColumnPadStr(1, " "); // Pad w/ extra blanks between cols 1&2
actab.setColumnPadStr(3, " "); // Pad w/ extra blanks between cols 3&4
actab.setColumnJustify(0, "right");
actab.setColumnJustify(2, "right");
actab.setColumnJustify(4, "right");
actab << "Headng:" << m_start_nav_hdg;
actab << "Headng:" << doubleToStringX(record.getHeading(),1);
if(dual_state)
actab << "Headng:" << doubleToStringX(record.getHeading(),1);
else
actab << "(same)" << "-";
actab << "Speed:" << m_start_nav_spd;
actab << "Speed:" << doubleToStringX(record.getSpeed(),2);
if(dual_state)
actab << "Speed:" << doubleToStringX(record_gt.getSpeed(),2);
else
actab << " " << "-";
actab << "Depth:" << m_start_nav_dep;
actab << "Depth:" << doubleToStringX(record.getDepth(),1);
if(dual_state)
actab << "Depth:" << doubleToStringX(record_gt.getDepth(),1);
else
actab << " " << "-";
actab << "Alt:" << m_start_nav_alt;
actab << "Alt:" << doubleToStringX(nav_alt,1);
if(dual_state)
actab << "Alt:" << doubleToStringX(nav_alt_gt,1);
else
actab << " " << "-";
actab << "(X,Y):" << m_start_nav_x +","+ m_start_nav_y;
actab << "(X,Y):" << doubleToStringX(nav_x,2) + "," + doubleToStringX(nav_y,2);
if(dual_state)
actab << "(X,Y):" << doubleToStringX(nav_x_gt,2) +","+ doubleToStringX(nav_y_gt,2);
else
actab << " " << "-";
actab << "Lat:" << m_start_nav_lat;
actab << "Lat:" << doubleToStringX(nav_lat,8);
if(dual_state)
actab << "Lat:" << doubleToStringX(nav_lat_gt,8);
else
actab << " " << "-";
actab << "Lon:" << m_start_nav_lon;
actab << "Lon:" << doubleToStringX(nav_lon,8);
if(dual_state)
actab << "Lon:" << doubleToStringX(nav_lon_gt,8);
else
actab << " " << "-";
m_msgs << actab.getFormattedString();
// Part 2: Buoyancy Info ==============================================
string buoy_rate_now = doubleToStringX(m_model.getBuoyancyRate(),8);
string buoy_srcs = "initial_config";
if(m_srcs_buoyrate.size() != 0)
buoy_srcs = setToString(m_srcs_buoyrate);
m_msgs << endl;
m_msgs << "Present Buoyancy rate: " << buoy_rate_now << endl;
m_msgs << " Starting rate: " << m_start_buoyrate << endl;
m_msgs << " Source: " << buoy_srcs << endl;
// Part 3: External Drift Info =======================================
m_msgs << endl;
actab = ACTable(7,2);
actab << "Ext Drift | X | Y | Mag | Ang | Rot. |Source(s)";
actab.addHeaderLines();
actab.setColumnJustify(0, "right");
actab.setColumnPadStr(2, " | ");
actab.setColumnPadStr(4, " | ");
actab.setColumnPadStr(5, " | ");
actab << "Starting" << m_start_drift_x << m_start_drift_y << m_start_drift_mag;
actab << m_start_drift_ang << m_start_rotate_spd << "init_config";
string drift_x = doubleToStringX(m_model.getDriftX(),3);
string drift_y = doubleToStringX(m_model.getDriftY(),3);
string drift_mag = doubleToStringX(m_model.getDriftMag(),4);
string drift_ang = doubleToStringX(m_model.getDriftAng(),4);
string rotate_spd = doubleToStringX(m_model.getRotateSpd(),4);
if(drift_mag == "0")
drift_ang = "0";
string drift_srcs = "n/a";
if(m_srcs_drift.size() != 0)
drift_srcs = setToString(m_srcs_drift);
actab << "Present" << drift_x << drift_y << drift_mag << drift_ang;
actab << rotate_spd << drift_srcs;
m_msgs << actab.getFormattedString();
m_msgs << endl << endl;
// Part 4: Speed/Thrust Info =======================================
m_msgs << "Velocity Information: " << endl;
m_msgs << "--------------------- " << endl;
m_msgs << " DESIRED_THRUST=" << doubleToStringX(m_model.getThrust(),1);
m_msgs << " ==> SPEED=" << doubleToStringX(record.getSpeed(),2) << endl;
bool using_thrust_factor = m_model.usingThrustFactor();
m_msgs << " Using Thrust_Factor: " << boolToString(using_thrust_factor);
if(using_thrust_factor)
m_msgs << " (" + doubleToStringX(m_model.getThrustFactor(),4) + ")";
m_msgs << endl;
string max_acceleration = doubleToStringX(m_model.getMaxAcceleration(),6);
string max_deceleration = doubleToStringX(m_model.getMaxDeceleration(),6);
string posmap = m_model.getThrustMapPos();
string negmap = m_model.getThrustMapNeg();
string thrust_mode = m_model.getThrustModeDiff();
string desired_thrust_l = "n/a";
string desired_thrust_r = "n/a";
if(thrust_mode == "differential") {
desired_thrust_l = doubleToStringX(m_model.getThrustLeft(),2);
desired_thrust_r = doubleToStringX(m_model.getThrustRight(),2);
}
string thrust_mode_reverse = boolToString(m_model.getThrustModeReverse());
if(posmap == "")
posmap = "n/a";
if(negmap == "")
negmap = "n/a";
m_msgs << " Positive Thrust Map: " << posmap << endl;
m_msgs << " Negative Thrust Map: " << negmap << endl;
m_msgs << " Max Accereration: " << max_acceleration << endl;
m_msgs << " Max Decereration: " << max_deceleration << endl << endl;
m_msgs << " Thrust Mode: " << thrust_mode << endl;
m_msgs << " Thrust Mode Reverse: " << thrust_mode_reverse << endl;
m_msgs << " DESIRED_THRUST_L: " << desired_thrust_l << endl;
m_msgs << " DESIRED_THRUST_R: " << desired_thrust_r << endl;
// Part 5: Speed/Depth Change Info ===========================
string max_depth_rate = doubleToStringX(m_model.getMaxDepthRate(),6);
string max_depth_rate_v = doubleToStringX(m_model.getMaxDepthRateSpd(),6);
m_msgs << endl;
m_msgs << "Depth Information: " << endl;
m_msgs << "------------------ " << endl;
m_msgs << " Max Depth Rate: " << max_depth_rate << endl;
m_msgs << " Max Depth Rate Speed: " << max_depth_rate_v << endl;
m_msgs << " Water Depth: " << m_model.getWaterDepth() << endl;
return(true);
}
| 33.185099 | 88 | 0.613345 | [
"vector"
] |
e8d296c697b6ec2ff21359ca1879599297de9085 | 2,887 | cpp | C++ | leetcode/problems/hard/1847-closest-room.cpp | wingkwong/competitive-programming | e8bf7aa32e87b3a020b63acac20e740728764649 | [
"MIT"
] | 18 | 2020-08-27T05:27:50.000Z | 2022-03-08T02:56:48.000Z | leetcode/problems/hard/1847-closest-room.cpp | wingkwong/competitive-programming | e8bf7aa32e87b3a020b63acac20e740728764649 | [
"MIT"
] | null | null | null | leetcode/problems/hard/1847-closest-room.cpp | wingkwong/competitive-programming | e8bf7aa32e87b3a020b63acac20e740728764649 | [
"MIT"
] | 1 | 2020-10-13T05:23:58.000Z | 2020-10-13T05:23:58.000Z | /*
Closest Room
https://leetcode.com/problems/closest-room/
There is a hotel with n rooms. The rooms are represented by a 2D integer array rooms where rooms[i] = [roomIdi, sizei] denotes that there is a room with room number roomIdi and size equal to sizei. Each roomIdi is guaranteed to be unique.
You are also given k queries in a 2D array queries where queries[j] = [preferredj, minSizej]. The answer to the jth query is the room number id of a room such that:
The room has a size of at least minSizej, and
abs(id - preferredj) is minimized, where abs(x) is the absolute value of x.
If there is a tie in the absolute difference, then use the room with the smallest such id. If there is no such room, the answer is -1.
Return an array answer of length k where answer[j] contains the answer to the jth query.
Example 1:
Input: rooms = [[2,2],[1,2],[3,2]], queries = [[3,1],[3,3],[5,2]]
Output: [3,-1,3]
Explanation: The answers to the queries are as follows:
Query = [3,1]: Room number 3 is the closest as abs(3 - 3) = 0, and its size of 2 is at least 1. The answer is 3.
Query = [3,3]: There are no rooms with a size of at least 3, so the answer is -1.
Query = [5,2]: Room number 3 is the closest as abs(3 - 5) = 2, and its size of 2 is at least 2. The answer is 3.
Example 2:
Input: rooms = [[1,4],[2,3],[3,5],[4,1],[5,2]], queries = [[2,3],[2,4],[2,5]]
Output: [2,1,3]
Explanation: The answers to the queries are as follows:
Query = [2,3]: Room number 2 is the closest as abs(2 - 2) = 0, and its size of 3 is at least 3. The answer is 2.
Query = [2,4]: Room numbers 1 and 3 both have sizes of at least 4. The answer is 1 since it is smaller.
Query = [2,5]: Room number 3 is the only room with a size of at least 5. The answer is 3.
Constraints:
n == rooms.length
1 <= n <= 105
k == queries.length
1 <= k <= 104
1 <= roomIdi, preferredj <= 107
1 <= sizei, minSizej <= 107
*/
class Solution {
public:
vector<int> closestRoom(vector<vector<int>>& rooms, vector<vector<int>>& queries) {
int n = rooms.size(), m = queries.size();
vector<int> ans(m);
for(int i = 0; i < m; i++) queries[i].push_back(i);
sort(rooms.begin(), rooms.end(), [&](vector<int>& x, vector<int>& y){
return x[1] > y[1];
});
sort(queries.begin(), queries.end(), [&](vector<int>& x, vector<int>& y){
return x[1] > y[1];
});
auto it1 = rooms.begin();
set<int> ids;
for(auto q : queries) {
for(; it1 != rooms.end() && (*it1)[1] >= q[1]; it1++) ids.insert((*it1)[0]);
auto it2 = ids.lower_bound(q[0]);
int ans1 = it2 == ids.begin() ? -1 : *(prev(it2));
int ans2 = it2 == ids.end() ? -1 : *it2;
ans[q[2]] = min(ans1, ans2) == -1 ? max(ans1, ans2) : abs(ans1 - q[0]) <= abs(ans2 - q[0]) ? ans1 : ans2;
}
return ans;
}
}; | 42.455882 | 238 | 0.611708 | [
"vector"
] |
e8d36be67947b729326511d4453a89766a7e20bc | 692 | cpp | C++ | Dynamic Programming/Coin Combinations II.cpp | razouq/cses | 82534f4ac37a690b5cd72ab094d5276bd01dd64e | [
"MIT"
] | 3 | 2021-03-14T18:47:13.000Z | 2021-03-19T09:59:56.000Z | Dynamic Programming/Coin Combinations II.cpp | razouq/cses | 82534f4ac37a690b5cd72ab094d5276bd01dd64e | [
"MIT"
] | null | null | null | Dynamic Programming/Coin Combinations II.cpp | razouq/cses | 82534f4ac37a690b5cd72ab094d5276bd01dd64e | [
"MIT"
] | null | null | null | #include "bits/stdc++.h"
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#define ll long long
#define ull unsigned long long
#define F first
#define S second
#define PB push_back
#define POB pop_back
using namespace std;
vector<ll> coins;
ll n, x;
int main(){
// freopen("input.in", "r", stdin);
// freopen("output.out", "w", stdout);
ios::sync_with_stdio(0);
cin.tie();
cin>>n>>x;
coins.resize(n);
for(ll &coin : coins) cin>>coin;
ll dp[x+1];
memset(dp, 0, sizeof dp);
dp[0] = 1;
for(int j = 0; j < n; j++) {
for(int i = 1; i < x+1; i++) {
if(i - coins[j] >= 0) dp[i] += dp[i - coins[j]];
dp[i] %= 1000000007;
}
}
cout<<dp[x]<<endl;
return 0;
}
| 16.093023 | 51 | 0.583815 | [
"vector"
] |
e8d54b0b0ec1b5a488c26c4f7ab2d1003852d720 | 926 | cpp | C++ | Geometry/EcalTestBeam/test/testEcalTBCrystalMap.cpp | nistefan/cmssw | ea13af97f7f2117a4f590a5e654e06ecd9825a5b | [
"Apache-2.0"
] | 3 | 2018-08-24T19:10:26.000Z | 2019-02-19T11:45:32.000Z | Geometry/EcalTestBeam/test/testEcalTBCrystalMap.cpp | nistefan/cmssw | ea13af97f7f2117a4f590a5e654e06ecd9825a5b | [
"Apache-2.0"
] | 3 | 2018-08-23T13:40:24.000Z | 2019-12-05T21:16:03.000Z | Geometry/EcalTestBeam/test/testEcalTBCrystalMap.cpp | nistefan/cmssw | ea13af97f7f2117a4f590a5e654e06ecd9825a5b | [
"Apache-2.0"
] | 5 | 2018-08-21T16:37:52.000Z | 2020-01-09T13:33:17.000Z | #include "Geometry/EcalTestBeam/interface/EcalTBCrystalMap.h"
#include "FWCore/ParameterSet/interface/FileInPath.h"
#include "CLHEP/Random/RandFlat.h"
#include <string>
int main()
{
edm::FileInPath dataFile("Geometry/EcalTestBeam/data/BarrelSM1CrystalCenterElectron120GeV.dat");
EcalTBCrystalMap theTestMap(dataFile.fullPath());
long nCrystal = 1700;
for ( int i = 0 ; i < 10 ; ++i ) {
int thisCrystal = CLHEP::RandFlat::shootInt(nCrystal);
double thisEta = 0.;
double thisPhi = 0.;
theTestMap.findCrystalAngles(thisCrystal, thisEta, thisPhi);
std::cout << "Crystal number " << thisCrystal << " eta = " << thisEta << " phi = " << thisPhi << std::endl;
int checkThisCrystal = theTestMap.CrystalIndex(thisEta, thisPhi);
std::cout << "(eta,phi) = " << thisEta << " , " << thisPhi << " corresponds to crystal n. = " << checkThisCrystal << std::endl;
}
return 0;
}
| 28.060606 | 131 | 0.661987 | [
"geometry"
] |
e8dec0feba48efd6fc7e66f12721691a74a02b8b | 6,299 | cpp | C++ | TextureGeneratorGUI/Unit_Testing/PerlinNoise.cpp | seb776/Tricible | fb1b7c7e027231c158a1945d3568777c4092ca6d | [
"Apache-2.0"
] | 2 | 2017-09-08T04:52:01.000Z | 2018-10-13T14:30:52.000Z | TextureGeneratorGUI/Unit_Testing/PerlinNoise.cpp | seb776/Tricible | fb1b7c7e027231c158a1945d3568777c4092ca6d | [
"Apache-2.0"
] | 2 | 2018-10-24T12:48:00.000Z | 2018-11-02T16:15:21.000Z | TextureGeneratorGUI/Unit_Testing/PerlinNoise.cpp | seb776/Tricible | fb1b7c7e027231c158a1945d3568777c4092ca6d | [
"Apache-2.0"
] | 1 | 2018-03-17T23:45:21.000Z | 2018-03-17T23:45:21.000Z | //
// Author: Pierre COURTEILLE
//
//----------------------------------------//
// include SFML
//----------------------------------------//
#include <SFML/Window.hpp>
#include <SFML/Graphics/RenderWindow.hpp>
#include <SFML/Graphics/Texture.hpp>
#include <SFML/Graphics/Text.hpp>
#include <SFML/Graphics/Font.hpp>
#include <SFML/Graphics/Sprite.hpp>
//----------------------------------------//
// include STL
//----------------------------------------//
#include <iostream>
#include <string>
#include "../../Engine/Rendering/Renderer.hpp"
//----------------------------------------//
// include Tricible
//----------------------------------------//
#include "../../TextureGenerator/Procedural1D/Curve.hpp"
#include "../../TextureGenerator/Procedural1D/OverlappedCurve.hpp"
#include "../../TextureGenerator/Procedural2D/PerlinNoise.hpp"
#include "../../TextureGenerator/Procedural2D/OverlappedPerlinNoise.hpp"
#include "../../TextureGenerator/Utility/Gradient/LinearGradient.hpp"
namespace UnitTesting
{
#define SIZE_IMG_WIDTH 800 // taille de l'image PNG
#define SIZE_IMG_HEIGHT 500 // taille de l'image PNG
using namespace Tricible;
using namespace Utility;
// Va générer une image PNG dans le dossier courant
// Courbe à une dimension - de gauche à droite
// L'axe X est constant (horizontal)
// L'axe Y varie (vertical)
void PerlinNoise_1D()
{
float * result = new float[SIZE_IMG_WIDTH]; // buffer de l'image
sf::Image image; // SFML pour enregistrer le fichier PNG
int temp_y_coord; // pour stocker la valeur Y de la courbe
// compute perlin noise
Procedural1D::Curve(6, SIZE_IMG_WIDTH, &result);
// mise en place d'un fond blanc
image.create(SIZE_IMG_WIDTH, SIZE_IMG_HEIGHT, sf::Color::White);
// affichage de la courbe
for (int x = 0; x < SIZE_IMG_WIDTH; ++x)
{
temp_y_coord = (int)(result[x] * SIZE_IMG_HEIGHT); // coord sur l'axe vertical
image.setPixel(x, temp_y_coord, sf::Color(0, 0, 0)); // courbe noir
}
image.saveToFile("Example_PerlinNoise_1D.png");
// nettoyage
delete[] result;
}
// Va générer une image PNG dans le dossier courant
// Courbe à une dimension - de gauche à droite
// L'axe X est constant (horizontal)
// L'axe Y varie (vertical)
void PerlinNoise_1D_Overlapped()
{
float * result = new float[SIZE_IMG_WIDTH]; // buffer de l'image
sf::Image image; // SFML pour enregistrer le fichier PNG
int temp_y_coord; // pour stocker la valeur Y de la courbe
// compute perlin noise
Procedural1D::OverlappedCurve(16, 4, 0.3f, SIZE_IMG_WIDTH, &result);
// mise en place d'un fond blanc
image.create(SIZE_IMG_WIDTH, SIZE_IMG_HEIGHT, sf::Color::White);
// affichage de la courbe
for (int x = 0; x < SIZE_IMG_WIDTH; ++x)
{
temp_y_coord = (int)(result[x] * SIZE_IMG_HEIGHT); // coord sur l'axe vertical
image.setPixel(x, temp_y_coord, sf::Color(0, 0, 0)); // courbe noir
}
image.saveToFile("Example_PerlinNoise_1D_Overlapped.png");
// nettoyage
delete[] result;
}
// Va générer une image PNG dans le dossier courant
// Nuage de gris
void PerlinNoise_2D()
{
float * result = new float[SIZE_IMG_HEIGHT * SIZE_IMG_WIDTH]; // buffer de l'image
sf::Color pixel;
sf::Image image;
int result_color;
// compute perlin noise
Procedural2D::PerlinNoise(20, 12, SIZE_IMG_WIDTH, SIZE_IMG_HEIGHT, &result);
// mise en place d'un fond blanc
image.create(SIZE_IMG_WIDTH, SIZE_IMG_HEIGHT, sf::Color::White);
// render perlin noise
for (int y = 0; y < SIZE_IMG_HEIGHT; ++y)
{
for (int x = 0; x < SIZE_IMG_WIDTH; ++x)
{
result_color = (int)(result[y * SIZE_IMG_WIDTH + x] * 255.0f); // 255 = blanc
pixel = sf::Color(result_color, result_color, result_color);
image.setPixel(x, y, pixel);
}
}
image.saveToFile("Example_Overlapped_2D.png");
// nettoyage
delete[] result;
}
// Va générer une image PNG dans le dossier courant
// Nuage de gris
void PerlinNoise_2D_Overlapped()
{
float * result = new float[SIZE_IMG_HEIGHT * SIZE_IMG_WIDTH]; // buffer de l'image
sf::Color pixel;
sf::Image image;
int result_color;
// compute perlin noise
Procedural2D::OverlappedPerlinNoise(16, 9, 5, 0.25f, SIZE_IMG_WIDTH, SIZE_IMG_HEIGHT, &result);
// mise en place d'un fond blanc
image.create(SIZE_IMG_WIDTH, SIZE_IMG_HEIGHT, sf::Color::White);
// render perlin noise
for (int y = 0; y < SIZE_IMG_HEIGHT; ++y)
{
for (int x = 0; x < SIZE_IMG_WIDTH; ++x)
{
result_color = (int)(result[y * SIZE_IMG_WIDTH + x] * 255.0f); // 255 = blanc
pixel = sf::Color(result_color, result_color, result_color);
image.setPixel(x, y, pixel);
}
}
image.saveToFile("Example_PerlinNoise_2D_Overlapped.png");
// nettoyage
delete[] result;
}
// Va générer une image PNG dans le dossier courant
// Nuage de gris qui est ensuite coloris� avec une liste de gradientColor
void PerlinNoise_2D_Overlapped_With_Color()
{
// compute perlin noise
float * result = new float[SIZE_IMG_HEIGHT * SIZE_IMG_WIDTH];
Procedural2D::OverlappedPerlinNoise(30, 15, 8, 0.30f, SIZE_IMG_WIDTH, SIZE_IMG_HEIGHT, &result);
// gradient mapping
Utility::Gradient::LinearGradient grad;
grad.AddPoint(Gradient::PointGradient(0.00f, Color::RGBA(0, 50, 200)));
grad.AddPoint(Gradient::PointGradient(0.30f, Color::RGBA(0, 200, 0)));
grad.AddPoint(Gradient::PointGradient(0.45f, Color::RGBA(200, 50, 0)));
grad.AddPoint(Gradient::PointGradient(0.55f, Color::RGBA(200, 255, 0)));
grad.AddPoint(Gradient::PointGradient(0.70f, Color::RGBA(200, 50, 200)));
grad.AddPoint(Gradient::PointGradient(1.00f, Color::RGBA(0, 200, 200)));
// render perlin noise
sf::Color pixel;
sf::Image image;
Tricible::Color::RGBA resultGrad;
image.create(SIZE_IMG_WIDTH, SIZE_IMG_HEIGHT, sf::Color::White);
for (int y = 0; y < SIZE_IMG_HEIGHT; ++y)
{
for (int x = 0; x < SIZE_IMG_WIDTH; ++x)
{
grad.GetColor(result[y * SIZE_IMG_WIDTH + x], &resultGrad);
pixel = sf::Color(resultGrad.Red(), resultGrad.Green(), resultGrad.Blue());
image.setPixel(x, y, pixel);
}
}
image.saveToFile("Example_PerlinNoise_2D_Overlapped_With_Color.png");
// nettoyage
delete[] result;
}
}
| 31.974619 | 98 | 0.655501 | [
"render"
] |
e8e080e04197e5e5133d3e31593546f2c98d80f3 | 13,184 | cpp | C++ | lib/structs/events/common.cpp | vurpo/mtxclient | c9965a9720ee24ecb64fa70dc5168b1920a4a710 | [
"MIT"
] | null | null | null | lib/structs/events/common.cpp | vurpo/mtxclient | c9965a9720ee24ecb64fa70dc5168b1920a4a710 | [
"MIT"
] | null | null | null | lib/structs/events/common.cpp | vurpo/mtxclient | c9965a9720ee24ecb64fa70dc5168b1920a4a710 | [
"MIT"
] | null | null | null | #include <nlohmann/json.hpp>
#include "mtx/events/common.hpp"
using json = nlohmann::json;
namespace {
template<class T>
T
safe_get(const json &obj, const std::string &name, T default_val = {})
try {
return obj.value(name, default_val);
} catch (const nlohmann::json::type_error &) {
return default_val;
}
}
namespace mtx {
namespace common {
void
from_json(const json &obj, ThumbnailInfo &info)
{
info.h = safe_get<uint64_t>(obj, "h");
info.w = safe_get<uint64_t>(obj, "w");
info.size = safe_get<uint64_t>(obj, "size");
if (obj.find("mimetype") != obj.end())
info.mimetype = obj.at("mimetype").get<std::string>();
}
void
to_json(json &obj, const ThumbnailInfo &info)
{
obj["h"] = info.h;
obj["w"] = info.w;
obj["size"] = info.size;
obj["mimetype"] = info.mimetype;
}
void
from_json(const json &obj, ImageInfo &info)
{
info.h = safe_get<uint64_t>(obj, "h");
info.w = safe_get<uint64_t>(obj, "w");
info.size = safe_get<uint64_t>(obj, "size");
if (obj.find("mimetype") != obj.end())
info.mimetype = obj.at("mimetype").get<std::string>();
if (obj.find("thumbnail_url") != obj.end())
info.thumbnail_url = obj.at("thumbnail_url").get<std::string>();
if (obj.find("thumbnail_info") != obj.end())
info.thumbnail_info = obj.at("thumbnail_info").get<ThumbnailInfo>();
if (obj.find("thumbnail_file") != obj.end())
info.thumbnail_file = obj.at("thumbnail_file").get<crypto::EncryptedFile>();
if (obj.find("xyz.amorgan.blurhash") != obj.end())
info.blurhash = obj.at("xyz.amorgan.blurhash").get<std::string>();
}
void
to_json(json &obj, const ImageInfo &info)
{
obj["h"] = info.h;
obj["w"] = info.w;
obj["size"] = info.size;
obj["mimetype"] = info.mimetype;
if (!info.thumbnail_url.empty()) {
obj["thumbnail_url"] = info.thumbnail_url;
obj["thumbnail_info"] = info.thumbnail_info;
}
if (info.thumbnail_file)
obj["thumbnail_file"] = info.thumbnail_file.value();
if (!info.blurhash.empty())
obj["xyz.amorgan.blurhash"] = info.blurhash;
}
void
from_json(const json &obj, FileInfo &info)
{
info.size = safe_get<uint64_t>(obj, "size");
if (obj.find("mimetype") != obj.end())
info.mimetype = obj.at("mimetype").get<std::string>();
if (obj.find("thumbnail_url") != obj.end())
info.thumbnail_url = obj.at("thumbnail_url").get<std::string>();
if (obj.find("thumbnail_info") != obj.end())
info.thumbnail_info = obj.at("thumbnail_info").get<ThumbnailInfo>();
if (obj.find("thumbnail_file") != obj.end())
info.thumbnail_file = obj.at("thumbnail_file").get<crypto::EncryptedFile>();
}
void
to_json(json &obj, const FileInfo &info)
{
obj["size"] = info.size;
obj["mimetype"] = info.mimetype;
if (!info.thumbnail_url.empty()) {
obj["thumbnail_url"] = info.thumbnail_url;
obj["thumbnail_info"] = info.thumbnail_info;
}
if (info.thumbnail_file)
obj["thumbnail_file"] = info.thumbnail_file.value();
}
void
from_json(const json &obj, AudioInfo &info)
{
info.duration = safe_get<uint64_t>(obj, "duration");
info.size = safe_get<uint64_t>(obj, "size");
if (obj.find("mimetype") != obj.end())
info.mimetype = obj.at("mimetype").get<std::string>();
}
void
to_json(json &obj, const AudioInfo &info)
{
obj["size"] = info.size;
obj["duration"] = info.duration;
obj["mimetype"] = info.mimetype;
}
void
from_json(const json &obj, VideoInfo &info)
{
info.h = safe_get<uint64_t>(obj, "h");
info.w = safe_get<uint64_t>(obj, "w");
info.size = safe_get<uint64_t>(obj, "size");
info.duration = safe_get<uint64_t>(obj, "duration");
if (obj.find("mimetype") != obj.end())
info.mimetype = obj.at("mimetype").get<std::string>();
if (obj.find("thumbnail_url") != obj.end())
info.thumbnail_url = obj.at("thumbnail_url").get<std::string>();
if (obj.find("thumbnail_info") != obj.end())
info.thumbnail_info = obj.at("thumbnail_info").get<ThumbnailInfo>();
if (obj.find("thumbnail_file") != obj.end())
info.thumbnail_file = obj.at("thumbnail_file").get<crypto::EncryptedFile>();
if (obj.find("xyz.amorgan.blurhash") != obj.end())
info.blurhash = obj.at("xyz.amorgan.blurhash").get<std::string>();
}
void
to_json(json &obj, const VideoInfo &info)
{
obj["size"] = info.size;
obj["h"] = info.h;
obj["w"] = info.w;
obj["duration"] = info.duration;
obj["mimetype"] = info.mimetype;
if (!info.thumbnail_url.empty()) {
obj["thumbnail_url"] = info.thumbnail_url;
obj["thumbnail_info"] = info.thumbnail_info;
}
if (info.thumbnail_file)
obj["thumbnail_file"] = info.thumbnail_file.value();
if (!info.blurhash.empty())
obj["xyz.amorgan.blurhash"] = info.blurhash;
}
void
to_json(json &obj, const RelationType &type)
{
switch (type) {
case RelationType::Annotation:
obj = "m.annotation";
break;
case RelationType::Reference:
obj = "m.reference";
break;
case RelationType::Replace:
obj = "m.replace";
break;
case RelationType::InReplyTo:
obj = "im.nheko.relations.v1.in_reply_to";
break;
case RelationType::Unsupported:
default:
obj = "unsupported";
break;
}
}
void
from_json(const json &obj, RelationType &type)
{
if (obj.get<std::string>() == "m.annotation")
type = RelationType::Annotation;
else if (obj.get<std::string>() == "m.reference")
type = RelationType::Reference;
else if (obj.get<std::string>() == "m.replace")
type = RelationType::Replace;
else if (obj.get<std::string>() == "im.nheko.relations.v1.in_reply_to")
type = RelationType::InReplyTo;
else
type = RelationType::Unsupported;
}
Relations
parse_relations(const nlohmann::json &content)
{
try {
if (content.contains("im.nheko.relations.v1.relations")) {
Relations rels;
rels.relations = content.at("im.nheko.relations.v1.relations")
.get<std::vector<mtx::common::Relation>>();
rels.synthesized = false;
return rels;
} else if (content.contains("m.relates_to")) {
if (content.at("m.relates_to").contains("m.in_reply_to")) {
Relation r;
r.event_id = content.at("m.relates_to")
.at("m.in_reply_to")
.at("event_id")
.get<std::string>();
r.rel_type = RelationType::InReplyTo;
Relations rels;
rels.relations.push_back(r);
rels.synthesized = true;
return rels;
} else {
Relation r =
content.at("m.relates_to").get<mtx::common::Relation>();
Relations rels;
rels.relations.push_back(r);
rels.synthesized = true;
if (r.rel_type == RelationType::Replace &&
content.contains("m.new_content") &&
content.at("m.new_content").contains("m.relates_to")) {
const auto secondRel =
content["m.new_content"]["m.relates_to"];
if (secondRel.contains("m.in_reply_to")) {
Relation r2{};
r.rel_type = RelationType::InReplyTo;
r.event_id = secondRel.at("m.in_reply_to")
.at("event_id")
.get<std::string>();
rels.relations.push_back(r2);
} else {
rels.relations.push_back(secondRel.get<Relation>());
}
}
return rels;
}
}
} catch (nlohmann::json &e) {
}
return {};
}
void
add_relations(nlohmann::json &content, const Relations &relations)
{
if (relations.relations.empty())
return;
std::optional<Relation> edit, not_edit;
for (const auto &r : relations.relations) {
if (r.rel_type == RelationType::Replace)
edit = r;
else
not_edit = r;
}
if (not_edit) {
if (not_edit->rel_type == RelationType::InReplyTo) {
content["m.relates_to"]["m.in_reply_to"]["event_id"] = not_edit->event_id;
} else {
content["m.relates_to"] = *not_edit;
}
}
if (edit) {
if (not_edit)
content["m.new_content"]["m.relates_to"] = content["m.relates_to"];
content["m.relates_to"] = *edit;
}
if (!relations.synthesized) {
for (const auto &r : relations.relations) {
if (r.rel_type != RelationType::Unsupported)
content["im.nheko.relations.v1.relations"].push_back(r);
}
}
}
void
apply_relations(nlohmann::json &content, const Relations &relations)
{
add_relations(content, relations);
if (relations.replaces()) {
for (const auto &e : content.items()) {
if (e.key() != "m.relates_to" &&
e.key() != "im.nheko.relations.v1.relations" &&
e.key() != "m.new_content") {
content["m.new_content"][e.key()] = e.value();
}
}
if (content.contains("body")) {
content["body"] = "* " + content["body"].get<std::string>();
}
if (content.contains("formatted_body")) {
content["formatted_body"] =
"* " + content["formatted_body"].get<std::string>();
}
}
}
void
from_json(const json &obj, Relation &relates_to)
{
if (obj.find("rel_type") != obj.end())
relates_to.rel_type = obj.at("rel_type").get<RelationType>();
if (obj.find("event_id") != obj.end())
relates_to.event_id = obj.at("event_id").get<std::string>();
if (obj.find("key") != obj.end())
relates_to.key = obj.at("key").get<std::string>();
}
void
to_json(json &obj, const Relation &relates_to)
{
obj["rel_type"] = relates_to.rel_type;
obj["event_id"] = relates_to.event_id;
if (relates_to.key.has_value())
obj["key"] = relates_to.key.value();
}
static inline std::optional<std::string>
return_first_relation_matching(RelationType t, const Relations &rels)
{
for (const auto &r : rels.relations)
if (r.rel_type == t)
return r.event_id;
return std::nullopt;
}
std::optional<std::string>
Relations::reply_to() const
{
return return_first_relation_matching(RelationType::InReplyTo, *this);
}
std::optional<std::string>
Relations::replaces() const
{
return return_first_relation_matching(RelationType::Replace, *this);
}
std::optional<std::string>
Relations::references() const
{
return return_first_relation_matching(RelationType::Reference, *this);
}
std::optional<Relation>
Relations::annotates() const
{
for (const auto &r : relations)
if (r.rel_type == RelationType::Annotation)
return r;
return std::nullopt;
}
} // namespace common
} // namespace mtx
| 34.970822 | 100 | 0.493477 | [
"vector"
] |
e8e21ba8ebdfd5d52ff27a52cde6bfd73068a89c | 59,478 | cpp | C++ | src/quickdraw/qPicstuff.cpp | probonopd/executor | 0fb82c09109ec27ae8707f07690f7325ee0f98e0 | [
"MIT"
] | 2 | 2019-09-16T15:51:39.000Z | 2020-03-04T08:47:42.000Z | src/quickdraw/qPicstuff.cpp | probonopd/executor | 0fb82c09109ec27ae8707f07690f7325ee0f98e0 | [
"MIT"
] | null | null | null | src/quickdraw/qPicstuff.cpp | probonopd/executor | 0fb82c09109ec27ae8707f07690f7325ee0f98e0 | [
"MIT"
] | null | null | null | /* Copyright 1986-1996 by Abacus Research and
* Development, Inc. All rights reserved.
*/
/* Forward declarations in QuickDraw.h (DO NOT DELETE THIS LINE) */
#include <base/common.h>
#include <WindowMgr.h>
#include <ControlMgr.h>
#include <MemoryMgr.h>
#include <QuickDraw.h>
#include <CQuickDraw.h>
#include <OSUtil.h>
#include <ToolboxUtil.h>
#include <FontMgr.h>
#include <rsys/toolutil.h>
#include <quickdraw/cquick.h>
#include <quickdraw/picture.h>
#include <mman/mman.h>
#include <quickdraw/xdata.h>
#include <mman/tempalloc.h>
#include <print/print.h>
#include <rsys/executor.h>
#include <base/functions.impl.h>
#include <algorithm>
using namespace Executor;
/*
* Hooray for static variables. We have to do something like this because
* the StdGetPic routine doesn't actually supply a source byte pointer.
* We used to be nice and re-entrant, but Collate likes to patch out StdGetPic
* with a routine that uses PBRead() to supply values, and our old trick of
* requesting one chunk that is a picSize long doesn't work, because the
* picture Collate wants to print contains more than 32767 characters.
*
* We could still make *our* implementation re-entrant, but it's clear that
* Apple's isn't.
*/
static unsigned char *nextbytep;
static QDGetPicUPP procp;
typedef void (*pfv)();
typedef struct
{
pfv func;
LONGINT argcode;
} wps;
typedef struct assoc_link
{
struct assoc_link *nextp;
StringPtr str;
INTEGER i;
} assoc_link_t;
static assoc_link_t *assoc_headp = 0;
/*
* The top four bits that are used to describe how an opcode behaves are an
* encoded form of which of the operands (described in the remaining 28 bits)
* need to be scaled.
*
* Two bits are used for each operand. The msb is set only when the operand
* in question requies scaling only as a v quantity (i.e. if it is not set
* then the operand requires scaling either in both h and v or just h. Which
* it is depends on the type of the operand (e.g. rects require scaling of
* both components). The lower bit specifies whether or not to do any scaling.
*
* WoRDs and BYTes are taken to be relative quantities while other types are
* assumed to be absolute coordinates (this effects exactly what scaling is:
* relative quantities are scaled but not offset).
*
* Note the actual top four bits only specify an index into the array
* scalevalues. The array scalevalues is where the scaling info belongs.
*/
#define NOSCALE 0L
#define SCALE0 1L
#define SCALE01 2L
#define SCALE012V 3L
#define SCALE01V 4L
#define SCALE0V 5L
#define SCALE3 6L
#define SCALE35 7L
#define SCALEIT 1L
#define VONLY 2L
static unsigned short scalevalues[16] = {
0x000, /* 00000000 0000 0000 NOSCALE */
0x001, /* 00000000 0000 0001 SCALE0 */
0x005, /* 00000000 0000 0101 SCALE01 */
0x035, /* 00000000 0011 0101 SCALE012V */
0x00D, /* 00000000 0000 1101 SCALE01V */
0x003, /* 00000000 0000 0011 SCALE0V */
0x040, /* 00000000 0100 0000 SCALE3 */
0x140, /* 00000001 0100 0000 SCALE35 */
/* the rest are all zeros */
};
#define xxx0() 0
#define xxx1(a) xxx0() | a
#define xxx2(a, b) xxx1(a) | (b << 4)
#define xxx3(a, b, c) xxx2(a, b) | (c << 8)
#define xxx4(a, b, c, d) xxx3(a, b, c) | (d << 12)
#define xxx5(a, b, c, d, e) xxx4(a, b, c, d) | (e << 16)
#define xxx6(a, b, c, d, e, f) xxx5(a, b, c, d, e) | (f << 20)
#define xxx7(a, b, c, d, e, f, g) xxx6(a, b, c, d, e, f) | (g << 24)
#define yyy1(s, a) (s << 28) | xxx1(a)
#define yyy2(s, a, b) (s << 28) | xxx2(a, b)
#define yyy3(s, a, b, c) (s << 28) | xxx3(a, b, c)
#define yyy4(s, a, b, c, d) (s << 28) | xxx4(a, b, c, d)
#define yyy5(s, a, b, c, d, e) (s << 28) | xxx5(a, b, c, d, e)
#define yyy6(s, a, b, c, d, e, f) (s << 28) | xxx6(a, b, c, d, e, f)
#define yyy7(s, a, b, c, d, e, f, g) (s << 28) | xxx7(a, b, c, d, e, f, g)
#define OVP 1L /* 0 bytes: oval point */
#define BYT 2L /* 1 byte */
#define WRD 3L /* 2 bytes */
#define LNG 4L /* 4 bytes */
#define PNT 5L /* 4 bytes */
#define RCT 6L /* 8 bytes */
#define PAT 7L /* 8 bytes */
#define TXT 8L /* first byte 0..255 tells how many succesive bytes */
#define RGN 9L /* first word tells how many inclusive bytes */
#define DAT 10L /* first word tells how many exclusive bytes */
#define SAM 11L /* Same, as in FrameSameRect */
#define RGB 12L /* RGB color */
#define PXP 13L /* PixPat */
#define SPL 14L /* Special ... do by hand */
#define PLY 15L /* polys have to be mapped differently from regions */
#define ARGMASK 0x0FFFFFFF /* everything except the scale bits */
static void nop();
static void thepat(Pattern *p);
static void txratio(Point num, Point den);
static void line(Point op, Point np);
static void shrtline(Point op, SignedByte dh, SignedByte dv);
static void nop()
{
}
static void thepat(Pattern *p)
{
ROMlib_fill_pat(*p);
}
static LONGINT txnumh, txnumv, txdenh, txdenv;
static Rect srcpicframe, dstpicframe;
static LONGINT picnumh, picnumv, picdenh, picdenv;
static GUEST<Point> txtpoint;
/*
* TODO: reduce is exceedingly inefficient. Reconsider its use here.
*/
/*
* NOTE: reduce is used internally and hence doesn't treat its pointer
* arguments as pointers into syn space
*/
static void reduce(LONGINT *nump, LONGINT *denp)
{
LONGINT num, den, max, i;
num = *nump;
den = *denp;
max = std::min(num / 2, den / 2);
for(i = max; i >= 2; --i)
{
if((num % i == 0) && (den % i == 0))
break;
}
if(i > 1)
{
*nump = num / i;
*denp = den / i;
}
if(*nump > *denp)
{
if(*denp && (*nump % *denp == 0))
{
*nump = (*nump) / (*denp);
*denp = 1;
}
}
else
{
if(*nump && (*denp % *nump == 0))
{
*denp = (*denp) / (*nump);
*nump = 1;
}
}
}
static void txratio(Point num, Point den)
{
txnumh = num.h;
txnumv = num.v;
txdenh = den.h;
txdenv = den.v;
reduce(&txnumh, &txdenh);
reduce(&txnumv, &txdenv);
}
static void line(Point op, Point np)
{
PORT_PEN_LOC(qdGlobals().thePort).h = op.h;
PORT_PEN_LOC(qdGlobals().thePort).v = op.v;
CALLLINE(np);
PORT_PEN_LOC(qdGlobals().thePort).h = np.h;
PORT_PEN_LOC(qdGlobals().thePort).v = np.v;
}
static void shrtline(Point op, SignedByte dh, SignedByte dv)
{
PORT_PEN_LOC(qdGlobals().thePort).h = op.h;
PORT_PEN_LOC(qdGlobals().thePort).v = op.v;
op.h += dh;
op.v += dv;
CALLLINE(op);
PORT_PEN_LOC(qdGlobals().thePort).h = op.h;
PORT_PEN_LOC(qdGlobals().thePort).v = op.v;
}
static void setnumerdenom(Point *nump, Point *denp)
{
LONGINT numerh, numerv, denomh, denomv;
numerh = txnumh * picnumh;
numerv = txnumv * picnumv;
denomh = txdenh * picdenh;
denomv = txdenv * picdenv;
reduce(&numerh, &denomh);
reduce(&numerv, &denomv);
nump->h = numerh;
nump->v = numerv;
denp->h = denomh;
denp->v = denomv;
}
static void longtext(Point, StringPtr, GUEST<Point> *);
static void dhtext(unsigned char, StringPtr, GUEST<Point> *);
static void defhilite();
static void dvtext(unsigned char, StringPtr, GUEST<Point> *);
static void fillrct(Rect *r);
static void dhdvtext(Byte dh, Byte dv, StringPtr s, GUEST<Point> *pp);
static void fillrrct(Rect *r, INTEGER ow, INTEGER oh);
static void fillovl(Rect *r);
static void fillarc(Rect *r, INTEGER stang, INTEGER arcang);
static void fillpoly(PolyHandle p);
static void fillrgn(RgnHandle r);
static void origin(INTEGER dh, INTEGER dv);
static void pnlochfrac(INTEGER f);
static void myreadcment(INTEGER kind);
static void defhilite();
static void hilitemode();
static void fillpixpat(PixPatHandle ph);
static void pnsize(INTEGER pv, INTEGER ph);
static void textface(Byte f);
static void charextra(INTEGER extra);
static void shrtlinefrom(SignedByte dh, SignedByte dv);
static void setpicclip(RgnHandle rh);
static void eatRegion(RgnHandle rh, Size hs);
static void eatRect(Rect *rp);
static void eatPixMap(PixMapPtr pixp, INTEGER rowb);
static void eatBitMap(BitMap *bp, INTEGER rowb);
static Size eatpixdata(PixMapPtr pixmap, Boolean *freep);
static void eatbitdata(BitMap *bp, Boolean packed);
static void eatRGBColor(RGBColor *rgbp);
static void eatColorTable(PixMapPtr pixmap);
static void eatPattern(Pattern pat);
static void eatPixPat(PixPatHandle pixpat);
static unsigned short nextop(INTEGER vers);
static void longtext(Point pt, StringPtr s, GUEST<Point> *pp)
{
GUEST<Point> save;
Point numer, denom;
save = PORT_PEN_LOC(qdGlobals().thePort);
pp->h = pt.h;
pp->v = pt.v;
PORT_PEN_LOC(qdGlobals().thePort).h = pt.h;
PORT_PEN_LOC(qdGlobals().thePort).v = pt.v;
setnumerdenom(&numer, &denom);
CALLTEXT((INTEGER)s[0], (Ptr)(s + 1), numer, denom);
PORT_PEN_LOC(qdGlobals().thePort) = save;
}
static void dhtext(unsigned char dh, StringPtr s, GUEST<Point> *pp)
{
GUEST<Point> save;
Point numer, denom;
pp->h = pp->h + (dh);
save = PORT_PEN_LOC(qdGlobals().thePort);
PORT_PEN_LOC(qdGlobals().thePort) = *pp;
setnumerdenom(&numer, &denom);
CALLTEXT((INTEGER)s[0], (Ptr)(s + 1), numer, denom);
PORT_PEN_LOC(qdGlobals().thePort) = save;
}
static void dvtext(unsigned char dv, StringPtr s, GUEST<Point> *pp)
{
GUEST<Point> save;
Point numer, denom;
pp->v = pp->v + (dv);
save = PORT_PEN_LOC(qdGlobals().thePort);
PORT_PEN_LOC(qdGlobals().thePort) = *pp;
setnumerdenom(&numer, &denom);
CALLTEXT((INTEGER)s[0], (Ptr)(s + 1), numer, denom);
PORT_PEN_LOC(qdGlobals().thePort) = save;
}
static void dhdvtext(Byte dh, Byte dv, StringPtr s, GUEST<Point> *pp)
{
GUEST<Point> save;
Point numer, denom;
pp->h = pp->h + (dh);
pp->v = pp->v + (dv);
save = PORT_PEN_LOC(qdGlobals().thePort);
PORT_PEN_LOC(qdGlobals().thePort) = *pp;
setnumerdenom(&numer, &denom);
CALLTEXT((INTEGER)s[0], (Ptr)(s + 1), numer, denom);
PORT_PEN_LOC(qdGlobals().thePort) = save;
}
static void fillrct(Rect *r)
{
CALLRECT(fill, r);
}
static void fillrrct(Rect *r, INTEGER ow, INTEGER oh)
{
CALLRRECT(fill, r, ow, oh);
}
static void fillovl(Rect *r)
{
CALLOVAL(fill, r);
}
static void fillarc(Rect *r, INTEGER stang, INTEGER arcang)
{
CALLARC(fill, r, stang, arcang);
}
static void fillpoly(PolyHandle p)
{
CALLPOLY(fill, p);
}
static void fillrgn(RgnHandle r)
{
CALLRGN(fill, r);
}
static RgnHandle saveclip;
static void origin(INTEGER dh, INTEGER dv)
{
OffsetRect(&srcpicframe, dh, dv);
txtpoint.h = txtpoint.h - dh;
txtpoint.v = txtpoint.v - dv;
}
static void pnlochfrac(INTEGER f)
{
/* make sure that we scale f, since it's fixed and can't be scaled
automatically */
}
static void myreadcment(INTEGER kind)
{
C_ReadComment(kind, 0, (Handle)0);
}
static RGBColor saveHiliteRGB;
static void defhilite()
{
LM(HiliteRGB) = saveHiliteRGB;
}
static void hilitemode()
{
LM(HiliteMode) &= ~(0x80);
}
static void fillpixpat(PixPatHandle ph)
{
if(CGrafPort_p(qdGlobals().thePort))
{
GUEST<Handle> tmp = (Handle)ph;
HandToHand(&tmp);
CPORT_FILL_PIXPAT(theCPort) = guest_cast<PixPatHandle>(tmp);
}
}
static void pnsize(INTEGER pv, INTEGER ph)
{
GUEST<Point> p;
p.h = ph;
p.v = pv;
ScalePt(&p, &srcpicframe, &dstpicframe);
PenSize(p.h, p.v);
}
static void textface(Byte f)
{
TextFace(f);
}
static void charextra(INTEGER extra)
{
/* TODO: Can't use CharExtra 'cause argument is Fixed */
}
static void shrtlinefrom(SignedByte dh, SignedByte dv)
{
Line(dh, dv);
}
static void setpicclip(RgnHandle rh)
{
SectRgn(rh, saveclip, rh);
SetClip(rh);
}
static void W_BackPat(const Pattern *pp)
{
BackPat(pp);
}
/* routines that associate a PICT font number with a font name */
static void
begin_assoc(void)
{
/* Don't do anything */
}
static assoc_link_t **
assoc_find_str(StringPtr sp)
{
assoc_link_t **retval;
for(retval = &assoc_headp;
*retval && EqualString((*retval)->str, sp, false, true) != 0;
retval = &(*retval)->nextp)
;
return retval;
}
static assoc_link_t **
assoc_find_i(INTEGER i)
{
assoc_link_t **retval;
for(retval = &assoc_headp;
*retval && (*retval)->i != i;
retval = &(*retval)->nextp)
;
return retval;
}
static StringPtr
makestr(StringPtr sp)
{
StringPtr retval;
int len;
len = sp[0] + 1;
retval = (StringPtr)NewPtr(len);
memcpy(retval, sp, len);
return retval;
}
static void
add_assoc(INTEGER i, StringPtr sp)
{
assoc_link_t **pp;
pp = assoc_find_str(sp);
if(*pp)
(*pp)->i = i;
else
{
assoc_link_t *p;
p = (assoc_link_t *)malloc(sizeof *p);
p->nextp = 0;
p->str = makestr(sp);
p->i = i;
*pp = p;
}
}
static StringPtr
assoc(INTEGER i)
{
StringPtr retval;
assoc_link_t **pp;
pp = assoc_find_i(i);
if(*pp)
retval = (*pp)->str;
else
retval = 0;
return retval;
}
static void
end_assoc(void)
{
assoc_link_t *p, *nextp;
for(p = assoc_headp; p; p = nextp)
{
nextp = p->nextp;
DisposePtr((Ptr)p->str);
free(p);
}
assoc_headp = 0;
}
static void W_TextFont(INTEGER f)
{
StringPtr sp;
sp = assoc(f);
if(sp)
{
GUEST<INTEGER> new_f;
GetFNum(sp, &new_f);
if(new_f)
f = new_f;
}
TextFont(f);
}
static void W_TextMode(INTEGER m)
{
TextMode(m);
}
static void W_SpaceExtra(Fixed e)
{
SpaceExtra(e);
}
static void W_PenMode(INTEGER m)
{
#define BACHMAN_HACK
#if defined(BACHMAN_HACK)
if(m == 23)
m = 7;
#endif
PenMode(m);
}
static void W_PenPat(const Pattern *pp)
{
PenPat(pp);
}
static void W_TextSize(INTEGER s)
{
TextSize(s);
}
static void W_ForeColor(LONGINT c)
{
ForeColor(c);
}
static void W_BackColor(LONGINT c)
{
BackColor(c);
}
static void W_BackPixPat(PixPatHandle ph)
{
BackPixPat(ph);
}
static void W_PenPixPat(PixPatHandle ph)
{
PenPixPat(ph);
}
static void W_RGBForeColor(RGBColor *colorp)
{
RGBForeColor(colorp);
}
static void W_RGBBackColor(RGBColor *colorp)
{
RGBBackColor(colorp);
}
static void W_HiliteColor(RGBColor *colorp)
{
HiliteColor(colorp);
}
static void W_OpColor(RGBColor *colorp)
{
OpColor(colorp);
}
static void W_LineTo(INTEGER h, INTEGER v)
{
LineTo(h, v);
}
static void W_FrameRect(Rect *r)
{
FrameRect(r);
}
static void W_PaintRect(Rect *r)
{
PaintRect(r);
}
static void W_EraseRect(Rect *r)
{
EraseRect(r);
}
static void
reset_hilite_mode(void)
{
LM(HiliteMode) |= 0x80;
}
static void W_InvertRect(Rect *r)
{
InvertRect(r);
reset_hilite_mode();
}
static void W_FrameRoundRect(Rect *r, INTEGER ow, INTEGER oh)
{
FrameRoundRect(r, ow, oh);
}
static void W_PaintRoundRect(Rect *r, INTEGER ow, INTEGER oh)
{
PaintRoundRect(r, ow, oh);
}
static void W_EraseRoundRect(Rect *r, INTEGER ow, INTEGER oh)
{
EraseRoundRect(r, ow, oh);
}
static void W_InvertRoundRect(Rect *r, INTEGER ow, INTEGER oh)
{
InvertRoundRect(r, ow, oh);
reset_hilite_mode();
}
static void W_FrameOval(Rect *r)
{
FrameOval(r);
}
static void W_PaintOval(Rect *r)
{
PaintOval(r);
}
static void W_EraseOval(Rect *r)
{
EraseOval(r);
}
static void W_InvertOval(Rect *r)
{
InvertOval(r);
reset_hilite_mode();
}
static void W_FrameArc(Rect *r, INTEGER start, INTEGER angle)
{
FrameArc(r, start, angle);
}
static void W_PaintArc(Rect *r, INTEGER start, INTEGER angle)
{
PaintArc(r, start, angle);
}
static void W_EraseArc(Rect *r, INTEGER start, INTEGER angle)
{
EraseArc(r, start, angle);
}
static void W_InvertArc(Rect *r, INTEGER start, INTEGER angle)
{
InvertArc(r, start, angle);
reset_hilite_mode();
}
static void W_FramePoly(PolyHandle poly)
{
FramePoly(poly);
}
static void W_PaintPoly(PolyHandle poly)
{
PaintPoly(poly);
}
static void W_ErasePoly(PolyHandle poly)
{
ErasePoly(poly);
}
static void W_InvertPoly(PolyHandle poly)
{
InvertPoly(poly);
reset_hilite_mode();
}
static void W_FrameRgn(RgnHandle rh)
{
FrameRgn(rh);
}
static void W_PaintRgn(RgnHandle rh)
{
PaintRgn(rh);
}
static void W_EraseRgn(RgnHandle rh)
{
EraseRgn(rh);
}
static void W_InvertRgn(RgnHandle rh)
{
InvertRgn(rh);
reset_hilite_mode();
}
static void W_ReadComment(INTEGER kind, INTEGER size, Handle hand)
{
C_ReadComment(kind, size, hand);
}
static void
fontname(INTEGER hsize, Handle hand)
{
char *p;
INTEGER i;
StringPtr sp;
p = (char *)*hand;
i = *(GUEST<INTEGER> *)p;
sp = (StringPtr)p + 2;
add_assoc(i, sp);
}
static void
glyphstate(INTEGER hsize, Handle hand)
{
char *p;
p = (char *)*hand;
warning_unimplemented("partially implemented");
SetFractEnable(!p[2]);
SetFScaleDisable(p[3]);
}
static wps wparray[] = {
{ (pfv)nop, xxx0(), /* 00 */ },
{ (pfv)setpicclip, yyy1(SCALE0, RGN), /* 01 */ },
{ (pfv)W_BackPat, xxx1(PAT), /* 02 */ },
{ (pfv)W_TextFont, xxx1(WRD), /* 03 */ },
{ (pfv)textface, xxx1(BYT), /* 04 */ },
{ (pfv)W_TextMode, xxx1(WRD), /* 05 */ },
{ (pfv)W_SpaceExtra, xxx1(LNG), /* 06 */ },
{ (pfv)pnsize, xxx2(WRD, WRD), /* 07 */ },
{ (pfv)W_PenMode, xxx1(WRD), /* 08 */ },
{ (pfv)W_PenPat, xxx1(PAT), /* 09 */ },
{ (pfv)thepat, xxx1(PAT), /* 0A */ },
{ (pfv)nop, xxx1(PNT), /* OvSize */ /* 0B */ },
{ (pfv)origin, xxx2(WRD, WRD), /* 0C */ },
{ (pfv)W_TextSize, xxx1(WRD), /* 0D */ },
{ (pfv)W_ForeColor, xxx1(LNG), /* 0E */ },
{ (pfv)W_BackColor, xxx1(LNG), /* 0F */ },
{ (pfv)txratio, xxx2(PNT, PNT), /* 10 */ },
{ (pfv)nop, xxx1(BYT), /* PicVers */ /* 11 */ },
{ (pfv)W_BackPixPat, xxx1(PXP), /* 12 */ },
{ (pfv)W_PenPixPat, xxx1(PXP), /* 13 */ },
{ (pfv)fillpixpat, xxx1(PXP), /* 14 */ },
{ (pfv)pnlochfrac, xxx1(WRD), /* 15 */ },
{ (pfv)charextra, xxx1(WRD), /* 16 */ },
{ (pfv)nop, xxx0(), /* reserved for Apple use */ /* 17 */ },
{ (pfv)nop, xxx0(), /* reserved for Apple use */ /* 18 */ },
{ (pfv)nop, xxx0(), /* reserved for Apple use */ /* 19 */ },
{ (pfv)W_RGBForeColor, xxx1(RGB), /* 1A */ },
{ (pfv)W_RGBBackColor, xxx1(RGB), /* 1B */ },
{ (pfv)hilitemode, xxx0(), /* 1C */ },
{ (pfv)W_HiliteColor, xxx1(RGB), /* 1D */ },
{ (pfv)defhilite, xxx0(), /* 1E */ },
{ (pfv)W_OpColor, xxx1(RGB), /* 1F */ },
{ (pfv)line, yyy2(SCALE01, PNT, PNT), /* 20 */ },
{ (pfv)W_LineTo, yyy1(SCALE0, PNT), /* 21 */ },
{ (pfv)shrtline, yyy3(SCALE012V, PNT, BYT, BYT), /* 22 */ },
{ (pfv)shrtlinefrom, yyy2(SCALE01V, BYT, BYT), /* 23 */ },
{ (pfv)nop, xxx1(DAT), /* reserved for Apple use */ /* 24 */ },
{ (pfv)nop, xxx1(DAT), /* reserved for Apple use */ /* 25 */ },
{ (pfv)nop, xxx1(DAT), /* reserved for Apple use */ /* 26 */ },
{ (pfv)nop, xxx1(DAT), /* reserved for Apple use */ /* 27 */ },
{ (pfv)longtext, yyy2(SCALE0, PNT, TXT), /* 28 */ },
{ (pfv)dhtext, yyy2(SCALE0, BYT, TXT), /* 29 */ },
{ (pfv)dvtext, yyy2(SCALE0V, BYT, TXT), /* 2A */ },
{ (pfv)dhdvtext, yyy3(SCALE01V, BYT, BYT, TXT), /* 2B */ },
{ (pfv)fontname, xxx1(DAT), /* 2C */ },
{ (pfv)nop, xxx1(DAT), /* reserved for Apple use */ /* 2D */ },
{ (pfv)glyphstate, xxx1(DAT), /* 2E */ },
{ (pfv)nop, xxx1(DAT), /* reserved for Apple use */ /* 2F */ },
{ (pfv)W_FrameRect, yyy1(SCALE0, RCT), /* 30 */ },
{ (pfv)W_PaintRect, yyy1(SCALE0, RCT), /* 31 */ },
{ (pfv)W_EraseRect, yyy1(SCALE0, RCT), /* 32 */ },
{ (pfv)W_InvertRect, yyy1(SCALE0, RCT), /* 33 */ },
{ (pfv)fillrct, yyy1(SCALE0, RCT), /* 34 */ },
{ (pfv)nop, xxx1(RCT), /* reserved for Apple use */ /* 35 */ },
{ (pfv)nop, xxx1(RCT), /* reserved for Apple use */ /* 36 */ },
{ (pfv)nop, xxx1(RCT), /* reserved for Apple use */ /* 37 */ },
{ (pfv)W_FrameRect, xxx2(SAM, RCT), /* 38 */ },
{ (pfv)W_PaintRect, xxx2(SAM, RCT), /* 39 */ },
{ (pfv)W_EraseRect, xxx2(SAM, RCT), /* 3A */ },
{ (pfv)W_InvertRect, xxx2(SAM, RCT), /* 3B */ },
{ (pfv)fillrct, xxx2(SAM, RCT), /* 3C */ },
{ (pfv)nop, xxx2(SAM, RCT), /* reserved for Apple use */ /* 3D */ },
{ (pfv)nop, xxx2(SAM, RCT), /* reserved for Apple use */ /* 3E */ },
{ (pfv)nop, xxx2(SAM, RCT), /* reserved for Apple use */ /* 3F */ },
{ (pfv)W_FrameRoundRect, yyy2(SCALE0, RCT, OVP), /* 40 */ },
{ (pfv)W_PaintRoundRect, yyy2(SCALE0, RCT, OVP), /* 41 */ },
{ (pfv)W_EraseRoundRect, yyy2(SCALE0, RCT, OVP), /* 42 */ },
{ (pfv)W_InvertRoundRect, yyy2(SCALE0, RCT, OVP), /* 43 */ },
{ (pfv)fillrrct, yyy2(SCALE0, RCT, OVP), /* 44 */ },
{ (pfv)nop, xxx2(RCT, OVP), /* Apple use */ /* 45 */ },
{ (pfv)nop, xxx2(RCT, OVP), /* Apple use */ /* 46 */ },
{ (pfv)nop, xxx2(RCT, OVP), /* Apple use */ /* 47 */ },
{ (pfv)W_FrameRoundRect, xxx3(SAM, RCT, OVP), /* 48 */ },
{ (pfv)W_PaintRoundRect, xxx3(SAM, RCT, OVP), /* 49 */ },
{ (pfv)W_EraseRoundRect, xxx3(SAM, RCT, OVP), /* 4A */ },
{ (pfv)W_InvertRoundRect, xxx3(SAM, RCT, OVP), /* 4B */ },
{ (pfv)fillrrct, xxx3(SAM, RCT, OVP), /* 4C */ },
{ (pfv)nop, xxx3(SAM, RCT, OVP), /* Apple use */ /* 4D */ },
{ (pfv)nop, xxx3(SAM, RCT, OVP), /* Apple use */ /* 4E */ },
{ (pfv)nop, xxx3(SAM, RCT, OVP), /* Apple use */ /* 4F */ },
{ (pfv)W_FrameOval, yyy1(SCALE0, RCT), /* 50 */ },
{ (pfv)W_PaintOval, yyy1(SCALE0, RCT), /* 51 */ },
{ (pfv)W_EraseOval, yyy1(SCALE0, RCT), /* 52 */ },
{ (pfv)W_InvertOval, yyy1(SCALE0, RCT), /* 53 */ },
{ (pfv)fillovl, yyy1(SCALE0, RCT), /* 54 */ },
{ (pfv)nop, xxx1(RCT), /* Apple use */ /* 55 */ },
{ (pfv)nop, xxx1(RCT), /* Apple use */ /* 56 */ },
{ (pfv)nop, xxx1(RCT), /* Apple use */ /* 57 */ },
{ (pfv)W_FrameOval, xxx2(SAM, RCT), /* 58 */ },
{ (pfv)W_PaintOval, xxx2(SAM, RCT), /* 59 */ },
{ (pfv)W_EraseOval, xxx2(SAM, RCT), /* 5A */ },
{ (pfv)W_InvertOval, xxx2(SAM, RCT), /* 5B */ },
{ (pfv)fillovl, xxx2(SAM, RCT), /* 5C */ },
{ (pfv)nop, xxx2(SAM, RCT), /* Apple use */ /* 5D */ },
{ (pfv)nop, xxx2(SAM, RCT), /* Apple use */ /* 5E */ },
{ (pfv)nop, xxx2(SAM, RCT), /* Apple use */ /* 5F */ },
{ (pfv)W_FrameArc, yyy3(SCALE0, RCT, WRD, WRD), /* 60 */ },
{ (pfv)W_PaintArc, yyy3(SCALE0, RCT, WRD, WRD), /* 61 */ },
{ (pfv)W_EraseArc, yyy3(SCALE0, RCT, WRD, WRD), /* 62 */ },
{ (pfv)W_InvertArc, yyy3(SCALE0, RCT, WRD, WRD), /* 63 */ },
{ (pfv)fillarc, yyy3(SCALE0, RCT, WRD, WRD), /* 64 */ },
{ (pfv)nop, xxx3(RCT, WRD, WRD), /* Apple use */ /* 65 */ },
{ (pfv)nop, xxx3(RCT, WRD, WRD), /* Apple use */ /* 66 */ },
{ (pfv)nop, xxx3(RCT, WRD, WRD), /* Apple use */ /* 67 */ },
{ (pfv)W_FrameArc, xxx6(WRD, WRD, SAM, RCT, WRD, WRD), /* 68 */ },
{ (pfv)W_PaintArc, xxx6(WRD, WRD, SAM, RCT, WRD, WRD), /* 69 */ },
{ (pfv)W_EraseArc, xxx6(WRD, WRD, SAM, RCT, WRD, WRD), /* 6A */ },
{ (pfv)W_InvertArc, xxx6(WRD, WRD, SAM, RCT, WRD, WRD), /* 6B */ },
{ (pfv)fillarc, xxx6(WRD, WRD, SAM, RCT, WRD, WRD), /* 6C */ },
{ (pfv)nop, xxx6(WRD, WRD, SAM, RCT, WRD, WRD), /* Apple use */ /* 6D */ },
{ (pfv)nop, xxx6(WRD, WRD, SAM, RCT, WRD, WRD), /* Apple use */ /* 6E */ },
{ (pfv)nop, xxx6(WRD, WRD, SAM, RCT, WRD, WRD), /* Apple use */ /* 6F */ },
{ (pfv)W_FramePoly, yyy1(SCALE0, PLY), /* 70 */ },
{ (pfv)W_PaintPoly, yyy1(SCALE0, PLY), /* 71 */ },
{ (pfv)W_ErasePoly, yyy1(SCALE0, PLY), /* 72 */ },
{ (pfv)W_InvertPoly, yyy1(SCALE0, PLY), /* 73 */ },
{ (pfv)fillpoly, yyy1(SCALE0, PLY), /* 74 */ },
{ (pfv)nop, xxx1(PLY), /* Apple use */ /* 75 */ },
{ (pfv)nop, xxx1(PLY), /* Apple use */ /* 76 */ },
{ (pfv)nop, xxx1(PLY), /* Apple use */ /* 77 */ },
{ (pfv)W_FramePoly, xxx2(SAM, PLY), /* 78 */ },
{ (pfv)W_PaintPoly, xxx2(SAM, PLY), /* 79 */ },
{ (pfv)W_ErasePoly, xxx2(SAM, PLY), /* 7A */ },
{ (pfv)W_InvertPoly, xxx2(SAM, PLY), /* 7B */ },
{ (pfv)fillpoly, xxx2(SAM, PLY), /* 7C */ },
{ (pfv)nop, xxx2(SAM, PLY), /* Apple use */ /* 7D */ },
{ (pfv)nop, xxx2(SAM, PLY), /* Apple use */ /* 7E */ },
{ (pfv)nop, xxx2(SAM, RGN), /* Apple use */ /* 7F */ },
{ (pfv)W_FrameRgn, yyy1(SCALE0, RGN), /* 80 */ },
{ (pfv)W_PaintRgn, yyy1(SCALE0, RGN), /* 81 */ },
{ (pfv)W_EraseRgn, yyy1(SCALE0, RGN), /* 82 */ },
{ (pfv)W_InvertRgn, yyy1(SCALE0, RGN), /* 83 */ },
{ (pfv)fillrgn, yyy1(SCALE0, RGN), /* 84 */ },
{ (pfv)nop, xxx1(RGN), /* Apple use */ /* 85 */ },
{ (pfv)nop, xxx1(RGN), /* Apple use */ /* 86 */ },
{ (pfv)nop, xxx1(RGN), /* Apple use */ /* 87 */ },
{ (pfv)W_FrameRgn, xxx2(SAM, RGN), /* 88 */ },
{ (pfv)W_PaintRgn, xxx2(SAM, RGN), /* 89 */ },
{ (pfv)W_EraseRgn, xxx2(SAM, RGN), /* 8A */ },
{ (pfv)W_InvertRgn, xxx2(SAM, RGN), /* 8B */ },
{ (pfv)fillrgn, xxx2(SAM, RGN), /* 8C */ },
{ (pfv)nop, xxx2(SAM, RGN), /* Apple use */ /* 8D */ },
{ (pfv)nop, xxx2(SAM, RGN), /* Apple use */ /* 8E */ },
{ (pfv)nop, xxx2(SAM, RGN), /* Apple use */ /* 8F */ },
{ (pfv)nop, xxx1(SPL), /* unpacked bits rect 90 */ },
{ (pfv)nop, xxx1(SPL), /* unpacked bits rgn 91 */ },
{ (pfv)nop, xxx1(DAT), /* reserved for Apple use */ /* 92 */ },
{ (pfv)nop, xxx1(DAT), /* reserved for Apple use */ /* 93 */ },
{ (pfv)nop, xxx1(DAT), /* reserved for Apple use */ /* 94 */ },
{ (pfv)nop, xxx1(DAT), /* reserved for Apple use */ /* 95 */ },
{ (pfv)nop, xxx1(DAT), /* reserved for Apple use */ /* 96 */ },
{ (pfv)nop, xxx1(DAT), /* reserved for Apple use */ /* 97 */ },
{ (pfv)nop, xxx1(SPL), /* packed bits rect 98 */ },
{ (pfv)nop, xxx1(SPL), /* packed bits rgn 99 */ },
{ (pfv)nop, xxx1(SPL), /* direct bits rect */ /* 9A */ },
{ (pfv)nop, xxx1(SPL), /* direct bits rgn */ /* 9B */ },
{ (pfv)nop, xxx1(DAT), /* reserved for Apple use */ /* 9C */ },
{ (pfv)nop, xxx1(DAT), /* reserved for Apple use */ /* 9D */ },
{ (pfv)nop, xxx1(DAT), /* reserved for Apple use */ /* 9E */ },
{ (pfv)nop, xxx1(DAT), /* reserved for Apple use */ /* 9F */ },
{ (pfv)myreadcment, xxx1(WRD), /* A0 */ },
{ (pfv)W_ReadComment, xxx2(WRD, DAT), /* A1 */ },
{ (pfv)nop, xxx1(DAT), /* reserved for Apple use */ /* A2 */ },
{ (pfv)nop, xxx1(DAT), /* reserved for Apple use */ /* A3 */ },
{ (pfv)nop, xxx1(DAT), /* reserved for Apple use */ /* A4 */ },
{ (pfv)nop, xxx1(DAT), /* reserved for Apple use */ /* A5 */ },
{ (pfv)nop, xxx1(DAT), /* reserved for Apple use */ /* A6 */ },
{ (pfv)nop, xxx1(DAT), /* reserved for Apple use */ /* A7 */ },
{ (pfv)nop, xxx1(DAT), /* reserved for Apple use */ /* A8 */ },
{ (pfv)nop, xxx1(DAT), /* reserved for Apple use */ /* A9 */ },
{ (pfv)nop, xxx1(DAT), /* reserved for Apple use */ /* AA */ },
{ (pfv)nop, xxx1(DAT), /* reserved for Apple use */ /* AB */ },
{ (pfv)nop, xxx1(DAT), /* reserved for Apple use */ /* AC */ },
{ (pfv)nop, xxx1(DAT), /* reserved for Apple use */ /* AD */ },
{ (pfv)nop, xxx1(DAT), /* reserved for Apple use */ /* AE */ },
{ (pfv)nop, xxx1(DAT), /* reserved for Apple use */ /* AF */ },
};
#define RGBPat 2
/*
* NOTE: we move nextbytep even if we're calling someone else's routine
* so we can maintain the proper alignment in nextop()
*/
static Byte eatByte()
{
Byte retval;
if(procp)
procp(&retval, sizeof(Byte));
else
retval = *nextbytep;
++nextbytep;
return retval;
}
static GUEST<INTEGER> eatINTEGERX()
{
GUEST<INTEGER> retval;
if(procp)
procp(&retval, sizeof(GUEST<INTEGER>));
else
retval = *(GUEST<INTEGER> *)nextbytep;
nextbytep += sizeof(GUEST<INTEGER>);
return retval;
}
static INTEGER eatINTEGER()
{
GUEST<INTEGER> retval;
retval = eatINTEGERX();
return retval;
}
static GUEST<LONGINT> eatLONGINTX()
{
GUEST<LONGINT> retval;
if(procp)
procp(&retval, sizeof(GUEST<LONGINT>));
else
retval = *(GUEST<LONGINT> *)nextbytep;
nextbytep += sizeof(GUEST<LONGINT>);
return retval;
}
static LONGINT eatLONGINT()
{
GUEST<LONGINT> retval;
retval = eatLONGINTX();
return retval;
}
static void eatString(Str255 str)
{
str[0] = eatByte();
if(procp)
procp(str + 1, str[0]);
else
BlockMoveData((Ptr)nextbytep, (Ptr)str + 1, str[0]);
nextbytep += str[0];
}
static void eatNBytes(LONGINT n)
{
char *bufp;
if(procp)
{
TEMP_ALLOC_DECL(temp_alloc_space);
TEMP_ALLOC_ALLOCATE(bufp, temp_alloc_space, n);
procp(bufp, n);
TEMP_ALLOC_FREE(temp_alloc_space);
}
nextbytep += n;
}
static void eatRegion(RgnHandle rh, Size hs)
{
SignedByte state;
SetHandleSize((Handle)rh, hs);
if(procp)
{
state = HGetState((Handle)rh);
HLock((Handle)rh);
procp((Ptr)*rh + sizeof(INTEGER),
hs - sizeof(INTEGER));
HSetState((Handle)rh, state);
}
else
BlockMoveData((Ptr)nextbytep, (Ptr)*rh + sizeof(INTEGER),
hs - sizeof(INTEGER));
(*rh)->rgnSize = hs;
nextbytep += hs - sizeof(INTEGER);
}
static void eatRect(Rect *rp)
{
rp->top = eatINTEGERX();
rp->left = eatINTEGERX();
rp->bottom = eatINTEGERX();
rp->right = eatINTEGERX();
}
static void eatPixMap(PixMapPtr pixp, INTEGER rowb)
{
/* TODO: byte swapping stuff, testing */
/* x(pixp->baseAddr) = 0; will be set later */
pixp->rowBytes = rowb ? rowb : eatINTEGER();
eatRect(&pixp->bounds);
pixp->pmVersion = eatINTEGERX();
pixp->packType = eatINTEGERX();
pixp->packSize = eatLONGINTX();
pixp->hRes = eatLONGINTX();
pixp->vRes = eatLONGINTX();
pixp->pixelType = eatINTEGERX();
pixp->pixelSize = eatINTEGERX();
pixp->cmpCount = eatINTEGERX();
pixp->cmpSize = eatINTEGERX();
pixp->planeBytes = eatLONGINTX();
(void)eatLONGINTX(); /* IMV-104 */
pixp->pmTable = (CTabHandle)NewHandle(sizeof(ColorTable));
/* will be filled in later */
pixp->pmReserved = eatLONGINTX();
}
static void eatBitMap(BitMap *bp, INTEGER rowb)
{
bp->baseAddr = 0;
bp->rowBytes = rowb ? rowb : eatINTEGER();
eatRect(&bp->bounds);
}
static Size eatpixdata(PixMapPtr pixmap, Boolean *freep)
{
int rowb;
Size pic_data_size, final_data_size;
GUEST<Ptr> temp_pp, dp;
Handle h;
Byte *inp;
Handle temph;
INTEGER length;
bool insert_pad_byte_p;
int comp_bytes;
int height;
height = RECT_HEIGHT(&pixmap->bounds);
rowb = BITMAP_ROWBYTES(pixmap);
/* comp bytes is the number of bytes take up by each of r, g, b
per scanline */
comp_bytes = rowb / 4;
insert_pad_byte_p = (pixmap->pixelSize == 32
&& pixmap->cmpCount != 4);
final_data_size = rowb * height;
if(pixmap->packType == 2)
pic_data_size = 3 * comp_bytes * height;
else
pic_data_size = final_data_size;
if(rowb < 8 || pixmap->packType == 2)
{
if(procp
|| pixmap->packType == 2)
{
h = NewHandle(final_data_size);
/* The practice of trying again in LM(SysZone) comes from the
database "Panorama" which calls MaxMem, subtracts a
small number from that, then calls NewPtr with the
result (i.e. asking for all of memory minus a small
number of bytes), then later DrawPicture is called, and
our implementation runs out of memory. It's not clear
what happens on a Mac. This hack should be more
thoroughly investigated sometime. */
if(h == nullptr)
{
TheZoneGuard guard(LM(SysZone));
h = NewHandle(final_data_size);
}
HLock(h);
if(procp)
procp(*h, pic_data_size);
else if(pixmap->packType == 2)
memcpy(*h, nextbytep, pic_data_size);
pixmap->baseAddr = *h;
*freep = true;
}
else
{
pixmap->baseAddr = (Ptr)nextbytep;
*freep = false;
}
nextbytep += pic_data_size;
if(pic_data_size & 1)
++nextbytep;
}
else
{
uint8_t *temp_scanline, *scanline, *ep;
h = NewHandle(final_data_size);
if(h == nullptr)
{
TheZoneGuard guard(LM(SysZone));
h = NewHandle(final_data_size);
}
HLock(h);
pixmap->baseAddr = *h;
temp_scanline = (uint8_t *)alloca(rowb);
for(scanline = (uint8_t *)BITMAP_BASEADDR(pixmap),
ep = scanline + final_data_size;
scanline < ep;
scanline += rowb)
{
int i;
length = rowb > 250 ? eatINTEGER() : eatByte();
if(procp)
{
temph = NewHandle(length);
HLock(temph);
procp(*temph, length);
inp = (Byte *)*temph;
}
else
{
inp = nextbytep;
temph = nullptr;
}
dp = (Ptr)temp_scanline;
temp_pp = (Ptr)inp;
if(pixmap->pixelSize == 16
&& pixmap->packType == 3)
unpack_int16_t_bits(&temp_pp, &dp, rowb);
else
UnpackBits(&temp_pp, &dp,
insert_pad_byte_p ? comp_bytes * 3 : rowb);
inp = (unsigned char *)temp_pp;
if(pixmap->pixelSize == 32)
{
for(i = 0; i < comp_bytes; i++)
{
/* ### are the packed unused bytes first or last in
the packed scanline? */
if(insert_pad_byte_p)
scanline[i * 4] = 0;
else
scanline[i * 4] = temp_scanline[i + 3 * comp_bytes];
scanline[i * 4 + 1] = temp_scanline[i];
scanline[i * 4 + 2] = temp_scanline[i + comp_bytes];
scanline[i * 4 + 3] = temp_scanline[i + 2 * comp_bytes];
}
}
else
memcpy(scanline, temp_scanline, rowb);
if(!procp)
nextbytep = inp;
else
{
nextbytep += length;
DisposeHandle(temph);
}
}
*freep = true;
}
if(pixmap->packType == 2)
{
uint8_t *start, *src, *dst;
start = (uint8_t *)BITMAP_BASEADDR(pixmap);
src = start + height * comp_bytes * 3;
dst = start + height * rowb;
while(src > start)
{
*--dst = *--src;
*--dst = *--src;
*--dst = *--src;
*--dst = 0;
}
}
pixmap->packType = 0;
return final_data_size;
}
static void eatbitdata(BitMap *bp, Boolean packed)
{
INTEGER rowb;
Size datasize;
Ptr ep;
Ptr dp;
GUEST<Ptr> temp_pp, temp_dp;
Handle h;
Byte *inp;
INTEGER length;
Handle temph;
rowb = bp->rowBytes & ROWMASK;
datasize = (LONGINT)rowb * (bp->bounds.bottom - bp->bounds.top);
if(!packed)
{
if(procp)
{
h = NewHandle(datasize);
if(!h)
{
GUEST<THz> savezone;
savezone = LM(TheZone);
LM(TheZone) = LM(SysZone);
h = NewHandle(datasize);
LM(TheZone) = savezone;
}
HLock(h);
procp(*h, datasize);
bp->baseAddr = *h;
}
else
bp->baseAddr = (Ptr)nextbytep;
nextbytep += datasize;
}
else
{
h = NewHandle(datasize);
if(!h)
{
GUEST<THz> savezone;
savezone = LM(TheZone);
LM(TheZone) = LM(SysZone);
h = NewHandle(datasize);
LM(TheZone) = savezone;
}
HLock(h);
bp->baseAddr = *h;
for(dp = bp->baseAddr, ep = dp + datasize; dp < ep;)
{
length = rowb > 250 ? eatINTEGER() : eatByte();
if(procp)
{
temph = NewHandle(length);
HLock(temph);
procp(*temph, length);
inp = (Byte *)*temph;
}
else
{
inp = nextbytep;
#if !defined(LETGCCWAIL)
temph = 0;
#endif
}
temp_dp = dp;
temp_pp = (Ptr)inp;
UnpackBits(&temp_pp, &temp_dp, rowb);
inp = (Byte *)temp_pp;
dp = temp_dp;
if(!procp)
nextbytep = inp;
else
{
nextbytep += length;
DisposeHandle(temph);
}
}
}
}
static void eatRGBColor(RGBColor *rgbp)
{
rgbp->red = eatINTEGERX();
rgbp->green = eatINTEGERX();
rgbp->blue = eatINTEGERX();
}
static void eatColorTable(PixMapPtr pixmap)
{
CTabPtr cp;
ColorSpec *cspecp, *cspecep;
CTabHandle ch;
ch = pixmap->pmTable;
cp = *ch;
/* cp->ctSeed = */ eatLONGINTX();
cp->ctSeed = GetCTSeed();
cp->ctFlags = eatINTEGERX();
cp->ctSize = eatINTEGERX();
SetHandleSize((Handle)ch, (Size)sizeof(ColorTable) - sizeof(cp->ctTable) + (cp->ctSize + 1) * 4 * sizeof(INTEGER));
for(cspecp = (*ch)->ctTable, cspecep = cspecp + (*ch)->ctSize + 1;
cspecp != cspecep; cspecp++)
{
cspecp->value = eatINTEGERX();
eatRGBColor(&cspecp->rgb);
}
}
static void eatPattern(Pattern pat)
{
for(int i = 0; i < 8; i++)
pat.pat[i] = eatByte();
}
static void eatPixPat(PixPatHandle pixpat)
{
RGBColor rgb;
Size datasize;
Handle temph;
HLockGuard guard(pixpat);
PIXPAT_TYPE(pixpat) = eatINTEGERX();
if(PIXPAT_TYPE(pixpat) == RGBPat)
{
eatPattern(PIXPAT_1DATA(pixpat));
eatRGBColor(&rgb);
{
PixMapHandle patmap;
patmap = (PixMapHandle)NewHandleClear(sizeof(PixMap));
PIXMAP_TABLE(patmap) = (CTabHandle)NewHandle(0);
PIXPAT_MAP(pixpat) = patmap;
}
MakeRGBPat(pixpat, &rgb);
}
else
{
PixMapHandle patmap;
Boolean free;
eatPattern(PIXPAT_1DATA(pixpat));
patmap = (PixMapHandle)NewHandle(sizeof(PixMap));
PIXPAT_MAP(pixpat) = patmap;
HLockGuard guard(patmap);
PixMapPtr patmap_ptr = *patmap;
eatPixMap(patmap_ptr, 0);
eatColorTable(patmap_ptr);
datasize = eatpixdata(patmap_ptr, &free);
temph = NewHandle(0); /* do not use NewEmptyHandle, because
the call to PtrToXHand below will
fail, with a nilHandleErr as per
IM Memory 2-62 */
PIXPAT_DATA(pixpat) = temph;
PtrToXHand(BITMAP_BASEADDR(patmap_ptr), temph, datasize);
if(free)
DisposeHandle(RecoverHandle(BITMAP_BASEADDR(patmap_ptr)));
HASSIGN_3(pixpat,
patXMap, nullptr,
patXData, NewHandleClear(sizeof(xdata_t)),
patXValid, -1);
}
}
#define opEndPic 0xff
static unsigned short nextop(INTEGER vers)
{
unsigned int retval;
if(vers == 1)
{
retval = eatByte() & 0xFF;
}
else
{
/* require even alignment */
if((intptr_t)nextbytep & 1)
eatByte();
retval = eatINTEGER();
}
return retval;
}
#define SE(x) ((x & 0x80) ? x | (~0 ^ 0xff) : x & 0xff) /* sign extend */
void Executor::C_DrawPicture(PicHandle pic, const Rect *destrp)
{
INTEGER words[2], *wp;
Point points[2], *pp;
Byte bytes[2], *bp;
Rect rects[3], *rp;
Handle hand;
LONGINT lng;
ULONGINT ac;
unsigned short sc;
unsigned int opcode;
INTEGER ovh, ovw;
Pattern ourpattern;
Str255 ourstring;
INTEGER hsize;
void (*f)();
INTEGER vers;
Fixed scaleh, scalev, tempf;
RGBColor rgb;
BitMap bm;
PixMap pm;
Boolean packed;
GrafPort saveport, *the_port;
CGrafPtr the_cport;
#if 0
INTEGER tempshort;
#endif
INTEGER state;
BitMap *bmp;
QDProcsPtr grafprocp;
LONGINT templ;
SignedByte state2;
/* this is not saved automagically if the port is a color
grafport, hence we need to save and restore it */
Rect saveportbounds;
int16_t version_2, version_2ext;
Fixed hRes, vRes;
PixPatHandle junk_pen_pixpat, junk_bk_pixpat, junk_fill_pixpat;
Boolean saveFractEnable, saveFScaleDisable;
Byte saveHiliteMode;
#if 0
fprintf (stderr, "DrawPicture (%d): %d\n", debugnumber,
GetHandleSize (pic));
#endif
#if 0
/*
* NOTE: At one time I believed that picSize 10 pictures should be
* silently ignored, but I'm not convinced that this is true;
* it could be that a different bug was creating/passing spurious
* pictures. I know for a fact (having tested it on a Mac) that
* picSize 0 pictures should be printed (Word5 creates 'em sometimes).
* --ctm
*/
if ((*pic)->picSize <= 10)
/*-->*/ return;
#endif
#if !defined(LETGCCWAIL)
lng = 0;
ovh = 0;
ovw = 0;
hsize = 0;
#endif /* LETGCCWAIL */
#if 0
if (!pic || (destrp->top == destrp->bottom
&& destrp->left == destrp->right))
return;
#else
if(!pic || !*pic || EmptyRect(destrp) || EmptyRect(&(*pic)->picFrame))
return;
#endif
saveHiliteMode = LM(HiliteMode);
saveHiliteRGB = LM(HiliteRGB);
saveFractEnable = LM(FractEnable);
saveFScaleDisable = LM(FScaleDisable);
begin_assoc();
the_port = qdGlobals().thePort;
if(CGrafPort_p(the_port))
the_cport = theCPort;
else
the_cport = nullptr;
saveport = *the_port;
saveportbounds = PORT_BOUNDS(the_port);
PORT_CLIP_REGION(the_port) = NewRgn();
SetRectRgn(PORT_CLIP_REGION(the_port), -32768, -32768, 32767, 32767);
PORT_VIS_REGION(the_port) = NewRgn();
CopyRgn(PORT_VIS_REGION(&saveport),
PORT_VIS_REGION(the_port));
saveclip = NewRgn();
CopyRgn(PORT_CLIP_REGION(&saveport), saveclip);
if(CGrafPort_p(the_port))
{
junk_pen_pixpat = NewPixPat();
junk_bk_pixpat = NewPixPat();
junk_fill_pixpat = NewPixPat();
CPORT_PEN_PIXPAT(the_cport) = junk_pen_pixpat;
CPORT_BK_PIXPAT(the_cport) = junk_bk_pixpat;
CPORT_FILL_PIXPAT(the_cport) = junk_fill_pixpat;
}
else
{
junk_pen_pixpat = junk_bk_pixpat = junk_fill_pixpat = 0;
}
/* These will replace the junk pixpats we just installed. */
BackPat(&qdGlobals().white);
ROMlib_fill_pat(qdGlobals().black);
PenPat(&qdGlobals().black);
/* Free these up now, since they are no longer used. */
if(CGrafPort_p(the_port))
{
DisposePixPat(junk_pen_pixpat);
DisposePixPat(junk_bk_pixpat);
DisposePixPat(junk_fill_pixpat);
}
PORT_PEN_LOC(the_port).h = destrp->left; /* This is a guess, based on */
PORT_PEN_LOC(the_port).v = destrp->top; /* Word's EPS handling */
PORT_PEN_SIZE(the_port).h = PORT_PEN_SIZE(the_port).v = 1;
PORT_PEN_MODE(the_port) = patCopy;
PORT_TX_FONT(the_port) = 0;
PORT_TX_FACE(the_port) = 0;
PORT_TX_SIZE(the_port) = 0;
PORT_SP_EXTRA(the_port) = 0;
#if 0
/* this will fail if we are actually drawing to a
color graph port; we'll get spew colors instead of
b/w, so let ForeColor or BackColor do the work */
the_port->fgColor = blackColor;
the_port->bkColor = whiteColor;
#else
ForeColor(blackColor);
BackColor(whiteColor);
#endif
PORT_COLR_BIT(the_port) = 0;
PORT_PAT_STRETCH(the_port) = 0;
/*
* NOTE: I used to start pics out with srcXor because of a PICT
* in LightspeedC, but it turns out the problem is that
* srcOr with outline doesn't do what one might think
*/
TextMode(srcOr);
vers = 1;
state = HGetState((Handle)pic);
HLock((Handle)pic);
grafprocp = the_port->grafProcs;
if(grafprocp)
{
procp = grafprocp->getPicProc;
if(procp == &StdGetPic)
procp = 0;
}
else
procp = 0;
nextbytep = (unsigned char *)(&(*pic)->picSize + 5);
hand = 0;
dstpicframe = *destrp;
srcpicframe = (*pic)->picFrame;
picnumh = RECT_WIDTH(&dstpicframe);
picnumv = RECT_HEIGHT(&dstpicframe);
picdenh = RECT_WIDTH(&srcpicframe);
picdenv = RECT_HEIGHT(&srcpicframe);
txnumh = txdenh = txnumv = txdenv = 1;
reduce(&picnumh, &picdenh);
reduce(&picnumv, &picdenv);
txtpoint.h = dstpicframe.left - srcpicframe.left;
txtpoint.v = dstpicframe.top - srcpicframe.top;
scaleh = FixRatio(RECT_WIDTH(&dstpicframe), RECT_WIDTH(&srcpicframe));
scalev = FixRatio(RECT_HEIGHT(&dstpicframe), RECT_HEIGHT(&srcpicframe));
while((opcode = nextop(vers)) != opEndPic)
{
wp = words;
pp = points;
bp = bytes;
rp = rects;
if(opcode < std::size(wparray))
{
for(ac = wparray[opcode].argcode, sc = scalevalues[ac >> 28],
ac &= ARGMASK;
ac; ac >>= 4, sc >>= 2)
{
switch(ac & 0xF)
{
case OVP:
break;
case BYT:
*bp++ = eatByte();
if(sc & SCALEIT)
{
tempf = ((LONGINT)bp[-1] << 16) | (bp[-1] & 0x80 ? 0xFF000000 : 0);
if(sc & VONLY)
bp[-1] = FixMul(scalev, tempf) >> 16;
else
bp[-1] = FixMul(scaleh, tempf) >> 16;
}
break;
case WRD:
*wp++ = eatINTEGER();
if(sc & SCALEIT)
{
tempf = (LONGINT)wp[-1] << 16;
if(sc & VONLY)
wp[-1] = FixMul(scalev, tempf) >> 16;
else
wp[-1] = FixMul(scaleh, tempf) >> 16;
}
break;
case LNG:
lng = eatLONGINT();
break;
case PNT:
pp->v = eatINTEGER();
pp->h = eatINTEGER();
if(sc & SCALEIT)
{
GUEST<Point> tempPoint;
tempPoint.set(*pp);
MapPt(&tempPoint, &srcpicframe, destrp);
*pp = tempPoint.get();
}
++pp;
break;
case RCT:
eatRect(rp++);
if(sc & SCALEIT)
MapRect(&rp[-1], &srcpicframe, destrp);
break;
case PAT:
eatPattern(ourpattern);
break;
case TXT:
eatString(ourstring);
break;
case RGN:
case DAT:
case PLY:
hsize = eatINTEGER();
if(!hand)
hand = NewHandle(hsize);
if((ac & 0xf) == DAT)
{
SetHandleSize(hand, hsize);
if(procp)
{
state2 = HGetState(hand);
HLock(hand);
procp(*hand, hsize);
HSetState(hand, state2);
}
else
BlockMoveData((Ptr)nextbytep, *hand, hsize);
nextbytep += hsize;
}
else
eatRegion((RgnHandle)hand, hsize);
if(sc & SCALEIT)
{
if((ac & 0xF) == PLY)
MapPoly((PolyHandle)hand, &srcpicframe, destrp);
else
MapRgn((RgnHandle)hand, &srcpicframe, destrp);
}
break;
case SAM:
ac = 0; /* we've already read everything */
break;
case RGB:
eatRGBColor(&rgb);
break;
case PXP:
if(!hand)
hand = NewHandle(sizeof(PixPat));
else
ReallocateHandle(hand, sizeof(PixPat));
memset(*hand, 0, sizeof(PixPat));
eatPixPat((PixPatHandle)hand);
break;
case SPL:
/* Apparently calling DrawPicture while a pict is open
can create a new pict that is much larger than the
previous one, due to the way we handle direct bits.
It looks like by the time we actually log the CopyBits
associated with direct bits, we've already done some
transformations (unpacking, and perhaps changing to
32-bpp). We need to have code here that saves all
the args that we're reading here and then writes them
to the open pict with the only change being the dest
rect modifications that we may need to do. Then we'll
have to set a flag (or call an internal variant of
CopyBits) to prevent the CopyBits from logging again.
Of course this could be problematic if people patch
out CopyBits */
if(opcode == OP_DirectBitsRect
|| opcode == OP_DirectBitsRgn)
/* suck off `0xFF' baseaddr */
eatLONGINT();
words[0] = eatINTEGER(); /* rowb */
packed = (opcode == OP_PackBitsRect
|| opcode == OP_PackBitsRgn);
if(words[0] & 0x8000)
{
eatPixMap(&pm, words[0]);
if(opcode != OP_DirectBitsRect
&& opcode != OP_DirectBitsRgn)
eatColorTable(&pm);
}
else
eatBitMap(&bm, words[0]);
eatRect(&rects[0]); /* src rect */
eatRect(&rects[1]); /* dst rect */
MapRect(&rects[1], &srcpicframe, destrp);
words[1] = eatINTEGER(); /* mode */
if(opcode == OP_BitsRgn
|| opcode == OP_PackBitsRgn
|| opcode == OP_DirectBitsRgn)
{
if(!hand)
hand = NewHandle(0); /* NewEmptyHandle may cause
trouble here, since
SizeHandle won't properly
adjust it */
hsize = eatINTEGER();
eatRegion((RgnHandle)hand, hsize);
MapRgn((RgnHandle)hand, &srcpicframe, destrp);
}
else
{
if(hand)
DisposeHandle(hand);
hand = nullptr;
}
if(words[0] & 0x8000)
{
eatpixdata(&pm, &packed);
bmp = (BitMap *)±
}
else
{
eatbitdata(&bm, packed);
bmp = &bm;
}
CopyBits(bmp, PORT_BITS_FOR_COPY(the_port),
&rects[0], &rects[1],
words[1], (RgnHandle)hand);
if(packed)
DisposeHandle(RecoverHandle(BITMAP_BASEADDR(bmp)));
if(words[0] & 0x8000)
DisposeHandle((Handle)pm.pmTable);
else if(!packed && procp)
DisposeHandle(RecoverHandle(BITMAP_BASEADDR(bmp)));
break;
default:
gui_fatal("unknown arg code `%d'",
ac & 0xF);
}
}
}
else if(opcode == 0x02FF)
{
version_2 = eatINTEGER();
}
else if(opcode == 0x0C00)
{
/* extended v2 opcode header */
/* version */
version_2ext = eatINTEGER();
/* reserved */
eatINTEGER();
/* hres, Fixed */
hRes = eatLONGINT();
/* vres, Fixed */
vRes = eatLONGINT();
#define CLIFFS_QUICK_199_P2_HACK /* makes risk work properly */
#if defined(CLIFFS_QUICK_199_P2_HACK)
{
Rect new_src_pic_frame;
eatRect(&new_src_pic_frame);
if(!EmptyRect(&new_src_pic_frame))
srcpicframe = new_src_pic_frame;
}
#else
eatRect(&srcpicframe);
if(EmptyRect(&srcpicframe))
goto cleanup;
#endif
/* reserved */
eatLONGINT();
}
else
{
warning_unexpected("hit opcode `0x%X' with no table entry",
opcode);
if(opcode < 0x00D0)
; /* do nothing; no extra data */
else if(opcode < 0x0100)
{
templ = eatLONGINT();
eatNBytes(templ + sizeof(LONGINT));
}
else if(opcode < 0x8000)
eatNBytes((opcode >> 8) * 2);
else if(opcode < 0x8100)
; /* do nothing; no extra data */
else
{
templ = eatLONGINT();
eatNBytes(templ);
}
}
if(opcode == OP_OvSize)
{
GUEST<Point> tempPoint;
ScalePt(&tempPoint, &srcpicframe, &dstpicframe);
tempPoint.set(points[0]);
points[0] = tempPoint.get();
ovh = points[0].v;
ovw = points[0].h;
}
else if(opcode == OP_Version)
{
vers = bytes[0];
}
else if(opcode < std::size(wparray))
{
f = wparray[opcode].func;
switch(wparray[opcode].argcode & ARGMASK)
{
case xxx0():
(*(void (*)(void))f)();
break;
case xxx1(BYT):
(*(void (*)(Byte))f)(SE(bytes[0]));
break;
case xxx1(LNG):
(*(void (*)(LONGINT))f)(lng);
break;
case xxx1(PAT):
(*(void (*)(const Pattern*))f)(&ourpattern);
break;
case xxx1(PNT):
(*(void (*)(Point))f)(points[0]);
break;
case xxx1(RCT):
case xxx2(SAM, RCT):
(*(void (*)(Rect *))f)(&rects[0]);
break;
case xxx1(RGB):
(*(void (*)(RGBColor *))f)(&rgb);
break;
case xxx1(DAT):
(*(void (*)(INTEGER, Handle))f)(hsize, hand);
break;
case xxx1(PXP):
(*(void (*)(Handle))f)(hand);
hand = nullptr;
break;
case xxx1(RGN):
case xxx1(PLY):
case xxx2(SAM, RGN):
case xxx2(SAM, PLY):
(*(void (*)(Handle))f)(hand);
break;
case xxx1(WRD):
(*(void (*)(INTEGER))f)(words[0]);
break;
case xxx1(SPL):
/* was done when the args were picked up */
break;
case xxx2(BYT, BYT):
(*(void (*)(Byte, Byte))f)(SE(bytes[0]), SE(bytes[1]));
break;
case xxx2(BYT, TXT):
(*(void (*)(Byte, StringPtr, GUEST<Point> *))f)(SE(bytes[0]), ourstring, &txtpoint);
break;
case xxx2(PNT, PNT):
(*(void (*)(Point, Point))f)(points[0], points[1]);
break;
case xxx2(PNT, TXT):
(*(void (*)(Point, StringPtr, GUEST<Point> *))f)(points[0], ourstring, &txtpoint);
break;
case xxx2(RCT, OVP):
case xxx3(SAM, RCT, OVP):
(*(void (*)(Rect *, INTEGER, INTEGER))f)(&rects[0], ovw, ovh);
break;
case xxx2(WRD, WRD):
(*(void (*)(INTEGER, INTEGER))f)(words[0], words[1]);
break;
case xxx3(BYT, BYT, TXT):
(*(void (*)(Byte, Byte, StringPtr, GUEST<Point> *))f)(SE(bytes[0]), SE(bytes[1]), ourstring, &txtpoint);
break;
case xxx3(PNT, BYT, BYT):
(*(void (*)(Point, Byte, Byte))f)(points[0], SE(bytes[0]), SE(bytes[1]));
break;
case xxx3(RCT, WRD, WRD):
case xxx4(SAM, RCT, WRD, WRD):
case xxx6(WRD, WRD, SAM, RCT, WRD, WRD):
(*(void (*)(Rect *, INTEGER, INTEGER))f)(&rects[0], words[0], words[1]);
break;
case xxx2(WRD, DAT):
(*(void (*)(INTEGER, INTEGER, Handle))f)(words[0], hsize, hand);
break;
default:
gui_assert(0);
break;
}
}
}
HSetState((Handle)pic, state);
if(hand)
DisposeHandle(hand);
if(CGrafPort_p(the_port))
{
DisposePixPat(CPORT_PEN_PIXPAT(the_cport));
DisposePixPat(CPORT_BK_PIXPAT(the_cport));
DisposePixPat(CPORT_FILL_PIXPAT(the_cport));
}
do_textend(); /* in case some clowns included a textbegin without
a textend */
DisposeRgn(PORT_CLIP_REGION(the_port));
DisposeRgn(PORT_VIS_REGION(the_port));
*the_port = saveport;
PORT_BOUNDS(the_port) = saveportbounds;
DisposeRgn(saveclip);
saveclip = nullptr;
end_assoc();
SetFractEnable(saveFractEnable);
SetFScaleDisable(saveFScaleDisable);
LM(HiliteRGB) = saveHiliteRGB;
LM(HiliteMode) = saveHiliteMode;
}
| 29.027818 | 124 | 0.525976 | [
"3d"
] |
e8ef34d9bde54a5cb963ed9bdbd54adc0fbd35f2 | 757 | hpp | C++ | src/cigar.hpp | urbanslug/gimbricate | 6a57c2d49fd43575b8d081d6fc663795b19d1cd7 | [
"MIT"
] | null | null | null | src/cigar.hpp | urbanslug/gimbricate | 6a57c2d49fd43575b8d081d6fc663795b19d1cd7 | [
"MIT"
] | null | null | null | src/cigar.hpp | urbanslug/gimbricate | 6a57c2d49fd43575b8d081d6fc663795b19d1cd7 | [
"MIT"
] | null | null | null | #include <vector>
#include <string>
#include <utility>
#include <cctype>
#include <sstream>
#include <algorithm>
#include "gssw.h"
namespace gimbricate {
std::vector<std::pair<uint64_t, char>> split_cigar(const std::string& cigar_str);
uint64_t cigar_length(const std::vector<std::pair<uint64_t, char>>& cigar);
std::string compress_cigar(const std::string& cigar);
std::string flip_cigar(const std::string& cigar);
std::string overlap_cigar(gssw_graph_mapping* gm);
std::string simple_cigar(gssw_graph_mapping* gm);
void mapping_boundaries(gssw_graph_mapping* gm,
uint64_t& query_start, uint64_t& query_end,
uint64_t& target_start, uint64_t& target_end,
uint64_t& num_matches);
}
| 31.541667 | 81 | 0.702774 | [
"vector"
] |
e8f05702b0e07a8841febc9f486ec8fcb9d97edc | 82,505 | cpp | C++ | Sources/Elastos/Frameworks/Droid/DevSamples/jpk/JSGallery2/elastos/devsamples/node/jsgallery3d/R.cpp | jingcao80/Elastos | d0f39852356bdaf3a1234743b86364493a0441bc | [
"Apache-2.0"
] | 7 | 2017-07-13T10:34:54.000Z | 2021-04-16T05:40:35.000Z | Sources/Elastos/Frameworks/Droid/DevSamples/jpk/JSGallery2/elastos/devsamples/node/jsgallery3d/R.cpp | jingcao80/Elastos | d0f39852356bdaf3a1234743b86364493a0441bc | [
"Apache-2.0"
] | null | null | null | Sources/Elastos/Frameworks/Droid/DevSamples/jpk/JSGallery2/elastos/devsamples/node/jsgallery3d/R.cpp | jingcao80/Elastos | d0f39852356bdaf3a1234743b86364493a0441bc | [
"Apache-2.0"
] | 9 | 2017-07-13T12:33:20.000Z | 2021-06-19T02:46:48.000Z | #include "R.h"
namespace Elastos {
namespace DevSamples {
namespace Node {
namespace JSGallery3D {
const int R::anim::count_down_exit;
const int R::anim::on_screen_hint_enter;
const int R::anim::on_screen_hint_exit;
const int R::anim::player_out;
const int R::anim::slide_in_left;
const int R::anim::slide_in_right;
const int R::anim::slide_out_left;
const int R::anim::slide_out_right;
const int R::array::camera_flashmode_icons;
const int R::array::camera_flashmode_largeicons;
const int R::array::camera_id_entries;
const int R::array::camera_id_icons;
const int R::array::camera_id_labels;
const int R::array::camera_id_largeicons;
const int R::array::camera_recordlocation_icons;
const int R::array::camera_recordlocation_largeicons;
const int R::array::camera_wb_indicators;
const int R::array::pref_camera_countdown_labels;
const int R::array::pref_camera_exposure_icons;
const int R::array::pref_camera_flashmode_entries;
const int R::array::pref_camera_flashmode_entryvalues;
const int R::array::pref_camera_flashmode_labels;
const int R::array::pref_camera_focusmode_default_array;
const int R::array::pref_camera_focusmode_entries;
const int R::array::pref_camera_focusmode_entryvalues;
const int R::array::pref_camera_focusmode_labels;
const int R::array::pref_camera_hdr_entries;
const int R::array::pref_camera_hdr_entryvalues;
const int R::array::pref_camera_hdr_icons;
const int R::array::pref_camera_hdr_labels;
const int R::array::pref_camera_picturesize_entries;
const int R::array::pref_camera_picturesize_entryvalues;
const int R::array::pref_camera_recordlocation_entries;
const int R::array::pref_camera_recordlocation_entryvalues;
const int R::array::pref_camera_recordlocation_labels;
const int R::array::pref_camera_scenemode_entries;
const int R::array::pref_camera_scenemode_entryvalues;
const int R::array::pref_camera_scenemode_icons;
const int R::array::pref_camera_scenemode_labels;
const int R::array::pref_camera_timer_sound_entries;
const int R::array::pref_camera_timer_sound_entryvalues;
const int R::array::pref_camera_video_flashmode_entries;
const int R::array::pref_camera_video_flashmode_entryvalues;
const int R::array::pref_camera_video_flashmode_labels;
const int R::array::pref_camera_whitebalance_entries;
const int R::array::pref_camera_whitebalance_entryvalues;
const int R::array::pref_camera_whitebalance_labels;
const int R::array::pref_video_effect_entries;
const int R::array::pref_video_effect_entryvalues;
const int R::array::pref_video_quality_entries;
const int R::array::pref_video_quality_entryvalues;
const int R::array::pref_video_time_lapse_frame_interval_duration_values;
const int R::array::pref_video_time_lapse_frame_interval_entries;
const int R::array::pref_video_time_lapse_frame_interval_entryvalues;
const int R::array::pref_video_time_lapse_frame_interval_units;
const int R::array::video_effect_icons;
const int R::array::video_flashmode_icons;
const int R::array::video_flashmode_largeicons;
const int R::array::whitebalance_icons;
const int R::array::whitebalance_largeicons;
const int R::attr::background;
const int R::attr::defaultValue;
const int R::attr::elemEndSize;
const int R::attr::elemSize;
const int R::attr::entries;
const int R::attr::entryValues;
const int R::attr::foreground;
const int R::attr::iconSize;
const int R::attr::icons;
const int R::attr::images;
const int R::attr::key;
const int R::attr::label;
const int R::attr::labelList;
const int R::attr::largeIcons;
const int R::attr::listPreferredItemHeightSmall;
const int R::attr::max_width;
const int R::attr::modes;
const int R::attr::singleIcon;
const int R::attr::switchStyle;
const int R::attr::title;
const int R::bool_::config_scroll_horizontal;
const int R::bool_::config_show_more_images;
const int R::bool_::loop;
const int R::bool_::only_use_portrait;
const int R::bool_::picker_is_dialog;
const int R::bool_::playlist;
const int R::bool_::show_action_bar_title;
const int R::bool_::speaker;
const int R::bool_::stereo;
const int R::bool_::streaming;
const int R::color::accent;
const int R::color::album_background;
const int R::color::album_placeholder;
const int R::color::albumset_background;
const int R::color::albumset_label_background;
const int R::color::albumset_label_count;
const int R::color::albumset_label_title;
const int R::color::albumset_placeholder;
const int R::color::background_main_toolbar;
const int R::color::background_screen;
const int R::color::background_toolbar;
const int R::color::bitmap_screennail_placeholder;
const int R::color::blue;
const int R::color::bright_foreground_disabled_holo_dark;
const int R::color::bright_foreground_holo_dark;
const int R::color::button_dark_transparent_background;
const int R::color::cache_background;
const int R::color::cache_placeholder;
const int R::color::color_chooser_slected_border;
const int R::color::color_chooser_unslected_border;
const int R::color::crop_shadow_color;
const int R::color::crop_shadow_wp_color;
const int R::color::crop_wp_markers;
const int R::color::darker_transparent;
const int R::color::default_background;
const int R::color::disabled_knob;
const int R::color::draw_rect_border;
const int R::color::fab;
const int R::color::face_detect_fail;
const int R::color::face_detect_start;
const int R::color::face_detect_success;
const int R::color::filtershow_background;
const int R::color::filtershow_category_selection;
const int R::color::filtershow_categoryview_background;
const int R::color::filtershow_categoryview_text;
const int R::color::filtershow_graphic;
const int R::color::filtershow_stateview_background;
const int R::color::filtershow_stateview_end_background;
const int R::color::filtershow_stateview_end_text;
const int R::color::filtershow_stateview_selected_background;
const int R::color::filtershow_stateview_selected_text;
const int R::color::filtershow_stateview_text;
const int R::color::floating_action_button_icon_color;
const int R::color::floating_action_button_touch_tint;
const int R::color::gradcontrol_graypoint_center;
const int R::color::gradcontrol_graypoint_edge;
const int R::color::gradcontrol_line_color;
const int R::color::gradcontrol_line_shadow;
const int R::color::gradcontrol_point_center;
const int R::color::gradcontrol_point_edge;
const int R::color::gradcontrol_point_shadow_end;
const int R::color::gradcontrol_point_shadow_start;
const int R::color::gray;
const int R::color::green;
const int R::color::grey;
const int R::color::highlight;
const int R::color::holo_blue_light;
const int R::color::icon_disabled_color;
const int R::color::indicator_background;
const int R::color::ingest_date_tile_text;
const int R::color::ingest_highlight_semitransparent;
const int R::color::lowlight;
const int R::color::material_blue_grey_950;
const int R::color::mode_selection_border;
const int R::color::on_viewfinder_label_background_color;
const int R::color::pano_progress_done;
const int R::color::pano_progress_empty;
const int R::color::pano_progress_indication;
const int R::color::pano_progress_indication_fast;
const int R::color::photo_background;
const int R::color::photo_placeholder;
const int R::color::popup_background;
const int R::color::popup_title_color;
const int R::color::primary;
const int R::color::primary_dark;
const int R::color::primary_text;
const int R::color::recording_time_elapsed_text;
const int R::color::recording_time_remaining_text;
const int R::color::red;
const int R::color::review_background;
const int R::color::review_control_pressed_color;
const int R::color::review_control_pressed_fan_color;
const int R::color::slider_dot_color;
const int R::color::slider_line_color;
const int R::color::slideshow_background;
const int R::color::state_panel_separation_line;
const int R::color::text_toolbar;
const int R::color::time_lapse_arc;
const int R::color::toolbar_separation_line;
const int R::color::yellow;
const int R::dimen::action_bar_arrow_margin_left;
const int R::dimen::action_bar_arrow_margin_right;
const int R::dimen::action_bar_elevation;
const int R::dimen::action_bar_icon_padding_left;
const int R::dimen::action_bar_icon_padding_right;
const int R::dimen::action_bar_icon_padding_vertical;
const int R::dimen::action_button_padding_horizontal;
const int R::dimen::action_button_padding_vertical;
const int R::dimen::action_item_height;
const int R::dimen::add_button_margin;
const int R::dimen::album_padding_bottom;
const int R::dimen::album_padding_left;
const int R::dimen::album_padding_right;
const int R::dimen::album_padding_top;
const int R::dimen::album_set_item_image_height;
const int R::dimen::album_set_item_width;
const int R::dimen::album_slot_gap;
const int R::dimen::albumset_count_font_size;
const int R::dimen::albumset_count_offset;
const int R::dimen::albumset_icon_size;
const int R::dimen::albumset_label_background_height;
const int R::dimen::albumset_left_margin;
const int R::dimen::albumset_padding_bottom;
const int R::dimen::albumset_padding_left;
const int R::dimen::albumset_padding_right;
const int R::dimen::albumset_padding_top;
const int R::dimen::albumset_slot_gap;
const int R::dimen::albumset_title_font_size;
const int R::dimen::albumset_title_offset;
const int R::dimen::albumset_title_right_margin;
const int R::dimen::appwidget_height;
const int R::dimen::appwidget_width;
const int R::dimen::big_setting_popup_window_width;
const int R::dimen::big_setting_popup_window_width_xlarge;
const int R::dimen::cache_pin_margin;
const int R::dimen::cache_pin_size;
const int R::dimen::camera_controls_size;
const int R::dimen::camera_film_strip_gap;
const int R::dimen::capture_border;
const int R::dimen::capture_margin_right;
const int R::dimen::capture_margin_top;
const int R::dimen::capture_size;
const int R::dimen::capture_top_margin;
const int R::dimen::category_panel_height;
const int R::dimen::category_panel_icon_size;
const int R::dimen::category_panel_margin;
const int R::dimen::category_panel_text_size;
const int R::dimen::crop_indicator_size;
const int R::dimen::crop_min_side;
const int R::dimen::crop_touch_tolerance;
const int R::dimen::draw_color_check_dim;
const int R::dimen::draw_color_icon_dim;
const int R::dimen::draw_rect_border;
const int R::dimen::draw_rect_border_edge;
const int R::dimen::draw_rect_round;
const int R::dimen::draw_rect_shadow;
const int R::dimen::draw_style_icon_dim;
const int R::dimen::draw_ui_width;
const int R::dimen::edge_glow_size;
const int R::dimen::effect_icon_size;
const int R::dimen::effect_label_margin_top;
const int R::dimen::effect_label_text_size;
const int R::dimen::effect_label_width;
const int R::dimen::effect_padding_horizontal;
const int R::dimen::effect_setting_clear_text_min_height;
const int R::dimen::effect_setting_clear_text_min_height_xlarge;
const int R::dimen::effect_setting_clear_text_size;
const int R::dimen::effect_setting_clear_text_size_xlarge;
const int R::dimen::effect_setting_item_icon_width;
const int R::dimen::effect_setting_item_icon_width_xlarge;
const int R::dimen::effect_setting_item_text_size;
const int R::dimen::effect_setting_item_text_size_xlarge;
const int R::dimen::effect_setting_type_text_left_padding;
const int R::dimen::effect_setting_type_text_left_padding_xlarge;
const int R::dimen::effect_setting_type_text_min_height;
const int R::dimen::effect_setting_type_text_min_height_xlarge;
const int R::dimen::effect_setting_type_text_size;
const int R::dimen::effect_setting_type_text_size_xlarge;
const int R::dimen::effect_tool_panel_padding_bottom;
const int R::dimen::effect_tool_panel_padding_top;
const int R::dimen::effects_container_padding;
const int R::dimen::effects_menu_container_width;
const int R::dimen::elevation_high;
const int R::dimen::elevation_low;
const int R::dimen::face_circle_stroke;
const int R::dimen::floating_action_button_height;
const int R::dimen::floating_action_button_margin_bottom;
const int R::dimen::floating_action_button_margin_left;
const int R::dimen::floating_action_button_margin_right;
const int R::dimen::floating_action_button_radius;
const int R::dimen::floating_action_button_translation_z;
const int R::dimen::floating_action_button_width;
const int R::dimen::focus_inner_offset;
const int R::dimen::focus_inner_stroke;
const int R::dimen::focus_outer_stroke;
const int R::dimen::focus_radius_offset;
const int R::dimen::gradcontrol_dot_size;
const int R::dimen::gradcontrol_min_touch_dist;
const int R::dimen::hint_y_offset;
const int R::dimen::indicator_bar_width;
const int R::dimen::indicator_bar_width_large;
const int R::dimen::indicator_bar_width_xlarge;
const int R::dimen::manage_cache_bottom_height;
const int R::dimen::navigation_bar_height;
const int R::dimen::navigation_bar_width;
const int R::dimen::onscreen_exposure_indicator_text_size;
const int R::dimen::onscreen_exposure_indicator_text_size_xlarge;
const int R::dimen::onscreen_indicators_height;
const int R::dimen::onscreen_indicators_height_large;
const int R::dimen::onscreen_indicators_height_xlarge;
const int R::dimen::pano_mosaic_surface_height;
const int R::dimen::pano_mosaic_surface_height_xlarge;
const int R::dimen::pano_review_button_height;
const int R::dimen::pano_review_button_height_xlarge;
const int R::dimen::pano_review_button_width;
const int R::dimen::pano_review_button_width_xlarge;
const int R::dimen::photoeditor_original_text_margin;
const int R::dimen::photoeditor_original_text_size;
const int R::dimen::photoeditor_text_padding;
const int R::dimen::photoeditor_text_size;
const int R::dimen::pie_anglezone_width;
const int R::dimen::pie_arc_offset;
const int R::dimen::pie_arc_radius;
const int R::dimen::pie_deadzone_width;
const int R::dimen::pie_item_radius;
const int R::dimen::pie_radius_increment;
const int R::dimen::pie_radius_start;
const int R::dimen::pie_touch_offset;
const int R::dimen::pie_touch_slop;
const int R::dimen::pie_view_size;
const int R::dimen::popup_title_frame_min_height;
const int R::dimen::popup_title_frame_min_height_xlarge;
const int R::dimen::popup_title_text_size;
const int R::dimen::popup_title_text_size_xlarge;
const int R::dimen::preview_margin;
const int R::dimen::seekbar_height;
const int R::dimen::seekbar_padding_horizontal;
const int R::dimen::seekbar_padding_vertical;
const int R::dimen::seekbar_width;
const int R::dimen::setting_item_icon_width;
const int R::dimen::setting_item_icon_width_large;
const int R::dimen::setting_item_icon_width_xlarge;
const int R::dimen::setting_item_list_margin;
const int R::dimen::setting_item_list_margin_xlarge;
const int R::dimen::setting_item_text_size;
const int R::dimen::setting_item_text_size_xlarge;
const int R::dimen::setting_item_text_width;
const int R::dimen::setting_item_text_width_xlarge;
const int R::dimen::setting_knob_text_size;
const int R::dimen::setting_knob_width;
const int R::dimen::setting_knob_width_xlarge;
const int R::dimen::setting_popup_right_margin;
const int R::dimen::setting_popup_right_margin_large;
const int R::dimen::setting_popup_window_width;
const int R::dimen::setting_popup_window_width_large;
const int R::dimen::setting_popup_window_width_xlarge;
const int R::dimen::setting_row_height;
const int R::dimen::setting_row_height_large;
const int R::dimen::setting_row_height_xlarge;
const int R::dimen::shadow_margin;
const int R::dimen::shutter_offset;
const int R::dimen::size_preview;
const int R::dimen::size_thumbnail;
const int R::dimen::stack_photo_height;
const int R::dimen::stack_photo_width;
const int R::dimen::state_panel_text_size;
const int R::dimen::switch_min_width;
const int R::dimen::switch_padding;
const int R::dimen::switch_text_max_width;
const int R::dimen::switcher_size;
const int R::dimen::thumb_text_padding;
const int R::dimen::thumb_text_size;
const int R::dimen::thumbnail_margin;
const int R::dimen::thumbnail_size;
const int R::dimen::touch_circle_size;
const int R::dimen::wp_selector_dash_length;
const int R::dimen::wp_selector_off_length;
const int R::dimen::zoom_font_size;
const int R::dimen::zoom_ring_min;
const int R::drawable::action_bar_two_line_background;
const int R::drawable::actionbar_translucent;
const int R::drawable::appwidget_photo_border;
const int R::drawable::background;
const int R::drawable::background_portrait;
const int R::drawable::bg_pressed;
const int R::drawable::bg_pressed_exit_fading;
const int R::drawable::bg_text_on_preview;
const int R::drawable::bg_vidcontrol;
const int R::drawable::border_photo_frame_widget;
const int R::drawable::border_photo_frame_widget_focused_holo;
const int R::drawable::border_photo_frame_widget_holo;
const int R::drawable::border_photo_frame_widget_pressed_holo;
const int R::drawable::brush_flat;
const int R::drawable::brush_gauss;
const int R::drawable::brush_marker;
const int R::drawable::brush_round;
const int R::drawable::brush_spatter;
const int R::drawable::btn_make_offline_disabled_on_holo_dark;
const int R::drawable::btn_make_offline_normal_off_holo_dark;
const int R::drawable::btn_make_offline_normal_on_holo_dark;
const int R::drawable::btn_new_shutter;
const int R::drawable::btn_new_shutter_video;
const int R::drawable::btn_shutter_default;
const int R::drawable::btn_shutter_pressed;
const int R::drawable::btn_shutter_video_default;
const int R::drawable::btn_shutter_video_pressed;
const int R::drawable::btn_shutter_video_recording;
const int R::drawable::btn_video_shutter_recording_holo;
const int R::drawable::btn_video_shutter_recording_holo_large;
const int R::drawable::btn_video_shutter_recording_holo_xlarge;
const int R::drawable::btn_video_shutter_recording_pressed_holo;
const int R::drawable::btn_video_shutter_recording_pressed_holo_large;
const int R::drawable::btn_video_shutter_recording_pressed_holo_xlarge;
const int R::drawable::cab_divider_vertical_dark;
const int R::drawable::camera_crop;
const int R::drawable::dialog_full_holo_dark;
const int R::drawable::dropdown_ic_arrow;
const int R::drawable::fab_accent;
const int R::drawable::filtershow_add;
const int R::drawable::filtershow_addpoint;
const int R::drawable::filtershow_border_4x5;
const int R::drawable::filtershow_border_black;
const int R::drawable::filtershow_border_brush;
const int R::drawable::filtershow_border_film;
const int R::drawable::filtershow_border_grunge;
const int R::drawable::filtershow_border_rounded_black;
const int R::drawable::filtershow_border_rounded_white;
const int R::drawable::filtershow_border_sumi_e;
const int R::drawable::filtershow_border_tape;
const int R::drawable::filtershow_border_white;
const int R::drawable::filtershow_button_background;
const int R::drawable::filtershow_button_border;
const int R::drawable::filtershow_button_colors;
const int R::drawable::filtershow_button_colors_contrast;
const int R::drawable::filtershow_button_colors_curve;
const int R::drawable::filtershow_button_colors_sharpen;
const int R::drawable::filtershow_button_colors_vignette;
const int R::drawable::filtershow_button_current;
const int R::drawable::filtershow_button_fx;
const int R::drawable::filtershow_button_geometry;
const int R::drawable::filtershow_button_geometry_crop;
const int R::drawable::filtershow_button_geometry_flip;
const int R::drawable::filtershow_button_geometry_rotate;
const int R::drawable::filtershow_button_geometry_straighten;
const int R::drawable::filtershow_button_grad;
const int R::drawable::filtershow_button_operations;
const int R::drawable::filtershow_button_origin;
const int R::drawable::filtershow_button_redo;
const int R::drawable::filtershow_button_selected_background;
const int R::drawable::filtershow_button_settings;
const int R::drawable::filtershow_button_show_original;
const int R::drawable::filtershow_button_undo;
const int R::drawable::filtershow_color_picker_circle;
const int R::drawable::filtershow_color_picker_roundrect;
const int R::drawable::filtershow_delpoint;
const int R::drawable::filtershow_drawing;
const int R::drawable::filtershow_fx_0000_vintage;
const int R::drawable::filtershow_fx_0001_instant;
const int R::drawable::filtershow_fx_0002_bleach;
const int R::drawable::filtershow_fx_0003_blue_crush;
const int R::drawable::filtershow_fx_0004_bw_contrast;
const int R::drawable::filtershow_fx_0005_punch;
const int R::drawable::filtershow_fx_0006_x_process;
const int R::drawable::filtershow_fx_0007_washout;
const int R::drawable::filtershow_fx_0008_washout_color;
const int R::drawable::filtershow_grad_button;
const int R::drawable::filtershow_icon_vignette;
const int R::drawable::filtershow_menu_marker;
const int R::drawable::filtershow_menu_marker_rtl;
const int R::drawable::filtershow_scrubber;
const int R::drawable::filtershow_scrubber_control_disabled;
const int R::drawable::filtershow_scrubber_control_focused;
const int R::drawable::filtershow_scrubber_control_normal;
const int R::drawable::filtershow_scrubber_control_pressed;
const int R::drawable::filtershow_scrubber_primary;
const int R::drawable::filtershow_scrubber_secondary;
const int R::drawable::filtershow_scrubber_track;
const int R::drawable::filtershow_slider;
const int R::drawable::filtershow_state_button_background;
const int R::drawable::filtershow_versions_compare;
const int R::drawable::filtershow_vertical_bar;
const int R::drawable::filtershow_vertical_line;
const int R::drawable::floating_action_button;
const int R::drawable::frame_overlay_gallery_camera;
const int R::drawable::frame_overlay_gallery_folder;
const int R::drawable::frame_overlay_gallery_picasa;
const int R::drawable::geometry_shadow;
const int R::drawable::grid_pressed;
const int R::drawable::grid_selected;
const int R::drawable::ic_360pano_holo_light;
const int R::drawable::ic_action_overflow;
const int R::drawable::ic_btn_shutter_retake;
const int R::drawable::ic_cameraalbum_overlay;
const int R::drawable::ic_control_play;
const int R::drawable::ic_edit;
const int R::drawable::ic_effects_holo_light;
const int R::drawable::ic_effects_holo_light_large;
const int R::drawable::ic_effects_holo_light_xlarge;
const int R::drawable::ic_exposure_0;
const int R::drawable::ic_exposure_holo_light;
const int R::drawable::ic_exposure_n1;
const int R::drawable::ic_exposure_n2;
const int R::drawable::ic_exposure_n3;
const int R::drawable::ic_exposure_p1;
const int R::drawable::ic_exposure_p2;
const int R::drawable::ic_exposure_p3;
const int R::drawable::ic_flash_auto_holo_light;
const int R::drawable::ic_flash_off_holo_light;
const int R::drawable::ic_flash_on_holo_light;
const int R::drawable::ic_gallery_play;
const int R::drawable::ic_gallery_play_big;
const int R::drawable::ic_grad_add;
const int R::drawable::ic_grad_del;
const int R::drawable::ic_hdr;
const int R::drawable::ic_hdr_off;
const int R::drawable::ic_indicator_ev_0;
const int R::drawable::ic_indicator_flash_auto;
const int R::drawable::ic_indicator_flash_off;
const int R::drawable::ic_indicator_loc_on;
const int R::drawable::ic_indicator_sce_off;
const int R::drawable::ic_indicator_timer_off;
const int R::drawable::ic_indicator_wb_cloudy;
const int R::drawable::ic_indicator_wb_daylight;
const int R::drawable::ic_indicator_wb_fluorescent;
const int R::drawable::ic_indicator_wb_off;
const int R::drawable::ic_indicator_wb_tungsten;
const int R::drawable::ic_location;
const int R::drawable::ic_location_off;
const int R::drawable::ic_media_bigscreen;
const int R::drawable::ic_media_cropscreen;
const int R::drawable::ic_media_fullscreen;
const int R::drawable::ic_menu_camera_holo_light;
const int R::drawable::ic_menu_cancel_holo_light;
const int R::drawable::ic_menu_disabled_forward;
const int R::drawable::ic_menu_disabled_rewind;
const int R::drawable::ic_menu_disabled_stop;
const int R::drawable::ic_menu_display_bookmark;
const int R::drawable::ic_menu_done_holo_light;
const int R::drawable::ic_menu_forward;
const int R::drawable::ic_menu_info_details;
const int R::drawable::ic_menu_loop;
const int R::drawable::ic_menu_make_offline;
const int R::drawable::ic_menu_ptp_holo_light;
const int R::drawable::ic_menu_revert_holo_dark;
const int R::drawable::ic_menu_rewind;
const int R::drawable::ic_menu_savephoto;
const int R::drawable::ic_menu_savephoto_disabled;
const int R::drawable::ic_menu_share;
const int R::drawable::ic_menu_single_track;
const int R::drawable::ic_menu_slideshow_holo_light;
const int R::drawable::ic_menu_stereo;
const int R::drawable::ic_menu_stop;
const int R::drawable::ic_menu_tiny_planet;
const int R::drawable::ic_menu_trash;
const int R::drawable::ic_menu_unloop;
const int R::drawable::ic_pan_border_fast;
const int R::drawable::ic_pan_border_fast_large;
const int R::drawable::ic_pan_border_fast_xlarge;
const int R::drawable::ic_pan_left_indicator;
const int R::drawable::ic_pan_left_indicator_fast;
const int R::drawable::ic_pan_left_indicator_fast_large;
const int R::drawable::ic_pan_left_indicator_fast_xlarge;
const int R::drawable::ic_pan_left_indicator_large;
const int R::drawable::ic_pan_left_indicator_xlarge;
const int R::drawable::ic_pan_progression;
const int R::drawable::ic_pan_progression_large;
const int R::drawable::ic_pan_progression_xlarge;
const int R::drawable::ic_pan_right_indicator;
const int R::drawable::ic_pan_right_indicator_fast;
const int R::drawable::ic_pan_right_indicator_fast_large;
const int R::drawable::ic_pan_right_indicator_fast_xlarge;
const int R::drawable::ic_pan_right_indicator_large;
const int R::drawable::ic_pan_right_indicator_xlarge;
const int R::drawable::ic_pan_thumb;
const int R::drawable::ic_photoeditor_border;
const int R::drawable::ic_photoeditor_color;
const int R::drawable::ic_photoeditor_effects;
const int R::drawable::ic_photoeditor_fix;
const int R::drawable::ic_recording_indicator;
const int R::drawable::ic_sce;
const int R::drawable::ic_sce_action;
const int R::drawable::ic_sce_night;
const int R::drawable::ic_sce_off;
const int R::drawable::ic_sce_party;
const int R::drawable::ic_sce_sunset;
const int R::drawable::ic_scn_holo_light;
const int R::drawable::ic_scn_holo_light_large;
const int R::drawable::ic_scn_holo_light_xlarge;
const int R::drawable::ic_separator_line;
const int R::drawable::ic_snapshot_border;
const int R::drawable::ic_snapshot_border_large;
const int R::drawable::ic_snapshot_border_xlarge;
const int R::drawable::ic_switch_back;
const int R::drawable::ic_switch_camera;
const int R::drawable::ic_switch_front;
const int R::drawable::ic_switch_photo_facing_holo_light;
const int R::drawable::ic_switch_photo_facing_holo_light_large;
const int R::drawable::ic_switch_photo_facing_holo_light_xlarge;
const int R::drawable::ic_switch_video;
const int R::drawable::ic_switch_video_facing_holo_light;
const int R::drawable::ic_switch_video_facing_holo_light_large;
const int R::drawable::ic_switch_video_facing_holo_light_xlarge;
const int R::drawable::ic_switcher_menu_indicator;
const int R::drawable::ic_timelapse_none;
const int R::drawable::ic_timelapse_none_large;
const int R::drawable::ic_timelapse_none_xlarge;
const int R::drawable::ic_vidcontrol_disable_pause;
const int R::drawable::ic_vidcontrol_disable_play;
const int R::drawable::ic_vidcontrol_disable_reload;
const int R::drawable::ic_vidcontrol_pause;
const int R::drawable::ic_vidcontrol_play;
const int R::drawable::ic_vidcontrol_reload;
const int R::drawable::ic_video_effects_background_fields_of_wheat_holo;
const int R::drawable::ic_video_effects_background_intergalactic_holo;
const int R::drawable::ic_video_effects_background_normal_holo_dark;
const int R::drawable::ic_video_effects_faces_big_eyes_holo_dark;
const int R::drawable::ic_video_effects_faces_big_mouth_holo_dark;
const int R::drawable::ic_video_effects_faces_big_nose_holo_dark;
const int R::drawable::ic_video_effects_faces_small_eyes_holo_dark;
const int R::drawable::ic_video_effects_faces_small_mouth_holo_dark;
const int R::drawable::ic_video_effects_faces_squeeze_holo_dark;
const int R::drawable::ic_video_thumb;
const int R::drawable::ic_view_photosphere;
const int R::drawable::ic_wb_auto;
const int R::drawable::ic_wb_cloudy;
const int R::drawable::ic_wb_fluorescent;
const int R::drawable::ic_wb_incandescent;
const int R::drawable::ic_wb_sunlight;
const int R::drawable::icn_media_forward;
const int R::drawable::icn_media_pause;
const int R::drawable::icn_media_pause_focused_holo_dark;
const int R::drawable::icn_media_pause_normal_holo_dark;
const int R::drawable::icn_media_pause_pressed_holo_dark;
const int R::drawable::icn_media_play;
const int R::drawable::icn_media_play_focused_holo_dark;
const int R::drawable::icn_media_play_normal_holo_dark;
const int R::drawable::icn_media_play_pressed_holo_dark;
const int R::drawable::icn_media_rewind;
const int R::drawable::icn_media_stop;
const int R::drawable::ingest_item_list_selector;
const int R::drawable::knob;
const int R::drawable::knob_toggle_off;
const int R::drawable::knob_toggle_on;
const int R::drawable::list_divider;
const int R::drawable::list_divider_holo_dark;
const int R::drawable::list_divider_large;
const int R::drawable::list_pressed_holo_light;
const int R::drawable::list_selector_background_selected;
const int R::drawable::media_default_bkg;
const int R::drawable::menu_dropdown_panel_holo_dark;
const int R::drawable::menu_save_photo;
const int R::drawable::on_screen_hint_frame;
const int R::drawable::overscroll_edge;
const int R::drawable::overscroll_glow;
const int R::drawable::panel_undo_holo;
const int R::drawable::photoeditor_effect_redeye;
const int R::drawable::photopage_bottom_button_background;
const int R::drawable::placeholder_camera;
const int R::drawable::placeholder_empty;
const int R::drawable::placeholder_locked;
const int R::drawable::preview;
const int R::drawable::scrubber_knob;
const int R::drawable::setting_picker;
const int R::drawable::spinner_76_inner_holo;
const int R::drawable::spinner_76_outer_holo;
const int R::drawable::spot_mask;
const int R::drawable::switch_bg_focused_holo_dark;
const int R::drawable::switch_bg_holo_dark;
const int R::drawable::switch_inner_holo_dark;
const int R::drawable::switch_thumb_activated;
const int R::drawable::switch_thumb_activated_holo_dark;
const int R::drawable::switch_thumb_disabled_holo_dark;
const int R::drawable::switch_thumb_holo_dark;
const int R::drawable::switch_thumb_off;
const int R::drawable::switch_thumb_pressed_holo_dark;
const int R::drawable::switch_track_holo_dark;
const int R::drawable::text_select_handle_left;
const int R::drawable::text_select_handle_right;
const int R::drawable::toast_frame_holo;
const int R::drawable::transparent_button_background;
const int R::drawable::videoplayer_pause;
const int R::drawable::videoplayer_play;
const int R::drawable::videoplayer_reload;
const int R::drawable::wallpaper_picker_preview;
const int R::drawable::white_text_bg_gradient;
const int R::id::Button06;
const int R::id::Button11;
const int R::id::Button16;
const int R::id::ColorHueView;
const int R::id::RelativeLayout1;
const int R::id::aEffectsPanel;
const int R::id::action_camera;
const int R::id::action_cancel;
const int R::id::action_cluster_album;
const int R::id::action_cluster_faces;
const int R::id::action_cluster_location;
const int R::id::action_cluster_size;
const int R::id::action_cluster_tags;
const int R::id::action_cluster_time;
const int R::id::action_crop;
const int R::id::action_delete;
const int R::id::action_details;
const int R::id::action_edit;
const int R::id::action_filter_all;
const int R::id::action_filter_image;
const int R::id::action_filter_video;
const int R::id::action_general_help;
const int R::id::action_group_by;
const int R::id::action_import;
const int R::id::action_manage_offline;
const int R::id::action_more_image;
const int R::id::action_mute;
const int R::id::action_rotate_ccw;
const int R::id::action_rotate_cw;
const int R::id::action_select;
const int R::id::action_select_all;
const int R::id::action_setas;
const int R::id::action_settings;
const int R::id::action_share;
const int R::id::action_share_panorama;
const int R::id::action_show_on_map;
const int R::id::action_simple_edit;
const int R::id::action_slideshow;
const int R::id::action_sync_picasa_albums;
const int R::id::action_toggle_full_caching;
const int R::id::action_trim;
const int R::id::addButton;
const int R::id::add_account;
const int R::id::album_header_image;
const int R::id::album_header_subtitle;
const int R::id::album_header_title;
const int R::id::album_set_item_count;
const int R::id::album_set_item_image;
const int R::id::album_set_item_title;
const int R::id::applyBar;
const int R::id::applyColorPick;
const int R::id::applyEffect;
const int R::id::applyFilter;
const int R::id::appwidget_empty_view;
const int R::id::appwidget_loading_item;
const int R::id::appwidget_photo_item;
const int R::id::appwidget_stack_view;
const int R::id::audio_effects_switch;
const int R::id::bBStrengthKnob;
const int R::id::basicEditor;
const int R::id::beep_title;
const int R::id::bg_replace_message;
const int R::id::bg_replace_message_frame;
const int R::id::blocker;
const int R::id::blueSeekBar;
const int R::id::blueValue;
const int R::id::borderButton;
const int R::id::bottomControlLineBottom;
const int R::id::bottomControlLineTop;
const int R::id::bottom_panel;
const int R::id::brightnessView;
const int R::id::btnSelect;
const int R::id::btn_cancel;
const int R::id::btn_done;
const int R::id::btn_play;
const int R::id::btn_retake;
const int R::id::button03;
const int R::id::button04;
const int R::id::button05;
const int R::id::button07;
const int R::id::button08;
const int R::id::button09;
const int R::id::button10;
const int R::id::button12;
const int R::id::button13;
const int R::id::button14;
const int R::id::button15;
const int R::id::button17;
const int R::id::button18;
const int R::id::button19;
const int R::id::button2;
const int R::id::button20;
const int R::id::bwfilterButton;
const int R::id::camera_app_root;
const int R::id::camera_controls;
const int R::id::camera_switcher;
const int R::id::camera_switcher_ind;
const int R::id::cancel;
const int R::id::cancelColorPick;
const int R::id::cancelFilter;
const int R::id::categorySelectedIndicator;
const int R::id::category_panel_container;
const int R::id::central_panel_container;
const int R::id::clearButton;
const int R::id::clear_effects;
const int R::id::colorBorderCornerSizeSeekBar;
const int R::id::colorBorderCornerValue;
const int R::id::colorBorderSizeSeekBar;
const int R::id::colorBorderSizeValue;
const int R::id::colorOpacityView;
const int R::id::colorPicker;
const int R::id::colorRectView;
const int R::id::color_border_menu_clear;
const int R::id::color_border_menu_color;
const int R::id::color_border_menu_corner_size;
const int R::id::color_border_menu_size;
const int R::id::colorsButton;
const int R::id::content;
const int R::id::contrastButton;
const int R::id::contrastSeekBar;
const int R::id::contrastValue;
const int R::id::controlArea;
const int R::id::controlName;
const int R::id::controlName1;
const int R::id::controlName2;
const int R::id::controlName3;
const int R::id::controlValue;
const int R::id::controlValueSeekBar;
const int R::id::controls;
const int R::id::count_down_title;
const int R::id::count_down_to_capture;
const int R::id::cp_grid_button01;
const int R::id::cropUtilityButton;
const int R::id::cropView;
const int R::id::crop_menu_1to1;
const int R::id::crop_menu_3to4;
const int R::id::crop_menu_4to3;
const int R::id::crop_menu_4to6;
const int R::id::crop_menu_5to7;
const int R::id::crop_menu_7to5;
const int R::id::crop_menu_9to16;
const int R::id::crop_menu_none;
const int R::id::crop_menu_original;
const int R::id::crop_popupmenu;
const int R::id::current_setting;
const int R::id::curve_menu_blue;
const int R::id::curve_menu_green;
const int R::id::curve_menu_red;
const int R::id::curve_menu_rgb;
const int R::id::curvesButtonRGB;
const int R::id::curvesUtilityButton;
const int R::id::curves_popupmenu;
const int R::id::customTitle;
const int R::id::cyanSeekBar;
const int R::id::cyanValue;
const int R::id::data;
const int R::id::date_tile_day;
const int R::id::date_tile_month;
const int R::id::date_tile_year;
const int R::id::deleteUserPreset;
const int R::id::done;
const int R::id::downsampleButton;
const int R::id::drawOnImageButton;
const int R::id::drawSizeSeekBar;
const int R::id::drawSizeValue;
const int R::id::drawUtilityButton;
const int R::id::draw_color_button01;
const int R::id::draw_color_button02;
const int R::id::draw_color_button03;
const int R::id::draw_color_button04;
const int R::id::draw_color_button05;
const int R::id::draw_color_popupbutton;
const int R::id::draw_menu_clear;
const int R::id::draw_menu_color;
const int R::id::draw_menu_size;
const int R::id::draw_menu_style;
const int R::id::duration;
const int R::id::duration_unit;
const int R::id::edgeButton;
const int R::id::editView;
const int R::id::editableHeight;
const int R::id::editableWidth;
const int R::id::editorChanSat;
const int R::id::editorColorBorder;
const int R::id::editorContainer;
const int R::id::editorCrop;
const int R::id::editorDraw;
const int R::id::editorFlip;
const int R::id::editorGrad;
const int R::id::editorGradButton;
const int R::id::editorParametric;
const int R::id::editorRedEye;
const int R::id::editorRotate;
const int R::id::editorStraighten;
const int R::id::editor_chan_sat_blue;
const int R::id::editor_chan_sat_cyan;
const int R::id::editor_chan_sat_green;
const int R::id::editor_chan_sat_magenta;
const int R::id::editor_chan_sat_main;
const int R::id::editor_chan_sat_red;
const int R::id::editor_chan_sat_yellow;
const int R::id::editor_grad_brightness;
const int R::id::editor_grad_contrast;
const int R::id::editor_grad_new;
const int R::id::editor_grad_saturation;
const int R::id::editor_vignette_contrast;
const int R::id::editor_vignette_exposure;
const int R::id::editor_vignette_falloff;
const int R::id::editor_vignette_main;
const int R::id::editor_vignette_saturation;
const int R::id::effect_background;
const int R::id::effect_background_separator;
const int R::id::effect_background_title;
const int R::id::effect_background_title_separator;
const int R::id::effect_silly_faces;
const int R::id::effect_silly_faces_title;
const int R::id::effect_silly_faces_title_separator;
const int R::id::estimadedSize;
const int R::id::exifData;
const int R::id::exifLabel;
const int R::id::exportFlattenButton;
const int R::id::exposureButton;
const int R::id::exposureSeekBar;
const int R::id::exposureValue;
const int R::id::face_view;
const int R::id::face_view_stub;
const int R::id::falloffSeekBar;
const int R::id::falloffValue;
const int R::id::filmstrip_bottom_control_panorama;
const int R::id::filmstrip_view;
const int R::id::filtershow_cp_custom;
const int R::id::filtershow_done;
const int R::id::flash_overlay;
const int R::id::floating_action_button_edit;
const int R::id::floating_action_button_panorama;
const int R::id::floating_action_button_tiny_planet;
const int R::id::footer;
const int R::id::fxButton;
const int R::id::gallery_root;
const int R::id::geometryButton;
const int R::id::gl_root_cover;
const int R::id::gl_root_view;
const int R::id::gradAddButton;
const int R::id::gradBrightnessSeekBar;
const int R::id::gradBrightnessValue;
const int R::id::gradContrastSeekBar;
const int R::id::gradContrastValue;
const int R::id::gradDelButton;
const int R::id::gradEditor;
const int R::id::gradSaturationSeekBar;
const int R::id::gradSaturationValue;
const int R::id::greenSeekBar;
const int R::id::greenValue;
const int R::id::gridContainer;
const int R::id::grunge_popupmenu;
const int R::id::header;
const int R::id::highlightRecoveryButton;
const int R::id::histogramView;
const int R::id::historyPanel;
const int R::id::hueButton;
const int R::id::hueView;
const int R::id::image;
const int R::id::imageCurves;
const int R::id::imageName;
const int R::id::imageOnlyEditor;
const int R::id::imageShow;
const int R::id::imageSize;
const int R::id::imageStateList;
const int R::id::imageStatePanel;
const int R::id::imageThumbnail;
const int R::id::imageTinyPlanet;
const int R::id::imageView;
const int R::id::imageVignette;
const int R::id::imageZoom;
const int R::id::image_absoluteLayout;
const int R::id::image_display_area;
const int R::id::ingest_fullsize_image;
const int R::id::ingest_fullsize_image_checkbox;
const int R::id::ingest_gridview;
const int R::id::ingest_import_items;
const int R::id::ingest_notification_importing;
const int R::id::ingest_notification_scanning;
const int R::id::ingest_switch_view;
const int R::id::ingest_view_pager;
const int R::id::ingest_warning_view;
const int R::id::ingest_warning_view_icon;
const int R::id::ingest_warning_view_text;
const int R::id::kmeansButton;
const int R::id::knob_foreground;
const int R::id::knob_label;
const int R::id::knob_toggle_off;
const int R::id::knob_toggle_on;
const int R::id::knob_value;
const int R::id::labels;
const int R::id::leftActionButton;
const int R::id::listColors;
const int R::id::listItems;
const int R::id::listStates;
const int R::id::listStyles;
const int R::id::loading;
const int R::id::magentaSeekBar;
const int R::id::magentaValue;
const int R::id::mainPanel;
const int R::id::mainSeekbar;
const int R::id::mainValue;
const int R::id::mainView;
const int R::id::mainVignetteSeekbar;
const int R::id::mainVignetteValue;
const int R::id::main_panel_container;
const int R::id::manageUserPresets;
const int R::id::menu;
const int R::id::menu_camera;
const int R::id::menu_crop;
const int R::id::menu_delete;
const int R::id::menu_edit;
const int R::id::menu_exposure_indicator;
const int R::id::menu_flash_indicator;
const int R::id::menu_help;
const int R::id::menu_location_indicator;
const int R::id::menu_mute;
const int R::id::menu_scenemode_indicator;
const int R::id::menu_search;
const int R::id::menu_set_as;
const int R::id::menu_settings;
const int R::id::menu_share;
const int R::id::menu_timer_indicator;
const int R::id::menu_trim;
const int R::id::menu_wb_indicator;
const int R::id::message;
const int R::id::movie_view_root;
const int R::id::negativeButton;
const int R::id::ok;
const int R::id::on_screen_indicators;
const int R::id::opacityView;
const int R::id::operationsList;
const int R::id::panel;
const int R::id::panelAccessoryViewList;
const int R::id::pano_stitching_progress_bar;
const int R::id::pano_stitching_progress_panel;
const int R::id::pano_stitching_progress_text;
const int R::id::photo;
const int R::id::photopage_bottom_control_edit;
const int R::id::photopage_bottom_control_panorama;
const int R::id::photopage_bottom_control_tiny_planet;
const int R::id::photopage_bottom_controls;
const int R::id::photopage_progress_background;
const int R::id::photopage_progress_bar;
const int R::id::photopage_progress_bar_text;
const int R::id::photopage_progress_foreground;
const int R::id::preview;
const int R::id::preview_border;
const int R::id::preview_content;
const int R::id::preview_thumb;
const int R::id::primarySeekBar;
const int R::id::print;
const int R::id::printButton;
const int R::id::progress;
const int R::id::progressContainer;
const int R::id::progress_bar;
const int R::id::qualitySeekBar;
const int R::id::qualityTextView;
const int R::id::recording_time;
const int R::id::recording_time_rect;
const int R::id::redSeekBar;
const int R::id::redValue;
const int R::id::redoButton;
const int R::id::remaining_seconds;
const int R::id::render_overlay;
const int R::id::resetHistoryButton;
const int R::id::resetOperationsButton;
const int R::id::review_image;
const int R::id::rightActionButton;
const int R::id::rotate_dialog_button1;
const int R::id::rotate_dialog_button2;
const int R::id::rotate_dialog_button_layout;
const int R::id::rotate_dialog_layout;
const int R::id::rotate_dialog_root_layout;
const int R::id::rotate_dialog_spinner;
const int R::id::rotate_dialog_text;
const int R::id::rotate_dialog_title;
const int R::id::rotate_dialog_title_layout;
const int R::id::rotate_toast;
const int R::id::rowTextView;
const int R::id::saturationButton;
const int R::id::saturationSeekBar;
const int R::id::saturationValue;
const int R::id::saturationView;
const int R::id::save;
const int R::id::saveOperationsButton;
const int R::id::scrollList;
const int R::id::selection_menu;
const int R::id::set_time_interval_help_text;
const int R::id::set_time_interval_title;
const int R::id::settingList;
const int R::id::setting_check_box;
const int R::id::shadowRecoveryButton;
const int R::id::sharpenButton;
const int R::id::showImageStateButton;
const int R::id::showInfoPanel;
const int R::id::shutter;
const int R::id::shutter_button;
const int R::id::sizeAcceptButton;
const int R::id::sizeSeekBar;
const int R::id::sound_check_box;
const int R::id::start_trim;
const int R::id::state_panel_container;
const int R::id::status;
const int R::id::surface_view;
const int R::id::tableRow1;
const int R::id::tableRow2;
const int R::id::tableRow3;
const int R::id::tableRow4;
const int R::id::text;
const int R::id::textView;
const int R::id::textView1;
const int R::id::thumbnail;
const int R::id::time_duration_picker;
const int R::id::time_interval_picker;
const int R::id::time_lapse_interval_set_button;
const int R::id::time_lapse_label;
const int R::id::time_lapse_switch;
const int R::id::timer_set_button;
const int R::id::timer_sound;
const int R::id::tinyPlanetEditor;
const int R::id::tinyplanetButton;
const int R::id::title;
const int R::id::toggleVersionsPanel;
const int R::id::toggle_state;
const int R::id::top;
const int R::id::trim_view_root;
const int R::id::undoButton;
const int R::id::undo_button;
const int R::id::vIStrengthKnob;
const int R::id::vibranceButton;
const int R::id::viewpager;
const int R::id::vignetteButton;
const int R::id::vignetteEditor;
const int R::id::wbalanceButton;
const int R::id::widget_type;
const int R::id::widget_type_album;
const int R::id::widget_type_photo;
const int R::id::widget_type_shuffle;
const int R::id::yellowSeekBar;
const int R::id::yellowValue;
const int R::integer::album_cols_land;
const int R::integer::album_cols_port;
const int R::integer::album_rows_land;
const int R::integer::album_rows_port;
const int R::integer::albumset_cols_land;
const int R::integer::albumset_cols_port;
const int R::integer::albumset_rows_land;
const int R::integer::albumset_rows_port;
const int R::integer::max_video_recording_length;
const int R::interpolator::decelerate_cubic;
const int R::interpolator::decelerate_quint;
const int R::layout::action_bar_text;
const int R::layout::action_bar_two_line_text;
const int R::layout::action_mode;
const int R::layout::album_content;
const int R::layout::album_header;
const int R::layout::album_set_item;
const int R::layout::appwidget_loading_item;
const int R::layout::appwidget_main;
const int R::layout::appwidget_photo_item;
const int R::layout::audio_effects_dialog;
const int R::layout::audio_effects_title;
const int R::layout::bg_replacement_training_message;
const int R::layout::bookmark;
const int R::layout::bookmark_edit_dialog;
const int R::layout::bookmark_item;
const int R::layout::camera;
const int R::layout::camera_controls;
const int R::layout::camera_filmstrip;
const int R::layout::choose_widget_type;
const int R::layout::count_down_to_capture;
const int R::layout::countdown_setting_popup;
const int R::layout::crop_activity;
const int R::layout::cropimage;
const int R::layout::details;
const int R::layout::details_list;
const int R::layout::dialog_picker;
const int R::layout::editor_grad_button;
const int R::layout::effect_setting_item;
const int R::layout::effect_setting_popup;
const int R::layout::face_view;
const int R::layout::filtershow_actionbar;
const int R::layout::filtershow_activity;
const int R::layout::filtershow_brightness;
const int R::layout::filtershow_category_panel;
const int R::layout::filtershow_category_panel_new;
const int R::layout::filtershow_color_border_ui;
const int R::layout::filtershow_color_gird;
const int R::layout::filtershow_color_picker;
const int R::layout::filtershow_control_action_slider;
const int R::layout::filtershow_control_color_chooser;
const int R::layout::filtershow_control_style_chooser;
const int R::layout::filtershow_control_title_slider;
const int R::layout::filtershow_cp_custom_title;
const int R::layout::filtershow_crop_button;
const int R::layout::filtershow_curves_button;
const int R::layout::filtershow_default_editor;
const int R::layout::filtershow_draw_button;
const int R::layout::filtershow_draw_size;
const int R::layout::filtershow_draw_ui;
const int R::layout::filtershow_editor_panel;
const int R::layout::filtershow_export_dialog;
const int R::layout::filtershow_grad_editor;
const int R::layout::filtershow_grad_ui;
const int R::layout::filtershow_history_operation_row;
const int R::layout::filtershow_history_panel;
const int R::layout::filtershow_hue;
const int R::layout::filtershow_info_panel;
const int R::layout::filtershow_main_panel;
const int R::layout::filtershow_opacity;
const int R::layout::filtershow_presets_management_dialog;
const int R::layout::filtershow_presets_management_row;
const int R::layout::filtershow_saturation;
const int R::layout::filtershow_saturation_controls;
const int R::layout::filtershow_seekbar;
const int R::layout::filtershow_splashscreen;
const int R::layout::filtershow_state_panel;
const int R::layout::filtershow_state_panel_new;
const int R::layout::filtershow_tiny_planet_editor;
const int R::layout::filtershow_vignette_controls;
const int R::layout::filtershow_vignette_editor;
const int R::layout::filtershow_zoom_editor;
const int R::layout::gl_root_group;
const int R::layout::in_line_setting_check_box;
const int R::layout::in_line_setting_menu;
const int R::layout::ingest_activity_item_list;
const int R::layout::ingest_date_tile;
const int R::layout::ingest_fullsize;
const int R::layout::ingest_thumbnail;
const int R::layout::keyguard_widget;
const int R::layout::knob;
const int R::layout::list_pref_setting_popup;
const int R::layout::main;
const int R::layout::manage_offline_bar;
const int R::layout::menu_indicators;
const int R::layout::menu_indicators_keyguard;
const int R::layout::more_setting_popup;
const int R::layout::movie_view;
const int R::layout::multigrid_content;
const int R::layout::on_screen_hint;
const int R::layout::photo_frame;
const int R::layout::photo_module;
const int R::layout::photo_set_item;
const int R::layout::photopage_bottom_controls;
const int R::layout::photopage_progress_bar;
const int R::layout::popup_list_item;
const int R::layout::review_module_control;
const int R::layout::rotate_dialog;
const int R::layout::rotate_text_toast;
const int R::layout::secure_album_placeholder;
const int R::layout::setting_item;
const int R::layout::setting_list;
const int R::layout::switcher_popup;
const int R::layout::time_interval_picker;
const int R::layout::time_interval_popup;
const int R::layout::trim_menu;
const int R::layout::trim_view;
const int R::layout::undo_bar;
const int R::layout::video_module;
const int R::layout::view_gif_image;
const int R::layout::viewfinder_labels_video;
const int R::menu::album;
const int R::menu::albumset;
const int R::menu::crop;
const int R::menu::filterby;
const int R::menu::filtershow_activity_menu;
const int R::menu::filtershow_menu_chan_sat;
const int R::menu::filtershow_menu_color_border;
const int R::menu::filtershow_menu_crop;
const int R::menu::filtershow_menu_curves;
const int R::menu::filtershow_menu_draw;
const int R::menu::filtershow_menu_grad;
const int R::menu::filtershow_menu_vignette;
const int R::menu::gallery;
const int R::menu::gallery_multiselect;
const int R::menu::groupby;
const int R::menu::ingest_menu_item_list_selection;
const int R::menu::movie;
const int R::menu::operation;
const int R::menu::photo;
const int R::menu::pickup;
const int R::menu::settings;
const int R::mipmap::ic_launcher_camera;
const int R::mipmap::ic_launcher_gallery;
const int R::plurals::delete_selection;
const int R::plurals::ingest_number_of_items_scanned;
const int R::plurals::ingest_number_of_items_selected;
const int R::plurals::make_albums_available_offline;
const int R::plurals::number_of_albums_selected;
const int R::plurals::number_of_groups_selected;
const int R::plurals::number_of_items_selected;
const int R::plurals::number_of_photos;
const int R::plurals::pref_camera_timer_entry;
const int R::raw::backdropper;
const int R::raw::beep_once;
const int R::raw::beep_twice;
const int R::raw::blank;
const int R::raw::focus_complete;
const int R::raw::goofy_face;
const int R::raw::video_record;
const int R::string::Fixed;
const int R::string::Import;
const int R::string::_auto;
const int R::string::_delete;
const int R::string::access_sd_fail;
const int R::string::accessibility_back_to_first_level;
const int R::string::accessibility_camera_picker;
const int R::string::accessibility_check_box;
const int R::string::accessibility_decrement;
const int R::string::accessibility_increment;
const int R::string::accessibility_menu_button;
const int R::string::accessibility_mode_picker;
const int R::string::accessibility_pause_video;
const int R::string::accessibility_play_video;
const int R::string::accessibility_reload_video;
const int R::string::accessibility_review_cancel;
const int R::string::accessibility_review_ok;
const int R::string::accessibility_review_retake;
const int R::string::accessibility_review_thumbnail;
const int R::string::accessibility_second_level_indicators;
const int R::string::accessibility_shutter_button;
const int R::string::accessibility_switch_to_camera;
const int R::string::accessibility_switch_to_new_panorama;
const int R::string::accessibility_switch_to_panorama;
const int R::string::accessibility_switch_to_refocus;
const int R::string::accessibility_switch_to_video;
const int R::string::accessibility_time_bar;
const int R::string::accessibility_zoom_control;
const int R::string::add_account;
const int R::string::albums;
const int R::string::aperture;
const int R::string::apn;
const int R::string::app_name;
const int R::string::apply_effect;
const int R::string::appwidget_empty_text;
const int R::string::appwidget_title;
const int R::string::aspect;
const int R::string::aspect1to1_effect;
const int R::string::aspect3to4_effect;
const int R::string::aspect4to3_effect;
const int R::string::aspect4to6_effect;
const int R::string::aspect5to7_effect;
const int R::string::aspect7to5_effect;
const int R::string::aspect9to16_effect;
const int R::string::aspectNone_effect;
const int R::string::aspectOriginal_effect;
const int R::string::audio_effects;
const int R::string::audio_effects_dialog_title;
const int R::string::bass_boost_strength;
const int R::string::bg_replacement_message;
const int R::string::bookmark_add;
const int R::string::bookmark_add_success;
const int R::string::bookmark_display;
const int R::string::bookmark_empty;
const int R::string::bookmark_exist;
const int R::string::bookmark_list;
const int R::string::bookmark_location;
const int R::string::bookmark_title;
const int R::string::borders;
const int R::string::buffer_size;
const int R::string::bwfilter;
const int R::string::caching_label;
const int R::string::camera_connected;
const int R::string::camera_disabled;
const int R::string::camera_disconnected;
const int R::string::camera_error_title;
const int R::string::camera_label;
const int R::string::camera_menu_more_label;
const int R::string::camera_menu_settings_label;
const int R::string::camera_setas_wallpaper;
const int R::string::cancel;
const int R::string::cannot_connect_camera;
const int R::string::cannot_edit_original;
const int R::string::cannot_load_image;
const int R::string::capital_off;
const int R::string::capital_on;
const int R::string::clear_effects;
const int R::string::click_import;
const int R::string::close;
const int R::string::color_border_clear;
const int R::string::color_border_color;
const int R::string::color_border_corner_size;
const int R::string::color_border_size;
const int R::string::color_pick_select;
const int R::string::color_pick_title;
const int R::string::compare_original;
const int R::string::confirm;
const int R::string::contrast;
const int R::string::count_down_title_text;
const int R::string::crop;
const int R::string::crop_action;
const int R::string::crop_label;
const int R::string::crop_save_text;
const int R::string::crop_saved;
const int R::string::curvesRGB;
const int R::string::curves_channel_blue;
const int R::string::curves_channel_green;
const int R::string::curves_channel_red;
const int R::string::curves_channel_rgb;
const int R::string::custom_border;
const int R::string::default_title;
const int R::string::delete_all;
const int R::string::deleted;
const int R::string::description;
const int R::string::deselect_all;
const int R::string::details;
const int R::string::details_hms;
const int R::string::details_ms;
const int R::string::details_title;
const int R::string::dialog_ok;
const int R::string::disable_video_snapshot_hint;
const int R::string::done;
const int R::string::download_failure;
const int R::string::downsample;
const int R::string::draw_clear;
const int R::string::draw_color;
const int R::string::draw_hue;
const int R::string::draw_saturation;
const int R::string::draw_size;
const int R::string::draw_size_accept;
const int R::string::draw_size_title;
const int R::string::draw_style;
const int R::string::draw_style_brush_marker;
const int R::string::draw_style_brush_spatter;
const int R::string::draw_style_line;
const int R::string::draw_value;
const int R::string::duration;
const int R::string::edge;
const int R::string::edit;
const int R::string::editor_chan_sat_blue;
const int R::string::editor_chan_sat_cyan;
const int R::string::editor_chan_sat_green;
const int R::string::editor_chan_sat_magenta;
const int R::string::editor_chan_sat_main;
const int R::string::editor_chan_sat_red;
const int R::string::editor_chan_sat_yellow;
const int R::string::editor_grad_brightness;
const int R::string::editor_grad_contrast;
const int R::string::editor_grad_new;
const int R::string::editor_grad_saturation;
const int R::string::editor_grad_style;
const int R::string::effect_backdropper_gallery;
const int R::string::effect_backdropper_space;
const int R::string::effect_backdropper_sunset;
const int R::string::effect_background;
const int R::string::effect_goofy_face_big_eyes;
const int R::string::effect_goofy_face_big_mouth;
const int R::string::effect_goofy_face_big_nose;
const int R::string::effect_goofy_face_small_eyes;
const int R::string::effect_goofy_face_small_mouth;
const int R::string::effect_goofy_face_squeeze;
const int R::string::effect_none;
const int R::string::effect_silly_faces;
const int R::string::empty;
const int R::string::empty_album;
const int R::string::exit;
const int R::string::export_flattened;
const int R::string::export_image;
const int R::string::exposure;
const int R::string::exposure_time;
const int R::string::fail_to_load;
const int R::string::fail_to_load_image;
const int R::string::fail_trim;
const int R::string::ffx_bleach;
const int R::string::ffx_blue_crush;
const int R::string::ffx_bw_contrast;
const int R::string::ffx_instant;
const int R::string::ffx_original;
const int R::string::ffx_punch;
const int R::string::ffx_vintage;
const int R::string::ffx_washout;
const int R::string::ffx_washout_color;
const int R::string::ffx_x_process;
const int R::string::file_size;
const int R::string::filtershow_add_button_looks;
const int R::string::filtershow_add_button_versions;
const int R::string::filtershow_exif_aperture;
const int R::string::filtershow_exif_copyright;
const int R::string::filtershow_exif_date;
const int R::string::filtershow_exif_exposure_time;
const int R::string::filtershow_exif_f_stop;
const int R::string::filtershow_exif_focal_length;
const int R::string::filtershow_exif_iso;
const int R::string::filtershow_exif_model;
const int R::string::filtershow_exif_subject_distance;
const int R::string::filtershow_manage_preset;
const int R::string::filtershow_new_preset;
const int R::string::filtershow_notification_label;
const int R::string::filtershow_notification_message;
const int R::string::filtershow_preset_name;
const int R::string::filtershow_redo;
const int R::string::filtershow_save_preset;
const int R::string::filtershow_saving_image;
const int R::string::filtershow_show_info_panel;
const int R::string::filtershow_show_info_panel_exif;
const int R::string::filtershow_show_info_panel_histogram;
const int R::string::filtershow_show_info_panel_name;
const int R::string::filtershow_show_info_panel_size;
const int R::string::filtershow_undo;
const int R::string::filtershow_version_current;
const int R::string::filtershow_version_original;
const int R::string::flash;
const int R::string::flash_off;
const int R::string::flash_on;
const int R::string::focal_length;
const int R::string::folder_camera;
const int R::string::folder_download;
const int R::string::folder_edited_online_photos;
const int R::string::folder_imported;
const int R::string::folder_screenshot;
const int R::string::free_space_format;
const int R::string::gadget_title;
const int R::string::grad;
const int R::string::group_by;
const int R::string::group_by_album;
const int R::string::group_by_faces;
const int R::string::group_by_location;
const int R::string::group_by_size;
const int R::string::group_by_tags;
const int R::string::group_by_time;
const int R::string::headset_plug;
const int R::string::height;
const int R::string::help;
const int R::string::hide_imagestate_panel;
const int R::string::highlight_recovery;
const int R::string::history;
const int R::string::history_original;
const int R::string::hue;
const int R::string::imageDraw;
const int R::string::imageState;
const int R::string::image_file_name_format;
const int R::string::import_complete;
const int R::string::import_fail;
const int R::string::ingest_empty_device;
const int R::string::ingest_import;
const int R::string::ingest_import_complete;
const int R::string::ingest_importing;
const int R::string::ingest_no_device;
const int R::string::ingest_scanning;
const int R::string::ingest_scanning_done;
const int R::string::ingest_sorting;
const int R::string::ingest_switch_photo_fullscreen;
const int R::string::ingest_switch_photo_grid;
const int R::string::input_url;
const int R::string::iso;
const int R::string::kmeans;
const int R::string::loading;
const int R::string::loading_account;
const int R::string::loading_image;
const int R::string::loading_video;
const int R::string::location;
const int R::string::locations;
const int R::string::loop;
const int R::string::make_available_offline;
const int R::string::maker;
const int R::string::manual;
const int R::string::map_activity_not_found_err;
const int R::string::media_controller_connecting;
const int R::string::media_controller_live;
const int R::string::media_controller_playing;
const int R::string::menu_camera;
const int R::string::menu_search;
const int R::string::menu_settings;
const int R::string::mimetype;
const int R::string::mirror;
const int R::string::model;
const int R::string::more_image;
const int R::string::movie_view_label;
const int R::string::multiface_crop_help;
const int R::string::mute_action;
const int R::string::mute_nosupport;
const int R::string::muting;
const int R::string::negative;
const int R::string::next;
const int R::string::no_albums_alert;
const int R::string::no_connectivity;
const int R::string::no_external_storage;
const int R::string::no_external_storage_title;
const int R::string::no_location;
const int R::string::no_storage;
const int R::string::no_such_item;
const int R::string::no_thumbnail;
const int R::string::none;
const int R::string::not_selectable_in_scene_mode;
const int R::string::ok;
const int R::string::orientation;
const int R::string::original;
const int R::string::original_picture_text;
const int R::string::pano_capture_indication;
const int R::string::pano_dialog_panorama_failed;
const int R::string::pano_dialog_prepare_preview;
const int R::string::pano_dialog_title;
const int R::string::pano_dialog_waiting_previous;
const int R::string::pano_file_name_format;
const int R::string::pano_progress_text;
const int R::string::pano_review_rendering;
const int R::string::pano_review_saving_indication_str;
const int R::string::pano_too_fast_prompt;
const int R::string::path;
const int R::string::people;
const int R::string::picasa_posts;
const int R::string::please_wait;
const int R::string::pref_camcorder_settings_category;
const int R::string::pref_camera_countdown_label;
const int R::string::pref_camera_countdown_label_fifteen;
const int R::string::pref_camera_countdown_label_off;
const int R::string::pref_camera_countdown_label_one;
const int R::string::pref_camera_countdown_label_ten;
const int R::string::pref_camera_countdown_label_three;
const int R::string::pref_camera_flashmode_default;
const int R::string::pref_camera_flashmode_entry_auto;
const int R::string::pref_camera_flashmode_entry_off;
const int R::string::pref_camera_flashmode_entry_on;
const int R::string::pref_camera_flashmode_label;
const int R::string::pref_camera_flashmode_label_auto;
const int R::string::pref_camera_flashmode_label_off;
const int R::string::pref_camera_flashmode_label_on;
const int R::string::pref_camera_flashmode_no_flash;
const int R::string::pref_camera_flashmode_title;
const int R::string::pref_camera_focusmode_entry_auto;
const int R::string::pref_camera_focusmode_entry_infinity;
const int R::string::pref_camera_focusmode_entry_macro;
const int R::string::pref_camera_focusmode_label_auto;
const int R::string::pref_camera_focusmode_label_infinity;
const int R::string::pref_camera_focusmode_label_macro;
const int R::string::pref_camera_focusmode_title;
const int R::string::pref_camera_hdr_default;
const int R::string::pref_camera_hdr_label;
const int R::string::pref_camera_id_default;
const int R::string::pref_camera_id_entry_back;
const int R::string::pref_camera_id_entry_front;
const int R::string::pref_camera_id_label_back;
const int R::string::pref_camera_id_label_front;
const int R::string::pref_camera_id_title;
const int R::string::pref_camera_location_label;
const int R::string::pref_camera_picturesize_entry_13mp;
const int R::string::pref_camera_picturesize_entry_1_3mp;
const int R::string::pref_camera_picturesize_entry_1mp;
const int R::string::pref_camera_picturesize_entry_2mp;
const int R::string::pref_camera_picturesize_entry_2mp_wide;
const int R::string::pref_camera_picturesize_entry_3mp;
const int R::string::pref_camera_picturesize_entry_4mp;
const int R::string::pref_camera_picturesize_entry_5mp;
const int R::string::pref_camera_picturesize_entry_8mp;
const int R::string::pref_camera_picturesize_entry_qvga;
const int R::string::pref_camera_picturesize_entry_vga;
const int R::string::pref_camera_picturesize_title;
const int R::string::pref_camera_recordlocation_default;
const int R::string::pref_camera_recordlocation_title;
const int R::string::pref_camera_scenemode_default;
const int R::string::pref_camera_scenemode_entry_action;
const int R::string::pref_camera_scenemode_entry_auto;
const int R::string::pref_camera_scenemode_entry_hdr;
const int R::string::pref_camera_scenemode_entry_night;
const int R::string::pref_camera_scenemode_entry_party;
const int R::string::pref_camera_scenemode_entry_sunset;
const int R::string::pref_camera_scenemode_label_action;
const int R::string::pref_camera_scenemode_label_auto;
const int R::string::pref_camera_scenemode_label_night;
const int R::string::pref_camera_scenemode_label_party;
const int R::string::pref_camera_scenemode_label_sunset;
const int R::string::pref_camera_scenemode_title;
const int R::string::pref_camera_settings_category;
const int R::string::pref_camera_timer_default;
const int R::string::pref_camera_timer_sound_default;
const int R::string::pref_camera_timer_sound_title;
const int R::string::pref_camera_timer_title;
const int R::string::pref_camera_video_flashmode_default;
const int R::string::pref_camera_whitebalance_default;
const int R::string::pref_camera_whitebalance_entry_auto;
const int R::string::pref_camera_whitebalance_entry_cloudy;
const int R::string::pref_camera_whitebalance_entry_daylight;
const int R::string::pref_camera_whitebalance_entry_fluorescent;
const int R::string::pref_camera_whitebalance_entry_incandescent;
const int R::string::pref_camera_whitebalance_label;
const int R::string::pref_camera_whitebalance_label_auto;
const int R::string::pref_camera_whitebalance_label_cloudy;
const int R::string::pref_camera_whitebalance_label_daylight;
const int R::string::pref_camera_whitebalance_label_fluorescent;
const int R::string::pref_camera_whitebalance_label_incandescent;
const int R::string::pref_camera_whitebalance_title;
const int R::string::pref_exposure_default;
const int R::string::pref_exposure_label;
const int R::string::pref_exposure_title;
const int R::string::pref_video_effect_default;
const int R::string::pref_video_effect_title;
const int R::string::pref_video_quality_default;
const int R::string::pref_video_quality_entry_1080p;
const int R::string::pref_video_quality_entry_480p;
const int R::string::pref_video_quality_entry_720p;
const int R::string::pref_video_quality_entry_high;
const int R::string::pref_video_quality_entry_low;
const int R::string::pref_video_quality_title;
const int R::string::pref_video_time_lapse_frame_interval_1000;
const int R::string::pref_video_time_lapse_frame_interval_10000;
const int R::string::pref_video_time_lapse_frame_interval_10800000;
const int R::string::pref_video_time_lapse_frame_interval_12000;
const int R::string::pref_video_time_lapse_frame_interval_120000;
const int R::string::pref_video_time_lapse_frame_interval_1440000;
const int R::string::pref_video_time_lapse_frame_interval_14400000;
const int R::string::pref_video_time_lapse_frame_interval_1500;
const int R::string::pref_video_time_lapse_frame_interval_15000;
const int R::string::pref_video_time_lapse_frame_interval_150000;
const int R::string::pref_video_time_lapse_frame_interval_180000;
const int R::string::pref_video_time_lapse_frame_interval_1800000;
const int R::string::pref_video_time_lapse_frame_interval_18000000;
const int R::string::pref_video_time_lapse_frame_interval_2000;
const int R::string::pref_video_time_lapse_frame_interval_21600000;
const int R::string::pref_video_time_lapse_frame_interval_24000;
const int R::string::pref_video_time_lapse_frame_interval_240000;
const int R::string::pref_video_time_lapse_frame_interval_2500;
const int R::string::pref_video_time_lapse_frame_interval_3000;
const int R::string::pref_video_time_lapse_frame_interval_30000;
const int R::string::pref_video_time_lapse_frame_interval_300000;
const int R::string::pref_video_time_lapse_frame_interval_360000;
const int R::string::pref_video_time_lapse_frame_interval_3600000;
const int R::string::pref_video_time_lapse_frame_interval_36000000;
const int R::string::pref_video_time_lapse_frame_interval_4000;
const int R::string::pref_video_time_lapse_frame_interval_43200000;
const int R::string::pref_video_time_lapse_frame_interval_500;
const int R::string::pref_video_time_lapse_frame_interval_5000;
const int R::string::pref_video_time_lapse_frame_interval_5400000;
const int R::string::pref_video_time_lapse_frame_interval_54000000;
const int R::string::pref_video_time_lapse_frame_interval_6000;
const int R::string::pref_video_time_lapse_frame_interval_60000;
const int R::string::pref_video_time_lapse_frame_interval_600000;
const int R::string::pref_video_time_lapse_frame_interval_720000;
const int R::string::pref_video_time_lapse_frame_interval_7200000;
const int R::string::pref_video_time_lapse_frame_interval_86400000;
const int R::string::pref_video_time_lapse_frame_interval_90000;
const int R::string::pref_video_time_lapse_frame_interval_900000;
const int R::string::pref_video_time_lapse_frame_interval_9000000;
const int R::string::pref_video_time_lapse_frame_interval_default;
const int R::string::pref_video_time_lapse_frame_interval_off;
const int R::string::pref_video_time_lapse_frame_interval_title;
const int R::string::preparing_sd;
const int R::string::previous;
const int R::string::print_image;
const int R::string::process_caching_requests;
const int R::string::quality;
const int R::string::record_time;
const int R::string::redeye;
const int R::string::remember_location_no;
const int R::string::remember_location_prompt;
const int R::string::remember_location_title;
const int R::string::remember_location_yes;
const int R::string::reset;
const int R::string::reset_effect;
const int R::string::resume_playing_message;
const int R::string::resume_playing_restart;
const int R::string::resume_playing_resume;
const int R::string::resume_playing_title;
const int R::string::review_cancel;
const int R::string::review_ok;
const int R::string::rotate;
const int R::string::rotate_left;
const int R::string::rotate_right;
const int R::string::rtp_max_port;
const int R::string::rtp_min_port;
const int R::string::rtp_rtcp;
const int R::string::saturation;
const int R::string::save;
const int R::string::save_and_exit;
const int R::string::save_and_processing;
const int R::string::save_before_exit;
const int R::string::save_error;
const int R::string::save_into;
const int R::string::saved;
const int R::string::saving_image;
const int R::string::select_album;
const int R::string::select_all;
const int R::string::select_group;
const int R::string::select_image;
const int R::string::select_item;
const int R::string::select_output_settings;
const int R::string::select_video;
const int R::string::sequence_in_set;
const int R::string::server_timeout_message;
const int R::string::server_timeout_title;
const int R::string::set_apn;
const int R::string::set_as;
const int R::string::set_buffer_size;
const int R::string::set_duration;
const int R::string::set_image;
const int R::string::set_label_all_albums;
const int R::string::set_label_local_albums;
const int R::string::set_label_mtp_devices;
const int R::string::set_label_picasa_albums;
const int R::string::set_rtp_max_port;
const int R::string::set_rtp_min_port;
const int R::string::set_time_interval;
const int R::string::set_time_interval_help;
const int R::string::set_timer_help;
const int R::string::set_wallpaper;
const int R::string::setp_option_name;
const int R::string::setp_option_six_second;
const int R::string::setp_option_three_second;
const int R::string::setting;
const int R::string::setting_off;
const int R::string::setting_off_value;
const int R::string::setting_on;
const int R::string::setting_on_value;
const int R::string::setting_wallpaper;
const int R::string::settings;
const int R::string::shadow_recovery;
const int R::string::share;
const int R::string::share_as_photo;
const int R::string::share_panorama;
const int R::string::sharpness;
const int R::string::show_all;
const int R::string::show_images_only;
const int R::string::show_imagestate_panel;
const int R::string::show_on_map;
const int R::string::show_videos_only;
const int R::string::simple_edit;
const int R::string::single;
const int R::string::single_track;
const int R::string::size;
const int R::string::size_above;
const int R::string::size_below;
const int R::string::size_between;
const int R::string::slideshow;
const int R::string::slideshow_dream_name;
const int R::string::spaceIsLow_content;
const int R::string::speaker_need_headset;
const int R::string::speaker_off;
const int R::string::speaker_on;
const int R::string::state_panel_original;
const int R::string::state_panel_result;
const int R::string::step_option_desc;
const int R::string::stereo;
const int R::string::straighten;
const int R::string::streaming_settings;
const int R::string::switch_photo_filmstrip;
const int R::string::switch_photo_fullscreen;
const int R::string::switch_photo_grid;
const int R::string::switch_to_camera;
const int R::string::sync_album_error;
const int R::string::sync_picasa_albums;
const int R::string::tab_albums;
const int R::string::tab_photos;
const int R::string::tags;
const int R::string::tap_to_focus;
const int R::string::time;
const int R::string::time_lapse_hours;
const int R::string::time_lapse_interval_set;
const int R::string::time_lapse_minutes;
const int R::string::time_lapse_seconds;
const int R::string::time_lapse_title;
const int R::string::times;
const int R::string::tinyplanet;
const int R::string::title;
const int R::string::title_activity_filter_show;
const int R::string::trim_action;
const int R::string::trim_label;
const int R::string::trim_too_short;
const int R::string::trimming;
const int R::string::try_to_set_local_album_available_offline;
const int R::string::undo;
const int R::string::unit_mm;
const int R::string::unknown;
const int R::string::unsaved;
const int R::string::untagged;
const int R::string::vibrance;
const int R::string::video_err;
const int R::string::video_file_name_format;
const int R::string::video_mute_err;
const int R::string::video_reach_size_limit;
const int R::string::video_recording_started;
const int R::string::video_recording_stopped;
const int R::string::video_snapshot_hint;
const int R::string::videoview_error_text_cannot_connect_retry;
const int R::string::vignette;
const int R::string::vignette_contrast;
const int R::string::vignette_exposure;
const int R::string::vignette_falloff;
const int R::string::vignette_main;
const int R::string::vignette_saturation;
const int R::string::virtualizer_strength;
const int R::string::wait;
const int R::string::wallpaper;
const int R::string::wbalance;
const int R::string::website_for_more_image;
const int R::string::white_balance;
const int R::string::widget_type;
const int R::string::widget_type_album;
const int R::string::widget_type_photo;
const int R::string::widget_type_shuffle;
const int R::string::width;
const int R::string::x;
const int R::style::ActionBarTitle;
const int R::style::ActionBarTwoLineItem;
const int R::style::ActionBarTwoLinePrimary;
const int R::style::ActionBarTwoLineSecondary;
const int R::style::Animation_OnScreenHint;
const int R::style::CameraControls;
const int R::style::DialogPickerTheme;
const int R::style::EffectSettingGrid;
const int R::style::EffectSettingItem;
const int R::style::EffectSettingItemTitle;
const int R::style::EffectSettingTypeTitle;
const int R::style::EffectTitleSeparator;
const int R::style::EffectTypeSeparator;
const int R::style::FilterIconButton;
const int R::style::FilterShowBottomButton;
const int R::style::FilterShowHistoryButton;
const int R::style::FilterShowSlider;
const int R::style::FilterShowTopButton;
const int R::style::Holo_ActionBar;
const int R::style::IconButton;
const int R::style::Material_ActionBar;
const int R::style::MediaButton_Play;
const int R::style::MenuIndicator;
const int R::style::OnScreenHintTextAppearance;
const int R::style::OnScreenHintTextAppearance_Small;
const int R::style::OnViewfinderLabel;
const int R::style::PanoCustomDialogText;
const int R::style::PanoCustomDialogText_xlarge;
const int R::style::PanoViewHorizontalBar;
const int R::style::PopupTitleSeparator;
const int R::style::PopupTitleText;
const int R::style::PopupTitleText_xlarge;
const int R::style::ReviewControlIcon;
const int R::style::ReviewControlText;
const int R::style::ReviewControlText_xlarge;
const int R::style::ReviewPlayIcon;
const int R::style::SettingItemList;
const int R::style::SettingItemText;
const int R::style::SettingItemTitle;
const int R::style::SettingPopupWindow;
const int R::style::SettingPopupWindow_xlarge;
const int R::style::SettingRow;
const int R::style::SwitcherButton;
const int R::style::TextAppearance_DialogWindowTitle;
const int R::style::TextAppearance_Medium;
const int R::style::Theme_Camera;
const int R::style::Theme_CameraBase;
const int R::style::Theme_Crop;
const int R::style::Theme_FilterShow;
const int R::style::Theme_Gallery;
const int R::style::Theme_Gallery_Dialog;
const int R::style::Theme_GalleryBase;
const int R::style::Theme_Photos_Fullscreen;
const int R::style::Theme_Photos_Gallery;
const int R::style::Theme_ProxyLauncher;
const int R::style::UndoBar;
const int R::style::UndoBarSeparator;
const int R::style::UndoBarTextAppearance;
const int R::style::UndoButton;
const int R::style::ViewfinderLabelLayout;
const int R::style::ViewfinderLabelLayout_xlarge;
const int R::style::Widget_Button_Borderless;
const int R::xml::camera_preferences;
const int R::xml::device_filter;
const int R::xml::rtsp_settings_preferences;
const int R::xml::video_preferences;
const int R::xml::wallpaper_picker_preview;
const int R::xml::widget_info;
const int R::styleable::CameraPreference[1] = {
0x7f010002
};
const int R::styleable::CameraPreference_title;
const int R::styleable::CategoryTrack[1] = {
0x7f010013
};
const int R::styleable::CategoryTrack_iconSize;
const int R::styleable::CenteredLinearLayout[1] = {
0x7f010010
};
const int R::styleable::CenteredLinearLayout_max_width;
const int R::styleable::IconIndicator[2] = {
0x7f010008, 0x7f010009
};
const int R::styleable::IconIndicator_icons;
const int R::styleable::IconIndicator_modes;
const int R::styleable::IconListPreference[4] = {
0x7f010008, 0x7f01000a, 0x7f01000b, 0x7f01000c
};
const int R::styleable::IconListPreference_icons;
const int R::styleable::IconListPreference_images;
const int R::styleable::IconListPreference_largeIcons;
const int R::styleable::IconListPreference_singleIcon;
const int R::styleable::ImageButtonTitle[2] = {
0x01010098, 0x0101014f
};
const int R::styleable::ImageButtonTitle_android_text;
const int R::styleable::ImageButtonTitle_android_textColor;
const int R::styleable::Knob[3] = {
0x7f01000d, 0x7f01000e, 0x7f01000f
};
const int R::styleable::Knob_background;
const int R::styleable::Knob_foreground;
const int R::styleable::Knob_label;
const int R::styleable::ListPreference[5] = {
0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006,
0x7f010007
};
const int R::styleable::ListPreference_defaultValue;
const int R::styleable::ListPreference_entries;
const int R::styleable::ListPreference_entryValues;
const int R::styleable::ListPreference_key;
const int R::styleable::ListPreference_labelList;
const int R::styleable::StatePanelTrack[2] = {
0x7f010011, 0x7f010012
};
const int R::styleable::StatePanelTrack_elemEndSize;
const int R::styleable::StatePanelTrack_elemSize;
const int R::styleable::Theme_GalleryBase[2] = {
0x7f010000, 0x7f010001
};
const int R::styleable::Theme_GalleryBase_listPreferredItemHeightSmall;
const int R::styleable::Theme_GalleryBase_switchStyle;
};
};
};
};
| 41.190714 | 73 | 0.805406 | [
"model"
] |
e8f5c81ed7c2493cf8458716210203affabc5c73 | 10,559 | cpp | C++ | src/Molassembler/Stereopermutators/FeasiblePermutations.cpp | qcscine/molassembler | 3b72168477b2d1dee55812517e49d9c3285c50ba | [
"BSD-3-Clause"
] | 17 | 2020-11-27T14:59:34.000Z | 2022-03-28T10:31:25.000Z | src/Molassembler/Stereopermutators/FeasiblePermutations.cpp | qcscine/molassembler | 3b72168477b2d1dee55812517e49d9c3285c50ba | [
"BSD-3-Clause"
] | null | null | null | src/Molassembler/Stereopermutators/FeasiblePermutations.cpp | qcscine/molassembler | 3b72168477b2d1dee55812517e49d9c3285c50ba | [
"BSD-3-Clause"
] | 6 | 2020-12-09T09:21:53.000Z | 2021-08-22T15:42:21.000Z | /*!@file
* @copyright This code is licensed under the 3-clause BSD license.
* Copyright ETH Zurich, Laboratory of Physical Chemistry, Reiher Group.
* See LICENSE.txt for details.
*/
#include "Molassembler/Stereopermutators/FeasiblePermutations.h"
#include "Molassembler/Stereopermutators/AbstractPermutations.h"
#include "Molassembler/Stereopermutators/CycleFeasibility.h"
#include "Molassembler/Stereopermutators/ShapeVertexMaps.h"
#include "Molassembler/Modeling/BondDistance.h"
#include "Molassembler/Modeling/CommonTrig.h"
#include "Molassembler/DistanceGeometry/SpatialModel.h"
#include "Molassembler/Shapes/PropertyCaching.h"
#include "Molassembler/Temple/Adaptors/CyclicFrame.h"
#include "Molassembler/Temple/Adaptors/Transform.h"
#include "Molassembler/Temple/Functional.h"
namespace Scine {
namespace Molassembler {
namespace Stereopermutators {
bool Feasible::linkPossiblyFeasible(
const RankingInformation::Link& link,
const AtomIndex placement,
const ConeAngleType& cones,
const RankingInformation& ranking,
const Shapes::Shape shape,
const SiteToShapeVertexMap& shapeVertexMap,
const Graph& graph
) {
// The algorithm below is explained in detail in documents/denticity_feasibility
assert(link.cycleSequence.front() != link.cycleSequence.back());
// Perform no checks if, for either of the sites, no cone angle could be calculated
if(!cones.at(link.sites.first) || !cones.at(link.sites.second)) {
return true;
}
const DistanceGeometry::ValueBounds siteIConeAngle = cones.at(link.sites.first).value();
const DistanceGeometry::ValueBounds siteJConeAngle = cones.at(link.sites.second).value();
const double shapeAngle = DistanceGeometry::SpatialModel::siteCentralAngle(
placement,
shape,
ranking,
shapeVertexMap,
link.sites,
graph.inner()
);
if(link.cycleSequence.size() == 3) {
/* Test if the bond gets closer than the central index's bond radius.
* It's a pretty arbitrary condition...
*
* This way, triangles aren't universally allowed (siteCentralAngle will
* distort the angle to enable the graph in some situations, and leave
* the ideal angle preserved in others)
*/
assert(link.cycleSequence.front() == placement);
/* TODO maybe it might be better to ask in a very boolean way whether
* the shape is willing to distort for this particular link or not
* instead of testing the angle in such a roundabout manner...
*/
return !Stereopermutators::triangleBondTooClose(
DistanceGeometry::SpatialModel::modelDistance(
placement,
link.cycleSequence[1],
graph.inner()
),
DistanceGeometry::SpatialModel::modelDistance(
placement,
link.cycleSequence[2],
graph.inner()
),
shapeAngle,
AtomInfo::bondRadius(graph.elementType(placement))
);
}
/* A link across haptic sites is only obviously impossible if it is
* impossible in the best case scenario. In this case, especially for alpha,
* site bridge links must be possible only in the best case spatial
* arrangement for the haptic site link to be possible. That means
* subtracting the upper bound of the respective cone angles.
*/
const double alpha = std::max(
0.0,
shapeAngle - siteIConeAngle.upper - siteJConeAngle.upper
);
/* We need to respect the graph as ground truth. If a cycle is of size
* three, then angles of whatever shape is present will be distorted if
* there is only one group of shape positions (e.g. tetrahedral has
* only one group, but square pyramidal has two!) available.
*
* For symmetries with multiple groups of shape positions, only that
* group of shape positions with lower cross-angles is viable for the
* link, and will distort accordingly.
*/
// auto symmetryGroups = Shapes::Properties::positionGroupCharacters(shape);
/* First we need to construct the cyclic polygon of the cycle sequence
* without the central atom.
*/
assert(link.cycleSequence.front() == placement);
auto cycleEdgeLengths = Temple::map(
Temple::Adaptors::cyclicFrame<2>(link.cycleSequence),
[&](const auto& i, const auto& j) -> double {
return DistanceGeometry::SpatialModel::modelDistance(i, j, graph.inner());
}
);
/* The first and last cycle edge lengths are from and to the central atom,
* and so we remove those by combining alpha with those edge lengths
* with the law of cosines
*/
const double a = cycleEdgeLengths.front();
const double b = cycleEdgeLengths.back();
const double c = CommonTrig::lawOfCosines(a, b, alpha); // B-A
cycleEdgeLengths.back() = c;
cycleEdgeLengths.erase(std::begin(cycleEdgeLengths));
std::vector<Stereopermutators::BaseAtom> bases (1);
auto& base = bases.front();
base.elementType = graph.elementType(placement);
base.distanceToLeft = a;
base.distanceToRight = b;
auto elementTypes = Temple::map(
link.cycleSequence,
[&](const AtomIndex i) -> Utils::ElementType {
return graph.elementType(i);
}
);
// Drop the central index's element type from this map
elementTypes.erase(std::begin(elementTypes));
return !Stereopermutators::cycleModelContradictsGraph(
elementTypes,
cycleEdgeLengths,
bases
);
}
bool Feasible::possiblyFeasible(
const Stereopermutations::Stereopermutation& stereopermutation,
const AtomIndex placement,
const RankingInformation::RankedSitesType& canonicalSites,
const ConeAngleType& coneAngles,
const RankingInformation& ranking,
const Shapes::Shape shape,
const Graph& graph
) {
const auto shapeVertexMap = siteToShapeVertexMap(
stereopermutation,
canonicalSites,
ranking.links
);
// Check if any haptic site cones intersect
const unsigned L = ranking.sites.size();
for(SiteIndex siteI {0}; siteI < L - 1; ++siteI) {
if(ranking.sites.at(siteI).size() == 1) {
continue;
}
for(SiteIndex siteJ {siteI + 1}; siteJ < L; ++siteJ) {
if(ranking.sites.at(siteJ).size() == 1) {
continue;
}
// Do not test cone angles if no angle could be calculated
if(!coneAngles.at(siteI) || !coneAngles.at(siteJ)) {
continue;
}
// siteCentralAngle yields undistorted symmetry angles for haptic sites
const double shapeAngle = DistanceGeometry::SpatialModel::siteCentralAngle(
placement,
shape,
ranking,
shapeVertexMap,
{siteI, siteJ},
graph.inner()
);
/* A haptic steropermutation of sites is only feasible if the haptic
* sites have spatial freedom to arrange in a fashion that does not
* overlap.
*/
if(
(
shapeAngle
- coneAngles.at(siteI).value().lower
- coneAngles.at(siteJ).value().lower
) < 0
) {
return false;
}
}
}
/* Idea: An stereopermutation is possibly feasible if all links' cycles can
* be realized as a flat cyclic polygon, in which the edges from the central
* atom are merged using the joint angle calculable from the
* stereopermutation and shape.
*/
return Temple::all_of(
ranking.links,
[&](const auto& link) -> bool {
return linkPossiblyFeasible(
link,
placement,
coneAngles,
ranking,
shape,
shapeVertexMap,
graph
);
}
);
}
std::vector<unsigned> Feasible::Functor::operator() (
const Abstract& abstract,
Shapes::Shape shape,
AtomIndex placement,
const RankingInformation& ranking
) const {
const unsigned P = abstract.permutations.list.size();
// Determine which permutations are feasible and which aren't
const bool hapticSitesExist = Temple::any_of(
ranking.sites,
[](const auto& siteAtoms) -> bool {
return siteAtoms.size() > 1;
}
);
if(ranking.links.empty() && !hapticSitesExist) {
return Temple::iota<unsigned>(P);
}
const LocalSpatialModel spatial {
placement,
ranking,
graph.inner()
};
std::vector<unsigned> indices;
indices.reserve(P);
for(unsigned i = 0; i < P; ++i) {
if(
possiblyFeasible(
abstract.permutations.list.at(i),
placement,
abstract.canonicalSites,
spatial.coneAngles,
ranking,
shape,
graph
)
) {
indices.push_back(i);
}
}
indices.shrink_to_fit();
return indices;
}
std::vector<unsigned> Feasible::Unchecked::operator() (
const Abstract& abstract,
Shapes::Shape /* shape */,
AtomIndex /* placement */,
const RankingInformation& /* ranking */
) const {
const unsigned P = abstract.permutations.list.size();
return Temple::iota<unsigned>(P);
}
boost::optional<unsigned> Feasible::findRotationallySuperposableAssignment(
const Stereopermutations::Stereopermutation& permutation,
const Shapes::Shape shape,
const Abstract& abstract,
const std::vector<unsigned>& feasibles
) {
/* NOTE: Assumes that abstract permutations are all the min element of their
* rotational set (see Stereopermutations::uniques).
*/
const auto trialRotations = Stereopermutations::generateAllRotations(permutation, shape);
const auto trialMinRotation = *std::min_element(std::begin(trialRotations), std::end(trialRotations));
const auto feasiblesIter = Temple::find_if(
feasibles,
[&](const unsigned feasible) -> bool {
const auto& feasiblePermutation = abstract.permutations.list.at(feasible);
return feasiblePermutation == trialMinRotation;
}
);
if(feasiblesIter == std::end(feasibles)) {
return boost::none;
}
/* Return the index within the list of feasibles (assignment), not the
* abstract stereopermutation index
*/
return feasiblesIter - std::begin(feasibles);
}
LocalSpatialModel::LocalSpatialModel(
const AtomIndex placement,
const RankingInformation& ranking,
const PrivateGraph& graph
) {
using ModelType = DistanceGeometry::SpatialModel;
siteDistances = Temple::map(
ranking.sites,
[&](const auto& siteAtomsList) -> DistanceGeometry::ValueBounds {
return ModelType::siteDistanceFromCenter(
siteAtomsList,
placement,
graph
);
}
);
coneAngles.reserve(ranking.sites.size());
for(unsigned i = 0; i < ranking.sites.size(); ++i) {
coneAngles.push_back(
ModelType::coneAngle(
ranking.sites.at(i),
siteDistances.at(i),
graph
)
);
}
}
} // namespace Stereopermutators
} // namespace Molassembler
} // namespace Scine
| 30.341954 | 104 | 0.688323 | [
"shape",
"vector",
"transform"
] |
3301b57ab908ff174d84f2beace5b7cbdcbb2434 | 2,484 | cpp | C++ | src/bvh.cpp | DestinationStellar/TrivalRayTracing | 881cc654685fae27b90195fd9b917e0ed7d1b4a2 | [
"MIT"
] | null | null | null | src/bvh.cpp | DestinationStellar/TrivalRayTracing | 881cc654685fae27b90195fd9b917e0ed7d1b4a2 | [
"MIT"
] | null | null | null | src/bvh.cpp | DestinationStellar/TrivalRayTracing | 881cc654685fae27b90195fd9b917e0ed7d1b4a2 | [
"MIT"
] | null | null | null | #include "bvh.hpp"
inline bool box_compare(const shared_ptr<Object3D> a, const shared_ptr<Object3D> b, int axis) {
AABB box_a;
AABB box_b;
if (!a->bounding_box(0,0, box_a) || !b->bounding_box(0,0, box_b))
std::cerr << "No bounding box in BVHnode constructor.\n";
return box_a.min()[axis] < box_b.min()[axis];
}
bool box_x_compare (const shared_ptr<Object3D> a, const shared_ptr<Object3D> b) {
return box_compare(a, b, 0);
}
bool box_y_compare (const shared_ptr<Object3D> a, const shared_ptr<Object3D> b) {
return box_compare(a, b, 1);
}
bool box_z_compare (const shared_ptr<Object3D> a, const shared_ptr<Object3D> b) {
return box_compare(a, b, 2);
}
BVHnode::BVHnode(
const std::vector<shared_ptr<Object3D>>& src_objects,
size_t start, size_t end, double time0, double time1
) {
auto objects = src_objects; // Create a modifiable array of the source scene objects
int axis = random_int(0,2);
auto comparator = (axis == 0) ? box_x_compare
: (axis == 1) ? box_y_compare
: box_z_compare;
size_t object_span = end - start;
if (object_span == 1) {
left = right = objects[start];
} else if (object_span == 2) {
if (comparator(objects[start], objects[start+1])) {
left = objects[start];
right = objects[start+1];
} else {
left = objects[start+1];
right = objects[start];
}
} else {
std::sort(objects.begin() + start, objects.begin() + end, comparator);
auto mid = start + object_span/2;
left = make_shared<BVHnode>(objects, start, mid, time0, time1);
right = make_shared<BVHnode>(objects, mid, end, time0, time1);
}
AABB box_left, box_right;
if ( !left->bounding_box (time0, time1, box_left)
|| !right->bounding_box(time0, time1, box_right)
)
std::cerr << "No bounding box in BVHnode constructor.\n";
box = AABB::surrounding_box(box_left, box_right);
}
bool BVHnode::intersect(const Ray& r, Hit& rec, float t_min, float t_max) const {
if (!box.intersect(r, t_min, t_max))
return false;
bool hit_left = left->intersect(r, rec, t_min, t_max);
bool hit_right = right->intersect(r, rec, t_min, hit_left ? rec.t : t_max);
return hit_left || hit_right;
}
bool BVHnode::bounding_box(double time0, double time1, AABB& output_box) const {
output_box = box;
return true;
}
| 29.571429 | 95 | 0.624396 | [
"vector"
] |
3308f608f7f6781ead2fe2e3f6854b8380ea06b9 | 11,734 | cpp | C++ | dali/internal/input/windows/input-method-context-impl-win.cpp | dalihub/dali-adaptor | b7943ae5aeb7ddd069be7496a1c1cee186b740c5 | [
"Apache-2.0",
"BSD-3-Clause"
] | 6 | 2016-11-18T10:26:46.000Z | 2021-11-01T12:29:05.000Z | dali/internal/input/windows/input-method-context-impl-win.cpp | dalihub/dali-adaptor | b7943ae5aeb7ddd069be7496a1c1cee186b740c5 | [
"Apache-2.0",
"BSD-3-Clause"
] | 5 | 2020-07-15T11:30:49.000Z | 2020-12-11T19:13:46.000Z | dali/internal/input/windows/input-method-context-impl-win.cpp | dalihub/dali-adaptor | b7943ae5aeb7ddd069be7496a1c1cee186b740c5 | [
"Apache-2.0",
"BSD-3-Clause"
] | 7 | 2019-05-17T07:14:40.000Z | 2021-05-24T07:25:26.000Z | /*
* Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
// CLASS HEADER
#include <dali/internal/input/windows/input-method-context-impl-win.h>
// EXTERNAL INCLUDES
#include <dali/devel-api/common/singleton-service.h>
#include <dali/integration-api/debug.h>
#include <dali/public-api/events/key-event.h>
#include <dali/public-api/object/type-registry.h>
// INTERNAL INCLUDES
#include <dali/integration-api/adaptor-framework/adaptor.h>
#include <dali/internal/adaptor/common/adaptor-impl.h>
#include <dali/internal/input/common/key-impl.h>
#include <dali/internal/input/common/virtual-keyboard-impl.h>
#include <dali/internal/system/common/locale-utils.h>
#include <dali/public-api/adaptor-framework/key.h>
namespace Dali
{
namespace Internal
{
namespace Adaptor
{
namespace
{
#if defined(DEBUG_ENABLED)
Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_INPUT_METHOD_CONTEXT");
#endif
} // namespace
InputMethodContextPtr InputMethodContextWin::New(Dali::Actor actor)
{
InputMethodContextPtr manager;
if(actor && Adaptor::IsAvailable())
{
manager = new InputMethodContextWin(actor);
}
return manager;
}
void InputMethodContextWin::Finalize()
{
}
InputMethodContextWin::InputMethodContextWin(Dali::Actor actor)
: mWin32Window(0),
mIMFCursorPosition(0),
mSurroundingText(),
mRestoreAfterFocusLost(false),
mIdleCallbackConnected(false)
{
actor.OnSceneSignal().Connect(this, &InputMethodContextWin::OnStaged);
}
InputMethodContextWin::~InputMethodContextWin()
{
Finalize();
}
void InputMethodContextWin::Initialize()
{
CreateContext(mWin32Window);
ConnectCallbacks();
}
void InputMethodContextWin::CreateContext(WinWindowHandle winHandle)
{
DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextWin::CreateContext\n");
}
void InputMethodContextWin::DeleteContext()
{
DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextWin::DeleteContext\n");
}
// Callbacks for predicitive text support.
void InputMethodContextWin::ConnectCallbacks()
{
}
void InputMethodContextWin::DisconnectCallbacks()
{
}
void InputMethodContextWin::Activate()
{
// Reset mIdleCallbackConnected
mIdleCallbackConnected = false;
}
void InputMethodContextWin::Deactivate()
{
mIdleCallbackConnected = false;
}
void InputMethodContextWin::Reset()
{
DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextWin::Reset\n");
}
ImfContext* InputMethodContextWin::GetContext()
{
DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextWin::GetContext\n");
return NULL;
}
bool InputMethodContextWin::RestoreAfterFocusLost() const
{
return mRestoreAfterFocusLost;
}
void InputMethodContextWin::SetRestoreAfterFocusLost(bool toggle)
{
mRestoreAfterFocusLost = toggle;
}
/**
* Called when an InputMethodContext Pre-Edit changed event is received.
* We are still predicting what the user is typing. The latest string is what the InputMethodContext module thinks
* the user wants to type.
*/
void InputMethodContextWin::PreEditChanged(void*, ImfContext* imfContext, void* eventInfo)
{
DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextWin::PreEditChanged\n");
}
void InputMethodContextWin::CommitReceived(void*, ImfContext* imfContext, void* eventInfo)
{
DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextWin::CommitReceived\n");
if(Dali::Adaptor::IsAvailable())
{
const std::string keyString(static_cast<char*>(eventInfo));
Dali::InputMethodContext handle(this);
Dali::InputMethodContext::EventData eventData(Dali::InputMethodContext::COMMIT, keyString, 0, 0);
Dali::InputMethodContext::CallbackData callbackData = mEventSignal.Emit(handle, eventData);
if(callbackData.update)
{
mIMFCursorPosition = static_cast<int>(callbackData.cursorPosition);
NotifyCursorPosition();
}
}
}
/**
* Called when an InputMethodContext retrieve surround event is received.
* Here the InputMethodContext module wishes to know the string we are working with and where within the string the cursor is
* We need to signal the application to tell us this information.
*/
bool InputMethodContextWin::RetrieveSurrounding(void* data, ImfContext* imfContext, char** text, int* cursorPosition)
{
DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextWin::RetrieveSurrounding\n");
Dali::InputMethodContext::EventData imfData(Dali::InputMethodContext::GET_SURROUNDING, std::string(), 0, 0);
Dali::InputMethodContext handle(this);
Dali::InputMethodContext::CallbackData callbackData = mEventSignal.Emit(handle, imfData);
if(callbackData.update)
{
if(text)
{
*text = strdup(callbackData.currentText.c_str());
}
if(cursorPosition)
{
mIMFCursorPosition = static_cast<int>(callbackData.cursorPosition);
*cursorPosition = mIMFCursorPosition;
}
}
return true;
}
/**
* Called when an InputMethodContext delete surrounding event is received.
* Here we tell the application that it should delete a certain range.
*/
void InputMethodContextWin::DeleteSurrounding(void* data, ImfContext* imfContext, void* eventInfo)
{
DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextWin::DeleteSurrounding\n");
}
void InputMethodContextWin::NotifyCursorPosition()
{
DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextWin::NotifyCursorPosition\n");
}
void InputMethodContextWin::SetCursorPosition(unsigned int cursorPosition)
{
DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextWin::SetCursorPosition\n");
mIMFCursorPosition = static_cast<int>(cursorPosition);
}
unsigned int InputMethodContextWin::GetCursorPosition() const
{
DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextWin::GetCursorPosition\n");
return static_cast<unsigned int>(mIMFCursorPosition);
}
void InputMethodContextWin::SetSurroundingText(const std::string& text)
{
DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextWin::SetSurroundingText\n");
mSurroundingText = text;
}
const std::string& InputMethodContextWin::GetSurroundingText() const
{
DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextWin::GetSurroundingText\n");
return mSurroundingText;
}
void InputMethodContextWin::NotifyTextInputMultiLine(bool multiLine)
{
}
Dali::InputMethodContext::TextDirection InputMethodContextWin::GetTextDirection()
{
Dali::InputMethodContext::TextDirection direction(Dali::InputMethodContext::LEFT_TO_RIGHT);
return direction;
}
Rect<int> InputMethodContextWin::GetInputMethodArea()
{
int xPos, yPos, width, height;
width = height = xPos = yPos = 0;
return Rect<int>(xPos, yPos, width, height);
}
void InputMethodContextWin::ApplyOptions(const InputMethodOptions& options)
{
using namespace Dali::InputMethod::Category;
int index;
if(mOptions.CompareAndSet(PANEL_LAYOUT, options, index))
{
}
if(mOptions.CompareAndSet(BUTTON_ACTION, options, index))
{
}
if(mOptions.CompareAndSet(AUTO_CAPITALIZE, options, index))
{
}
if(mOptions.CompareAndSet(VARIATION, options, index))
{
}
}
void InputMethodContextWin::SetInputPanelData(const std::string& data)
{
DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextWin::SetInputPanelData\n");
}
void InputMethodContextWin::GetInputPanelData(std::string& data)
{
DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextWin::GetInputPanelData\n");
}
Dali::InputMethodContext::State InputMethodContextWin::GetInputPanelState()
{
DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextWin::GetInputPanelState\n");
return Dali::InputMethodContext::DEFAULT;
}
void InputMethodContextWin::SetReturnKeyState(bool visible)
{
DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextWin::SetReturnKeyState\n");
}
void InputMethodContextWin::AutoEnableInputPanel(bool enabled)
{
DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextWin::AutoEnableInputPanel\n");
}
void InputMethodContextWin::ShowInputPanel()
{
DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextWin::ShowInputPanel\n");
}
void InputMethodContextWin::HideInputPanel()
{
DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextWin::HideInputPanel\n");
}
Dali::InputMethodContext::KeyboardType InputMethodContextWin::GetKeyboardType()
{
return Dali::InputMethodContext::KeyboardType::SOFTWARE_KEYBOARD;
}
std::string InputMethodContextWin::GetInputPanelLocale()
{
DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextWin::GetInputPanelLocale\n");
std::string locale = "";
return locale;
}
void InputMethodContextWin::SetContentMIMETypes(const std::string& mimeTypes)
{
DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextWin::SetContentMIMETypes\n");
}
bool InputMethodContextWin::FilterEventKey(const Dali::KeyEvent& keyEvent)
{
bool eventHandled(false);
if(!KeyLookup::IsDeviceButton(keyEvent.GetKeyName().c_str()))
{
//check whether it's key down or key up event
if(keyEvent.GetState() == Dali::KeyEvent::DOWN)
{
eventHandled = ProcessEventKeyDown(keyEvent);
}
else if(keyEvent.GetState() == Dali::KeyEvent::UP)
{
eventHandled = ProcessEventKeyUp(keyEvent);
}
}
return eventHandled;
}
void InputMethodContextWin::SetInputPanelLanguage(Dali::InputMethodContext::InputPanelLanguage language)
{
DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextWin::SetInputPanelLanguage\n");
}
Dali::InputMethodContext::InputPanelLanguage InputMethodContextWin::GetInputPanelLanguage() const
{
DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextWin::GetInputPanelLanguage\n");
return Dali::InputMethodContext::InputPanelLanguage::AUTOMATIC;
}
void InputMethodContextWin::SetInputPanelPosition(unsigned int x, unsigned int y)
{
DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextWin::SetInputPanelPosition\n");
}
void InputMethodContextWin::GetPreeditStyle(Dali::InputMethodContext::PreEditAttributeDataContainer& attrs) const
{
DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextWin::GetPreeditStyle\n");
attrs = mPreeditAttrs;
}
bool InputMethodContextWin::ProcessEventKeyDown(const Dali::KeyEvent& keyEvent)
{
bool eventHandled(false);
return eventHandled;
}
bool InputMethodContextWin::ProcessEventKeyUp(const Dali::KeyEvent& keyEvent)
{
bool eventHandled(false);
return eventHandled;
}
void InputMethodContextWin::OnStaged(Dali::Actor actor)
{
WinWindowHandle winWindow(AnyCast<WinWindowHandle>(Dali::Integration::SceneHolder::Get(actor).GetNativeHandle()));
if(mWin32Window != winWindow)
{
mWin32Window = winWindow;
// Reset
Finalize();
Initialize();
}
}
} // namespace Adaptor
} // namespace Internal
} // namespace Dali
| 28.830467 | 126 | 0.743395 | [
"object"
] |
330ac34bb22763683a58f9326636c78cd741e8c9 | 7,363 | hpp | C++ | libs/core/render/include/bksge/core/render/vulkan/detail/inl/command_buffer_inl.hpp | myoukaku/bksge | 0f8b60e475a3f1709723906e4796b5e60decf06e | [
"MIT"
] | 4 | 2018-06-10T13:35:32.000Z | 2021-06-03T14:27:41.000Z | libs/core/render/include/bksge/core/render/vulkan/detail/inl/command_buffer_inl.hpp | myoukaku/bksge | 0f8b60e475a3f1709723906e4796b5e60decf06e | [
"MIT"
] | 566 | 2017-01-31T05:36:09.000Z | 2022-02-09T05:04:37.000Z | libs/core/render/include/bksge/core/render/vulkan/detail/inl/command_buffer_inl.hpp | myoukaku/bksge | 0f8b60e475a3f1709723906e4796b5e60decf06e | [
"MIT"
] | 1 | 2018-07-05T04:40:53.000Z | 2018-07-05T04:40:53.000Z | /**
* @file command_buffer_inl.hpp
*
* @brief CommandBuffer クラスの実装
*
* @author myoukaku
*/
#ifndef BKSGE_CORE_RENDER_VULKAN_DETAIL_INL_COMMAND_BUFFER_INL_HPP
#define BKSGE_CORE_RENDER_VULKAN_DETAIL_INL_COMMAND_BUFFER_INL_HPP
#include <bksge/core/render/config.hpp>
#if BKSGE_CORE_RENDER_HAS_VULKAN_RENDERER
#include <bksge/core/render/vulkan/detail/command_buffer.hpp>
#include <bksge/core/render/vulkan/detail/command_pool.hpp>
#include <bksge/core/render/vulkan/detail/device.hpp>
#include <bksge/core/render/vulkan/detail/render_pass.hpp>
#include <bksge/core/render/vulkan/detail/frame_buffer.hpp>
#include <bksge/core/render/vulkan/detail/queue.hpp>
#include <bksge/core/render/vulkan/detail/vulkan.hpp>
#include <bksge/fnd/memory/make_unique.hpp>
#include <bksge/fnd/memory/unique_ptr.hpp>
#include <cstdint>
#include <vector>
namespace bksge
{
namespace render
{
namespace vulkan
{
BKSGE_INLINE
CommandBuffer::CommandBuffer(
vulkan::CommandPoolSharedPtr const& command_pool)
: m_command_buffer(VK_NULL_HANDLE)
, m_command_pool(command_pool)
, m_device(command_pool->device())
{
m_command_buffer =
m_command_pool->AllocateCommandBuffer(
VK_COMMAND_BUFFER_LEVEL_PRIMARY);
}
BKSGE_INLINE
CommandBuffer::~CommandBuffer()
{
m_command_pool->FreeCommandBuffer(m_command_buffer);
}
BKSGE_INLINE void
CommandBuffer::Begin(::VkCommandBufferUsageFlags flags)
{
vk::CommandBufferBeginInfo begin_info;
begin_info.flags = flags;
vk::BeginCommandBuffer(m_command_buffer, &begin_info);
}
BKSGE_INLINE void
CommandBuffer::End(void)
{
vk::EndCommandBuffer(m_command_buffer);
}
BKSGE_INLINE void
CommandBuffer::BindPipeline(
::VkPipelineBindPoint pipeline_bind_point,
::VkPipeline pipeline)
{
vk::CmdBindPipeline(
m_command_buffer,
pipeline_bind_point,
pipeline);
}
BKSGE_INLINE void
CommandBuffer::SetViewport(::VkViewport const& viewport)
{
vk::CmdSetViewport(m_command_buffer, 0, 1, &viewport);
}
BKSGE_INLINE void
CommandBuffer::SetScissor(::VkRect2D const& scissor_rect)
{
vk::CmdSetScissor(m_command_buffer, 0, 1, &scissor_rect);
}
BKSGE_INLINE void
CommandBuffer::BindIndexBuffer(
::VkBuffer buffer,
::VkDeviceSize offset,
::VkIndexType index_type)
{
vk::CmdBindIndexBuffer(m_command_buffer, buffer, offset, index_type);
}
BKSGE_INLINE void
CommandBuffer::BindVertexBuffers(
std::uint32_t first_binding,
std::uint32_t binding_count,
::VkBuffer const* buffers,
::VkDeviceSize const* offsets)
{
vk::CmdBindVertexBuffers(
m_command_buffer,
first_binding,
binding_count,
buffers,
offsets);
}
BKSGE_INLINE void
CommandBuffer::Draw(
std::uint32_t vertex_count,
std::uint32_t instance_count,
std::uint32_t first_vertex,
std::uint32_t first_instance)
{
vk::CmdDraw(
m_command_buffer,
vertex_count,
instance_count,
first_vertex,
first_instance);
}
BKSGE_INLINE void
CommandBuffer::DrawIndexed(
std::uint32_t index_count,
std::uint32_t instance_count,
std::uint32_t first_index,
std::int32_t vertex_offset,
std::uint32_t first_instance)
{
vk::CmdDrawIndexed(
m_command_buffer,
index_count,
instance_count,
first_index,
vertex_offset,
first_instance);
}
BKSGE_INLINE void
CommandBuffer::CopyBufferToImage(
::VkBuffer src_buffer,
::VkImage dst_image,
::VkImageLayout dst_image_layout,
std::uint32_t region_count,
::VkBufferImageCopy const* regions)
{
vk::CmdCopyBufferToImage(
m_command_buffer,
src_buffer,
dst_image,
dst_image_layout,
region_count,
regions);
}
BKSGE_INLINE void
CommandBuffer::ClearColorImage(
::VkImage image,
::VkImageLayout image_layout,
::VkClearColorValue const* color,
std::uint32_t range_count,
::VkImageSubresourceRange const* ranges)
{
vk::CmdClearColorImage(
m_command_buffer,
image,
image_layout,
color,
range_count,
ranges);
}
BKSGE_INLINE void
CommandBuffer::ClearDepthStencilImage(
::VkImage image,
::VkImageLayout image_layout,
::VkClearDepthStencilValue const* depth_stencil,
std::uint32_t range_count,
::VkImageSubresourceRange const* ranges)
{
vk::CmdClearDepthStencilImage(
m_command_buffer,
image,
image_layout,
depth_stencil,
range_count,
ranges);
}
BKSGE_INLINE void
CommandBuffer::PipelineBarrier(
::VkPipelineStageFlags src_stage_mask,
::VkPipelineStageFlags dst_stage_mask,
::VkDependencyFlags dependency_flags,
std::uint32_t memory_barrier_count,
::VkMemoryBarrier const* memory_barriers,
std::uint32_t buffer_memory_barrier_count,
::VkBufferMemoryBarrier const* buffer_memory_barriers,
std::uint32_t image_memory_barrier_count,
::VkImageMemoryBarrier const* image_memory_barriers)
{
vk::CmdPipelineBarrier(
m_command_buffer,
src_stage_mask,
dst_stage_mask,
dependency_flags,
memory_barrier_count,
memory_barriers,
buffer_memory_barrier_count,
buffer_memory_barriers,
image_memory_barrier_count,
image_memory_barriers);
}
BKSGE_INLINE void
CommandBuffer::BeginRenderPass(
vk::RenderPassBeginInfo const& render_pass_begin_info)
{
vk::CmdBeginRenderPass(
m_command_buffer,
&render_pass_begin_info,
VK_SUBPASS_CONTENTS_INLINE);
}
BKSGE_INLINE void
CommandBuffer::EndRenderPass(void)
{
vk::CmdEndRenderPass(m_command_buffer);
}
BKSGE_INLINE void
CommandBuffer::PushDescriptorSet(
::VkPipelineBindPoint pipeline_bind_point,
::VkPipelineLayout layout,
std::uint32_t set,
std::vector<::VkWriteDescriptorSet> const& descriptor_writes)
{
m_device->PushDescriptorSet(
m_command_buffer,
pipeline_bind_point,
layout,
set,
descriptor_writes);
}
BKSGE_INLINE vk::SubmitInfo
CommandBuffer::CreateSubmitInfo(void) const
{
vk::SubmitInfo submit_info;
submit_info.SetCommandBuffers(m_command_buffer);
return submit_info;
}
BKSGE_INLINE ::VkCommandBuffer const*
CommandBuffer::GetAddressOf(void) const
{
return &m_command_buffer;
}
BKSGE_INLINE
ScopedOneTimeCommandBuffer::ScopedOneTimeCommandBuffer(
vulkan::CommandPoolSharedPtr const& command_pool)
: m_command_buffer(bksge::make_unique<vulkan::CommandBuffer>(command_pool))
, m_graphics_queue(bksge::make_unique<vulkan::Queue>(command_pool->GetQueue()))
{
m_command_buffer->Begin(VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT);
}
BKSGE_INLINE
ScopedOneTimeCommandBuffer::~ScopedOneTimeCommandBuffer()
{
m_command_buffer->End();
vk::SubmitInfo submit_info = m_command_buffer->CreateSubmitInfo();
m_graphics_queue->Submit(submit_info, VK_NULL_HANDLE);
m_graphics_queue->WaitIdle();
}
BKSGE_INLINE vulkan::CommandBuffer*
ScopedOneTimeCommandBuffer::Get(void) const
{
return m_command_buffer.get();
}
} // namespace vulkan
} // namespace render
} // namespace bksge
#endif // BKSGE_CORE_RENDER_HAS_VULKAN_RENDERER
#endif // BKSGE_CORE_RENDER_VULKAN_DETAIL_INL_COMMAND_BUFFER_INL_HPP
| 24.220395 | 81 | 0.725927 | [
"render",
"vector"
] |
3312409dd3203145d68741d232a382f36b621593 | 6,855 | cpp | C++ | Source/UI/src/Button.cpp | appcelerator/titanium_mobile_windows | ec82c011f418cbcf27795eb009deaef5e3fe4b20 | [
"Apache-2.0"
] | 20 | 2015-04-02T06:55:30.000Z | 2022-03-29T04:27:30.000Z | Source/UI/src/Button.cpp | appcelerator/titanium_mobile_windows | ec82c011f418cbcf27795eb009deaef5e3fe4b20 | [
"Apache-2.0"
] | 692 | 2015-04-01T21:05:49.000Z | 2020-03-10T10:11:57.000Z | Source/UI/src/Button.cpp | appcelerator/titanium_mobile_windows | ec82c011f418cbcf27795eb009deaef5e3fe4b20 | [
"Apache-2.0"
] | 22 | 2015-04-01T20:57:51.000Z | 2022-01-18T17:33:15.000Z | /**
* Titanium.UI.Button for Windows
*
* Copyright (c) 2014 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License.
* Please see the LICENSE included with this distribution for details.
*/
#include "TitaniumWindows/UI/Button.hpp"
#include "TitaniumWindows/Utility.hpp"
#include "TitaniumWindows/UI/WindowsViewLayoutDelegate.hpp"
#include "TitaniumWindows/UI/TableViewRow.hpp"
#include "Titanium/UI/TableViewSection.hpp"
#include "Titanium/detail/TiImpl.hpp"
#include "TitaniumWindows/UI/Windows/ViewHelper.hpp"
namespace TitaniumWindows
{
namespace UI
{
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Input;
Button::Button(const JSContext& js_context) TITANIUM_NOEXCEPT
: Titanium::UI::Button(js_context)
{
TITANIUM_LOG_DEBUG("Button::ctor");
}
void Button::postCallAsConstructor(const JSContext& js_context, const std::vector<JSValue>& arguments)
{
Titanium::UI::Button::postCallAsConstructor(js_context, arguments);
Titanium::UI::Button::setLayoutDelegate<WindowsButtonLayoutDelegate>();
button__ = ref new Controls::Button();
button__->VerticalAlignment = VerticalAlignment::Stretch;
button__->HorizontalAlignment = HorizontalAlignment::Stretch;
loaded_event__ = button__->Loaded += ref new RoutedEventHandler([this](Platform::Object^ sender, RoutedEventArgs^ e) {
//
// Apply default style if there's no style set
//
if (button__->Resources == nullptr && button__->Style == nullptr) {
button__->FontSize = DefaultFontSize;
button__->BorderThickness = 0;
}
});
click_event__ = button__->Click += ref new RoutedEventHandler([this](Platform::Object^ sender, RoutedEventArgs^ e) {
const auto button = safe_cast<Controls::Button^>(sender);
// Set center of the button since Button::Click does not provide position info
Windows::Foundation::Point pos;
pos.X = static_cast<float>(button->ActualWidth * 0.5);
pos.Y = static_cast<float>(button->ActualHeight * 0.5);
const auto ctx = get_context();
JSObject eventArgs = ctx.CreateObject();
eventArgs.SetProperty("x", ctx.CreateNumber(pos.X));
eventArgs.SetProperty("y", ctx.CreateNumber(pos.Y));
eventArgs.SetProperty("source", get_object());
// If button is part of TableViewRow, it needs additional data
const auto bubbleEventData = getBubbleEventData();
const auto isTableViewRow = bubbleEventData.find("TableViewRow") != bubbleEventData.end();
if (isTableViewRow) {
const auto row = std::dynamic_pointer_cast<Titanium::UI::TableViewRow>(bubbleEventData.at("TableViewRow"));
if (row) {
eventArgs.SetProperty("row", row->get_object());
eventArgs.SetProperty("rowData", row->get_data());
const auto section = row->get_section();
if (section) {
eventArgs.SetProperty("section", section->get_object());
eventArgs.SetProperty("index", ctx.CreateNumber(section->getItemIndex(row)));
}
}
}
if (hasEventListener("click")) {
fireEvent("click", eventArgs);
}
// Bubble to parent here because Xaml Button blocks propagating events (Only for TableViewRow)
const auto parent = get_parent();
if (isTableViewRow && parent && get_bubbleParent()) {
parent->fireEvent("click", eventArgs);
}
});
// TIMOB-19143: reset MinWidth to fix size issues
button__->MinWidth = 0;
border__ = ref new Controls::Border();
border__->Child = button__;
getViewLayoutDelegate<WindowsButtonLayoutDelegate>()->setComponent(border__, button__, border__);
}
void Button::JSExportInitialize()
{
JSExport<Button>::SetClassVersion(1);
JSExport<Button>::SetParent(JSExport<Titanium::UI::Button>::Class());
}
void Button::set_color(const std::string& colorName) TITANIUM_NOEXCEPT
{
Titanium::UI::Button::set_color(colorName);
const auto color_obj = WindowsViewLayoutDelegate::ColorForName(colorName);
button__->Foreground = ref new Windows::UI::Xaml::Media::SolidColorBrush(color_obj);
}
void Button::set_image(const std::string& image) TITANIUM_NOEXCEPT
{
Titanium::UI::Button::set_image(image);
// Just call set_backgroundImage behind the scenes...and it should just work.
getViewLayoutDelegate<WindowsViewLayoutDelegate>()->set_backgroundImage(image);
}
void Button::set_imageAsBlob(const std::shared_ptr<Titanium::Blob>& image) TITANIUM_NOEXCEPT
{
Titanium::UI::Button::set_imageAsBlob(image);
if (image != nullptr) {
getViewLayoutDelegate<WindowsViewLayoutDelegate>()->set_backgroundImage(image);
}
}
void Button::set_font(const Titanium::UI::Font& font) TITANIUM_NOEXCEPT
{
Titanium::UI::Button::set_font(font);
TitaniumWindows::UI::ViewHelper::SetFont<Windows::UI::Xaml::Controls::Button^>(get_context(), button__, font);
}
void Button::set_textAlign(const Titanium::UI::TEXT_ALIGNMENT& textAlign) TITANIUM_NOEXCEPT
{
Titanium::UI::Button::set_textAlign(textAlign);
if (textAlign == Titanium::UI::TEXT_ALIGNMENT::CENTER) {
button__->HorizontalContentAlignment = HorizontalAlignment::Center;
} else if (textAlign == Titanium::UI::TEXT_ALIGNMENT::LEFT) {
button__->HorizontalContentAlignment = HorizontalAlignment::Left;
} else if (textAlign == Titanium::UI::TEXT_ALIGNMENT::RIGHT) {
button__->HorizontalContentAlignment = HorizontalAlignment::Right;
}
// TODO Windows supports stretch!
}
void Button::set_title(const std::string& title) TITANIUM_NOEXCEPT
{
Titanium::UI::Button::set_title(title);
button__->Content = TitaniumWindows::Utility::ConvertUTF8String(title);
}
void Button::set_verticalAlign(const Titanium::UI::TEXT_VERTICAL_ALIGNMENT& verticalAlign) TITANIUM_NOEXCEPT
{
Titanium::UI::Button::set_verticalAlign(verticalAlign);
if (verticalAlign == Titanium::UI::TEXT_VERTICAL_ALIGNMENT::BOTTOM) {
button__ ->VerticalContentAlignment = VerticalAlignment::Bottom;
} else if (verticalAlign == Titanium::UI::TEXT_VERTICAL_ALIGNMENT::CENTER) {
button__->VerticalContentAlignment = VerticalAlignment::Center;
} else if (verticalAlign == Titanium::UI::TEXT_VERTICAL_ALIGNMENT::TOP) {
button__->VerticalContentAlignment = VerticalAlignment::Top;
}
// TODO Windows supports stretch!
}
void Button::enableEvent(const std::string& event_name) TITANIUM_NOEXCEPT
{
//
// Disable some touch events because Xaml Button has a inconsistency on Pointer event handling.
//
getViewLayoutDelegate<WindowsViewLayoutDelegate>()->filterEvents({ "click", "touchstart", "touchend", "touchcancel" });
Titanium::UI::Button::enableEvent(event_name);
}
} // namespace UI
} // namespace TitaniumWindows
| 38.083333 | 123 | 0.710284 | [
"object",
"vector"
] |
06a2478d03324ec938e59d16194e996090b6c2c9 | 353 | cpp | C++ | yellow/week4/vector_part/main.cpp | vbondarevsky/c-plus-plus-white | 04c468a9fbc54a94be3ec14164af08e6eb226e22 | [
"MIT"
] | 1 | 2020-10-15T20:36:34.000Z | 2020-10-15T20:36:34.000Z | yellow/week4/vector_part/main.cpp | vbondarevsky/c-plus-plus-white | 04c468a9fbc54a94be3ec14164af08e6eb226e22 | [
"MIT"
] | null | null | null | yellow/week4/vector_part/main.cpp | vbondarevsky/c-plus-plus-white | 04c468a9fbc54a94be3ec14164af08e6eb226e22 | [
"MIT"
] | 4 | 2018-12-09T22:17:40.000Z | 2022-01-04T13:21:21.000Z | #include <iostream>
#include <string>
#include <vector>
using namespace std;
void PrintVectorPart(const vector<int> &numbers);
int main() {
PrintVectorPart({6, 1, 8, -5, 4});
cout << endl;
PrintVectorPart({-6, 1, 8, -5, 4}); // ничего не выведется
cout << endl;
PrintVectorPart({6, 1, 8, 5, 4});
cout << endl;
return 0;
} | 20.764706 | 63 | 0.603399 | [
"vector"
] |
06abd6a628dc9a450f03a9ce122e0d50f040ca06 | 4,865 | cpp | C++ | dali/internal/adaptor-framework/android/file-loader-impl-android.cpp | Coquinho/dali-adaptor | a8006aea66b316a5eb710e634db30f566acda144 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | dali/internal/adaptor-framework/android/file-loader-impl-android.cpp | Coquinho/dali-adaptor | a8006aea66b316a5eb710e634db30f566acda144 | [
"Apache-2.0",
"BSD-3-Clause"
] | 2 | 2020-10-19T13:45:40.000Z | 2020-12-10T20:21:03.000Z | dali/internal/adaptor-framework/android/file-loader-impl-android.cpp | expertisesolutions/dali-adaptor | 810bf4dea833ea7dfbd2a0c82193bc0b3b155011 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | /*
* Copyright (c) 2019 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// CLASS HEADER
#include <dali/internal/adaptor-framework/common/file-loader-impl.h>
// EXTERNAL INCLUDES
#include <cstdio>
#include <string>
#include <fstream>
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
#include <dali/integration-api/adaptor-framework/android/android-framework.h>
#include <dali/internal/adaptor/common/framework.h>
namespace Dali
{
namespace Internal
{
namespace Adaptor
{
int ReadFile(const std::string& filename, Dali::Vector<char>& memblock, Dali::FileLoader::FileType fileType)
{
std::streampos size;
return Dali::Internal::Adaptor::ReadFile( filename, size, memblock, fileType);
}
int ReadFile(const std::string& filename, Dali::Vector<uint8_t>& memblock, Dali::FileLoader::FileType fileType)
{
std::streampos size;
return Dali::Internal::Adaptor::ReadFile( filename, size, memblock, fileType);
}
inline bool hasPrefix(const std::string& prefix, const std::string& path)
{
return std::mismatch(prefix.begin(), prefix.end(), path.begin()).first == prefix.end();
}
inline std::string ConvertToAssetsInternalPath(const std::string& path, int offset)
{
std::string internalPath = std::string(path.c_str() + offset);
int i = 0;
while ((i = internalPath.find("//", i)) != std::string::npos)
{
internalPath.replace(i, 2, "/");
}
return internalPath;
}
template<typename T>
int ReadFile(const std::string& filename, std::streampos& fileSize, Dali::Vector<T>& memblock, Dali::FileLoader::FileType fileType)
{
int errorCode = 0;
int length = 0;
char mode[3] = { 'r', 0, 0 };
if( fileType == Dali::FileLoader::BINARY )
{
mode[1] = 'b';
}
else if( fileType != Dali::FileLoader::TEXT )
{
return errorCode;
}
const std::string assetsPrefix = "assets/";
if( hasPrefix( assetsPrefix, filename ) )
{
std::string internalPath = ConvertToAssetsInternalPath( filename, assetsPrefix.length() );
AAssetManager* assetManager = Dali::Integration::AndroidFramework::Get().GetApplicationAssets();
AAsset* asset = AAssetManager_open( assetManager, internalPath.c_str(), AASSET_MODE_BUFFER );
if( asset )
{
length = AAsset_getLength( asset );
memblock.Resize( length + 1 ); // 1 for extra zero at the end
char* buffer = reinterpret_cast<char*>(memblock.Begin());
errorCode = ( AAsset_read( asset, buffer, length ) != length ) ? 0 : 1;
fileSize = length;
AAsset_close( asset );
}
else
{
DALI_LOG_ERROR( "Asset not found %s\n", internalPath.c_str() );
}
}
else
{
FILE* file = fopen( filename.c_str(), mode );
if( file )
{
fseek( file, 0, SEEK_END );
length = ftell( file );
//Dali::Vector.Resize would lead to calling PushBack for each byte, waste of CPU resource
memblock.ResizeUninitialized( length + 1 );
//put last byte as 0, in case this is a text file without null-terminator
memblock[length] = 0;
char* buffer = reinterpret_cast<char*>(memblock.Begin());
fseek( file, 0, SEEK_SET );
errorCode = ( fread( buffer, 1, length, file ) != length ) ? 0 : 1;
fileSize = length;
fclose( file );
}
else
{
DALI_LOG_ERROR( "File not found %s\n", filename.c_str() );
}
}
return errorCode;
}
std::streampos GetFileSize(const std::string& filename)
{
std::streampos size = 0;
const std::string assetsPrefix = "assets/";
if( hasPrefix( assetsPrefix, filename ) )
{
std::string internalPath = ConvertToAssetsInternalPath( filename, assetsPrefix.length() );
AAssetManager* assetManager = Dali::Integration::AndroidFramework::Get().GetApplicationAssets();
AAsset* asset = AAssetManager_open( assetManager, internalPath.c_str(), AASSET_MODE_BUFFER );
if( asset )
{
size = AAsset_getLength( asset );
AAsset_close( asset );
}
else
{
DALI_LOG_ERROR( "Asset not found %s\n", internalPath.c_str() );
}
}
else
{
FILE* file = fopen( filename.c_str(), "r" );
if( file )
{
fseek( file, 0, SEEK_END );
size = ftell( file );
fclose( file );
}
else
{
DALI_LOG_ERROR( "File not found %s\n", filename.c_str() );
}
}
return size;
}
} // Adaptor
} // Internal
} // Dali
| 27.027778 | 131 | 0.663104 | [
"vector"
] |
06b07c5689858fc707eb1a3e76a1212f1008ace3 | 5,222 | cc | C++ | tiledb/sm/metadata/test/unit_metadata.cc | MullionGroup/TileDB | 3fb8a60ded95f2a05ed91acca000fce5a8ab391a | [
"MIT"
] | null | null | null | tiledb/sm/metadata/test/unit_metadata.cc | MullionGroup/TileDB | 3fb8a60ded95f2a05ed91acca000fce5a8ab391a | [
"MIT"
] | null | null | null | tiledb/sm/metadata/test/unit_metadata.cc | MullionGroup/TileDB | 3fb8a60ded95f2a05ed91acca000fce5a8ab391a | [
"MIT"
] | null | null | null | /**
* @file tiledb/sm/metadata/test/unit_metadata.cc
*
* @section LICENSE
*
* The MIT License
*
* @copyright Copyright (c) 2022 TileDB, Inc.
*
* 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.
*
* @section DESCRIPTION
*
* This file defines a test `main()`
*/
#include <catch.hpp>
#include "../metadata.h"
#include "tiledb/common/common.h"
#include "tiledb/common/dynamic_memory/dynamic_memory.h"
#include "tiledb/sm/buffer/buffer.h"
#include "tiledb/sm/enums/datatype.h"
#include "tiledb/sm/filesystem/uri.h"
#include "tiledb/sm/misc/time.h"
#include "tiledb/sm/misc/uuid.h"
using namespace tiledb;
using namespace tiledb::common;
using namespace tiledb::sm;
template <class T, int n>
inline T& buffer_metadata(void* p) {
return *static_cast<T*>(static_cast<void*>(static_cast<char*>(p) + n));
}
TEST_CASE(
"Metadata: Test metadata deserialization", "[metadata][deserialization]") {
std::vector<tdb_shared_ptr<Buffer>> metadata_buffs;
// key_1:a, value_1:100,200
std::string key_1 = "key1";
auto key_1_size = static_cast<uint32_t>(key_1.size());
std::vector<int> value_1_vector{100, 200};
// key_2:key_2, value_2:1.1(double)
std::string key_2 = "key2";
uint32_t key_2_size = static_cast<uint32_t>(key_2.size());
uint32_t value_2_size = 1;
double value_2 = 1.0;
// key_3:key_3, value_3:strmetadata
std::string key_3 = "key3";
uint32_t key_3_size = static_cast<uint32_t>(key_2.size());
std::string value_3 = "strmetadata";
uint32_t value_3_size = static_cast<uint32_t>(value_3.size());
char serialized_buffer_1[22];
char* p_1 = &serialized_buffer_1[0];
// set key_1:value_1 integer metadata
buffer_metadata<uint32_t, 0>(p_1) = static_cast<uint32_t>(key_1.size());
std::memcpy(&buffer_metadata<char, 4>(p_1), key_1.c_str(), key_1_size);
buffer_metadata<char, 8>(p_1) = 0;
buffer_metadata<char, 9>(p_1) = static_cast<char>(Datatype::INT32);
buffer_metadata<uint32_t, 10>(p_1) = (uint32_t)value_1_vector.size();
buffer_metadata<int32_t, 14>(p_1) = value_1_vector[0];
buffer_metadata<int32_t, 18>(p_1) = value_1_vector[1];
metadata_buffs.push_back(make_shared<Buffer>(
HERE(), &serialized_buffer_1, sizeof(serialized_buffer_1)));
char serialized_buffer_2[22];
char* p_2 = &serialized_buffer_2[0];
// set key_2:value_2 double metadata
buffer_metadata<uint32_t, 0>(p_2) = static_cast<uint32_t>(key_2.size());
std::memcpy(&buffer_metadata<char, 4>(p_2), key_2.c_str(), key_2_size);
buffer_metadata<char, 8>(p_2) = 0;
buffer_metadata<char, 9>(p_2) = (char)Datatype::FLOAT64;
buffer_metadata<uint32_t, 10>(p_2) = value_2_size;
buffer_metadata<double, 14>(p_2) = value_2;
metadata_buffs.push_back(make_shared<Buffer>(
HERE(), &serialized_buffer_2, sizeof(serialized_buffer_2)));
char serialized_buffer_3[25];
char* p_3 = &serialized_buffer_3[0];
// set key_3:value_3 string metadata
buffer_metadata<uint32_t, 0>(p_3) = static_cast<uint32_t>(key_3.size());
std::memcpy(&buffer_metadata<char, 4>(p_3), key_3.c_str(), key_3_size);
buffer_metadata<char, 8>(p_3) = 0;
buffer_metadata<char, 9>(p_3) = (char)Datatype::STRING_ASCII;
buffer_metadata<uint32_t, 10>(p_3) = value_3_size;
std::memcpy(&buffer_metadata<char, 14>(p_3), value_3.c_str(), value_3_size);
metadata_buffs.push_back(make_shared<Buffer>(
HERE(), &serialized_buffer_3, sizeof(serialized_buffer_3)));
auto&& [st_meta, meta]{Metadata::deserialize(metadata_buffs)};
REQUIRE(st_meta.ok());
Datatype type;
uint32_t v_num;
// Read key_1 metadata
const int32_t* v_1;
meta.value()->get("key1", &type, &v_num, (const void**)(&v_1));
CHECK(type == Datatype::INT32);
CHECK(v_num == (uint32_t)(value_1_vector.size()));
CHECK(*(v_1) == 100);
CHECK(*(v_1 + 1) == 200);
// Read key_2 metadata
const double* v_2;
meta.value()->get("key2", &type, &v_num, (const void**)(&v_2));
CHECK(type == Datatype::FLOAT64);
CHECK(v_num == value_2_size);
CHECK(*(v_2) == value_2);
// Read key_3 metadata
const char* v_3;
meta.value()->get("key3", &type, &v_num, (const void**)(&v_3));
CHECK(type == Datatype::STRING_ASCII);
CHECK(v_num == value_3_size);
CHECK(std::string(v_3) == value_3);
} | 37.84058 | 80 | 0.716392 | [
"vector"
] |
06b0c3b9692122e65265127ff8f606bc7498e9b2 | 3,115 | cpp | C++ | source/de/hackcraft/world/sub/camera/rCamera.cpp | DMJC/linwarrior | 50cd46660c11e58cc6fbc431a150cf55ce0dd682 | [
"Apache-2.0"
] | 23 | 2015-12-08T19:29:10.000Z | 2021-09-22T04:13:31.000Z | source/de/hackcraft/world/sub/camera/rCamera.cpp | DMJC/linwarrior | 50cd46660c11e58cc6fbc431a150cf55ce0dd682 | [
"Apache-2.0"
] | 7 | 2018-04-30T13:05:57.000Z | 2021-08-25T03:58:07.000Z | source/de/hackcraft/world/sub/camera/rCamera.cpp | DMJC/linwarrior | 50cd46660c11e58cc6fbc431a150cf55ce0dd682 | [
"Apache-2.0"
] | 4 | 2018-01-25T03:05:19.000Z | 2021-08-25T03:30:15.000Z | #include "rCamera.h"
#include "de/hackcraft/psi3d/GLS.h"
#include "de/hackcraft/opengl/GL.h"
std::string rCamera::cname = "CAMERA";
unsigned int rCamera::cid = 3311;
rCamera::rCamera(Entity * obj) : cameraswitch(0), camerashake(0), firstperson(true), camerastate(1) {
object = obj;
quat_zero(ori1);
vector_zero(pos1);
quat_zero(ori0);
vector_zero(pos0);
}
void rCamera::camera() {
float cam[16];
float rot_inv[16];
float pos_inv[16];
float intensity = 0.0 + pow(camerashake, 1.5f);
float shake = 0.004f * intensity;
float jerk = 0.95f * intensity;
GL::glPushMatrix();
{
// Get inverse components of head pos and ori.
GL::glLoadIdentity();
GL::glTranslatef(pos0[0], pos0[1], pos0[2]);
GLS::glRotateq(ori0);
GL::glTranslatef(pos1[0], pos1[1], pos1[2]);
GLS::glRotateq(ori1);
// FIXME: Camera forward is inverted, therefore rotate.
GL::glRotatef(180, 0, 1, 0);
GLS::glGetTransposeInverseRotationMatrix(rot_inv);
GLS::glGetInverseTranslationMatrix(pos_inv);
// Compose Camera Matrix from inverse components
GL::glLoadIdentity();
GL::glMultMatrixf(rot_inv);
GL::glRotatef(grand() * jerk, 1, 0, 0);
GL::glRotatef(grand() * jerk, 0, 1, 0);
GL::glRotatef(grand() * jerk, 0, 0, 1);
GL::glMultMatrixf(pos_inv);
GL::glTranslatef(grand() * shake, grand() * shake, grand() * shake);
GL::glGetFloatv(GL_MODELVIEW_MATRIX, cam);
//matrix_print(cam);
}
GL::glPopMatrix();
int cs = abs(camerastate);
if (cs == 1) { // 1st
GL::glMultMatrixf(cam);
} else if (cs == 2) { // 3rd
GL::glTranslatef(0, 0, -5);
GL::glRotatef(15, 1, 0, 0);
GL::glMultMatrixf(cam);
} else if (cs == 3) { // 3rd Far
GL::glTranslatef(0, 0, -15);
GL::glRotatef(15, 1, 0, 0);
GL::glMultMatrixf(cam);
} else if (cs == 4) { // Reverse 3rd Far
GL::glTranslatef(0, 0, -15);
GL::glRotatef(15, 1, 0, 0);
GL::glRotatef(180, 0, 1, 0);
GL::glMultMatrixf(cam);
} else if (cs == 5) { // Map Near
GL::glTranslatef(0, 0, -50);
GL::glRotatef(90, 1, 0, 0);
GL::glMultMatrixf(pos_inv);
} else if (cs == 6) { // Map Far
GL::glTranslatef(0, 0, -100);
GL::glRotatef(90, 1, 0, 0);
GL::glMultMatrixf(pos_inv);
} // if camerastate
}
void rCamera::animate(float spf) {
const int MAX_CAMERAMODES = 6;
if (cameraswitch) {
// Only if Camera State is not transitional
// then switch to next perspective on button press.
if (camerastate > 0) {
camerastate = (1 + (camerastate % MAX_CAMERAMODES));
camerastate *= -1; // Set transitional.
}
} else {
// Set Camera State as fixed.
camerastate = abs(camerastate);
}
firstperson = (abs(camerastate) == 1);
}
float rCamera::grand() {
float r = ((rand()%100 + rand()%100 + rand()%100 + rand()%100 + rand()%100) * 0.01f * 0.2f - 0.5f);
return r;
}
| 30.242718 | 103 | 0.565329 | [
"object"
] |
06b153521c7424a990f6144777398cb4e5d77b44 | 4,234 | hpp | C++ | npy/SequenceNPY.hpp | hanswenzel/opticks | b75b5929b6cf36a5eedeffb3031af2920f75f9f0 | [
"Apache-2.0"
] | 11 | 2020-07-05T02:39:32.000Z | 2022-03-20T18:52:44.000Z | npy/SequenceNPY.hpp | hanswenzel/opticks | b75b5929b6cf36a5eedeffb3031af2920f75f9f0 | [
"Apache-2.0"
] | null | null | null | npy/SequenceNPY.hpp | hanswenzel/opticks | b75b5929b6cf36a5eedeffb3031af2920f75f9f0 | [
"Apache-2.0"
] | 4 | 2020-09-03T20:36:32.000Z | 2022-01-19T07:42:21.000Z | /*
* Copyright (c) 2019 Opticks Team. All Rights Reserved.
*
* This file is part of Opticks
* (see https://bitbucket.org/simoncblyth/opticks).
*
* 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.
*/
#pragma once
#include "NGLM.hpp"
#include <map>
#include <string>
#include <vector>
#include "Types.hpp"
#include "Counts.hpp"
template <typename T> class NPY ;
class RecordsNPY ;
class Index ;
//
// precise agreement between Photon and Record histories
// demands setting a bounce max less that maxrec
// in order to avoid any truncated and top record slot overwrites
//
// eg for maxrec 10 bounce max of 9 (option -b9)
// succeeds to give perfect agreement
//
#include "NPY_API_EXPORT.hh"
class NPY_API SequenceNPY {
public:
enum {
e_seqhis ,
e_seqmat
};
public:
SequenceNPY(NPY<float>* photons);
public:
void setTypes(Types* types);
void setRecs(RecordsNPY* recs);
public:
NPY<float>* getPhotons();
RecordsNPY* getRecs();
Types* getTypes();
public:
Index* makeHexIndex(const char* itemtype);
public:
void indexSequences(unsigned int maxidx=32);
public:
void dumpUniqueHistories();
void countMaterials();
public:
void setSeqIdx(NPY<unsigned char>* seqidx);
NPY<unsigned char>* getSeqIdx();
Index* getSeqHis();
Index* getSeqHisHex();
Index* getSeqMat();
public:
NPY<unsigned long long>* getSeqHisNpy();
private:
static bool second_value_order(const std::pair<int,int>&a, const std::pair<int,int>&b);
static bool su_second_value_order(const std::pair<std::string,unsigned int>&a, const std::pair<std::string,unsigned int>&b);
private:
NPY<unsigned long long>* makeSequenceCountsArray(
Types::Item_t etype,
std::vector< std::pair<std::string, unsigned int> >& vp
);
Index* makeSequenceCountsIndex(
Types::Item_t etype,
std::vector< std::pair<std::string, unsigned int> >& vp,
unsigned long maxidx=32,
bool hex=false
);
void fillSequenceIndex(
unsigned int k,
Index* idx,
std::map<std::string, std::vector<unsigned int> >& sv
);
void dumpMaskCounts(
const char* msg,
Types::Item_t etype,
std::map<unsigned int, unsigned int>& uu,
unsigned int cutoff
);
void dumpSequenceCounts(
const char* msg,
Types::Item_t etype,
std::map<std::string, unsigned int>& su,
std::map<std::string, std::vector<unsigned int> >& sv,
unsigned int cutoff
);
private:
NPY<float>* m_photons ;
RecordsNPY* m_recs ;
Types* m_types ;
NPY<unsigned char>* m_seqidx ;
unsigned int m_maxrec ;
private:
Index* m_seqhis ;
Index* m_seqhis_hex ;
NPY<unsigned long long>* m_seqhis_npy ;
private:
Index* m_seqmat ;
private:
Counts<unsigned int> m_material_counts ;
Counts<unsigned int> m_history_counts ;
};
| 31.132353 | 131 | 0.541568 | [
"vector"
] |
06b15f0c84ca63a340dce9b258cce94224af1e25 | 7,091 | cpp | C++ | Source/Cubiquity/Private/CubiquityVolume.cpp | volumesoffun/cubiquity-for-unreal-engine | 23b56c300c9507770c37c27c5c9efe4f3b7b08c0 | [
"MIT"
] | 101 | 2015-03-01T23:30:49.000Z | 2021-09-23T20:43:47.000Z | Source/Cubiquity/Private/CubiquityVolume.cpp | JulianoCristian/cubiquity-for-unreal-engine | 23b56c300c9507770c37c27c5c9efe4f3b7b08c0 | [
"MIT"
] | 3 | 2015-08-16T22:42:24.000Z | 2018-10-25T20:10:32.000Z | Source/Cubiquity/Private/CubiquityVolume.cpp | JulianoCristian/cubiquity-for-unreal-engine | 23b56c300c9507770c37c27c5c9efe4f3b7b08c0 | [
"MIT"
] | 44 | 2015-03-12T14:51:30.000Z | 2021-09-23T20:44:06.000Z | // Copyright 2014 Volumes of Fun. All Rights Reserved.
#include "CubiquityPluginPrivatePCH.h"
#include "CubiquityVolume.h"
#include "CubiquityOctreeNode.h"
#include "CubiquityMeshComponent.h"
#include "CubiquityUpdateComponent.h"
ACubiquityVolume::ACubiquityVolume(const FObjectInitializer& PCIP)
: Super(PCIP)
{
UE_LOG(CubiquityLog, Log, TEXT("Creating ACubiquityVolume"));
root = PCIP.CreateDefaultSubobject<UCubiquityUpdateComponent>(this, TEXT("Updater node"));
RootComponent = root;
//AddOwnedComponent(root);
PrimaryActorTick.bCanEverTick = true;
//PrimaryActorTick.bStartWithTickEnabled = true;
//PrimaryActorTick.TickGroup = TG_PrePhysics;
}
void ACubiquityVolume::PostActorCreated()
{
loadVolume();
const auto eyePosition = eyePositionInVolumeSpace();
//while (!volume()->update({ eyePosition.X, eyePosition.Y, eyePosition.Z }, 0.0)) { /*Keep calling update until it returns true*/ }
volume()->update({ eyePosition.X, eyePosition.Y, eyePosition.Z }, lodThreshold);
createOctree();
Super::PostActorCreated();
}
void ACubiquityVolume::PostLoad()
{
//In here, we are loading an existing volume. We should initialise all the Cubiquity stuff by loading the filename from the UProperty
//It seems too early to spawn actors as the World doesn't exist yet.
//Actors in the tree will have been serialised anyway so should be loaded.
loadVolume();
const auto eyePosition = eyePositionInVolumeSpace();
//while (!volume()->update({ eyePosition.X, eyePosition.Y, eyePosition.Z }, 0.0)) { /*Keep calling update until it returns true*/ }
volume()->update({ eyePosition.X, eyePosition.Y, eyePosition.Z }, lodThreshold);
Super::PostLoad();
}
void ACubiquityVolume::OnConstruction(const FTransform& transform)
{
UE_LOG(CubiquityLog, Log, TEXT("ACubiquityVolume::OnConstruction"));
if (RootComponent->GetNumChildrenComponents() == 0) //If we haven't created the octree yet
{
createOctree();
}
updateMaterial();
Super::OnConstruction(transform);
}
void ACubiquityVolume::PostInitializeComponents()
{
UE_LOG(CubiquityLog, Log, TEXT("ACubiquityVolume::PostInitializeComponents"));
Super::PostInitializeComponents();
}
void ACubiquityVolume::BeginPlay()
{
UE_LOG(CubiquityLog, Log, TEXT("ACubiquityVolume::BeginPlay"));
createOctree();
Super::BeginPlay();
}
/*void Serialize(FArchive& Ar)
{
}*/
void ACubiquityVolume::Destroyed()
{
UE_LOG(CubiquityLog, Log, TEXT("ACubiquityVolume::Destroyed"));
TArray<AActor*> children = Children; //Make a copy to avoid overruns
//UE_LOG(CubiquityLog, Log, TEXT(" Children %d"), children.Num());
for (AActor* childActor : children) //Should only be 1 child of this Actor
{
//UE_LOG(CubiquityLog, Log, TEXT(" Destroying childActor"));
if (childActor && !childActor->IsPendingKillPending())
{
GetWorld()->DestroyActor(childActor);
}
}
Super::Destroyed();
}
void ACubiquityVolume::processOctree()
{
const auto eyePosition = eyePositionInVolumeSpace();
volume()->update({ eyePosition.X, eyePosition.Y, eyePosition.Z }, lodThreshold);
if (octreeRootNodeActor)
{
octreeRootNodeActor->processOctreeNode(volume()->rootOctreeNode(), 1);
}
}
#if WITH_EDITOR
void ACubiquityVolume::PostEditChangeProperty(FPropertyChangedEvent & PropertyChangedEvent)
{
Super::PostEditChangeProperty(PropertyChangedEvent);
const FName PropertyName = PropertyChangedEvent.Property ? PropertyChangedEvent.Property->GetFName() : NAME_None;
if (PropertyName == FName(TEXT("volumeFileName")))
{
//Should we save the old volume? Probably not without asking.
//Unload old volume
//Load new one
TArray<AActor*> children = Children; //Make a copy to avoid overruns
for (AActor* childActor : children) //Should only be 1 child of this Actor
{
if (childActor && !childActor->IsPendingKillPending())
{
GetWorld()->DestroyActor(childActor);
}
}
loadVolume();
createOctree();
updateMaterial(); //TODO needed?
}
else if (PropertyName == FName(TEXT("Material")))
{
updateMaterial();
}
}
#endif
void ACubiquityVolume::createOctree()
{
UE_LOG(CubiquityLog, Log, TEXT("ACubiquityColoredCubesVolume::loadVolume"));
if (volume()->hasRootOctreeNode())
{
auto rootOctreeNode = volume()->rootOctreeNode();
const FVector childNodeVolumePosition = FVector(rootOctreeNode.position().x, rootOctreeNode.position().y, rootOctreeNode.position().z);
FActorSpawnParameters spawnParameters;
spawnParameters.Owner = this;
octreeRootNodeActor = GetWorld()->SpawnActor<ACubiquityOctreeNode>(childNodeVolumePosition, FRotator::ZeroRotator, spawnParameters);
octreeRootNodeActor->initialiseOctreeNode(rootOctreeNode, Material);
//octreeRootNodeActor->processOctreeNode(rootOctreeNode, 1);
}
}
void ACubiquityVolume::updateMaterial()
{
TArray<USceneComponent*> children;
root->GetChildrenComponents(true, children); //Get all children and grandchildren...
for (USceneComponent* childNode : children)
{
UCubiquityMeshComponent* mesh = Cast<UCubiquityMeshComponent>(childNode);
if (mesh)
{
mesh->SetMaterial(0, Material);
}
}
}
void ACubiquityVolume::commitChanges()
{
if (volume())
{
volume()->acceptOverrideChunks();
}
}
void ACubiquityVolume::discardChanges()
{
if (volume())
{
volume()->discardOverrideChunks();
}
}
FVector ACubiquityVolume::worldPositionToVolumePosition(const FVector& worldPosition) const
{
return ActorToWorld().InverseTransformPosition(worldPosition);
//GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("World: %f %f %f, Mesh: %f %f %f, Voxel: %d %d %d"), worldPosition.X, worldPosition.Y, worldPosition.Z, meshSpacePosition.X, meshSpacePosition.Y, meshSpacePosition.Z, int32_t(meshSpacePosition.X), int32_t(meshSpacePosition.Y), int32_t(meshSpacePosition.Z)));
//return{ int32_t(meshSpacePosition.X), int32_t(meshSpacePosition.Y), int32_t(meshSpacePosition.Z) };
}
FVector ACubiquityVolume::volumePositionToWorldPosition(const FVector& localPosition) const
{
return ActorToWorld().TransformPosition(localPosition);
}
FVector ACubiquityVolume::worldDirectionToVolumeDirection(const FVector& worldDirection) const
{
return ActorToWorld().InverseTransformVectorNoScale(worldDirection);
}
FVector ACubiquityVolume::volumeDirectionToWorldDirection(const FVector& localDirection) const
{
return ActorToWorld().TransformVectorNoScale(localDirection);
}
FVector ACubiquityVolume::eyePositionInVolumeSpace() const
{
UWorld* const World = GetWorld();
if (World)
{
//UE_LOG(CubiquityLog, Log, TEXT("Found world"));
auto playerController = World->GetFirstPlayerController();
if (playerController)
{
//UE_LOG(CubiquityLog, Log, TEXT("Found PC"));
FVector location;
FRotator rotation;
playerController->GetPlayerViewPoint(location, rotation);
//UE_LOG(CubiquityLog, Log, TEXT("Location: %f %f %f"), location.X, location.Y, location.Z);
//UE_LOG(CubiquityLog, Log, TEXT("Location: %f %f %f"), worldToVolume(location).X, worldToVolume(location).Y, worldToVolume(location).Z);
return worldPositionToVolumePosition(location);
}
}
return {0.0, 0.0, 0.0};
}
| 28.825203 | 339 | 0.750952 | [
"mesh",
"transform"
] |
06c0a4f59dee13e1c416b484dabe7c1acb2ba2c5 | 12,796 | cpp | C++ | src/renderer/direct12/mxrenderer.cpp | Mewatools/mewa | a429f25ddc2fc92926c08adf81f7ead7222cb239 | [
"MIT"
] | 5 | 2021-04-21T20:38:30.000Z | 2022-03-20T06:55:30.000Z | src/renderer/direct12/mxrenderer.cpp | Mewatools/mewa | a429f25ddc2fc92926c08adf81f7ead7222cb239 | [
"MIT"
] | 3 | 2021-12-27T01:20:22.000Z | 2022-02-25T15:24:41.000Z | src/renderer/direct12/mxrenderer.cpp | Mewatools/mewa | a429f25ddc2fc92926c08adf81f7ead7222cb239 | [
"MIT"
] | 3 | 2021-04-22T23:27:21.000Z | 2022-01-09T12:45:33.000Z | /****************************************************************************
** Copyright (C) 2020-2021 Mewatools <hugo@mewatools.com>
** SPDX-License-Identifier: MIT License
****************************************************************************/
#include "mxrenderer.h"
#include "mxgpuprogram.h"
#include "mxdebug.h"
#include <d3d12.h>
// \TODO remove std dependencies
#include <vector>
#include <string>
#include <stdlib.h>
MxRenderer::MxRenderer()
{
pEnableSRGB = false;
pFirstTime = true;
pPipelineChanged = true;
pCurrProgram = NULL;
pRootSignatureChanged = true;
pCurrInputTextureFlags = 0;
pBoundTextureCount = 0;
pDevice = nullptr;
pDxgiFactory = nullptr;
pCmdAllocator = nullptr;
pCmdList = nullptr;
pCmdQueue = nullptr;
pSwapchain = nullptr;
pRtvHeaps = nullptr;
pErrorBlob = nullptr;
pPipeline = {};
pPipeline.pRootSignature = nullptr;
pRootSignature = nullptr;
pPipelinestate = nullptr;
}
MxRenderer::~MxRenderer()
{}
void MxRenderer::initialize()
{
}
void MxRenderer::init(HWND hwnd, unsigned int windowWidth, unsigned int windowHeight )
{
Q_ASSERT( NULL == pDevice );
D3D_FEATURE_LEVEL levels[] = {
D3D_FEATURE_LEVEL_12_1,
D3D_FEATURE_LEVEL_12_0,
D3D_FEATURE_LEVEL_11_1,
D3D_FEATURE_LEVEL_11_0,
};
HRESULT result = CreateDXGIFactory1(IID_PPV_ARGS(&pDxgiFactory));
// \TODO avoid heap alloc and use a stack array (MxStack)
std::vector <IDXGIAdapter*> adapters;
IDXGIAdapter* tmpAdapter = nullptr;
for (int i = 0; pDxgiFactory->EnumAdapters(i, &tmpAdapter) != DXGI_ERROR_NOT_FOUND; ++i) {
adapters.push_back(tmpAdapter);
}
for (auto adpt : adapters) {
DXGI_ADAPTER_DESC adesc = {};
adpt->GetDesc(&adesc);
std::wstring strDesc = adesc.Description;
if (strDesc.find(L"NVIDIA") != std::string::npos) {
tmpAdapter = adpt;
break;
}
}
D3D_FEATURE_LEVEL featureLevel;
for (auto l : levels) {
if (D3D12CreateDevice(tmpAdapter, l, IID_PPV_ARGS(&pDevice)) == S_OK) {
featureLevel = l;
break;
}
}
result = pDevice->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&pCmdAllocator));
result = pDevice->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, pCmdAllocator, nullptr, IID_PPV_ARGS(&pCmdList));
D3D12_COMMAND_QUEUE_DESC cmdQueueDesc = {};
cmdQueueDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE;
cmdQueueDesc.NodeMask = 0;
cmdQueueDesc.Priority = D3D12_COMMAND_QUEUE_PRIORITY_NORMAL;
cmdQueueDesc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT;
result = pDevice->CreateCommandQueue(&cmdQueueDesc, IID_PPV_ARGS(&pCmdQueue));
DXGI_SWAP_CHAIN_DESC1 swapchainDesc = {};
swapchainDesc.Width = windowWidth;
swapchainDesc.Height = windowHeight;
swapchainDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
swapchainDesc.Stereo = false;
swapchainDesc.SampleDesc.Count = 1;
swapchainDesc.SampleDesc.Quality = 0;
swapchainDesc.BufferUsage = DXGI_USAGE_BACK_BUFFER;
swapchainDesc.BufferCount = 2;
swapchainDesc.Scaling = DXGI_SCALING_NONE;
swapchainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
swapchainDesc.AlphaMode = DXGI_ALPHA_MODE_UNSPECIFIED;
swapchainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
result = pDxgiFactory->CreateSwapChainForHwnd(pCmdQueue,
hwnd,
&swapchainDesc,
nullptr,
nullptr,
(IDXGISwapChain1**)&pSwapchain);
D3D12_DESCRIPTOR_HEAP_DESC heapDesc = {};
heapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_RTV;
heapDesc.NodeMask = 0;
heapDesc.NumDescriptors = 2;
heapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE;
//ID3D12DescriptorHeap* rtvHeaps = nullptr;
result = pDevice->CreateDescriptorHeap(&heapDesc, IID_PPV_ARGS(&pRtvHeaps));
DXGI_SWAP_CHAIN_DESC swcDesc = {};
result = pSwapchain->GetDesc(&swcDesc);
//std::vector<ID3D12Resource*> _backBuffers(swcDesc.BufferCount);
Q_ASSERT(swcDesc.BufferCount == 2);
D3D12_CPU_DESCRIPTOR_HANDLE handle = pRtvHeaps->GetCPUDescriptorHandleForHeapStart();
D3D12_RENDER_TARGET_VIEW_DESC rtvDesc = {};
if (pEnableSRGB) {
rtvDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
}
else {
rtvDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
}
rtvDesc.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2D;
for (size_t i = 0; i < swcDesc.BufferCount; ++i) {
result = pSwapchain->GetBuffer(static_cast<UINT>(i), IID_PPV_ARGS(&pBackBuffers[i]));
pDevice->CreateRenderTargetView(pBackBuffers[i], &rtvDesc, handle);
handle.ptr += pDevice->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV);
}
}
void MxRenderer::setViewport( int x, int y, unsigned int width, unsigned int height )
{
D3D12_VIEWPORT viewport = {};
viewport.Width = (float)width;
viewport.Height = (float)height;
viewport.TopLeftX = (float)x;
viewport.TopLeftY = (float)y;
viewport.MaxDepth = 1.0f;
viewport.MinDepth = 0.0f;
pCmdList->RSSetViewports(1, &viewport);
}
void MxRenderer::setScissor(const MxVector2I& pos, const MxVector2I& size)
{
D3D12_RECT scissorrect = {};
scissorrect.top = pos.x();
scissorrect.left = pos.y();
scissorrect.right = scissorrect.left + size.width();
scissorrect.bottom = scissorrect.top + size.height();
pCmdList->RSSetScissorRects(1, &scissorrect);
}
void MxRenderer::setBlending(MxRenderer::Blending blend)
{
}
void MxRenderer::enableDepthTest(bool enable)
{
}
MxTexture* MxRenderer::newTexture(const MxVector2I& size, MxTexture::PixelFormat format)
{
Q_ASSERT(NULL == pTextures[0].pTexBuffer);
pTextures[0].init(this, size.width(), size.height());
Q_ASSERT(NULL != pTextures[0].pTexBuffer);
return &(pTextures[0]);
}
MxGpuArray* MxRenderer::getBuffer( UINT64 length)
{
// reuse buffers, is this correct??
for (int i = 0; i < pBufferViews.size(); ++i)
{
MxGpuArray& reuseArray = pBufferViews[i];
if ( (reuseArray.isTaken() == false)
&& (reuseArray.size() >= length) )
{
reuseArray.pTaken = true;
return &reuseArray;
}
}
// create new
MxGpuArray *newArray = pBufferViews.appendAndGet();
allocResource(newArray, length);
newArray->pTaken = true;
return newArray;
}
void MxRenderer::setProgram(MxGpuProgram* program)
{
if (pCurrProgram != program) {
pCurrProgram = program;
pPipelineChanged = true;
}
}
void MxRenderer::setTexturesParameters(unsigned int flags)
{
if (pCurrInputTextureFlags != flags) {
pCurrInputTextureFlags = flags;
pRootSignatureChanged = true;
// changing the root signature is expensive, it triggers pipeline change
pPipelineChanged = true;
}
}
void MxRenderer::bindTextureGL(unsigned int textureId, unsigned int slot )
{
}
void MxRenderer::bindTexture(MxTexture* texture, unsigned char parameters, int inputIndex)
{
Q_ASSERT(inputIndex == pBoundTextureCount);
pBoundTextures[pBoundTextureCount] = texture;
pBoundTextureCount++;
}
void MxRenderer::checkGLError(const char* fileName, int line)
{
}
void MxRenderer::renderBegin()
{
}
void MxRenderer::renderEnd()
{
pBoundTextureCount = 0;
}
void MxRenderer::setupRoot()
{
Q_ASSERT(NULL != pDevice);
if (pRootSignatureChanged)
{
pRootSignatureChanged = false;
Q_ASSERT( pPipelineChanged == true );
// \TODO can pRootSignature be overwritten or needs to be deleted ??
Q_ASSERT(pRootSignature == NULL);
D3D12_ROOT_SIGNATURE_DESC rootSignatureDesc = {};
rootSignatureDesc.Flags = D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT;
D3D12_DESCRIPTOR_RANGE descTblRange = {};
descTblRange.NumDescriptors = 1;
descTblRange.RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV;
descTblRange.BaseShaderRegister = 0;
descTblRange.OffsetInDescriptorsFromTableStart = D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND;
// Matrix uniform
D3D12_ROOT_PARAMETER rootparam[2]; // = {};
rootparam[0].ParameterType = D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS;
rootparam[0].Constants.Num32BitValues = 16; // matrix
rootparam[0].Constants.ShaderRegister = 0; //b0
rootparam[0].Constants.RegisterSpace = 0;
rootparam[0].ShaderVisibility = D3D12_SHADER_VISIBILITY_VERTEX;
rootparam[1].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
rootparam[1].DescriptorTable.pDescriptorRanges = &descTblRange;
rootparam[1].DescriptorTable.NumDescriptorRanges = 1;
rootparam[1].ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL;
rootSignatureDesc.pParameters = rootparam;
rootSignatureDesc.NumParameters = 2;
D3D12_STATIC_SAMPLER_DESC samplerDesc = {};
samplerDesc.AddressU = D3D12_TEXTURE_ADDRESS_MODE_WRAP;
samplerDesc.AddressV = D3D12_TEXTURE_ADDRESS_MODE_WRAP;
samplerDesc.AddressW = D3D12_TEXTURE_ADDRESS_MODE_WRAP;
samplerDesc.BorderColor = D3D12_STATIC_BORDER_COLOR_TRANSPARENT_BLACK;
samplerDesc.Filter = D3D12_FILTER_MIN_MAG_MIP_POINT;
samplerDesc.MaxLOD = D3D12_FLOAT32_MAX;
samplerDesc.MinLOD = 0.0f;
samplerDesc.ComparisonFunc = D3D12_COMPARISON_FUNC_NEVER;
samplerDesc.ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL;
rootSignatureDesc.pStaticSamplers = &samplerDesc;
rootSignatureDesc.NumStaticSamplers = 1;
ID3DBlob* rootSigBlob = nullptr;
HRESULT result = D3D12SerializeRootSignature(&rootSignatureDesc, D3D_ROOT_SIGNATURE_VERSION_1_0, &rootSigBlob, &pErrorBlob);
result = pDevice->CreateRootSignature(0, rootSigBlob->GetBufferPointer(), rootSigBlob->GetBufferSize(), IID_PPV_ARGS(&pRootSignature));
rootSigBlob->Release();
}
}
void MxRenderer::prepareToDraw()
{
setupRoot();
bool changed = setupPipeline();
if (changed) {
HRESULT result = pDevice->CreateGraphicsPipelineState(&pPipeline, IID_PPV_ARGS(&pPipelinestate));
}
pCmdList->SetGraphicsRootSignature(pRootSignature);
pCmdList->SetPipelineState(pPipelinestate);
// descriptorHeaps are called after allocating all textures
pCmdList->SetDescriptorHeaps(1, &(pBoundTextures[0]->pTexDescHeap));
pCmdList->SetGraphicsRootDescriptorTable(1, pBoundTextures[0]->pTexDescHeap->GetGPUDescriptorHandleForHeapStart());
}
void MxRenderer::allocResource(MxGpuArray *newArray, UINT64 length)
{
D3D12_HEAP_PROPERTIES heapprop = {};
heapprop.Type = D3D12_HEAP_TYPE_UPLOAD;
heapprop.CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN;
heapprop.MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN;
D3D12_RESOURCE_DESC resdesc = {};
resdesc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER;
resdesc.Width = length;
resdesc.Height = 1;
resdesc.DepthOrArraySize = 1;
resdesc.MipLevels = 1;
resdesc.Format = DXGI_FORMAT_UNKNOWN;
resdesc.SampleDesc.Count = 1;
resdesc.Flags = D3D12_RESOURCE_FLAG_NONE;
resdesc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR;
HRESULT result = pDevice->CreateCommittedResource(
&heapprop,
D3D12_HEAP_FLAG_NONE,
&resdesc,
D3D12_RESOURCE_STATE_GENERIC_READ,
nullptr,
IID_PPV_ARGS(&(newArray->pBuffer)));
Q_ASSERT(NULL != newArray->pBuffer);
}
void MxRenderer::releaseGpuArrays()
{
for (int i = 0; i < pBufferViews.size(); ++i)
{
MxGpuArray& reuseArray = pBufferViews[i];
reuseArray.pTaken = false;
}
}
bool MxRenderer::setupPipeline()
{
if (pPipelineChanged)
{
pPipelineChanged = false;
Q_ASSERT(NULL != pCurrProgram);
pCurrProgram->setToPipeline(&pPipeline);
pPipeline.SampleMask = D3D12_DEFAULT_SAMPLE_MASK;
pPipeline.BlendState.AlphaToCoverageEnable = false;
pPipeline.BlendState.IndependentBlendEnable = false;
D3D12_RENDER_TARGET_BLEND_DESC renderTargetBlendDesc = {};
renderTargetBlendDesc.BlendEnable = false;
renderTargetBlendDesc.RenderTargetWriteMask = D3D12_COLOR_WRITE_ENABLE_ALL;
renderTargetBlendDesc.LogicOpEnable = false;
pPipeline.BlendState.RenderTarget[0] = renderTargetBlendDesc;
pPipeline.RasterizerState.MultisampleEnable = false;
pPipeline.RasterizerState.CullMode = D3D12_CULL_MODE_NONE;
pPipeline.RasterizerState.FillMode = D3D12_FILL_MODE_SOLID;
pPipeline.RasterizerState.DepthClipEnable = true;
pPipeline.RasterizerState.FrontCounterClockwise = false;
pPipeline.RasterizerState.DepthBias = D3D12_DEFAULT_DEPTH_BIAS;
pPipeline.RasterizerState.DepthBiasClamp = D3D12_DEFAULT_DEPTH_BIAS_CLAMP;
pPipeline.RasterizerState.SlopeScaledDepthBias = D3D12_DEFAULT_SLOPE_SCALED_DEPTH_BIAS;
pPipeline.RasterizerState.AntialiasedLineEnable = false;
pPipeline.RasterizerState.ForcedSampleCount = 0;
pPipeline.RasterizerState.ConservativeRaster = D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF;
pPipeline.DepthStencilState.DepthEnable = false;
pPipeline.DepthStencilState.StencilEnable = false;
pPipeline.IBStripCutValue = D3D12_INDEX_BUFFER_STRIP_CUT_VALUE_DISABLED;
pPipeline.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
pPipeline.NumRenderTargets = 1;
if (pEnableSRGB) {
pPipeline.RTVFormats[0] = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
}
else {
pPipeline.RTVFormats[0] = DXGI_FORMAT_R8G8B8A8_UNORM;
}
pPipeline.SampleDesc.Count = 1;
pPipeline.SampleDesc.Quality = 0;
Q_ASSERT(pRootSignature != NULL);
pPipeline.pRootSignature = pRootSignature;
return true;
}
return false;
}
| 26.713987 | 137 | 0.763207 | [
"vector"
] |
06c3ef5937040a917fe21952be3f29309ad1e04f | 2,946 | cpp | C++ | src/kad/Bucket.cpp | VictorKostyukov/kademlia | bad1189b55697715f45760687074ecdc6f50eab5 | [
"MIT"
] | 2 | 2018-04-03T06:49:57.000Z | 2020-06-24T12:34:07.000Z | src/kad/Bucket.cpp | VictorKostyukov/kademlia | bad1189b55697715f45760687074ecdc6f50eab5 | [
"MIT"
] | 1 | 2020-06-26T15:34:42.000Z | 2020-11-17T05:18:30.000Z | src/kad/Bucket.cpp | VictorKostyukov/kademlia | bad1189b55697715f45760687074ecdc6f50eab5 | [
"MIT"
] | 2 | 2018-04-03T06:53:04.000Z | 2018-05-23T14:11:43.000Z | /**
*
* MIT License
*
* Copyright (c) 2018 drvcoin
*
* 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 "Bucket.h"
namespace kad
{
ContactPtr Bucket::FindContact(KeyPtr key)
{
auto itr = this->values.find(key);
return itr != this->values.end() ? itr->second.contact : nullptr;
}
ContactPtr Bucket::UpdateContact(KeyPtr key)
{
auto itr = this->values.find(key);
if (itr == this->values.end())
{
return nullptr;
}
this->keys.splice(this->keys.end(), this->keys, itr->second.iter);
itr->second.iter = (-- this->keys.end());
return itr->second.contact;
}
KeyPtr Bucket::GetKeyFromIndx(size_t idx)
{
if (idx >= this->keys.size())
{
return nullptr;
}
auto itr = this->keys.begin();
for (size_t i = 0; i < idx; ++i) {
++ itr;
}
return * itr;
}
ContactPtr Bucket::EraseContact(KeyPtr key)
{
auto itr = this->values.find(key);
if (itr == this->values.end())
{
return nullptr;
}
this->keys.erase(itr->second.iter);
auto result = itr->second.contact;
this->values.erase(itr);
return result;
}
bool Bucket::AddContact(KeyPtr key, ContactPtr contact)
{
if (this->values.find(key) != this->values.end())
{
return false;
}
this->keys.push_back(key);
Entry entry;
entry.iter = (-- this->keys.end());
entry.contact = contact;
this->values.emplace(key, std::move(entry));
return true;
}
void Bucket::GetAllContacts(std::vector<std::pair<KeyPtr, ContactPtr>> & result) const
{
for (auto value : this->values)
{
result.emplace_back(std::make_pair(value.first, value.second.contact));
}
}
void Bucket::UpdateLookupTime()
{
this->lastLookupTime = std::chrono::steady_clock::now();
}
} | 23.758065 | 88 | 0.636456 | [
"vector"
] |
06c95d70c70357e4fbe0e1b3166e0216c8958e3b | 6,057 | cpp | C++ | nar/narnode/ActiveTask/Pull.cpp | webcok/nar | fda146f62f43c0d48612716299b132483700abad | [
"MIT"
] | null | null | null | nar/narnode/ActiveTask/Pull.cpp | webcok/nar | fda146f62f43c0d48612716299b132483700abad | [
"MIT"
] | null | null | null | nar/narnode/ActiveTask/Pull.cpp | webcok/nar | fda146f62f43c0d48612716299b132483700abad | [
"MIT"
] | 2 | 2019-01-11T20:14:39.000Z | 2021-04-29T10:23:31.000Z | #include "ActiveTask.h"
#include <nar/lib/Exception/Exception.h>
#include <nar/lib/Messaging/MessageTypes/FilePull.h>
#include <nar/lib/Socket/USocket.h>
#include <nar/lib/Messaging/MessageTypes/InfoChunkPull.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <boost/filesystem.hpp>
#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1
#include <crypto++/md5.h>
#include <cryptopp/filters.h>
#include <cryptopp/hex.h>
using std::string;
using std::cout;
using std::endl;
// TO_DO: Last part should handled for file::encrypt,decompress etc..
void nar::ActiveTask::Pull::run(nar::Socket* ipc_socket, nar::MessageTypes::IPCPull::Request* req) {
nar::Socket* server_sck = this->_globals->establish_server_connection();
std::string file_aes;
try {
file_aes = nar::ActiveTask::user_authenticate(server_sck, this->_vars);
} catch (nar::Exception::Daemon::AuthenticationError& exp) {
NAR_LOG<<exp.what()<<std::endl;
return;
}
string file_name,system_dir,nar_dir_name;
try {
file_name = req->get_file_name();
system_dir = req->get_dir_path(); // to be changed
nar_dir_name = req->get_current_directory();
}
catch (...) {
NAR_LOG << "Malformed Json, exiting pull" << std::endl;
return;
}
nar::MessageTypes::FilePull::Request pull_req(file_name, nar_dir_name);
nar::MessageTypes::FilePull::Response pull_resp;
try {
pull_req.send_mess(server_sck, pull_resp);
}
catch (nar::Exception::ExcpBase& e) {
NAR_LOG << std::string( "nar_daemon::activepull " ).append(e.what()) << std::endl;
return;
}
if ( pull_resp.get_status_code() == 666 ) { // Not enough online peer
nar::MessageTypes::IPCPull::Response ipcpull_resp(3,666); // Params ?
ipcpull_resp.send_message_end(ipc_socket);
return;
}
unsigned short rand_port = pull_resp.get_rendezvous_port();
std::vector<struct nar::MessageTypes::FilePull::Response::PeerListElement> elements = pull_resp.get_elements();
std::sort(elements.begin(), elements.end());
boost::filesystem::path tpath(system_dir);
tpath /= file_name;
boost::filesystem::path temp;
try {
temp = boost::filesystem::unique_path();
} catch(std::ios_base::failure& Exp) {
throw nar::Exception::Unknown(Exp.what());
}
std::string temp_native = temp.native();
nar::File* tempfile1 = new nar::File(temp_native,"w",false);
int i=0;
try {
unsigned long offset = 0;
while( i<elements.size() ) {
unsigned long stream_id = elements[i].stream_id;
nar::USocket* cli_sck = new nar::USocket(this->_globals->get_ioserv(), this->_globals->get_server_ip(), rand_port, stream_id);
char* buf = NULL;
try {
cli_sck->connect();
long int total_read = 0;
buf = new char [elements[i].chunk_size];
while(total_read < elements[i].chunk_size) {
int len = cli_sck->recv(buf+total_read, elements[i].chunk_size - total_read);
total_read += len;
}
byte digest[ CryptoPP::Weak::MD5::DIGESTSIZE];
CryptoPP::Weak::MD5 hash;
hash.CalculateDigest( digest, (const byte*)buf, elements[i].chunk_size );
CryptoPP::HexEncoder encoder;
std::string output;
encoder.Attach( new CryptoPP::StringSink( output ) );
encoder.Put( digest, sizeof(digest) );
encoder.MessageEnd();
/* if ( output.compare(elements[i].hashed) ) // Wrong Hash
{
std::cout <<"Benim Hesabim: " << output << std::endl;
std::cout <<"Carsidaki Hesap: " << elements[i].hashed << std::endl;
throw nar::Exception::Unknown("Wrong Hash");
} */
tempfile1->write(buf,total_read);
offset+=total_read;
}
catch (nar::Exception::File::WrongMode& e) {
NAR_LOG << e.what() << std::endl;
}
catch (nar::Exception::File::OffsetOutOfBounds& e) {
NAR_LOG << e.what() << std::endl;
}
catch ( nar::Exception::DomainError::Negative& e) {
NAR_LOG << e.what() << std::endl;
}
catch ( nar::Exception::File::WriteError& e) {
NAR_LOG << e.what() << std::endl;
}
catch ( nar::Exception::File::NotOpen& e) {
NAR_LOG << e.what() << std::endl;
}
catch (...) {
NAR_LOG<<"pull.cpp inside"<<std::endl;
nar::MessageTypes::InfoChunkPull::Request _req(elements[i].chunk_id, 704);
nar::MessageTypes::InfoChunkPull::Response _resp;
_req.send_mess(server_sck,_resp);
elements[i].stream_id = _resp.get_stream_id();
if (buf)
delete [] buf;
continue;
}
cli_sck->close();
i++;
}
}
catch ( ... ) {
NAR_LOG << "Problem occured when pulling chunks from peers" << std::endl;
delete tempfile1;
return;
}
delete tempfile1;
tempfile1 = new nar::File(temp_native,"r",true);
nar::File * decrypted;
try{
decrypted = tempfile1->decrypt(file_aes);
} catch(...) {
NAR_LOG<<"can not decrytp"<<std::endl;
}
string dust= tpath.native();
nar::File * decompressed = decrypted->decompress(dust);
nar::MessageTypes::InfoChunkPull::Request _req(50, 200);
_req.send_mess(server_sck);
try {
nar::MessageTypes::IPCPull::Response ipcpull_resp(100,200);
ipcpull_resp.send_message_end(ipc_socket);
} catch (...){
NAR_LOG << "cli seems down!!! " << std::endl;
}
delete tempfile1;
delete decrypted;
delete decompressed;
return;
}
| 33.837989 | 138 | 0.57157 | [
"vector"
] |
06cdfc5e89a06a9ed2c116d758b1693ab722cf7e | 1,053 | cpp | C++ | 70B.cpp | felikjunvianto/kfile-codeforces-submissions | 1b53da27a294a12063b0912e12ad32efe24af678 | [
"MIT"
] | null | null | null | 70B.cpp | felikjunvianto/kfile-codeforces-submissions | 1b53da27a294a12063b0912e12ad32efe24af678 | [
"MIT"
] | null | null | null | 70B.cpp | felikjunvianto/kfile-codeforces-submissions | 1b53da27a294a12063b0912e12ad32efe24af678 | [
"MIT"
] | null | null | null | #include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define pi 2*acos(0.0)
#define eps 1e-9
#define PII pair<int,int>
#define PDD pair<double,double>
#define LL long long
#define INF 1000000000
using namespace std;
int N,len,x,y,z,ans,temp;
char msk[10010];
bool bisa;
int main()
{
scanf("%d",&N);getchar();
gets(msk);len=strlen(msk);
bisa=true,x=-1;
ans=0;
do
{
x++;
z=x;
temp=0;
while(temp<N)
{
y=z;
while((y<len)&&(msk[y]!='.')&&(msk[y]!='?')&&(msk[y]!='!')) y++;
if(temp+y-z+1>N) break;
temp+=(y-z+1);
z=y+1;
}
if(!temp)
{
bisa=false;
break;
}
ans++;
x=z;
while((x<len)&&(msk[x]==' ')) x++;x--;
}while(x+1<len);
if(bisa) printf("%d\n",ans); else printf("Impossible\n");
return 0;
}
| 15.485294 | 68 | 0.553656 | [
"vector"
] |
06d23fce884a9fe8eef017cca607a98ac63c1251 | 1,673 | hpp | C++ | src/tracer/observers/caustic_observer.hpp | ngc92/branchedflowsim | d38c0e7f892d07d0abd9b63d30570c41b3b83b34 | [
"MIT"
] | null | null | null | src/tracer/observers/caustic_observer.hpp | ngc92/branchedflowsim | d38c0e7f892d07d0abd9b63d30570c41b3b83b34 | [
"MIT"
] | null | null | null | src/tracer/observers/caustic_observer.hpp | ngc92/branchedflowsim | d38c0e7f892d07d0abd9b63d30570c41b3b83b34 | [
"MIT"
] | null | null | null | #ifndef CAUSTIC_OBSERVER_HPP_INCLUDED
#define CAUSTIC_OBSERVER_HPP_INCLUDED
#include "observer.hpp"
#include "caustic.hpp"
#include <deque>
class CausticObserver final: public ThreadLocalObserver
{
// use deque because we do not iterate over the data very often,
// and deque has better push_back performance and does not require
// enormous amounts of consecutive memory.
typedef std::deque<Caustic> container_type;
public:
/// create an observer and specify the size of the density track object
CausticObserver( std::size_t dimension, bool breakOnFirst = false, std::string file_name = "caustics.dat" );
/// d'tor
virtual ~CausticObserver();
// standard observer functions
// for documentation look at observer.hpp
bool watch( const State& state, double t ) override;
void startTrajectory(const InitialCondition& start, std::size_t trajectory) override;
void save(std::ostream& target) override;
const container_type& getCausticPositions() const;
private:
std::shared_ptr<ThreadLocalObserver> clone() const override;
void combine(ThreadLocalObserver& other) override;
// configuration
bool mBreakOnFirst = false;
const std::size_t mDimension;
std::size_t mCausticCount = 0; // counts the number of caustics on the current trajectory
std::size_t mParticleNumber = 0;
// cache data for a single trajectory run
double mOldArea = 0;
gen_vect mOldPosition;
gen_vect mOldVelocity;
double mOldTime;
const InitialCondition* mCachedInitialCondition;
// generated results
container_type mCausticPositions;
};
#endif // CAUSTIC_OBSERVER_HPP_INCLUDED
| 30.981481 | 112 | 0.738195 | [
"object"
] |
06d4e8c2bb823b432899feaff98aa076b0fbde24 | 8,794 | cpp | C++ | apps/main.cpp | iclue-summer-2020/coxeter | 4d8f2ab271387db6550880a6b9bb64b6b2118477 | [
"MIT"
] | null | null | null | apps/main.cpp | iclue-summer-2020/coxeter | 4d8f2ab271387db6550880a6b9bb64b6b2118477 | [
"MIT"
] | null | null | null | apps/main.cpp | iclue-summer-2020/coxeter | 4d8f2ab271387db6550880a6b9bb64b6b2118477 | [
"MIT"
] | null | null | null | /*
This is main.c
Coxeter version 3.0 Copyright (c) 2002 Fokko du Cloux
This program is made available under the terms stated in the Gnu
General Public License below. Enquiries about the General Public License
and the Gnu project may be adressed to :
Free Software Foundation
675 Mass. Ave., Cambridge, MA 02139, USA
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any program or other work which
contains a notice placed by the copyright holder saying it may be
distributed under the terms of this General Public License. The
"Program", below, refers to any such program or work, and a "work based
on the Program" means either the Program or any work containing the
Program or a portion of it, either verbatim or with modifications. Each
licensee is addressed as "you".
1. You may copy and distribute verbatim copies of the Program's source
code as you receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice and
disclaimer of warranty; keep intact all the notices that refer to this
General Public License and to the absence of any warranty; and give any
other recipients of the Program a copy of this General Public License
along with the Program. You may charge a fee for the physical act of
transferring a copy.
2. You may modify your copy or copies of the Program or any portion of
it, and copy and distribute such modifications under the terms of Paragraph
1 above, provided that you also do the following:
a) cause the modified files to carry prominent notices stating that
you changed the files and the date of any change; and
b) cause the whole of any work that you distribute or publish, that
in whole or in part contains the Program or any part thereof, either
with or without modifications, to be licensed at no charge to all
third parties under the terms of this General Public License (except
that you may choose to grant warranty protection to some or all
third parties, at your option).
c) If the modified program normally reads commands interactively when
run, you must cause it, when started running for such interactive use
in the simplest and most usual way, to print or display an
announcement including an appropriate copyright notice and a notice
that there is no warranty (or else, saying that you provide a
warranty) and that users may redistribute the program under these
conditions, and telling the user how to view a copy of this General
Public License.
d) You may charge a fee for the physical act of transferring a
copy, and you may at your option offer warranty protection in
exchange for a fee.
Mere aggregation of another independent work with the Program (or its
derivative) on a volume of a storage or distribution medium does not bring
the other work under the scope of these terms.
3. You may copy and distribute the Program (or a portion or derivative of
it, under Paragraph 2) in object code or executable form under the terms of
Paragraphs 1 and 2 above provided that you also do one of the following:
a) accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of
Paragraphs 1 and 2 above; or,
b) accompany it with a written offer, valid for at least three
years, to give any third party free (except for a nominal charge
for the cost of distribution) a complete machine-readable copy of the
corresponding source code, to be distributed under the terms of
Paragraphs 1 and 2 above; or,
c) accompany it with the information you received as to where the
corresponding source code may be obtained. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form alone.)
Source code for a work means the preferred form of the work for making
modifications to it. For an executable file, complete source code means
all the source code for all modules it contains; but, as a special
exception, it need not include source code for modules which are standard
libraries that accompany the operating system on which the executable
file runs, or for standard header files or definitions files that
accompany that operating system.
4. You may not copy, modify, sublicense, distribute or transfer the
Program except as expressly provided under this General Public License.
Any attempt otherwise to copy, modify, sublicense, distribute or transfer
the Program is void, and will automatically terminate your rights to use
the Program under this License. However, parties who have received
copies, or rights to use copies, from you under this General Public
License will not have their licenses terminated so long as such parties
remain in full compliance.
5. By copying, distributing or modifying the Program (or any work based
on the Program) you indicate your acceptance of this license to do so,
and all its terms and conditions.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the original
licensor to copy, distribute or modify the Program subject to these
terms and conditions. You may not impose any further restrictions on the
recipients' exercise of the rights granted herein.
7. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of the license which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
the license, you may choose any version ever published by the Free Software
Foundation.
8. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
*/
#include <coxeter/constants.h>
#include <coxeter/commands.h>
#include <coxeter/version.h>
namespace {
using namespace version;
void printVersion();
}
int main()
/*
In this version, the program can only run in interactive mode, and
does not take any arguments.
*/
{
constants::initConstants();
printVersion();
commands::run();
exit(0);
}
namespace {
void printVersion()
/*
Prints an opening message and the version number.
*/
{
printf("This is %s version %s.\nEnter help if you need assistance,\
carriage return to start the program.\n\n",NAME,VERSION);
return;
}
}
| 44.414141 | 77 | 0.757107 | [
"object"
] |
06d53278bdab3779031d183c5667292af322f9c5 | 12,251 | cxx | C++ | MUON/MUONraw/AliMUONRawStreamTrigger.cxx | AllaMaevskaya/AliRoot | c53712645bf1c7d5f565b0d3228e3a6b9b09011a | [
"BSD-3-Clause"
] | 52 | 2016-12-11T13:04:01.000Z | 2022-03-11T11:49:35.000Z | MUON/MUONraw/AliMUONRawStreamTrigger.cxx | AllaMaevskaya/AliRoot | c53712645bf1c7d5f565b0d3228e3a6b9b09011a | [
"BSD-3-Clause"
] | 1,388 | 2016-11-01T10:27:36.000Z | 2022-03-30T15:26:09.000Z | MUON/MUONraw/AliMUONRawStreamTrigger.cxx | AllaMaevskaya/AliRoot | c53712645bf1c7d5f565b0d3228e3a6b9b09011a | [
"BSD-3-Clause"
] | 275 | 2016-06-21T20:24:05.000Z | 2022-03-31T13:06:19.000Z | /**************************************************************************
* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* *
* Author: The ALICE Off-line Project. *
* Contributors are mentioned in the code where appropriate. *
* *
* Permission to use, copy, modify and distribute this software and its *
* documentation strictly for non-commercial purposes is hereby granted *
* without fee, provided that the above copyright notice appears in all *
* copies and that both the copyright notice and this permission notice *
* appear in the supporting documentation. The authors make no claims *
* about the suitability of this software for any purpose. It is *
* provided "as is" without express or implied warranty. *
**************************************************************************/
/* $Id$ */
//-----------------------------------------------------------------------------
/// \class AliMUONRawStreamTrigger
/// This class provides access to MUON digits in raw data.
///
/// It loops over all MUON digits in the raw data given by the AliRawReader.
/// The Next method goes to the next local response. If there are no local response left
/// it returns kFALSE.
/// It can loop also over DDL and store the decoded rawdata in TClonesArrays
/// in payload class.
///
/// Version implement for Trigger
/// \author Christian Finck
//-----------------------------------------------------------------------------
#include <TArrayS.h>
#include "AliMUONRawStreamTrigger.h"
#include "AliMUONDarcHeader.h"
#include "AliMUONRegHeader.h"
#include "AliMUONLocalStruct.h"
#include "AliMUONDDLTrigger.h"
#include "AliMUONLogger.h"
#include "AliRawReader.h"
#include "AliRawDataHeader.h"
#include "AliRawDataHeaderV3.h"
#include "AliDAQ.h"
#include "AliLog.h"
#include <cassert>
/// \cond CLASSIMP
ClassImp(AliMUONRawStreamTrigger)
/// \endcond
const Int_t AliMUONRawStreamTrigger::fgkMaxDDL = 2;
//___________________________________________
AliMUONRawStreamTrigger::AliMUONRawStreamTrigger(TRootIOCtor* /*dummy*/)
: AliMUONVRawStreamTrigger(),
fPayload(0x0),
fCurrentDDL(0x0),
fCurrentDDLIndex(fgkMaxDDL),
fCurrentDarcHeader(0x0),
fCurrentRegHeader(0x0),
fCurrentRegHeaderIndex(0),
fCurrentLocalStruct(0x0),
fCurrentLocalStructIndex(0),
fLocalStructRead(kFALSE),
fDDL(0),
fNextDDL(kFALSE)
{
///
/// create an object to read MUON raw digits
/// Default ctor with no mem allocation for I/O
///
}
//___________________________________________
AliMUONRawStreamTrigger::AliMUONRawStreamTrigger()
: AliMUONVRawStreamTrigger(),
fPayload(new AliMUONPayloadTrigger()),
fCurrentDDL(0x0),
fCurrentDDLIndex(fgkMaxDDL),
fCurrentDarcHeader(0x0),
fCurrentRegHeader(0x0),
fCurrentRegHeaderIndex(0),
fCurrentLocalStruct(0x0),
fCurrentLocalStructIndex(0),
fLocalStructRead(kFALSE),
fDDL(0),
fNextDDL(kFALSE)
{
///
/// create an object to read MUON raw digits
/// Default ctor for monitoring purposes
///
}
//_________________________________________________________________
AliMUONRawStreamTrigger::AliMUONRawStreamTrigger(AliRawReader* rawReader)
: AliMUONVRawStreamTrigger(rawReader),
fPayload(new AliMUONPayloadTrigger()),
fCurrentDDL(0x0),
fCurrentDDLIndex(fgkMaxDDL),
fCurrentDarcHeader(0x0),
fCurrentRegHeader(0x0),
fCurrentRegHeaderIndex(0),
fCurrentLocalStruct(0x0),
fCurrentLocalStructIndex(0),
fLocalStructRead(kFALSE),
fDDL(0),
fNextDDL(kFALSE)
{
///
/// ctor with AliRawReader as argument
/// for reconstruction purpose
///
}
//___________________________________
AliMUONRawStreamTrigger::~AliMUONRawStreamTrigger()
{
///
/// clean up
///
delete fPayload;
}
//_____________________________________________________________
Bool_t AliMUONRawStreamTrigger::Next(UChar_t& id, UChar_t& dec, Bool_t& trigY,
UChar_t& yPos, UChar_t& sXDev, UChar_t& xDev,
UChar_t& xPos, Bool_t& triggerY, Bool_t& triggerX,
TArrayS& xPattern, TArrayS& yPattern)
{
///
/// read the next raw digit (local structure)
/// returns kFALSE if there is no digit left
/// Should call First() before this method to start the iteration.
///
if ( IsDone() ) return kFALSE;
if ( fLocalStructRead ) {
Bool_t ok = GetNextLocalStruct();
if (!ok)
{
// this is the end
return kFALSE;
}
}
fLocalStructRead = kTRUE;
id = fCurrentLocalStruct->GetId();
dec = fCurrentLocalStruct->GetDec();
trigY = fCurrentLocalStruct->GetTrigY();
yPos = fCurrentLocalStruct->GetYPos();
sXDev = fCurrentLocalStruct->GetSXDev();
xDev = fCurrentLocalStruct->GetXDev();
xPos = fCurrentLocalStruct->GetXPos();
triggerX = fCurrentLocalStruct->GetTriggerX();
triggerY = fCurrentLocalStruct->GetTriggerY();
fCurrentLocalStruct->GetXPattern(xPattern);
fCurrentLocalStruct->GetYPattern(yPattern);
return kTRUE;
}
//______________________________________________________
Bool_t AliMUONRawStreamTrigger::IsDone() const
{
/// Whether the iteration is finished or not
return (fCurrentLocalStruct==0);
}
//______________________________________________________
void AliMUONRawStreamTrigger::First()
{
/// Initialize the iteration process.
fCurrentDDLIndex = -1;
// Must reset all the pointers because if we return before calling
// GetNextLocalStruct() the user might call CurrentDDL(), CurrentBlockHeader(),
// CurrentRegHeader() or CurrentLocalStruct() which should return reasonable
// results in that case.
fCurrentDDL = 0;
fCurrentDarcHeader = 0;
fCurrentRegHeader = 0;
fCurrentLocalStruct = 0;
// Find the first non-empty structure
if (not GetNextDDL()) return;
if (not GetNextRegHeader()) return;
GetNextLocalStruct();
}
//______________________________________________________
Bool_t AliMUONRawStreamTrigger::GetNextDDL()
{
/// Returns the next DDL present
assert( GetReader() != 0 );
Bool_t kFound(kFALSE);
while ( fCurrentDDLIndex < fgkMaxDDL-1 && !kFound )
{
++fCurrentDDLIndex;
GetReader()->Reset();
GetReader()->Select("MUONTRG",fCurrentDDLIndex,fCurrentDDLIndex);
if ( GetReader()->ReadHeader() )
{
kFound = kTRUE;
}
}
if ( !kFound )
{
// fCurrentDDLIndex is set to fgkMaxDDL so that we exit the above loop immediately
// for a subsequent call to this method, unless NextEvent is called in between.
fCurrentDDLIndex = fgkMaxDDL;
// We have not actually been able to complete the loading of the new DDL so
// we are still on the old one. In this case we do not need to reset fCurrentDDL.
//fCurrentDDL = 0;
if (IsErrorLogger()) AddErrorMessage();
return kFALSE;
}
Int_t totalDataWord = GetReader()->GetDataSize(); // in bytes
AliRawReader * reader = GetReader();
if (!reader) return kFALSE;
const AliRawDataHeader * cdh = reader->GetDataHeader();
const AliRawDataHeaderV3 * cdh3 = reader->GetDataHeaderV3();
if (!cdh && !cdh3) return kFALSE;
Bool_t scalerEvent = ((cdh ? cdh->GetL1TriggerMessage() : cdh3->GetL1TriggerMessage()) & 0x1) == 0x1;
AliDebug(3, Form("DDL Number %d totalDataWord %d\n", fCurrentDDLIndex,
totalDataWord));
UInt_t *buffer = new UInt_t[totalDataWord/4];
if ( !GetReader()->ReadNext((UChar_t*)buffer, totalDataWord) )
{
// We have not actually been able to complete the loading of the new DDL so
// we are still on the old one. In this case we do not need to reset fCurrentDDL.
//fCurrentDDL = 0;
delete [] buffer;
return kFALSE;
}
#ifndef R__BYTESWAP
Swap(buffer, totalDataWord / sizeof(UInt_t)); // swap needed for mac power pc
#endif
fPayload->ResetDDL();
Bool_t ok = fPayload->Decode(buffer, scalerEvent);
delete[] buffer;
fCurrentDDL = fPayload->GetDDLTrigger();
fCurrentDarcHeader = fCurrentDDL->GetDarcHeader();
fCurrentRegHeaderIndex = -1;
return ok;
}
//______________________________________________________
Bool_t AliMUONRawStreamTrigger::GetNextRegHeader()
{
/// Returns the next Reg Header present
assert( fCurrentDarcHeader != 0 );
assert( fCurrentDDL != 0 );
fCurrentRegHeader = 0;
Int_t i = fCurrentRegHeaderIndex;
while ( fCurrentRegHeader == 0 && i < fCurrentDarcHeader->GetRegHeaderEntries()-1 )
{
++i;
fCurrentRegHeader = fCurrentDarcHeader->GetRegHeaderEntry(i);
}
if ( !fCurrentRegHeader )
{
Bool_t ok = GetNextDDL();
if (!ok)
{
return kFALSE;
}
else
{
return GetNextRegHeader();
}
}
fCurrentRegHeaderIndex = i;
fCurrentLocalStructIndex = -1;
return kTRUE;
}
//______________________________________________________
Bool_t AliMUONRawStreamTrigger::GetNextLocalStruct()
{
/// Find the next non-empty local structure
assert( fCurrentRegHeader != 0 );
fCurrentLocalStruct = 0;
Int_t i = fCurrentLocalStructIndex;
while ( fCurrentLocalStruct == 0 && i < fCurrentRegHeader->GetLocalEntries()-1 )
{
++i;
fCurrentLocalStruct = fCurrentRegHeader->GetLocalEntry(i);
}
if ( !fCurrentLocalStruct )
{
Bool_t ok = GetNextRegHeader();
if (!ok)
{
return kFALSE;
}
else
{
return GetNextLocalStruct();
}
}
fCurrentLocalStructIndex = i;
fLocalStructRead = kFALSE;
return kTRUE;
}
//______________________________________________________
Bool_t AliMUONRawStreamTrigger::NextDDL()
{
/// reading tracker DDL
/// store local info into Array
/// store only non-empty structures
// reset TClones
fPayload->ResetDDL();
// loop over the two ddl's
while ( fDDL < fgkMaxDDL ) {
GetReader()->Reset();
GetReader()->Select("MUONTRG", fDDL, fDDL); //Select the DDL file to be read
if (GetReader()->ReadHeader()) break;
AliDebug(3,Form("Skipping DDL %d which does not seem to be there",fDDL));
++fDDL;
}
if (fDDL >= fgkMaxDDL) {
fDDL = 0;
if (IsErrorLogger()) AddErrorMessage();
return kFALSE;
}
AliDebug(3, Form("DDL Number %d\n", fDDL ));
Int_t totalDataWord = GetReader()->GetDataSize(); // in bytes
AliRawReader * reader = GetReader();
if (!reader) return kFALSE;
const AliRawDataHeader * cdh = reader->GetDataHeader();
const AliRawDataHeaderV3 * cdh3 = reader->GetDataHeaderV3();
if (!cdh && !cdh3) return kFALSE;
Bool_t scalerEvent = ((cdh ? cdh->GetL1TriggerMessage() : cdh3->GetL1TriggerMessage()) & 0x1) == 0x1;
UInt_t *buffer = new UInt_t[totalDataWord/4];
// check not necessary yet, but for future developments
if (!GetReader()->ReadNext((UChar_t*)buffer, totalDataWord)) return kFALSE;
#ifndef R__BYTESWAP
Swap(buffer, totalDataWord / sizeof(UInt_t)); // swap needed for mac power pc
#endif
fPayload->Decode(buffer, scalerEvent);
fDDL++;
delete [] buffer;
return kTRUE;
}
// //______________________________________________________
// void AliMUONRawStreamTrigger::SetMaxReg(Int_t reg)
// {
// /// set regional card number
// fPayload->SetMaxReg(reg);
// }
//______________________________________________________
void AliMUONRawStreamTrigger::SetMaxLoc(Int_t loc)
{
/// set local card number
fPayload->SetMaxLoc(loc);
}
//______________________________________________________
void AliMUONRawStreamTrigger::AddErrorMessage()
{
/// add message into logger of AliRawReader per event
TString msg;
Int_t occurance = 0;
AliMUONLogger* log = fPayload->GetErrorLogger();
log->ResetItr();
while(log->Next(msg, occurance))
{
if (msg.Contains("Darc"))
GetReader()->AddMajorErrorLog(kDarcEoWErr, msg.Data());
if (msg.Contains("Global"))
GetReader()->AddMajorErrorLog(kGlobalEoWErr, msg.Data());
if (msg.Contains("Regional"))
GetReader()->AddMajorErrorLog(kRegEoWErr, msg.Data());
if (msg.Contains("Local"))
GetReader()->AddMajorErrorLog(kLocalEoWErr, msg.Data());
}
log->Clear(); // clear after each event
}
| 26.574837 | 104 | 0.672435 | [
"object"
] |
06de785ac94b335db435ea96bc94e2eb12b0e053 | 5,643 | cpp | C++ | 02 Stukturerad programmering C, C plusplus/11_Awesome_adventures/common/common.cpp | alexanderjxnsson/MMMMUH21 | becb785d01017de3cc41a91be22b7c00fc559f85 | [
"MIT"
] | 4 | 2021-09-30T09:57:01.000Z | 2022-01-07T09:37:35.000Z | 02 Stukturerad programmering C, C plusplus/11_Awesome_adventures/common/common.cpp | alexanderjxnsson/MMMMUH21 | becb785d01017de3cc41a91be22b7c00fc559f85 | [
"MIT"
] | 2 | 2021-09-30T12:44:44.000Z | 2021-10-06T15:45:12.000Z | 02 Stukturerad programmering C, C plusplus/11_Awesome_adventures/common/common.cpp | alexanderjxnsson/MMMMUH21 | becb785d01017de3cc41a91be22b7c00fc559f85 | [
"MIT"
] | 11 | 2021-09-15T07:43:01.000Z | 2021-10-06T14:16:45.000Z | //
// common/common.cpp
// 11_Awesome_adventures
//
// Created by Daniel Eftodi on 2021-10-12.
//
#include "common.h"
//void function_one_size_of_datatype () {
// unsigned int usDataSize = 128;
//
// printf("Data size of usDataSize (%d) is: %lu bytes\n", usDataSize, sizeof(usDataSize) );
//
// printf("Data size of usDataSize (%d) is: %lu bits\n", usDataSize, sizeof(usDataSize) * 8 );
//
// printf("Data size of usDataSize (%d) is: %lu bits\n\n", usDataSize, sizeof(usDataSize) * CHAR_BIT );
//}
//
//void function_two_argc_argv_main (int f_argc, char ** f_argv) {
//
// printf("There are %d number of arguments (f_argc)\n", f_argc - 1);
//
// char cf_argv;
// std::string sf_argv;
//
// for (int i = 1; i < f_argc; i++) {
//
// // Felmeddelande:
//// cf_argv = f_argv[i];
// // Lösninagr:
// cf_argv = *f_argv[i];
//// cf_argv = f_argv[i][0];
//
// switch ( cf_argv ) {
// case '-':
// printf("Input is: %s\n", f_argv[i]);
// break;
// case 'i':
// printf("f_argv[%d]: %s\n", i, f_argv[i+1]);
// break;
// case 'e':
// printf("f_argv[%d]: %s\n", i, f_argv[i+1]);
// break;
// case 'c':
// printf("f_argv[%d]: %s\n", i, f_argv[i+1]);
// break;
// case 'h':
// printf("f_argv[%d]: %s\n", i, f_argv[i+1]);
// break;
// default:
//// printf("f_argv[%d]: %s\n", i, f_argv[i]);
// break;
// }
//
//// printf("f_argv[%d]: %s\n", i, f_argv[i]);
//
// // reset cf_argv to NULL
// cf_argv = NULL;
// }
//
//}
//
//
//
//void function_four_playing_with_arrays (void) {
// /*
// There are four ways to implement an array
// RTFM: https://www.geeksforgeeks.org/array-strings-c-3-different-ways-create/
// */
//
// // clear the screen
// system("clear");
//
// // Way one :: Using the string class
// std::string words_one[2]; // let's just make an empty array of two
// words_one[0] = "Hello"; // add first word to array
// words_one[1] = "World"; // add second word to array
//
// printf("First word is: %s\nSecond word is: %s\n", words_one[0].c_str(), words_one[1].c_str());
// printf("Size of the arary is: %lu\n", ( sizeof(words_one) / sizeof(std::string) ) );
// printf("Size of first word is: %lu\n", words_one[0].size());
// printf("Size of second word is: %lu\n\n", words_one[1].size());
//
// // Way one :: Using the string class - at defenition
// std::string wordz_one[2] = { "World",
// "Hello" };
//
// printf("First word is: %s\nSecond word is: %s\n", wordz_one[0].c_str(), wordz_one[1].c_str());
// printf("Size of first word is: %lu\n", wordz_one[0].size());
// printf("Size of second word is: %lu\n\n", wordz_one[1].size());
//
//
// // Way two :: Using 2D array
// char words_two[2][10] = { "Zombie",
// "World" };
//
// printf("First word is: %s\nSecond word is: %s\n\n", words_two[0], words_two[1]);
//
// //ERRORs *hmm*
//// printf("Size of the arary is: %lu\n", words_two.size());
//// printf("Size of first word is: %d\n", words_two[0].size());
//// printf("Size of second word is: %d\n\n", words_two[1].size());
//
// // Way two :: Using 2D array - Why does it fail to build?
//// char words_three[3][19] = { "Zombie",
//// "World",
//// "Way to many letters" };
////
//// printf("First word is: %s\nSecond word is: %s\nThird word is: %s\n\n", words_three[0], words_three[1], words_three[2]);
//
//
// // Way three :: Using the vector class
//#include <vector>
// std::vector<std::string> words_three;
//// = { "Zoro", "Rulez" };
//
// words_three.push_back("Zoro");
// words_three.push_back("Rulez");
//
// printf("First word is: %s\nSecond word is: %s\n", words_three[0].c_str(), words_three[1].c_str());
// printf("Size of the arary is: %lu\n", words_three.size());
// printf("Size of first word is: %lu\n", words_three[0].size());
// printf("Size of second word is: %lu\n", words_three[1].size());
//}
//
//void function_five_possible_roads_a_frog_can_jump_to_rome (int iNumRequireSteps) {
// /*
// Uppgift: En groda kan hoppa 1 steg eller 2 steg åt gången.
//
// Man vill veta på hur många olika sätt som grodan
// kan hoppa fram för att nå 50 steg bort.
//
// Assignment: A frog can either jump 1 or 2 steps at a time.
//
// How many different ways can the frog jump, in 50 steps?
//
// Think: What are all of the possible "Roads to Rome" the
// frog can jump in 50 steps.
// */
//
// // clear screen
// system("clear");
//
// printf("Lets figure out all of the possbile permutations a frog can jump 1 or 2 steps at a time, in %d steps.", iNumRequireSteps);
//}
//
//void function_enumeration_example_one (void) {
//
//}
//
//void function_enumeration_example_two (void) {
//
//// enum suit cards = diamonds;
// int iWantToCheckFor = 3;
// cards = clubs;
// if (cards == iWantToCheckFor){
// printf("Yes: it is 3\n");
// } else {
// printf("No: it is not 3\n");
// }
//}
//
//// Function :: Returns "Hearts", "Spades" etc
//const char* get_suit2 (enum suit a_suit){
// const char *suit_strs[] = {"Hearts", "Spades", "Clubs", "Diamonds", "Unknown" };
// return suit_strs[a_suit];
//}
| 32.80814 | 136 | 0.533581 | [
"vector"
] |
06df3b6091e913d34ca373e0e4b7984310d2898d | 8,366 | cpp | C++ | src/primitives/transaction.cpp | izzy-developer/core | 32b83537a255aeef50a64252ea001c99c7e69a01 | [
"MIT"
] | null | null | null | src/primitives/transaction.cpp | izzy-developer/core | 32b83537a255aeef50a64252ea001c99c7e69a01 | [
"MIT"
] | null | null | null | src/primitives/transaction.cpp | izzy-developer/core | 32b83537a255aeef50a64252ea001c99c7e69a01 | [
"MIT"
] | 1 | 2022-03-15T23:32:26.000Z | 2022-03-15T23:32:26.000Z | // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin developers
// Copyright (c) 2015-2017 The PIVX Developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "primitives/block.h"
#include "primitives/transaction.h"
#include "chain.h"
#include "hash.h"
#include "main.h"
#include "tinyformat.h"
#include "utilstrencodings.h"
#include "transaction.h"
#include <boost/foreach.hpp>
COutPoint::COutPoint() { SetNull(); }
COutPoint::COutPoint(uint256 hashIn, uint32_t nIn) { hash = hashIn; n = nIn; }
void COutPoint::SetNull() { hash.SetNull(); n = (uint32_t) -1; }
bool COutPoint::IsNull() const { return (hash.IsNull() && n == (uint32_t) -1); }
bool operator<(const COutPoint& a, const COutPoint& b)
{
return (a.hash < b.hash || (a.hash == b.hash && a.n < b.n));
}
bool operator==(const COutPoint& a, const COutPoint& b)
{
return (a.hash == b.hash && a.n == b.n);
}
bool operator!=(const COutPoint& a, const COutPoint& b)
{
return !(a == b);
}
std::string COutPoint::ToString() const
{
return strprintf("COutPoint(%s, %u)", hash.ToString()/*.substr(0,10)*/, n);
}
std::string COutPoint::ToStringShort() const
{
return strprintf("%s-%u", hash.ToString().substr(0,64), n);
}
uint256 COutPoint::GetHash() const
{
return Hash(BEGIN(hash), END(hash), BEGIN(n), END(n));
}
CTxIn::CTxIn()
{
nSequence = std::numeric_limits<uint32_t>::max();
}
bool CTxIn::IsFinal() const
{
return (nSequence == std::numeric_limits<uint32_t>::max());
}
bool operator==(const CTxIn& a, const CTxIn& b)
{
return (a.prevout == b.prevout &&
a.scriptSig == b.scriptSig &&
a.nSequence == b.nSequence);
}
bool operator!=(const CTxIn& a, const CTxIn& b)
{
return !(a == b);
}
CTxIn::CTxIn(COutPoint prevoutIn, CScript scriptSigIn, uint32_t nSequenceIn)
{
prevout = prevoutIn;
scriptSig = scriptSigIn;
nSequence = nSequenceIn;
}
CTxIn::CTxIn(uint256 hashPrevTx, uint32_t nOut, CScript scriptSigIn, uint32_t nSequenceIn)
{
prevout = COutPoint(hashPrevTx, nOut);
scriptSig = scriptSigIn;
nSequence = nSequenceIn;
}
std::string CTxIn::ToString() const
{
std::string str;
str += "CTxIn(";
str += prevout.ToString();
if (prevout.IsNull())
str += strprintf(", coinbase %s", HexStr(scriptSig));
else
str += strprintf(", scriptSig=%s", scriptSig.ToString().substr(0,24));
if (nSequence != std::numeric_limits<unsigned int>::max())
str += strprintf(", nSequence=%u", nSequence);
str += ")";
return str;
}
CTxOut::CTxOut()
{
SetNull();
}
void CTxOut::SetNull()
{
nValue = -1;
scriptPubKey.clear();
}
bool CTxOut::IsNull() const
{
return (nValue == -1);
}
void CTxOut::SetEmpty()
{
nValue = 0;
scriptPubKey.clear();
}
bool CTxOut::IsEmpty() const
{
return (nValue == 0 && scriptPubKey.empty());
}
bool operator==(const CTxOut& a, const CTxOut& b)
{
return (a.nValue == b.nValue &&
a.scriptPubKey == b.scriptPubKey);
}
bool operator!=(const CTxOut& a, const CTxOut& b)
{
return !(a == b);
}
CTxOut::CTxOut(const CAmount& nValueIn, CScript scriptPubKeyIn)
{
nValue = nValueIn;
scriptPubKey = scriptPubKeyIn;
}
uint256 CTxOut::GetHash() const
{
return SerializeHash(*this);
}
std::string CTxOut::ToString() const
{
return strprintf("CTxOut(nValue=%d.%08d, scriptPubKey=%s)", nValue / COIN, nValue % COIN, scriptPubKey.ToString().substr(0,30));
}
bool CTransaction::IsNull() const {
return vin.empty() && vout.empty();
}
const uint256& CTransaction::GetHash() const {
return hash;
}
bool CTransaction::IsCoinBase() const
{
return (vin.size() == 1 && vin[0].prevout.IsNull());
}
bool CTransaction::IsCoinStake() const
{
// ppcoin: the coin stake transaction is marked with the first output empty
return (vin.size() > 0 && (!vin[0].prevout.IsNull()) && vout.size() >= 2 && vout[0].IsEmpty());
}
bool operator==(const CTransaction& a, const CTransaction& b)
{
return a.hash == b.hash;
}
bool operator!=(const CTransaction& a, const CTransaction& b)
{
return a.hash != b.hash;
}
uint256 CMutableTransaction::GetBareTxid() const
{
return CTransaction(*this).GetBareTxid();
}
bool operator==(const CMutableTransaction& a, const CMutableTransaction& b)
{
return a.GetHash() == b.GetHash();
}
bool operator!=(const CMutableTransaction& a, const CMutableTransaction& b)
{
return !(a == b);
}
CMutableTransaction::CMutableTransaction() : nVersion(CTransaction::CURRENT_VERSION), nLockTime(0) {}
CMutableTransaction::CMutableTransaction(const CTransaction& tx) : nVersion(tx.nVersion), vin(tx.vin), vout(tx.vout), nLockTime(tx.nLockTime) {}
uint256 CMutableTransaction::GetHash() const
{
return SerializeHash(*this);
}
std::string CMutableTransaction::ToString() const
{
std::string str;
str += strprintf("CMutableTransaction(ver=%d, vin.size=%u, vout.size=%u, nLockTime=%u)\n",
nVersion,
vin.size(),
vout.size(),
nLockTime);
for (unsigned int i = 0; i < vin.size(); i++)
str += " " + vin[i].ToString() + "\n";
for (unsigned int i = 0; i < vout.size(); i++)
str += " " + vout[i].ToString() + "\n";
return str;
}
CAmount CMutableTransaction::GetValueOut() const
{
CAmount nValueOut = 0;
for (std::vector<CTxOut>::const_iterator it(vout.begin()); it != vout.end(); ++it)
{
if (it->nValue < 0)
return -1;
if ((nValueOut + it->nValue) < nValueOut)
return -1;
nValueOut += it->nValue;
}
return nValueOut;
}
void CTransaction::UpdateHash() const
{
*const_cast<uint256*>(&hash) = SerializeHash(*this);
}
uint256 CTransaction::GetBareTxid () const
{
if (IsCoinBase())
{
/* For coinbase transactions, the bare txid equals the normal one.
They don't contain a real signature anyway, but the scriptSig
is needed to distinguish them and make sure we won't have two
transactions with the same bare txid.
In practice on mainnet, this has no influence, since no more
coinbases are created after the fork activation (since the network
is on PoS for a long time). We still need this here to make sure
all works fine in tests and is just correct in general. */
return GetHash();
}
CMutableTransaction withoutSigs(*this);
for (auto& in : withoutSigs.vin)
in.scriptSig.clear();
return withoutSigs.GetHash();
}
CTransaction::CTransaction() : hash(), nVersion(CTransaction::CURRENT_VERSION), vin(), vout(), nLockTime(0) { }
CTransaction::CTransaction(const CMutableTransaction &tx) : nVersion(tx.nVersion), vin(tx.vin), vout(tx.vout), nLockTime(tx.nLockTime) {
UpdateHash();
}
CTransaction& CTransaction::operator=(const CTransaction &tx) {
*const_cast<int*>(&nVersion) = tx.nVersion;
*const_cast<std::vector<CTxIn>*>(&vin) = tx.vin;
*const_cast<std::vector<CTxOut>*>(&vout) = tx.vout;
*const_cast<unsigned int*>(&nLockTime) = tx.nLockTime;
*const_cast<uint256*>(&hash) = tx.hash;
return *this;
}
CAmount CTransaction::GetValueOut() const
{
CAmount nValueOut = 0;
for (std::vector<CTxOut>::const_iterator it(vout.begin()); it != vout.end(); ++it)
{
if (it->nValue < 0)
throw std::runtime_error("CTransaction::GetValueOut() : value out of range : less than 0");
if ((nValueOut + it->nValue) < nValueOut)
throw std::runtime_error("CTransaction::GetValueOut() : value out of range : wraps the int64_t boundary");
nValueOut += it->nValue;
}
return nValueOut;
}
std::string CTransaction::ToString() const
{
std::string str;
str += strprintf("CTransaction(%s, ver=%d, vin.size=%u, vout.size=%u, nLockTime=%u)\n",
ToStringShort(),
nVersion,
vin.size(),
vout.size(),
nLockTime);
for (unsigned int i = 0; i < vin.size(); i++)
str += " " + vin[i].ToString() + "\n";
for (unsigned int i = 0; i < vout.size(); i++)
str += " " + vout[i].ToString() + "\n";
return str;
}
std::string CTransaction::ToStringShort() const
{
return GetHash().ToString().substr(0, 10);
}
| 26.14375 | 144 | 0.636505 | [
"vector"
] |
06f886ee129f346f8f07f3efb1598fe4ccd69ea1 | 1,329 | cpp | C++ | practice/everyoneIsAwinnerCodeforces.cpp | xenowits/cp | 963b3c7df65b5328d5ce5ef894a46691afefb98c | [
"MIT"
] | null | null | null | practice/everyoneIsAwinnerCodeforces.cpp | xenowits/cp | 963b3c7df65b5328d5ce5ef894a46691afefb98c | [
"MIT"
] | null | null | null | practice/everyoneIsAwinnerCodeforces.cpp | xenowits/cp | 963b3c7df65b5328d5ce5ef894a46691afefb98c | [
"MIT"
] | null | null | null | //xenowitz -- Jai Shree Ram
#include<bits/stdc++.h>
using namespace std;
#define fori(i,a,b) for (long long int i = a; i <= b ; ++i)
#define ford(i,a,b) for(long long int i = a;i >= b ; --i)
#define mk make_pair
#define mod 998244353
#define pb push_back
#define ll long long
#define ld long double
#define MAXN (ll)1e6+5
#define rnd mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().cnt())
#define pi pair<long long int,long long int>
#define sc second
#define fs first
vector<ll> v;
ll binpow(ll a, ll b) {
ll res = 1;
while (b > 0) {
if (b & 1)
res = res * a;
a = a * a;
b >>= 1;
}
return res;
}
void solve(ll n) {
v.pb(0); //for x > n
ll temp, current = n;
while (current > 0) {
if (current == 0) {
cout << "blunder" << endl;
exit(0);
}
temp = n/current;
v.pb(temp);
ll temp1 = floor(n/(temp+1.000000));
//all x > temp1 have the same floor value i.e., temp
//cout << temp << " is the temp and temp1 " << temp1 << endl;
current = temp1;
//cout << current << endl;
}
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while (t--) {
ll n;
cin >> n;
solve(n);
cout << v.size() << endl;
for(auto x : v) {
cout << x << " ";
}
cout << endl;
v.clear();
}
return 0;
}
| 18.458333 | 89 | 0.563582 | [
"vector"
] |
06f8f6b80f4800febb4ea0101ee3504657c534f4 | 3,254 | cpp | C++ | algospot/lec4/lec4_HS.cpp | cutz-j/AlgorithmStudy | de0f81220e29bd5e109d174800f507b12a3bee36 | [
"MIT"
] | 3 | 2019-11-26T14:31:01.000Z | 2020-01-10T18:19:46.000Z | algospot/lec4/lec4_HS.cpp | cutz-j/AlgorithmStudy | de0f81220e29bd5e109d174800f507b12a3bee36 | [
"MIT"
] | null | null | null | algospot/lec4/lec4_HS.cpp | cutz-j/AlgorithmStudy | de0f81220e29bd5e109d174800f507b12a3bee36 | [
"MIT"
] | null | null | null | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<double> c4_3(const vector<double>& A, int M) {
vector<double> ret;
int N = A.size();
for (int i = M - 1; i < N; ++i) {
double partialSum = 0;
for (int j = 0; j < M; ++j)
partialSum += A[i - j];
ret.push_back(partialSum / M);
}
return ret;
}
vector<double> c4_4(const vector<double>& A, int M) {
vector<double> ret;
double partialSum = 0;
int N = A.size();
for (int i = 0; i < M-1; i++)
partialSum += A[i];
for (int i = M - 1; i < N; i++) {
partialSum += A[i];
ret.push_back(partialSum / M);
partialSum -= A[i - M + 1];
}
return ret;
}
//int selectMenu(vector<int>& menu, int food) {
// const int INF = 987654321;
// int M = 0;
// bool canEverybodyEat(const vector<int> & menu);
// if (food == M) {
// if (canEverybodyEat(menu)) return menu.size();
// return INF;
// }
// int ret = selectMenu(menu, food + 1);
// menu.push_back(food);
// ret = min(ret, selectMenu(menu, food + 1));
// menu.pop_back();
// return ret;
//}
const int MIN = numeric_limits<int>::min();
int inefficientMaxSum(const vector<int>& A) {
int N = A.size(), ret = MIN;
for (int i = 0; i < N; ++i) {
for (int j = 0; j < N; ++j) {
int sum = 0;
for (int k = i; k <= j; ++k) {
sum += A[k];
}
ret = max(ret, sum);
}
}
return ret;
}
int betterMaxSum(const vector<int>& A) {
int N = A.size(), ret = MIN;
for (int i = 0; i < N; ++i) {
int sum = 0;
for (int j = i; j < N; ++j) {
sum += A[j];
ret = max(ret, sum);
}
}
return ret;
}
int divideMaxSum(const vector<int>& A, int lo, int hi) {
if (lo == hi)
return A[lo];
int mid = (lo + hi) / 2;
int left = MIN;
int right = MIN;
int sum = 0;
for (int i = mid; i >= lo; --i) {
sum += A[i];
left = max(left, sum);
}
sum = 0;
for (int j = mid + 1; j <= hi; ++j) {
sum += A[j];
right = max(right, sum);
}
int single = max(divideMaxSum(A, lo, mid), divideMaxSum(A, mid + 1, hi));
return max(left + right, single);
}
int dynamicMaxSum(const vector<int>& A) {
int N = A.size();
int ret = MIN;
int psum = 0;
for (int i = 0; i < N; ++i) {
psum = max(psum, 0) + A[i];
ret = max(psum, ret);
}
return ret;
}
int q10818(void) {
int N, num;
cin >> N;
int* arr = new int[N];
int max = -987654321, min = 987654321;
for (int i = 0; i < N; i++) {
cin >> num;
arr[i] = num;
}
for (int i = 0; i < N; i++) {
if (max <= arr[i])
max = arr[i];
if (min >= arr[i])
min = arr[i];
}
printf("%d %d", min, max);
return 0;
}
int q3052(void) {
int N, lf;
int res = 0;
int arr[42];
for (int i = 0; i < 42; i++) {
arr[i] = 0;
}
for (int i = 0; i < 10; i++) {
cin >> N;
lf = N % 42;
arr[lf] = 1;
}
for (int i = 0; i < 42; i++) {
res += arr[i];
}
cout << res;
return 1;
}
int q1546(void) {
int N, num;
cin >> N;
int* arr = new int[N];
int max = -987654321;
int idx = 0;
int allsum = 0;
for (int i = 0; i < N; i++) {
cin >> num;
arr[i] = num;
}
for (int i = 0; i < N; i++) {
if (arr[i] >= max) {
max = arr[i];
}
}
for (int i = 0; i < N; i++) {
idx = arr[i] / max * 100;
allsum += idx;
}
cout << allsum/N;
return 0;
}
int main(void) {
//q10818();
//q3052();
q1546();
return 0;
}
| 16.602041 | 74 | 0.514751 | [
"vector"
] |
660199f2a40db2717704bf86070676c1932685ed | 4,103 | cpp | C++ | detectors/local2D/detection/simple_ransac_detection/Model.cpp | j-polden/opendetection | 0fa2f2d7da2fd5489a5935a923a4d621723fa5f0 | [
"BSD-3-Clause"
] | 119 | 2016-02-29T20:39:28.000Z | 2022-01-02T11:26:50.000Z | detectors/local2D/detection/simple_ransac_detection/Model.cpp | j-polden/opendetection | 0fa2f2d7da2fd5489a5935a923a4d621723fa5f0 | [
"BSD-3-Clause"
] | 13 | 2016-02-27T02:55:42.000Z | 2019-08-23T19:09:47.000Z | detectors/local2D/detection/simple_ransac_detection/Model.cpp | j-polden/opendetection | 0fa2f2d7da2fd5489a5935a923a4d621723fa5f0 | [
"BSD-3-Clause"
] | 67 | 2015-10-07T02:41:18.000Z | 2021-07-05T04:37:33.000Z | /*
* Model.cpp
*
* Created on: Apr 9, 2014
* Author: edgar
*/
#include <fstream>
#include <iostream>
#include <pugixml.hpp>
#include "Model.h"
#include "CsvWriter.h"
#include <sstream>
#include <ostream>
#include <boost/algorithm/string.hpp>
Model::Model() : list_points2d_in_(0), list_points2d_out_(0), list_points3d_in_(0)
{
n_correspondences_ = 0;
}
Model::~Model()
{
// TODO Auto-generated destructor stub
}
void Model::add_correspondence(const cv::Point2f &point2d, const cv::Point3f &point3d)
{
list_points2d_in_.push_back(point2d);
list_points3d_in_.push_back(point3d);
n_correspondences_++;
}
void Model::add_outlier(const cv::Point2f &point2d)
{
list_points2d_out_.push_back(point2d);
}
void Model::add_descriptor(const cv::Mat &descriptor)
{
descriptors_.push_back(descriptor);
}
void Model::add_keypoint(const cv::KeyPoint &kp)
{
list_keypoints_.push_back(kp);
}
/** Save a CSV file and fill the object mesh */
void Model::save(const std::string path)
{
cv::Mat points3dmatrix = cv::Mat(list_points3d_in_);
cv::Mat points2dmatrix = cv::Mat(list_points2d_in_);
//cv::Mat keyPointmatrix = cv::Mat(list_keypoints_);
cv::FileStorage storage(path, cv::FileStorage::WRITE);
storage << "points_3d" << points3dmatrix;
storage << "points_2d" << points2dmatrix;
storage << "keypoints" << list_keypoints_;
storage << "descriptors" << descriptors_;
storage.release();
}
/** Load a YAML file using OpenCv functions **/
void Model::load(const std::string path)
{
cv::Mat points3d_mat;
cv::FileStorage storage(path, cv::FileStorage::READ);
storage["points_3d"] >> points3d_mat;
storage["descriptors"] >> descriptors_;
points3d_mat.copyTo(list_points3d_in_);
std::cout << list_points3d_in_.size() << endl;
std::cout << descriptors_;
storage.release();
id = path;
}
void Model::load_new_desc(const std::string path)
{
f_type = "SIFT";
std::fstream infile(path.c_str());
if (!infile.is_open())
{
std::cout << "ERRROR opening model file!!";
return ;
}
int nop, desc_size, point_size;
infile >> nop;
infile >> point_size >> desc_size;
descriptors_ = Mat(nop, desc_size, CV_32FC1);
for (int i = 0; i < nop; i++)
{
float x, y, z;
infile >> x >> y >> z;
cv::Point3f p3d(x, y, z);
list_points3d_in_.push_back(p3d);
cv::KeyPoint kp;
infile >> kp.pt.x >> kp.pt.y >> kp.octave >> kp.angle >> kp.response >> kp.size;
list_keypoints_.push_back(kp);
for (int j = 0; j < desc_size; j++)
{
infile >> descriptors_.at<float>(i, j);
}
}
id = path;
}
template <typename T>
string ps ( T thing )
{
cout << thing;
ostringstream ss;
ss << thing;
return ss.str();
}
void Model::load_new_xml(const std::string path)
{
pugi::xml_document doc;
pugi::xml_parse_result result = doc.load_file(path.c_str());
if (!result)
{
std::cout << "ERRROR opening model file!!";
return ;
}
pugi::xml_node pts_node = doc.child("Model").child("Points");
if (pts_node.first_child())
f_type = pts_node.first_child().attribute("desc_type").as_string();
else return;
for (pugi::xml_node pt_node = pts_node.first_child(); pt_node; pt_node = pt_node.next_sibling())
{
Mat single_desc = Mat::zeros(1, get_descriptor_size(), CV_32FC1);
stringstream ss;
ss.str(pt_node.attribute("p3d").as_string());
float x, y, z;
ss >> x >> y >> z; ss.clear();
cv::Point3f p3d(x, y, z);
list_points3d_in_.push_back(p3d);
ss.str(pt_node.attribute("p2d_prop").as_string());
cv::KeyPoint kp;
ss >> kp.pt.x >> kp.pt.y >> kp.octave >> kp.angle >> kp.response >> kp.size; ss.clear();
list_keypoints_.push_back(kp);
ss.str(pt_node.attribute("desc").as_string());
float d;
for(int it = 0; it < get_descriptor_size(); it ++)
{
ss >> d;
//cout <<it << " " << ss.eof() << " " << d << endl;
single_desc.at<float> (0, it) = d;
}
ss.clear();
descriptors_.push_back(single_desc);
}
id = path;
//std::cout << list_points3d_in_.size() << endl;
//std::cout << descriptors_;
}
| 22.543956 | 98 | 0.647331 | [
"mesh",
"object",
"model"
] |
66099005ec393cf0b80dc825766a833fcad52f36 | 18,088 | cpp | C++ | src/bridges/variant_array_bridge.cpp | ShalokShalom/godot-jvm | 7b9b195de5be4a0b88b9831c3a02f9ca06aa399c | [
"MIT"
] | null | null | null | src/bridges/variant_array_bridge.cpp | ShalokShalom/godot-jvm | 7b9b195de5be4a0b88b9831c3a02f9ca06aa399c | [
"MIT"
] | null | null | null | src/bridges/variant_array_bridge.cpp | ShalokShalom/godot-jvm | 7b9b195de5be4a0b88b9831c3a02f9ca06aa399c | [
"MIT"
] | null | null | null | #include <core/reference.h>
#include <modules/kotlin_jvm/src/gd_kotlin.h>
#include "variant_array_bridge.h"
#include "constants.h"
#include "bridges_utils.h"
using namespace bridges;
JNI_INIT_STATICS_FOR_CLASS(VariantArrayBridge)
VariantArrayBridge::VariantArrayBridge(jni::JObject p_wrapped, jni::JObject p_class_loader)
: JavaInstanceWrapper(VARIANT_ARRAY_BRIDGE_CLASS_NAME, p_wrapped, p_class_loader) {
jni::JNativeMethod engine_call_constructor_method {
"engine_call_constructor",
"()J",
(void*) VariantArrayBridge::engine_call_constructor
};
jni::JNativeMethod engine_call_get_size_method {
"engine_call_get_size",
"(J)V",
(void*) VariantArrayBridge::engine_call_get_size
};
jni::JNativeMethod engine_call_clear_method {
"engine_call_clear",
"(J)V",
(void*) VariantArrayBridge::engine_call_clear
};
jni::JNativeMethod engine_call_empty_method {
"engine_call_empty",
"(J)V",
(void*) VariantArrayBridge::engine_call_empty
};
jni::JNativeMethod engine_call_hash_method {
"engine_call_hash",
"(J)V",
(void*) VariantArrayBridge::engine_call_hash
};
jni::JNativeMethod engine_call_invert_method {
"engine_call_invert",
"(J)V",
(void*) VariantArrayBridge::engine_call_invert
};
jni::JNativeMethod engine_call_remove_method {
"engine_call_remove",
"(J)V",
(void*) VariantArrayBridge::engine_call_remove
};
jni::JNativeMethod engine_call_resize_method {
"engine_call_resize",
"(J)V",
(void*) VariantArrayBridge::engine_call_resize
};
jni::JNativeMethod engine_call_shuffle_method {
"engine_call_shuffle",
"(J)V",
(void*) VariantArrayBridge::engine_call_shuffle
};
jni::JNativeMethod engine_call_sort_method {
"engine_call_sort",
"(J)V",
(void*) VariantArrayBridge::engine_call_sort
};
jni::JNativeMethod engine_call_sortCustom_method {
"engine_call_sortCustom",
"(J)V",
(void*) VariantArrayBridge::engine_call_sortCustom
};
jni::JNativeMethod engine_call_append_method {
"engine_call_append",
"(J)V",
(void*) VariantArrayBridge::engine_call_append
};
jni::JNativeMethod engine_call_bsearch_method {
"engine_call_bsearch",
"(J)V",
(void*) VariantArrayBridge::engine_call_bsearch
};
jni::JNativeMethod engine_call_bsearchCustom_method {
"engine_call_bsearchCustom",
"(J)V",
(void*) VariantArrayBridge::engine_call_bsearchCustom
};
jni::JNativeMethod engine_call_count_method {
"engine_call_count",
"(J)V",
(void*) VariantArrayBridge::engine_call_count
};
jni::JNativeMethod engine_call_duplicate_method {
"engine_call_duplicate",
"(J)V",
(void*) VariantArrayBridge::engine_call_duplicate
};
jni::JNativeMethod engine_call_erase_method {
"engine_call_erase",
"(J)V",
(void*) VariantArrayBridge::engine_call_erase
};
jni::JNativeMethod engine_call_find_method {
"engine_call_find",
"(J)V",
(void*) VariantArrayBridge::engine_call_find
};
jni::JNativeMethod engine_call_findLast_method {
"engine_call_findLast",
"(J)V",
(void*) VariantArrayBridge::engine_call_findLast
};
jni::JNativeMethod engine_call_front_method {
"engine_call_front",
"(J)V",
(void*) VariantArrayBridge::engine_call_front
};
jni::JNativeMethod engine_call_has_method {
"engine_call_has",
"(J)V",
(void*) VariantArrayBridge::engine_call_has
};
jni::JNativeMethod engine_call_insert_method {
"engine_call_insert",
"(J)V",
(void*) VariantArrayBridge::engine_call_insert
};
jni::JNativeMethod engine_call_max_method {
"engine_call_max",
"(J)V",
(void*) VariantArrayBridge::engine_call_max
};
jni::JNativeMethod engine_call_min_method {
"engine_call_min",
"(J)V",
(void*) VariantArrayBridge::engine_call_min
};
jni::JNativeMethod engine_call_popBack_method {
"engine_call_popBack",
"(J)V",
(void*) VariantArrayBridge::engine_call_popBack
};
jni::JNativeMethod engine_call_popFront_method {
"engine_call_popFront",
"(J)V",
(void*) VariantArrayBridge::engine_call_popFront
};
jni::JNativeMethod engine_call_pushBack_method {
"engine_call_pushBack",
"(J)V",
(void*) VariantArrayBridge::engine_call_pushBack
};
jni::JNativeMethod engine_call_pushFront_method {
"engine_call_pushFront",
"(J)V",
(void*) VariantArrayBridge::engine_call_pushFront
};
jni::JNativeMethod engine_call_rfind_method {
"engine_call_rfind",
"(J)V",
(void*) VariantArrayBridge::engine_call_rfind
};
jni::JNativeMethod engine_call_slice_method {
"engine_call_slice",
"(J)V",
(void*) VariantArrayBridge::engine_call_slice
};
jni::JNativeMethod engine_call_operator_set_method {
"engine_call_operator_set",
"(J)V",
(void*) VariantArrayBridge::engine_call_operator_set
};
jni::JNativeMethod engine_call_operator_get_method {
"engine_call_operator_get",
"(J)V",
(void*) VariantArrayBridge::engine_call_operator_get
};
Vector<jni::JNativeMethod> methods;
methods.push_back(engine_call_constructor_method);
methods.push_back(engine_call_get_size_method);
methods.push_back(engine_call_clear_method);
methods.push_back(engine_call_empty_method);
methods.push_back(engine_call_hash_method);
methods.push_back(engine_call_invert_method);
methods.push_back(engine_call_remove_method);
methods.push_back(engine_call_resize_method);
methods.push_back(engine_call_shuffle_method);
methods.push_back(engine_call_sort_method);
methods.push_back(engine_call_sortCustom_method);
methods.push_back(engine_call_append_method);
methods.push_back(engine_call_bsearch_method);
methods.push_back(engine_call_bsearchCustom_method);
methods.push_back(engine_call_count_method);
methods.push_back(engine_call_duplicate_method);
methods.push_back(engine_call_erase_method);
methods.push_back(engine_call_find_method);
methods.push_back(engine_call_findLast_method);
methods.push_back(engine_call_front_method);
methods.push_back(engine_call_has_method);
methods.push_back(engine_call_insert_method);
methods.push_back(engine_call_max_method);
methods.push_back(engine_call_min_method);
methods.push_back(engine_call_popBack_method);
methods.push_back(engine_call_popFront_method);
methods.push_back(engine_call_pushBack_method);
methods.push_back(engine_call_pushFront_method);
methods.push_back(engine_call_rfind_method);
methods.push_back(engine_call_slice_method);
methods.push_back(engine_call_operator_set_method);
methods.push_back(engine_call_operator_get_method);
jni::Env env{jni::Jvm::current_env()};
j_class.register_natives(env, methods);
p_wrapped.delete_local_ref(env);
}
uintptr_t VariantArrayBridge::engine_call_constructor(JNIEnv* p_raw_env, jobject p_instance) {
return reinterpret_cast<uintptr_t>(memnew(Array));
}
void VariantArrayBridge::engine_call_get_size(JNIEnv* p_raw_env, jobject p_instance, jlong p_raw_ptr) {
jni::Env env{p_raw_env};
Variant variant{from_uint_to_ptr<Array>(p_raw_ptr)->size()};
GDKotlin::get_instance().transfer_context->write_return_value(env, variant);
}
void VariantArrayBridge::engine_call_clear(JNIEnv* p_raw_env, jobject p_instance, jlong p_raw_ptr) {
from_uint_to_ptr<Array>(p_raw_ptr)->clear();
}
void VariantArrayBridge::engine_call_empty(JNIEnv* p_raw_env, jobject p_instance, jlong p_raw_ptr) {
jni::Env env{p_raw_env};
Variant variant{from_uint_to_ptr<Array>(p_raw_ptr)->empty()};
GDKotlin::get_instance().transfer_context->write_return_value(env, variant);
}
void VariantArrayBridge::engine_call_hash(JNIEnv* p_raw_env, jobject p_instance, jlong p_raw_ptr) {
jni::Env env{p_raw_env};
Variant variant{from_uint_to_ptr<Array>(p_raw_ptr)->hash()};
GDKotlin::get_instance().transfer_context->write_return_value(env, variant);
}
void VariantArrayBridge::engine_call_invert(JNIEnv* p_raw_env, jobject p_instance, jlong p_raw_ptr) {
from_uint_to_ptr<Array>(p_raw_ptr)->invert();
}
void VariantArrayBridge::engine_call_remove(JNIEnv* p_raw_env, jobject p_instance, jlong p_raw_ptr) {
jni::Env env{p_raw_env};
Variant args[1] = {};
GDKotlin::get_instance().transfer_context->read_args(env, args);
from_uint_to_ptr<Array>(p_raw_ptr)->remove(args[0].operator int64_t());
}
void VariantArrayBridge::engine_call_resize(JNIEnv* p_raw_env, jobject p_instance, jlong p_raw_ptr) {
jni::Env env{p_raw_env};
Variant args[1] = {};
GDKotlin::get_instance().transfer_context->read_args(env, args);
from_uint_to_ptr<Array>(p_raw_ptr)->resize(args[0].operator int64_t());
}
void VariantArrayBridge::engine_call_shuffle(JNIEnv* p_raw_env, jobject p_instance, jlong p_raw_ptr) {
from_uint_to_ptr<Array>(p_raw_ptr)->shuffle();
}
void VariantArrayBridge::engine_call_sort(JNIEnv* p_raw_env, jobject p_instance, jlong p_raw_ptr) {
from_uint_to_ptr<Array>(p_raw_ptr)->sort();
}
void VariantArrayBridge::engine_call_sortCustom(JNIEnv* p_raw_env, jobject p_instance, jlong p_raw_ptr) {
jni::Env env{p_raw_env};
Variant args[2] = {};
GDKotlin::get_instance().transfer_context->read_args(env, args);
from_uint_to_ptr<Array>(p_raw_ptr)->sort_custom(args[0].operator Object *(), args[1].operator String());
}
void VariantArrayBridge::engine_call_append(JNIEnv* p_raw_env, jobject p_instance, jlong p_raw_ptr) {
jni::Env env{p_raw_env};
Variant args[1] = {};
GDKotlin::get_instance().transfer_context->read_args(env, args);
from_uint_to_ptr<Array>(p_raw_ptr)->append(args[0]);
}
void VariantArrayBridge::engine_call_bsearch(JNIEnv* p_raw_env, jobject p_instance, jlong p_raw_ptr) {
jni::Env env{p_raw_env};
Variant args[2] = {};
TransferContext* transfer_context{GDKotlin::get_instance().transfer_context};
transfer_context->read_args(env, args);
Variant variant{from_uint_to_ptr<Array>(p_raw_ptr)->bsearch(args[0], args[1].operator bool())};
transfer_context->write_return_value(env, variant);
}
void VariantArrayBridge::engine_call_bsearchCustom(JNIEnv* p_raw_env, jobject p_instance, jlong p_raw_ptr) {
jni::Env env{p_raw_env};
Variant args[4] = {};
TransferContext* transfer_context{GDKotlin::get_instance().transfer_context};
transfer_context->read_args(env, args);
Variant variant{from_uint_to_ptr<Array>(p_raw_ptr)->bsearch_custom(
args[0], args[1].operator Object *(), args[2].operator String(), args[3].operator bool()
)};
transfer_context->write_return_value(env, variant);
}
void VariantArrayBridge::engine_call_count(JNIEnv* p_raw_env, jobject p_instance, jlong p_raw_ptr) {
jni::Env env{p_raw_env};
Variant args[1] = {};
GDKotlin::get_instance().transfer_context->read_args(env, args);
Variant variant{from_uint_to_ptr<Array>(p_raw_ptr)->count(args[0].operator Object *())};
}
void VariantArrayBridge::engine_call_duplicate(JNIEnv* p_raw_env, jobject p_instance, jlong p_raw_ptr) {
jni::Env env{p_raw_env};
Variant args[1] = {};
TransferContext* transfer_context = GDKotlin::get_instance().transfer_context;
transfer_context->read_args(env, args);
Variant variant{from_uint_to_ptr<Array>(p_raw_ptr)->duplicate(args[0].operator bool())};
transfer_context->write_return_value(env, variant);
}
void VariantArrayBridge::engine_call_erase(JNIEnv* p_raw_env, jobject p_instance, jlong p_raw_ptr) {
jni::Env env{p_raw_env};
Variant args[1] = {};
GDKotlin::get_instance().transfer_context->read_args(env, args);
from_uint_to_ptr<Array>(p_raw_ptr)->erase(args[0]);
}
void VariantArrayBridge::engine_call_find(JNIEnv* p_raw_env, jobject p_instance, jlong p_raw_ptr) {
jni::Env env{p_raw_env};
Variant args[2] = {};
TransferContext* transfer_context = GDKotlin::get_instance().transfer_context;
transfer_context->read_args(env, args);
Variant variant{from_uint_to_ptr<Array>(p_raw_ptr)->find(args[0], args[1].operator int64_t())};
transfer_context->write_return_value(env, variant);
}
void VariantArrayBridge::engine_call_findLast(JNIEnv* p_raw_env, jobject p_instance, jlong p_raw_ptr) {
jni::Env env{p_raw_env};
Variant args[1] = {};
TransferContext* transfer_context = GDKotlin::get_instance().transfer_context;
transfer_context->read_args(env, args);
Variant variant{from_uint_to_ptr<Array>(p_raw_ptr)->find_last(args[0].operator Object *())};
transfer_context->write_return_value(env, variant);
}
void VariantArrayBridge::engine_call_front(JNIEnv* p_raw_env, jobject p_instance, jlong p_raw_ptr) {
jni::Env env{p_raw_env};
Variant variant{from_uint_to_ptr<Array>(p_raw_ptr)->front()};
GDKotlin::get_instance().transfer_context->write_return_value(env, variant);
}
void VariantArrayBridge::engine_call_has(JNIEnv* p_raw_env, jobject p_instance, jlong p_raw_ptr) {
jni::Env env{p_raw_env};
Variant args[1] = {};
TransferContext* transfer_context = GDKotlin::get_instance().transfer_context;
transfer_context->read_args(env, args);
Variant variant{from_uint_to_ptr<Array>(p_raw_ptr)->has(args[0])};
transfer_context->write_return_value(env, variant);
}
void VariantArrayBridge::engine_call_insert(JNIEnv* p_raw_env, jobject p_instance, jlong p_raw_ptr) {
jni::Env env{p_raw_env};
Variant args[2] = {};
GDKotlin::get_instance().transfer_context->read_args(env, args);
from_uint_to_ptr<Array>(p_raw_ptr)->insert(args[0].operator int64_t(), args[1].operator Object *());
}
void VariantArrayBridge::engine_call_max(JNIEnv* p_raw_env, jobject p_instance, jlong p_raw_ptr) {
jni::Env env{p_raw_env};
Variant variant{from_uint_to_ptr<Array>(p_raw_ptr)->max()};
GDKotlin::get_instance().transfer_context->write_return_value(env, variant);
}
void VariantArrayBridge::engine_call_min(JNIEnv* p_raw_env, jobject p_instance, jlong p_raw_ptr) {
jni::Env env{p_raw_env};
Variant variant{from_uint_to_ptr<Array>(p_raw_ptr)->min()};
GDKotlin::get_instance().transfer_context->write_return_value(env, variant);
}
void VariantArrayBridge::engine_call_popBack(JNIEnv* p_raw_env, jobject p_instance, jlong p_raw_ptr) {
jni::Env env{p_raw_env};
Variant variant{from_uint_to_ptr<Array>(p_raw_ptr)->pop_back()};
GDKotlin::get_instance().transfer_context->write_return_value(env, variant);
}
void VariantArrayBridge::engine_call_popFront(JNIEnv* p_raw_env, jobject p_instance, jlong p_raw_ptr) {
jni::Env env{p_raw_env};
Variant variant{from_uint_to_ptr<Array>(p_raw_ptr)->pop_front()};
GDKotlin::get_instance().transfer_context->write_return_value(env, variant);
}
void VariantArrayBridge::engine_call_pushBack(JNIEnv* p_raw_env, jobject p_instance, jlong p_raw_ptr) {
jni::Env env{p_raw_env};
Variant args[1] = {};
GDKotlin::get_instance().transfer_context->read_args(env, args);
from_uint_to_ptr<Array>(p_raw_ptr)->push_back(args[0]);
}
void VariantArrayBridge::engine_call_pushFront(JNIEnv* p_raw_env, jobject p_instance, jlong p_raw_ptr) {
jni::Env env{p_raw_env};
Variant args[1] = {};
GDKotlin::get_instance().transfer_context->read_args(env, args);
from_uint_to_ptr<Array>(p_raw_ptr)->push_front(args[0]);
}
void VariantArrayBridge::engine_call_rfind(JNIEnv* p_raw_env, jobject p_instance, jlong p_raw_ptr) {
jni::Env env{p_raw_env};
Variant args[2] = {};
TransferContext* transfer_context = GDKotlin::get_instance().transfer_context;
transfer_context->read_args(env, args);
Variant variant{from_uint_to_ptr<Array>(p_raw_ptr)->rfind(args[0], args[1].operator int64_t())};
transfer_context->write_return_value(env, variant);
}
void VariantArrayBridge::engine_call_slice(JNIEnv* p_raw_env, jobject p_instance, jlong p_raw_ptr) {
jni::Env env{p_raw_env};
Variant args[4] = {};
TransferContext* transfer_context = GDKotlin::get_instance().transfer_context;
transfer_context->read_args(env, args);
Variant variant{
from_uint_to_ptr<Array>(p_raw_ptr)->slice(
args[0].operator int64_t(),
args[1].operator int64_t(),
args[2].operator int64_t(),
args[3].operator bool()
)
};
transfer_context->write_return_value(env, variant);
}
void VariantArrayBridge::engine_call_operator_set(JNIEnv* p_raw_env, jobject p_instance, jlong p_raw_ptr) {
jni::Env env{p_raw_env};
Variant args[2] = {};
GDKotlin::get_instance().transfer_context->read_args(env, args);
from_uint_to_ptr<Array>(p_raw_ptr)->set(args[0].operator int64_t(), args[1].operator Object *());
}
void VariantArrayBridge::engine_call_operator_get(JNIEnv* p_raw_env, jobject p_instance, jlong p_raw_ptr) {
jni::Env env{p_raw_env};
Variant args[1] = {};
TransferContext* transfer_context = GDKotlin::get_instance().transfer_context;
transfer_context->read_args(env, args);
Variant variant{from_uint_to_ptr<Array>(p_raw_ptr)->get(args[0])};
transfer_context->write_return_value(env, variant);
}
| 41.015873 | 109 | 0.705108 | [
"object",
"vector"
] |
6609e421d5b004db75a6520f518cbe130a692a23 | 2,572 | cpp | C++ | Evantai/main.cpp | rusucosmin/Cplusplus | 0e95cd01d20b22404aa4166c71d5a9e834a5a21b | [
"MIT"
] | 11 | 2015-08-29T13:41:22.000Z | 2020-01-08T20:34:06.000Z | Evantai/main.cpp | rusucosmin/Cplusplus | 0e95cd01d20b22404aa4166c71d5a9e834a5a21b | [
"MIT"
] | null | null | null | Evantai/main.cpp | rusucosmin/Cplusplus | 0e95cd01d20b22404aa4166c71d5a9e834a5a21b | [
"MIT"
] | 5 | 2016-01-20T18:17:01.000Z | 2019-10-30T11:57:15.000Z | #include <fstream>
#include <vector>
#include <bitset>
#include <algorithm>
using namespace std;
const char outfile[] = "evantai.out";
const int MAXN = 701;
const int MOD = 30103;
const int oo = 0x3f3f3f3f;
typedef vector<int> Graph[MAXN];
typedef vector<int> :: iterator It;
const inline int min(const int &a, const int &b) { if( a > b ) return b; return a; }
const inline int max(const int &a, const int &b) { if( a < b ) return b; return a; }
const inline void Get_min(int &a, const int b) { if( a > b ) a = b; }
const inline void Get_max(int &a, const int b) { if( a < b ) a = b; }
int N, A[MAXN], dp[MAXN][MAXN], aib[MAXN][MAXN];
inline int lsb(int a) {
return a & (-a);
}
inline void Update(int x, int y, int value) {
for(int i = x ; i <= N ; i += lsb(i))
for(int j = y ; j <= N ; j += lsb(j)) {
aib[i][j] += value;
if(aib[i][j] > MOD)
aib[i][j] -= MOD;
}
}
inline int Query(int x, int y) {
int ret = 0;
for( int i = x ; i > 0 ; i -= lsb(i))
for( int j = y ; j > 0 ; j -= lsb(j)) {
ret += aib[i][j];
if(ret > MOD)
ret -= MOD;
}
return ret;
}
FILE* fin=fopen("evantai.in","r");
const unsigned maxb=8192;
char buf[maxb];
unsigned ptr=maxb;
inline unsigned getInt(){
unsigned nr=0;
while(buf[ptr]<'0'||'9'<buf[ptr])
if(++ptr>=maxb)
fread(buf,maxb,1,fin),ptr=0;
while('0'<=buf[ptr]&&buf[ptr]<='9'){
nr=nr*10+buf[ptr]-'0';
if(++ptr>=maxb)
fread(buf,maxb,1,fin),ptr=0;
}
return nr;
}
int main() {
vector<pair<int, pair<int, int> > > v;
N = getInt();
for(int i = 1 ; i <= N ; ++ i)
A[i] = getInt();
for(int i = 1 ; i <= N ; ++ i)
for(int j = i + 1 ; j <= N ; ++ j)
v.push_back(make_pair(A[i] + A[j], make_pair(i, j)));
sort(v.begin(), v.end());
for(int i = 0, M = v.size() ; i < M ; ++ i) {
int newx = v[i].second.first;
int newy = v[i].second.second;
int aux = Query(newy - 1, newy - 1) + Query(newx, newx) - Query(newy - 1, newx) - Query(newx, newy - 1) + 1;
if(aux < 0)
aux += MOD;
Update(newx, newy, aux);
dp[newx][newy] = aux;
}
int Ans = 0;
for(int i = 1 ; i <= N ; ++ i)
for(int j = i + 1 ; j <= N ; ++ j) {
Ans += dp[i][j];
if(Ans > MOD)
Ans -= MOD;
}
ofstream cout(outfile);
cout << Ans << '\n';
cout.close();
return 0;
}
| 26.791667 | 116 | 0.476283 | [
"vector"
] |
660a69dc820612ea4ca8500cc57ef37ff4082052 | 1,461 | hpp | C++ | clstatphys/clstatphys/physics/fixed_boundary_normalmode_fftw.hpp | FIshikawa/ClassicalStatPhys | e4010480d3c7977829c1b3fdeaf51401a2409373 | [
"MIT"
] | null | null | null | clstatphys/clstatphys/physics/fixed_boundary_normalmode_fftw.hpp | FIshikawa/ClassicalStatPhys | e4010480d3c7977829c1b3fdeaf51401a2409373 | [
"MIT"
] | 2 | 2020-01-21T08:54:05.000Z | 2020-01-21T09:29:10.000Z | clstatphys/clstatphys/physics/fixed_boundary_normalmode_fftw.hpp | FIshikawa/ClassicalStatPhys | e4010480d3c7977829c1b3fdeaf51401a2409373 | [
"MIT"
] | 2 | 2020-07-18T03:36:32.000Z | 2021-07-21T22:58:27.000Z | #ifndef FIXED_BOUNDARY_NORMALMODE_FFTW_HPP
#define FIXED_BOUNDARY_NORMALMODE_FFTW_HPP
#include <vector>
#include <fftw3.h>
void FixedBoundaryNormalModeFFTW(const std::vector<double>& z, std::vector<double>& z_k){
int num_particles = z.size() / 2;
const double *x = &z[0];
const double *p = &z[num_particles];
double *x_k = &z_k[0];
double *p_k = &z_k[num_particles];
double *p_in, *p_out, *x_in, *x_out;
fftw_plan plan_momentum, plan_displace;
x_in = (double *) fftw_malloc(sizeof(double) * num_particles);
x_out = (double *) fftw_malloc(sizeof(double) * num_particles);
p_in = (double *) fftw_malloc(sizeof(double) * num_particles);
p_out = (double *) fftw_malloc(sizeof(double) * num_particles);
plan_momentum = fftw_plan_r2r_1d(num_particles, p_in, p_out, FFTW_RODFT00, FFTW_ESTIMATE);
plan_displace = fftw_plan_r2r_1d(num_particles, x_in, x_out, FFTW_RODFT00, FFTW_ESTIMATE);
for(int i = 0; i < num_particles; ++i){
p_in[i] = p[i];
x_in[i] = x[i];
}
fftw_execute(plan_momentum);
fftw_execute(plan_displace);
double normalize_constant = std::sqrt(2*(num_particles+1));
for(int i = 0; i < num_particles; ++i){
p_k[i] = p_out[i] / normalize_constant;
x_k[i] = x_out[i] / normalize_constant;
}
fftw_destroy_plan(plan_momentum);
fftw_destroy_plan(plan_displace);
fftw_free(p_in);
fftw_free(p_out);
fftw_free(x_in);
fftw_free(x_out);
}
#endif //FIXED_BOUNDARY_NORMALMODE_FFTW_HPP
| 29.816327 | 92 | 0.710472 | [
"vector"
] |
66154668c4ababa4f6ea1a0b6b8667c8e535fd6d | 21,835 | cc | C++ | impl/media/base/tizen/media_player_bridge_capi.cc | isabella232/chromium-efl | db2d09aba6498fb09bbea1f8440d071c4b0fde78 | [
"BSD-3-Clause"
] | 9 | 2015-04-09T20:22:08.000Z | 2021-03-17T08:34:56.000Z | impl/media/base/tizen/media_player_bridge_capi.cc | crosswalk-project/chromium-efl | db2d09aba6498fb09bbea1f8440d071c4b0fde78 | [
"BSD-3-Clause"
] | 2 | 2015-02-04T13:41:12.000Z | 2015-05-25T14:00:40.000Z | impl/media/base/tizen/media_player_bridge_capi.cc | isabella232/chromium-efl | db2d09aba6498fb09bbea1f8440d071c4b0fde78 | [
"BSD-3-Clause"
] | 14 | 2015-02-12T16:20:47.000Z | 2022-01-20T10:36:26.000Z | // Copyright 2014 Samsung Electronics Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/base/tizen/media_player_bridge_capi.h"
#include "base/basictypes.h"
#include "base/command_line.h"
#include "base/logging.h"
#include "base/memory/shared_memory.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/strings/string_util.h"
#include "content/public/common/content_switches.h"
#include "media/base/tizen/media_player_manager_tizen.h"
#include "ui/gfx/size.h"
#if defined(OS_TIZEN_MOBILE)
#include <device/power.h>
#endif
namespace {
// Update duration every 100ms.
const int kDurationUpdateInterval = 100;
}
namespace media {
struct ErrorList {
player_error_e error_code;
std::string error_message;
};
// Modify this when new error information is added to |errorlist|.
const int ERROR_MAX = 18;
const struct ErrorList errorlist[ERROR_MAX] = {
{PLAYER_ERROR_OUT_OF_MEMORY, "PLAYER_ERROR_OUT_OF_MEMORY"},
{PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"},
{PLAYER_ERROR_NO_SUCH_FILE, "PLAYER_ERROR_NO_SUCH_FILE"},
{PLAYER_ERROR_INVALID_OPERATION, "PLAYER_ERROR_INVALID_OPERATION"},
{PLAYER_ERROR_FILE_NO_SPACE_ON_DEVICE,
"PLAYER_ERROR_FILE_NO_SPACE_ON_DEVICE"},
#if defined(OS_TIZEN_MOBILE)
{PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE,
"PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE"},
#endif
{PLAYER_ERROR_SEEK_FAILED, "PLAYER_ERROR_SEEK_FAILED"},
{PLAYER_ERROR_INVALID_STATE, "PLAYER_ERROR_INVALID_STATE"},
{PLAYER_ERROR_NOT_SUPPORTED_FILE, "PLAYER_ERROR_NOT_SUPPORTED_FILE"},
{PLAYER_ERROR_INVALID_URI, "PLAYER_ERROR_INVALID_URI"},
{PLAYER_ERROR_SOUND_POLICY, "PLAYER_ERROR_SOUND_POLICY"},
{PLAYER_ERROR_CONNECTION_FAILED, "PLAYER_ERROR_CONNECTION_FAILED"},
{PLAYER_ERROR_VIDEO_CAPTURE_FAILED, "PLAYER_ERROR_VIDEO_CAPTURE_FAILED"},
{PLAYER_ERROR_DRM_EXPIRED, "PLAYER_ERROR_DRM_EXPIRED"},
{PLAYER_ERROR_DRM_NO_LICENSE, "PLAYER_ERROR_DRM_NO_LICENSE"},
{PLAYER_ERROR_DRM_FUTURE_USE, "PLAYER_ERROR_DRM_FUTURE_USE"},
{PLAYER_ERROR_DRM_NOT_PERMITTED, "PLAYER_ERROR_DRM_NOT_PERMITTED"},
{PLAYER_ERROR_RESOURCE_LIMIT, "PLAYER_ERROR_RESOURCE_LIMIT"}};
static Eina_Bool notify_damage_updated_cb(void* data, int type, void* event) {
MediaPlayerBridgeCapi* player = static_cast <MediaPlayerBridgeCapi*>(data);
if (!player)
return ECORE_CALLBACK_PASS_ON;
player->PlatformSurfaceUpdated();
return ECORE_CALLBACK_PASS_ON;
}
static double ConvertMilliSecondsToSeconds(int time) {
double seconds = static_cast<double>(time) /
(base::Time::kMillisecondsPerSecond);
return seconds;
}
static double ConvertSecondsToMilliSeconds(double time) {
if (time < 0) {
LOG(ERROR) << "Invalid time:" << time << " Reset to 0";
time = 0;
}
double seconds = static_cast<double>(time) *
(base::Time::kMillisecondsPerSecond);
return seconds;
}
// Called by player_prepare_async()
void player_prepared_cb(void* user_data) {
MediaPlayerBridgeCapi* player =
static_cast<MediaPlayerBridgeCapi*>(user_data);
if (!player)
return;
player->SetPixmap();
player->ExecuteDelayedPlayerState();
}
// Called by player_set_x11_display_pixmap()
unsigned int pixmap_buffer_ready_cb(void *user_data) {
MediaPlayerBridgeCapi* player =
static_cast<MediaPlayerBridgeCapi*>(user_data);
if (!player)
return -1;
return player->GetSurfaceID();
}
// Called by player_set_completed_cb()
void playback_complete_cb(void* user_data) {
MediaPlayerBridgeCapi* player =
static_cast<MediaPlayerBridgeCapi*>(user_data);
if (!player)
return;
player->PlaybackCompleteUpdate();
}
// Called by player_set_play_position()
void seek_complete_cb(void* user_data) {
MediaPlayerBridgeCapi* player =
static_cast<MediaPlayerBridgeCapi*>(user_data);
if (!player)
return;
player->SeekCompleteUpdate();
}
// Called by player_set_buffering_cb()
void changed_buffering_status_cb(int percent, void *user_data) {
MediaPlayerBridgeCapi* player =
static_cast<MediaPlayerBridgeCapi*>(user_data);
if (!player)
return;
player->HandleBufferingStatus(percent);
}
// Called by player_set_error_cb()
void error_cb(int error_code, void *user_data) {
MediaPlayerBridgeCapi* player =
static_cast<MediaPlayerBridgeCapi*>(user_data);
if (!player)
return;
player->HandleError(error_code, "error_cb");
}
// Called by player_set_interrupted_cb()
void interrupt_cb(player_interrupted_code_e code, void *user_data) {
MediaPlayerBridgeCapi* player =
static_cast<MediaPlayerBridgeCapi*>(user_data);
if (!player)
return;
// FIMXE: Add interrupt handling
}
MediaPlayerBridgeCapi::MediaPlayerBridgeCapi(
int player_id,
const GURL& url,
double volume,
MediaPlayerManager* manager_in)
: MediaPlayerTizen(player_id, manager_in),
pixmap_id_(0),
efl_pixmap_(0),
m_damage(0),
m_damageHandler(NULL),
main_loop_(base::MessageLoopProxy::current()),
player_(NULL),
url_(url),
media_type_(0),
player_width_(0),
player_height_(0),
video_format_(0),
is_end_reached_(false),
is_file_url_(false),
is_paused_(true),
is_pixmap_used_(true),
is_seeking_(false),
duration_(0),
seek_duration_(0),
playback_rate_(1.0),
delayed_player_state_(0),
shared_memory_size(0) {
VLOG(1) << __FUNCTION__ << " : Player Id = " << GetPlayerId();
int ret = player_create(&player_);
if (ret == PLAYER_ERROR_NONE) {
VLOG(1) << __FUNCTION__ << " : Create Player Success.";
VLOG(1) << __FUNCTION__ << " : URL = " << url_.spec().c_str();
player_set_uri(player_, url_.spec().c_str());
player_set_sound_type(player_, SOUND_TYPE_MEDIA);
player_set_volume(player_, (float)volume, (float)volume);
// Use Pixmap
ret = player_set_x11_display_pixmap(player_,
pixmap_buffer_ready_cb, this);
if (ret != PLAYER_ERROR_NONE) {
HandleError(ret, "player_set_x11_display_pixmap");
return;
}
player_set_completed_cb(player_, playback_complete_cb, this);
player_set_buffering_cb(player_, changed_buffering_status_cb, this);
player_set_interrupted_cb(player_, interrupt_cb, this);
player_set_error_cb(player_, error_cb, this);
#if defined(OS_TIZEN_MOBILE)
player_set_display_visible (player_, true);
#else // OS_TIZEN_TV
player_set_x11_display_visible (player_, true);
#endif
if(url_.SchemeIsFile())
is_file_url_ = true;
manager()->OnReadyStateChange(GetPlayerId(),
MediaPlayerTizen::ReadyStateHaveEnoughData);
manager()->OnNetworkStateChange(GetPlayerId(),
MediaPlayerTizen::NetworkStateLoaded);
} else {
HandleError(ret, "player_create");
}
}
MediaPlayerBridgeCapi::~MediaPlayerBridgeCapi() {
VLOG(1) << __FUNCTION__ << " : Player Id = " << GetPlayerId();
}
void MediaPlayerBridgeCapi::Destroy() {
VLOG(1) << __FUNCTION__ << " : Player Id = " << GetPlayerId();
if (IsPlayerDestructing())
return;
destructing_ = true;
StopCurrentTimeUpdateTimer();
StopBufferingUpdateTimer();
player_unset_completed_cb(player_);
player_unset_interrupted_cb(player_);
player_unset_error_cb(player_);
player_unset_buffering_cb(player_);
player_unset_subtitle_updated_cb(player_);
player_destroy(player_);
if (m_damage) {
ecore_x_damage_free(m_damage);
m_damage = 0;
}
if (m_damageHandler) {
ecore_event_handler_del(m_damageHandler);
m_damageHandler = NULL;
}
if (efl_pixmap_.get()) {
efl_pixmap_ = NULL;
}
main_loop_->DeleteSoon(FROM_HERE, this);
}
void MediaPlayerBridgeCapi::Play() {
VLOG(1) << __FUNCTION__ << " : Player Id = " << GetPlayerId();
if (GetPlayerState() == PLAYER_STATE_IDLE) {
if(delayed_player_state_ != 0) {
delayed_player_state_ = DELAYED_PLAYER_STATE_PLAY;
return;
}
delayed_player_state_ = DELAYED_PLAYER_STATE_PLAY;
int ret = player_prepare_async(player_, player_prepared_cb, this);
if (ret != PLAYER_ERROR_NONE)
HandleError(ret, "player_prepare_async");
return;
}
if (playback_rate_ == 0.0) {
is_paused_ = false;
return;
}
if (player_start(player_) != PLAYER_ERROR_NONE) {
LOG(ERROR) <<"Play() -> |player_start| failed";
return;
}
#if defined(OS_TIZEN_MOBILE)
if (device_power_request_lock(POWER_LOCK_DISPLAY, 0) != DEVICE_ERROR_NONE)
LOG(ERROR) <<"Play() -> |device_power_request_lock| failed";
#endif
StartCurrentTimeUpdateTimer();
if (!is_file_url_)
StartBufferingUpdateTimer();
is_paused_ = false;
is_end_reached_ = false;
}
void MediaPlayerBridgeCapi::Pause(bool is_media_related_action) {
VLOG(1) << __FUNCTION__ << " : Player Id = " << GetPlayerId();
if (GetPlayerState() == PLAYER_STATE_IDLE) {
if(delayed_player_state_ != 0) {
delayed_player_state_ = DELAYED_PLAYER_STATE_PAUSE;
return;
}
delayed_player_state_ = DELAYED_PLAYER_STATE_PAUSE;
int ret = player_prepare_async(player_, player_prepared_cb, this);
if (ret != PLAYER_ERROR_NONE)
HandleError(ret, "player_prepare_async");
return;
}
if (player_pause(player_) != PLAYER_ERROR_NONE) {
LOG(ERROR) << "Pause() -> |player_pause| failed";
return;
}
if (!is_file_url_)
StartBufferingUpdateTimer();
#if defined(OS_TIZEN_MOBILE)
if (device_power_release_lock(POWER_LOCK_DISPLAY) != DEVICE_ERROR_NONE)
LOG(ERROR) << "|device_power_release_lock| request failed";
#endif
StopCurrentTimeUpdateTimer();
is_paused_ = true;
}
void MediaPlayerBridgeCapi::SetRate(double rate) {
VLOG(1) << __FUNCTION__ << " : Player Id = " << GetPlayerId();
if (playback_rate_ == rate)
return;
if (rate == 0.0) {
playback_rate_ = rate;
Pause(true);
return;
}
// Fixme: SetRate is always failing
if (player_set_playback_rate(player_, (float)rate) != PLAYER_ERROR_NONE)
LOG(ERROR) <<"|player_set_playback_rate|failed";
else {
// If previous rate was zero and requested rate is non-zero, change the
// playback rate and call play
if(playback_rate_ == 0.0 && rate != 0.0) {
playback_rate_ = rate;
Play();
} else {
playback_rate_ = rate;
}
}
}
void MediaPlayerBridgeCapi::Seek(const double time) {
VLOG(1) << __FUNCTION__ << " : Player Id = " << GetPlayerId();
#if defined(OS_TIZEN_MOBILE)
int err = player_set_play_position(player_,
ConvertSecondsToMilliSeconds(time), true, seek_complete_cb, this);
#else // OS_TIZEN_TV
int err = player_set_position(player_,
ConvertSecondsToMilliSeconds(time), seek_complete_cb, this);
#endif
if(err != PLAYER_ERROR_NONE) {
LOG(ERROR) <<"|player_set_playback_rate|failed";
manager()->OnTimeUpdate(GetPlayerId(), GetCurrentTime());
manager()->OnTimeChanged(GetPlayerId());
return;
}
if (!is_paused_)
StopCurrentTimeUpdateTimer();
StopBufferingUpdateTimer();
UpdateSeekState(true);
seek_duration_ = time;
is_end_reached_ = time != duration_ ? false : true;
manager()->OnTimeUpdate(GetPlayerId(), time);
if (!is_paused_)
StartCurrentTimeUpdateTimer();
}
void MediaPlayerBridgeCapi::Release() {
}
void MediaPlayerBridgeCapi::SetVolume(double volume) {
VLOG(1) << __FUNCTION__ << " : Player Id = " << GetPlayerId()
<< " : Volume : " << volume;
if (GetPlayerState() > PLAYER_STATE_IDLE){
if(volume == 0.0){
if(player_set_mute(player_,true)
!= PLAYER_ERROR_NONE)
LOG(ERROR) << "|player_set_mute(true)| failed in MediaPlayerBridgeCapi::"
<< __FUNCTION__;
return;
}
if(player_set_mute(player_,false)
!= PLAYER_ERROR_NONE)
LOG(ERROR) << "|player_set_mute(false)| failed in MediaPlayerBridgeCapi::"
<< __FUNCTION__;
if (player_set_volume(player_, (float)volume, (float)volume)
!= PLAYER_ERROR_NONE)
LOG(ERROR) << "|player_set_volume| failed in MediaPlayerBridgeCapi::"
<< __FUNCTION__;
}
}
void MediaPlayerBridgeCapi::UpdateMediaType() {
int fps = 0 ;
int bit_rate = 0;
int sample_rate = 0;
int channel = 0;
int audio_bit_rate = 0;
media_type_ = 0;
int err = player_get_video_stream_info(player_, &fps, &bit_rate);
int err_audio = player_get_audio_stream_info(player_,
&sample_rate, &channel, &audio_bit_rate);
VLOG(1) << "Audio Information: sample_rate = " << sample_rate
<< " , channel = " << channel
<< " , audio_bit_rate = " << audio_bit_rate;
if (err != PLAYER_ERROR_NONE) {
HandleError(err, "player_get_video_stream_info");
return;
}
if (err_audio != PLAYER_ERROR_NONE) {
HandleError(err_audio, "player_get_audio_stream_info");
return;
}
if (sample_rate > 0)
media_type_ |= MEDIA_AUDIO_MASK;
err = player_get_video_size(player_,&player_width_,&player_height_);
if (err != PLAYER_ERROR_NONE) {
HandleError(err, " player_get_video_size");
return;
}
VLOG(1) << "Video Information: fps = " << fps
<< " , bit_rate = " << bit_rate
<< " , Video Height = " << player_height_
<< " , Video Width = " << player_width_;
// Video stream is present if both video width and video
// height are non-zero.
if (player_width_ != 0 && player_height_ != 0)
media_type_ |= MEDIA_VIDEO_MASK;
// Passing NULL value for video_format. Its not required but
// |webmediaplayertizen| expects a value.
manager()->OnMediaDataChange(GetPlayerId(), video_format_, player_height_,
player_width_, media_type_);
}
void MediaPlayerBridgeCapi::UpdateDuration() {
int duration = 0;
player_get_duration(player_, &duration);
if (duration_ != ConvertMilliSecondsToSeconds(duration)) {
duration_ = ConvertMilliSecondsToSeconds(duration);
manager()->OnDurationChange(GetPlayerId(), duration_);
}
// No need to buffer 'local file'. Update buffered percentage.
if(is_file_url_) {
std::vector<media::MediaPlayerTizen::TimeRanges> buffer_range;
media::MediaPlayerTizen::TimeRanges range;
range.start = 0;
range.end = duration_ * base::Time::kMicrosecondsPerSecond;
buffer_range.push_back(range);
manager()->OnBufferUpdate(GetPlayerId(), buffer_range);
}
}
double MediaPlayerBridgeCapi::GetCurrentTime() {
// For http://instagram.com/p/tMQOo0lWqm/
// After playback completed current-time and duration are not equal.
if (is_end_reached_) {
if (is_seeking_)
return seek_duration_;
if (playback_rate_ < 0)
return 0.0f;
if (duration_)
return duration_;
}
int postion = 0;
#if defined(OS_TIZEN_MOBILE)
player_get_play_position(player_, &postion);
#else // OS_TIZEN_TV
player_get_position(player_, &postion);
#endif
return ConvertMilliSecondsToSeconds(postion);
}
void MediaPlayerBridgeCapi::OnCurrentTimeUpdateTimerFired() {
if (IsPlayerDestructing())
return;
manager()->OnTimeUpdate(GetPlayerId(), GetCurrentTime());
UpdateDuration();
}
void MediaPlayerBridgeCapi::StartCurrentTimeUpdateTimer() {
if (!current_time_update_timer_.IsRunning()) {
current_time_update_timer_.Start(
FROM_HERE,
base::TimeDelta::FromMilliseconds(kDurationUpdateInterval),
this, &MediaPlayerBridgeCapi::OnCurrentTimeUpdateTimerFired);
}
}
void MediaPlayerBridgeCapi::StopCurrentTimeUpdateTimer() {
if (current_time_update_timer_.IsRunning())
current_time_update_timer_.Stop();
}
void MediaPlayerBridgeCapi::OnBufferingUpdateTimerFired() {
if (IsPlayerDestructing())
return;
int start, current;
if (player_get_streaming_download_progress(player_,
&start, ¤t) == PLAYER_ERROR_NONE) {
if (current == 100) {
StopBufferingUpdateTimer();
manager()->OnNetworkStateChange(GetPlayerId(),
MediaPlayerTizen::NetworkStateLoaded);
}
std::vector<media::MediaPlayerTizen::TimeRanges> buffer_range;
media::MediaPlayerTizen::TimeRanges range;
range.start = 0;
range.end = static_cast<double>(current) * duration_ / 100
* base::Time::kMicrosecondsPerSecond;
buffer_range.push_back(range);
manager()->OnBufferUpdate(GetPlayerId(), buffer_range);
}
}
void MediaPlayerBridgeCapi::StartBufferingUpdateTimer() {
if (!buffering_update_timer_.IsRunning()) {
buffering_update_timer_.Start(
FROM_HERE,
base::TimeDelta::FromMilliseconds(kDurationUpdateInterval),
this, &MediaPlayerBridgeCapi::OnBufferingUpdateTimerFired);
}
}
void MediaPlayerBridgeCapi::StopBufferingUpdateTimer() {
if (buffering_update_timer_.IsRunning())
buffering_update_timer_.Stop();
}
void MediaPlayerBridgeCapi::OnTimeChanged() {
DCHECK(main_loop_->BelongsToCurrentThread());
manager()->OnTimeChanged(GetPlayerId());
}
void MediaPlayerBridgeCapi::PlaybackCompleteUpdate() {
VLOG(1) << __FUNCTION__ << " : Player Id = " << GetPlayerId();
is_end_reached_ = true;
#if defined(OS_TIZEN_MOBILE)
if (device_power_release_lock(POWER_LOCK_DISPLAY) != DEVICE_ERROR_NONE)
LOG(ERROR) << "|device_power_release_lock| request failed";
#endif
StopCurrentTimeUpdateTimer();
manager()->OnTimeUpdate(GetPlayerId(), GetCurrentTime());
manager()->OnTimeChanged(GetPlayerId());
}
void MediaPlayerBridgeCapi::SeekCompleteUpdate() {
UpdateSeekState(false);
manager()->OnTimeChanged(GetPlayerId());
if (!is_file_url_)
StartBufferingUpdateTimer();
}
void MediaPlayerBridgeCapi::UpdateSeekState(bool state) {
is_seeking_ = state;
}
void MediaPlayerBridgeCapi::PlatformSurfaceUpdated() {
int postion = 0;
#if defined(OS_TIZEN_MOBILE)
player_get_play_position(player_, &postion);
#else // OS_TIZEN_TV
player_get_position(player_, &postion);
#endif
base::TimeDelta timestamp = base::TimeDelta::FromMilliseconds(postion);
manager()->OnPlatformSurfaceUpdated(GetPlayerId(), pixmap_id_, timestamp);
}
void MediaPlayerBridgeCapi::SetPixmap() {
VLOG(1) << __FUNCTION__ << " : Player Id = " << GetPlayerId();
UpdateMediaType();
UpdateDuration();
if (media_type_ == 0)
return;
if ((media_type_ & MEDIA_VIDEO_MASK) && !efl_pixmap_.get()) {
efl_pixmap_ = gfx::EflPixmap::Create(gfx::EflPixmap::SURFACE,
gfx::Size(player_width_, player_height_));
if (!efl_pixmap_.get()) {
HandleError(0, " PixmapSurfaceTizen::create");
return ;
}
is_pixmap_used_ = true;
pixmap_id_ = efl_pixmap_->GetId();
//Register to get notification from ecore for damage updates.
m_damage = ecore_x_damage_new(pixmap_id_,
ECORE_X_DAMAGE_REPORT_RAW_RECTANGLES);
m_damageHandler = ecore_event_handler_add(ECORE_X_EVENT_DAMAGE_NOTIFY,
notify_damage_updated_cb, this);
}
manager()->OnReadyStateChange(GetPlayerId(),
MediaPlayerTizen::ReadyStateHaveEnoughData);
manager()->OnNetworkStateChange(GetPlayerId(),
MediaPlayerTizen::NetworkStateLoaded);
}
int MediaPlayerBridgeCapi::GetSurfaceID() const {
return pixmap_id_;
}
void MediaPlayerBridgeCapi::HandleBufferingStatus(int percent) {
if (IsPlayerDestructing())
return;
if (percent == 100 && !is_paused_ && !is_seeking_) {
if (GetPlayerState() == PLAYER_STATE_PAUSED) {
VLOG(1) << __FUNCTION__ << " : Player Id = " << GetPlayerId()
<< " : Playing MediaPlayer as buffer reached 100%";
if (player_start(player_) != PLAYER_ERROR_NONE) {
LOG(ERROR) << "HandleBufferingStatus:player_start failed";
return;
}
StartCurrentTimeUpdateTimer();
if (!is_file_url_)
StartBufferingUpdateTimer();
manager()->OnReadyStateChange(GetPlayerId(),
MediaPlayerTizen::ReadyStateHaveEnoughData);
manager()->OnNetworkStateChange(GetPlayerId(),
MediaPlayerTizen::NetworkStateLoading);
return;
}
}
if (percent != 100 && !is_paused_ && !is_seeking_) {
if (GetPlayerState() == PLAYER_STATE_PLAYING) {
VLOG(1) << __FUNCTION__ << " : Player Id = " << GetPlayerId()
<< " : Pausing MediaPlayer as buffer is < 100%";
if (player_pause(player_) != PLAYER_ERROR_NONE) {
LOG(ERROR) << "HandleBufferingStatus:player_pause failed";
return;
}
StopCurrentTimeUpdateTimer();
manager()->OnReadyStateChange(GetPlayerId(),
MediaPlayerTizen::ReadyStateHaveCurrentData);
manager()->OnNetworkStateChange(GetPlayerId(),
MediaPlayerTizen::NetworkStateLoading);
}
}
}
// Helper method which prints errors occured while calling CAPI api's.
void MediaPlayerBridgeCapi::HandleError(int err, char const* from) {
int index;
for (index = 0; index < ERROR_MAX; index++) {
if (errorlist[index].error_code == err) {
LOG(ERROR) << "Stoping playback of media due to Error code : "<<err
<<" Error message : "<<errorlist[index].error_message
<<" from " << from;
break;
}
}
if (index == ERROR_MAX)
LOG(ERROR) << "Stoping playback of media due to Unknown error : "
<<err <<" from " << from;
StopBufferingUpdateTimer();
StopCurrentTimeUpdateTimer();
manager()->OnNetworkStateChange(GetPlayerId(),
MediaPlayerTizen::NetworkStateDecodeError);
#ifdef OS_TIZEN_MOBILE
if (device_power_release_lock(POWER_LOCK_DISPLAY) != DEVICE_ERROR_NONE)
LOG(ERROR) << "|device_power_release_lock| request failed";
#endif
}
player_state_e MediaPlayerBridgeCapi::GetPlayerState() {
player_state_e state;
player_get_state(player_,&state);
return state;
}
void MediaPlayerBridgeCapi::ExecuteDelayedPlayerState() {
switch (delayed_player_state_) {
case DELAYED_PLAYER_STATE_PLAY :
VLOG(1) << "Executing the delayed play command";
Play();
break;
case DELAYED_PLAYER_STATE_PAUSE :
VLOG(1) << "Executing the delayed pause command";
Pause(false);
break;
default :
break;
}
}
} // namespace media
| 30.284327 | 80 | 0.709778 | [
"vector"
] |
6616e2e21a4d5baa78d7c5b8bc5a2666f5b33660 | 205 | hpp | C++ | solutions/303-E-Range-Sum-Query-Immutable/num-array.hpp | ARW2705/leet-code-solutions | fa551e5b15f5340e5be3b832db39638bcbf0dc78 | [
"MIT"
] | null | null | null | solutions/303-E-Range-Sum-Query-Immutable/num-array.hpp | ARW2705/leet-code-solutions | fa551e5b15f5340e5be3b832db39638bcbf0dc78 | [
"MIT"
] | null | null | null | solutions/303-E-Range-Sum-Query-Immutable/num-array.hpp | ARW2705/leet-code-solutions | fa551e5b15f5340e5be3b832db39638bcbf0dc78 | [
"MIT"
] | null | null | null | #ifndef NUM_ARRAY_HPP
#define NUM_ARRAY_HPP
#include <vector>
class NumArray {
public:
NumArray(std::vector<int>& nums);
int sumRange(int left, int right);
private:
std::vector<int> v;
};
#endif
| 12.8125 | 36 | 0.707317 | [
"vector"
] |
6627ac8915b6d9847038843591a3a76028c9fb86 | 6,408 | cpp | C++ | Examples/OffscreenRender/main.cpp | bpwiselybabu/SceneGraph | 1ae7142615bb2c15883ed928a5ed69b0cd281665 | [
"Apache-2.0"
] | 15 | 2015-10-18T15:11:34.000Z | 2021-06-15T02:22:13.000Z | Examples/OffscreenRender/main.cpp | bpwiselybabu/SceneGraph | 1ae7142615bb2c15883ed928a5ed69b0cd281665 | [
"Apache-2.0"
] | 13 | 2015-04-24T20:37:44.000Z | 2020-01-27T15:26:42.000Z | Examples/OffscreenRender/main.cpp | bpwiselybabu/SceneGraph | 1ae7142615bb2c15883ed928a5ed69b0cd281665 | [
"Apache-2.0"
] | 9 | 2015-08-21T18:52:27.000Z | 2020-04-08T15:15:38.000Z | #include <pangolin/pangolin.h>
#include <SceneGraph/SceneGraph.h>
#include <iostream>
#include <iomanip>
#include <thread>
#include <chrono>
using namespace SceneGraph;
using namespace pangolin;
using namespace std;
void Usage() {
cout << "Usage: OffscreenRender ModelFilename DestinationDirectory" << endl;
}
Eigen::Matrix<double,6,1> TrajectoryT_wx(double t)
{
const double s = t/3;
const double r = 7.5 + sin( 4*(M_PI+s) - M_PI/2.0)/2.0;
Eigen::Matrix<double,6,1> ret;
ret << r * cos(M_PI+s), r * sin(M_PI+s), -1.5 + 0.05*sin(10*t),
M_PI/2.0, 0,
M_PI/2.0- atan2(
(2.0*sin(4.0*(s+M_PI))*sin(s))/3.0+((7.5-cos(4.0*(s+M_PI))/2.0)*cos(s))/3.0,
((7.5-cos(4.0*(s+M_PI))/2.0)*sin(s))/3.0-(2.0*sin(4.0*(s+M_PI))*cos(s))/3.0
);
return ret;
}
void SavePPM( const std::string& prefix, unsigned char* img_data, int w, int h, int channels, double time )
{
assert(channels == 1 || channels == 3);
std::ofstream bFile( (prefix+".pgm").c_str(), std::ios::out | std::ios::binary );
bFile << (channels == 1 ? "P5" : "P6") << std::endl;
bFile << w << " " << h << '\n';
bFile << "255" << '\n';
bFile.write( (char *)img_data, w*h*channels);
bFile.close();
std::ofstream txtFile( (prefix+".txt").c_str(), std::ios::out );
txtFile << "%YAML:1.0" << std::endl;
txtFile << "SystemTime: \"" << std::setprecision(20) << time << "\"" << std::endl;
txtFile.close();
}
int main( int argc, char* argv[] )
{
if(argc < 2) {
Usage();
return -1;
}
const bool save_files = (argc == 3);
const std::string model_filename(argv[1]);
const std::string destination_directory = save_files ? argv[2] : "";
// Camera parameters
const int w = 512;
const int h = 384;
const double fu = 300;
const double fv = 300;
const double u0 = w/2;
const double v0 = h/2;
// Create OpenGL window in single line thanks to GLUT
pangolin::CreateWindowAndBind("Main",640*2,480);
GLSceneGraph::ApplyPreferredGlSettings();
glewInit();
// Scenegraph to hold GLObjects and relative transformations
GLSceneGraph glGraph;
#ifdef HAVE_ASSIMP
// Define a mesh object and try to load model
SceneGraph::GLMesh glMesh;
try {
glMesh.Init(model_filename);
glGraph.AddChild(&glMesh);
}catch(exception e) {
cerr << "Cannot load mesh. Check file exists" << endl;
cerr << e.what() << endl;
return -1;
}
#endif // HAVE_ASSIMP
// Coordinate axis to visualise trajectory
GLAxis glCamAxis;
glGraph.AddChild(&glCamAxis);
// Define Camera Render Object (for view / scene browsing)
pangolin::OpenGlRenderState stacks3d(
ProjectionMatrix(w,h,fu,fv,u0,v0,0.1,1000),
ModelViewLookAt(0,-10,-30, 0,0,-1.5, AxisNegZ)
);
// We define a new view which will reside within the container.
pangolin::View view3d;
// We set the views location on screen and add a handler which will
// let user input update the model_view matrix (stacks3d) and feed through
// to our scenegraph
view3d.SetBounds(0.0, 1.0, 0.0, 1.0/2.0, 640.0f/480.0f)
.SetHandler(new HandlerSceneGraph(glGraph,stacks3d,AxisNegZ))
.SetDrawFunction(ActivateDrawFunctor(glGraph, stacks3d));
// We define a special type of view which will accept image data
// to display and set its bounds on screen.
pangolin::View viewImage;
viewImage.SetBounds(0.0, 1.0, 1.0/2.0, 1.0, (double)w/h);
// Add our views as children to the base container.
pangolin::DisplayBase().AddDisplay(view3d);
pangolin::DisplayBase().AddDisplay(viewImage);
// Define Camera Render Object for generating synthetic video sequence
pangolin::OpenGlRenderState stacks_synth(
ProjectionMatrixRDF_BottomLeft(w,h,fu,fv,u0,v0,0.1,1000),
ModelViewLookAt(0,-2,-4, 0,1,0, AxisNegZ)
);
// Offscreen render buffer for synthetic video sequence
pangolin::GlRenderBuffer synth_depth(w,h);
pangolin::GlTexture synth_texture(w,h,GL_RGBA);
pangolin::GlFramebuffer synth_framebuffer(synth_texture, synth_depth);
// Time details
const double LoopDuration = 3*2*M_PI;
const double frameDuration = LoopDuration / 200;
const double lineDuration = frameDuration / h;
int frame = 0;
// frameStartTime is middle of first row in image.
double frameStartTime = 0;
unsigned char* img_data = new unsigned char[w*h];
// Default hooks for exiting (Esc) and fullscreen (tab).
while( !pangolin::ShouldQuit() )
{
glCamAxis.SetPose(GLCart2T(TrajectoryT_wx(frameStartTime)));
// Render synthetic rolling shutter scene
synth_framebuffer.Bind();
glViewport(0,0,w,h);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_SCISSOR_TEST);
for(int r=0; r<h; ++r) {
glScissor(0,r,w,1);
Eigen::Matrix4d T_wv = GLCart2T(TrajectoryT_wx(frameStartTime + r*lineDuration));
pangolin::OpenGlMatrix T_vw = OpenGlMatrix(T_wv).Inverse();
stacks_synth.SetModelViewMatrix(T_vw);
stacks_synth.Apply();
glGraph.DrawObjectAndChildren(eRenderPerceptable);
}
glDisable(GL_SCISSOR_TEST);
synth_framebuffer.Unbind();
if(save_files) {
const double frameEndTime = frameStartTime + frameDuration;
synth_texture.Download(img_data, GL_RED, GL_UNSIGNED_BYTE);
std::ostringstream ss;
ss << destination_directory << "/0_" << std::setw( 5 ) << std::setfill( '0' ) << frame;
SavePPM(ss.str(), img_data, w, h, 1, frameEndTime );
}
frameStartTime += frameDuration;
frame++;
// Clear whole screen
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Display our saved image
viewImage.Activate();
synth_texture.RenderToViewportFlipY();
// Swap frames and Process Events
pangolin::FinishFrame();
// Pause for 1/60th of a second.
std::this_thread::sleep_for(std::chrono::milliseconds(1000 / 60));
}
delete[] img_data;
return 0;
}
| 33.549738 | 107 | 0.610643 | [
"mesh",
"render",
"object",
"model"
] |
6628ac144a5bdd873d785b53524e330cbfc23e36 | 8,638 | cpp | C++ | tzt/tzt.cpp | Raais/tzt | a649979b61550a8d81c6a1ef56747f49cb08113c | [
"MIT"
] | null | null | null | tzt/tzt.cpp | Raais/tzt | a649979b61550a8d81c6a1ef56747f49cb08113c | [
"MIT"
] | null | null | null | tzt/tzt.cpp | Raais/tzt | a649979b61550a8d81c6a1ef56747f49cb08113c | [
"MIT"
] | null | null | null | #include <iostream>
#include <vector>
#include <string>
#include <fstream>
#include <algorithm>
#include <sstream>
#include <string.h>
#include "tztx.h"
#include "cxxopts.hpp"
#include "termcolor.hpp"
#include "base64_rfc4648.hpp"
using namespace tzt;
using rapidfuzz::fuzz::ratio;
using base64 = cppcodec::base64_rfc4648;
inline bool exists(const std::string &name)
{
std::ifstream f(name.c_str());
return f.good();
}
int main(int argc, char *argv[])
{
cxxopts::Options options("tzt", "just some text utils");
options.add_options()
("f,file", "File Name", cxxopts::value<std::string>())
("s,section", "Search Section [-s section-identifier]", cxxopts::value<std::string>())
("S,Section", "Fuzzy-Search Section [-S \"Section Title\"]", cxxopts::value<std::string>())
("l,list", "List Sections", cxxopts::value<bool>()->default_value("false"))
("a,amalgamate", "Amalgamate Multiple Files [-f output -a files...]", cxxopts::value<bool>()->default_value("false"))
("z,encode", "Encode/Decode with Base64", cxxopts::value<bool>()->default_value("false"))
("v,verbose", "Verbose Output", cxxopts::value<bool>()->default_value("false"))
("h,help", "Print Usage");
options.parse_positional({"file"});
options.allow_unrecognised_options();
cxxopts::ParseResult result;
try
{
result = options.parse(argc, argv);
}
catch (std::exception &e)
{
std::cout << "Invalid argument(s)" << std::endl;
exit(1);
}
if (result.count("help"))
{
std::cout << options.help() << std::endl;
exit(0);
}
bool list = result["list"].as<bool>();
bool amalg = result["amalgamate"].as<bool>();
bool verbose = result["verbose"].as<bool>();
bool encode = result["encode"].as<bool>();
bool decode = false;
std::vector<std::string> buffer;
std::vector<std::string> files;
if ((result.count("file")) && (result.count("amalgamate")))
{
if (argc >= 5)
{
if (std::string(argv[3]) == "-a")
{
for (int i = 4; i < argc; i++)
{
if (exists(argv[i]))
{
files.push_back(argv[i]);
}
else
{
std::cout << "File does not exist: " << argv[i] << std::endl;
exit(1);
}
}
}
}
else
{
std::cout << "Not enough arguments" << std::endl;
exit(1);
}
for (auto &file : files)
{
std::string header = "##!" + file;
buffer.push_back(header);
std::ifstream in(file);
std::string line;
while (std::getline(in, line))
{
buffer.push_back(line);
}
}
std::string ofn = result["file"].as<std::string>();
if (ofn.find(".tzt") == std::string::npos)
{
ofn += ".tzt";
}
std::ofstream ofs(ofn);
for (int i = 0; i < buffer.size(); i++)
{
ofs << buffer.at(i) << std::endl;
}
ofs.close();
if (verbose)
std::cout << "Created file: " << ofn << std::endl;
exit(0);
}
int stype = 0;
std::string search;
if (result.count("Section"))
{
search = result["Section"].as<std::string>();
stype = 1;
}
if (result.count("section"))
{
search = result["section"].as<std::string>();
stype = 2;
}
std::string fn;
if (result.count("file"))
{
fn = result["file"].as<std::string>();
std::ifstream ifs(fn, std::ios::in);
if(!exists(fn))
{
std::cout << "File not found: " << fn << std::endl;
exit(1);
}
if (!encode)
{
if (fn.find(".tzt") == std::string::npos)
{
std::cout << "Not a .tzt file: " << fn << std::endl;
exit(1);
}
}
std::string ln;
while (std::getline(ifs, ln))
{
buffer.push_back(ln);
}
//###########################################################################
if (encode)
{
std::string l1 = buffer.at(0);
if (l1.find("!TZT0!") == 0)
{
decode = true;
buffer.at(0) = l1.substr(6);
try
{
for (int i = 0; i < buffer.size(); i++)
{
std::vector<uint8_t> ddata = base64::decode(buffer.at(i));
std::string dstr(ddata.begin(), ddata.end());
buffer.at(i) = dstr;
}
}
catch (std::exception &e)
{
std::cout << "Invalid or corrupt file" << std::endl;
exit(1);
}
}
else
{
for (int i = 0; i < buffer.size(); i++)
{
std::string estr = base64::encode(buffer.at(i));
buffer.at(i) = estr;
}
}
size_t size = sizeof(buffer[0]) * buffer.size();
std::ofstream ofs(fn, std::ios::out);
if (!decode)
{
ofs << "!TZT0!";
}
for (int i = 0; i < buffer.size(); i++)
{
ofs << buffer.at(i) << std::endl;
}
if (verbose)
{
if (decode)
{
std::cout << "Decoded: " << size << std::endl;
}
else
{
std::cout << "Encoded: " << size << std::endl;
}
}
}
//###########################################################################
else
{
file f(fn);
for (int i = 0; i < buffer.size(); i++)
{
f.append(buffer.at(i));
}
if (list)
{
for (auto §ion : f.sections)
{
std::string ws = " ";
if(!section.hs.empty()) {std::cout << termcolor::yellow << section.hs << termcolor::reset << std::endl; ws="\t";}
if(!section.hsi.empty()) std::cout << ws << termcolor::cyan << section.hsi << termcolor::reset << std::endl;
}
exit(0);
}
if (stype == 1)
{
section *out = f.searchSectionFuzzy(search);
if (out != nullptr)
{
if (verbose)
std::cout << termcolor::yellow << out->hs << termcolor::reset << std::endl;
for (int i = 0; i < out->lines.size(); i++)
{
std::cout << out->lines[i] << std::endl;
}
}
else
{
std::cout << "No matches found." << std::endl;
exit(1);
}
}
else if (stype == 2)
{
section *out = f.searchSection(search);
if (out != nullptr)
{
if (verbose)
std::cout << termcolor::yellow << out->hs << termcolor::reset << std::endl;
for (int i = 0; i < out->lines.size(); i++)
{
std::cout << out->lines[i] << std::endl;
}
}
else
{
std::cout << "No matches found." << std::endl;
exit(1);
}
}
else // no opts
{
for (int i = 0; i < f.sections.size(); i++)
{
if (verbose)
std::cout << termcolor::yellow << f.sections[i].hs << termcolor::reset << std::endl;
for (int j = 0; j < f.sections[i].lines.size(); j++)
{
std::cout << f.sections[i].lines[j] << std::endl;
}
}
}
}
}
else
{
std::cout << options.help() << std::endl;
}
return 0;
}
| 29.582192 | 133 | 0.388284 | [
"vector"
] |
662b09f30db9ba61d9cb67d458a113ffcb661d5c | 2,305 | cpp | C++ | Final/Dataset/B2016_Z1_Z1/student4430.cpp | Team-PyRated/PyRated | 1df171c8a5a98977b7a96ee298a288314d1b1b96 | [
"MIT"
] | null | null | null | Final/Dataset/B2016_Z1_Z1/student4430.cpp | Team-PyRated/PyRated | 1df171c8a5a98977b7a96ee298a288314d1b1b96 | [
"MIT"
] | null | null | null | Final/Dataset/B2016_Z1_Z1/student4430.cpp | Team-PyRated/PyRated | 1df171c8a5a98977b7a96ee298a288314d1b1b96 | [
"MIT"
] | null | null | null | /*B 2016/2017, Zadaća 1, Zadatak 1
NAPOMENA: ulaz/izlaz za zadatke je specificiran
javnim autotestovima. Zalbe za ne analiziranje testova
se ne uvazavaju!
NAPOMENA: nece svi (javni) testovi sa zamgera biti
dostupni na c9.
*/
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
vector<int> IzdvojiGadne(vector <int> v, bool a){
vector <int> izlaz;
if(v.size()==0) return izlaz;
int pomocni, broj, cifra;
int brojac0=0, brojac1=0, brojac2=0;
for(int i=0; i<v.size(); i++){
pomocni=v[i];
broj=v[i];
if(pomocni<0) pomocni=-pomocni;
brojac0=0; brojac1=0; brojac2=0; // za svaki broj postavljamo brojace na 0
if(pomocni==0){
brojac0++;
}
while(pomocni!=0){
cifra=pomocni%3;
pomocni=pomocni/3; //gledamo koja je cifra pri promjeni u bazu 3
if(cifra==0) brojac0++;
else if(cifra==1) brojac1++; // zavisno koja je cifra povećavamo odgovarajući brojac
else if(cifra==2) brojac2++;
}
if((brojac0%2==0 || brojac0==0) && (brojac1%2==0 || brojac1==0) && (brojac2%2==0 || brojac2==0) && a==true){ // sa parnim brojem i true tj opaki
bool sadrzi=false;
for(int i=0; i<izlaz.size(); i++){ //provjeravamo da li se taj broj nalazi već u vektoru
if(broj==izlaz[i])
sadrzi=true;
}
if(!sadrzi) //ako se ne nalazi onda ga ubacujeo u vektor
izlaz.push_back(broj);
}
else if((brojac0%2!=0 || brojac0==0) && (brojac1%2!=0 || brojac1==0) && (brojac2%2!=0 || brojac2==0) && a==false){ // sa neparnim brojem i false tj odvratni
bool sadrzi=false;
for(int i=0; i<izlaz.size(); i++){
if(broj==izlaz[i])
sadrzi=true;
}
if(!sadrzi)
izlaz.push_back(broj);
}
}
return izlaz;
}
int main ()
{
vector<int> vektor;
int broj;
cout << "Unesite brojeve (0 za prekid unosa): ";
for(int i=0; ; i++){
cin >> broj;
if(broj==0) break;
vektor.push_back(broj);
}
vector<int> opaki;
vector<int> odvratni;
opaki=IzdvojiGadne(vektor, true);
odvratni=IzdvojiGadne(vektor, false);
cout << "Opaki: ";
for(int x : opaki){
cout << x << " ";
}
cout << endl << "Odvratni: ";
for(int x : odvratni){
cout << x << " ";
}
return 0;
} | 25.898876 | 159 | 0.583948 | [
"vector"
] |
66409571a4e30dfac338c5e6393929b2f5579111 | 13,728 | cc | C++ | Digit_Example/opt_two_step/gen/opt/hs_int_dx.cc | prem-chand/Cassie_CFROST | da4bd51442f86e852cbb630cc91c9a380a10b66d | [
"BSD-3-Clause"
] | null | null | null | Digit_Example/opt_two_step/gen/opt/hs_int_dx.cc | prem-chand/Cassie_CFROST | da4bd51442f86e852cbb630cc91c9a380a10b66d | [
"BSD-3-Clause"
] | null | null | null | Digit_Example/opt_two_step/gen/opt/hs_int_dx.cc | prem-chand/Cassie_CFROST | da4bd51442f86e852cbb630cc91c9a380a10b66d | [
"BSD-3-Clause"
] | null | null | null | /*
* Automatically Generated from Mathematica.
* Fri 5 Nov 2021 16:28:01 GMT-04:00
*/
#ifdef MATLAB_MEX_FILE
#include <stdexcept>
#include <cmath>
#include<math.h>
/**
* Copied from Wolfram Mathematica C Definitions file mdefs.hpp
* Changed marcos to inline functions (Eric Cousineau)
*/
inline double Power(double x, double y) { return pow(x, y); }
inline double Sqrt(double x) { return sqrt(x); }
inline double Abs(double x) { return fabs(x); }
inline double Exp(double x) { return exp(x); }
inline double Log(double x) { return log(x); }
inline double Sin(double x) { return sin(x); }
inline double Cos(double x) { return cos(x); }
inline double Tan(double x) { return tan(x); }
inline double ArcSin(double x) { return asin(x); }
inline double ArcCos(double x) { return acos(x); }
inline double ArcTan(double x) { return atan(x); }
/* update ArcTan function to use atan2 instead. */
inline double ArcTan(double x, double y) { return atan2(y,x); }
inline double Sinh(double x) { return sinh(x); }
inline double Cosh(double x) { return cosh(x); }
inline double Tanh(double x) { return tanh(x); }
const double E = 2.71828182845904523536029;
const double Pi = 3.14159265358979323846264;
const double Degree = 0.01745329251994329576924;
inline double Sec(double x) { return 1/cos(x); }
inline double Csc(double x) { return 1/sin(x); }
#endif
/*
* Sub functions
*/
static void output1(double *p_output1,const double *var1,const double *var2,const double *var3,const double *var4,const double *var5,const double *var6,const double *var7,const double *var8)
{
double t79;
double t99;
double t101;
double t126;
double t54;
double t141;
double t168;
double t196;
double t231;
double t281;
double t308;
double t334;
double t361;
double t399;
double t413;
double t439;
double t459;
double t475;
double t492;
double t528;
double t561;
double t622;
double t653;
double t693;
double t725;
double t765;
double t788;
double t810;
double t891;
double t955;
double t997;
double t1032;
double t1064;
double t1075;
double t1082;
double t1089;
double t1101;
double t1112;
double t1119;
double t1133;
t79 = -1. + var8[0];
t99 = 1/t79;
t101 = -1.*var1[0];
t126 = t101 + var1[1];
t54 = -1.*var2[0];
t141 = -1.*var2[1];
t168 = -1.*var2[2];
t196 = -1.*var2[3];
t231 = -1.*var2[4];
t281 = -1.*var2[5];
t308 = -1.*var2[6];
t334 = -1.*var2[7];
t361 = -1.*var2[8];
t399 = -1.*var2[9];
t413 = -1.*var2[10];
t439 = -1.*var2[11];
t459 = -1.*var2[12];
t475 = -1.*var2[13];
t492 = -1.*var2[14];
t528 = -1.*var2[15];
t561 = -1.*var2[16];
t622 = -1.*var2[17];
t653 = -1.*var2[18];
t693 = -1.*var2[19];
t725 = -1.*var2[20];
t765 = -1.*var2[21];
t788 = -1.*var2[22];
t810 = -1.*var2[23];
t891 = -1.*var2[24];
t955 = -1.*var2[25];
t997 = -1.*var2[26];
t1032 = -1.*var2[27];
t1064 = -1.*var2[28];
t1075 = -1.*var2[29];
t1082 = -1.*var2[30];
t1089 = -1.*var2[31];
t1101 = -1.*var2[32];
t1112 = -1.*var2[33];
t1119 = -1.*var2[34];
t1133 = -1.*var2[35];
p_output1[0]=t54 + var6[0] - 0.333333333333333*t126*t99*(var3[0] + 4.*var5[0] + var7[0]);
p_output1[1]=t141 + var6[1] - 0.333333333333333*t126*t99*(var3[1] + 4.*var5[1] + var7[1]);
p_output1[2]=t168 + var6[2] - 0.333333333333333*t126*t99*(var3[2] + 4.*var5[2] + var7[2]);
p_output1[3]=t196 + var6[3] - 0.333333333333333*t126*t99*(var3[3] + 4.*var5[3] + var7[3]);
p_output1[4]=t231 + var6[4] - 0.333333333333333*t126*t99*(var3[4] + 4.*var5[4] + var7[4]);
p_output1[5]=t281 + var6[5] - 0.333333333333333*t126*t99*(var3[5] + 4.*var5[5] + var7[5]);
p_output1[6]=t308 + var6[6] - 0.333333333333333*t126*t99*(var3[6] + 4.*var5[6] + var7[6]);
p_output1[7]=t334 + var6[7] - 0.333333333333333*t126*t99*(var3[7] + 4.*var5[7] + var7[7]);
p_output1[8]=t361 + var6[8] - 0.333333333333333*t126*t99*(var3[8] + 4.*var5[8] + var7[8]);
p_output1[9]=t399 + var6[9] - 0.333333333333333*t126*t99*(var3[9] + 4.*var5[9] + var7[9]);
p_output1[10]=t413 + var6[10] - 0.333333333333333*t126*t99*(var3[10] + 4.*var5[10] + var7[10]);
p_output1[11]=t439 + var6[11] - 0.333333333333333*t126*t99*(var3[11] + 4.*var5[11] + var7[11]);
p_output1[12]=t459 + var6[12] - 0.333333333333333*t126*t99*(var3[12] + 4.*var5[12] + var7[12]);
p_output1[13]=t475 + var6[13] - 0.333333333333333*t126*t99*(var3[13] + 4.*var5[13] + var7[13]);
p_output1[14]=t492 + var6[14] - 0.333333333333333*t126*t99*(var3[14] + 4.*var5[14] + var7[14]);
p_output1[15]=t528 + var6[15] - 0.333333333333333*t126*t99*(var3[15] + 4.*var5[15] + var7[15]);
p_output1[16]=t561 + var6[16] - 0.333333333333333*t126*t99*(var3[16] + 4.*var5[16] + var7[16]);
p_output1[17]=t622 + var6[17] - 0.333333333333333*t126*t99*(var3[17] + 4.*var5[17] + var7[17]);
p_output1[18]=t653 + var6[18] - 0.333333333333333*t126*t99*(var3[18] + 4.*var5[18] + var7[18]);
p_output1[19]=t693 + var6[19] - 0.333333333333333*t126*t99*(var3[19] + 4.*var5[19] + var7[19]);
p_output1[20]=t725 + var6[20] - 0.333333333333333*t126*t99*(var3[20] + 4.*var5[20] + var7[20]);
p_output1[21]=t765 + var6[21] - 0.333333333333333*t126*t99*(var3[21] + 4.*var5[21] + var7[21]);
p_output1[22]=t788 + var6[22] - 0.333333333333333*t126*t99*(var3[22] + 4.*var5[22] + var7[22]);
p_output1[23]=t810 + var6[23] - 0.333333333333333*t126*t99*(var3[23] + 4.*var5[23] + var7[23]);
p_output1[24]=t891 + var6[24] - 0.333333333333333*t126*t99*(var3[24] + 4.*var5[24] + var7[24]);
p_output1[25]=t955 + var6[25] - 0.333333333333333*t126*t99*(var3[25] + 4.*var5[25] + var7[25]);
p_output1[26]=t997 + var6[26] - 0.333333333333333*t126*t99*(var3[26] + 4.*var5[26] + var7[26]);
p_output1[27]=t1032 + var6[27] - 0.333333333333333*t126*t99*(var3[27] + 4.*var5[27] + var7[27]);
p_output1[28]=t1064 + var6[28] - 0.333333333333333*t126*t99*(var3[28] + 4.*var5[28] + var7[28]);
p_output1[29]=t1075 + var6[29] - 0.333333333333333*t126*t99*(var3[29] + 4.*var5[29] + var7[29]);
p_output1[30]=t1082 + var6[30] - 0.333333333333333*t126*t99*(var3[30] + 4.*var5[30] + var7[30]);
p_output1[31]=t1089 + var6[31] - 0.333333333333333*t126*t99*(var3[31] + 4.*var5[31] + var7[31]);
p_output1[32]=t1101 + var6[32] - 0.333333333333333*t126*t99*(var3[32] + 4.*var5[32] + var7[32]);
p_output1[33]=t1112 + var6[33] - 0.333333333333333*t126*t99*(var3[33] + 4.*var5[33] + var7[33]);
p_output1[34]=t1119 + var6[34] - 0.333333333333333*t126*t99*(var3[34] + 4.*var5[34] + var7[34]);
p_output1[35]=t1133 + var6[35] - 0.333333333333333*t126*t99*(var3[35] + 4.*var5[35] + var7[35]);
p_output1[36]=var4[0] + 0.5*(t54 - 1.*var6[0]) - 0.25*t126*t99*(var3[0] - 1.*var7[0]);
p_output1[37]=var4[1] + 0.5*(t141 - 1.*var6[1]) - 0.25*t126*t99*(var3[1] - 1.*var7[1]);
p_output1[38]=var4[2] + 0.5*(t168 - 1.*var6[2]) - 0.25*t126*t99*(var3[2] - 1.*var7[2]);
p_output1[39]=var4[3] + 0.5*(t196 - 1.*var6[3]) - 0.25*t126*t99*(var3[3] - 1.*var7[3]);
p_output1[40]=var4[4] + 0.5*(t231 - 1.*var6[4]) - 0.25*t126*t99*(var3[4] - 1.*var7[4]);
p_output1[41]=var4[5] + 0.5*(t281 - 1.*var6[5]) - 0.25*t126*t99*(var3[5] - 1.*var7[5]);
p_output1[42]=var4[6] + 0.5*(t308 - 1.*var6[6]) - 0.25*t126*t99*(var3[6] - 1.*var7[6]);
p_output1[43]=var4[7] + 0.5*(t334 - 1.*var6[7]) - 0.25*t126*t99*(var3[7] - 1.*var7[7]);
p_output1[44]=var4[8] + 0.5*(t361 - 1.*var6[8]) - 0.25*t126*t99*(var3[8] - 1.*var7[8]);
p_output1[45]=var4[9] + 0.5*(t399 - 1.*var6[9]) - 0.25*t126*t99*(var3[9] - 1.*var7[9]);
p_output1[46]=var4[10] + 0.5*(t413 - 1.*var6[10]) - 0.25*t126*t99*(var3[10] - 1.*var7[10]);
p_output1[47]=var4[11] + 0.5*(t439 - 1.*var6[11]) - 0.25*t126*t99*(var3[11] - 1.*var7[11]);
p_output1[48]=var4[12] + 0.5*(t459 - 1.*var6[12]) - 0.25*t126*t99*(var3[12] - 1.*var7[12]);
p_output1[49]=var4[13] + 0.5*(t475 - 1.*var6[13]) - 0.25*t126*t99*(var3[13] - 1.*var7[13]);
p_output1[50]=var4[14] + 0.5*(t492 - 1.*var6[14]) - 0.25*t126*t99*(var3[14] - 1.*var7[14]);
p_output1[51]=var4[15] + 0.5*(t528 - 1.*var6[15]) - 0.25*t126*t99*(var3[15] - 1.*var7[15]);
p_output1[52]=var4[16] + 0.5*(t561 - 1.*var6[16]) - 0.25*t126*t99*(var3[16] - 1.*var7[16]);
p_output1[53]=var4[17] + 0.5*(t622 - 1.*var6[17]) - 0.25*t126*t99*(var3[17] - 1.*var7[17]);
p_output1[54]=var4[18] + 0.5*(t653 - 1.*var6[18]) - 0.25*t126*t99*(var3[18] - 1.*var7[18]);
p_output1[55]=var4[19] + 0.5*(t693 - 1.*var6[19]) - 0.25*t126*t99*(var3[19] - 1.*var7[19]);
p_output1[56]=var4[20] + 0.5*(t725 - 1.*var6[20]) - 0.25*t126*t99*(var3[20] - 1.*var7[20]);
p_output1[57]=var4[21] + 0.5*(t765 - 1.*var6[21]) - 0.25*t126*t99*(var3[21] - 1.*var7[21]);
p_output1[58]=var4[22] + 0.5*(t788 - 1.*var6[22]) - 0.25*t126*t99*(var3[22] - 1.*var7[22]);
p_output1[59]=var4[23] + 0.5*(t810 - 1.*var6[23]) - 0.25*t126*t99*(var3[23] - 1.*var7[23]);
p_output1[60]=var4[24] + 0.5*(t891 - 1.*var6[24]) - 0.25*t126*t99*(var3[24] - 1.*var7[24]);
p_output1[61]=var4[25] + 0.5*(t955 - 1.*var6[25]) - 0.25*t126*t99*(var3[25] - 1.*var7[25]);
p_output1[62]=var4[26] + 0.5*(t997 - 1.*var6[26]) - 0.25*t126*t99*(var3[26] - 1.*var7[26]);
p_output1[63]=var4[27] + 0.5*(t1032 - 1.*var6[27]) - 0.25*t126*t99*(var3[27] - 1.*var7[27]);
p_output1[64]=var4[28] + 0.5*(t1064 - 1.*var6[28]) - 0.25*t126*t99*(var3[28] - 1.*var7[28]);
p_output1[65]=var4[29] + 0.5*(t1075 - 1.*var6[29]) - 0.25*t126*t99*(var3[29] - 1.*var7[29]);
p_output1[66]=var4[30] + 0.5*(t1082 - 1.*var6[30]) - 0.25*t126*t99*(var3[30] - 1.*var7[30]);
p_output1[67]=var4[31] + 0.5*(t1089 - 1.*var6[31]) - 0.25*t126*t99*(var3[31] - 1.*var7[31]);
p_output1[68]=var4[32] + 0.5*(t1101 - 1.*var6[32]) - 0.25*t126*t99*(var3[32] - 1.*var7[32]);
p_output1[69]=var4[33] + 0.5*(t1112 - 1.*var6[33]) - 0.25*t126*t99*(var3[33] - 1.*var7[33]);
p_output1[70]=var4[34] + 0.5*(t1119 - 1.*var6[34]) - 0.25*t126*t99*(var3[34] - 1.*var7[34]);
p_output1[71]=var4[35] + 0.5*(t1133 - 1.*var6[35]) - 0.25*t126*t99*(var3[35] - 1.*var7[35]);
}
#ifdef MATLAB_MEX_FILE
#include "mex.h"
/*
* Main function
*/
void mexFunction( int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[] )
{
size_t mrows, ncols;
double *var1,*var2,*var3,*var4,*var5,*var6,*var7,*var8;
double *p_output1;
/* Check for proper number of arguments. */
if( nrhs != 8)
{
mexErrMsgIdAndTxt("MATLAB:MShaped:invalidNumInputs", "Eight input(s) required (var1,var2,var3,var4,var5,var6,var7,var8).");
}
else if( nlhs > 1)
{
mexErrMsgIdAndTxt("MATLAB:MShaped:maxlhs", "Too many output arguments.");
}
/* The input must be a noncomplex double vector or scaler. */
mrows = mxGetM(prhs[0]);
ncols = mxGetN(prhs[0]);
if( !mxIsDouble(prhs[0]) || mxIsComplex(prhs[0]) ||
( !(mrows == 2 && ncols == 1) &&
!(mrows == 1 && ncols == 2)))
{
mexErrMsgIdAndTxt( "MATLAB:MShaped:inputNotRealVector", "var1 is wrong.");
}
mrows = mxGetM(prhs[1]);
ncols = mxGetN(prhs[1]);
if( !mxIsDouble(prhs[1]) || mxIsComplex(prhs[1]) ||
( !(mrows == 36 && ncols == 1) &&
!(mrows == 1 && ncols == 36)))
{
mexErrMsgIdAndTxt( "MATLAB:MShaped:inputNotRealVector", "var2 is wrong.");
}
mrows = mxGetM(prhs[2]);
ncols = mxGetN(prhs[2]);
if( !mxIsDouble(prhs[2]) || mxIsComplex(prhs[2]) ||
( !(mrows == 36 && ncols == 1) &&
!(mrows == 1 && ncols == 36)))
{
mexErrMsgIdAndTxt( "MATLAB:MShaped:inputNotRealVector", "var3 is wrong.");
}
mrows = mxGetM(prhs[3]);
ncols = mxGetN(prhs[3]);
if( !mxIsDouble(prhs[3]) || mxIsComplex(prhs[3]) ||
( !(mrows == 36 && ncols == 1) &&
!(mrows == 1 && ncols == 36)))
{
mexErrMsgIdAndTxt( "MATLAB:MShaped:inputNotRealVector", "var4 is wrong.");
}
mrows = mxGetM(prhs[4]);
ncols = mxGetN(prhs[4]);
if( !mxIsDouble(prhs[4]) || mxIsComplex(prhs[4]) ||
( !(mrows == 36 && ncols == 1) &&
!(mrows == 1 && ncols == 36)))
{
mexErrMsgIdAndTxt( "MATLAB:MShaped:inputNotRealVector", "var5 is wrong.");
}
mrows = mxGetM(prhs[5]);
ncols = mxGetN(prhs[5]);
if( !mxIsDouble(prhs[5]) || mxIsComplex(prhs[5]) ||
( !(mrows == 36 && ncols == 1) &&
!(mrows == 1 && ncols == 36)))
{
mexErrMsgIdAndTxt( "MATLAB:MShaped:inputNotRealVector", "var6 is wrong.");
}
mrows = mxGetM(prhs[6]);
ncols = mxGetN(prhs[6]);
if( !mxIsDouble(prhs[6]) || mxIsComplex(prhs[6]) ||
( !(mrows == 36 && ncols == 1) &&
!(mrows == 1 && ncols == 36)))
{
mexErrMsgIdAndTxt( "MATLAB:MShaped:inputNotRealVector", "var7 is wrong.");
}
mrows = mxGetM(prhs[7]);
ncols = mxGetN(prhs[7]);
if( !mxIsDouble(prhs[7]) || mxIsComplex(prhs[7]) ||
( !(mrows == 1 && ncols == 1) &&
!(mrows == 1 && ncols == 1)))
{
mexErrMsgIdAndTxt( "MATLAB:MShaped:inputNotRealVector", "var8 is wrong.");
}
/* Assign pointers to each input. */
var1 = mxGetPr(prhs[0]);
var2 = mxGetPr(prhs[1]);
var3 = mxGetPr(prhs[2]);
var4 = mxGetPr(prhs[3]);
var5 = mxGetPr(prhs[4]);
var6 = mxGetPr(prhs[5]);
var7 = mxGetPr(prhs[6]);
var8 = mxGetPr(prhs[7]);
/* Create matrices for return arguments. */
plhs[0] = mxCreateDoubleMatrix((mwSize) 72, (mwSize) 1, mxREAL);
p_output1 = mxGetPr(plhs[0]);
/* Call the calculation subroutine. */
output1(p_output1,var1,var2,var3,var4,var5,var6,var7,var8);
}
#else // MATLAB_MEX_FILE
#include "hs_int_dx.hh"
namespace LeftStance
{
void hs_int_dx_raw(double *p_output1, const double *var1,const double *var2,const double *var3,const double *var4,const double *var5,const double *var6,const double *var7,const double *var8)
{
// Call Subroutines
output1(p_output1, var1, var2, var3, var4, var5, var6, var7, var8);
}
}
#endif // MATLAB_MEX_FILE
| 40.615385 | 190 | 0.604531 | [
"vector"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.