hexsha
stringlengths 40
40
| size
int64 7
1.05M
| ext
stringclasses 13
values | lang
stringclasses 1
value | max_stars_repo_path
stringlengths 4
269
| max_stars_repo_name
stringlengths 5
108
| max_stars_repo_head_hexsha
stringlengths 40
40
| max_stars_repo_licenses
listlengths 1
9
| max_stars_count
int64 1
191k
⌀ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
⌀ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
⌀ | max_issues_repo_path
stringlengths 4
269
| max_issues_repo_name
stringlengths 5
116
| max_issues_repo_head_hexsha
stringlengths 40
40
| max_issues_repo_licenses
listlengths 1
9
| max_issues_count
int64 1
67k
⌀ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
⌀ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
⌀ | max_forks_repo_path
stringlengths 4
269
| max_forks_repo_name
stringlengths 5
116
| max_forks_repo_head_hexsha
stringlengths 40
40
| max_forks_repo_licenses
listlengths 1
9
| max_forks_count
int64 1
105k
⌀ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
⌀ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
⌀ | content
stringlengths 7
1.05M
| avg_line_length
float64 1.21
330k
| max_line_length
int64 6
990k
| alphanum_fraction
float64 0.01
0.99
| author_id
stringlengths 2
40
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
322399a6ddafb4e2f67c58e3d8b574741c2d0f87
| 847
|
cpp
|
C++
|
pvxmatching/utils/rbitmap.cpp
|
igarashi/matchingwithvcmap
|
b1bc5441d7b45622edf58f0597f478c07ee6db75
|
[
"MIT"
] | null | null | null |
pvxmatching/utils/rbitmap.cpp
|
igarashi/matchingwithvcmap
|
b1bc5441d7b45622edf58f0597f478c07ee6db75
|
[
"MIT"
] | null | null | null |
pvxmatching/utils/rbitmap.cpp
|
igarashi/matchingwithvcmap
|
b1bc5441d7b45622edf58f0597f478c07ee6db75
|
[
"MIT"
] | null | null | null |
//
// Created by Yuki Igarashi on 2017/05/23.
//
#include "rbitmap.hpp"
namespace utils {
RBitmap::RBitmap(int size) : size_(size) {
if (size > MAX_BIT_SIZE)
throw "Exception: size exceed MAX_BIT_SIZE while creating bitmap. (Use longer int as Bitmap instead.)";
}
void RBitmap::set_value(int symbol, size_t caseId) {
temp_bitmap_[symbol].set(caseId);
temp_default_bitmap_.set(caseId);
}
void RBitmap::compile() {
auto default_mask = temp_default_bitmap_;
default_mask ^= ((1 << size_) - 1);
default_mask_ = default_mask.to_ulong();
for (auto symbol : temp_bitmap_) {
bitmap_[symbol.first] = default_mask_ | symbol.second.to_ulong();
}
}
RBitmap::Bitmap RBitmap::get_filter(int value) const {
auto exists = bitmap_.find(value);
if (exists != bitmap_.end())
return exists->second;
return default_mask_;
}
}
| 22.891892
| 107
| 0.702479
|
igarashi
|
322990c1350e8b84464e785bf64d9154bb92ecf7
| 503
|
hpp
|
C++
|
src/Common/src/PolynomialFit.hpp
|
LBNL-ETA/Windows-CalcEngine
|
c81528f25ffb79989fcb15b03f00b7c18da138c4
|
[
"BSD-3-Clause-LBNL"
] | 15
|
2018-04-20T19:16:50.000Z
|
2022-02-11T04:11:41.000Z
|
src/Common/src/PolynomialFit.hpp
|
LBNL-ETA/Windows-CalcEngine
|
c81528f25ffb79989fcb15b03f00b7c18da138c4
|
[
"BSD-3-Clause-LBNL"
] | 31
|
2016-04-05T20:56:28.000Z
|
2022-03-31T22:02:46.000Z
|
src/Common/src/PolynomialFit.hpp
|
LBNL-ETA/Windows-CalcEngine
|
c81528f25ffb79989fcb15b03f00b7c18da138c4
|
[
"BSD-3-Clause-LBNL"
] | 6
|
2018-04-20T19:38:58.000Z
|
2020-04-06T00:30:47.000Z
|
#ifndef POLYNOMIALFIT_CPOLYFIT_HPP
#define POLYNOMIALFIT_CPOLYFIT_HPP
#include <vector>
namespace FenestrationCommon
{
class PolynomialFit
{
public:
explicit PolynomialFit(std::size_t const t_Order);
// Get polynomial fit for given coefficients
std::vector<double> getCoefficients(std::vector<std::pair<double, double>> t_Table) const;
private:
std::size_t m_Order;
};
} // namespace FenestrationCommon
#endif // POLYNOMIALFIT_CPOLYFIT_HPP
| 20.958333
| 98
| 0.709742
|
LBNL-ETA
|
7a8aae924191335e0c0e561f5f39f1d8269ca4ad
| 1,982
|
cpp
|
C++
|
CrossApp/renderer/CCPrimitive.cpp
|
kingBook/cross-2.1.5
|
de4e910bd2de55d79ab3aa105d3c2f99ffa60219
|
[
"MIT"
] | 794
|
2015-01-01T04:59:48.000Z
|
2022-03-09T03:31:13.000Z
|
CrossApp/renderer/CCPrimitive.cpp
|
kingBook/cross-2.1.5
|
de4e910bd2de55d79ab3aa105d3c2f99ffa60219
|
[
"MIT"
] | 83
|
2015-01-04T06:00:35.000Z
|
2021-05-20T08:48:38.000Z
|
CrossApp/renderer/CCPrimitive.cpp
|
kingBook/cross-2.1.5
|
de4e910bd2de55d79ab3aa105d3c2f99ffa60219
|
[
"MIT"
] | 598
|
2015-01-02T02:38:13.000Z
|
2022-03-09T03:31:37.000Z
|
#include "renderer/CCPrimitive.h"
#include "renderer/CCVertexIndexBuffer.h"
NS_CC_BEGIN
Primitive* Primitive::create(VertexData* verts, IndexBuffer* indices, int type)
{
auto result = new (std::nothrow) Primitive();
if( result && result->init(verts, indices, type))
{
result->autorelease();
return result;
}
CC_SAFE_DELETE(result);
return nullptr;
}
const VertexData* Primitive::getVertexData() const
{
return _verts;
}
const IndexBuffer* Primitive::getIndexData() const
{
return _indices;
}
Primitive::Primitive()
: _verts(nullptr)
, _indices(nullptr)
, _type(GL_POINTS)
, _start(0)
, _count(0)
{
}
Primitive::~Primitive()
{
CC_SAFE_RELEASE_NULL(_verts);
CC_SAFE_RELEASE_NULL(_indices);
}
bool Primitive::init(VertexData* verts, IndexBuffer* indices, int type)
{
if( nullptr == verts ) return false;
if(verts != _verts)
{
CC_SAFE_RELEASE(_verts);
CC_SAFE_RETAIN(verts);
_verts = verts;
}
if(indices != _indices)
{
CC_SAFE_RETAIN(indices);
CC_SAFE_RELEASE(_indices);
_indices = indices;
}
_type = type;
return true;
}
void Primitive::draw()
{
if(_verts)
{
_verts->use();
if(_indices!= nullptr)
{
GLenum type = (_indices->getType() == IndexBuffer::IndexType::INDEX_TYPE_SHORT_16) ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT;
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indices->getVBO());
size_t offset = _start * _indices->getSizePerIndex();
glDrawElements((GLenum)_type, _count, type, (GLvoid*)offset);
}
else
{
glDrawArrays((GLenum)_type, _start, _count);
}
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
}
void Primitive::setStart(int start)
{
_start = start;
}
void Primitive::setCount(int count)
{
_count = count;
}
NS_CC_END
| 19.623762
| 133
| 0.624622
|
kingBook
|
7a9172749bb79019588820fc40c1676f16d2bd0e
| 12,308
|
cpp
|
C++
|
test/yulPhaser/Population.cpp
|
MrChico/solidity
|
5b4ea1eb895d5edc9a24ee5c6f96d8580eceec08
|
[
"MIT"
] | null | null | null |
test/yulPhaser/Population.cpp
|
MrChico/solidity
|
5b4ea1eb895d5edc9a24ee5c6f96d8580eceec08
|
[
"MIT"
] | null | null | null |
test/yulPhaser/Population.cpp
|
MrChico/solidity
|
5b4ea1eb895d5edc9a24ee5c6f96d8580eceec08
|
[
"MIT"
] | null | null | null |
/*
This file is part of solidity.
solidity 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.
solidity 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 solidity. If not, see <http://www.gnu.org/licenses/>.
*/
#include <test/yulPhaser/TestHelpers.h>
#include <tools/yulPhaser/Chromosome.h>
#include <tools/yulPhaser/PairSelections.h>
#include <tools/yulPhaser/Population.h>
#include <tools/yulPhaser/Program.h>
#include <tools/yulPhaser/Selections.h>
#include <libyul/optimiser/BlockFlattener.h>
#include <libyul/optimiser/SSAReverser.h>
#include <libyul/optimiser/StructuralSimplifier.h>
#include <libyul/optimiser/UnusedPruner.h>
#include <liblangutil/CharStream.h>
#include <boost/test/unit_test.hpp>
#include <cmath>
#include <optional>
#include <string>
#include <sstream>
using namespace std;
using namespace solidity::langutil;
using namespace solidity::yul;
using namespace boost::unit_test::framework;
namespace solidity::phaser::test
{
class PopulationFixture
{
protected:
shared_ptr<FitnessMetric> m_fitnessMetric = make_shared<ChromosomeLengthMetric>();
};
BOOST_AUTO_TEST_SUITE(Phaser)
BOOST_AUTO_TEST_SUITE(PopulationTest)
BOOST_AUTO_TEST_CASE(isFitter_should_use_fitness_as_the_main_criterion)
{
BOOST_TEST(isFitter(Individual(Chromosome("a"), 5), Individual(Chromosome("a"), 10)));
BOOST_TEST(!isFitter(Individual(Chromosome("a"), 10), Individual(Chromosome("a"), 5)));
BOOST_TEST(isFitter(Individual(Chromosome("aaa"), 5), Individual(Chromosome("aaaaa"), 10)));
BOOST_TEST(!isFitter(Individual(Chromosome("aaaaa"), 10), Individual(Chromosome("aaa"), 5)));
BOOST_TEST(isFitter(Individual(Chromosome("aaaaa"), 5), Individual(Chromosome("aaa"), 10)));
BOOST_TEST(!isFitter(Individual(Chromosome("aaa"), 10), Individual(Chromosome("aaaaa"), 5)));
}
BOOST_AUTO_TEST_CASE(isFitter_should_use_alphabetical_order_when_fitness_is_the_same)
{
BOOST_TEST(isFitter(Individual(Chromosome("a"), 3), Individual(Chromosome("c"), 3)));
BOOST_TEST(!isFitter(Individual(Chromosome("c"), 3), Individual(Chromosome("a"), 3)));
BOOST_TEST(isFitter(Individual(Chromosome("a"), 3), Individual(Chromosome("aa"), 3)));
BOOST_TEST(!isFitter(Individual(Chromosome("aa"), 3), Individual(Chromosome("a"), 3)));
BOOST_TEST(isFitter(Individual(Chromosome("T"), 3), Individual(Chromosome("a"), 3)));
BOOST_TEST(!isFitter(Individual(Chromosome("a"), 3), Individual(Chromosome("T"), 3)));
}
BOOST_AUTO_TEST_CASE(isFitter_should_return_false_for_identical_individuals)
{
BOOST_TEST(!isFitter(Individual(Chromosome("a"), 3), Individual(Chromosome("a"), 3)));
BOOST_TEST(!isFitter(Individual(Chromosome("acT"), 0), Individual(Chromosome("acT"), 0)));
}
BOOST_FIXTURE_TEST_CASE(constructor_should_copy_chromosomes_compute_fitness_and_sort_chromosomes, PopulationFixture)
{
vector<Chromosome> chromosomes = {
Chromosome::makeRandom(5),
Chromosome::makeRandom(15),
Chromosome::makeRandom(10),
};
Population population(m_fitnessMetric, chromosomes);
vector<Individual> const& individuals = population.individuals();
BOOST_TEST(individuals.size() == 3);
BOOST_TEST(individuals[0].fitness == 5);
BOOST_TEST(individuals[1].fitness == 10);
BOOST_TEST(individuals[2].fitness == 15);
BOOST_TEST(individuals[0].chromosome == chromosomes[0]);
BOOST_TEST(individuals[1].chromosome == chromosomes[2]);
BOOST_TEST(individuals[2].chromosome == chromosomes[1]);
}
BOOST_FIXTURE_TEST_CASE(makeRandom_should_get_chromosome_lengths_from_specified_generator, PopulationFixture)
{
size_t chromosomeCount = 30;
size_t maxLength = 5;
assert(chromosomeCount % maxLength == 0);
auto nextLength = [counter = 0, maxLength]() mutable { return counter++ % maxLength; };
auto population = Population::makeRandom(m_fitnessMetric, chromosomeCount, nextLength);
// We can't rely on the order since the population sorts its chromosomes immediately but
// we can check the number of occurrences of each length.
for (size_t length = 0; length < maxLength; ++length)
BOOST_TEST(
count_if(
population.individuals().begin(),
population.individuals().end(),
[&length](auto const& individual) { return individual.chromosome.length() == length; }
) == chromosomeCount / maxLength
);
}
BOOST_FIXTURE_TEST_CASE(makeRandom_should_get_chromosome_lengths_from_specified_range, PopulationFixture)
{
auto population = Population::makeRandom(m_fitnessMetric, 100, 5, 10);
BOOST_TEST(all_of(
population.individuals().begin(),
population.individuals().end(),
[](auto const& individual){ return 5 <= individual.chromosome.length() && individual.chromosome.length() <= 10; }
));
}
BOOST_FIXTURE_TEST_CASE(makeRandom_should_use_random_chromosome_length, PopulationFixture)
{
SimulationRNG::reset(1);
constexpr int populationSize = 200;
constexpr int minLength = 5;
constexpr int maxLength = 10;
constexpr double relativeTolerance = 0.05;
auto population = Population::makeRandom(m_fitnessMetric, populationSize, minLength, maxLength);
vector<size_t> samples = chromosomeLengths(population);
const double expectedValue = (maxLength + minLength) / 2.0;
const double variance = ((maxLength - minLength + 1) * (maxLength - minLength + 1) - 1) / 12.0;
BOOST_TEST(abs(mean(samples) - expectedValue) < expectedValue * relativeTolerance);
BOOST_TEST(abs(meanSquaredError(samples, expectedValue) - variance) < variance * relativeTolerance);
}
BOOST_FIXTURE_TEST_CASE(makeRandom_should_return_population_with_random_chromosomes, PopulationFixture)
{
SimulationRNG::reset(1);
constexpr int populationSize = 100;
constexpr int chromosomeLength = 30;
constexpr double relativeTolerance = 0.01;
map<string, size_t> stepIndices = enumerateOptmisationSteps();
auto population = Population::makeRandom(m_fitnessMetric, populationSize, chromosomeLength, chromosomeLength);
vector<size_t> samples;
for (auto& individual: population.individuals())
for (auto& step: individual.chromosome.optimisationSteps())
samples.push_back(stepIndices.at(step));
const double expectedValue = (stepIndices.size() - 1) / 2.0;
const double variance = (stepIndices.size() * stepIndices.size() - 1) / 12.0;
BOOST_TEST(abs(mean(samples) - expectedValue) < expectedValue * relativeTolerance);
BOOST_TEST(abs(meanSquaredError(samples, expectedValue) - variance) < variance * relativeTolerance);
}
BOOST_FIXTURE_TEST_CASE(makeRandom_should_compute_fitness, PopulationFixture)
{
auto population = Population::makeRandom(m_fitnessMetric, 3, 5, 10);
BOOST_TEST(population.individuals()[0].fitness == m_fitnessMetric->evaluate(population.individuals()[0].chromosome));
BOOST_TEST(population.individuals()[1].fitness == m_fitnessMetric->evaluate(population.individuals()[1].chromosome));
BOOST_TEST(population.individuals()[2].fitness == m_fitnessMetric->evaluate(population.individuals()[2].chromosome));
}
BOOST_FIXTURE_TEST_CASE(plus_operator_should_add_two_populations, PopulationFixture)
{
BOOST_CHECK_EQUAL(
Population(m_fitnessMetric, {Chromosome("ac"), Chromosome("cx")}) +
Population(m_fitnessMetric, {Chromosome("g"), Chromosome("h"), Chromosome("iI")}),
Population(m_fitnessMetric, {Chromosome("ac"), Chromosome("cx"), Chromosome("g"), Chromosome("h"), Chromosome("iI")})
);
}
BOOST_FIXTURE_TEST_CASE(select_should_return_population_containing_individuals_indicated_by_selection, PopulationFixture)
{
Population population(m_fitnessMetric, {Chromosome("a"), Chromosome("c"), Chromosome("g"), Chromosome("h")});
RangeSelection selection(0.25, 0.75);
assert(selection.materialise(population.individuals().size()) == (vector<size_t>{1, 2}));
BOOST_TEST(
population.select(selection) ==
Population(m_fitnessMetric, {population.individuals()[1].chromosome, population.individuals()[2].chromosome})
);
}
BOOST_FIXTURE_TEST_CASE(select_should_include_duplicates_if_selection_contains_duplicates, PopulationFixture)
{
Population population(m_fitnessMetric, {Chromosome("a"), Chromosome("c")});
MosaicSelection selection({0, 1}, 2.0);
assert(selection.materialise(population.individuals().size()) == (vector<size_t>{0, 1, 0, 1}));
BOOST_TEST(population.select(selection) == Population(m_fitnessMetric, {
population.individuals()[0].chromosome,
population.individuals()[1].chromosome,
population.individuals()[0].chromosome,
population.individuals()[1].chromosome,
}));
}
BOOST_FIXTURE_TEST_CASE(select_should_return_empty_population_if_selection_is_empty, PopulationFixture)
{
Population population(m_fitnessMetric, {Chromosome("a"), Chromosome("c")});
RangeSelection selection(0.0, 0.0);
assert(selection.materialise(population.individuals().size()).empty());
BOOST_TEST(population.select(selection).individuals().empty());
}
BOOST_FIXTURE_TEST_CASE(mutate_should_return_population_containing_individuals_indicated_by_selection_with_mutation_applied, PopulationFixture)
{
Population population(m_fitnessMetric, {Chromosome("aa"), Chromosome("cc"), Chromosome("gg"), Chromosome("hh")});
RangeSelection selection(0.25, 0.75);
assert(selection.materialise(population.individuals().size()) == (vector<size_t>{1, 2}));
Population expectedPopulation(m_fitnessMetric, {Chromosome("fc"), Chromosome("fg")});
BOOST_TEST(population.mutate(selection, geneSubstitution(0, BlockFlattener::name)) == expectedPopulation);
}
BOOST_FIXTURE_TEST_CASE(mutate_should_include_duplicates_if_selection_contains_duplicates, PopulationFixture)
{
Population population(m_fitnessMetric, {Chromosome("aa"), Chromosome("aa")});
RangeSelection selection(0.0, 1.0);
assert(selection.materialise(population.individuals().size()) == (vector<size_t>{0, 1}));
BOOST_TEST(
population.mutate(selection, geneSubstitution(0, BlockFlattener::name)) ==
Population(m_fitnessMetric, {Chromosome("fa"), Chromosome("fa")})
);
}
BOOST_FIXTURE_TEST_CASE(mutate_should_return_empty_population_if_selection_is_empty, PopulationFixture)
{
Population population(m_fitnessMetric, {Chromosome("aa"), Chromosome("cc")});
RangeSelection selection(0.0, 0.0);
assert(selection.materialise(population.individuals().size()).empty());
BOOST_TEST(population.mutate(selection, geneSubstitution(0, BlockFlattener::name)).individuals().empty());
}
BOOST_FIXTURE_TEST_CASE(crossover_should_return_population_containing_individuals_indicated_by_selection_with_crossover_applied, PopulationFixture)
{
Population population(m_fitnessMetric, {Chromosome("aa"), Chromosome("cc"), Chromosome("gg"), Chromosome("hh")});
PairMosaicSelection selection({{0, 1}, {2, 1}}, 1.0);
assert(selection.materialise(population.individuals().size()) == (vector<tuple<size_t, size_t>>{{0, 1}, {2, 1}, {0, 1}, {2, 1}}));
Population expectedPopulation(m_fitnessMetric, {Chromosome("ac"), Chromosome("ac"), Chromosome("gc"), Chromosome("gc")});
BOOST_TEST(population.crossover(selection, fixedPointCrossover(0.5)) == expectedPopulation);
}
BOOST_FIXTURE_TEST_CASE(crossover_should_include_duplicates_if_selection_contains_duplicates, PopulationFixture)
{
Population population(m_fitnessMetric, {Chromosome("aa"), Chromosome("aa")});
PairMosaicSelection selection({{0, 0}, {1, 1}}, 2.0);
assert(selection.materialise(population.individuals().size()) == (vector<tuple<size_t, size_t>>{{0, 0}, {1, 1}, {0, 0}, {1, 1}}));
BOOST_TEST(
population.crossover(selection, fixedPointCrossover(0.5)) ==
Population(m_fitnessMetric, {Chromosome("aa"), Chromosome("aa"), Chromosome("aa"), Chromosome("aa")})
);
}
BOOST_FIXTURE_TEST_CASE(crossover_should_return_empty_population_if_selection_is_empty, PopulationFixture)
{
Population population(m_fitnessMetric, {Chromosome("aa"), Chromosome("cc")});
PairMosaicSelection selection({}, 0.0);
assert(selection.materialise(population.individuals().size()).empty());
BOOST_TEST(population.crossover(selection, fixedPointCrossover(0.5)).individuals().empty());
}
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_SUITE_END()
}
| 41.16388
| 147
| 0.772262
|
MrChico
|
7a92578132cd9170dd4baece915ccdaab616239c
| 730
|
cpp
|
C++
|
TCP_ServerClient/AsyncTCPServer_Factory.cpp
|
aliyavuzkahveci/tcp_serverclient
|
c37111e21069670972f0fcd08584710af42f591a
|
[
"MIT"
] | null | null | null |
TCP_ServerClient/AsyncTCPServer_Factory.cpp
|
aliyavuzkahveci/tcp_serverclient
|
c37111e21069670972f0fcd08584710af42f591a
|
[
"MIT"
] | null | null | null |
TCP_ServerClient/AsyncTCPServer_Factory.cpp
|
aliyavuzkahveci/tcp_serverclient
|
c37111e21069670972f0fcd08584710af42f591a
|
[
"MIT"
] | null | null | null |
#include "AsyncTCPServer_Factory.h"
#include "AsyncTCPServer_Impl.h"
namespace AsyncTCP
{
AsyncTCPServer_Factory_Ptr AsyncTCPServer_Factory::m_instance = nullptr;
AsyncTCPServer_Factory_Ptr& AsyncTCPServer_Factory::getInstance()
{
if (m_instance == nullptr)
m_instance = std::unique_ptr<AsyncTCPServer_Factory>(new AsyncTCPServer_Factory());
return m_instance;
}
AsyncTCPServer_Factory::AsyncTCPServer_Factory()
{
}
AsyncTCPServer_Factory::~AsyncTCPServer_Factory()
{
}
AsyncTCPServer_Ptr AsyncTCPServer_Factory::createAsyncTCPServer(
AsyncTCPServer_Subscriber_Ptr subscriberPtr, short port)
{
return AsyncTCPServer_Ptr(new AsyncTCPServer_Impl(subscriberPtr, port));
}
}
| 24.333333
| 87
| 0.773973
|
aliyavuzkahveci
|
7a9a54ee622437b984766c046bb2611a0d0565df
| 16,941
|
cpp
|
C++
|
src/helpers/ExtraHelpers.cpp
|
mdhooge/qt-handlebars
|
e950052e0e758413ee09a9c91499481a3ea51b11
|
[
"MIT"
] | 1
|
2022-01-11T19:57:39.000Z
|
2022-01-11T19:57:39.000Z
|
src/helpers/ExtraHelpers.cpp
|
mdhooge/qt-handlebars
|
e950052e0e758413ee09a9c91499481a3ea51b11
|
[
"MIT"
] | null | null | null |
src/helpers/ExtraHelpers.cpp
|
mdhooge/qt-handlebars
|
e950052e0e758413ee09a9c91499481a3ea51b11
|
[
"MIT"
] | 2
|
2016-11-17T12:35:03.000Z
|
2022-01-11T19:57:19.000Z
|
#include "ExtraHelpers.h"
#include <QChar>
#include <QDateTime>
#include <QDir>
#include <QFile>
#include <QObject>
#include <QTextStream>
#include "HandlebarsParser.h"
namespace Handlebars {
const escape_fn
fn_noEscape,
fn_htmlEscape { [] (const QString& str ) { return str.toHtmlEscaped(); } };
void registerAllHelpers( Parser & parser ) {
registerBitwiseHelpers( parser );
registerBooleanHelpers( parser );
registerFileHelpers( parser );
registerIntegerHelpers( parser );
registerPropertyHelpers( parser );
registerStringHelpers( parser );
}
// ###
// ### Bit-wise Helpers
// ###
static QVariant
integerTypes_bit( const QString& tmplate, int bits )
{
if( bits <= 8 )
return tmplate.arg( "8" );
if( bits <= 16 )
return tmplate.arg( "16" );
if( bits <= 32 )
return tmplate.arg( "32" );
return tmplate.arg( "64" );
}
void
registerBitwiseHelpers( Parser & parser )
{
parser.registerHelper(
"bit-mask", [] (
const RenderingContext &,
const helper_params & params,
const helper_options & )
{
int shift = 64 - params.value( 0 ).toInt();
uint64_t mask { UINT64_MAX >> shift };
QString out( "0x" );
out.append( QString::number( mask, 16 ).toUpper() );
return out;
} );
parser.registerHelper(
"int_fast", [] (
const RenderingContext &,
const helper_params & params,
const helper_options & )
{
if( params.size() != 2 )
return QVariant(); // RTFM
int bits = params.at( 1 ).toInt();
if( params.at( 0 ).toString().toUpper() == "BYTE" )
bits *= 8;
return integerTypes_bit( "int_fast%1_t", bits );
} );
parser.registerHelper(
"int_least", [] (
const RenderingContext &,
const helper_params & params,
const helper_options & )
{
if( params.size() != 2 )
return QVariant(); // RTFM
int bits = params.at( 1 ).toInt();
if( params.at( 0 ).toString().toUpper() == "BYTE" )
bits *= 8;
return integerTypes_bit( "int_least%1_t", bits );
} );
parser.registerHelper(
"uint_fast", [] (
const RenderingContext &,
const helper_params & params,
const helper_options & )
{
if( params.size() != 2 )
return QVariant(); // RTFM
int bits = params.at( 1 ).toInt();
if( params.at( 0 ).toString().toUpper() == "BYTE" )
bits *= 8;
return integerTypes_bit( "uint_fast%1_t", bits );
} );
parser.registerHelper(
"uint_least", [] (
const RenderingContext &,
const helper_params & params,
const helper_options & )
{
if( params.size() != 2 )
return QVariant(); // RTFM
int bits = params.at( 1 ).toInt();
if( params.at( 0 ).toString().toUpper() == "BYTE" )
bits *= 8;
return integerTypes_bit( "uint_least%1_t", bits );
} );
}
// ###
// ### Boolean Helpers
// ###
void
registerBooleanHelpers( Parser & parser )
{
parser.registerHelper(
"==", [] ( const RenderingContext &, const helper_params & params, const helper_options & )
{ return params.value( 0 ) == params.value( 1 ); } );
parser.registerHelper(
"!=", [] ( const RenderingContext &, const helper_params & params, const helper_options & )
{ return params.value( 0 ) != params.value( 1 ); } );
parser.registerHelper(
"<", [] ( const RenderingContext &, const helper_params & params, const helper_options & )
{ return params.value( 0 ) < params.value( 1 ); } );
parser.registerHelper(
"<=", [] ( const RenderingContext &, const helper_params & params, const helper_options & )
{ return params.value( 0 ) <= params.value( 1 ); } );
parser.registerHelper(
">", [] ( const RenderingContext &, const helper_params & params, const helper_options & )
{ return params.value( 0 ) > params.value( 1 ); } );
parser.registerHelper(
">=", [] ( const RenderingContext &, const helper_params & params, const helper_options & )
{ return params.value( 0 ) >= params.value( 1 ); } );
parser.registerHelper(
"AND", [] (
const RenderingContext & c,
const helper_params & params,
const helper_options & )
{
bool r = true;
for( auto v : params ) {
r = r && c.propertyAsBool( v );
if( ! r ) break;
}
return r;
} );
parser.registerHelper(
"NOT", [] ( const RenderingContext & c, const helper_params & params, const helper_options & )
{ return ! c.propertyAsBool( params.value( 0 )); } );
parser.registerHelper(
"OR", [] (
const RenderingContext & c,
const helper_params & params,
const helper_options & )
{
bool r = false;
for( auto v : params ) {
r = r || c.propertyAsBool( v );
if( r ) break;
}
return r;
} );
}
// ###
// ### File Helpers
// ###
/**
* Concatenate all params to create file path & name
*/
static QString
pathConcatenate( const helper_params & params )
{
QString filepath;
for( auto element : params )
filepath += element.toString();
return filepath;
}
/**
* Recursively copy content of a folder to another folder.
*
* - source must be an existing folder.
*/
static void
copyRecursively( const QString& source, const QString& target )
{
QDir sourceDir( source );
QDir targetDir( target );
// Create target folder if needed
if( ! targetDir.exists() )
targetDir.mkpath( "." );
// Loop & copy
auto list = sourceDir.entryInfoList( QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot | QDir::Readable );
for( int i = 0; i < list.size(); ++i )
{
// Create paths
auto fileInfo = list.at( i );
QString
filename( fileInfo.fileName() ),
sourcePath( sourceDir.filePath( filename )),
targetPath( targetDir.filePath( filename ));
// Copy
if( fileInfo.isDir() )
copyRecursively( sourcePath, targetPath );
else
QFile::copy( sourcePath, targetPath );
}
}
void
registerFileHelpers( Parser & parser )
{
parser.registerHelper(
"cd", [] (
const RenderingContext &,
const helper_params & params,
const helper_options & )
{
QDir::setCurrent( pathConcatenate( params ));
return QVariant();
} );
parser.registerHelper(
"copy_into-current-folder_from", [] (
const RenderingContext & context,
const helper_params & params,
const helper_options & options)
{
// Check source
QString source( pathConcatenate( params ));
QFileInfo sourceFileInfo( source );
if( ! sourceFileInfo.exists() ) {
context.warning(
QString( "Handlebars.helper.copy: Source \"%1\" doesn't exist." ).arg( source ));
return QVariant();
}
// "contentOnly" option
bool contentOnly = options.value( "contentOnly" ).toBool();
// Copy file or folder
if ( sourceFileInfo.isDir() ) {
QString targetPath( contentOnly ? "." : sourceFileInfo.fileName() );
copyRecursively( source, targetPath );
}
else
QFile::copy( source, sourceFileInfo.fileName() );
return QVariant();
} );
parser.registerHelper(
"mkdir", [] (
const RenderingContext &,
const helper_params & params,
const helper_options & )
{
QDir::current().mkpath( pathConcatenate( params ));
return QVariant();
} );
parser.registerHelper(
"temp_path", [] (
const RenderingContext &,
const helper_params &,
const helper_options & )
{
return QVariant( QDir::tempPath() );
} );
parser.registerBlockHelper(
"create_file", [] (
RenderingContext & context,
const helper_params & params,
const helper_options & options,
const NodeList & truthy,
const NodeList &
)
{
if( params.size() == 0 )
return; // RTFM
// Compute file path & name
QString filepath( pathConcatenate( params ));
// If property "output_folder" exists, use it to compute a relative path (for log messages)
QString relative_filepath( filepath );
QVariant output_folder( context.getProperty( "output_folder" ));
if( output_folder.isValid() ) {
QDir output_dir( output_folder.toString() );
relative_filepath = output_dir.relativeFilePath(
QDir::current().absoluteFilePath( filepath ));
}
// Open file
QFile file( filepath );
if( ! file.open( QIODevice::WriteOnly )) {
context.warning( QString( "Handlebars.helper.create_file(%1): error #%2" )
.arg( relative_filepath )
.arg( file.error() ));
return;
}
context.info( QString( "Handlebars.helper.create_file(%1)" ).arg( relative_filepath ));
// Create context with file info
QFileInfo fi( filepath );
QVariantHash infos;
infos.insert( "@basename", fi.baseName() );
infos.insert( "@filename", fi.fileName() );
infos.insert( "@filepath", fi.filePath() );
infos.insert( "@filepath_absolute", fi.canonicalFilePath() );
if( output_folder.isValid() )
infos.insert( "@filepath_relative", relative_filepath );
context.pushPropertiesContext( infos );
// If options were given, add them to the context
if( ! options.isEmpty() )
context.pushPropertiesContext( options );
// Create file value
QTextStream stream( & file );
context.render( truthy, & stream );
file.close();
// Remove temporary contexts
if( ! options.isEmpty() )
context.popPropertiesContext();
context.popPropertiesContext();
} );
}
// ###
// ### Integer Helpers
// ###
void
registerIntegerHelpers( Parser & parser )
{
parser.registerHelper(
"range", [] (
const RenderingContext &,
const helper_params & params,
const helper_options & ) -> QVariant
{
if( params.size() < 2 )
return QVariant(); // RTFM
// Retrieve parameters
int i = params.at( 0 ).toInt();
int end = params.at( 1 ).toInt();
int incr = ( params.size() > 2 )
? params.at( 2 ).toInt()
: ( i <= end ) ? 1 : -1;
// Loop
QVariantList range;
for(; (incr>0) ? i<=end : i>=end; i+=incr )
range.append( i );
return range;
} );
}
// ###
// ### Property Helpers
// ###
/**
* Loops over a <Container<QVariant>>
*
* The container is obtained from the "anonymous" QVariant.
*/
template< template<typename> class C >
static QVariant
objectsWithProperty(
const QVariant& q_input,
const helper_params & params
)
{
C< QVariant > input( q_input.value< C< QVariant > > () );
C< QVariant > output;
for( QVariant q_var : input ) {
QObject* object( q_var.value<QObject*>() );
if( object != nullptr )
for( auto propertyName : params )
if( object->property( propertyName.toByteArray().constData() ).toBool() ) {
output.append( q_var );
break;
}
}
return output;
}
/**
* Loops over a <Container< QString, QVariant >>
*
* The container is obtained from the "anonymous" QVariant.
*/
template< template<typename,typename> class C >
static QVariant
objectsWithProperty(
const QVariant& q_input,
const helper_params & params
)
{
C< QString,QVariant > input( q_input.value< C< QString,QVariant > > () );
C< QString,QVariant > output;
for( auto i = input.constBegin(), end = input.constEnd(); i != end; ++i ) {
QVariant q_var( *i );
QObject* object( q_var.value<QObject*>() );
if( object != nullptr )
for( auto propertyName : params )
if( object->property( propertyName.toByteArray().constData() ).toBool() ) {
output.insert( i.key(), i.value() );
break;
}
}
return output;
}
void
registerPropertyHelpers( Parser & parser )
{
parser.registerHelper(
"objects-with-property", [] (
const RenderingContext &,
const helper_params & c_params,
const helper_options & ) -> QVariant
{
if( c_params.size() < 2 )
return QVariant(); // RTFM
// Find type of container
auto params = c_params;
auto container( params.takeFirst() );
auto type( QMetaType::Type( container.type() ));
switch( type )
{
case QMetaType::QVariantHash:
return objectsWithProperty <QHash> ( container, params );
break;
case QMetaType::QVariantList:
return objectsWithProperty <QList> ( container, params );
break;
case QMetaType::QVariantMap:
return objectsWithProperty <QMap> ( container, params );
break;
default:
return QVariant();
break;
}
} );
parser.registerHelper(
"container-value", [] (
const RenderingContext &,
const helper_params & params,
const helper_options & ) -> QVariant
{
if( params.size() < 2 )
return QVariant(); // RTFM
auto container = params.at( 0 );
auto key = params.at( 1 ).toString();
return RenderingContext::findPropertyInContext( key, container );
} );
parser.registerBlockHelper(
"set_property", [] (
RenderingContext & context,
const helper_params & params,
const helper_options & options,
const NodeList & truthy,
const NodeList &
)
{
if( params.size() < 1 ) return; // RTFM
auto name = params.at( 0 ).toString();
// Check if property already exists and "only-if" is set to "new"
if( options.value( "only-if" ).toString() == "new" && context.hasProperty( name ))
return;
QVariant value;
if( params.size() == 2 )
value = params.at( 1 );
else {
// If options were given, add them to the context
if( ! options.isEmpty() )
context.pushPropertiesContext( options );
// Use temporary output to collect inner block
QString content;
QTextStream stream( & content, QIODevice::WriteOnly );
// Create property value
context.render( truthy, & stream );
// Remove any options
if( ! options.isEmpty() )
context.popPropertiesContext();
value = content;
}
// Insert property into context (SIDE-EFFECT!)
context.addProperty( name, value );
} );
}
// ###
// ### String Helpers
// ###
void
registerStringHelpers( Parser & parser )
{
parser.registerHelper(
"camelize", [] (
const RenderingContext &,
const helper_params & p,
const helper_options & )
{
QString in( p.value( 0 ).toString() );
QString out;
out.reserve( in.size() );
//
bool upper = true;
for( QChar c : in ) {
if( c.isLetterOrNumber() ) {
out += upper ? c.toUpper() : c;
upper = false;
} else
upper = true;
}
//
if( out.isEmpty() || ! out[0].isLetter() )
out.prepend( '_' );
//
return out;
} );
// date [<format> =]
parser.registerHelper(
"date", [] (
const RenderingContext &,
const helper_params & p,
const helper_options & )
{
auto format = p.value( 0 ).toString();
if( format.isEmpty() ) format = "yyyy-MM-ddTHH:mmt";
return QDateTime::currentDateTime().toString( format );
} );
parser.registerHelper(
"hex", [] (
const RenderingContext &,
const helper_params & p,
const helper_options & opt )
{
qint64 value = p.value( 0 ).toLongLong();
int width = opt.value( "width", 0 ).toInt();
QString fillS = opt.value( "fill" ).toString();
QChar fill = fillS.size() > 0 ? fillS.at( 0 ) : ' ';
return QVariant( QString( "%1" ).arg( value, width, 16, fill ));
} );
parser.registerHelper(
"link", [] (
const RenderingContext &,
const helper_params & p,
const helper_options & opt )
{
QStringList attrs;
for( auto i = opt.begin(), end = opt.end(); i != end; ++i )
attrs.append( QString( "%1=\"%2\"" ).arg( i.key() ).arg( i.value().toString() ));
return QVariant( QString( "<a %1>%2</a>" )
.arg( attrs.join( ' ' ))
.arg( p.value( 0 ).toString() ));
} );
parser.registerHelper(
"print", [] (
const RenderingContext &,
const helper_params & p,
const helper_options & )
{
QString out;
QTextStream stream( & out, QIODevice::WriteOnly );
for( auto i = p.begin(), end = p.end() ;;)
{
stream << i->typeName() << '(' << i->toString() << ')';
if( ++i == end )
break;
stream << ' ';
}
return QVariant( out );
} );
parser.registerHelper(
"upper", [] (
const RenderingContext &,
const helper_params & p,
const helper_options & )
{
return QVariant( p.value( 0 ).toString().toUpper() );
} );
}
}// namespace Handlebars
| 25.90367
| 106
| 0.581725
|
mdhooge
|
7a9c02bc21da5bd673f3a972a10d7862f117a9b4
| 1,524
|
hpp
|
C++
|
libs/ledger/include/ledger/tx_status_http_interface.hpp
|
devjsc/ledger-1
|
2aa68e05b9f9c10a9971fc8ddf4848695511af3c
|
[
"Apache-2.0"
] | 3
|
2019-07-11T08:49:27.000Z
|
2021-09-07T16:49:15.000Z
|
libs/ledger/include/ledger/tx_status_http_interface.hpp
|
devjsc/ledger-1
|
2aa68e05b9f9c10a9971fc8ddf4848695511af3c
|
[
"Apache-2.0"
] | null | null | null |
libs/ledger/include/ledger/tx_status_http_interface.hpp
|
devjsc/ledger-1
|
2aa68e05b9f9c10a9971fc8ddf4848695511af3c
|
[
"Apache-2.0"
] | 2
|
2019-07-13T12:45:22.000Z
|
2021-03-12T08:48:57.000Z
|
#pragma once
//------------------------------------------------------------------------------
//
// Copyright 2018-2019 Fetch.AI Limited
//
// 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 "http/module.hpp"
namespace fetch {
namespace ledger {
class TransactionStatusCache;
class TxStatusHttpInterface : public http::HTTPModule
{
public:
// Construction / Destruction
explicit TxStatusHttpInterface(TransactionStatusCache &status_cache);
TxStatusHttpInterface(TxStatusHttpInterface const &) = delete;
TxStatusHttpInterface(TxStatusHttpInterface &&) = delete;
~TxStatusHttpInterface() = default;
// Operators
TxStatusHttpInterface &operator=(TxStatusHttpInterface const &) = delete;
TxStatusHttpInterface &operator=(TxStatusHttpInterface &&) = delete;
private:
TransactionStatusCache &status_cache_;
};
} // namespace ledger
} // namespace fetch
| 33.130435
| 80
| 0.654199
|
devjsc
|
7a9ea246aeb7df0f5298e76b12ecffced085fafa
| 3,983
|
cpp
|
C++
|
src/main/cpp/ofxOboeAndroidSoundPlayer.cpp
|
danoli3/ofxOboe
|
61b628c48c18c44a4f21a695549fa95286d86779
|
[
"MIT"
] | 1
|
2021-11-05T08:33:34.000Z
|
2021-11-05T08:33:34.000Z
|
src/main/cpp/ofxOboeAndroidSoundPlayer.cpp
|
danoli3/ofxOboe
|
61b628c48c18c44a4f21a695549fa95286d86779
|
[
"MIT"
] | null | null | null |
src/main/cpp/ofxOboeAndroidSoundPlayer.cpp
|
danoli3/ofxOboe
|
61b628c48c18c44a4f21a695549fa95286d86779
|
[
"MIT"
] | null | null | null |
//
// Created by Dan Rosser on 10/9/21.
//
#include "ofxOboeAndroidSoundPlayer.h"
bool ofxOboeAndroidSoundPlayer::load(const std::filesystem::path& fileName, bool stream) {
AudioProperties targetProperties {
.channelCount = ofxOboe::getChannelCount(),
.sampleRate = ofxOboe::getSampleRate()
};
filePath = fileName.c_str();
std::shared_ptr<ofxOboeAssetDataSource> trackSource {
ofxOboeAssetDataSource::newFromCompressedAsset(ofxOboe::getAssetManager(), fileName.c_str(), targetProperties, AASSET_MODE_UNKNOWN)
};
if (trackSource == nullptr){
ofLogError("ofxOboe") << "Could not load source data for track:" << fileName;
return false;
}
track = std::make_unique<ofxOboePlayer>(trackSource);
if(track != nullptr) {
track->setPlaying(false);
track->setLooping(isLooping);
ofxOboe::mixer.addTrack(track.get());
} else
return false;
return true;
}
void ofxOboeAndroidSoundPlayer::unload() {
if(track) {
track->setPlaying(false);
track.reset();
track.release();
track = nullptr;
state = ofxOboeAndroidSoundState::UNLOADED;
}
}
void ofxOboeAndroidSoundPlayer::play() {
if(track)
track->setPlaying(true);
}
void ofxOboeAndroidSoundPlayer::stop() {
if(track) {
track->setPlaying(false);
}
}
void ofxOboeAndroidSoundPlayer::setVolume(float vol) {
if(track) {
track->setVolume(vol);
}
}
void ofxOboeAndroidSoundPlayer::setPan(float vol) {
}
void ofxOboeAndroidSoundPlayer::setSpeed(float spd) {
}
void ofxOboeAndroidSoundPlayer::setPaused(bool bP) {
if(track) {
track->setPlaying(false);
}
}
void ofxOboeAndroidSoundPlayer::setLoop(bool bLp) {
if(track) {
track->setLooping(bLp);
}
}
void ofxOboeAndroidSoundPlayer::setMultiPlay(bool bMp) {
}
void ofxOboeAndroidSoundPlayer::setPosition(float pct) {
if(track) {
track->setPlayHead((int)pct);
}
}
void ofxOboeAndroidSoundPlayer::setPositionMS(int ms) {
if(track) {
track->setPlayHead(ms);
}
}
float ofxOboeAndroidSoundPlayer::getPosition() const {
return 1.0f;
}
int ofxOboeAndroidSoundPlayer::getPositionMS() const {
return 0;
}
bool ofxOboeAndroidSoundPlayer::isPlaying() const {
if(track) {
return track->getPlaying();
}
return false;
}
float ofxOboeAndroidSoundPlayer::getSpeed() const {
return 1.0f;
}
float ofxOboeAndroidSoundPlayer::getPan() const {
return 1.0f;
}
bool ofxOboeAndroidSoundPlayer::isPaused() const {
return false;
}
float ofxOboeAndroidSoundPlayer::getVolume() const {
return 1.0f;
}
bool ofxOboeAndroidSoundPlayer::isLoaded() const {
if(track) {
return true;
}
return false;
}
void ofxOboeAndroidSoundPlayer::audioIn(ofSoundBuffer&) const {
}
void ofxOboeAndroidSoundPlayer::audioOut(ofSoundBuffer&) const {
}
ofxOboeAndroidSoundPlayer::~ofxOboeAndroidSoundPlayer() {
}
oboe::DataCallbackResult
ofxOboeAndroidSoundPlayer::onAudioReady(AudioStream *oboeStream, void *audioData,
int32_t numFrames) {
// auto *outputBuffer = static_cast<float *>(audioData);
//
// int64_t nextClapEventMs;
//
// for (int i = 0; i < numFrames; ++i) {
//
// songPositionMS = convertFramesToMillis(
// currentFrame,
// ofxOboe::getSampleRate());
//
//
// ofxOboe::mixer.renderAudio(outputBuffer+(oboeStream->getChannelCount()*i), 1);
// currentFrame++;
// }
return DataCallbackResult::Continue;
}
void ofxOboeAndroidSoundPlayer::onErrorAfterClose(AudioStream *oboeStream, Result error) {
if (error == Result::ErrorDisconnected){
state = ofxOboeAndroidSoundState::FAILED;
currentFrame = 0;
songPositionMS = 0;
lastUpdateTime = 0;
//start();
} else {
//LOGE("Stream error: %s", convertToText(error));
}
}
| 23.850299
| 143
| 0.656038
|
danoli3
|
7aa12e259b0d9d4631b6095a6b4f9710001c8f20
| 1,028
|
cpp
|
C++
|
project2D/Spring.cpp
|
Master-Mas/2D-Physics-Exmaple
|
a4ee3401daeb9150b8d2c8953bf6b0e70cacf93a
|
[
"MIT"
] | null | null | null |
project2D/Spring.cpp
|
Master-Mas/2D-Physics-Exmaple
|
a4ee3401daeb9150b8d2c8953bf6b0e70cacf93a
|
[
"MIT"
] | null | null | null |
project2D/Spring.cpp
|
Master-Mas/2D-Physics-Exmaple
|
a4ee3401daeb9150b8d2c8953bf6b0e70cacf93a
|
[
"MIT"
] | null | null | null |
#include "Spring.h"
Spring::Spring(RigidBody2D * join1, RigidBody2D * join2, float springConstant, float damping)
{
this->join1 = join1;
this->join2 = join2;
this->springConstant = springConstant;
this->damping = damping;
this->restDistance = glm::length(join1->getTransform().getPosition() - join2->getTransform().getPosition());
}
Spring::~Spring()
{
}
void Spring::fixedUpdate(float fixedTimeStep, glm::vec2 gravity)
{
float force = -springConstant * (glm::distance(join1->getTransform().getPosition(), join2->getTransform().getPosition()) - restDistance) - damping * glm::length(join1->getVelocity() - join2->getVelocity());
join2->applyForce(glm::normalize(join2->getTransform().getPosition() - join1->getTransform().getPosition()) * force * fixedTimeStep);
}
void Spring::draw(aie::Renderer2D * renderer)
{
renderer->setRenderColour(0, 0, 1);
glm::vec2 pos1 = join1->getTransform().getPosition();
glm::vec2 pos2 = join2->getTransform().getPosition();
renderer->drawLine(pos1.x, pos1.y, pos2.x, pos2.y);
}
| 33.16129
| 207
| 0.719844
|
Master-Mas
|
7aa381be8780833746f2bb730b4590fb0337ca7b
| 975
|
cpp
|
C++
|
app/src/main/cpp/recording/streams/RecordingStreamConstants.cpp
|
atikur-rabbi/fast-mixer
|
7b471e102aacb9cdf75af5c7775d18d10e584ff1
|
[
"CC0-1.0"
] | 47
|
2020-07-16T21:21:37.000Z
|
2022-03-02T00:18:00.000Z
|
app/src/main/cpp/recording/streams/RecordingStreamConstants.cpp
|
iftenet/fast-mixer
|
9e834d6ebed0b1dd63fe8688f8bf614e19a8467f
|
[
"CC0-1.0"
] | 1
|
2020-09-29T06:48:22.000Z
|
2020-10-10T17:40:50.000Z
|
app/src/main/cpp/recording/streams/RecordingStreamConstants.cpp
|
iftenet/fast-mixer
|
9e834d6ebed0b1dd63fe8688f8bf614e19a8467f
|
[
"CC0-1.0"
] | 10
|
2020-07-19T10:07:21.000Z
|
2022-02-11T07:03:20.000Z
|
//
// Created by asalehin on 7/30/20.
//
#include "RecordingStreamConstants.h"
int32_t RecordingStreamConstants::mSampleRate = oboe::DefaultStreamValues::SampleRate;
int32_t RecordingStreamConstants::mPlaybackSampleRate = RecordingStreamConstants::mSampleRate;
int32_t RecordingStreamConstants::mInputChannelCount = oboe::ChannelCount::Stereo;
int32_t RecordingStreamConstants::mOutputChannelCount = oboe::ChannelCount::Stereo;
oboe::AudioApi RecordingStreamConstants::mAudioApi = oboe::AudioApi::AAudio;
oboe::AudioFormat RecordingStreamConstants::mFormat = oboe::AudioFormat::I16;
int32_t RecordingStreamConstants::mPlaybackDeviceId = oboe::kUnspecified;
int32_t RecordingStreamConstants::mFramesPerBurst{};
int32_t RecordingStreamConstants::mRecordingDeviceId = oboe::kUnspecified;
oboe::AudioFormat RecordingStreamConstants::mPlaybackFormat = oboe::AudioFormat::Float;
oboe::InputPreset RecordingStreamConstants::mRecordingPreset = oboe::InputPreset::VoicePerformance;
| 54.166667
| 99
| 0.842051
|
atikur-rabbi
|
7aa3cc7bb45ecd4e61eaa3cb5d14aa8f925b7675
| 60
|
cpp
|
C++
|
src/main/places/Mill.cpp
|
baatochan/VillageSimulation
|
633e68a29a7f7eb960ab0ec8fc59e7ce5735a6af
|
[
"MIT"
] | null | null | null |
src/main/places/Mill.cpp
|
baatochan/VillageSimulation
|
633e68a29a7f7eb960ab0ec8fc59e7ce5735a6af
|
[
"MIT"
] | null | null | null |
src/main/places/Mill.cpp
|
baatochan/VillageSimulation
|
633e68a29a7f7eb960ab0ec8fc59e7ce5735a6af
|
[
"MIT"
] | null | null | null |
//
// Created by black on 05.06.18.
//
#include "Mill.hpp"
| 10
| 32
| 0.6
|
baatochan
|
7aa8b4970179dde3e1691202772a982ccd205706
| 396
|
cpp
|
C++
|
Editor/gui/EngineViewWidget/widget/impl/EngineViewWidgetImpl.cpp
|
obivan43/pawnengine
|
ec092fa855d41705f3fb55fcf1aa5e515d093405
|
[
"MIT"
] | null | null | null |
Editor/gui/EngineViewWidget/widget/impl/EngineViewWidgetImpl.cpp
|
obivan43/pawnengine
|
ec092fa855d41705f3fb55fcf1aa5e515d093405
|
[
"MIT"
] | null | null | null |
Editor/gui/EngineViewWidget/widget/impl/EngineViewWidgetImpl.cpp
|
obivan43/pawnengine
|
ec092fa855d41705f3fb55fcf1aa5e515d093405
|
[
"MIT"
] | null | null | null |
#include "EngineViewWidgetImpl.h"
#include <QHBoxLayout>
#include <QVBoxLayout>
namespace editor::impl {
EngineViewWidgetImpl::EngineViewWidgetImpl(QWidget* parent)
: EngineViewWidget(parent)
, m_EngineFrame(nullptr) {
QVBoxLayout* layout = new QVBoxLayout(this);
m_EngineFrame = new QFrame();
layout->addWidget(m_EngineFrame);
setLayout(layout);
}
}
| 18
| 61
| 0.70202
|
obivan43
|
7aa96d20a59f120a661efb34271486e2914fd876
| 8,273
|
cpp
|
C++
|
transactdatadialog.cpp
|
igrekus/depot
|
c9101c6072b3c0ce3fe26f5926f0371055eaa270
|
[
"MIT"
] | null | null | null |
transactdatadialog.cpp
|
igrekus/depot
|
c9101c6072b3c0ce3fe26f5926f0371055eaa270
|
[
"MIT"
] | null | null | null |
transactdatadialog.cpp
|
igrekus/depot
|
c9101c6072b3c0ce3fe26f5926f0371055eaa270
|
[
"MIT"
] | null | null | null |
#include "transactdatadialog.h"
#include "ui_transactdatadialog.h"
TransactDataDialog::TransactDataDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::TransactDataDialog)
{
ui->setupUi(this);
}
TransactDataDialog::~TransactDataDialog()
{
delete ui;
}
void TransactDataDialog::resetWidgets()
{
ui->editProductName->setText(QString(""));
ui->editProductCode->setText("здесь будет код товара в базе");
ui->dateTransact->setDate(QDate::currentDate());
ui->comboStaff->setCurrentIndex(0);
ui->comboProject->setCurrentText(0);
ui->spinDiff->setValue(0);
ui->editNote->setText(QString(""));
ui->editSearch->setText(QString(""));
}
void TransactDataDialog::initWidgets()
{
ui->editProductName->setText(m_data.itemName);
ui->editProductCode->setText("здесь будет код товара в базе");
ui->dateTransact->setDate(m_data.itemDate);
ui->comboStaff->setCurrentText(m_dictModel->m_staffListModel->getData(m_data.itemStaffRef));
ui->comboProject->setCurrentText(m_dictModel->m_projectListModel->getData(m_data.itemProjectRef));
ui->spinDiff->setValue(m_data.itemDiff);
ui->editNote->setText(m_data.itemNote);
ui->editSearch->setText(m_data.itemName);
}
void TransactDataDialog::updateWidgets()
{
ui->editProductName->setText(m_data.itemName);
ui->editProductCode->setText("здесь будет код товара в базе");
ui->dateTransact->setDate(m_data.itemDate);
ui->comboStaff->setCurrentText(m_dictModel->m_staffListModel->getData(m_data.itemStaffRef));
ui->comboProject->setCurrentText(m_dictModel->m_projectListModel->getData(m_data.itemProjectRef));
// ui->spinDiff->setValue(m_data.itemDiff);
// ui->editNote->setText(m_data.itemNote);
ui->editSearch->setText(m_data.itemName);
}
void TransactDataDialog::initDialog()
{
if (m_data.itemId == 0) {
setWindowTitle("Новая запись о приходе/расходе");
} else {
setWindowTitle("Редактировать запись о приходе/расходе");
}
// QStringList projects(m_dictModel->m_projectListModel->m_strList);
// comProject = new QCompleter(projects, this);
// comProject->setCaseSensitivity(Qt::CaseInsensitive);
// comProject->setCompletionMode(QCompleter::PopupCompletion);
// QStringList staff(m_dictModel->m_staffListModel->m_strList);
// comStaff = new QCompleter(staff, this);
// comStaff->setCaseSensitivity(Qt::CaseInsensitive);
// comStaff->setCompletionMode(QCompleter::PopupCompletion);
ui->comboProject->setModel(m_dictModel->m_projectListModel);
// ui->comboProject->setEditable(true);
// ui->comboProject->setInsertPolicy(QComboBox::NoInsert);
// ui->comboProject->setCompleter(comProject);
ui->comboStaff->setModel(m_dictModel->m_staffListModel);
// ui->comboStaff->setEditable(true);
// ui->comboStaff->setInsertPolicy(QComboBox::NoInsert);
// ui->comboStaff->setCompleter(comStaff);
ui->lblProductCode->setVisible(false);
ui->editProductCode->setVisible(false);
m_searchFilterModel = new ProjectRecursiveFilterProxyModel(this);
m_searchFilterModel->setSourceModel(m_stockModel);
m_searchFilterModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
m_searchFilterModel->setFilterWildcard(m_data.itemName);
m_searchFilterModel->setFilterProjectId(0);
ui->treeStock->setModel(m_searchFilterModel);
ui->treeStock->hideColumn(2);
// ui->treeStock->hideColumn(3);
ui->treeStock->hideColumn(4);
ui->treeStock->hideColumn(6);
ui->treeStock->hideColumn(7);
ui->treeStock->setIndentation(0);
ui->treeStock->setSelectionMode(QAbstractItemView::SingleSelection);
ui->treeStock->setSelectionBehavior(QAbstractItemView::SelectRows);
ui->treeStock->setUniformRowHeights(true);
ui->treeStock->header()->setDefaultAlignment(Qt::AlignCenter); // Qt::TextWordWrap
ui->treeStock->header()->setStretchLastSection(true);
ui->treeStock->setItemDelegate(new DelegateHighligtableTreeText(ui->treeStock));
ui->treeStock->setRootIsDecorated(false);
ui->treeStock->setStyleSheet(QString("QTreeView::branch { border-image: none; }"));
ui->treeStock->header()->moveSection(3, 5);
refreshView();
initWidgets();
connect(ui->treeStock->selectionModel(),
&QItemSelectionModel::currentChanged,
this,
&treeStockSelectionChanged);
}
void TransactDataDialog::refreshView()
{
qint32 trwidth = ui->treeStock->frameGeometry().width()-30;
ui->treeStock->hide();
ui->treeStock->setColumnWidth(0, trwidth*0.20);
ui->treeStock->setColumnWidth(1, trwidth*0.50);
ui->treeStock->setColumnWidth(3, trwidth*0.10);
ui->treeStock->setColumnWidth(5, trwidth*0.20);
ui->treeStock->show();
}
TransactItem TransactDataDialog::getData()
{
return m_data;
}
TransactItem TransactDataDialog::collectData()
{
return (TransactItem::TransactItemBuilder()
.setId(m_data.itemId)
.setName(m_data.itemName)
.setDate(ui->dateTransact->date())
.setDiff(ui->spinDiff->value())
.setNote(ui->editNote->text())
.setStock(m_data.itemStockRef)
.setStaff(ui->comboStaff->currentData(Constants::RoleNodeId).toInt())
.setProject(ui->comboProject->currentData(Constants::RoleNodeId).toInt())
.build());
}
void TransactDataDialog::changeEvent(QEvent *e)
{
QDialog::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}
void TransactDataDialog::on_spinDiff_valueChanged(int arg1)
{
// if (arg1 > 0) {
// ui->editNote->setText("Приход");
// }
// else {
// ui->editNote->clear();
// }
}
void TransactDataDialog::on_btnOk_clicked()
{
if (ui->editProductName->text().isEmpty()) {
QMessageBox::warning(this,
"Ошибка!",
"Выберите позицию на складе, для которой нужно создать новый приход/расход.");
return;
}
if (ui->comboProject->currentData(Constants::RoleNodeId).toInt() == 0) {
QMessageBox::warning(this,
"Ошибка!",
"Выберите тему, на которую следует записать текущий приход/расход.");
return;
}
// if (ui->editNote->text().isEmpty()) {
// QMessageBox::warning(this,
// "Ошибка!",
// "Введите комментарий, поясняющий информацию о текущем приходе/расходе.");
// return;
// }
if (ui->spinDiff->value() == 0) {
QMessageBox::warning(this,
"Ошибка!",
"Приход/расход не может быть равен нулю.");
return;
}
m_data = collectData();
accept();
}
void TransactDataDialog::on_editSearch_textChanged(const QString &arg1)
{
m_searchFilterModel->setFilterWildcard(arg1);
if (arg1.size() > 1) {
ui->treeStock->expandAll();
} else {
// ui->treeStock->clearSelection();
ui->treeStock->collapseAll();
}
m_searchFilterModel->invalidate();
}
void TransactDataDialog::on_treeStock_clicked(const QModelIndex &index)
{
// qDebug() << "tree click";
if (index.data(Constants::RoleNodeType) == Constants::ItemItem) {
QModelIndex sourceIndex = m_searchFilterModel->mapToSource(index);
m_data = TransactItem::TransactItemBuilder().fromStockItem(m_stockModel->getStockItemByIndex(sourceIndex));
// qDebug() << m_data;
updateWidgets();
}
}
void TransactDataDialog::on_treeStock_doubleClicked(const QModelIndex &index)
{
// qDebug() << "tree doubleclick";
}
void TransactDataDialog::treeStockSelectionChanged(const QModelIndex ¤t, const QModelIndex &previous)
{
// qDebug() << "tree selection changed";
// if (ui->treeStock->selectionModel()->hasSelection()) {
// on_treeStock_doubleClicked(current);
// }
// else {
// resetWidgets();
// }
}
| 34.615063
| 116
| 0.649462
|
igrekus
|
7aae9e76f79854e77c9493597c3f1005c85189a6
| 2,918
|
cpp
|
C++
|
RectangleProgressBar.cpp
|
arvindrajayadav/Good-Robot
|
c9a0a5f50793acbe7af312fccac48ee035498d1e
|
[
"MIT"
] | 53
|
2020-08-04T08:38:14.000Z
|
2021-12-08T18:06:40.000Z
|
RectangleProgressBar.cpp
|
arvindrajayadav/Good-Robot
|
c9a0a5f50793acbe7af312fccac48ee035498d1e
|
[
"MIT"
] | 2
|
2020-08-15T13:03:26.000Z
|
2020-08-15T19:54:22.000Z
|
RectangleProgressBar.cpp
|
arvindrajayadav/Good-Robot
|
c9a0a5f50793acbe7af312fccac48ee035498d1e
|
[
"MIT"
] | 5
|
2020-08-04T09:33:40.000Z
|
2021-09-13T04:22:49.000Z
|
#include "master.h"
#include "RectangleProgressBar.h"
using namespace pyrodactyl;
void RectangleProgressBar::Load(rapidxml::xml_node<char> *node)
{
Element::Load(node);
timer.Load(node, "delta_time");
if (NodeValid("bg", node))
bg.Load(node->first_node("bg"), this);
if (NodeValid("caption", node))
caption.Load(node->first_node("caption"), this);
if (NodeValid("bar", node))
{
rapidxml::xml_node<char> *barnode = node->first_node("bar");
if (NodeValid("max", barnode))
max.Load(barnode->first_node("max"));
if (NodeValid("cur", barnode))
cur.Load(barnode->first_node("cur"));
if (NodeValid("inc", barnode))
change_inc.Load(barnode->first_node("inc"));
if (NodeValid("dec", barnode))
change_dec.Load(barnode->first_node("dec"));
if (NodeValid("offset", barnode))
offset.Load(barnode->first_node("offset"));
}
}
void RectangleProgressBar::Draw(const int &value, const int &maximum, const char *title, bool draw_value)
{
//Prevent divide by zero
if (maximum == 0)
return;
bg.Draw();
if (!init)
{
init = true;
prev = value;
}
//Calculate pixels per unit according to the size IF the bar is of constant width
pixels_per_unit = w / (float)maximum;
//Draw the outline bar that depends on the maximum value of health
max.Draw(x, y, h, pixels_per_unit, maximum, false);
//Add the offset for all other bars
int X = x + offset.x, Y = y + offset.y;
if (prev > value)
{
//The value decreased, draw the decrease bar
change_dec.Draw(X + static_cast<int>(value * pixels_per_unit), Y, h, pixels_per_unit, prev - value, true);
//Decrease the bar value so it moves 1px forward every X ms, and eventually becomes equal to value
if (timer.TargetReached())
{
prev -= 1 + static_cast<int>(pixels_per_unit / 2);
if (prev < value)
prev = value;
//Reset the timer
timer.Start();
}
//Draw the current bar
cur.Draw(X, Y, h, pixels_per_unit, value, true);
}
else if (prev < value)
{
//Draw the current bar
cur.Draw(X, Y, h, pixels_per_unit, value, true);
//The value increased, draw the increase bar
change_inc.Draw(X + static_cast<int>(prev * pixels_per_unit), Y, h, pixels_per_unit, value - prev, true);
//Increase the bar value so it moves 1px forward every X ms, and eventually becomes equal to value
if (timer.TargetReached())
{
prev += 1 + static_cast<int>(pixels_per_unit / 2);
if (prev > value)
prev = value;
//Reset the timer
timer.Start();
}
}
else
cur.Draw(X, Y, h, pixels_per_unit, value, true);
//Draw the caption
if (draw_value)
caption.text = title + NumberToString<int>(value) +" / " + NumberToString<int>(maximum);
else
caption.text = title;
caption.Draw();
}
void RectangleProgressBar::SetUI(pyroRect *parent)
{
Element::SetUI(parent);
bg.SetUI(this);
caption.SetUI(this);
offset.SetUI();
max.SetUI();
cur.SetUI();
change_inc.SetUI();
change_dec.SetUI();
}
| 23.918033
| 108
| 0.67512
|
arvindrajayadav
|
7aafbc38e6b0cfa5feefb5d5f7caec980b83af6d
| 875
|
cpp
|
C++
|
Source/Insanity/MessageBox.cpp
|
mice777/Insanity3D
|
49dc70130f786439fb0e4f91b75b6b686a134760
|
[
"Apache-2.0"
] | 2
|
2022-02-11T11:59:44.000Z
|
2022-02-16T20:33:25.000Z
|
Source/Insanity/MessageBox.cpp
|
mice777/Insanity3D
|
49dc70130f786439fb0e4f91b75b6b686a134760
|
[
"Apache-2.0"
] | null | null | null |
Source/Insanity/MessageBox.cpp
|
mice777/Insanity3D
|
49dc70130f786439fb0e4f91b75b6b686a134760
|
[
"Apache-2.0"
] | null | null | null |
#include "pch.h"
//----------------------------
#pragma comment (lib,"user32.lib")
//----------------------------
MSGBOX_RETURN OsMessageBox(void *hwnd, const char *txt, const char *title, MSGBOX_STYLE wmb){
int wtype;
switch(wmb){
case MBOX_OK: wtype = MB_OK; break;
case MBOX_YESNO: wtype = MB_YESNO; break;
case MBOX_YESNOCANCEL: wtype = MB_YESNOCANCEL; break;
case MBOX_RETRYCANCEL: wtype = MB_RETRYCANCEL; break;
case MBOX_OKCANCEL: wtype = MB_OKCANCEL; break;
default: wtype = MB_OK;
}
int ret = MessageBox((HWND)hwnd, txt, title, wtype);
switch(ret){
case IDYES: return MBOX_RETURN_YES;
case IDOK: return MBOX_RETURN_YES;
case IDNO: return MBOX_RETURN_NO;
case IDCANCEL: return MBOX_RETURN_CANCEL;
case IDRETRY: return MBOX_RETURN_YES;
}
assert(0);
return MBOX_RETURN_NO;
}
//----------------------------
| 26.515152
| 93
| 0.635429
|
mice777
|
7ab070e798d995ec86e79df525877847fa03cea5
| 802
|
cpp
|
C++
|
modules/core/base/unit/utility/size.cpp
|
psiha/nt2
|
5e829807f6b57b339ca1be918a6b60a2507c54d0
|
[
"BSL-1.0"
] | 34
|
2017-05-19T18:10:17.000Z
|
2022-01-04T02:18:13.000Z
|
modules/core/base/unit/utility/size.cpp
|
psiha/nt2
|
5e829807f6b57b339ca1be918a6b60a2507c54d0
|
[
"BSL-1.0"
] | null | null | null |
modules/core/base/unit/utility/size.cpp
|
psiha/nt2
|
5e829807f6b57b339ca1be918a6b60a2507c54d0
|
[
"BSL-1.0"
] | 7
|
2017-12-02T12:59:17.000Z
|
2021-07-31T12:46:14.000Z
|
//==============================================================================
// Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II
// Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI
//
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//==============================================================================
#include <nt2/include/functions/size.hpp>
#include <nt2/sdk/unit/module.hpp>
#include <nt2/sdk/unit/tests/relation.hpp>
NT2_TEST_CASE( fundamental_size )
{
using nt2::size;
NT2_TEST_EQUAL( size( 3 , 1 ), 1u);
NT2_TEST_EQUAL( size( 3 , 2 ), 1u);
NT2_TEST_EQUAL( size( 3 , 3 ), 1u);
}
| 36.454545
| 80
| 0.506234
|
psiha
|
7ab1951862a75a5a3df0fff27114f4cde919a359
| 15,012
|
cpp
|
C++
|
data/474.cpp
|
TianyiChen/rdcpp-data
|
75c6868c876511e3ce143fdc3c08ddd74c7aa4ea
|
[
"MIT"
] | null | null | null |
data/474.cpp
|
TianyiChen/rdcpp-data
|
75c6868c876511e3ce143fdc3c08ddd74c7aa4ea
|
[
"MIT"
] | null | null | null |
data/474.cpp
|
TianyiChen/rdcpp-data
|
75c6868c876511e3ce143fdc3c08ddd74c7aa4ea
|
[
"MIT"
] | null | null | null |
int ds//mX
,t3 ,
MGA ,s ,
Kai
/*R4k*/,al,C8L ,
Zt,kW5a
,zNAk , M1l, a5Q7 ,
K
//
,Zj/*ZbNw*///
, xz
,U8
, CQ,pb,
msWtM
,PRZEy ,
wrI
, XIc1o , uh,K2s ,
HR6 ,rvUy3 ,
Sw/*1*/, t ,
S8,ha
, RH, Na0, q
/*9ku*///P1G
,m,
v3Wcf , XZ4 ,WxYJ ,OQou ,
py2, gpl ,h0RF, GyQZ
, lVwY4b,sN2 ,c3uy ,dmv,a0,fQ , //
NaWv ,Bi5X,
Jee//dQ
,Z
,
PxH , uz, RAT, UC
, eSrN
, M9, D0fK1
,/*7tNJ*/yfoS8l ,
eCD, //Fj
sS
, tl
,uV, NZm
, /*e*/Ws
, IPMi5Y ; void f_f0()//5
{ { { int eL ;volatile int dm1Y
, zAD, nEt ;
for(int i=1
; i<1;++i)if ( true
)for(int
i=1//s36
;
i<
2;++i )if (true ) eL =
nEt
+dm1Y +/*Oe*/
zAD
; else
{volatile int
nk5N
,
ZSC; IPMi5Y=//Bw
ZSC
+
nk5N;
}else return
;
return ;
{{ int ZehfD/*xh*/;volatile int DyRo7 ,pc ,Vtar ;if
(
true )ZehfD/*e*///wsM
= /*BbW*/Vtar
+ DyRo7+/*o4H*/pc; else return ; {//kKem
}
{{}
} } {} }{ //
int pX;
volatile int
WEl,sme8
; for
(int i=1 ; i< 3;++i )
{ ; for (int i=1; i<
4;++i
)
{} } pX=
sme8+
WEl ;}}{
volatile int fZ, sGL , /*I*/
upWO
,mp, IF ;
;{/*N*/volatile int/*Q6*/ Qkuw
, gO,Vkk ; //f3Xt
{ for (int i=1; i<5 ;++i){}} {} {;} ds
=Vkk/*PmY*/+Qkuw //z
+
gO;{} }
t3/*eVa*/=
IF +
fZ +sGL +
upWO
+mp ;}{
{
{
}
{{ volatile int
fC
;{
}
for
(int
i=1;i<
6
;++i //we
)/*wHt*/MGA= fC
//QV
;
} }/*3*/}
//Gy
return ; } {
int eNPS;
//f
volatile int
/*Xi4C*/ cw, tyX,sQDc
;
{
/**/;
}for (int i=1 ;
i<7
;++i
) if(true /*x*/){ int N5VKlj9;volatile int y0Z
, MFk ,
sGa0 ; { }N5VKlj9 =
sGa0+/*sLo1*/y0Z
+MFk
;
}else
eNPS
=sQDc
+ cw+ tyX
;
}
{ /**/ if (true)return ;else return ; { if
(
true)return ; else for(int //rDAW
i=1
; //w
i<8;++i) for (int i=1;/*CR*/ i<9;++i
)//Jz3
//n
{
}} }
} if(
true ) //s
return ;
else//5GWj
{{ for
(int
i=1//GPU
; i<
10;++i)
{ {
}//0yF
;//NLj1ESz
}
//7
return //
; } /*83*/
if( true
){{ return ;
{}
} {if( true) return ;
else{return ;{ int
NECy ;volatile int UaN;if
(
true) {} else //
NECy= UaN;
}}
}
}/*oO*/else
{volatile int K2G//f
,e2gl1 //a
, ls
;{for
(int i=1 ;i< 11;++i)/*m*/
{{ }//Niv
} }
s =
ls+ K2G
+
e2gl1
//KSDY
;
; {if(
true
) {
;}
else /*l*/{
} }if
(
true )
; else {volatile int
i3sK
/*Gy*/, J ;
Kai =J
+i3sK ;for (int i=1 ;i<12;++i) ;
}if
(/*G8*/
true
)
{ {/*Z*/}; }else{volatile int/*SlD*/ Kdt ,vQwV ;{volatile int
aNn ,d1Orr
,
N9v6
; al
=
N9v6
+
aNn+d1Orr ;//Jw
{ {/*XZ*/
}}
} C8L
= vQwV//wf
+Kdt ;{}}
}{{for
(int i=1 ;i<13;++i);
}{volatile int n5
,
z
,auzN ,s79H; {}
{
} if //ZN
( true )for(int i=1
;i<14 ;++i )
;else Zt =/*8d*/s79H//Omvo
+ n5;
kW5a=z//q
+auzN;}{
{ } }}{
//0zi
if(true) { {} {
}{{}if( true) return ;else
{
{ }} {} if (
true)
{}else
{}}{ if
(true)
{
//v
}
else { }
return ;}
}else ; {if
(
true
)
{volatile int SaZDa,ah, qFlY//2P9T
,Cy; if/**/( true){}
else{ }
if//d4r
(true) if
(true )zNAk
=Cy+ SaZDa
; else M1l=/*EH1*//*rS*/ah
+
qFlY; else {volatile int//
n , LZ3Z;if( true
)
{}else a5Q7 = LZ3Z+n;
/**/
}
} /*pI*/else
if (true ){}
else return ; } {if( true )//Bs4
//p8
;
else {{ {
}
}for (int i=1 ;i<
15;++i ) {} {} //0TPs
if //v
(true ) { ;}
else
{
}//2
for (int i=1
;i<16 ;++i)if (true)if/*ZY*/( true )//E
{}
else ;
else {}
}
{
{
} ;}{ return
; }}{{
}
{/*oy*/{}} }/*t*/ //
}}for(int i=1/*uiX*/; i<17;++i)
if(true){ /*oH*/{ { volatile int mCOg
,
D, PWJTDb;K = PWJTDb + mCOg+//K
D;} if(true )return ; else { int IEz6; volatile int cb3,gZ
,
vW//E
, I//6B
/*Z*/; for(int i=1 ;i<18
;++i /*w8*/) ;
IEz6= I+ cb3//7x
;/*Jikgg*/
Zj= gZ + vW
;} //kK
} { volatile int Un
,
oan , WDs ,Wz8pk4/*ZBtv*/,eqy ; {/**/int h;volatile int id//O1
, HT8 ,//5iT
pY2,AzaWn
; { volatile int
qeE
;
{
{}//n7Y
; }
xz = qeE; if
(//OB
true)
{}else { } }{ {{
}} { }
} h
=AzaWn//
+id
+HT8 + pY2;} U8=
eqy+ Un +oan +
WDs
+ Wz8pk4;{{volatile int //G
F4b
, g//6u
;{ }CQ= g+F4b; } }} return ;
{
int
P/*Jl*/;
volatile int W6, wz, bgVg;;if//ns
(true ) if (true ) {//4
{ }for (int i=1 ;i<
/*7T*/
19/*b8*/;++i//Zc
);{ {{ } }
{volatile int
fpN
;pb =fpN ; }}}
else P= bgVg +W6 +wz;else ;}} else
return
;{//5h
for(int
i=1 ; i<
20 ;++i
)//wO
{
volatile int
lOKdG0 , kA
, jS3 ,
Cv
,b8r ; {{
;
}
if(
true ) /*46*/; else
;//zj
}msWtM=//6S
b8r + lOKdG0 + kA
+
jS3 + Cv//
;for//ts
(int i=1
;i< 21;++i){
{
{ }
{
//H
}{}
}
{
int w4;volatile int R9, IL9u ;return
;/*sSI*/ if(//7u
true )w4= IL9u + R9 ;/*9OI*/ else{}{//e
/*Won*/ } {//RT
}
} } };
{ ; {{
{
if(
true){{}
}/*Xpa*/ else{ }
if
( true)for(int
i=1 ;/*6*/ i<22;++i)
return ; else ;
} /*TR*/} } ; }{int
fy
;volatile int /*RO*/ aU ,
Nkl
, C ; { volatile int VBw
,
QOLl,uc9I2 //nE
;
PRZEy
=
uc9I2//d
+ //MwR6
VBw
+
QOLl;{ for(int i=1 ;/*H*/i<//lw
23
;++i)if//N
(true)if(true ){
/**/}else
{
}else{ }
}{{
}} } fy = C
+ aU+Nkl ; for (int i=1
; i<24 //Bt
;++i/*j*/ /*BxUS*/
) {
{}
;
}
}}
return
;
}void f_f1(){ { { {
int WI3 ; volatile int B8 ,m2Uy
;
WI3 =/*5N*/m2Uy +//TsJ
B8;
}{volatile int//EKS
/*mU*/ sKf,NJZPkUU8/*S*/,
suO ;wrI
=
suO+sKf+NJZPkUU8
;if ( true
);else{ {}
{//Z4
}}} }
return ;{{ ; }if (true){ volatile int lY,
owz
;for (int
i=1; i< 25/*AW*/;++i)
XIc1o =
owz+ lY ; { }{
//GW5
}
}else//RD
; if//64
( true){;{
for
(int i=1;
i< 26
;++i
); return
; }
return ;
}
else
{ ;
;
}{{ {
} }
;
}
} { { int hp ; volatile int Wr,i3Rw//xy
; {volatile int d8c ,y0
, o; uh
= o//Q
+ d8c
+
y0 ;
}if
(/*mf*/ true
) /**/{
} else for//4KQa
(int i=1 ;
i< 27 ;++i
)hp = i3Rw +Wr;}{ {} {} {
}
} } };{//
{ volatile int DW ,
US
,e6 ,ouHvl;{ for (int i=1;i< 28 ;++i ){ volatile int//o
O,tP
; for(int i=1;
i< 29 ;++i){ }if/*teMXjS*/(/*W*///od
true
) { int oV;volatile int ZYg,PGkruw;oV= PGkruw+ZYg ;
}else {
{ }{
}return
;
}/*rC*/
K2s
= tP
+
O ;return //T
; }; }if (true )
{
{
} return ;
{{
{} } ; }/**/}else/*4gbq*/ return
;
HR6= ouHvl + DW + US +
e6 ;
}{
; {volatile int pNkW,
yA
; /*b0*/for(int
//
i=1;i< 30;++i )
rvUy3 //4S
=yA+ pNkW ; for(int i=1 ; i< 31 ;++i) ; //Iep
}
} {
volatile int caF , i3 ,//i
b,
D1L,
lKSAe,vKF
; for/**/(int /**/i=1;i< 32;++i )
{
{{//w
}
} {for(int i=1
;i<33;++i );} }//FO
{
{ {}}} Sw =
vKF+/*W*//*ANs*/ caF
+
i3 +
b+ D1L +/*Aq*/lKSAe;
return ; {volatile int
gA ,
Ui1p ;for(int
i=1; i< 34 ;++i)t= /*dUb*/ Ui1p +
gA ;{
volatile int Hx , rCY ;S8//4O
= rCY+ Hx ; }
} }for (int i=1;
i<
35 ;++i)return ;} { if(true)for/*hQ6x*/(int i=1
;i<36;++i
){int
Zk ;volatile int
Of ,E8,XZl , fr1sI, GOMJ; return ; {if (
/**/true) if(
true ) { }else {for(int i=1 ;i< 37
;++i )
if(true){}
else {
}{{
}}
}
else return ;
for(int
i=1 ;i<38;++i
)
if
/*bBab*//*wy*/(true
)
; else
;
{if(/*HnT*/ true ){volatile int NvB ; if ( true )ha=NvB;else{}}
//fv
/*Iz*/ else{{
}
}
}/*ojw*/}
Zk/*n*/=
GOMJ +Of //CEH
+E8 +XZl +//U
fr1sI
;
}else
{
{
{
;/*HH*/}if
( true ) for (int i=1 ;i<
39;++i ) for
(int i=1;
i<
40
;++i ) {
}//gq
else { }return
;{} } { {int/**/ MCYl7s ; volatile int fw
//
, O5c ,nmz
;MCYl7s=nmz
+fw + O5c//r
;{{//DBxd
} }
}{{ }
}
}/*Y*/ if /*Ml*/( true ){
{/*88M*/
{}for
(int i=1 ;i<41;++i)
{
/**/}{
;//re
} } {}
{
}
} else for (int
i=1; i<42;++i) if(true ) { volatile int Wwy ,F
,b6V, u
;
RH
= u+Wwy
+ F+ b6V ; }
else{ volatile int
bHoCj
,lNsKL , ZlL;for(int i=1;/**/i<
43 ;++i
) if( true
)if(true )Na0= ZlL+ bHoCj +lNsKL;else ; else {{/*BLn*/ }}
{if
(/*O*//*Ba*/true) for
(int /*fYU*/i=1 ; i<44
;++i)if( true)
{ } else ; else {}}} } {int dy8
; volatile int
N
, AgF ,
gVS1, VKoG ,tBiAS ; {{{}
}} {
{
} }dy8
=
tBiAS+N +
/*YG*/AgF + gVS1+VKoG
; }return
;{; for (int i=1 ;i<45;++i)
{/*fHj*/
volatile int M9JHS/**/
,r, oskgFJ
,AHy ;q=
AHy+M9JHS +r +/**/oskgFJ
;
}{;/*6H*/}
}//APg
} { volatile int AV
,j7 , fOWkQv
,
qL9O
, E08;{volatile int a,v ,DU ,YCP ;
{{
{
} {;
} }
for(int i=1 ; i<46 /**/;++i /*l*/){{ }
} }
m /*6*/=YCP
+a +v
+DU; for(int i=1
; i<
47
;++i ) if (true) if
( true ) return//
;else {;; {} } else
{{ {}
}
{ {}for(int
i=1;
/*o7*/i< //G0Y
48 ;++i /**/ )for
(int i=1;i<49;++i ) ;}
}{
; //G
{ } } } v3Wcf =
E08 +AV
+j7 +fOWkQv +
qL9O//fV47
; if( true ){return ;//UW
;/*0*/for(int
i=1 ;i< 50;++i) { return
;
}
} else {
{ { }{/*d*/
/*RL*/} }{
{ {//
{
} for (int i=1;i< 51;++i)
{} } {}for (int i=1;i< 52
;++i)//
{int GF ;
volatile int
qGd;GF/*p*/=qGd;}
{}} {
{/*w4*/ }
if(true ){ } else{}} }}
{{{
};
} {{int A9U ;
volatile int qyb,zLEB
, b6q; A9U
=b6q +
qyb
+ zLEB;}/*1RH5*/{ int OQr; volatile int
GA;OQr= GA //
; {} }{/*uJ*/ }} {
int zDQ; volatile int fT /*2J*/,
iP
,/*n0g*/ qW;zDQ=qW
+fT
+
iP;
{ } } } //f
} { volatile int TNv, JQ , ogxvz ,
wp ,
duvoEM2
,KVQbU,UOn
, /*SXA*/ZESm
,
G3X,QfJ,bAHY//J4s
;{
volatile int
sd
/*o9U*/,/*UBc*/pCjM
, nsqvN
,//9
m9j;for(int
i=1;i<53
;++i)/*Gym*/ {{}{ {} }}/*cKkOFo*/
if ( //FNN
true
)
{
//lH
int Pm ,
//cf7
trS
; volatile int R2kE0/*vk*/ ,s775, /*BA*/ xP, Ne ,Ee3f ; trS
=
Ee3f
+//5mrV
R2kE0;
Pm= s775+
xP
+Ne /*9*/
;
if (
true)return ;else{{
} { }}
; }else ; { {} { ;} return
; }
if//0P
(true
)
{for (int //kJ7
i=1;i<54;++i )for
(int i=1; i< 55;++i ) for
(int i=1;
i<
56;++i)
//c
;{{
} {return /**/ ; }return ; } }else
if(//R
true )
XZ4
=m9j + sd +pCjM
//
+
nsqvN ;else for (int //c
i=1 ;i< 57;++i){//U
volatile int QG ,IgSa
; /*2zf*/WxYJ = IgSa +
QG ; }}for (int i=1
; i<58
;++i) if(true
)
{int oT; //gOy
volatile int NHg
, zxBOuX,PjhOs,XH
,A9 ,Y
,
vO
,
//4mV
kiJZz ; { volatile int ykF1qt
,Uk;OQou
=
Uk +
ykF1qt/*e3*/; { volatile int wIi942 , Sg , i ;
py2 =
i+wIi942+
Sg ; {} if (
true/*y0*/) return ;
else return ;} }/*Dp*/if ( true) { if ( true
){}
else {
}{ { {
} } { {//N
}}} }
else
gpl
= kiJZz+NHg +zxBOuX+PjhOs;/*k*/oT= XH +A9+Y
+vO ;
}//7Dj
else{{volatile int /*L*/ rIOZ/*P*/,la
,
NNw
/*Ck*/; for(int i=1
; //vA2x
/*Dch*/i< 59 ;++i//T
)//hZ
h0RF =NNw/*o6s*/
+rIOZ+ la; {
; }{;
} } { return ;{
} }return ;
} if( true ) {//I
for (int i=1//Wzkw
; i<60 ;++i )for
(int
i=1 ; i< 61 ;++i) ;{ {; }
{for(int //9r
i=1 ;i<62;++i//A
){
} {
} /*LVk*/
} }
}
else GyQZ
= bAHY
+TNv
+JQ
+ogxvz + wp ;{
{return ; } { return ;
{
int
DO//mkv
;
volatile int x47; DO=
x47//Bx9m7
;{ } {{ }
} }//fVU
/*4Sq*/;
}{ {/*eo*/}
{{ { } }
}
/*f*/}/*18*/{
{if ( true
)
/*TiS*/{ } else//5NXM
return ;}}
}//8
lVwY4b =duvoEM2//L
+KVQbU + UOn+ZESm +
G3X//O
+QfJ
;}
return ; }void
f_f2//Y
() {if (
true
)if(//MoL
true
){int G;volatile int BVm , QgUT9 ,EIU ,Jie,
Te//F
,gOA1,
NU
,
Av
,
Bq,
DEL; sN2//ahpv
=
DEL +
BVm + QgUT9+ EIU+Jie +
/*k*/
Te ;
G =
gOA1 +NU+ Av + Bq ; { { volatile int
y48L , oc9;{
}c3uy =
oc9 +
y48L;
if(
true)
{ }else
;//N
} return ; } ;
}
else {
/*FtE*/volatile int RK ,QP ,/*9*/LM3
,
m80U1G ,F9//Uz
;
{
volatile int T,
s4S , vrDVz, Am ;
; { int
xu;volatile int mloB
,qq ;{/*r*/ return
;} xu
=qq+mloB ;
{}
} dmv = Am +T + s4S +
vrDVz ;//e
{volatile int
ekzRm,TO; { ;}a0 = TO +
ekzRm; return ;
{
if (
true)return
; else ; }if(
true ){/*g*/return
;
}/**/ else{
}
if
( true
) ;else { /*pO*/{ //
int vVr;volatile int oDC ;{
}
vVr =oDC
;} {}{volatile int /*4d*/ LE,
uSN2q
;if(
true)
{} else fQ=uSN2q+ LE ;
{
}
}}} } NaWv =
F9
+
RK+ QP+LM3/*OsG*/+m80U1G
; {{{
}}/*oJ*/{ { }} {{for//W
(int
i=1;i</*Bo*/ 63
;++i
) { } }/*RWj*/} }
/*emE*/for
(int i=1;i< 64;++i) {
;{
{ /*v*/{
int LlHG
//6
; volatile int/*iS*/ AZBNdQ
//rM
; if( true ) { }
else LlHG=
AZBNdQ;
}
{{ }
}{}
{
{} } }} {{
if(
true)return
;else return ;{}}{ }
{ {}{}}} }
{ volatile int e , pxrO
,
SEZtJ ;
{for (int
i=1;i</*KZ*/65
;++i
) return ;} Bi5X =SEZtJ
+e+pxrO//PT
;
}
}else{ /*0i41*/{/*9d*/volatile int st, WW, yXQ
,//OC
Ibr;{volatile int Ado
, MCU;
Jee
=MCU +
Ado ; {
return ;}for
(int i=1;i<66 ;++i
)
{} } Z
=
Ibr+st//du
+
WW + yXQ//Dv
; return ; } {;/*HlsE*/return ;{
for
(int //3Z0KL
i=1
;/**/ i< 67;++i)
/*b0Sn*/return ;;}
{; //S
for(int i=1
;
i<
68
;++i/*le*/) //o
if (
true
)return ; else/**/ return ;{ {}}
} }{int UE
; volatile int Wfr , ORt1T , wIw, aH7,
BUc5t
,
CY;
for
(int
i=1 ;i< 69//e5js
;++i)
PxH/*nps*/ =CY+/*3*/Wfr+ ORt1T ;
UE =wIw +aH7
+ BUc5t/*o*/;
/*b*/} { volatile int FEOCDH
,Cc, eNk , tY9W ,L; if(true ){ {volatile int wc, //GEW
vtx/*N1*/;{}{ } if(true){ }
else for(int i=1; i<
70;++i
) uz//fXG5T
=
vtx
+ wc/*8*/; } }else for/*ew*/(int
i=1; i< 71;++i )
{int
H
; volatile int/*z*/ Iif,HBVUJq,
i5C, iV ,DKVF8i
;
//w
if
( true )return ;else RAT=
DKVF8i//
+Iif
+//F6
HBVUJq
;H
= i5C +iV ;/*F1*/ } UC /**/=
L+FEOCDH +
Cc+ eNk
+tY9W;
for
(int
i=1;i<72;++i
)
return
; } //M
{
{ {return ;
/*ZUU*/ }
{
} }
if(
true){
{return ;
;}} else
return ;
;
}{
{return ; }
{//1
{ }//dT
if(true) { for
(int i=1;i<73 ;++i
) { for (int i=1
; i<74;++i ) {/*e7*/} return/*j8q*/
;
}//
} else
return//NUsg
/*gY*/ ;//rR1
}
;
}
}
;
; ;;return ;} //Vf
int main()
{volatile int pf5Us ,zr0 ,hs , snC6 ,Lv ,AC ;eSrN
= AC +pf5Us +zr0/*7jQa*/+//eO
hs+ snC6
+
Lv;if(true ){{;if
(
true )
{ {return 497866240 ;
{ }}if
(
true){ {} {volatile int
PQ1,opp/*mc6*/;M9=opp
+PQ1;}}else /*k*/ return 1231516520
;
return 1626704340
; } else{ int
Vtr;volatile int ye, f2uy,BW
; if//x
( true)return 1624972648 ; else
Vtr= BW
+ye
+ f2uy;}{
{
{ }{
volatile int SV8U; {
int WT7; volatile int AS; /**/WT7 = AS; } D0fK1=/**/ SV8U ;}
};for (int i=1; i<
75
;++i){} }//Ub
}
{
volatile int dU ,
nTk
, w2 ,Nu,oJ5 , HGYe,//L
uIy,X4gp;
yfoS8l = X4gp+
dU/*Vau*/
+
nTk
+ /*Fi*/w2;eCD= Nu//kK7P
+
oJ5
+
HGYe +uIy ; }{
volatile int HE ,
w,/*4M*/RN
, ssD,lq ;sS= lq
//TxZVN
+
HE+w +
RN +ssD;for
(int i=1
; i<76;++i ) for(int i=1 ;i<77 ;++i //M
) { //
; }{
; {
if/*gX*/(
true ){}
else
return //WfU
1968188452
;} } } {
{volatile int sFz, cxKP; return
166725831 ;/*K*/tl=
cxKP+ sFz;
return
989441849
;
} /*u*/; {
{}
return 1658773024/*czUX*/; }
}}else return 634456850
; return 1275129466 ;/*4YM*/ {;
{return 389301623
;{volatile int
sTDbs, LYj
,/*T32*/ D60
; uV =D60+ sTDbs +LYj; }
/*Y*/} {volatile int Zn4U
,//DHrV
vsZi,
/*UX*/eM ; NZm = eM+Zn4U+vsZi ;for
(int i=1;
i< 78
;++i ) { int yS
; volatile int Cjwepm, mm
; yS
= mm /*rNp*/+ Cjwepm ; }}}if(true
) {
volatile int
hTB
,
NG //RHS
, QcYj,R, Cz, DT;Ws = DT +/**/ hTB
+ NG +/*Tes*/ QcYj+R
+ Cz
;{{ {} {}} return 1463615358;;
{
; }//B
}return 634380861
;
;; }
else return 1508537189 ; }/**/
| 11.078967
| 72
| 0.454103
|
TianyiChen
|
7ab5378aa0cbb3f329fe8ff9e2905f51df42fdfe
| 3,143
|
hpp
|
C++
|
src/applicationui.hpp
|
kaszarek/drivenowandthen
|
9632ae308544f2833a2de9b7d1a5bdb7649c2930
|
[
"MIT"
] | null | null | null |
src/applicationui.hpp
|
kaszarek/drivenowandthen
|
9632ae308544f2833a2de9b7d1a5bdb7649c2930
|
[
"MIT"
] | null | null | null |
src/applicationui.hpp
|
kaszarek/drivenowandthen
|
9632ae308544f2833a2de9b7d1a5bdb7649c2930
|
[
"MIT"
] | null | null | null |
/*
* Copyright (c) 2011-2015 BlackBerry Limited.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ApplicationUI_HPP_
#define ApplicationUI_HPP_
#include <QObject>
#include <QMutex>
#include "api/DriveNowWebClient.h"
#include "controllers/CityController.h"
#include "controllers/CarsController.h"
#include "controllers/ClustersController.h"
#include "controllers/RevervationController.h"
#include "controllers/CredendialsController.h"
#include "ActiveFrameQML.h"
namespace bb
{
namespace cascades
{
class LocaleHandler;
}
}
class QTranslator;
/*!
* @brief Application UI object
*
* Use this object to create and init app UI, to create context objects, to register the new meta types etc.
*/
class ApplicationUI : public QObject
{
Q_OBJECT
public:
ApplicationUI();
virtual ~ApplicationUI() {}
Q_INVOKABLE QVariantList worldToPixelInvokable(QObject* mapObject, double latitude, double longitude) const;
Q_INVOKABLE void updateMarkers(QObject* mapObject, QObject* containerObject);
Q_INVOKABLE void login(QString user, QString pass);
Q_INVOKABLE void logout();
Q_INVOKABLE void updateUserLatitude(double newLat);
Q_INVOKABLE void updateUserLongitude(double newLon);
Q_INVOKABLE void setCurrentCity(QString city);
Q_INVOKABLE void getCars();
Q_INVOKABLE void adjustClusterToAltitude(double altitude, double latitude, double longitude);
double getUserLatitude() const
{
return m_userLatitude;
}
double getUserLongitude() const
{
return m_userLongitude;
}
private slots:
void onSystemLanguageChanged();
void updateClustersWithCars(QList<Car*> & cars);
void updateViewWithClusters(QList<Cluster*> & clusters);
void showMessageToUser(QString message);
void notifyViewAboutProblem(QString msg);
void onLogin(bool result);
void onLogout(bool result);
void onThumbnail();
void onFullScreen();
void stopLoadingCars();
void startLoadingCars();
private:
bool m_updatingCLusters;
QMutex mutex;
QObject* pinsContainer;
QTranslator* m_pTranslator;
bb::cascades::LocaleHandler* m_pLocaleHandler;
DriveNowWebClient* driveNowApi;
CityController * cityController;
CarsController *carsController;
ClustersController *clusterController;
RevervationController *reservationController;
CredendialsController *credentialsController;
QPoint worldToPixel(QObject* mapObject, double latitude, double longitude) const;
double m_userLatitude;
double m_userLongitude;
ActiveFrameQML *activeFrame;
};
#endif /* ApplicationUI_HPP_ */
| 30.221154
| 112
| 0.746739
|
kaszarek
|
7ab702d4e219294b173b4935f27d73517121c335
| 371
|
cpp
|
C++
|
leetcode/reverse_integer.cpp
|
alexandru-dinu/competitive-programming
|
4515d221a649b3ab8bc012d01f38b9e4659e2e76
|
[
"MIT"
] | null | null | null |
leetcode/reverse_integer.cpp
|
alexandru-dinu/competitive-programming
|
4515d221a649b3ab8bc012d01f38b9e4659e2e76
|
[
"MIT"
] | 6
|
2021-10-12T09:14:30.000Z
|
2021-10-16T19:29:08.000Z
|
leetcode/reverse_integer.cpp
|
alexandru-dinu/competitive-programming
|
4515d221a649b3ab8bc012d01f38b9e4659e2e76
|
[
"MIT"
] | null | null | null |
// https://leetcode.com/problems/reverse-integer
class Solution
{
public:
int reverse(int x)
{
int sign = (x < 0) ? -1 : 1;
std:
int64_t bx = x;
auto s = std::to_string(std::abs(bx));
std::reverse(s.begin(), s.end());
auto r = std::stoll(s);
return (r < INT_MIN || r > INT_MAX) ? 0 : sign * (int)r;
}
};
| 21.823529
| 64
| 0.498652
|
alexandru-dinu
|
7abd8d8902d6549c9a9cbd099797a65257771aff
| 2,124
|
cpp
|
C++
|
src/shape.cpp
|
SergeyG22/TetrisRepository
|
527f671f7732cc07109ff30ea9cb1fca673e889e
|
[
"MIT"
] | null | null | null |
src/shape.cpp
|
SergeyG22/TetrisRepository
|
527f671f7732cc07109ff30ea9cb1fca673e889e
|
[
"MIT"
] | null | null | null |
src/shape.cpp
|
SergeyG22/TetrisRepository
|
527f671f7732cc07109ff30ea9cb1fca673e889e
|
[
"MIT"
] | null | null | null |
#include "shape.h"
Shape::~Shape(){
}
bool Shape::moveShape(){
for(int i = 0; i < figure.size(); ++i){
//если конец остановить
if(figure.value(i).y() == window->height() - shape_configuration.size.width()){
return true;
}
}
if(shape_configuration.activity){
for(QRect& rect: figure){
int y = rect.y() + shape_configuration.step;
rect.moveTo(rect.x(),y);
repaintShape();
}
}
return false;
}
bool Shape::checkArgumentsShape(int pos_x, int pos_y, QSize size_rect){
if(pos_x < 0 || pos_y < 0 || size_rect.width() < 0 || size_rect.height() < 0){
perror("argument is less than zero");
return false;
}
return true;
}
void Shape::moveToRight(){
if(shape_configuration.activity){
if(std::all_of(figure.begin(), figure.end(), [&](QRect i){ return i.x() < window->width() - shape_configuration.size.width();})){
for(QRect &rect: figure){
rect.moveTo(rect.x() + rect.size().width(),rect.y());
repaintShape();
}
}
}
}
void Shape::moveToLeft(){
if(shape_configuration.activity){
if(std::all_of(figure.begin(), figure.end(), [](QRect i){ return i.x() - i.size().width() >= 0;})){
for(QRect &rect: figure) {
rect.moveTo(rect.x() - rect.size().width(),rect.y());
repaintShape();
}
}
}
}
bool Shape::moveToDown(FieldOfRectangles& field){
if(shape_configuration.activity){
if(std::all_of(figure.begin(), figure.end(), [&](QRect i){ return i.y() + i.size().width() < window->height();})){
if(field.bottomCollision(figure)){
return true;
}
for(QRect &rect: figure) {
rect.moveTo(rect.x(),rect.y() + rect.size().width());
repaintShape();
}
for(QRect &rect: figure){
if(rect.y() + rect.size().width() == window->height()){
return true;
}
}
}
}
return false;
}
| 27.584416
| 137
| 0.51177
|
SergeyG22
|
7abe681a701691dc9eb3bb3e36784c972d871c53
| 2,606
|
cpp
|
C++
|
mcrouter/routes/test/ShadowRouteTest.cpp
|
hrjaco/mcrouter
|
5a7b852a1ea2f3c645e0b8366c0549bc992870af
|
[
"BSD-3-Clause"
] | null | null | null |
mcrouter/routes/test/ShadowRouteTest.cpp
|
hrjaco/mcrouter
|
5a7b852a1ea2f3c645e0b8366c0549bc992870af
|
[
"BSD-3-Clause"
] | null | null | null |
mcrouter/routes/test/ShadowRouteTest.cpp
|
hrjaco/mcrouter
|
5a7b852a1ea2f3c645e0b8366c0549bc992870af
|
[
"BSD-3-Clause"
] | null | null | null |
/**
* Copyright (c) 2014, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#include <memory>
#include <random>
#include <vector>
#include <gtest/gtest.h>
#include "mcrouter/routes/DefaultShadowPolicy.h"
#include "mcrouter/routes/ShadowRoute.h"
#include "mcrouter/routes/ShadowRouteIf.h"
#include "mcrouter/lib/test/RouteHandleTestUtil.h"
using namespace facebook::memcache::mcrouter;
using namespace facebook::memcache;
using std::make_shared;
using std::string;
using std::vector;
TEST(shadowRouteTest, defaultPolicy) {
vector<std::shared_ptr<TestHandle>> normalHandle{
make_shared<TestHandle>(GetRouteTestData(mc_res_found, "a")),
};
auto normalRh = get_route_handles(normalHandle)[0];
vector<std::shared_ptr<TestHandle>> shadowHandles{
make_shared<TestHandle>(GetRouteTestData(mc_res_found, "b")),
make_shared<TestHandle>(GetRouteTestData(mc_res_found, "c")),
};
TestFiberManager fm;
auto data = make_shared<proxy_pool_shadowing_policy_t::Data>();
vector<std::shared_ptr<proxy_pool_shadowing_policy_t>> settings {
make_shared<proxy_pool_shadowing_policy_t>(data, nullptr),
make_shared<proxy_pool_shadowing_policy_t>(data, nullptr),
};
auto shadowRhs = get_route_handles(shadowHandles);
ShadowData<TestRouteHandleIf> shadowData = {
{std::move(shadowRhs[0]), std::move(settings[0])},
{std::move(shadowRhs[1]), std::move(settings[1])},
};
TestRouteHandle<ShadowRoute<TestRouteHandleIf, DefaultShadowPolicy>> rh(
normalRh,
std::move(shadowData),
0,
DefaultShadowPolicy());
fm.runAll(
{
[&] () {
auto reply = rh.route(McRequest("key"),
McOperation<mc_op_get>());
EXPECT_TRUE(reply.result() == mc_res_found);
EXPECT_TRUE(toString(reply.value()) == "a");
}
});
EXPECT_TRUE(shadowHandles[0]->saw_keys.empty());
EXPECT_TRUE(shadowHandles[1]->saw_keys.empty());
data->end_index = 1;
data->end_key_fraction = 1.0;
fm.runAll(
{
[&] () {
auto reply = rh.route(McRequest("key"),
McOperation<mc_op_get>());
EXPECT_TRUE(reply.result() == mc_res_found);
EXPECT_TRUE(toString(reply.value()) == "a");
}
});
EXPECT_TRUE(shadowHandles[0]->saw_keys == vector<string>{"key"});
EXPECT_TRUE(shadowHandles[1]->saw_keys == vector<string>{"key"});
}
| 29.613636
| 79
| 0.683039
|
hrjaco
|
7abfa3fe7c72801b08250e37ece2346a6888d62d
| 3,176
|
hpp
|
C++
|
von_mises.hpp
|
slmcbane/Le-TO
|
d8fb0378fb687bb6dd56ed302072b59e5cdfb92f
|
[
"MIT"
] | null | null | null |
von_mises.hpp
|
slmcbane/Le-TO
|
d8fb0378fb687bb6dd56ed302072b59e5cdfb92f
|
[
"MIT"
] | null | null | null |
von_mises.hpp
|
slmcbane/Le-TO
|
d8fb0378fb687bb6dd56ed302072b59e5cdfb92f
|
[
"MIT"
] | null | null | null |
#ifndef VON_MISES_HPP
#define VON_MISES_HPP
#include <cassert>
#include <iostream>
#include <utility>
#include "2d.hpp"
namespace Elasticity
{
namespace TwoD
{
template <class Element>
struct VonMisesComputer
{
template <class Vector>
VonMisesComputer(const Element &el, const Vector &v, double lambda, double mu)
: el(el), coeffs(), lambda{lambda}, mu{mu}
{
coeffs = v;
}
template <class... Args>
double evaluate(const Args &... args) const
{
const auto dudx = partials(args...);
const auto div = dudx[0] + dudx[1];
const auto a = lambda * div + 2 * mu * dudx[0];
const auto b = lambda * div + 2 * mu * dudx[1];
const auto c = mu * (dudx[2] + dudx[3]);
return std::sqrt(a * a - a * b + b * b + 3 * c * c);
}
template <class... Args>
std::pair<double, Eigen::Matrix<double, 2 * basis_size<Element>, 1>>
evaluate_with_gradient(const Args &... args) const
{
const auto dudx = partials(args...);
const auto div = dudx[0] + dudx[1];
const auto a = lambda * div + 2 * mu * dudx[0];
const auto b = lambda * div + 2 * mu * dudx[1];
const auto c = mu * (dudx[2] + dudx[3]);
const auto sigma = std::sqrt(a * a - a * b + b * b + 3 * c * c);
const double xcoeff1 = (lambda + 2 * mu) * (2 * a - b) + lambda * (2 * b - a);
const double ycoeff1 = (lambda + 2 * mu) * (2 * b - a) + lambda * (2 * a - b);
const double coeff2 = 6 * c * mu;
Eigen::Matrix<double, 2 * basis_size<Element>, 1> grad;
Galerkin::static_for<0, basis_size<Element>, 1>([&](auto I) {
const double phi_x = el.template partial<0>(Galerkin::get<I()>(Element::basis))(args...);
const double phi_y = el.template partial<1>(Galerkin::get<I()>(Element::basis))(args...);
grad[2 * I()] = xcoeff1 * phi_x + coeff2 * phi_y;
grad[2 * I() + 1] = ycoeff1 * phi_y + coeff2 * phi_x;
});
grad /= (2 * sigma);
return std::make_pair(sigma, grad);
}
template <class Vector>
void set_coeffs(const Vector &cs)
{
coeffs = cs;
}
constexpr static auto coeffs_size = 2 * Element::basis.size();
const Element &element() const noexcept { return el; }
private:
const Element el;
Eigen::Matrix<double, 2 * Element::basis.size(), 1> coeffs;
double lambda, mu;
// returns (ux_x, uy_y, ux_y, uy_x)
template <class... Args>
Eigen::Vector4d partials(const Args &... args) const
{
Eigen::Vector4d ps(0, 0, 0, 0);
Galerkin::static_for<0, basis_size<Element>, 1>([&](const auto I) {
const auto phi_x = el.template partial<0>(Galerkin::get<I()>(Element::basis))(args...);
const auto phi_y = el.template partial<1>(Galerkin::get<I()>(Element::basis))(args...);
ps[0] += coeffs[2 * I()] * phi_x;
ps[1] += coeffs[2 * I() + 1] * phi_y;
ps[2] += coeffs[2 * I()] * phi_y;
ps[3] += coeffs[2 * I() + 1] * phi_x;
});
return ps;
}
};
} // namespace TwoD
} // namespace Elasticity
#endif // VON_MISES_HPP
| 31.76
| 101
| 0.548174
|
slmcbane
|
7ac146b3ba0b13ea9afdd1e0860b352a7ac8e7b2
| 49,475
|
cpp
|
C++
|
Sandbox/HazelDash/HazelDashLayer.cpp
|
rocketman123456/RocketGE
|
dd8b6de286ce5d2abebc55454fbdf67968558535
|
[
"Apache-2.0"
] | 2
|
2020-12-06T23:16:46.000Z
|
2020-12-27T13:33:26.000Z
|
Sandbox/HazelDash/HazelDashLayer.cpp
|
rocketman123456/RocketGE
|
dd8b6de286ce5d2abebc55454fbdf67968558535
|
[
"Apache-2.0"
] | null | null | null |
Sandbox/HazelDash/HazelDashLayer.cpp
|
rocketman123456/RocketGE
|
dd8b6de286ce5d2abebc55454fbdf67968558535
|
[
"Apache-2.0"
] | null | null | null |
#include "HazelDashLayer.h"
#include "Components/Amoeba.h"
#include "Components/Animation.h"
#include "Components/Camera.h"
#include "Components/EnemyMovement.h"
#include "Components/Explosion.h"
#include "Components/Mass.h"
#include "Components/PlayerState.h"
#include "Components/Roll.h"
#include "Random.h"
#include "GEModule/Application.h"
#include "GEUtils/KeyCodes.h"
#include "GEEvent/KeyEvent.h"
#include "GERender/RenderCommand.h"
#include "GERender2D/Renderer2D.h"
#include "Hazel/Scene/Components.h"
#include <GLFW/glfw3.h>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <iomanip>
#include <sstream>
#ifdef _DEBUG
#include <imgui.h>
#endif
// If BATCHRENDER_TEST is non-zero, then starting level is always the
// large one with hazel logo, and will use huge viewport.
// Otherwise set STARTING_LEVEL to the level index (from levelDefinition)
// that you want to start on (and will use normal sized viewport)
// Real levels start from index 5, the ones before that are just small tests
#define BATCHRENDER_TEST 0
#define STARTING_LEVEL 0
struct LevelDefinition
{
int Width;
int Height;
int ScoreRequired;
int TimeAllowed;
std::string LevelData;
};
static std::vector<LevelDefinition> s_LevelDefinition = {
{10, 10, 1, 0,
"WWWWWWWWWW"
"W.......XW"
"W........W"
"W........W"
"W........W"
"W........W"
"W........W"
"W........W"
"WP......dW"
"WWWWWWWWWW"},
{10, 10, 1, 0,
"WWWWWWWWWW"
"W.r...r.XW"
"W........W"
"W... .W"
"W... .W"
"W... .W"
"W... B .W"
"W........W"
"WP.......W"
"WWWWWWWWWW"},
{10, 10, 1, 0,
"WWWWWWWWWW"
"W.r...r.XW"
"W........W"
"W... .W"
"W... .W"
"W... .W"
"W... F .W"
"W........W"
"WP......dW"
"WWWWWWWWWW"},
{40, 22, 9, 150,
"WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW"
"WP.....................................W"
"W......................................W"
"W......................................W"
"W......................................W"
"W.................r................ W"
"W....................r.................W"
"W.......r...........r..................W"
"W..................r...................W"
"W....... oooooooooo...........r........W"
"W....... ..............................W"
"W....... ..................... ........W"
"W....... ..................... ........W"
"W....... ..................... ........W"
"W.......B..................... ........W"
"W.......B.....................F........W"
"W....... ..................... ........W"
"W......................................W"
"W......................................W"
"W......................................W"
"W.....................................XW"
"WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW"},
{160, 88, 20, 120,
"WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW"
"WP.............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W........................................................................ .........................................................W"
"W........................................................................ ........................... .........................................................W"
"W........................................................................ . B . .........................................................W"
"W........................................................................ . ....................... . .........................................................W"
"W........................................................................ . ....................... . .........................................................W"
"W........................................................................ . ....................... . .........................................................W"
"W........................................................................ . ....................... . .........................................................W"
"W........................................................................ . ....................... . .........................................................W"
"W............ .............. ........................... . ....................... . .........................................................W"
"W............ .............. ........................... . . .........................................................W"
"W............ .............. ........................... ........................... .........................................................W"
"W............F d ..............F d ........................... B .........................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W............................................................................................................................................................. W"
"W............................................................................................................................................................. W"
"W............................................................................................................................................................. W"
"W............................................................................................................................................................. W"
"W............................................................................................................................................................. W"
"W............................................................................................................................................................. W"
"W....................................................................r........................................................................................ W"
"W...................................................................rr......................r................................................................. W"
"W..................................................................rrr.....................rr................................................................. W"
"W.................................................................rrrr....................rrr................................................................. W"
"W................................................................rrrrr...................rrrr................................................................. W"
"W...................rwwwwwwwwwwwwwwwwwwwwwwr.....................rrrr...................rrrrr....................rwwwwwwwwwwwwwwwwwwwwwwr..................... W"
"W....................w....................w......................rrr...................rrrrrr.....................w....................w...................... W"
"W....................w....................w......................rr..r.................rrrrrr.....................w....................w...................... W"
"W....................w....................w......................r..rr.................rrrrrr.....................w....................w...................... W"
"W....................w....................w........................rrr.................rrrrrr.....................w....................w...................... W"
"W....................w....................w.......................rrrrrrrrrrrrrrrrrrrrrrrrrrr.....................w....................w...................... W"
"W....................w....................w......................rrrrrrrrrrrrrrrrrrrrrrrrrrrr.....................w....................w...................... W"
"W....................w....................w......................rrrrrrrrrrrrrrrrrrrrrrrrrrr......................w....................w...................... W"
"W....................w....................w......................rrrrr.................rrrr.......................w....................w...................... W"
"W....................wAA..................w......................rrrrr.................rrr..r.....................w..................AAw...................... W"
"W...................rwwwwwwwwwwwwwwwwwwwwwwr.....................rrrrr.................rr..rr....................rwwwwwwwwwwwwwwwwwwwwwwr..................... W"
"W................................................................rrrrr.................r..rrr................................................................. W"
"W................................................................rrrrr...................rrrr..................................................................W"
"W................... F .....................rrrr...................rrrrr.................... F ......................W"
"W................................................................rrr...................rrrrr...................................................................W"
"W................................................................rr....................rrrr....................................................................W"
"W................................................................r.....................rr......................................................................W"
"W......................................................................................r.......................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W..............................................................................................................................................................W"
"W.............................................................................................................................................................XW"
"WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW"},
{40, 22, 1, 150,
"WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW"
"WP........r.............r...rr..r......W"
"Wr.....r..........r.............r...r.dW"
"W....r..........r..wwwwwwwwwwwwwwwwwwwwW"
"W..rr........r..w..r.r....r............W"
"W..rd.rr.rr.....w......r.........r.r..rW"
"W.rr..r......r..w..rr....rr..r..rw.r..rW"
"Wwwwwww.........w....r.rr..r.....w.rr..W"
"W.........rr.r..w.r..............wrr...W"
"W......r.r.r....wrr.......r.....rw.d.r.W"
"W.rrr...........wrdr........r....wdd...W"
"Wr..r.r......r.rw.....rr.rr.r.r..wdd.r.W"
"Wr.r...w....r...w..rrr....rr...r.w....rW"
"W....r.w........w......r..rr.r...w.....W"
"W......w...r..r.w.....r.r......rrw....rW"
"W..r.r.wrr...rdrw..r..r...r......w...rrW"
"Wr.....w..r.....w.r....r..rr..r.rw..r.rW"
"W.rr...w....r..rw...r.wwwwwwwwwwwwwwwwwW"
"W......wwwwwwwwww.r..r...r...r......r..W"
"W..rr.....r.rr....d....r.r.r....r....rrW"
"W.r....r.....r...dd...rrr.r...r.r.....XW"
"WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW"},
{40, 22, 9, 150,
"WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW"
"WP..........r.....w.......r............W"
"W.................w....................W"
"W.................w.w.......w.w........W"
"W.......w.w.......w.wwwwwwwwwwwwwwwwww.W"
"Wwwwwwwww.wwwwwwwww.w ..w W"
"W w.w w.w w.w W"
"W w.w w.. w.r dW"
"WFd r.r wwwwwwwwwww.w.wwwwwwwW"
"Wwwwwwwww.wwwwwwwww.w ..w W"
"W w.w w.w w.w W"
"W w.w w.r w.wd W"
"W d r.r w.wwwwwwwww.wwwwwwww.W"
"Wwwwwwwww.wwwwwwwww.w w.w W"
"W w.w w.w w.w W"
"W w.w ..r w.w dW"
"W d r.r w.wwwwwwwww.w.wwwwwwwW"
"Wwwwwwwww.wwwwwwwww.w ..w W"
"W w.w w.w w.w W"
"W w.w w.r w.wd .W"
"W d r.r dwwwwwwwwwwwwwwwwwwwwXW"
"WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW"},
{40, 22, 10, 0,
"WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW"
"WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW"
"WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW"
"WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW"
"WWWWWW WWWWWW W WW WWWW WWWWW"
"WWWWWWW WWWW PWW WWWW WW WWWW WWWWW"
"WWWWWWWW WW WWW WWWW WW WWWW WWWWW"
"WWWWWWWWWW WWWWW WWWW WW WWWW WWWWW"
"WWWWWWWWWW WWWWW WWWW WW WWWW WWWWW"
"WWWWWWWWWW WWWWW WWW WWWWWW"
"WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW"
"WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW"
"WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW"
"WWWW WWWWWW WW WWW WWW WWWWWWWW"
"WWWW WWWWWW WWWW WWWWW WW WWWWWWWW"
"WWWWW WWWW WWWWW WWWWW W WWWWWWWW"
"WWWWW W W WWWWW WWWWW W WWWWWWWW"
"WWWWWW WWWWWW WWWWW WW WWWWWWWW"
"WWWWWW WW WWWW WWW WWW WWWWWWWW"
"WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW"
"WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW"
"WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW"}};
Tile CharToTile(const char ch)
{
static std::unordered_map<char, Tile> tileMap = {
{'P', Tile::PlayerFirst},
{'X', Tile::DoorFirst},
{'A', Tile::AmoebaFirst},
{'B', Tile::ButterflyFirst},
{'F', Tile::FireflyFirst},
{'W', Tile::Metal1},
{'w', Tile::Brick1},
{'.', Tile::Dirt1},
{'r', Tile::BoulderFirst},
{'d', Tile::DiamondFirst},
{'o', Tile::BarrelFirst},
{' ', Tile::Empty}};
std::unordered_map<char, Tile>::const_iterator tile = tileMap.find(ch);
RK_ASSERT(tile != tileMap.end(), "ERROR: Unknown character '{}' in level definition", ch);
return (tile != tileMap.end()) ? tile->second : Tile::Empty;
}
Animation CharToAnimation(const char ch)
{
static std::unordered_map<char, Animation> animationMap = {
{'P', {{Tile::PlayerIdle0, Tile::PlayerIdle1, Tile::PlayerIdle2, Tile::PlayerIdle3}}},
{'A', {{Tile::Amoeba0, Tile::Amoeba1, Tile::Amoeba2, Tile::Amoeba3, Tile::Amoeba4, Tile::Amoeba5, Tile::Amoeba6, Tile::Amoeba7}}},
{'B', {{Tile::Butterfly0, Tile::Butterfly1, Tile::Butterfly2, Tile::Butterfly3}}},
{'F', {{Tile::Firefly0, Tile::Firefly1, Tile::Firefly2, Tile::Firefly3}}},
{'d', {{Tile::Diamond0, Tile::Diamond1, Tile::Diamond2, Tile::Diamond3, Tile::Diamond4, Tile::Diamond5, Tile::Diamond6, Tile::Diamond7}}}};
std::unordered_map<char, Animation>::const_iterator animation = animationMap.find(ch);
if (animation == animationMap.end())
{
return Animation{};
}
else
{
return animation->second;
}
}
Roll CharToRoll(const char ch)
{
static std::unordered_map<char, Roll> rollMap = {
{'r', {{Tile::Boulder0, Tile::Boulder1, Tile::Boulder2, Tile::Boulder3}}},
{'o', {{Tile::Barrel0, Tile::Barrel1, Tile::Barrel2, Tile::Barrel3}}}};
std::unordered_map<char, Roll>::const_iterator roll = rollMap.find(ch);
if (roll == rollMap.end())
{
return Roll{};
}
else
{
return roll->second;
}
}
const Animation &GetPlayerAnimation(PlayerState state, bool lastWasLeft)
{
static std::array<Animation, 6> animations = {
Animation{{Tile::PlayerIdle0, Tile::PlayerIdle0, Tile::PlayerIdle0, Tile::PlayerIdle0}},
Animation{{Tile::PlayerIdle0, Tile::PlayerIdle1, Tile::PlayerIdle2, Tile::PlayerIdle3}}, // TODO: idle animations
Animation{{Tile::PlayerIdle0, Tile::PlayerIdle1, Tile::PlayerIdle2, Tile::PlayerIdle3}}, // TODO: idle animations
Animation{{Tile::PlayerIdle0, Tile::PlayerIdle1, Tile::PlayerIdle2, Tile::PlayerIdle3}}, // TODO: idle animations
Animation{{Tile::PlayerLeft0, Tile::PlayerLeft1, Tile::PlayerLeft2, Tile::PlayerLeft3}},
Animation{{Tile::PlayerRight0, Tile::PlayerRight1, Tile::PlayerRight2, Tile::PlayerRight3}}};
if (state == PlayerState::MovingUp || state == PlayerState::MovingDown)
{
state = lastWasLeft ? PlayerState::MovingLeft : PlayerState::MovingRight;
}
return animations[static_cast<int>(state)];
}
PlayerState SetPlayerBlinkState(PlayerState state)
{
switch (state)
{
case PlayerState::Idle:
state = PlayerState::Blink;
break;
case PlayerState::Blink:
state = PlayerState::Blink;
break;
case PlayerState::FootTap:
state = PlayerState::BlinkFootTap;
break;
case PlayerState::BlinkFootTap:
state = PlayerState::BlinkFootTap;
break;
}
return state;
}
PlayerState ClearPlayerBlinkState(PlayerState state)
{
switch (state)
{
case PlayerState::Idle:
state = PlayerState::Idle;
break;
case PlayerState::Blink:
state = PlayerState::Idle;
break;
case PlayerState::FootTap:
state = PlayerState::FootTap;
break;
case PlayerState::BlinkFootTap:
state = PlayerState::FootTap;
break;
}
return state;
}
PlayerState SwapPlayerFootTapState(PlayerState state)
{
switch (state)
{
case PlayerState::Idle:
state = PlayerState::FootTap;
break;
case PlayerState::Blink:
state = PlayerState::BlinkFootTap;
break;
case PlayerState::FootTap:
state = PlayerState::Idle;
break;
case PlayerState::BlinkFootTap:
state = PlayerState::Blink;
break;
}
return state;
}
HazelDashLayer::HazelDashLayer()
: Layer("HelloBoulder"), m_ViewPort(0.0f, 0.0f, 20.0f, 11.0f), m_FixedTimestep(1.0 / 8.0f) // game logic runs at 8 fps
,
m_AnimationTimestep(1.0f / 25.0f) // animation runs at 25fps
,
m_FixedUpdateAccumulatedTs(0.0f), m_AnimatorAccumulatedTs(0.0f), m_PushProbability(0.25), m_CurrentLevel(STARTING_LEVEL), m_Width(0), m_Height(0), m_Score(0), m_ScoreRequired(0), m_AmoebaSize(0), m_AmoebaPotential(0), m_GamePaused(false), m_PlayerIsAlive(false), m_WonLevel(false)
{
#if BATCHRENDER_TEST
m_CurrentLevel = 4;
m_ViewPort = {0.0f, 0.0f, 160.0f, 88.0f};
#endif
m_ViewPort.SetCameraSpeed((1.0f / m_FixedTimestep) - 1.0f);
}
void HazelDashLayer::OnAttach()
{
std::string basePath = ProjectSourceDir + "/Assets/textures/dash";
std::string extension = ".png";
for (size_t i = 0; i < m_Tiles.size(); ++i)
{
std::ostringstream os;
os << std::setfill('0') << std::setw(3) << i;
std::string path = basePath + os.str() + extension;
m_Tiles[i] = Hazel::Texture2D::Create(path);
}
Hazel::RenderCommand::SetClearColor({0.0f, 0.0f, 0.0f, 1});
LoadScene(m_CurrentLevel);
}
void HazelDashLayer::OnDetach()
{
}
void HazelDashLayer::OnUpdate(Hazel::Timestep ts)
{
RK_PROFILE_FUNCTION();
if (m_GamePaused)
{
return;
}
if (m_WonLevel)
{
LoadScene(++m_CurrentLevel);
}
Hazel::Renderer2D::ResetStats();
Hazel::Renderer2D::StatsBeginFrame();
m_FixedUpdateAccumulatedTs += ts;
if (m_FixedUpdateAccumulatedTs > m_FixedTimestep)
{
//
// Each of these functions is a "system" that operates on a set of game entities.
// I envisage these will become some sort of scripted game-logic in the future...
//
// These systems are updated on a fixed timestep
PhysicsFixedUpdate();
PlayerControllerFixedUpdate();
EnemiesFixedUpdate();
AmoebaFixedUpdate();
m_FixedUpdateAccumulatedTs = 0.0;
}
// These systems update as fast as they like
PlayerControllerUpdate(ts);
ExploderUpdate(ts);
AnimatorUpdate(ts);
CameraControllerUpdate(ts);
RendererUpdate(ts);
RK_PROFILE_FRAMEMARKER();
Hazel::Renderer2D::StatsEndFrame();
auto stats = Hazel::Renderer2D::GetStats();
float averageRenderTime = stats.TotalFrameRenderTime / stats.FrameRenderTime.size(); // nb: wont be accurate until we have gathered at least stats.FrameRenderTime().size() results
float averageFPS = 1.0f / averageRenderTime;
char buffer[64];
sprintf_s(buffer, 64, "Average frame render time: %8.5f (%5.0f fps)", averageRenderTime, averageFPS);
glfwSetWindowTitle((GLFWwindow *)Hazel::Application::Get().GetWindow().GetNativeWindow(), buffer);
}
void HazelDashLayer::OnEvent(Hazel::Event &e)
{
Hazel::EventDispatcher dispatcher(e);
dispatcher.Dispatch<Hazel::KeyPressedEvent>(RK_BIND_EVENT_FN(HazelDashLayer::OnKeyPressed));
}
bool HazelDashLayer::OnKeyPressed(Hazel::KeyPressedEvent &e)
{
if (e.GetKeyCode() == RK_KEY_SPACE)
{
if (m_PlayerIsAlive)
{
m_GamePaused = !m_GamePaused;
}
else
{
LoadScene(m_CurrentLevel);
}
}
else if (e.GetKeyCode() == RK_KEY_ESCAPE)
{
LoadScene(m_CurrentLevel);
}
return true;
}
void HazelDashLayer::LoadScene(int level)
{
const LevelDefinition &definition = s_LevelDefinition[level];
m_Scene.DestroyAllEntities();
m_Entities.clear();
m_Width = definition.Width;
m_Height = definition.Height;
m_WonLevel = false;
m_EmptyEntity = m_Scene.CreateEntity();
m_EmptyEntity.AddComponent<Tile>(Tile::Empty);
Position playerPosition;
m_Entities.resize(m_Width * m_Height);
for (int row = 0; row < m_Height; ++row)
{
for (int col = 0; col < m_Width; ++col)
{
int charIndex = (m_Width * (m_Height - (row + 1))) + col;
RK_ASSERT(charIndex < definition.LevelData.size(), "insufficient levelData supplied");
if (charIndex < definition.LevelData.size())
{
char ch = definition.LevelData[charIndex];
Tile tile = CharToTile(ch);
int index = (m_Width * row) + col;
auto entity = m_EmptyEntity;
if (!IsEmpty(tile))
{
entity = m_Scene.CreateEntity();
if (IsAmoeba(tile))
{
entity.AddComponent<Amoeba>();
}
else if (IsBoulder(tile) || IsDiamond(tile))
{
entity.AddComponent<Mass>();
}
else if (IsBarrel(tile))
{
entity.AddComponent<Mass>(MassState::Stationary, 0, 5);
}
else if (IsButterfly(tile))
{
entity.AddComponent<EnemyMovement>(3, false);
}
else if (IsFirefly(tile))
{
entity.AddComponent<EnemyMovement>(1, true);
}
else if (IsDoor(tile))
{
m_ExitEntity = entity;
}
else if (IsPlayer(tile))
{
entity.AddComponent<PlayerState>(PlayerState::Idle);
playerPosition = {row, col};
}
entity.AddComponent<Position>(row, col);
entity.AddComponent<Tile>(tile);
Animation animation = CharToAnimation(ch);
if (!animation.Frames.empty())
{
entity.AddComponent<Animation>(animation);
}
Roll roll = CharToRoll(ch);
if (!roll.Frames.empty())
{
entity.AddComponent<Roll>(roll);
}
}
m_Entities[index] = entity;
}
}
}
RK_ASSERT((playerPosition.Row > 0) && (playerPosition.Col >= 0), "ERROR: ({},{}) is not a legal starting position for player (check that level definition contains player start point)", playerPosition.Row, playerPosition.Col);
m_Score = 0;
m_ScoreRequired = definition.ScoreRequired;
m_ViewPort.SetLevelSize(static_cast<float>(m_Width), static_cast<float>(m_Height));
m_ViewPort.SetPlayerPosition(static_cast<float>(playerPosition.Col), static_cast<float>(playerPosition.Row));
}
void HazelDashLayer::PhysicsFixedUpdate()
{
RK_PROFILE_FUNCTION();
// Note: To get the behaviour of the original DB game, the "physics" system must evaluate
// the entities in level top-down order.
// However, the ECS will not do that.
// Instead, entities will just be iterated in whatever order they happen to be stored in the
// underlying data structures (and to try and iterate them in any other order kind of defeats
// the purpose of the ECS in the first place (which is to iterate in a cache-friendly way))
// EnTT does allow for sorting of components (i.e. sort them first, and then iterate them in order)
// So that is worth investigating.
// However, for now I am just going to ignore it, and iterate the entities in the order that the ECS
// has them.
static const Position Below = {-1, 0};
static const Position Left = {0, -1};
static const Position BelowLeft = {-1, -1};
static const Position Right = {0, 1};
static const Position BelowRight = {-1, 1};
m_Scene.m_Registry.group<Mass>(entt::get<Position>).each([this](const auto entityHandle, auto &mass, auto &pos) {
Hazel::Entity entity(entityHandle, &m_Scene);
Hazel::Entity entityBelow = GetEntity(pos + Below);
auto tileBelow = entityBelow.GetComponent<Tile>();
if (IsEmpty(tileBelow))
{
mass.State = MassState::Falling;
++mass.HeightFallen;
SwapEntities(pos, pos + Below);
pos += Below;
}
else
{
if ((mass.State == MassState::Falling) && IsExplosive(tileBelow))
{
OnExplode(pos + Below);
}
else if (mass.HeightFallen > mass.FallLimit)
{
OnExplode(pos);
}
else
{
if (IsRounded(tileBelow))
{
Hazel::Entity entityLeft = GetEntity(pos + Left);
Hazel::Entity entityBelowLeft = GetEntity(pos + BelowLeft);
auto tileLeft = entityLeft.GetComponent<Tile>();
auto tileBelowLeft = entityBelowLeft.GetComponent<Tile>();
if (IsEmpty(tileLeft) && IsEmpty(tileBelowLeft))
{
// bounce left
mass.State = MassState::Falling;
SwapEntities(pos, pos + Left);
pos += Left;
if (entity.HasComponent<Roll>())
{
auto &roll = entity.GetComponent<Roll>();
auto &tile = entity.GetComponent<Tile>();
roll.CurrentFrame = (roll.CurrentFrame - 1) % roll.Frames.size();
tile = roll.Frames[roll.CurrentFrame];
}
}
else
{
Hazel::Entity entityRight = GetEntity(pos + Right);
Hazel::Entity entityBelowRight = GetEntity(pos + BelowRight);
auto tileRight = entityRight.GetComponent<Tile>();
auto tileBelowRight = entityBelowRight.GetComponent<Tile>();
if (IsEmpty(tileRight) && IsEmpty(tileBelowRight))
{
// bounce right
mass.State = MassState::Falling;
SwapEntities(pos, pos + Right);
pos += Right;
if (entity.HasComponent<Roll>())
{
auto &roll = entity.GetComponent<Roll>();
auto &tile = entity.GetComponent<Tile>();
roll.CurrentFrame = (roll.CurrentFrame + 1) % roll.Frames.size();
tile = roll.Frames[roll.CurrentFrame];
}
}
else
{
mass.State = MassState::Stationary;
mass.HeightFallen = 0;
}
}
}
else
{
mass.State = MassState::Stationary;
mass.HeightFallen = 0;
}
}
}
});
}
void HazelDashLayer::PlayerControllerFixedUpdate()
{
RK_PROFILE_FUNCTION();
static const Position Left = {0, -1};
static const Position Right = {0, 1};
static const Position Up = {1, 0};
static const Position Down = {-1, 0};
static bool lastWasLeft = false; // hack
m_Scene.m_Registry.group<PlayerState>(entt::get<Position, Animation>).each([this](auto &state, auto &pos, auto &animation) {
PlayerState newState = PlayerState::Idle;
PlayerState secondaryState = PlayerState::Idle;
if (Hazel::Input::IsKeyPressed(RK_KEY_LEFT) || Hazel::Input::IsKeyPressed(RK_KEY_A))
{
newState = PlayerState::MovingLeft;
lastWasLeft = true;
}
else if (Hazel::Input::IsKeyPressed(RK_KEY_RIGHT) || Hazel::Input::IsKeyPressed(RK_KEY_D))
{
newState = PlayerState::MovingRight;
lastWasLeft = false;
}
if (Hazel::Input::IsKeyPressed(RK_KEY_UP) || Hazel::Input::IsKeyPressed(RK_KEY_W))
{
secondaryState = newState;
newState = PlayerState::MovingUp;
}
else if (Hazel::Input::IsKeyPressed(RK_KEY_DOWN) || Hazel::Input::IsKeyPressed(RK_KEY_S))
{
secondaryState = newState;
newState = PlayerState::MovingDown;
}
if (IsIdle(state))
{
if (!IsIdle(newState))
{
state = newState;
animation = GetPlayerAnimation(state, lastWasLeft);
}
}
else
{
if (state != newState)
{
state = newState;
animation = GetPlayerAnimation(state, lastWasLeft);
}
}
bool ctrlPressed = Hazel::Input::IsKeyPressed(RK_KEY_LEFT_CONTROL) || Hazel::Input::IsKeyPressed(RK_KEY_RIGHT_CONTROL);
Position oldPos = pos;
switch (state)
{
case PlayerState::MovingLeft:
TryMovePlayer(pos, Left, ctrlPressed);
break;
case PlayerState::MovingRight:
TryMovePlayer(pos, Right, ctrlPressed);
break;
case PlayerState::MovingUp:
if (!TryMovePlayer(pos, Up, ctrlPressed))
{
if (secondaryState == PlayerState::MovingLeft)
{
TryMovePlayer(pos, Left, ctrlPressed);
}
else if (secondaryState == PlayerState::MovingRight)
{
TryMovePlayer(pos, Right, ctrlPressed);
}
}
break;
case PlayerState::MovingDown:
if (!TryMovePlayer(pos, Down, ctrlPressed))
{
if (secondaryState == PlayerState::MovingLeft)
{
TryMovePlayer(pos, Left, ctrlPressed);
}
else if (secondaryState == PlayerState::MovingRight)
{
TryMovePlayer(pos, Right, ctrlPressed);
}
}
break;
}
if (oldPos != pos)
{
Hazel::Entity entityAtNewPos = GetEntity(pos);
auto tile = entityAtNewPos.GetComponent<Tile>();
SwapEntities(oldPos, pos);
ClearEntity(oldPos);
OnPlayerMoved(pos);
if (IsDoor(tile))
{
OnLevelCompleted();
}
if (IsCollectable(tile))
{
OnIncreaseScore();
}
}
});
}
void HazelDashLayer::PlayerControllerUpdate(Hazel::Timestep ts)
{
RK_PROFILE_FUNCTION();
m_Scene.m_Registry.group<PlayerState>(entt::get<Position, Animation>).each([this](auto &state, auto &pos, auto &animation) {
if (animation.CurrentFrame == (animation.Frames.size() - 1))
{
if (IsIdle(state))
{
PlayerState newState = state;
if (Random::Uniform0_1() < 0.25f)
{
newState = SetPlayerBlinkState(state);
}
else
{
newState = ClearPlayerBlinkState(state);
}
if (Random::Uniform0_1() < 1.0f / 16.0f)
{
newState = SwapPlayerFootTapState(state);
}
if (state != newState)
{
state = newState;
animation = GetPlayerAnimation(state, false);
}
}
}
});
}
bool HazelDashLayer::TryMovePlayer(Position &pos, Position direction, const bool ctrlPressed)
{
bool retVal = false;
Hazel::Entity entity = GetEntity(pos + direction);
auto &tile = entity.GetComponent<Tile>();
if (CanBeOccupied(tile))
{
retVal = true;
if (!ctrlPressed)
{
pos += direction;
}
}
else if ((direction.Row == 0) && IsPushable(tile))
{
retVal = true;
if (Random::Uniform0_1() < m_PushProbability)
{
Position posBelow = {pos.Row - 1, pos.Col + direction.Col};
Position posAcross = {pos.Row, pos.Col + (2 * direction.Col)};
Hazel::Entity entityBelow = GetEntity(posBelow);
Hazel::Entity entityAcross = GetEntity(posAcross);
const auto tileBelow = entityBelow.GetComponent<Tile>();
const auto tileAcross = entityAcross.GetComponent<Tile>();
if (!IsEmpty(tileBelow) && IsEmpty(tileAcross))
{
SwapEntities(posAcross, pos + direction);
auto &posPushed = entity.GetComponent<Position>();
posPushed += direction;
if (entity.HasComponent<Roll>())
{
auto &roll = entity.GetComponent<Roll>();
roll.CurrentFrame = (roll.CurrentFrame + direction.Col) % roll.Frames.size();
tile = roll.Frames[roll.CurrentFrame];
}
if (!ctrlPressed)
{
pos += direction;
}
}
}
}
return retVal;
}
void HazelDashLayer::OnPlayerMoved(const Position &pos)
{
// TODO: placeholder code. Should be done with "proper" events at some point
m_ViewPort.SetPlayerPosition(static_cast<float>(pos.Col), static_cast<float>(pos.Row));
}
void HazelDashLayer::OnPlayerDied()
{
// TODO: placeholder code. Should be done with "proper" events at some point
m_PlayerIsAlive = false;
}
void HazelDashLayer::OnLevelCompleted()
{
// TODO: placeholder code. Should be done with "proper" events at some point
m_WonLevel = true;
}
void HazelDashLayer::OnIncreaseScore()
{
// TODO: placeholder code. Should be done with "proper" events at some point
++m_Score;
if (m_Score == m_ScoreRequired)
{
Animation animation = {{Tile::Door0, Tile::Door1, Tile::Door2, Tile::Door3}, 0, false};
m_ExitEntity.AddComponent<Animation>(animation);
}
}
void HazelDashLayer::EnemiesFixedUpdate()
{
RK_PROFILE_FUNCTION();
static std::array<Position, 4> Directions{
Position{-1, 0},
Position{0, -1},
Position{1, 0},
Position{0, 1}};
m_Scene.m_Registry.group<EnemyMovement>(entt::get<Position>).each([this](auto &movement, auto &pos) {
// If next to player, then explode (and do not move)
bool move = true;
for (auto direction : Directions)
{
if (IsPlayer(GetEntity(pos + direction).GetComponent<Tile>()))
{
OnExplode(pos);
move = false;
break;
}
}
if (move)
{
// try to turn in preferred direction
// if that is not possible, go straight ahead
// if that is not possible either, then don't move, but change to opposite direction for next frame
int direction = (movement.Direction + (movement.PreferLeftTurn ? -1 : 1)) % Directions.size();
Position preferredPos = pos + Directions[direction];
if (IsEmpty(GetEntity(preferredPos).GetComponent<Tile>()))
{
SwapEntities(pos, preferredPos);
pos = preferredPos;
movement.Direction = direction;
}
else
{
Position straightPos = pos + Directions[movement.Direction];
if (IsEmpty(GetEntity(straightPos).GetComponent<Tile>()))
{
SwapEntities(pos, straightPos);
pos = straightPos;
}
else
{
movement.Direction = (movement.Direction + 2) % Directions.size();
}
}
}
});
}
void HazelDashLayer::OnExplode(const Position &pos)
{
RK_PROFILE_FUNCTION();
// TODO: placeholder code. Should be done with "proper" events at some point
static std::array<Position, 9> Offsets = {
Position{1, -1},
Position{1, 0},
Position{1, 1},
Position{0, -1},
Position{0, 0},
Position{0, 1},
Position{-1, -1},
Position{-1, 0},
Position{-1, 1}};
static Animation animation1 = {{Tile::Explosion0, Tile::Explosion1, Tile::Explosion2, Tile::Explosion3, Tile::Explosion4, Tile::Explosion5, Tile::Explosion6, Tile::Explosion7}};
static Animation animation2 = {{Tile::Explosion0, Tile::Explosion1, Tile::Explosion2, Tile::Explosion3, Tile::ExplosionDiamond4, Tile::ExplosionDiamond5, Tile::ExplosionDiamond6, Tile::Diamond7}};
auto tile = GetEntity(pos).GetComponent<Tile>();
if (IsPlayer(tile))
{
OnPlayerDied();
}
bool explodeToDiamond = IsButterfly(tile);
//
// At this point, other systems are still iterating their entities,
// so we can't go destroying anything just yet.
// What we'll do here is create an explosion entities at appropriate
// positions, then when the exploder system gets its Update, we will
// wreak the destruction there.
for (auto offset : Offsets)
{
if (!IsExplodable(GetEntity(pos + offset).GetComponent<Tile>()))
{
continue;
}
Hazel::Entity entity = m_Scene.CreateEntity();
entity.AddComponent<Position>(pos + offset);
entity.AddComponent<Explosion>(Explosion::Ignite);
if (explodeToDiamond)
{
entity.AddComponent<Animation>(animation2);
entity.AddComponent<Tile>(animation2.Frames[0]);
}
else
{
entity.AddComponent<Animation>(animation1);
entity.AddComponent<Tile>(animation1.Frames[0]);
}
}
}
void HazelDashLayer::AmoebaFixedUpdate()
{
RK_PROFILE_FUNCTION();
static const std::array<Position, 4> Directions = {
Position{-1, 0},
Position{0, -1},
Position{1, 0},
Position{0, 1}};
auto amoebas = m_Scene.m_Registry.group<Amoeba>(entt::get<Position>);
m_AmoebaSize = static_cast<int>(amoebas.size());
if (m_AmoebaSize >= 200)
{ // TODO: parameterize?
OnSolidify(Tile::BoulderFirst);
}
m_AmoebaPotential = 0;
std::unordered_set<Position> growPositions;
amoebas.each([&](auto &amoeba, auto &pos) {
for (auto direction : Directions)
{
Hazel::Entity entityOther = GetEntity(pos + direction);
auto tile = entityOther.GetComponent<Tile>();
if (IsEmpty(tile) || tile == Tile::Dirt1)
{
++m_AmoebaPotential;
if (Random::Uniform0_1() < amoeba.GrowthProbability)
{
growPositions.emplace(pos + direction);
}
}
else if (IsExplosive(tile))
{
OnExplode(pos + direction);
}
amoeba.GrowthProbability *= 1.0f + static_cast<float>(amoebas.size()) / 200000.0f;
}
});
if (m_AmoebaPotential == 0)
{
OnSolidify(Tile::Diamond0);
}
else
{
for (auto pos : growPositions)
{
Hazel::Entity entity = GetEntity(pos);
auto &tileInitial = entity.GetComponent<Tile>();
if (IsEmpty(tileInitial))
{
entity = m_Scene.CreateEntity();
entity.AddComponent<Tile>(tileInitial);
entity.AddComponent<Position>(pos);
SetEntity(pos, entity);
}
entity.AddComponent<Amoeba>();
const Animation &animation = CharToAnimation('A');
entity.AddComponent<Animation>(animation);
auto &tile = entity.GetComponent<Tile>();
tile = animation.Frames[animation.CurrentFrame]; // TODO: it would be nicer to use EnTT "short circuit" to automatically set the tile when Animation component is added
}
}
}
void HazelDashLayer::OnSolidify(const Tile solidifyTo)
{
m_Scene.m_Registry.view<Amoeba, Tile>().each([&](const auto entityHandle, auto &amoeba, auto &tile) {
Hazel::Entity entity(entityHandle, &m_Scene);
entity.RemoveComponent<Amoeba>();
tile = solidifyTo;
if (IsDiamond(tile))
{
auto &animation = entity.GetComponent<Animation>(); // we know it has an Animation component because it was an Amoeba, and Amoeba entities have an Animation
animation = CharToAnimation('d');
}
else
{
entity.RemoveComponent<Animation>();
}
});
}
void HazelDashLayer::ExploderUpdate(Hazel::Timestep ts)
{
RK_PROFILE_FUNCTION();
// When we get here, other systems are finished iterating.
// It is now safe to destroy the game entities at position of explosion entities
m_Scene.m_Registry.group<Explosion>(entt::get<Position, Animation, Tile>).each([this](const auto entityHandle, auto &explosion, auto &pos, auto &animation, auto &tile) {
if (explosion == Explosion::Ignite)
{
ClearEntity(pos);
SetEntity(pos, {entityHandle, &m_Scene});
explosion = Explosion::Burn;
}
else
{
if (animation.CurrentFrame == animation.Frames.size() - 1)
{
if (IsDiamond(animation.Frames.back()))
{
// turn into a diamond
Hazel::Entity entity(entityHandle, &m_Scene);
entity.RemoveComponent<Explosion>();
entity.AddComponent<Mass>();
animation = CharToAnimation('d');
}
else
{
//RK_ASSERT(Hazel::Entity(entityHandle, &m_Scene) == GetEntity(pos), "Something has misplaced an explosion - game logic error!");
ClearEntity(pos);
}
}
}
});
}
void HazelDashLayer::AnimatorUpdate(Hazel::Timestep ts)
{
RK_PROFILE_FUNCTION();
m_AnimatorAccumulatedTs += ts;
if (m_AnimatorAccumulatedTs > m_AnimationTimestep)
{
m_AnimatorAccumulatedTs = 0.0f;
m_Scene.m_Registry.group<Animation>(entt::get<Tile>).each([this](const auto entityHandle, auto &animation, auto &tile) {
if (++animation.CurrentFrame >= animation.Frames.size())
{
if (animation.Repeat)
{
animation.CurrentFrame = 0;
}
else
{
Hazel::Entity entity(entityHandle, &m_Scene);
entity.RemoveComponent<Animation>();
return;
}
}
tile = animation.Frames[animation.CurrentFrame];
});
}
}
void HazelDashLayer::CameraControllerUpdate(Hazel::Timestep ts)
{
RK_PROFILE_FUNCTION();
// TODO: placeholder code. Camera and Viewport may become entities and components at some point
m_ViewPort.Update(ts);
}
void HazelDashLayer::RendererUpdate(Hazel::Timestep ts)
{
RK_PROFILE_FUNCTION();
static glm::vec2 tileSize{1.0f, 1.0f};
Hazel::RenderCommand::Clear();
Hazel::Renderer2D::BeginScene(m_ViewPort.GetCamera());
// Theres a couple of options for how to render here.
// Ideally, we'd like to just say "for each entity that has a position and a tile, render it"
// That iteration is cache-friendly, but it renders a lot of entities that it doesn't need to
// (the ones that are not in the viewport).
// (either that, or we have to check "is in viewport" for every entity)
//
// The other way to do it is use our "index" of entities m_Entities[], since we can efficiently query that
// for just the entities that are in the view port.
// However, this is not cache-friendly since it will jump all over the place in the underlying
// component data.
//
// Which is best ??
// Is there a better way?
m_Scene.m_Registry.group<Position, Tile>().each([this](auto &pos, auto &tile) {
if (m_ViewPort.Overlaps(pos))
{
glm::vec2 xy = {pos.Col, pos.Row};
Hazel::Renderer2D::DrawQuad(xy, tileSize, m_Tiles[(int)tile]);
}
});
Hazel::Renderer2D::EndScene();
}
Hazel::Entity HazelDashLayer::GetEntity(const Position pos)
{
return m_Entities[(m_Width * pos.Row) + pos.Col];
}
void HazelDashLayer::SetEntity(Position pos, Hazel::Entity entity)
{
m_Entities[(m_Width * pos.Row) + pos.Col] = entity;
}
void HazelDashLayer::ClearEntity(const Position pos)
{
int index = (m_Width * pos.Row) + pos.Col;
if (m_Entities[index] != m_EmptyEntity)
{
m_Scene.DestroyEntity(m_Entities[index]);
m_Entities[index] = m_EmptyEntity;
}
}
void HazelDashLayer::SwapEntities(const Position posA, const Position posB)
{
size_t indexA = (m_Width * posA.Row) + posA.Col;
size_t indexB = (m_Width * posB.Row) + posB.Col;
Hazel::Entity entityA = m_Entities[indexA];
Hazel::Entity entityB = m_Entities[indexB];
std::swap(m_Entities[(m_Width * posA.Row) + posA.Col], m_Entities[(m_Width * posB.Row) + posB.Col]);
Hazel::Entity entityA2 = m_Entities[indexA];
Hazel::Entity entityB2 = m_Entities[indexB];
}
#ifdef _DEBUG
void HazelDashLayer::OnImGuiRender()
{
ImGui::Begin("Game Stats");
ImGui::Text("Score: %d", m_Score);
ImGui::Separator();
int updateFPS = (int)(1.0f / m_FixedTimestep);
ImGui::DragInt("Game Speed: ", &updateFPS, 1, 1, 60);
m_FixedTimestep = 1.0f / updateFPS;
m_ViewPort.SetCameraSpeed((1.0f / m_FixedTimestep) - 1.0f);
ImGui::Separator();
ImGui::Text("Amoeba:");
ImGui::Text("Count: %d", m_AmoebaSize);
ImGui::Text("Growth Potential: %d", m_AmoebaPotential);
ImGui::Separator();
auto stats = Hazel::Renderer2D::GetStats();
ImGui::Text("Renderer2D Stats:");
ImGui::Text("Draw Calls: %d", stats.DrawCalls);
ImGui::Text("Quads: %d", stats.QuadCount);
ImGui::Text("Vertices: %d", stats.GetTotalVertexCount());
ImGui::Text("Indices: %d", stats.GetTotalIndexCount());
ImGui::Text("Textures: %d", stats.TextureCount);
float averageRenderTime = stats.TotalFrameRenderTime / stats.FrameRenderTime.size(); // nb: wont be accurate until we have gathered at least stats.FrameRenderTime().size() results
float averageFPS = 1.0f / averageRenderTime;
ImGui::Text("Average frame render time: %8.5f (%5.0f fps)", averageRenderTime, averageFPS);
ImGui::End();
}
#endif
| 39.018139
| 283
| 0.475331
|
rocketman123456
|
7ac42a0cc2d9f6663081876e32d27ff07885aa65
| 10,437
|
cpp
|
C++
|
main.cpp
|
shantigilbert/TvTextViewer
|
87ca192a81bce423af6723c7514b367db6bf6580
|
[
"MIT"
] | null | null | null |
main.cpp
|
shantigilbert/TvTextViewer
|
87ca192a81bce423af6723c7514b367db6bf6580
|
[
"MIT"
] | null | null | null |
main.cpp
|
shantigilbert/TvTextViewer
|
87ca192a81bce423af6723c7514b367db6bf6580
|
[
"MIT"
] | null | null | null |
/** Copyright (c) 2021 Nikolai Wuttke
*
* 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 "imgui.h"
#include "imgui_internal.h"
#include "imgui_impl_sdl.h"
#include "imgui_impl_opengl3.h"
#include <cxxopts.hpp>
#include <GLES2/gl2.h>
#include <SDL.h>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <optional>
namespace
{
std::optional<cxxopts::ParseResult> parseArgs(int argc, char** argv)
{
try
{
cxxopts::Options options(argv[0], "TvTextViewer - a full-screen text viewer");
options
.positional_help("[input file]")
.show_positional_help()
.add_options()
("input_file", "text file to view", cxxopts::value<std::string>())
("m,message", "text to show instead of viewing a file", cxxopts::value<std::string>())
("f,font_size", "font size in pixels", cxxopts::value<int>())
("t,title", "window title (filename by default)", cxxopts::value<std::string>())
("y,yes_button", "shows a yes button with different exit code")
("e,error_display", "format as error, background will be red")
("h,help", "show help")
;
options.parse_positional({"input_file"});
try
{
const auto result = options.parse(argc, argv);
if (result.count("help"))
{
std::cout << options.help({""}) << '\n';
std::exit(0);
}
if (!result.count("input_file") && !result.count("message"))
{
std::cerr << "Error: No input given\n\n";
std::cerr << options.help({""}) << '\n';
return {};
}
if (result.count("input_file") && result.count("message"))
{
std::cerr << "Error: Cannot use input_file and message at the same time\n\n";
std::cerr << options.help({""}) << '\n';
return {};
}
return result;
}
catch (const cxxopts::OptionParseException& e)
{
std::cerr << "Error: " << e.what() << "\n\n";
std::cerr << options.help({""}) << '\n';
}
}
catch (const cxxopts::OptionSpecException& e)
{
std::cerr << "Error defining options: " << e.what() << '\n';
}
return {};
}
std::string replaceEscapeSequences(const std::string& original)
{
std::string result;
result.reserve(original.size());
for (auto iChar = original.begin(); iChar != original.end(); ++iChar)
{
if (*iChar == '\\' && std::next(iChar) != original.end())
{
switch (*std::next(iChar))
{
case 'f': result.push_back('\f'); ++iChar; break;
case 'n': result.push_back('\n'); ++iChar; break;
case 'r': result.push_back('\r'); ++iChar; break;
case 't': result.push_back('\t'); ++iChar; break;
case 'v': result.push_back('\v'); ++iChar; break;
case '\\': result.push_back('\\'); ++iChar; break;
default:
result.push_back(*iChar);
break;
}
}
else
{
result.push_back(*iChar);
}
}
return result;
}
std::string readInput(const cxxopts::ParseResult& args)
{
if (args.count("input_file"))
{
const auto& inputFilename = args["input_file"].as<std::string>();
std::ifstream file(inputFilename, std::ios::ate);
if (!file.is_open())
{
return {};
}
const auto fileSize = file.tellg();
file.seekg(0);
std::string inputText;
inputText.resize(fileSize);
file.read(&inputText[0], fileSize);
return inputText;
}
else
{
return replaceEscapeSequences(args["message"].as<std::string>());
}
}
std::string determineTitle(const cxxopts::ParseResult& args)
{
if (args.count("title"))
{
return args["title"].as<std::string>();
}
else if (args.count("input_file"))
{
return args["input_file"].as<std::string>();
}
else if (args.count("error_display"))
{
return "Error!!";
}
else
{
return "Info";
}
}
int run(SDL_Window* pWindow, const cxxopts::ParseResult& args)
{
const auto inputText = readInput(args);
const auto windowTitle = determineTitle(args);
const auto showYesNoButtons = args.count("yes_button");
auto& io = ImGui::GetIO();
if (SDL_GameControllerAddMappingsFromFile("/storage/.config/SDL-GameControllerDB/gamecontrollerdb.txt") < 0)
{
printf("gamecontrollerdb.txt not found!\n");
}
auto exitCode = 0;
auto running = true;
while (running)
{
SDL_Event event;
while (SDL_PollEvent(&event))
{
ImGui_ImplSDL2_ProcessEvent(&event);
if (
event.type == SDL_QUIT ||
(event.type == SDL_CONTROLLERBUTTONDOWN &&
event.cbutton.button == SDL_CONTROLLER_BUTTON_START) ||
(event.type == SDL_WINDOWEVENT &&
event.window.event == SDL_WINDOWEVENT_CLOSE &&
event.window.windowID == SDL_GetWindowID(pWindow))
) {
running = false;
}
}
// Start the Dear ImGui frame
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplSDL2_NewFrame(pWindow);
ImGui::NewFrame();
// Draw the UI
const auto& windowSize = io.DisplaySize;
ImGui::SetNextWindowSize(windowSize);
ImGui::SetNextWindowPos(ImVec2(0, 0));
ImGui::Begin(
windowTitle.c_str(),
&running,
ImGuiWindowFlags_NoCollapse |
ImGuiWindowFlags_NoResize |
ImGuiWindowFlags_NoSavedSettings);
const auto buttonSpaceRequired =
ImGui::CalcTextSize("Close", nullptr, true).y +
ImGui::GetStyle().FramePadding.y * 2.0f;
const auto maxTextHeight = ImGui::GetContentRegionAvail().y -
ImGui::GetStyle().ItemSpacing.y -
buttonSpaceRequired;
if (ImGui::IsWindowAppearing() && !showYesNoButtons)
{
ImGui::SetNextWindowFocus();
}
ImGui::BeginChild("#scroll_area", {0, maxTextHeight}, true);
ImGui::TextUnformatted(inputText.c_str());
ImGui::EndChild();
// Draw buttons
if (showYesNoButtons) {
const auto buttonWidth = windowSize.x / 3.0f;
ImGui::SetCursorPosX(
(windowSize.x - (buttonWidth * 2 + ImGui::GetStyle().ItemSpacing.x))
/ 2.0f);
if (ImGui::Button("Yes", {buttonWidth, 0.0f}))
{
// return 21 if selected yes, this is for checking return code in bash scripts
exitCode = 21;
running = false;
}
ImGui::SameLine();
if (ImGui::Button("No", {buttonWidth, 0.0f}))
{
running = false;
}
// Auto-focus the yes button
if (ImGui::IsWindowAppearing())
{
ImGui::SetFocusID(ImGui::GetID("Yes"), ImGui::GetCurrentWindow());
ImGui::GetCurrentContext()->NavDisableHighlight = false;
ImGui::GetCurrentContext()->NavDisableMouseHover = true;
}
} else {
const auto buttonWidth = windowSize.x / 3.0f;
ImGui::SetCursorPosX((windowSize.x - buttonWidth) / 2.0f);
if (ImGui::Button("Close", {buttonWidth, 0.0f}))
{
running = false;
}
}
ImGui::End();
// Rendering
ImGui::Render();
glViewport(0, 0, (int)io.DisplaySize.x, (int)io.DisplaySize.y);
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
SDL_GL_SwapWindow(pWindow);
}
return exitCode;
}
}
int main(int argc, char** argv)
{
const auto oArgs = parseArgs(argc, argv);
if (!oArgs)
{
return -2;
}
const auto& args = *oArgs;
// Setup SDL
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0)
{
std::cerr << "Error: " << SDL_GetError() << '\n';
return -1;
}
// Setup window and OpenGL
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
SDL_DisplayMode displayMode;
SDL_GetDesktopDisplayMode(0, &displayMode);
auto pWindow = SDL_CreateWindow(
"Log Viewer",
SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED,
displayMode.w,
displayMode.h,
SDL_WINDOW_OPENGL | SDL_WINDOW_FULLSCREEN | SDL_WINDOW_ALLOW_HIGHDPI);
auto pGlContext = SDL_GL_CreateContext(pWindow);
SDL_GL_MakeCurrent(pWindow, pGlContext);
SDL_GL_SetSwapInterval(1); // Enable vsync
// Setup Dear ImGui context
IMGUI_CHECKVERSION();
ImGui::CreateContext();
auto& io = ImGui::GetIO();
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad;
// Setup Dear ImGui style
ImGui::StyleColorsDark();
if (args.count("error_display")) {
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(ImColor(94, 11, 22, 255))); // Set window background to red
ImGui::PushStyleColor(ImGuiCol_TitleBgActive, ImVec4(ImColor(94, 11, 22, 255)));
}
if (args.count("font_size"))
{
ImFontConfig config;
config.SizePixels = args["font_size"].as<int>();
ImGui::GetIO().Fonts->AddFontDefault(&config);
}
// Setup Platform/Renderer bindings
ImGui_ImplSDL2_InitForOpenGL(pWindow, pGlContext);
ImGui_ImplOpenGL3_Init(nullptr);
// Main loop
const auto exitCode = run(pWindow, args);
// Cleanup
ImGui_ImplOpenGL3_Shutdown();
ImGui_ImplSDL2_Shutdown();
ImGui::DestroyContext();
SDL_GL_DeleteContext(pGlContext);
SDL_DestroyWindow(pWindow);
SDL_Quit();
return exitCode;
}
| 27.393701
| 111
| 0.641947
|
shantigilbert
|
7ac515e2ac5aa9af9f6bc14e4777dcb36b32ae92
| 1,575
|
cpp
|
C++
|
krender/gles3/gles3_static_index_buffer.cpp
|
lulimin/KongFrame-0.1.0
|
2721a433fe089539621f53c71e26b21a8a293b63
|
[
"MIT"
] | null | null | null |
krender/gles3/gles3_static_index_buffer.cpp
|
lulimin/KongFrame-0.1.0
|
2721a433fe089539621f53c71e26b21a8a293b63
|
[
"MIT"
] | null | null | null |
krender/gles3/gles3_static_index_buffer.cpp
|
lulimin/KongFrame-0.1.0
|
2721a433fe089539621f53c71e26b21a8a293b63
|
[
"MIT"
] | null | null | null |
// gles3_static_index_buffer.cpp
// Created by lulimin on 2020/10/20.
#include "gles3_static_index_buffer.h"
#include "../render_service.h"
#include "../../inc/frame_mem.h"
// GLES3StaticIndexBuffer
GLES3StaticIndexBuffer* GLES3StaticIndexBuffer::CreateInstance(
RenderService* pRS)
{
GLES3StaticIndexBuffer* p = (GLES3StaticIndexBuffer*)K_ALLOC(sizeof(
GLES3StaticIndexBuffer));
new (p) GLES3StaticIndexBuffer(pRS);
return p;
}
void GLES3StaticIndexBuffer::DeleteInstance(GLES3StaticIndexBuffer* pInstance)
{
K_DELETE(pInstance);
}
GLES3StaticIndexBuffer::GLES3StaticIndexBuffer(RenderService* pRS)
{
Assert(pRS != NULL);
m_pRenderService = pRS;
m_nIndex = 0;
m_nSize = 0;
m_nBuffer = 0;
}
GLES3StaticIndexBuffer::~GLES3StaticIndexBuffer()
{
this->DeleteResource();
}
void GLES3StaticIndexBuffer::Release()
{
m_pRenderService->ReleaseResource(this);
}
bool GLES3StaticIndexBuffer::CreateResource(size_t index, const void* data,
unsigned int size)
{
Assert(data != NULL);
Assert(size > 0);
m_nIndex = index;
glGenBuffers(1, &m_nBuffer);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_nBuffer);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, size, data, GL_STATIC_DRAW);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
// GLenum err = glGetError();
//
// if (err != GL_NO_ERROR)
// {
// return false;
// }
m_nSize = size;
return true;
}
bool GLES3StaticIndexBuffer::DeleteResource()
{
if (m_nBuffer != 0)
{
glDeleteBuffers(1, &m_nBuffer);
m_nBuffer = 0;
}
return true;
}
| 19.936709
| 79
| 0.709841
|
lulimin
|
7ac709aa596aaae6aee4dc5fda5343c712678580
| 20,408
|
cc
|
C++
|
src/sge_vk_compute_target.cc
|
sungiant/sge
|
89692d4376cb4374e0936b5373878e59dc9a68bb
|
[
"MIT"
] | 6
|
2020-09-04T10:19:29.000Z
|
2021-05-07T05:21:37.000Z
|
src/sge_vk_compute_target.cc
|
sungiant/sge
|
89692d4376cb4374e0936b5373878e59dc9a68bb
|
[
"MIT"
] | null | null | null |
src/sge_vk_compute_target.cc
|
sungiant/sge
|
89692d4376cb4374e0936b5373878e59dc9a68bb
|
[
"MIT"
] | null | null | null |
#include "sge_vk_compute_target.hh"
#include "sge_vk_presentation.hh"
#include "sge_utils.hh"
namespace sge::vk {
compute_target::compute_target (const struct vk::context& z_context, const struct vk::queue_identifier& z_qid, const struct sge::app::content& z_content, const size_fn& z_size_fn)
: context (z_context)
, identifier (z_qid)
, content (z_content)
, get_size_fn (z_size_fn)
{
}
void compute_target::end_of_frame () {
const int num_blobs = content.blobs.size ();
if (sge::utils::contains_value (state.pending_blob_changes)) {
destroy_rl ();
for (int i = 0; i < num_blobs; ++i) {
if (state.pending_blob_changes[i].has_value ()) {
dataspan& data = state.pending_blob_changes[i].value ();
destroy_blob_buffer (i);
prepare_blob_buffer (i, data);
}
}
create_rl ();
}
state.pending_blob_changes.clear ();
state.pending_blob_changes.resize (num_blobs);
}
void compute_target::create () {
auto semaphore_info = utils::init_VkSemaphoreCreateInfo ();
vk_assert (vkCreateSemaphore (context.logical_device, &semaphore_info, context.allocation_callbacks, &state.compute_complete));
auto fenceCreateInfo = utils::init_VkFenceCreateInfo (VK_FENCE_CREATE_SIGNALED_BIT);
vk_assert (vkCreateFence (context.logical_device, &fenceCreateInfo, context.allocation_callbacks, &state.fence));
create_r ();
}
void compute_target::create_r () {
state.current_size = get_size_fn ();
assert (state.current_size.width > 0 && state.current_size.height > 0);
prepare_texture_target (VK_FORMAT_R8G8B8A8_UNORM, state.current_size);
prepare_uniform_buffers ();
prepare_blob_buffers ();
create_rl ();
}
void compute_target::create_rl () {
create_descriptor_set_layout ();
create_descriptor_set ();
create_compute_pipeline ();
create_command_buffer ();
record_command_buffer (state.current_size);
}
void compute_target::destroy_rl () {
destroy_command_buffer ();
destroy_compute_pipeline ();
vkDestroyDescriptorPool (context.logical_device, state.descriptor_pool, context.allocation_callbacks);
state.descriptor_pool = VK_NULL_HANDLE;
vkDestroyDescriptorSetLayout (context.logical_device, state.descriptor_set_layout, context.allocation_callbacks);
state.descriptor_set_layout = VK_NULL_HANDLE;
}
void compute_target::destroy_r () {
destroy_rl ();
destroy_blob_buffers ();
destroy_uniform_buffers ();
destroy_texture_target ();
}
void compute_target::destroy () {
destroy_r ();
state.compute_tex.destroy ();
vkDestroySemaphore (context.logical_device, state.compute_complete, context.allocation_callbacks);
state.compute_complete = VK_NULL_HANDLE;
vkDestroyFence (context.logical_device, state.fence, context.allocation_callbacks);
state.fence = VK_NULL_HANDLE;
}
void compute_target::enqueue () {
auto submitInfo = utils::init_VkSubmitInfo ();
submitInfo.commandBufferCount = 1;
submitInfo.pCommandBuffers = &state.command_buffer;
VkSemaphore signalSemaphores[] = { state.compute_complete };
submitInfo.signalSemaphoreCount = 1;
submitInfo.pSignalSemaphores = signalSemaphores;
vkWaitForFences (context.logical_device, 1, &state.fence, VK_TRUE, UINT64_MAX);
vkResetFences (context.logical_device, 1, &state.fence);
vk_assert (vkQueueSubmit (context.get_queue (identifier), 1, &submitInfo, state.fence));
}
void compute_target::update (bool& push_flag, std::vector<bool>& ubo_flags, std::vector<std::optional<dataspan>>& sbo_flags) {
if (push_flag) {
record_command_buffer (state.current_size);
push_flag = false;
}
for (int i = 0; i < content.uniforms.size (); ++i) {
if (ubo_flags[i]) {
update_uniform_buffer (i);
ubo_flags[i] = false;
}
}
for (int i = 0; i < content.blobs.size (); ++i) {
if (sbo_flags[i].has_value ()) {
dataspan& ds = sbo_flags[i].value ();
if (ds == state.latest_blob_infos[i]) {
update_blob_buffer (i, ds);
}
else {
state.pending_blob_changes[i] = ds;
}
sbo_flags[i].reset ();
}
}
}
void compute_target::prepare_uniform_buffers () {
state.uniform_buffers.resize (content.uniforms.size ());
for (int i = 0; i < content.uniforms.size (); ++i) {
auto& u = content.uniforms[i];
context.create_buffer (
VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT,
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
&state.uniform_buffers[i],
u.size);
update_uniform_buffer (i);
}
}
void compute_target::update_uniform_buffer (int ubo_idx) {
auto& u = content.uniforms[ubo_idx];
state.uniform_buffers[ubo_idx].map ();
assert (state.uniform_buffers[ubo_idx].size == u.size);
memcpy (state.uniform_buffers[ubo_idx].mapped, u.address, u.size);
state.uniform_buffers[ubo_idx].unmap ();
}
void compute_target::destroy_uniform_buffers () {
for (int i = 0; i < content.uniforms.size (); ++i) {
state.uniform_buffers[i].destroy (context.allocation_callbacks);
}
state.uniform_buffers.clear ();
}
void compute_target::copy_blob_from_staging_to_storage (int blob_idx) {
assert (state.blob_staging_buffers[blob_idx].size == state.blob_storage_buffers[blob_idx].size);
VkCommandBuffer copy_command = context.create_command_buffer (VK_COMMAND_BUFFER_LEVEL_PRIMARY, identifier, true);
VkBufferCopy copy_region = {};
copy_region.size = state.blob_staging_buffers[blob_idx].size;
vkCmdCopyBuffer (
copy_command,
state.blob_staging_buffers[blob_idx].buffer,
state.blob_storage_buffers[blob_idx].buffer,
1, ©_region);
context.flush_command_buffer (copy_command, identifier, true);
}
void compute_target::prepare_blob_buffers () {
const int num_storage_buffers = content.blobs.size ();
state.blob_staging_buffers.resize (num_storage_buffers);
state.blob_storage_buffers.resize (num_storage_buffers);
state.latest_blob_infos.resize (num_storage_buffers);
state.pending_blob_changes.resize (num_storage_buffers);
for (int i = 0; i < num_storage_buffers; ++i) {
auto& blob = content.blobs[i];
prepare_blob_buffer (i, blob);
}
}
void compute_target::prepare_blob_buffer (int blob_idx, dataspan data) {
state.latest_blob_infos[blob_idx].address = data.address;
state.latest_blob_infos[blob_idx].size = data.size;
// copy user data into a staging buffer
context.create_buffer (
VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
&state.blob_staging_buffers[blob_idx],
data.size,
data.address);
// create an empty buffer on the gpu of the same size
context.create_buffer (
VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT,
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
&state.blob_storage_buffers[blob_idx],
data.size);
// copy the data from staging to gpu storage
copy_blob_from_staging_to_storage (blob_idx);
}
void compute_target::update_blob_buffer (int blob_idx, dataspan data) {
state.blob_staging_buffers[blob_idx].map ();
state.blob_staging_buffers[blob_idx].copy (data.address, data.size);
state.blob_staging_buffers[blob_idx].unmap ();
copy_blob_from_staging_to_storage (blob_idx);
}
void compute_target::destroy_blob_buffer (int blob_idx) {
state.blob_storage_buffers[blob_idx].destroy (context.allocation_callbacks);
state.blob_staging_buffers[blob_idx].destroy (context.allocation_callbacks);
}
void compute_target::destroy_blob_buffers () {
for (int i = 0; i < state.blob_staging_buffers.size (); ++i) {
destroy_blob_buffer (i);
}
state.blob_storage_buffers.clear ();
state.blob_staging_buffers.clear ();
}
void compute_target::prepare_texture_target (VkFormat format, const VkExtent2D sz) {
VkFormatProperties formatProperties;
vkGetPhysicalDeviceFormatProperties (context.physical_device, format, &formatProperties);
assert (formatProperties.optimalTilingFeatures & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT);
state.compute_tex.width = sz.width;
state.compute_tex.height = sz.height;
auto imageCreateInfo = utils::init_VkImageCreateInfo ();
imageCreateInfo.imageType = VK_IMAGE_TYPE_2D;
imageCreateInfo.format = format;
imageCreateInfo.extent = { sz.width, sz.height, 1 };
imageCreateInfo.mipLevels = 1;
imageCreateInfo.arrayLayers = 1;
imageCreateInfo.samples = VK_SAMPLE_COUNT_1_BIT;
imageCreateInfo.tiling = VK_IMAGE_TILING_OPTIMAL;
imageCreateInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
imageCreateInfo.usage = VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT;
imageCreateInfo.flags = 0;
auto memAllocInfo = utils::init_VkMemoryAllocateInfo ();
VkMemoryRequirements memReqs;
vk_assert (vkCreateImage (context.logical_device, &imageCreateInfo, context.allocation_callbacks, &state.compute_tex.image));
vkGetImageMemoryRequirements (context.logical_device, state.compute_tex.image, &memReqs);
memAllocInfo.allocationSize = memReqs.size;
memAllocInfo.memoryTypeIndex = utils::choose_memory_type (context.physical_device, memReqs, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
vk_assert (vkAllocateMemory (context.logical_device, &memAllocInfo, context.allocation_callbacks, &state.compute_tex.device_memory));
vk_assert (vkBindImageMemory (context.logical_device, state.compute_tex.image, state.compute_tex.device_memory, 0));
VkCommandBuffer layoutCmd = context.create_command_buffer (VK_COMMAND_BUFFER_LEVEL_PRIMARY, identifier, true);
state.compute_tex.image_layout = VK_IMAGE_LAYOUT_GENERAL;
utils::set_image_layout (
layoutCmd,
state.compute_tex.image,
VK_IMAGE_ASPECT_COLOR_BIT,
VK_IMAGE_LAYOUT_UNDEFINED,
state.compute_tex.image_layout);
VkQueue queue = context.get_queue (identifier);
context.flush_command_buffer (layoutCmd, identifier, true);
auto sampler = utils::init_VkSamplerCreateInfo ();
sampler.magFilter = VK_FILTER_LINEAR;
sampler.minFilter = VK_FILTER_LINEAR;
sampler.mipmapMode = VK_SAMPLER_MIPMAP_MODE_LINEAR;
sampler.addressModeU = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER;
sampler.addressModeV = sampler.addressModeU;
sampler.addressModeW = sampler.addressModeU;
sampler.mipLodBias = 0.0f;
sampler.maxAnisotropy = 1.0f;
sampler.compareOp = VK_COMPARE_OP_NEVER;
sampler.minLod = 0.0f;
sampler.maxLod = 0.0f;
sampler.borderColor = VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE;
vk_assert (vkCreateSampler (context.logical_device, &sampler, context.allocation_callbacks, &state.compute_tex.sampler));
VkImageViewCreateInfo view = utils::init_VkImageViewCreateInfo ();
view.viewType = VK_IMAGE_VIEW_TYPE_2D;
view.format = format;
view.components = { VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G, VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_A };
view.subresourceRange = { VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1 };
view.image = state.compute_tex.image;
vk_assert (vkCreateImageView (context.logical_device, &view, context.allocation_callbacks, &state.compute_tex.view));
state.compute_tex.descriptor.imageLayout = state.compute_tex.image_layout;
state.compute_tex.descriptor.imageView = state.compute_tex.view;
state.compute_tex.descriptor.sampler = state.compute_tex.sampler;
state.compute_tex.context = &context;
}
void compute_target::destroy_texture_target () {
state.compute_tex.destroy ();
}
void compute_target::create_descriptor_set_layout () {
std::vector<VkDescriptorSetLayoutBinding> descriptor_set_layout_bindings = {
utils::init_VkDescriptorSetLayoutBinding (
VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
VK_SHADER_STAGE_COMPUTE_BIT,
0)
};
int idx = 1;
for (int i = 0; i < state.uniform_buffers.size (); ++i) {
descriptor_set_layout_bindings.emplace_back (
utils::init_VkDescriptorSetLayoutBinding (
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
VK_SHADER_STAGE_COMPUTE_BIT,
idx++));
}
for (int i = 0; i < state.blob_storage_buffers.size (); ++i) {
descriptor_set_layout_bindings.emplace_back (
utils::init_VkDescriptorSetLayoutBinding (
VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
VK_SHADER_STAGE_COMPUTE_BIT,
idx++));
}
auto descriptor_set_layout_create_info = utils::init_VkDescriptorSetLayoutCreateInfo (descriptor_set_layout_bindings);
vk_assert (vkCreateDescriptorSetLayout (
context.logical_device,
&descriptor_set_layout_create_info,
context.allocation_callbacks,
&state.descriptor_set_layout));
}
void compute_target::create_descriptor_set () {
std::vector<VkDescriptorPoolSize> pool_sizes = { utils::init_VkDescriptorPoolSize (VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1), };
if (content.uniforms.size ()) {
pool_sizes.emplace_back (utils::init_VkDescriptorPoolSize (VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, (uint32_t) content.uniforms.size ()));
}
if (content.blobs.size ()) {
pool_sizes.emplace_back (utils::init_VkDescriptorPoolSize (VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, (uint32_t)content.blobs.size ()));
}
auto descriptor_pool_create_info = utils::init_VkDescriptorPoolCreateInfo (pool_sizes, (uint32_t) content.uniforms.size () + 1, VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT);
vk_assert (vkCreateDescriptorPool (context.logical_device, &descriptor_pool_create_info, context.allocation_callbacks, &state.descriptor_pool));
auto descriptor_set_allocate_info = utils::init_VkDescriptorSetAllocateInfo (state.descriptor_pool, &state.descriptor_set_layout, 1);
vk_assert (vkAllocateDescriptorSets (context.logical_device, &descriptor_set_allocate_info, &state.descriptor_set));
auto write_descriptor_set = utils::init_VkWriteDescriptorSet (state.descriptor_set, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 0, &state.compute_tex.descriptor, 1);
vkUpdateDescriptorSets (context.logical_device, 1, &write_descriptor_set, 0, nullptr);
std::vector<VkWriteDescriptorSet> write_descriptor_sets = {
utils::init_VkWriteDescriptorSet (
state.descriptor_set,
VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
0,
&state.compute_tex.descriptor, 1)
};
int idx = 1;
for (int i = 0; i < state.uniform_buffers.size (); ++i) {
write_descriptor_sets.emplace_back (
utils::init_VkWriteDescriptorSet (
state.descriptor_set,
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
idx++,
&state.uniform_buffers[i].descriptor, 1));
};
for (int i = 0; i < state.blob_storage_buffers.size (); ++i) {
write_descriptor_sets.emplace_back (
utils::init_VkWriteDescriptorSet (
state.descriptor_set,
VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
idx++,
&state.blob_storage_buffers[i].descriptor, 1));
};
vkUpdateDescriptorSets (context.logical_device, (uint32_t) write_descriptor_sets.size (), write_descriptor_sets.data (), 0, nullptr);
}
void compute_target::create_compute_pipeline () {
std::vector<uint8_t> output;
sge::utils::get_file_stream (output, content.shader_path.c_str ());
state.compute_shader_module = utils::create_shader_module (context.logical_device, context.allocation_callbacks, output);
auto shader_stage_create_info = utils::init_VkPipelineShaderStageCreateInfo (VK_SHADER_STAGE_COMPUTE_BIT, state.compute_shader_module, "main");
auto pipeline_layout_create_info = utils::init_VkPipelineLayoutCreateInfo (1, &state.descriptor_set_layout);
if (content.push_constants.has_value ()) {
//https://stackoverflow.com/questions/50956414/what-is-a-push-constant-in-vulkan
assert (content.push_constants.value ().size <= 128);
VkPushConstantRange pushConstantRange =
utils::init_VkPushConstantRange (
VK_SHADER_STAGE_COMPUTE_BIT,
(uint32_t) content.push_constants.value ().size);
pipeline_layout_create_info.pushConstantRangeCount = 1;
pipeline_layout_create_info.pPushConstantRanges = &pushConstantRange;
}
vk_assert (vkCreatePipelineLayout (context.logical_device, &pipeline_layout_create_info, context.allocation_callbacks, &state.pipeline_layout));
auto pipeline_create_info = utils::init_VkComputePipelineCreateInfo (state.pipeline_layout);
pipeline_create_info.stage = shader_stage_create_info;
vk_assert (vkCreateComputePipelines (
context.logical_device,
VK_NULL_HANDLE,
1,
&pipeline_create_info,
context.allocation_callbacks,
&state.pipeline));
}
void compute_target::destroy_compute_pipeline () {
vkDestroyPipeline (context.logical_device, state.pipeline, context.allocation_callbacks);
state.pipeline = VK_NULL_HANDLE;
vkDestroyPipelineLayout (context.logical_device, state.pipeline_layout, context.allocation_callbacks);
state.pipeline_layout = VK_NULL_HANDLE;
vkDestroyShaderModule (context.logical_device, state.compute_shader_module, context.allocation_callbacks);
state.compute_shader_module = VK_NULL_HANDLE;
}
void compute_target::create_command_buffer () {
auto command_pool_create_info = utils::init_VkCommandPoolCreateInfo (identifier.family_index, VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT);
vk_assert (vkCreateCommandPool (context.logical_device, &command_pool_create_info, context.allocation_callbacks, &state.command_pool));
auto command_buffer_allocate_info = utils::init_VkCommandBufferAllocateInfo (state.command_pool, VK_COMMAND_BUFFER_LEVEL_PRIMARY, 1);
vk_assert (vkAllocateCommandBuffers (context.logical_device, &command_buffer_allocate_info, &state.command_buffer));
}
void compute_target::destroy_command_buffer () {
state.command_buffer = VK_NULL_HANDLE;
vkDestroyCommandPool (context.logical_device, state.command_pool, context.allocation_callbacks);
state.command_pool = VK_NULL_HANDLE;
}
void compute_target::record_command_buffer (const VkExtent2D sz) {
auto begin_info = utils::init_VkCommandBufferBeginInfo ();
vk_assert (vkBeginCommandBuffer (state.command_buffer, &begin_info));
if (content.push_constants.has_value ()) {
vkCmdPushConstants (
state.command_buffer,
state.pipeline_layout,
VK_SHADER_STAGE_COMPUTE_BIT,
0,
(uint32_t) content.push_constants.value ().size,
content.push_constants.value ().address);
}
vkCmdBindPipeline (state.command_buffer, VK_PIPELINE_BIND_POINT_COMPUTE, state.pipeline);
vkCmdBindDescriptorSets (
state.command_buffer,
VK_PIPELINE_BIND_POINT_COMPUTE,
state.pipeline_layout,
0,
1,
&state.descriptor_set,
0,
NULL);
const uint32_t workgroup_size_x = 16;
const uint32_t workgroup_size_y = 16;
const uint32_t workgroup_size_z = 1;
vkCmdDispatch (
state.command_buffer,
(uint32_t) ceil (sz.width / float (workgroup_size_x)),
(uint32_t) ceil (sz.height / float (workgroup_size_y)),
workgroup_size_z);
vk_assert (vkEndCommandBuffer (state.command_buffer));
}
void compute_target::run_command_buffer () {
auto submit_info = utils::init_VkSubmitInfo ();
submit_info.commandBufferCount = 1;
submit_info.pCommandBuffers = &state.command_buffer;
VkFence fence;
auto fence_create_info = utils::init_VkFenceCreateInfo ();
vk_assert (vkCreateFence (context.logical_device, &fence_create_info, context.allocation_callbacks, &fence));
vk_assert (vkQueueSubmit (context.get_queue (identifier), 1, &submit_info, fence));
vk_assert (vkWaitForFences (context.logical_device, 1, &fence, VK_TRUE, 100000000000));
vkDestroyFence (context.logical_device, fence, context.allocation_callbacks);
}
}
| 40.015686
| 183
| 0.726039
|
sungiant
|
7ac8d6535acf4f8ad0ae4a6ab71ef41f8e4e28e8
| 5,019
|
cpp
|
C++
|
Source/TurretSystem/Turret.cpp
|
kacmazemin/TurretSystem
|
dcb90e8eac84d6cbe8108cee3880e4c77e0ac4d4
|
[
"MIT"
] | 1
|
2021-05-07T09:01:55.000Z
|
2021-05-07T09:01:55.000Z
|
Source/TurretSystem/Turret.cpp
|
kacmazemin/TurretSystem
|
dcb90e8eac84d6cbe8108cee3880e4c77e0ac4d4
|
[
"MIT"
] | null | null | null |
Source/TurretSystem/Turret.cpp
|
kacmazemin/TurretSystem
|
dcb90e8eac84d6cbe8108cee3880e4c77e0ac4d4
|
[
"MIT"
] | null | null | null |
// Fill out your copyright notice in the Description page of Project Settings.
#include "Turret.h"
#include "DrawDebugHelpers.h"
#include "TurretProjectile.h"
#include "TurretSystemFunctionLibrary.h"
#include "Components/ArrowComponent.h"
#include "Components/AudioComponent.h"
#include "Components/SphereComponent.h"
#include "Kismet/GameplayStatics.h"
#include "Kismet/KismetMathLibrary.h"
#include "Kismet/KismetSystemLibrary.h"
#include "Sound/SoundCue.h"
// Sets default values
ATurret::ATurret()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
TurretSM = CreateDefaultSubobject<UStaticMeshComponent>("TurretStaticMesh");
SetRootComponent(RootComponent);
TurretSM->SetCollisionEnabled(ECollisionEnabled::NoCollision);
SphereComponent = CreateDefaultSubobject<USphereComponent>("BoxCollision");
SphereComponent->SetupAttachment(TurretSM);
RotationAC = CreateDefaultSubobject<UAudioComponent>("RotationAudioComponent");
RotationAC->SetupAttachment(TurretSM);
RotationAC->bAlwaysPlay = true;
FireAC = CreateDefaultSubobject<UAudioComponent>("FireAudioComponent");
FireAC->SetupAttachment(TurretSM);
FireAC->bAlwaysPlay = true;
ArrowComponent = CreateDefaultSubobject<UArrowComponent>("ArrowComponent");
ArrowComponent->SetupAttachment(TurretSM);
ArrowComponent->SetRelativeLocation({60.f,0.f,130.f});
ActorsToIgnore.Reserve(3);
ActorsToIgnore.Add(this);
}
// Called when the game starts or when spawned
void ATurret::BeginPlay()
{
Super::BeginPlay();
TraceObjectTypes.Add(UEngineTypes::ConvertToObjectType(ECollisionChannel::ECC_Pawn));
if(RotationSoundCue)
{
RotationAC->SetSound(RotationSoundCue);
}
if(FireSoundEffect)
{
FireAC->SetSound(FireSoundEffect);
}
ActorsToIgnore.Add(ProjectileActor.GetDefaultObject());
}
void ATurret::FindTarget()
{
if(EnableSphere)
{
DrawDebugSphere(GetWorld(), GetActorLocation(), SenseRange, 8, FColor::Blue, false, -1.0f, SDPG_World);
}
TArray<AActor*> OverlappingActors;
const bool IsOverlapped = UKismetSystemLibrary::SphereOverlapActors(GetWorld(), GetActorLocation(),
SenseRange, TraceObjectTypes, nullptr,
ActorIgnoreSphereOverlap, OverlappingActors);
float BestDistance = SenseRange;
AActor* ClosestTarget = nullptr;
if(IsOverlapped)
{
for (AActor*& HitResult : OverlappingActors)
{
ActorsToIgnore[2] = HitResult;
if(!ClosestTarget || GetDistanceTo(HitResult) < BestDistance)
{
if(UTurretSystemFunctionLibrary::HasLineOfSight(this, SightHitResult, GetActorLocation(), HitResult->GetActorLocation(), ActorsToIgnore))
{
ClosestTarget = HitResult;
BestDistance = GetDistanceTo(ClosestTarget);
}
}
}
BestTarget = ClosestTarget;
}
else
{
BestTarget = nullptr;
}
}
// Called every frame
void ATurret::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
if(BestTarget)
{
RotateToTarget();
FireProjectile();
}
else
{
if(GetWorld()->GetTimerManager().IsTimerActive(FireTimerHandle))
{
GetWorld()->GetTimerManager().ClearTimer(FireTimerHandle);
}
IdleRotate(DeltaTime);
}
}
void ATurret::RotateToTarget()
{
if(BestTarget && TurretSM)
{
const FRotator DesiredRotation = UKismetMathLibrary::FindLookAtRotation(TurretSM->GetRelativeLocation(),BestTarget->GetActorLocation());
TurretSM->SetRelativeRotation({TurretSM->GetRelativeRotation().Pitch, DesiredRotation.Yaw, TurretSM->GetRelativeRotation().Roll});
}
}
void ATurret::PlayRotateSound()
{
if(RotationSoundCue)
{
RotationAC->Stop();
RotationAC->Play();
}
}
void ATurret::PlayFireSound()
{
if(FireAC)
{
FireAC->Stop();
FireAC->Play();
}
}
void ATurret::IdleRotate(const float DeltaSecond)
{
if(!bIsRotating)
{
RandValue = FMath::FRandRange(-180.f,180.f);
PlayRotateSound();
bIsRotating = true;
}
if(bIsRotating && !bIsInDelayTime)
{
RotateValue = FMath::FInterpTo(TurretSM->GetRelativeRotation().Yaw, RandValue, DeltaSecond, InterpolationSpeed);
TurretSM->SetRelativeRotation({TurretSM->GetRelativeRotation().Pitch, RotateValue, TurretSM->GetRelativeRotation().Roll});
}
if(FMath::IsNearlyEqual(RandValue, TurretSM->GetRelativeRotation().Yaw, 1.f) && !bIsInDelayTime)
{
bIsInDelayTime = true;
if(bIsInDelayTime)
{
GetWorld()->GetTimerManager().SetTimer(TimerHandle,[&]()
{
GetWorld()->GetTimerManager().ClearTimer(TimerHandle);
bIsInDelayTime = false;
bIsRotating = false;
},1.f,false,FMath::RandRange(1.1f, 1.6f));
}
}
}
void ATurret::FireProjectile()
{
if(!GetWorld()->GetTimerManager().IsTimerActive(FireTimerHandle))
{
GetWorld()->GetTimerManager().SetTimer(FireTimerHandle,[=]()
{
ATurretProjectile* TurretProjectile = GetWorld()->SpawnActor<ATurretProjectile>(ProjectileActor.Get(),
ArrowComponent->GetComponentLocation(), {0,TurretSM->GetRelativeRotation().Yaw, 0});
PlayFireSound();
},1.f, false, FireRate);
}
}
| 24.970149
| 141
| 0.737796
|
kacmazemin
|
7ac9c0f5206c6a11a1415df465c201f7b288850d
| 2,644
|
cpp
|
C++
|
Source/Engine/Engine/Transform.cpp
|
Syoukei66/Animal-Space-Battle
|
edb17e2f75fd5b43697889597e1eaac2e9e9cd76
|
[
"MIT"
] | null | null | null |
Source/Engine/Engine/Transform.cpp
|
Syoukei66/Animal-Space-Battle
|
edb17e2f75fd5b43697889597e1eaac2e9e9cd76
|
[
"MIT"
] | null | null | null |
Source/Engine/Engine/Transform.cpp
|
Syoukei66/Animal-Space-Battle
|
edb17e2f75fd5b43697889597e1eaac2e9e9cd76
|
[
"MIT"
] | null | null | null |
#include "Transform.h"
#include "GameObject.h"
// =================================================================
// Constructor / Destructor
// =================================================================
Transform::Transform(GameObject* entity)
: entity_(entity)
, translate_matrix_(INativeMatrix::Create())
, scale_matrix_(INativeMatrix::Create())
, rotation_matrix_(INativeMatrix::Create())
, matrix_(INativeMatrix::Create())
, world_matrix_(INativeMatrix::Create())
{
}
Transform::~Transform()
{
delete this->translate_matrix_;
delete this->scale_matrix_;
delete this->rotation_matrix_;
delete this->matrix_;
delete this->world_matrix_;
}
// =================================================================
// Method
// =================================================================
void Transform::Init()
{
this->OnInit();
this->OnTransformChanged();
this->OnScaleChanged();
this->OnRotationChanged();
this->OnWorldTransformDirty();
}
void Transform::OnTransformChanged()
{
this->entity_->FireOnPositionChanged(this->entity_);
this->translation_dirty_ = true;
}
void Transform::OnScaleChanged()
{
this->entity_->FireOnScaleChanged(this->entity_);
this->scale_dirty_ = true;
}
void Transform::OnRotationChanged()
{
this->entity_->FireOnRotationChanged(this->entity_);
this->rotation_dirty_ = true;
}
void Transform::OnWorldTransformDirty()
{
this->world_transform_dirty_ = true;
}
void Transform::UpdateMatrix()
{
bool matrix_dirty = false;
if (this->translation_dirty_)
{
this->translate_matrix_->Init();
this->UpdateTranslateMatrix(this->translate_matrix_);
this->translation_dirty_ = false;
matrix_dirty = true;
}
if (this->scale_dirty_)
{
this->scale_matrix_->Init();
this->UpdateScaleMatrix(this->scale_matrix_);
this->scale_dirty_ = false;
matrix_dirty = true;
}
if (this->rotation_dirty_)
{
this->rotation_matrix_->Init();
this->UpdateRotateMatrix(this->rotation_matrix_);
this->rotation_dirty_ = false;
matrix_dirty = true;
}
if (matrix_dirty)
{
this->matrix_->Init();
this->matrix_->Multiple(*this->scale_matrix_);
this->matrix_->Multiple(*this->rotation_matrix_);
this->matrix_->Multiple(*this->translate_matrix_);
}
}
void Transform::UpdateWorldMatrix()
{
if (!this->world_transform_dirty_)
{
return;
}
this->world_matrix_->Assign(this->GetMatrix());
const INativeMatrix* parent_world_matrix = this->GetParentWorldMatrix();
if (parent_world_matrix)
{
this->world_matrix_->Multiple(*parent_world_matrix);
}
this->world_transform_dirty_ = false;
}
| 24.481481
| 74
| 0.639183
|
Syoukei66
|
7aca79722a06efa9c4f2ce78404ee6cc1ada06e4
| 3,710
|
cpp
|
C++
|
Source/10.0.18362.0/ucrt/lowio/dup2.cpp
|
825126369/UCRT
|
8853304fdc2a5c216658d08b6dbbe716aa2a7b1f
|
[
"MIT"
] | 2
|
2021-01-27T10:19:30.000Z
|
2021-02-09T06:24:30.000Z
|
Source/10.0.18362.0/ucrt/lowio/dup2.cpp
|
825126369/UCRT
|
8853304fdc2a5c216658d08b6dbbe716aa2a7b1f
|
[
"MIT"
] | null | null | null |
Source/10.0.18362.0/ucrt/lowio/dup2.cpp
|
825126369/UCRT
|
8853304fdc2a5c216658d08b6dbbe716aa2a7b1f
|
[
"MIT"
] | 1
|
2021-01-27T10:19:36.000Z
|
2021-01-27T10:19:36.000Z
|
//
// dup2.cpp
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// Defines _dup2() and _dup2_nolock, which duplicate lowio file handles
//
#include <corecrt_internal_lowio.h>
static int __cdecl dup2_nolock(int const source_fh, int const target_fh) throw()
{
if ((_osfile(source_fh) & FOPEN) == 0)
{
// If the source handle is not open, return an error. Noe that the
// DuplicateHandle API will not detect this error, because it implies
// that _osfhnd(source_fh) == INVALID_HANDLE_VALUE, and this is a
// legal HANDLE value to be duplicated.
errno = EBADF;
_doserrno = 0;
_ASSERTE(("Invalid file descriptor. File possibly closed by a different thread",0));
return -1;
}
// If the target is open, close it first. We ignore the possibility of an
// error here: an error simply means that the OS handle value may remain
// bound for the duration of the process.
if (_osfile(target_fh) & FOPEN)
{
_close_nolock(target_fh);
}
// Duplicate the source file onto the target file:
intptr_t new_osfhandle;
BOOL const result = DuplicateHandle(
GetCurrentProcess(),
reinterpret_cast<HANDLE>(_get_osfhandle(source_fh)),
GetCurrentProcess(),
&reinterpret_cast<HANDLE&>(new_osfhandle),
0,
TRUE,
DUPLICATE_SAME_ACCESS);
if (!result)
{
__acrt_errno_map_os_error(GetLastError());
return -1;
}
__acrt_lowio_set_os_handle(target_fh, new_osfhandle);
// Copy the _osfile information, with the FNOINHERIT bit cleared:
_osfile(target_fh) = _osfile(source_fh) & ~FNOINHERIT;
_textmode(target_fh) = _textmode(source_fh);
_tm_unicode(target_fh) = _tm_unicode(source_fh);
return 0;
}
// _dup2() makes the target file handle a duplicate of the source file handle,
// so that both handles refer to the same file. If the target handle is open
// upon entry, it is closed so that it is not leaked.
//
// Returns 0 if successful; returns -1 and sets errno on failure.
extern "C" int __cdecl _dup2(int const source_fh, int const target_fh)
{
_CHECK_FH_CLEAR_OSSERR_RETURN( source_fh, EBADF, -1 );
_VALIDATE_CLEAR_OSSERR_RETURN((source_fh >= 0 && (unsigned)source_fh < (unsigned)_nhandle), EBADF, -1);
_VALIDATE_CLEAR_OSSERR_RETURN((_osfile(source_fh) & FOPEN), EBADF, -1);
_CHECK_FH_CLEAR_OSSERR_RETURN( target_fh, EBADF, -1 );
_VALIDATE_CLEAR_OSSERR_RETURN(((unsigned)target_fh < _NHANDLE_), EBADF, -1);
// Make sure there is an __crt_lowio_handle_data struct corresponding to the target_fh:
if (target_fh >= _nhandle && __acrt_lowio_ensure_fh_exists(target_fh) != 0)
return -1;
// If the source and target are the same, return success (we've already
// verified that the file handle is open, above). This is for conformance
// with the POSIX specification for dup2.
if (source_fh == target_fh)
return 0;
// Obtain the two file handle locks. In order to prevent deadlock, we
// always obtain the lock for the lower-numbered file handle first:
if (source_fh < target_fh)
{
__acrt_lowio_lock_fh(source_fh);
__acrt_lowio_lock_fh(target_fh);
}
else if (source_fh > target_fh)
{
__acrt_lowio_lock_fh(target_fh);
__acrt_lowio_lock_fh(source_fh);
}
int result = 0;
__try
{
result = dup2_nolock(source_fh, target_fh);
}
__finally
{
// The order in which we unlock the file handles does not matter:
__acrt_lowio_unlock_fh(source_fh);
__acrt_lowio_unlock_fh(target_fh);
}
return result;
}
| 32.54386
| 107
| 0.674663
|
825126369
|
7acae6357a9ec2c4c4d66c30e9f3c8b3cc415a58
| 973
|
cpp
|
C++
|
vulnerability_examples/vulnerable_contracts/swc-101/case_study/SSA_Encoding_during.cpp
|
kunjsong01/data_set
|
dffdc54da103adca217b8c3c20a5097b0fe2fc1e
|
[
"Apache-2.0"
] | null | null | null |
vulnerability_examples/vulnerable_contracts/swc-101/case_study/SSA_Encoding_during.cpp
|
kunjsong01/data_set
|
dffdc54da103adca217b8c3c20a5097b0fe2fc1e
|
[
"Apache-2.0"
] | null | null | null |
vulnerability_examples/vulnerable_contracts/swc-101/case_study/SSA_Encoding_during.cpp
|
kunjsong01/data_set
|
dffdc54da103adca217b8c3c20a5097b0fe2fc1e
|
[
"Apache-2.0"
] | null | null | null |
Generated 1 VCC(s), 1 remaining after simplification (5 assignments)
Encoding remaining VCC(s) using bit-vector/floating-point arithmetic
Thread 0
ASSIGNMENT (HIDDEN)
func_case_study::$tmp::return_value$_nondet$1?1!0&0#1 == i?1!0&0#0
Thread 0 file MyContract_case_study.sol line 1 function func_case_study
ASSIGNMENT ()
y?1!0&0#1 == func_case_study::$tmp::return_value$_nondet$1?1!0&0#1
Thread 0 file MyContract_case_study.sol line 1 function func_case_study
ASSIGNMENT (HIDDEN)
goto_symex::guard?0!0&0#1 == (signed int)y?1!0&0#1 > 253
Thread 0 file MyContract_case_study.sol line 1 function func_case_study
ASSIGNMENT (HIDDEN)
sum?1!0&0#3 == (goto_symex::guard?0!0&0#1 ? 7 : 254)
Thread 0 file MyContract_case_study.sol line 1 function func_case_study
ASSERT
execution_statet::\guard_exec?0!0 => (signed int)sum?1!0&0#3 > 100
assertion
Encoding to solver time: 0.001s
Solving with solver Z3 v4.8.10
Encoding to solver time: 0.001s
Runtime decision procedure: 0.002s
| 33.551724
| 71
| 0.775951
|
kunjsong01
|
7ad02eb4d96400072f661c3868362f36475687ac
| 87,697
|
cpp
|
C++
|
sources/src/antlr4parser/ELDOLexer.cpp
|
sydelity-net/EDACurry
|
20cbf9835827e42efeb0b3686bf6b3e9d72417e9
|
[
"MIT"
] | null | null | null |
sources/src/antlr4parser/ELDOLexer.cpp
|
sydelity-net/EDACurry
|
20cbf9835827e42efeb0b3686bf6b3e9d72417e9
|
[
"MIT"
] | null | null | null |
sources/src/antlr4parser/ELDOLexer.cpp
|
sydelity-net/EDACurry
|
20cbf9835827e42efeb0b3686bf6b3e9d72417e9
|
[
"MIT"
] | null | null | null |
// Generated from g4files/ELDOLexer.g4 by ANTLR 4.7.1
#include "ELDOLexer.h"
using namespace antlr4;
using namespace edacurry;
ELDOLexer::ELDOLexer(CharStream *input) : Lexer(input) {
_interpreter = new atn::LexerATNSimulator(this, _atn, _decisionToDFA, _sharedContextCache);
}
ELDOLexer::~ELDOLexer() {
delete _interpreter;
}
std::string ELDOLexer::getGrammarFileName() const {
return "ELDOLexer.g4";
}
const std::vector<std::string>& ELDOLexer::getRuleNames() const {
return _ruleNames;
}
const std::vector<std::string>& ELDOLexer::getChannelNames() const {
return _channelNames;
}
const std::vector<std::string>& ELDOLexer::getModeNames() const {
return _modeNames;
}
const std::vector<std::string>& ELDOLexer::getTokenNames() const {
return _tokenNames;
}
dfa::Vocabulary& ELDOLexer::getVocabulary() const {
return _vocabulary;
}
const std::vector<uint16_t> ELDOLexer::getSerializedATN() const {
return _serializedATN;
}
const atn::ATN& ELDOLexer::getATN() const {
return _atn;
}
bool ELDOLexer::sempred(RuleContext *context, size_t ruleIndex, size_t predicateIndex) {
switch (ruleIndex) {
case 0: return BOLSempred(dynamic_cast<antlr4::RuleContext *>(context), predicateIndex);
default:
break;
}
return true;
}
bool ELDOLexer::BOLSempred(antlr4::RuleContext *_localctx, size_t predicateIndex) {
switch (predicateIndex) {
case 0: return getCharPositionInLine() == 0;
default:
break;
}
return true;
}
// Static vars and initialization.
std::vector<dfa::DFA> ELDOLexer::_decisionToDFA;
atn::PredictionContextCache ELDOLexer::_sharedContextCache;
// We own the ATN which in turn owns the ATN states.
atn::ATN ELDOLexer::_atn;
std::vector<uint16_t> ELDOLexer::_serializedATN;
std::vector<std::string> ELDOLexer::_ruleNames = {
u8"BOL", u8"DOT_BOL", u8"COMMENT", u8"INCLUDE", u8"DSPF_INCLUDE", u8"LIB",
u8"LIB_END", u8"SUBCKT", u8"SUBCKT_END", u8"NETLIST_END", u8"GLOBAL",
u8"MODEL_DEF", u8"VERILOG", u8"GLOBAL_PARAM", u8"ALTER", u8"SAVE", u8"OPTION",
u8"OPT", u8"NODESET", u8"CALL_TCL", u8"CHRENT", u8"CONNECT", u8"DEFMAC",
u8"DEFWAVE", u8"FFILE", u8"IC", u8"MEAS", u8"PLOT", u8"PRINT", u8"PROBE",
u8"TEMP_SET", u8"USE_TCL", u8"PARAM", u8"TEMP", u8"KEY", u8"NONOISE",
u8"TABLE", u8"PWL", u8"EXP", u8"SIN", u8"SFFM", u8"PULSE", u8"INTERP",
u8"MOD", u8"MODEL", u8"WHEN", u8"START", u8"START_OF_RUN", u8"END_OF_RUN",
u8"END", u8"FIND", u8"PP", u8"TRIG", u8"TARG", u8"AT", u8"DERIVATIVE",
u8"VECT", u8"CATVECT", u8"PARAM_LIST_START", u8"PIN_LIST_START", u8"NET_LIST_START",
u8"PORT_LIST_START", u8"COUPLING_LIST_START", u8"GENERIC_LIST_START",
u8"AC", u8"AGE", u8"CHECKSOA", u8"DC", u8"DCHIZ", u8"DCMISMATCH", u8"DEX",
u8"DSP", u8"DSPMOD", u8"FOUR", u8"LSTB", u8"MC", u8"NOISE", u8"NOISETRAN",
u8"OP", u8"OPTFOUR", u8"OPTIMIZE", u8"OPTNOISE", u8"PZ", u8"RAMP", u8"SENS",
u8"SENSAC", u8"SENSPARAM", u8"SNF", u8"SOLVE", u8"TF", u8"TRAN", u8"WCASE",
u8"EXTRACT", u8"RESISTOR", u8"CAPACITOR", u8"INDUCTOR", u8"COUPLED_INDUCTOR",
u8"DIFFUSION_RESISTOR", u8"TRANSMISSION_LINE", u8"LOSSY_TRANSMISSION_LINE",
u8"LTL_W_MODEL", u8"LTL_U_MODEL", u8"JUNCTION_DIODE", u8"BJT", u8"JFET",
u8"MOSFET", u8"S_DOMAIN_FILTER", u8"Z_DOMAIN_FILTER", u8"SUBCK_INSTANCE",
u8"IVSOURCE", u8"ICSOURCE", u8"VCVS", u8"CCCS", u8"VCCS", u8"CCVS", u8"OPA",
u8"SW", u8"NOISE_FUNCTION", u8"DIG_NAND", u8"DIG_AND", u8"DIG_NOR", u8"DIG_OR",
u8"DIG_XOR", u8"EQUAL", u8"EXCLAMATION_MARK", u8"LESS_THAN", u8"GREATER_THAN",
u8"LESS_THAN_EQUAL", u8"GREATER_THAN_EQUAL", u8"LOGIC_EQUAL", u8"LOGIC_NOT_EQUAL",
u8"LOGIC_AND", u8"LOGIC_OR", u8"LOGIC_BITWISE_AND", u8"LOGIC_BITWISE_OR",
u8"LOGIC_XOR", u8"BITWISE_SHIFT_LEFT", u8"BITWISE_SHIFT_RIGHT", u8"POWER_OPERATOR",
u8"AND", u8"OR", u8"COLON", u8"SEMICOLON", u8"PLUS", u8"MINUS", u8"STAR",
u8"OPEN_ROUND", u8"CLOSE_ROUND", u8"OPEN_SQUARE", u8"CLOSE_SQUARE", u8"OPEN_CURLY",
u8"CLOSE_CURLY", u8"QUESTION_MARK", u8"COMMA", u8"DOLLAR", u8"AMPERSAND",
u8"DOT", u8"UNDERSCORE", u8"AT_SIGN", u8"POUND_SIGN", u8"BACKSLASH", u8"SLASH",
u8"APEX", u8"QUOTES", u8"PIPE", u8"PERCENT", u8"CARET", u8"TILDE", u8"ARROW",
u8"DIGIT", u8"HEXDIGIT", u8"OCTALDIGIT", u8"EXPONENTIAL", u8"INT", u8"FLOAT",
u8"HEX", u8"PERCENTAGE", u8"COMPLEX", u8"NUMBER", u8"LETTER", u8"ESCAPE",
u8"ID", u8"STRING", u8"NL", u8"WS", u8"CNL"
};
std::vector<std::string> ELDOLexer::_channelNames = {
"DEFAULT_TOKEN_CHANNEL", "HIDDEN", u8"COMMENTS"
};
std::vector<std::string> ELDOLexer::_modeNames = {
u8"DEFAULT_MODE"
};
std::vector<std::string> ELDOLexer::_literalNames = {
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", u8"'='", u8"'!'",
u8"'<'", u8"'>'", "", "", "", "", "", "", "", "", "", "", "", "", u8"'and'",
u8"'or'", u8"':'", u8"';'", u8"'+'", u8"'-'", u8"'*'", u8"'('", u8"')'",
u8"'['", u8"']'", u8"'{'", u8"'}'", u8"'?'", u8"','", u8"'$'", u8"'&'",
u8"'.'", u8"'_'", u8"'@'", u8"'#'", u8"'\\'", u8"'/'", u8"'''", u8"'\"'",
u8"'|'", u8"'%'", u8"'^'", u8"'~'"
};
std::vector<std::string> ELDOLexer::_symbolicNames = {
"", u8"COMMENT", u8"INCLUDE", u8"DSPF_INCLUDE", u8"LIB", u8"LIB_END",
u8"SUBCKT", u8"SUBCKT_END", u8"NETLIST_END", u8"GLOBAL", u8"MODEL_DEF",
u8"VERILOG", u8"GLOBAL_PARAM", u8"ALTER", u8"SAVE", u8"OPTION", u8"OPT",
u8"NODESET", u8"CALL_TCL", u8"CHRENT", u8"CONNECT", u8"DEFMAC", u8"DEFWAVE",
u8"FFILE", u8"IC", u8"MEAS", u8"PLOT", u8"PRINT", u8"PROBE", u8"TEMP_SET",
u8"USE_TCL", u8"PARAM", u8"TEMP", u8"KEY", u8"NONOISE", u8"TABLE", u8"PWL",
u8"EXP", u8"SIN", u8"SFFM", u8"PULSE", u8"INTERP", u8"MOD", u8"MODEL",
u8"WHEN", u8"START", u8"START_OF_RUN", u8"END_OF_RUN", u8"END", u8"FIND",
u8"PP", u8"TRIG", u8"TARG", u8"AT", u8"DERIVATIVE", u8"VECT", u8"CATVECT",
u8"PARAM_LIST_START", u8"PIN_LIST_START", u8"NET_LIST_START", u8"PORT_LIST_START",
u8"COUPLING_LIST_START", u8"GENERIC_LIST_START", u8"AC", u8"AGE", u8"CHECKSOA",
u8"DC", u8"DCHIZ", u8"DCMISMATCH", u8"DEX", u8"DSP", u8"DSPMOD", u8"FOUR",
u8"LSTB", u8"MC", u8"NOISE", u8"NOISETRAN", u8"OP", u8"OPTFOUR", u8"OPTIMIZE",
u8"OPTNOISE", u8"PZ", u8"RAMP", u8"SENS", u8"SENSAC", u8"SENSPARAM", u8"SNF",
u8"SOLVE", u8"TF", u8"TRAN", u8"WCASE", u8"EXTRACT", u8"RESISTOR", u8"CAPACITOR",
u8"INDUCTOR", u8"COUPLED_INDUCTOR", u8"DIFFUSION_RESISTOR", u8"TRANSMISSION_LINE",
u8"LOSSY_TRANSMISSION_LINE", u8"LTL_W_MODEL", u8"LTL_U_MODEL", u8"JUNCTION_DIODE",
u8"BJT", u8"JFET", u8"MOSFET", u8"S_DOMAIN_FILTER", u8"Z_DOMAIN_FILTER",
u8"SUBCK_INSTANCE", u8"IVSOURCE", u8"ICSOURCE", u8"VCVS", u8"CCCS", u8"VCCS",
u8"CCVS", u8"OPA", u8"SW", u8"NOISE_FUNCTION", u8"DIG_NAND", u8"DIG_AND",
u8"DIG_NOR", u8"DIG_OR", u8"DIG_XOR", u8"EQUAL", u8"EXCLAMATION_MARK",
u8"LESS_THAN", u8"GREATER_THAN", u8"LESS_THAN_EQUAL", u8"GREATER_THAN_EQUAL",
u8"LOGIC_EQUAL", u8"LOGIC_NOT_EQUAL", u8"LOGIC_AND", u8"LOGIC_OR", u8"LOGIC_BITWISE_AND",
u8"LOGIC_BITWISE_OR", u8"LOGIC_XOR", u8"BITWISE_SHIFT_LEFT", u8"BITWISE_SHIFT_RIGHT",
u8"POWER_OPERATOR", u8"AND", u8"OR", u8"COLON", u8"SEMICOLON", u8"PLUS",
u8"MINUS", u8"STAR", u8"OPEN_ROUND", u8"CLOSE_ROUND", u8"OPEN_SQUARE",
u8"CLOSE_SQUARE", u8"OPEN_CURLY", u8"CLOSE_CURLY", u8"QUESTION_MARK",
u8"COMMA", u8"DOLLAR", u8"AMPERSAND", u8"DOT", u8"UNDERSCORE", u8"AT_SIGN",
u8"POUND_SIGN", u8"BACKSLASH", u8"SLASH", u8"APEX", u8"QUOTES", u8"PIPE",
u8"PERCENT", u8"CARET", u8"TILDE", u8"ARROW", u8"PERCENTAGE", u8"COMPLEX",
u8"NUMBER", u8"ID", u8"STRING", u8"NL", u8"WS", u8"CNL"
};
dfa::Vocabulary ELDOLexer::_vocabulary(_literalNames, _symbolicNames);
std::vector<std::string> ELDOLexer::_tokenNames;
ELDOLexer::Initializer::Initializer() {
// This code could be in a static initializer lambda, but VS doesn't allow access to private class members from there.
for (size_t i = 0; i < _symbolicNames.size(); ++i) {
std::string name = _vocabulary.getLiteralName(i);
if (name.empty()) {
name = _vocabulary.getSymbolicName(i);
}
if (name.empty()) {
_tokenNames.push_back("<INVALID>");
} else {
_tokenNames.push_back(name);
}
}
_serializedATN = {
0x3, 0x608b, 0xa72a, 0x8133, 0xb9ed, 0x417c, 0x3be7, 0x7786, 0x5964,
0x2, 0xb1, 0x5dc, 0x8, 0x1, 0x4, 0x2, 0x9, 0x2, 0x4, 0x3, 0x9, 0x3,
0x4, 0x4, 0x9, 0x4, 0x4, 0x5, 0x9, 0x5, 0x4, 0x6, 0x9, 0x6, 0x4, 0x7,
0x9, 0x7, 0x4, 0x8, 0x9, 0x8, 0x4, 0x9, 0x9, 0x9, 0x4, 0xa, 0x9, 0xa,
0x4, 0xb, 0x9, 0xb, 0x4, 0xc, 0x9, 0xc, 0x4, 0xd, 0x9, 0xd, 0x4, 0xe,
0x9, 0xe, 0x4, 0xf, 0x9, 0xf, 0x4, 0x10, 0x9, 0x10, 0x4, 0x11, 0x9,
0x11, 0x4, 0x12, 0x9, 0x12, 0x4, 0x13, 0x9, 0x13, 0x4, 0x14, 0x9, 0x14,
0x4, 0x15, 0x9, 0x15, 0x4, 0x16, 0x9, 0x16, 0x4, 0x17, 0x9, 0x17, 0x4,
0x18, 0x9, 0x18, 0x4, 0x19, 0x9, 0x19, 0x4, 0x1a, 0x9, 0x1a, 0x4, 0x1b,
0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0x56, 0xaf, 0x57, 0xb1, 0x58,
0xb3, 0x59, 0xb5, 0x5a, 0xb7, 0x5b, 0xb9, 0x5c, 0xbb, 0x5d, 0xbd, 0x5e,
0xbf, 0x5f, 0xc1, 0x60, 0xc3, 0x61, 0xc5, 0x62, 0xc7, 0x63, 0xc9, 0x64,
0xcb, 0x65, 0xcd, 0x66, 0xcf, 0x67, 0xd1, 0x68, 0xd3, 0x69, 0xd5, 0x6a,
0xd7, 0x6b, 0xd9, 0x6c, 0xdb, 0x6d, 0xdd, 0x6e, 0xdf, 0x6f, 0xe1, 0x70,
0xe3, 0x71, 0xe5, 0x72, 0xe7, 0x73, 0xe9, 0x74, 0xeb, 0x75, 0xed, 0x76,
0xef, 0x77, 0xf1, 0x78, 0xf3, 0x79, 0xf5, 0x7a, 0xf7, 0x7b, 0xf9, 0x7c,
0xfb, 0x7d, 0xfd, 0x7e, 0xff, 0x7f, 0x101, 0x80, 0x103, 0x81, 0x105,
0x82, 0x107, 0x83, 0x109, 0x84, 0x10b, 0x85, 0x10d, 0x86, 0x10f, 0x87,
0x111, 0x88, 0x113, 0x89, 0x115, 0x8a, 0x117, 0x8b, 0x119, 0x8c, 0x11b,
0x8d, 0x11d, 0x8e, 0x11f, 0x8f, 0x121, 0x90, 0x123, 0x91, 0x125, 0x92,
0x127, 0x93, 0x129, 0x94, 0x12b, 0x95, 0x12d, 0x96, 0x12f, 0x97, 0x131,
0x98, 0x133, 0x99, 0x135, 0x9a, 0x137, 0x9b, 0x139, 0x9c, 0x13b, 0x9d,
0x13d, 0x9e, 0x13f, 0x9f, 0x141, 0xa0, 0x143, 0xa1, 0x145, 0xa2, 0x147,
0xa3, 0x149, 0xa4, 0x14b, 0xa5, 0x14d, 0xa6, 0x14f, 0xa7, 0x151, 0xa8,
0x153, 0xa9, 0x155, 0x2, 0x157, 0x2, 0x159, 0x2, 0x15b, 0x2, 0x15d,
0x2, 0x15f, 0x2, 0x161, 0x2, 0x163, 0xaa, 0x165, 0xab, 0x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0x9, 0x9, 0x2, 0x2, 0x207, 0x22, 0x3, 0x2, 0x2, 0x2, 0x208, 0x209,
0x5, 0x5, 0x3, 0x2, 0x209, 0x20a, 0x9, 0x11, 0x2, 0x2, 0x20a, 0x20b,
0x9, 0xb, 0x2, 0x2, 0x20b, 0x20c, 0x9, 0xf, 0x2, 0x2, 0x20c, 0x20d,
0x9, 0x3, 0x2, 0x2, 0x20d, 0x20e, 0x9, 0x11, 0x2, 0x2, 0x20e, 0x20f,
0x9, 0x4, 0x2, 0x2, 0x20f, 0x24, 0x3, 0x2, 0x2, 0x2, 0x210, 0x211, 0x5,
0x5, 0x3, 0x2, 0x211, 0x212, 0x9, 0x11, 0x2, 0x2, 0x212, 0x213, 0x9,
0xb, 0x2, 0x2, 0x213, 0x214, 0x9, 0xf, 0x2, 0x2, 0x214, 0x26, 0x3, 0x2,
0x2, 0x2, 0x215, 0x216, 0x5, 0x5, 0x3, 0x2, 0x216, 0x217, 0x9, 0x4,
0x2, 0x2, 0x217, 0x218, 0x9, 0x11, 0x2, 0x2, 0x218, 0x219, 0x9, 0x8,
0x2, 0x2, 0x219, 0x21a, 0x9, 0x9, 0x2, 0x2, 0x21a, 0x21b, 0x9, 0xa,
0x2, 0x2, 0x21b, 0x21c, 0x9, 0x9, 0x2, 0x2, 0x21c, 0x21d, 0x9, 0xf,
0x2, 0x2, 0x21d, 0x28, 0x3, 0x2, 0x2, 0x2, 0x21e, 0x21f, 0x5, 0x5, 0x3,
0x2, 0x21f, 0x220, 0x9, 0x5, 0x2, 0x2, 0x220, 0x221, 0x9, 0x12, 0x2,
0x2, 0x221, 0x222, 0x9, 0x6, 0x2, 0x2, 0x222, 0x223, 0x9, 0x6, 0x2,
0x2, 0x223, 0x224, 0x7, 0x61, 0x2, 0x2, 0x224, 0x225, 0x9, 0xf, 0x2,
0x2, 0x225, 0x226, 0x9, 0x5, 0x2, 0x2, 0x226, 0x227, 0x9, 0x6, 0x2,
0x2, 0x227, 0x2a, 0x3, 0x2, 0x2, 0x2, 0x228, 0x229, 0x5, 0x5, 0x3, 0x2,
0x229, 0x22a, 0x9, 0x5, 0x2, 0x2, 0x22a, 0x22b, 0x9, 0x16, 0x2, 0x2,
0x22b, 0x22c, 0x9, 0x15, 0x2, 0x2, 0x22c, 0x22d, 0x9, 0x9, 0x2, 0x2,
0x22d, 0x22e, 0x9, 0x4, 0x2, 0x2, 0x22e, 0x22f, 0x9, 0xf, 0x2, 0x2,
0x22f, 0x2c, 0x3, 0x2, 0x2, 0x2, 0x230, 0x231, 0x5, 0x5, 0x3, 0x2, 0x231,
0x232, 0x9, 0x5, 0x2, 0x2, 0x232, 0x233, 0x9, 0x11, 0x2, 0x2, 0x233,
0x234, 0x9, 0x4, 0x2, 0x2, 0x234, 0x235, 0x9, 0x4, 0x2, 0x2, 0x235,
0x236, 0x9, 0x9, 0x2, 0x2, 0x236, 0x237, 0x9, 0x5, 0x2, 0x2, 0x237,
0x238, 0x9, 0xf, 0x2, 0x2, 0x238, 0x2e, 0x3, 0x2, 0x2, 0x2, 0x239, 0x23a,
0x5, 0x5, 0x3, 0x2, 0x23a, 0x23b, 0x9, 0x8, 0x2, 0x2, 0x23b, 0x23c,
0x9, 0x9, 0x2, 0x2, 0x23c, 0x23d, 0x9, 0xc, 0x2, 0x2, 0x23d, 0x23e,
0x9, 0x13, 0x2, 0x2, 0x23e, 0x23f, 0x9, 0x12, 0x2, 0x2, 0x23f, 0x240,
0x9, 0x5, 0x2, 0x2, 0x240, 0x30, 0x3, 0x2, 0x2, 0x2, 0x241, 0x242, 0x5,
0x5, 0x3, 0x2, 0x242, 0x243, 0x9, 0x8, 0x2, 0x2, 0x243, 0x244, 0x9,
0x9, 0x2, 0x2, 0x244, 0x245, 0x9, 0xc, 0x2, 0x2, 0x245, 0x246, 0x9,
0x17, 0x2, 0x2, 0x246, 0x247, 0x9, 0x12, 0x2, 0x2, 0x247, 0x248, 0x9,
0x14, 0x2, 0x2, 0x248, 0x249, 0x9, 0x9, 0x2, 0x2, 0x249, 0x32, 0x3,
0x2, 0x2, 0x2, 0x24a, 0x24b, 0x5, 0x5, 0x3, 0x2, 0x24b, 0x24c, 0x9,
0xc, 0x2, 0x2, 0x24c, 0x24d, 0x9, 0xc, 0x2, 0x2, 0x24d, 0x24e, 0x9,
0x3, 0x2, 0x2, 0x24e, 0x24f, 0x9, 0x6, 0x2, 0x2, 0x24f, 0x250, 0x9,
0x9, 0x2, 0x2, 0x250, 0x34, 0x3, 0x2, 0x2, 0x2, 0x251, 0x252, 0x5, 0x5,
0x3, 0x2, 0x252, 0x253, 0x9, 0x3, 0x2, 0x2, 0x253, 0x254, 0x9, 0x5,
0x2, 0x2, 0x254, 0x36, 0x3, 0x2, 0x2, 0x2, 0x255, 0x256, 0x5, 0x5, 0x3,
0x2, 0x256, 0x257, 0x9, 0x13, 0x2, 0x2, 0x257, 0x258, 0x9, 0x9, 0x2,
0x2, 0x258, 0x259, 0x9, 0x12, 0x2, 0x2, 0x259, 0x25a, 0x9, 0xa, 0x2,
0x2, 0x25a, 0x38, 0x3, 0x2, 0x2, 0x2, 0x25b, 0x25c, 0x5, 0x5, 0x3, 0x2,
0x25c, 0x25d, 0x9, 0xb, 0x2, 0x2, 0x25d, 0x25e, 0x9, 0x6, 0x2, 0x2,
0x25e, 0x25f, 0x9, 0x11, 0x2, 0x2, 0x25f, 0x260, 0x9, 0xf, 0x2, 0x2,
0x260, 0x3a, 0x3, 0x2, 0x2, 0x2, 0x261, 0x262, 0x5, 0x5, 0x3, 0x2, 0x262,
0x263, 0x9, 0xb, 0x2, 0x2, 0x263, 0x264, 0x9, 0x15, 0x2, 0x2, 0x264,
0x265, 0x9, 0x3, 0x2, 0x2, 0x265, 0x266, 0x9, 0x4, 0x2, 0x2, 0x266,
0x267, 0x9, 0xf, 0x2, 0x2, 0x267, 0x3c, 0x3, 0x2, 0x2, 0x2, 0x268, 0x269,
0x5, 0x5, 0x3, 0x2, 0x269, 0x26a, 0x9, 0xb, 0x2, 0x2, 0x26a, 0x26b,
0x9, 0x15, 0x2, 0x2, 0x26b, 0x26c, 0x9, 0x11, 0x2, 0x2, 0x26c, 0x26d,
0x9, 0xd, 0x2, 0x2, 0x26d, 0x26e, 0x9, 0x9, 0x2, 0x2, 0x26e, 0x3e, 0x3,
0x2, 0x2, 0x2, 0x26f, 0x270, 0x5, 0x5, 0x3, 0x2, 0x270, 0x271, 0x9,
0xf, 0x2, 0x2, 0x271, 0x272, 0x9, 0x9, 0x2, 0x2, 0x272, 0x273, 0x9,
0x13, 0x2, 0x2, 0x273, 0x274, 0x9, 0xb, 0x2, 0x2, 0x274, 0x40, 0x3,
0x2, 0x2, 0x2, 0x275, 0x276, 0x5, 0x5, 0x3, 0x2, 0x276, 0x277, 0x9,
0x7, 0x2, 0x2, 0x277, 0x278, 0x9, 0xa, 0x2, 0x2, 0x278, 0x279, 0x9,
0x9, 0x2, 0x2, 0x279, 0x27a, 0x7, 0x61, 0x2, 0x2, 0x27a, 0x27b, 0x9,
0xf, 0x2, 0x2, 0x27b, 0x27c, 0x9, 0x5, 0x2, 0x2, 0x27c, 0x27d, 0x9,
0x6, 0x2, 0x2, 0x27d, 0x42, 0x3, 0x2, 0x2, 0x2, 0x27e, 0x27f, 0x9, 0xb,
0x2, 0x2, 0x27f, 0x280, 0x9, 0x12, 0x2, 0x2, 0x280, 0x281, 0x9, 0x15,
0x2, 0x2, 0x281, 0x282, 0x9, 0x12, 0x2, 0x2, 0x282, 0x283, 0x9, 0x13,
0x2, 0x2, 0x283, 0x44, 0x3, 0x2, 0x2, 0x2, 0x284, 0x285, 0x9, 0xf, 0x2,
0x2, 0x285, 0x286, 0x9, 0x9, 0x2, 0x2, 0x286, 0x287, 0x9, 0x13, 0x2,
0x2, 0x287, 0x288, 0x9, 0xb, 0x2, 0x2, 0x288, 0x46, 0x3, 0x2, 0x2, 0x2,
0x289, 0x28a, 0x9, 0xe, 0x2, 0x2, 0x28a, 0x28b, 0x9, 0x9, 0x2, 0x2,
0x28b, 0x28c, 0x9,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, 0x2, 0x2, 0x308, 0x309, 0x9, 0x9, 0x2, 0x2, 0x309, 0x72,
0x3, 0x2, 0x2, 0x2, 0x30a, 0x30b, 0x9, 0x14, 0x2, 0x2, 0x30b, 0x30c,
0x9, 0x9, 0x2, 0x2, 0x30c, 0x30d, 0x9, 0x5, 0x2, 0x2, 0x30d, 0x30e,
0x9, 0xf, 0x2, 0x2, 0x30e, 0x74, 0x3, 0x2, 0x2, 0x2, 0x30f, 0x310, 0x9,
0x5, 0x2, 0x2, 0x310, 0x311, 0x9, 0x12, 0x2, 0x2, 0x311, 0x312, 0x9,
0xf, 0x2, 0x2, 0x312, 0x313, 0x9, 0x14, 0x2, 0x2, 0x313, 0x314, 0x9,
0x9, 0x2, 0x2, 0x314, 0x315, 0x9, 0x5, 0x2, 0x2, 0x315, 0x316, 0x9,
0xf, 0x2, 0x2, 0x316, 0x76, 0x3, 0x2, 0x2, 0x2, 0x317, 0x318, 0x9, 0xb,
0x2, 0x2, 0x318, 0x319, 0x9, 0x12, 0x2, 0x2, 0x319, 0x31a, 0x9, 0x15,
0x2, 0x2, 0x31a, 0x31b, 0x9, 0x12, 0x2, 0x2, 0x31b, 0x31c, 0x9, 0x13,
0x2, 0x2, 0x31c, 0x31d, 0x7, 0x3c, 0x2, 0x2, 0x31d, 0x78, 0x3, 0x2,
0x2, 0x2, 0x31e, 0x31f, 0x9, 0xb, 0x2, 0x2, 0x31f, 0x320, 0x9, 0x3,
0x2, 0x2, 0x320, 0x321, 0x9, 0x4, 0x2, 0x2, 0x321, 0x322, 0x7, 0x3c,
0x2, 0x2, 0x322, 0x7a, 0x3, 0x2, 0x2, 0x2, 0x323, 0x324, 0x9, 0x4, 0x2,
0x2, 0x324, 0x325, 0x9, 0x9, 0x2, 0x2, 0x325, 0x326, 0x9, 0xf, 0x2,
0x2, 0x326, 0x327, 0x7, 0x3c, 0x2, 0x2, 0x327, 0x7c, 0x3, 0x2, 0x2,
0x2, 0x328, 0x329, 0x9, 0xb, 0x2, 0x2, 0x329, 0x32a, 0x9, 0x11, 0x2,
0x2, 0x32a, 0x32b, 0x9, 0x15, 0x2, 0x2, 0x32b, 0x32c, 0x9, 0xf, 0x2,
0x2, 0x32c, 0x32d, 0x7, 0x3c, 0x2, 0x2, 0x32d, 0x7e, 0x3, 0x2, 0x2,
0x2, 0x32e, 0x32f, 0x9, 0x5, 0x2, 0x2, 0x32f, 0x330, 0x9, 0x11, 0x2,
0x2, 0x330, 0x331, 0x9, 0x7, 0x2, 0x2, 0x331, 0x332, 0x9, 0xb, 0x2,
0x2, 0x332, 0x333, 0x9, 0x6, 0x2, 0x2, 0x333, 0x334, 0x9, 0x3, 0x2,
0x2, 0x334, 0x335, 0x9, 0x4, 0x2, 0x2, 0x335, 0x336, 0x9, 0x10, 0x2,
0x2, 0x336, 0x337, 0x7, 0x3c, 0x2, 0x2, 0x337, 0x80, 0x3, 0x2, 0x2,
0x2, 0x338, 0x339, 0x9, 0x10, 0x2, 0x2, 0x339, 0x33a, 0x9, 0x9, 0x2,
0x2, 0x33a, 0x33b, 0x9, 0x4, 0x2, 0x2, 0x33b, 0x33c, 0x9, 0x9, 0x2,
0x2, 0x33c, 0x33d, 0x9, 0x15, 0x2, 0x2, 0x33d, 0x33e, 0x9, 0x3, 0x2,
0x2, 0x33e, 0x33f, 0x9, 0x5, 0x2, 0x2, 0x33f, 0x340, 0x7, 0x3c, 0x2,
0x2, 0x340, 0x82, 0x3, 0x2, 0x2, 0x2, 0x341, 0x342, 0x5, 0x5, 0x3, 0x2,
0x342, 0x343, 0x9, 0x12, 0x2, 0x2, 0x343, 0x344, 0x9, 0x5, 0x2, 0x2,
0x344, 0x84, 0x3, 0x2, 0x2, 0x2, 0x345, 0x346, 0x5, 0x5, 0x3, 0x2, 0x346,
0x347, 0x9, 0x12, 0x2, 0x2, 0x347, 0x348, 0x9, 0x10, 0x2, 0x2, 0x348,
0x349, 0x9, 0x9, 0x2, 0x2, 0x349, 0x86, 0x3, 0x2, 0x2, 0x2, 0x34a, 0x34b,
0x5, 0x5, 0x3, 0x2, 0x34b, 0x34c, 0x9, 0x5, 0x2, 0x2, 0x34c, 0x34d,
0x9, 0x16, 0x2, 0x2, 0x34d, 0x34e, 0x9, 0x9, 0x2, 0x2, 0x34e, 0x34f,
0x9, 0x5, 0x2, 0x2, 0x34f, 0x350, 0x9, 0xe, 0x2, 0x2, 0x350, 0x351,
0x9, 0xa, 0x2, 0x2, 0x351, 0x352, 0x9, 0x11, 0x2, 0x2, 0x352, 0x353,
0x9, 0x12, 0x2, 0x2, 0x353, 0x88, 0x3, 0x2, 0x2, 0x2, 0x354, 0x355,
0x5, 0x5, 0x3, 0x2, 0x355, 0x356, 0x9, 0x8, 0x2, 0x2, 0x356, 0x357,
0x9, 0x5, 0x2, 0x2, 0x357, 0x8a, 0x3, 0x2, 0x2, 0x2, 0x358, 0x359, 0x5,
0x5, 0x3, 0x2, 0x359, 0x35a, 0x9, 0x8, 0x2, 0x2, 0x35a, 0x35b, 0x9,
0x5, 0x2, 0x2, 0x35b, 0x35c, 0x9, 0x16, 0x2, 0x2, 0x35c, 0x35d, 0x9,
0x3, 0x2, 0x2, 0x35d, 0x35e, 0x9, 0x1a, 0x2, 0x2, 0x35e, 0x8c, 0x3,
0x2, 0x2, 0x2, 0x35f, 0x360, 0x5, 0x5, 0x3, 0x2, 0x360, 0x361, 0x9,
0x8, 0x2, 0x2, 0x361, 0x362, 0x9, 0x5, 0x2, 0x2, 0x362, 0x363, 0x9,
0x13, 0x2, 0x2, 0x363, 0x364, 0x9, 0x3, 0x2, 0x2, 0x364, 0x365, 0x9,
0xa, 0x2, 0x2, 0x365, 0x366, 0x9, 0x13, 0x2, 0x2, 0x366, 0x367, 0x9,
0x12, 0x2, 0x2, 0x367, 0x368, 0x9, 0xf, 0x2, 0x2, 0x368, 0x369, 0x9,
0x5, 0x2, 0x2, 0x369, 0x36a, 0x9, 0x16, 0x2, 0x2, 0x36a, 0x8e, 0x3,
0x2, 0x2, 0x2, 0x36b, 0x36c, 0x5, 0x5, 0x3, 0x2, 0x36c, 0x36d, 0x9,
0x8, 0x2, 0x2, 0x36d, 0x36e, 0x9, 0x9, 0x2, 0x2, 0x36e, 0x36f, 0x9,
0x19, 0x2, 0x2, 0x36f, 0x90, 0x3, 0x2, 0x2, 0x2, 0x370, 0x371, 0x5,
0x5, 0x3, 0x2, 0x371, 0x372, 0x9, 0x8, 0x2, 0x2, 0x372, 0x373, 0x9,
0xa, 0x2, 0x2, 0x373, 0x374, 0x9, 0xb, 0x2, 0x2, 0x374, 0x92, 0x3, 0x2,
0x2, 0x2, 0x375, 0x376, 0x5, 0x5, 0x3, 0x2, 0x376, 0x377, 0x9, 0x8,
0x2, 0x2, 0x377, 0x378, 0x9, 0xa, 0x2, 0x2, 0x378, 0x379, 0x9, 0xb,
0x2, 0x2, 0x379, 0x37a, 0x9, 0x13, 0x2, 0x2, 0x37a, 0x37b, 0x9, 0x11,
0x2, 0x2, 0x37b, 0x37c, 0x9, 0x8, 0x2, 0x2, 0x37c, 0x94, 0x3, 0x2, 0x2,
0x2, 0x37d, 0x37e, 0x5, 0x5, 0x3, 0x2, 0x37e, 0x37f, 0x9, 0xc, 0x2,
0x2, 0x37f, 0x380, 0x9, 0x11, 0x2, 0x2, 0x380, 0x381, 0x9, 0x7, 0x2,
0x2, 0x381, 0x382, 0x9, 0x15, 0x2, 0x2, 0x382, 0x96, 0x3, 0x2, 0x2,
0x2, 0x383, 0x384, 0x5, 0x5, 0x3, 0x2, 0x384, 0x385, 0x9, 0x6, 0x2,
0x2, 0x385, 0x386, 0x9, 0xa, 0x2, 0x2, 0x386, 0x387, 0x9, 0xf, 0x2,
0x2, 0x387, 0x388, 0x9, 0xd, 0x2, 0x2, 0x388, 0x98, 0x3, 0x2, 0x2, 0x2,
0x389, 0x38a, 0x5, 0x5, 0x3, 0x2, 0x38a, 0x38b, 0x9, 0x13, 0x2, 0x2,
0x38b, 0x38c, 0x9, 0x5, 0x2, 0x2, 0x38c, 0x9a, 0x3, 0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 0x2, 0x2, 0x2, 0x409, 0x40a, 0x5,
0x3, 0x2, 0x2, 0x40a, 0x40b, 0x9, 0x15, 0x2, 0x2, 0x40b, 0x40c, 0x5,
0x16d, 0xb7, 0x2, 0x40c, 0xbe, 0x3, 0x2, 0x2, 0x2, 0x40d, 0x40e, 0x5,
0x3, 0x2, 0x2, 0x40e, 0x40f, 0x9, 0x5, 0x2, 0x2, 0x40f, 0x410, 0x5,
0x16d, 0xb7, 0x2, 0x410, 0xc0, 0x3, 0x2, 0x2, 0x2, 0x411, 0x412, 0x5,
0x3, 0x2, 0x2, 0x412, 0x413, 0x9, 0x6, 0x2, 0x2, 0x413, 0x414, 0x5,
0x16d, 0xb7, 0x2, 0x414, 0xc2, 0x3, 0x2, 0x2, 0x2, 0x415, 0x416, 0x5,
0x3, 0x2, 0x2, 0x416, 0x417, 0x9, 0xe, 0x2, 0x2, 0x417, 0x418, 0x5,
0x16d, 0xb7, 0x2, 0x418, 0xc4, 0x3, 0x2, 0x2, 0x2, 0x419, 0x41a, 0x5,
0x3, 0x2, 0x2, 0x41a, 0x41b, 0x9, 0xb, 0x2, 0x2, 0x41b, 0x41c, 0x5,
0x16d, 0xb7, 0x2, 0x41c, 0xc6, 0x3, 0x2, 0x2, 0x2, 0x41d, 0x41e, 0x5,
0x3, 0x2, 0x2, 0x41e, 0x41f, 0x9, 0xf, 0x2, 0x2, 0x41f, 0x420, 0x5,
0x16d, 0xb7, 0x2, 0x420, 0xc8, 0x3, 0x2, 0x2, 0x2, 0x421, 0x422, 0x5,
0x3, 0x2, 0x2, 0x422, 0x423, 0x9, 0x18, 0x2, 0x2, 0x423, 0x424, 0x5,
0x16d, 0xb7, 0x2, 0x424, 0xca, 0x3, 0x2, 0x2, 0x2, 0x425, 0x426, 0x5,
0x3, 0x2, 0x2, 0x426, 0x427, 0x9, 0x17, 0x2, 0x2, 0x427, 0x428, 0x5,
0x16d, 0xb7, 0x2, 0x428, 0xcc, 0x3, 0x2, 0x2, 0x2, 0x429, 0x42a, 0x5,
0x3, 0x2, 0x2, 0x42a, 0x42b, 0x9, 0x7, 0x2, 0x2, 0x42b, 0x42c, 0x5,
0x16d, 0xb7, 0x2, 0x42c, 0xce, 0x3, 0x2, 0x2, 0x2, 0x42d, 0x42e, 0x5,
0x3, 0x2, 0x2, 0x42e, 0x42f, 0x9, 0x8, 0x2, 0x2, 0x42f, 0x430, 0x5,
0x16d, 0xb7, 0x2, 0x430, 0xd0, 0x3, 0x2, 0x2, 0x2, 0x431, 0x432, 0x5,
0x3, 0x2, 0x2, 0x432, 0x433, 0x9, 0x1b, 0x2, 0x2, 0x433, 0x434, 0x5,
0x16d, 0xb7, 0x2, 0x434, 0xd2, 0x3, 0x2, 0x2, 0x2, 0x435, 0x436, 0x5,
0x3, 0x2, 0x2, 0x436, 0x437, 0x9, 0x1c, 0x2, 0x2, 0x437, 0x438, 0x5,
0x16d, 0xb7, 0x2, 0x438, 0xd4, 0x3, 0x2, 0x2, 0x2, 0x439, 0x43a, 0x5,
0x3, 0x2, 0x2, 0x43a, 0x43b, 0x9, 0x13, 0x2, 0x2, 0x43b, 0x43c, 0x5,
0x16d, 0xb7, 0x2, 0x43c, 0xd6, 0x3, 0x2, 0x2, 0x2, 0x43d, 0x43e, 0x5,
0x3, 0x2, 0x2, 0x43e, 0x43f, 0x9, 0xc, 0x2, 0x2, 0x43f, 0x440, 0x9,
0x4, 0x2, 0x2, 0x440, 0x441, 0x9, 0xa, 0x2, 0x2, 0x441, 0x442, 0x5,
0x16d, 0xb7, 0x2, 0x442, 0xd8, 0x3, 0x2, 0x2, 0x2, 0x443, 0x444, 0x5,
0x3, 0x2, 0x2, 0x444, 0x445, 0x9, 0xc, 0x2, 0x2, 0x445, 0x446, 0x9,
0x4, 0x2, 0x2, 0x446, 0x447, 0x9, 0x1a, 0x2, 0x2, 0x447, 0x448, 0x5,
0x16d, 0xb7, 0x2, 0x448, 0xda, 0x3, 0x2, 0x2, 0x2, 0x449, 0x44a, 0x5,
0x3, 0x2, 0x2, 0x44a, 0x44b, 0x9, 0x19, 0x2, 0x2, 0x44b, 0x44c, 0x5,
0x16d, 0xb7, 0x2, 0x44c, 0xdc, 0x3, 0x2, 0x2, 0x2, 0x44d, 0x44e, 0x5,
0x3, 0x2, 0x2, 0x44e, 0x44f, 0x9, 0x14, 0x2, 0x2, 0x44f, 0x450, 0x5,
0x16d, 0xb7, 0x2, 0x450, 0xde, 0x3, 0x2, 0x2, 0x2, 0x451, 0x452, 0x5,
0x3, 0x2, 0x2, 0x452, 0x453, 0x9, 0x3, 0x2, 0x2, 0x453, 0x454, 0x5,
0x16d, 0xb7, 0x2, 0x454, 0xe0, 0x3, 0x2, 0x2, 0x2, 0x455, 0x456, 0x5,
0x3, 0x2, 0x2, 0x456, 0x457, 0x9, 0x9, 0x2, 0x2, 0x457, 0x458, 0x5,
0x16d, 0xb7, 0x2, 0x458, 0xe2, 0x3, 0x2, 0x2, 0x2, 0x459, 0x45a, 0x5,
0x3, 0x2, 0x2, 0x45a, 0x45b, 0x9, 0xc, 0x2, 0x2, 0x45b, 0x45c, 0x5,
0x16d, 0xb7, 0x2, 0x45c, 0xe4, 0x3, 0x2, 0x2, 0x2, 0x45d, 0x45e, 0x5,
0x3, 0x2, 0x2, 0x45e, 0x45f, 0x9, 0x10, 0x2, 0x2, 0x45f, 0x460, 0x5,
0x16d, 0xb7, 0x2, 0x460, 0xe6, 0x3, 0x2, 0x2, 0x2, 0x461, 0x462, 0x5,
0x3, 0x2, 0x2, 0x462, 0x463, 0x9, 0x16, 0x2, 0x2, 0x463, 0x464, 0x5,
0x16d, 0xb7, 0x2, 0x464, 0xe8, 0x3, 0x2, 0x2, 0x2, 0x465, 0x466, 0x5,
0x3, 0x2, 0x2, 0x466, 0x467, 0x9, 0x11, 0x2, 0x2, 0x467, 0x468, 0x9,
0xb, 0x2, 0x2, 0x468, 0x469, 0x9, 0x12, 0x2, 0x2, 0x469, 0x46a, 0x5,
0x16d, 0xb7, 0x2, 0x46a, 0xea, 0x3, 0x2, 0x2, 0x2, 0x46b, 0x46c, 0x5,
0x3, 0x2, 0x2, 0x46c, 0x46d, 0x9, 0xa, 0x2, 0x2, 0x46d, 0x46e, 0x5,
0x16d, 0xb7, 0x2, 0x46e, 0xec, 0x3, 0x2, 0x2, 0x2, 0x46f, 0x470, 0x5,
0x3, 0x2, 0x2, 0x470, 0x471, 0x9, 0x4, 0x2, 0x2, 0x471, 0x472, 0x9,
0x11, 0x2, 0x2, 0x472, 0x473, 0x9, 0x3, 0x2, 0x2, 0x473, 0x474, 0x9,
0xa, 0x2, 0x2, 0x474, 0x475, 0x9, 0x9, 0x2, 0x2, 0x475, 0x476, 0x5,
0x16d, 0xb7, 0x2, 0x476, 0xee, 0x3, 0x2, 0x2, 0x2, 0x477, 0x478, 0x5,
0x3, 0x2, 0x2, 0x478, 0x479, 0x9, 0x4, 0x2, 0x2, 0x479, 0x47a, 0x9,
0x12, 0x2, 0x2, 0x47a, 0x47b, 0x9, 0x4, 0x2, 0x2, 0x47b, 0x47c, 0x9,
0x8, 0x2, 0x2, 0x47c, 0x47d, 0x5, 0x16d, 0xb7, 0x2, 0x47d, 0xf0, 0x3,
0x2, 0x2, 0x2, 0x47e, 0x47f, 0x5, 0x3, 0x2, 0x2, 0x47f, 0x480, 0x9,
0x12, 0x2, 0x2, 0x480, 0x481, 0x9, 0x4, 0x2, 0x2, 0x481, 0x482, 0x9,
0x8, 0x2, 0x2, 0x482, 0x483, 0x5, 0x16d, 0xb7, 0x2, 0x483, 0xf2, 0x3,
0x2, 0x2, 0x2, 0x484, 0x485, 0x5, 0x3, 0x2, 0x2, 0x485, 0x486, 0x9,
0x4, 0x2, 0x2, 0x486, 0x487, 0x9, 0x11, 0x2, 0x2, 0x487, 0x488, 0x9,
0x15, 0x2, 0x2, 0x488, 0x489, 0x5, 0x16d, 0xb7, 0x2, 0x489, 0xf4, 0x3,
0x2, 0x2, 0x2, 0x48a, 0x48b, 0x5, 0x3, 0x2, 0x2, 0x48b, 0x48c,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 0x505,
0x3, 0x2, 0x2, 0x2, 0x507, 0x508, 0x3, 0x2, 0x2, 0x2, 0x508, 0x158,
0x3, 0x2, 0x2, 0x2, 0x509, 0x50b, 0x7, 0x32, 0x2, 0x2, 0x50a, 0x50c,
0x4, 0x32, 0x39, 0x2, 0x50b, 0x50a, 0x3, 0x2, 0x2, 0x2, 0x50c, 0x50d,
0x3, 0x2, 0x2, 0x2, 0x50d, 0x50b, 0x3, 0x2, 0x2, 0x2, 0x50d, 0x50e,
0x3, 0x2, 0x2, 0x2, 0x50e, 0x15a, 0x3, 0x2, 0x2, 0x2, 0x50f, 0x511,
0x9, 0x9, 0x2, 0x2, 0x510, 0x512, 0x9, 0x1f, 0x2, 0x2, 0x511, 0x510,
0x3, 0x2, 0x2, 0x2, 0x511, 0x512, 0x3, 0x2, 0x2, 0x2, 0x512, 0x513,
0x3, 0x2, 0x2, 0x2, 0x513, 0x514, 0x5, 0x15d, 0xaf, 0x2, 0x514, 0x15c,
0x3, 0x2, 0x2, 0x2, 0x515, 0x517, 0x9, 0x1f, 0x2, 0x2, 0x516, 0x515,
0x3, 0x2, 0x2, 0x2, 0x516, 0x517, 0x3, 0x2, 0x2, 0x2, 0x517, 0x519,
0x3, 0x2, 0x2, 0x2, 0x518, 0x51a, 0x5, 0x155, 0xab, 0x2, 0x519, 0x518,
0x3, 0x2, 0x2, 0x2, 0x51a, 0x51b, 0x3, 0x2, 0x2, 0x2, 0x51b, 0x519,
0x3, 0x2, 0x2, 0x2, 0x51b, 0x51c, 0x3, 0x2, 0x2, 0x2, 0x51c, 0x15e,
0x3, 0x2, 0x2, 0x2, 0x51d, 0x51f, 0x9, 0x1f, 0x2, 0x2, 0x51e, 0x51d,
0x3, 0x2, 0x2, 0x2, 0x51e, 0x51f, 0x3, 0x2, 0x2, 0x2, 0x51f, 0x521,
0x3, 0x2, 0x2, 0x2, 0x520, 0x522, 0x5, 0x155, 0xab, 0x2, 0x521, 0x520,
0x3, 0x2, 0x2, 0x2, 0x522, 0x523, 0x3, 0x2, 0x2, 0x2, 0x523, 0x521,
0x3, 0x2, 0x2, 0x2, 0x523, 0x524, 0x3, 0x2, 0x2, 0x2, 0x524, 0x525,
0x3, 0x2, 0x2, 0x2, 0x525, 0x529, 0x7, 0x30, 0x2, 0x2, 0x526, 0x528,
0x5, 0x155, 0xab, 0x2, 0x527, 0x526, 0x3, 0x2, 0x2, 0x2, 0x528, 0x52b,
0x3, 0x2, 0x2, 0x2, 0x529, 0x527, 0x3, 0x2, 0x2, 0x2, 0x529, 0x52a,
0x3, 0x2, 0x2, 0x2, 0x52a, 0x52d, 0x3, 0x2, 0x2, 0x2, 0x52b, 0x529,
0x3, 0x2, 0x2, 0x2, 0x52c, 0x52e, 0x5, 0x15b, 0xae, 0x2, 0x52d, 0x52c,
0x3, 0x2, 0x2, 0x2, 0x52d, 0x52e, 0x3, 0x2, 0x2, 0x2, 0x52e, 0x547,
0x3, 0x2, 0x2, 0x2, 0x52f, 0x531, 0x9, 0x1f, 0x2, 0x2, 0x530, 0x52f,
0x3, 0x2, 0x2, 0x2, 0x530, 0x531, 0x3, 0x2, 0x2, 0x2, 0x531, 0x533,
0x3, 0x2, 0x2, 0x2, 0x532, 0x534, 0x5, 0x155, 0xab, 0x2, 0x533, 0x532,
0x3, 0x2, 0x2, 0x2, 0x534, 0x535, 0x3, 0x2, 0x2, 0x2, 0x535, 0x533,
0x3, 0x2, 0x2, 0x2, 0x535, 0x536, 0x3, 0x2, 0x2, 0x2, 0x536, 0x538,
0x3, 0x2, 0x2, 0x2, 0x537, 0x539, 0x5, 0x15b, 0xae, 0x2, 0x538, 0x537,
0x3, 0x2, 0x2, 0x2, 0x538, 0x539, 0x3, 0x2, 0x2, 0x2, 0x539, 0x547,
0x3, 0x2, 0x2, 0x2, 0x53a, 0x53c, 0x9, 0x1f, 0x2, 0x2, 0x53b, 0x53a,
0x3, 0x2, 0x2, 0x2, 0x53b, 0x53c, 0x3, 0x2, 0x2, 0x2, 0x53c, 0x53d,
0x3, 0x2, 0x2, 0x2, 0x53d, 0x53f, 0x7, 0x30, 0x2, 0x2, 0x53e, 0x540,
0x5, 0x155, 0xab, 0x2, 0x53f, 0x53e, 0x3, 0x2, 0x2, 0x2, 0x540, 0x541,
0x3, 0x2, 0x2, 0x2, 0x541, 0x53f, 0x3, 0x2, 0x2, 0x2, 0x541, 0x542,
0x3, 0x2, 0x2, 0x2, 0x542, 0x544, 0x3, 0x2, 0x2, 0x2, 0x543, 0x545,
0x5, 0x15b, 0xae, 0x2, 0x544, 0x543, 0x3, 0x2, 0x2, 0x2, 0x544, 0x545,
0x3, 0x2, 0x2, 0x2, 0x545, 0x547, 0x3, 0x2, 0x2, 0x2, 0x546, 0x51e,
0x3, 0x2, 0x2, 0x2, 0x546, 0x530, 0x3, 0x2, 0x2, 0x2, 0x546, 0x53b,
0x3, 0x2, 0x2, 0x2, 0x547, 0x160, 0x3, 0x2, 0x2, 0x2, 0x548, 0x549,
0x7, 0x32, 0x2, 0x2, 0x549, 0x54b, 0x9, 0x19, 0x2, 0x2, 0x54a, 0x54c,
0x5, 0x157, 0xac, 0x2, 0x54b, 0x54a, 0x3, 0x2, 0x2, 0x2, 0x54c, 0x54d,
0x3, 0x2, 0x2, 0x2, 0x54d, 0x54b, 0x3, 0x2, 0x2, 0x2, 0x54d, 0x54e,
0x3, 0x2, 0x2, 0x2, 0x54e, 0x162, 0x3, 0x2, 0x2, 0x2, 0x54f, 0x550,
0x5, 0x15f, 0xb0, 0x2, 0x550, 0x551, 0x7, 0x27, 0x2, 0x2, 0x551, 0x164,
0x3, 0x2, 0x2, 0x2, 0x552, 0x553, 0x5, 0x15d, 0xaf, 0x2, 0x553, 0x554,
0x7, 0x6b, 0x2, 0x2, 0x554, 0x559, 0x3, 0x2, 0x2, 0x2, 0x555, 0x556,
0x5, 0x15f, 0xb0, 0x2, 0x556, 0x557, 0x7, 0x6b, 0x2, 0x2, 0x557, 0x559,
0x3, 0x2, 0x2, 0x2, 0x558, 0x552, 0x3, 0x2, 0x2, 0x2, 0x558, 0x555,
0x3, 0x2, 0x2, 0x2, 0x559, 0x166, 0x3, 0x2, 0x2, 0x2, 0x55a, 0x55e,
0x5, 0x15d, 0xaf, 0x2, 0x55b, 0x55e, 0x5, 0x15f, 0xb0, 0x2, 0x55c, 0x55e,
0x5, 0x161, 0xb1, 0x2, 0x55d, 0x55a, 0x3, 0x2, 0x2, 0x2, 0x55d, 0x55b,
0x3, 0x2, 0x2, 0x2, 0x55d, 0x55c, 0x3, 0x2, 0x2, 0x2, 0x55e, 0x560,
0x3, 0x2, 0x2, 0x2, 0x55f, 0x561, 0x5, 0x169, 0xb5, 0x2, 0x560, 0x55f,
0x3, 0x2, 0x2, 0x2, 0x560, 0x561, 0x3, 0x2, 0x2, 0x2, 0x561, 0x563,
0x3, 0x2, 0x2, 0x2, 0x562, 0x564, 0x5, 0x169, 0xb5, 0x2, 0x563, 0x562,
0x3, 0x2, 0x2, 0x2, 0x563, 0x564, 0x3, 0x2, 0x2, 0x2, 0x564, 0x566,
0x3, 0x2, 0x2, 0x2, 0x565, 0x567, 0x5, 0x169, 0xb5, 0x2, 0x566, 0x565,
0x3, 0x2, 0x2, 0x2, 0x566, 0x567, 0x3, 0x2, 0x2, 0x2, 0x567, 0x569,
0x3, 0x2, 0x2, 0x2, 0x568, 0x56a, 0x5, 0x169, 0xb5, 0x2, 0x569, 0x568,
0x3, 0x2, 0x2, 0x2, 0x569, 0x56a, 0x3, 0x2, 0x2, 0x2, 0x56a, 0x168,
0x3, 0x2, 0x2, 0x2, 0x56b, 0x56c, 0x9, 0x20, 0x2, 0x2, 0x56c, 0x16a,
0x3, 0x2, 0x2, 0x2, 0x56d, 0x586, 0x7, 0x5e, 0x2, 0x2, 0x56e, 0x587,
0x9, 0x21, 0x2, 0x2, 0x56f, 0x570, 0x7, 0x77, 0x2, 0x2, 0x570, 0x571,
0x5, 0x157, 0xac, 0x2, 0x571, 0x572, 0x5, 0x157, 0xac, 0x2, 0x572, 0x573,
0x5, 0x157, 0xac, 0x2, 0x573, 0x574, 0x5, 0x157, 0xac, 0x2, 0x574, 0x587,
0x3, 0x2, 0x2, 0x2, 0x575, 0x576, 0x7, 0x77, 0x2, 0x2, 0x576, 0x577,
0x7, 0x7d, 0x2, 0x2, 0x577, 0x578, 0x5, 0x157, 0xac, 0x2, 0x578, 0x579,
0x5, 0x157, 0xac, 0x2, 0x579, 0x57a, 0x5, 0x157, 0xac, 0x2, 0x57a, 0x57b,
0x5, 0x157, 0xac, 0x2, 0x57b, 0x57c, 0x7, 0x7f, 0x2, 0x2, 0x57c, 0x587,
0x3, 0x2, 0x2, 0x2, 0x57d, 0x57e, 0x9, 0x22, 0x2, 0x2, 0x57e, 0x57f,
0x9, 0x23, 0x2, 0x2, 0x57f, 0x587, 0x9, 0x23, 0x2, 0x2, 0x580, 0x581,
0x9, 0x23, 0x2, 0x2, 0x581, 0x587, 0x9, 0x23, 0x2, 0x2, 0x582, 0x587,
0x9, 0x23, 0x2, 0x2, 0x583, 0x584, 0x5, 0x157, 0xac, 0x2, 0x584, 0x585,
0x5, 0x157, 0xac, 0x2, 0x585, 0x587, 0x3, 0x2, 0x2, 0x2, 0x586, 0x56e,
0x3, 0x2, 0x2, 0x2, 0x586, 0x56f, 0x3, 0x2, 0x2, 0x2, 0x586, 0x575,
0x3, 0x2, 0x2, 0x2, 0x586, 0x57d, 0x3, 0x2, 0x2, 0x2, 0x586, 0x580,
0x3, 0x2, 0x2, 0x2, 0x586, 0x582, 0x3, 0x2, 0x2, 0x2, 0x586, 0x583,
0x3, 0x2, 0x2, 0x2, 0x587, 0x16c, 0x3, 0x2, 0x2, 0x2, 0x588, 0x591,
0x5, 0x169, 0xb5, 0x2, 0x589, 0x591, 0x5, 0xfb, 0x7e, 0x2, 0x58a, 0x591,
0x5, 0x13f, 0xa0, 0x2, 0x58b, 0x591, 0x5, 0x141, 0xa1, 0x2, 0x58c, 0x591,
0x5, 0x155, 0xab, 0x2, 0x58d, 0x591, 0x5, 0x13d, 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ba, 0x2, 0x2, 0x5cc, 0x174,
0x3, 0x2, 0x2, 0x2, 0x5cd, 0x5ce, 0x5, 0x143, 0xa2, 0x2, 0x5ce, 0x5cf,
0x5, 0x171, 0xb9, 0x2, 0x5cf, 0x5d9, 0x3, 0x2, 0x2, 0x2, 0x5d0, 0x5d2,
0x5, 0x171, 0xb9, 0x2, 0x5d1, 0x5d0, 0x3, 0x2, 0x2, 0x2, 0x5d2, 0x5d3,
0x3, 0x2, 0x2, 0x2, 0x5d3, 0x5d1, 0x3, 0x2, 0x2, 0x2, 0x5d3, 0x5d4,
0x3, 0x2, 0x2, 0x2, 0x5d4, 0x5d5, 0x3, 0x2, 0x2, 0x2, 0x5d5, 0x5d6,
0x5, 0x3, 0x2, 0x2, 0x5d6, 0x5d7, 0x5, 0x121, 0x91, 0x2, 0x5d7, 0x5d9,
0x3, 0x2, 0x2, 0x2, 0x5d8, 0x5cd, 0x3, 0x2, 0x2, 0x2, 0x5d8, 0x5d1,
0x3, 0x2, 0x2, 0x2, 0x5d9, 0x5da, 0x3, 0x2, 0x2, 0x2, 0x5da, 0x5db,
0x8, 0xbb, 0x2, 0x2, 0x5db, 0x176, 0x3, 0x2, 0x2, 0x2, 0x2f, 0x2, 0x17b,
0x186, 0x18c, 0x18f, 0x196, 0x19c, 0x1a1, 0x1a3, 0x507, 0x50d, 0x511,
0x516, 0x51b, 0x51e, 0x523, 0x529, 0x52d, 0x530, 0x535, 0x538, 0x53b,
0x541, 0x544, 0x546, 0x54d, 0x558, 0x55d, 0x560, 0x563, 0x566, 0x569,
0x586, 0x590, 0x5a6, 0x5a8, 0x5ae, 0x5b0, 0x5b8, 0x5ba, 0x5bf, 0x5c2,
0x5c9, 0x5d3, 0x5d8, 0x3, 0x8, 0x2, 0x2,
};
atn::ATNDeserializer deserializer;
_atn = deserializer.deserialize(_serializedATN);
size_t count = _atn.getNumberOfDecisions();
_decisionToDFA.reserve(count);
for (size_t i = 0; i < count; i++) {
_decisionToDFA.emplace_back(_atn.getDecisionState(i), i);
}
}
ELDOLexer::Initializer ELDOLexer::_init;
| 69.711447
| 120
| 0.604912
|
sydelity-net
|
7ad4120cf35887c1299d20c4bd55bfff365a9bf5
| 989
|
cpp
|
C++
|
Source/EngineStd/GameAssetManager/Factory/Components/Refrigeration/GameAssetRefrigerationUnit.cpp
|
vivienneanthony/MyForkEditor
|
273e15ca3610b3d3b68fdf2efbac2ba1b3659e7f
|
[
"Apache-2.0"
] | 2
|
2015-12-30T00:32:09.000Z
|
2016-02-27T14:50:06.000Z
|
Source/EngineStd/GameAssetManager/Factory/Components/Refrigeration/GameAssetRefrigerationUnit.cpp
|
vivienneanthony/MyForkEditor
|
273e15ca3610b3d3b68fdf2efbac2ba1b3659e7f
|
[
"Apache-2.0"
] | null | null | null |
Source/EngineStd/GameAssetManager/Factory/Components/Refrigeration/GameAssetRefrigerationUnit.cpp
|
vivienneanthony/MyForkEditor
|
273e15ca3610b3d3b68fdf2efbac2ba1b3659e7f
|
[
"Apache-2.0"
] | null | null | null |
// include engine headers
#include "EngineStd.h"
// header for specific component
#include "GameAssetRefrigerationUnit.h"
const GameAssetType GameAssetRefrigerationUnit::g_Type = GAType_RefrigerationUnit;
GameAssetRefrigerationUnit::GameAssetRefrigerationUnit(Context* context) : BaseComponent(context)
{
}
// Game Asset Component - Type
GameAssetRefrigerationUnit::GameAssetRefrigerationUnit() : BaseComponent()
{
// Set type and state to nothing for now
m_GameAssetType=GAType_RefrigerationUnit;
m_GameAssetState=GAState_None;
// Only the physics update event is needed: unsubscribe from the rest for optimization
SetUpdateEventMask(USE_FIXEDUPDATE);
}
// Destructor
GameAssetRefrigerationUnit::~GameAssetRefrigerationUnit(void)
{
return;
}
bool GameAssetRefrigerationUnit::VInit(const GameAsset* pGameAsset)
{
// Set type and state to nothing for now
m_GameAssetType = GAType_RefrigerationUnit;
m_GameAssetState = GAState_None;
return true;
}
| 23.547619
| 97
| 0.790698
|
vivienneanthony
|
7ad46012f30985b3883346136ac0fde6f90bd87a
| 1,930
|
cpp
|
C++
|
src/frameworks/wilhelm/src/itf/I3DCommit.cpp
|
dAck2cC2/m3e
|
475b89b59d5022a94e00b636438b25e27e4eaab2
|
[
"Apache-2.0"
] | 3
|
2015-08-31T15:24:31.000Z
|
2020-04-24T20:31:29.000Z
|
src/frameworks/wilhelm/src/itf/I3DCommit.cpp
|
dAck2cC2/m3e
|
475b89b59d5022a94e00b636438b25e27e4eaab2
|
[
"Apache-2.0"
] | null | null | null |
src/frameworks/wilhelm/src/itf/I3DCommit.cpp
|
dAck2cC2/m3e
|
475b89b59d5022a94e00b636438b25e27e4eaab2
|
[
"Apache-2.0"
] | 3
|
2015-07-29T07:17:15.000Z
|
2020-11-04T06:55:37.000Z
|
/*
* Copyright (C) 2010 The Android Open Source Project
*
* 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.
*/
/* 3DCommit implementation */
#include "sles_allinclusive.h"
static SLresult I3DCommit_Commit(SL3DCommitItf self)
{
SL_ENTER_INTERFACE
I3DCommit *thiz = (I3DCommit *) self;
IObject *thisObject = InterfaceToIObject(thiz);
object_lock_exclusive(thisObject);
if (thiz->mDeferred) {
SLuint32 myGeneration = thiz->mGeneration;
do {
++thiz->mWaiting;
object_cond_wait(thisObject);
} while (thiz->mGeneration == myGeneration);
}
object_unlock_exclusive(thisObject);
result = SL_RESULT_SUCCESS;
SL_LEAVE_INTERFACE
}
static SLresult I3DCommit_SetDeferred(SL3DCommitItf self, SLboolean deferred)
{
SL_ENTER_INTERFACE
I3DCommit *thiz = (I3DCommit *) self;
IObject *thisObject = InterfaceToIObject(thiz);
object_lock_exclusive(thisObject);
thiz->mDeferred = SL_BOOLEAN_FALSE != deferred; // normalize
object_unlock_exclusive(thisObject);
result = SL_RESULT_SUCCESS;
SL_LEAVE_INTERFACE
}
static const struct SL3DCommitItf_ I3DCommit_Itf = {
I3DCommit_Commit,
I3DCommit_SetDeferred
};
void I3DCommit_init(void *self)
{
I3DCommit *thiz = (I3DCommit *) self;
thiz->mItf = &I3DCommit_Itf;
thiz->mDeferred = SL_BOOLEAN_FALSE;
thiz->mGeneration = 0;
thiz->mWaiting = 0;
}
| 27.183099
| 77
| 0.712953
|
dAck2cC2
|
7ad48e2d8cdf0736321f0782af88979d3b513bb0
| 1,596
|
cpp
|
C++
|
libs/systems/impl/src/systems/impl/log_context.cpp
|
cpreh/spacegameengine
|
313a1c34160b42a5135f8223ffaa3a31bc075a01
|
[
"BSL-1.0"
] | 2
|
2016-01-27T13:18:14.000Z
|
2018-05-11T01:11:32.000Z
|
libs/systems/impl/src/systems/impl/log_context.cpp
|
cpreh/spacegameengine
|
313a1c34160b42a5135f8223ffaa3a31bc075a01
|
[
"BSL-1.0"
] | null | null | null |
libs/systems/impl/src/systems/impl/log_context.cpp
|
cpreh/spacegameengine
|
313a1c34160b42a5135f8223ffaa3a31bc075a01
|
[
"BSL-1.0"
] | 3
|
2018-05-11T01:11:34.000Z
|
2021-04-24T19:47:45.000Z
|
// Copyright Carl Philipp Reh 2006 - 2019.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <sge/log/default_level.hpp>
#include <sge/log/default_level_streams.hpp>
#include <sge/systems/optional_log_context_ref.hpp>
#include <sge/systems/impl/log_context.hpp>
#include <fcppt/make_ref.hpp>
#include <fcppt/make_unique_ptr.hpp>
#include <fcppt/reference_impl.hpp>
#include <fcppt/unique_ptr_impl.hpp>
#include <fcppt/log/context.hpp>
#include <fcppt/log/context_reference.hpp>
#include <fcppt/optional/maybe.hpp>
#include <fcppt/variant/match.hpp>
sge::systems::impl::log_context::log_context(
sge::systems::optional_log_context_ref const _log_context)
: impl_{fcppt::optional::maybe(
_log_context,
[]
{
return variant{fcppt::make_unique_ptr<fcppt::log::context>(
sge::log::default_level(), sge::log::default_level_streams())};
},
[](fcppt::reference<fcppt::log::context> const _ref) { return variant{_ref}; })}
{
}
sge::systems::impl::log_context::~log_context() = default;
fcppt::log::context_reference sge::systems::impl::log_context::get() const
{
return fcppt::variant::match(
impl_,
[](fcppt::unique_ptr<fcppt::log::context> const &_context) -> fcppt::log::context_reference
{ return fcppt::make_ref(*_context); },
[](fcppt::reference<fcppt::log::context> const &_context) -> fcppt::log::context_reference
{ return _context; });
}
| 37.116279
| 97
| 0.687343
|
cpreh
|
7ad684895c182e13c88f71645d1010a43c383515
| 6,260
|
cc
|
C++
|
sdl1/tennix/archive.cc
|
pdpdds/sdldualsystem
|
d74ea84cbea705fef62868ba8c693bf7d2555636
|
[
"BSD-2-Clause"
] | null | null | null |
sdl1/tennix/archive.cc
|
pdpdds/sdldualsystem
|
d74ea84cbea705fef62868ba8c693bf7d2555636
|
[
"BSD-2-Clause"
] | null | null | null |
sdl1/tennix/archive.cc
|
pdpdds/sdldualsystem
|
d74ea84cbea705fef62868ba8c693bf7d2555636
|
[
"BSD-2-Clause"
] | null | null | null |
/**
*
* Tennix Archive File Format
* Copyright (C) 2009-2010 Thomas Perl <thp@thpinfo.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
**/
#include <iostream>
#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
//#include <arpa/inet.h>
#include <WinSock2.h>
#include "archive.hh"
TennixArchive::TennixArchive(const char* filename, const char* fallback)
{
fp = fopen(filename, "rb");
if (fp == NULL && fallback != NULL) {
fp = fopen(fallback, "rb");
}
assert(fp != NULL);
offset = sizeof(TennixArchiveHeader)*fread(&(header), sizeof(TennixArchiveHeader), 1, fp);
assert(offset == sizeof(TennixArchiveHeader));
assert(strncmp(header.header, TENNIX_ARCHIVE_HEADER, TENNIX_ARCHIVE_HEADER_LEN) == 0);
assert(header.versionmajor == TENNIX_ARCHIVE_VERSIONMAJOR);
assert(header.versionminor == TENNIX_ARCHIVE_VERSIONMINOR);
items = (TennixArchiveItem*)calloc(header.items, sizeof(TennixArchiveItem));
assert(items != NULL);
offset += sizeof(TennixArchiveItem)*fread(items, sizeof(TennixArchiveItem), header.items, fp);
assert(offset == sizeof(TennixArchiveHeader) + header.items*sizeof(TennixArchiveItem));
xormem((char*)(items), header.items*sizeof(TennixArchiveItem), header.key);
for (int i=0; i<header.items; i++) {
/* convert offset + length from network byte order */
items[i].offset = ntohl(items[i].offset);
items[i].length = ntohl(items[i].length);
}
current_item = 0;
building = 0;
}
std::ostream&
operator<<(std::ostream& out, TennixArchiveHeader& header)
{
out << "Header: " << header.header << std::endl;
out << "Version: " <<
(int)header.versionmajor << '.' <<
(int)header.versionminor << std::endl;
out << "Master key: " << header.key << std::endl;
out << "Items: " << header.items;
return out;
}
std::ostream&
operator<<(std::ostream& out, TennixArchiveItem& item)
{
out << "File: " << item.filename << std::endl;
out << "Size: " << item.length << std::endl;
out << "Offset: " << item.offset << std::endl;
out << "Key: " << (int)item.key;
return out;
}
int
TennixArchive::setItemFilename(const char* filename)
{
int i;
for (i=0; i<header.items; i++) {
if (strncmp(items[i].filename, filename, TENNIX_ARCHIVE_ITEM_MAXNAME) == 0) {
current_item = i;
return 1;
}
}
return 0;
}
char*
TennixArchive::getItemBytes()
{
size_t size = getItemSize();
char* data = (char*)malloc(size+1);
/* the last char is a null character, so this works for strings, too */
data[size]='\0';
fseek(fp, items[current_item].offset, SEEK_SET);
assert(fread(data, size, 1, fp) == 1);
xormem(data, size, items[current_item].key);
return data;
}
void
TennixArchive::xormem(char* mem, uint32_t length, char key)
{
char *i = mem, *end = mem+length;
for(; i != end; i++) {
*i ^= key;
}
}
void
TennixArchive::appendItem(char* filename, char* data, uint32_t length)
{
TennixArchiveItem* item;
header.items++;
items = (TennixArchiveItem*)realloc(items, sizeof(TennixArchiveItem)*header.items);
blobs = (char**)realloc(blobs, sizeof(char*)*header.items);
item = &(items[header.items-1]);
blobs[header.items-1] = data;
for (int i=0; i<TENNIX_ARCHIVE_ITEM_MAXNAME; i++) {
item->filename[i] = data[(i*2)%length];
}
strcpy(item->filename, filename);
item->length = length;
}
void
TennixArchive::buildFile(char* filename)
{
size_t offset = 0;
size_t *memsize = NULL;
memsize = (size_t*)calloc(header.items, sizeof(size_t));
fp = fopen(filename, "wb");
assert(fp != NULL);
offset += sizeof(TennixArchiveHeader) + header.items*sizeof(TennixArchiveItem);
header.versionmajor = TENNIX_ARCHIVE_VERSIONMAJOR;
header.versionminor = TENNIX_ARCHIVE_VERSIONMINOR;
header.key = (0xaa + 0x77*header.items*3) % 0xff;
fprintf(stderr, "Packing: ");
for (int i=0; i<header.items; i++) {
fprintf(stderr, "%s", items[i].filename);
items[i].offset = htonl(offset); /* network byte order */
items[i].key = 0xaa ^ ((i<<2)%0x100);
xormem(blobs[i], items[i].length, items[i].key);
memsize[i] = items[i].length;
offset += items[i].length;
items[i].length = htonl(items[i].length); /* network byte order */
xormem((char*)(items + i), sizeof(TennixArchiveItem), header.key);
if (i != header.items-1) {
fprintf(stderr, ", ");
}
}
fputc('\n', stderr);
fprintf(stderr, "Writing: %s", filename);
fputc('.', stderr);
assert(fwrite(&(header), sizeof(TennixArchiveHeader), 1, fp) == 1);
fputc('.', stderr);
assert(fwrite(items, sizeof(TennixArchiveItem), header.items, fp) == header.items);
fputc('.', stderr);
for (int i=0; i<header.items; i++) {
assert(fwrite(blobs[i], memsize[i], 1, fp) == 1);
free(blobs[i]);
}
fputc('.', stderr);
fprintf(stderr, "OK\n");
free(memsize);
free(blobs);
}
std::ostream&
operator<<(std::ostream& out, TennixArchive& archive)
{
out << "Tennix Archive" << std::endl;
out << archive.header << std::endl;
for (int i=0; i<archive.header.items; i++) {
out << "=======================" << std::endl;
out << archive.items[i] << std::endl;
}
out << "=== END OF ARCHIVE ====" << std::endl;
return out;
}
| 28.715596
| 98
| 0.625879
|
pdpdds
|
7ad74b65a2b09feee3a5ac1a965420ac2c9bd381
| 3,286
|
cpp
|
C++
|
osgDB/Registry.cpp
|
gideonmay/PyOSG
|
fe44853d52a92596aeb3983f1f6d73191872affe
|
[
"BSD-2-Clause-FreeBSD"
] | 5
|
2019-05-09T14:09:05.000Z
|
2022-03-21T01:31:41.000Z
|
osgDB/Registry.cpp
|
gideonmay/PyOSG
|
fe44853d52a92596aeb3983f1f6d73191872affe
|
[
"BSD-2-Clause-FreeBSD"
] | null | null | null |
osgDB/Registry.cpp
|
gideonmay/PyOSG
|
fe44853d52a92596aeb3983f1f6d73191872affe
|
[
"BSD-2-Clause-FreeBSD"
] | 4
|
2018-05-10T07:54:23.000Z
|
2020-01-08T07:37:05.000Z
|
// Copyright (C) 2016 Gideon May (gideon@borges.xyz)
//
// Permission to copy, use, sell and distribute this software is granted
// provided this copyright notice appears in all copies.
// Permission to modify the code and to distribute modified code is granted
// provided this copyright notice appears in all copies, and a notice
// that the code was modified is included with the copyright notice.
//
// This software is provided "as is" without express or implied warranty,
// and with no claim as to its suitability for any purpose.
#include <boost/python.hpp>
#include <osg/Referenced>
#include <osgDB/Registry>
#include "held_ptr.hpp"
using namespace boost::python;
namespace {
osgDB::Registry * instance()
{
return osgDB::Registry::instance();
}
}
namespace PyOSG {
void init_Registry()
{
class_<osgDB::Registry, osg::ref_ptr<osgDB::Registry>, bases<osg::Referenced>, boost::noncopyable >
// class_<osgDB::Registry, osg::ref_ptr<osgDB::Registry>, boost::noncopyable >
registry("Registry", "Registry is a singleton factory which stores the reader/writers which are linked in at runtime for reading non-native file formats.",
no_init);
registry
.def("readCommandLine", &osgDB::Registry::readCommandLine)
.def("addFileExtensionAlias", &osgDB::Registry::addFileExtensionAlias)
// .def("addDotOsgWrapper", &osgDB::Registry::addDotOsgWrapper)
// .def("removeDotOsgWrapper", &osgDB::Registry::removeDotOsgWrapper)
.def("addReaderWriter", &osgDB::Registry::addReaderWriter)
.def("removeReaderWriter", &osgDB::Registry::removeReaderWriter)
.def("loadLibrary", &osgDB::Registry::loadLibrary)
.def("closeLibrary", &osgDB::Registry::closeLibrary)
/*
.def("getReaderWriterForExtension", &osgDB::Registry::getReaderWriterForExtension)
.def("readObject", &osgDB::Registry::readObject)
.def("writeObject", &osgDB::Registry::writeObject)
.def("readImage", &osgDB::Registry::readImage)
.def("writeImage", &osgDB::Registry::writeImage)
.def("readNode", &osgDB::Registry::readNode)
.def("writeNode", &osgDB::Registry::writeNode)
*/
.def("initFilePathLists", &osgDB::Registry::initFilePathLists,
"initilize both the Data and Library FilePaths, by default called by the constructor, so it should only be required if you want to force the re-reading of environmental variables.")
.def("initDataFilePathList", &osgDB::Registry::initDataFilePathList,
"initilize the Data FilePath by reading the OSG_FILE_PATH environmental variable.")
.def("removeExpiredObjectsInCache", &osgDB::Registry::removeExpiredObjectsInCache)
.def("clearObjectCache", &osgDB::Registry::clearObjectCache)
// XXX .def("setUseObjectCacheHint", &osgDB::Registry::setUseObjectCacheHint)
.def("instance", &osgDB::Registry::instance, return_value_policy<manage_osg_object>())
.def("instance", &instance, return_value_policy<manage_osg_object>())
.staticmethod("instance")
;
}
}
| 45.013699
| 197
| 0.664638
|
gideonmay
|
7ad85bca62cdc124c66b287180f153907aa2cb0e
| 310
|
cpp
|
C++
|
lib/EMP/emp-tool/gc/backend.cpp
|
zpleefly/libscapi
|
27d7d964d645ed111c2cc9870087971cf13e24f4
|
[
"MIT"
] | null | null | null |
lib/EMP/emp-tool/gc/backend.cpp
|
zpleefly/libscapi
|
27d7d964d645ed111c2cc9870087971cf13e24f4
|
[
"MIT"
] | 2
|
2021-03-20T05:38:48.000Z
|
2021-03-31T20:14:11.000Z
|
lib/EMP/emp-tool/gc/backend.cpp
|
zpleefly/libscapi
|
27d7d964d645ed111c2cc9870087971cf13e24f4
|
[
"MIT"
] | null | null | null |
#include "backend.h"
#ifdef THREADING
__thread Backend* local_backend = nullptr;
__thread GarbleCircuit* local_gc = nullptr;
#else
Backend* local_backend = nullptr;
GarbleCircuit* local_gc = nullptr;
#endif
int greatestPowerOfTwoLessThan(int n) {
int k = 1;
while (k < n)
k = k << 1;
return k >> 1;
}
| 16.315789
| 43
| 0.709677
|
zpleefly
|
7ad8cb9cbb1e8954aa8f4ab4ff01f9b3107b6137
| 2,398
|
hpp
|
C++
|
src/Error.hpp
|
JesseMaurais/SGe
|
f73bd03d30074a54642847b05f82151128481371
|
[
"MIT"
] | 1
|
2017-04-20T06:27:36.000Z
|
2017-04-20T06:27:36.000Z
|
src/Error.hpp
|
JesseMaurais/SGe
|
f73bd03d30074a54642847b05f82151128481371
|
[
"MIT"
] | null | null | null |
src/Error.hpp
|
JesseMaurais/SGe
|
f73bd03d30074a54642847b05f82151128481371
|
[
"MIT"
] | null | null | null |
#ifndef Error_hpp
#define Error_hpp
#include "io.hpp"
#include "SDL.hpp"
#include "Strings.hpp"
#include <system_error>
#include <exception>
namespace SDL
{
/// Overload of SDL::LogError that takes std::string
inline bool LogError(std::string const &prefix)
{
return LogError(prefix.c_str());
}
/// Overload of SDL::LogError that takes Strings enumeration
inline bool LogError(enum Strings prefix)
{
return LogError(String(prefix));
}
/// Overload of SDL::SetErrno that takes std::string
inline bool SetErrno(std::string const &prefix)
{
return SetErrno(prefix.c_str());
}
/// Overload of SDL::SetErrno that takes Strings enumeration
inline bool SetErrno(enum Strings prefix)
{
return SetErrno(String(prefix));
}
/// Set error string with current errno and log it like perror does
inline bool perror(std::string const &prefix)
{
return SDL::SetErrno() and SDL::LogError(prefix);
}
/// Type-safe and format-safe version of SDL_SetError. Always returns true
template <typename... Args> bool SetError(std::string const &format, Args&&... args)
{
std::string message;
io::sprintf(message, format, args...);
return 0 > SDL_SetError("%s", message.c_str());
}
/// Type-safe and format-safe version taking Strings enum. Always returns true
template <typename... Args> bool SetError(enum Strings format, Args&&... args)
{
return SetError(String(format), args...);
}
/// Set error string with given std::exception
inline bool SetError(std::exception const except)
{
std::string const message = except.what();
return SetError(message);
}
/// Set error string with given std::error_code
inline bool SetError(std::error_code const error_code)
{
std::string const message = error_code.message();
return SetError(message);
}
/// Set error string with given std::errc
inline bool SetError(std::errc const errc)
{
std::error_code const error_code = std::make_error_code(errc);
return SetError(error_code);
}
/// Type-safe and format-safe version of SDL_Log
template <typename... Args> void Log(std::string const &format, Args&&... args)
{
std::string message;
io::sprintf(message, format, args...);
SDL_Log("%s", message.c_str());
}
// Type-safe and format-safe version taking Strings enum
template <typename... Args> void Log(enum Strings format, Args&&... args)
{
Log(String(format), args...);
}
}
#endif // file
| 25.784946
| 85
| 0.706422
|
JesseMaurais
|
7addb7a8683610c2d49fefd995a33ca5c51645cf
| 1,302
|
hpp
|
C++
|
traffic.hpp
|
iszczesniak/ddpp
|
bc27ad2b7f699d8ef2e11dcb3b56d538d92e4b4e
|
[
"BSL-1.0"
] | null | null | null |
traffic.hpp
|
iszczesniak/ddpp
|
bc27ad2b7f699d8ef2e11dcb3b56d538d92e4b4e
|
[
"BSL-1.0"
] | null | null | null |
traffic.hpp
|
iszczesniak/ddpp
|
bc27ad2b7f699d8ef2e11dcb3b56d538d92e4b4e
|
[
"BSL-1.0"
] | null | null | null |
#ifndef TRAFFIC_HPP
#define TRAFFIC_HPP
#include "client.hpp"
#include "graph.hpp"
#include "module.hpp"
#include "sim.hpp"
#include <queue>
#include <random>
#include <set>
class traffic: public module<sim>
{
// The set of active clients.
std::set<client *> cs;
// The queue of clients to delete later.
std::queue<client *> dl;
// The ID counter.
int idc;
// The client arrival time distribution.
std::exponential_distribution<> m_catd;
// The mean holding time.
double m_mht;
// The mean number of units.
double m_mnu;
// Shortest distances.
mutable std::map<npair, int> sd;
public:
traffic(double mcat, double mht, double mnu);
~traffic();
// Processes the event and changes the state of the client.
void operator()(double t);
// Return the number of clients.
int nr_clients() const;
// Insert the client to the traffic.
void insert(client *);
// Remote the client from the traffic.
void erase(client *);
// Delete this client later.
void delete_me_later(client *);
// Calculate the capacity currently served, i.e., the sum of the
// products of the number of units used and the weight of an edge.
COST
capacity_served() const;
private:
void schedule_next(double);
void delete_clients();
};
#endif /* TRAFFIC_HPP */
| 19.432836
| 68
| 0.686636
|
iszczesniak
|
7adff761af2c06c28166a3736f93b726e6228626
| 1,418
|
cpp
|
C++
|
src/Command.cpp
|
eXpl0it3r/SecondaryMap
|
0c5dbe98f0f08a33771045bf80fa4197e7bc09f8
|
[
"Zlib"
] | null | null | null |
src/Command.cpp
|
eXpl0it3r/SecondaryMap
|
0c5dbe98f0f08a33771045bf80fa4197e7bc09f8
|
[
"Zlib"
] | null | null | null |
src/Command.cpp
|
eXpl0it3r/SecondaryMap
|
0c5dbe98f0f08a33771045bf80fa4197e7bc09f8
|
[
"Zlib"
] | null | null | null |
#include "Command.hpp"
#include "utility.hpp"
#include "Application.hpp"
#include <SFML/System/Err.hpp>
#include <iostream>
Command::Command(const std::string& tokens, const std::string& data) :
m_failed{false}
{
init_tokens(tokens);
init_data(data);
if(m_failed)
{
m_tokens.clear();
m_data.clear();
}
}
bool Command::failed()
{
return m_failed;
}
std::deque<std::string>& Command::tokens()
{
return m_tokens;
}
Json::Value& Command::data()
{
return m_data;
}
void Command::init_tokens(const std::string& tokens)
{
// Split the tokens
m_tokens = utility::split(tokens, '/');
// Required: API call & correct version
if(m_tokens.empty())
{
sf::err() << "No tokens given!" << std::endl;
m_failed = true;
}
else if(m_tokens.front() != Application::VERSION)
{
sf::err() << "API version miss match!" << std::endl;
m_failed = true;
}
// Remove the API version information
m_tokens.pop_front();
//for(auto& token : m_tokens)
// std::cout << "Split: " << token << std::endl;
}
void Command::init_data(const std::string& data)
{
// Extract JSON data
Json::Reader reader;
if(!reader.parse(data, m_data))
{
sf::err() << "Failed to parse the data" << std::endl << reader.getFormattedErrorMessages() << std::endl;
m_failed = true;
}
else
{
//std::cout << "Parsed successfully!" << std::endl;
}
}
| 18.657895
| 107
| 0.615656
|
eXpl0it3r
|
7ae2fbb27db7b8339595ffa710a10b5e8e63bf1f
| 1,349
|
cpp
|
C++
|
ntuj/4858.cpp
|
dk00/old-stuff
|
e1184684c85fe9bbd1ceba58b94d4da84c67784e
|
[
"Unlicense"
] | null | null | null |
ntuj/4858.cpp
|
dk00/old-stuff
|
e1184684c85fe9bbd1ceba58b94d4da84c67784e
|
[
"Unlicense"
] | null | null | null |
ntuj/4858.cpp
|
dk00/old-stuff
|
e1184684c85fe9bbd1ceba58b94d4da84c67784e
|
[
"Unlicense"
] | null | null | null |
#include<cstdio>
const int N = 102;
int s[N][N], t[N][N];
main() {
int i, j, k, l, n, m, x, T, C = 1;
scanf("%d", &T);
while (T--) {
scanf("%d %d", &n, &m);
for (i = 0; i < n; ++i)
for (j = 0; j < n; ++j)
scanf("%d", &s[i][j]);
for (i = 0; i < n; ++i)
for (j = 0; j < n; ++j)
scanf("%d", &t[i][j]);
printf("Case %d: ", C++);
for (i = k = 0; i < n; ++i)
for (j = 0; j < n; ++j)
if (s[i][j] != t[i][j]) ++k;
if (k == 0) {
puts("0");
continue;
}
for (i = k = 0; i < n; ++i)
for (j = i + 1; j < n; ++j)
if (t[j][i] != t[i][j]) ++k;
if (k == 0) {
puts("-1");
continue;
}/*
for (i = k = 0; i < n; ++i)
for (j = i + 1; j < n; ++j)
if (s[i][j] != s[j][i]) ++k;
if (k == 0) {
puts("-1");
continue;
}*/
for (i = l = 0; i < n; ++i)
for (j = i + 1; j < n; ++j)
if (s[i][j] != t[i][j] && s[j][i] != t[j][i] && t[i][j] == s[j][i] && t[j][i] == s[i][j])
++l;
if (k == 1 && l == 1) {
x = 1;
if (m == 2) {
if (n <= 2) {
puts("-1");
continue;
}
x = 2;
}
}
else x = 0;
for (i = k = 0; i < n; ++i)
for (j = 0; j < n; ++j)
if (s[i][j] != t[i][j]) ++k;
printf("%d\n", k + x);
}
}
| 22.864407
| 97
| 0.284655
|
dk00
|
7ae4171572f625c0c9043de8026a771be2601565
| 1,259
|
hpp
|
C++
|
include/Pothos/serialization/impl/preprocessor/control/expr_iif.hpp
|
pothosware/pothos-serialization
|
c59130f916a3e5b833a32ba415063f9cb306a8dd
|
[
"BSL-1.0"
] | 1
|
2015-05-26T11:27:22.000Z
|
2015-05-26T11:27:22.000Z
|
include/Pothos/serialization/impl/preprocessor/control/expr_iif.hpp
|
pothosware/pothos-serialization
|
c59130f916a3e5b833a32ba415063f9cb306a8dd
|
[
"BSL-1.0"
] | null | null | null |
include/Pothos/serialization/impl/preprocessor/control/expr_iif.hpp
|
pothosware/pothos-serialization
|
c59130f916a3e5b833a32ba415063f9cb306a8dd
|
[
"BSL-1.0"
] | null | null | null |
# /* **************************************************************************
# * *
# * (C) Copyright Paul Mensonides 2002.
# * Distributed under the Boost Software License, Version 1.0. (See
# * accompanying file LICENSE_1_0.txt or copy at
# * http://www.boost.org/LICENSE_1_0.txt)
# * *
# ************************************************************************** */
#
# /* See http://www.boost.org for most recent version. */
#
# ifndef POTHOS_PREPROCESSOR_CONTROL_EXPR_IIF_HPP
# define POTHOS_PREPROCESSOR_CONTROL_EXPR_IIF_HPP
#
# include <Pothos/serialization/impl/preprocessor/config/config.hpp>
#
# /* POTHOS_PP_EXPR_IIF */
#
# if ~POTHOS_PP_CONFIG_FLAGS() & POTHOS_PP_CONFIG_MWCC()
# define POTHOS_PP_EXPR_IIF(bit, expr) POTHOS_PP_EXPR_IIF_I(bit, expr)
# else
# define POTHOS_PP_EXPR_IIF(bit, expr) POTHOS_PP_EXPR_IIF_OO((bit, expr))
# define POTHOS_PP_EXPR_IIF_OO(par) POTHOS_PP_EXPR_IIF_I ## par
# endif
#
# define POTHOS_PP_EXPR_IIF_I(bit, expr) POTHOS_PP_EXPR_IIF_ ## bit(expr)
#
# define POTHOS_PP_EXPR_IIF_0(expr)
# define POTHOS_PP_EXPR_IIF_1(expr) expr
#
# endif
| 39.34375
| 80
| 0.55838
|
pothosware
|
7ae5bf12ce5bfce9821c206a5a97798a21725b19
| 132
|
cpp
|
C++
|
Engine/src/Engine/Renderer/RendererAPI.cpp
|
PalliativeX/GameEngine
|
704cf5f3ebc81fdf5e3e514908c3ac47305ccd33
|
[
"Apache-2.0"
] | null | null | null |
Engine/src/Engine/Renderer/RendererAPI.cpp
|
PalliativeX/GameEngine
|
704cf5f3ebc81fdf5e3e514908c3ac47305ccd33
|
[
"Apache-2.0"
] | null | null | null |
Engine/src/Engine/Renderer/RendererAPI.cpp
|
PalliativeX/GameEngine
|
704cf5f3ebc81fdf5e3e514908c3ac47305ccd33
|
[
"Apache-2.0"
] | null | null | null |
#include "enginepch.h"
#include "RendererAPI.h"
namespace Engine
{
RendererAPI::API RendererAPI::api = RendererAPI::API::OpenGL;
}
| 18.857143
| 62
| 0.75
|
PalliativeX
|
7ae639511551668ded269856b7d603838e0f1496
| 597
|
cpp
|
C++
|
cpp/671-680/Valid Parenthesis String.cpp
|
KaiyuWei/leetcode
|
fd61f5df60cfc7086f7e85774704bacacb4aaa5c
|
[
"MIT"
] | 150
|
2015-04-04T06:53:49.000Z
|
2022-03-21T13:32:08.000Z
|
cpp/671-680/Valid Parenthesis String.cpp
|
yizhu1012/leetcode
|
d6fa443a8517956f1fcc149c8c4f42c0ad93a4a7
|
[
"MIT"
] | 1
|
2015-04-13T15:15:40.000Z
|
2015-04-21T20:23:16.000Z
|
cpp/671-680/Valid Parenthesis String.cpp
|
yizhu1012/leetcode
|
d6fa443a8517956f1fcc149c8c4f42c0ad93a4a7
|
[
"MIT"
] | 64
|
2015-06-30T08:00:07.000Z
|
2022-01-01T16:44:14.000Z
|
class Solution {
public:
bool checkValidString(string s) {
int minLeft = 0, maxLeft = 0;
for (char ch : s) {
if (ch == '(') {
minLeft++;
maxLeft++;
} else if (ch == ')') {
minLeft--;
maxLeft--;
} else {
minLeft--;
maxLeft++;
}
if (maxLeft < 0) {
return false;
}
minLeft = max(0, minLeft);
}
return minLeft == 0;
}
};
| 21.321429
| 38
| 0.311558
|
KaiyuWei
|
7aec267d7676eef22504002a9fd510e54d5e390d
| 8,017
|
cpp
|
C++
|
scripts/alternative_splicing/AltSplicingToolkit/src/gff/BioMartGffHandler.cpp
|
dbolser-ebi/ensembl-production
|
70af4644b051b1b6b288871ad1b16efc8d65da90
|
[
"Apache-2.0"
] | null | null | null |
scripts/alternative_splicing/AltSplicingToolkit/src/gff/BioMartGffHandler.cpp
|
dbolser-ebi/ensembl-production
|
70af4644b051b1b6b288871ad1b16efc8d65da90
|
[
"Apache-2.0"
] | null | null | null |
scripts/alternative_splicing/AltSplicingToolkit/src/gff/BioMartGffHandler.cpp
|
dbolser-ebi/ensembl-production
|
70af4644b051b1b6b288871ad1b16efc8d65da90
|
[
"Apache-2.0"
] | null | null | null |
/*
* Copyright [1999-2013] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
*
* 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 "BioMartGffHandler.h"
#include "util/Logger.h"
#include <log4cpp/Category.hh>
#include <log4cpp/Appender.hh>
namespace gff {
BioMartGffHandler::BioMartGffHandler()
{
limit = 0;
//log4cpp::Appender* appender = util::Logger::getAppender();
//parserLog = log4cpp::Category::getInstance(std::string("parser"));
//parserLog.addAppender(appender);
}
BioMartGffHandler::BioMartGffHandler(int limit)
{
this->limit = limit;
}
BioMartGffHandler::~BioMartGffHandler()
{
//cout << "destroy BioMartGffHandler " << endl;
}
void BioMartGffHandler::start()
{
log4cpp::Category& root = log4cpp::Category::getRoot();
//cerr << "get root priority" << root.getRootPriority() << endl;
root.info("start BioMart parsing.");
countExons = 0;
countTranscripts = 0;
countGenes = 0;
exonStart = 0;
exonEnd = 0;
strand = 0;
chr = "";
newGene = false;
}
bool BioMartGffHandler::newline(string & str)
{
// parse the current line
log4cpp::Category& root = log4cpp::Category::getRoot();
if (limit > 0 && countGenes == limit) {
return false;
} else {
bool bExon = false;
column = 0;
boost::sregex_token_iterator it(str.begin(), str.end(), eTab, -1);
while(it != noMoreTokens)
{
if ( column <= GFF_TYPE || bExon )
{
switch (column) {
case GFF_CHR:
chr = *it;
break;
case GFF_STRAND:
strand = (it->compare("+") == 0) ? 1 : -1;
break;
case GFF_TYPE:
bExon = (it->compare("exon") == 0);
break;
case GFF_START:
exonStart = util::StringUtil::ToInt(*it);
break;
case GFF_END:
exonEnd = util::StringUtil::ToInt(*it);
break;
case GFF_COMMENTS:
// split the string in pieces
int countComments = 0;
string comments = *it;
boost::sregex_token_iterator itComments(comments.begin(), comments.end(), eComma, -1);
while(itComments != noMoreTokens)
{
string token = *itComments;
string identifier;
boost::sregex_token_iterator itID(token.begin(), token.end(), eFeatureId, 1);
if(itID != noMoreTokens)
{
identifier = *itID;
}
switch (countComments) {
case GFF_GENE_ID:
/**
* If the gene identifier has changed,
* we have to report it to find the splicing events
* on the current gene.
*/
if (geneIdentifier.compare(identifier) != 0) {
// check if we had a previous gene
newGene = (geneIdentifier.length() > 0);
geneIdentifier = identifier;
}
break;
case GFF_TRANSCRIPT_ID:
transcriptIdentifier = identifier;
break;
case GFF_EXON_ID:
exonIdentifier = identifier;
break;
} // end countComments
itComments++;
countComments++;
} // while comments
break;
}
}
// move to next column
it++;
column++;
}
/**
* fire an GffNewGene event.
*/
if (newGene)
fireNewgeneEvent();
// now that all the information is parsed.
// look if it's a new transcript
if(transcriptIdentifier.compare(currentTranscript) != 0) {
currentTranscript = transcriptIdentifier;
root.infoStream()<< currentTranscript << "(chr: " << chr << " strand: " << strand << ")" << log4cpp::eol;
// create a new transcript on the heap
Transcript *transcript = new Transcript(transcriptIdentifier);
transcript->setGene(shared_ptr<Gene>(new Gene(geneIdentifier)));
transcript->setStrand(strand);
transcript->setChromosome(chr);
// use insert instead of direct assignment.
transcripts[currentTranscript].reset(transcript);
//transcripts[currentTranscript] = new shared_ptr< Transcript >(transcript);
//transcripts.insert(currentTranscript, new shared_ptr< Transcript >(transcript) );
}
if (bExon) {
// we don't want to duplicate exons
shared_ptr< Exon > pExon;
// is the exon already stored?
// check whether it's in the hash map
// if not, add it to the map
map<string, shared_ptr<Exon> >::const_iterator ii = exons.find( exonIdentifier );
root.infoStream() << "\tExon: " << exonIdentifier << log4cpp::eol;
if ( ii == exons.end() ) {
// create a new exon on the heap
//cout << exonIdentifier + "\t" << exonStart << "\t" << exonEnd << endl;
// create a new feature
Exon *exon = new Exon(exonIdentifier);
exon->setStart(exonStart);
exon->setEnd(exonEnd);
exon->setStrand(strand);
exon->setChromosome(chr);
// count the number of elements in the map
// and assigned the current size to the feature
exon->setIndex(exons.size()+1);
// exons[exonIdentifier] = exon;
//shared_ptr< Exon > pExon(exon);
//exons[exonIdentifier] = exon;
exons[exonIdentifier].reset(exon);
//exons.insert(exonIdentifier, pExon);
}
//
// add the shared pointer to the new exon to the transcript
//
transcripts[currentTranscript]->addExon(exons[exonIdentifier]);
//
// conversely add the transcript reference.
//
exons[exonIdentifier]->addTranscript(transcripts[currentTranscript]);
//path.push_back(exonIdentifier);
previousExon = exonIdentifier;
}
return true;
}
}
void BioMartGffHandler::end()
{
if (transcripts.size() > 0)
fireNewgeneEvent();
}
const map<string, shared_ptr< Exon > >&BioMartGffHandler::getExons()
{
return exons;
}
const map<string, shared_ptr< Transcript > >&BioMartGffHandler::getTranscripts()
{
return transcripts;
}
void BioMartGffHandler::fireNewgeneEvent() {
//cout << exons.size() << " exons parsed." << std::endl;
//cout << transcripts.size() << " transcripts parsed." << std::endl;
// fire new gene event
log4cpp::Category& root = log4cpp::Category::getRoot();
root.info("\n*** " + geneIdentifier + " ***\n");
triggerEvent(shared_ptr<GffNewGeneEvent>(new GffNewGeneEvent(transcripts, exons)));
// then reset the exons list and transcript list.
//cout << "clear the current transcript list " << transcripts.size() << endl;
transcripts.clear();
//cout << "current transcript list done " << transcripts.size() << endl;
//cout << "clear the current exon list " << exons.size() << endl;
exons.clear();
//cout << "current exon list done " << exons.size() << endl;
//cout << "fireNewgeneEvent end" << endl;
// purge the current status
newGene = false;
countGenes++;
}
}
| 26.902685
| 111
| 0.569041
|
dbolser-ebi
|
7aed715ef9ebe3d0c540d0b86c92e8f17661c4c3
| 105
|
hh
|
C++
|
build/x86/mem/protocol/Message.hh
|
billionshang/gem5
|
18cc4294f32315595f865d07d1f33434e92b06b2
|
[
"BSD-3-Clause"
] | null | null | null |
build/x86/mem/protocol/Message.hh
|
billionshang/gem5
|
18cc4294f32315595f865d07d1f33434e92b06b2
|
[
"BSD-3-Clause"
] | null | null | null |
build/x86/mem/protocol/Message.hh
|
billionshang/gem5
|
18cc4294f32315595f865d07d1f33434e92b06b2
|
[
"BSD-3-Clause"
] | null | null | null |
#include "/mnt/hgfs/ShareShen/gem5-origin-stable-2015-9-3/build/x86/mem/ruby/slicc_interface/Message.hh"
| 52.5
| 104
| 0.8
|
billionshang
|
7aee2b1245a3c594ce397943a8c0548854afb060
| 159
|
cpp
|
C++
|
Chapter1/Excercise15.cpp
|
yapbenzet/absolute-c-plusplus
|
67adef6c177e7ef3c71406cd26cef2a944fd0d19
|
[
"MIT"
] | 1
|
2019-08-13T17:51:24.000Z
|
2019-08-13T17:51:24.000Z
|
Chapter1/Excercise15.cpp
|
yapbenzet/absolute-c-plusplus
|
67adef6c177e7ef3c71406cd26cef2a944fd0d19
|
[
"MIT"
] | null | null | null |
Chapter1/Excercise15.cpp
|
yapbenzet/absolute-c-plusplus
|
67adef6c177e7ef3c71406cd26cef2a944fd0d19
|
[
"MIT"
] | 1
|
2020-06-05T13:37:56.000Z
|
2020-06-05T13:37:56.000Z
|
#include <iostream>
#include <string>
using namespace std;
int main() {
string s1 = "5";
string s2 = "3";
string s3 = s1 + s2;
cout << s3 << endl;
}
| 13.25
| 22
| 0.578616
|
yapbenzet
|
7aeee5aad78a4ab307997ac05137ee63e7b9b340
| 30,880
|
cpp
|
C++
|
test/qupzilla-master/src/plugins/TabManager/tabmanagerwidget.cpp
|
JamesMBallard/qmake-unity
|
cf5006a83e7fb1bbd173a9506771693a673d387f
|
[
"MIT"
] | 16
|
2019-05-23T08:10:39.000Z
|
2021-12-21T11:20:37.000Z
|
test/qupzilla-master/src/plugins/TabManager/tabmanagerwidget.cpp
|
JamesMBallard/qmake-unity
|
cf5006a83e7fb1bbd173a9506771693a673d387f
|
[
"MIT"
] | null | null | null |
test/qupzilla-master/src/plugins/TabManager/tabmanagerwidget.cpp
|
JamesMBallard/qmake-unity
|
cf5006a83e7fb1bbd173a9506771693a673d387f
|
[
"MIT"
] | 2
|
2019-05-23T18:37:43.000Z
|
2021-08-24T21:29:40.000Z
|
/* ============================================================
* TabManager plugin for QupZilla
* Copyright (C) 2013-2017 S. Razi Alavizadeh <s.r.alavizadeh@gmail.com>
* Copyright (C) 2018 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */
#include "tabmanagerwidget.h"
#include "ui_tabmanagerwidget.h"
#include "mainapplication.h"
#include "browserwindow.h"
#include "webtab.h"
#include "webpage.h"
#include "tabbedwebview.h"
#include "tabwidget.h"
#include "locationbar.h"
#include "bookmarkstools.h"
#include "bookmarkitem.h"
#include "bookmarks.h"
#include "tabmanagerplugin.h"
#include "tldextractor/tldextractor.h"
#include "tabmanagerdelegate.h"
#include "tabcontextmenu.h"
#include "tabbar.h"
#include <QDesktopWidget>
#include <QDialogButtonBox>
#include <QStackedWidget>
#include <QDialog>
#include <QTimer>
#include <QLabel>
#include <QMimeData>
TLDExtractor* TabManagerWidget::s_tldExtractor = 0;
TabManagerWidget::TabManagerWidget(BrowserWindow* mainClass, QWidget* parent, bool defaultWidget)
: QWidget(parent)
, ui(new Ui::TabManagerWidget)
, p_QupZilla(mainClass)
, m_webPage(0)
, m_isRefreshing(false)
, m_refreshBlocked(false)
, m_waitForRefresh(false)
, m_isDefaultWidget(defaultWidget)
{
if(s_tldExtractor == 0)
{
s_tldExtractor = TLDExtractor::instance();
s_tldExtractor->setDataSearchPaths(QStringList() << TabManagerPlugin::settingsPath());
}
ui->setupUi(this);
ui->treeWidget->setSelectionMode(QTreeWidget::SingleSelection);
ui->treeWidget->setUniformRowHeights(true);
ui->treeWidget->setColumnCount(2);
ui->treeWidget->header()->hide();
ui->treeWidget->header()->setStretchLastSection(false);
ui->treeWidget->header()->setSectionResizeMode(0, QHeaderView::Stretch);
ui->treeWidget->header()->setSectionResizeMode(1, QHeaderView::Fixed);
ui->treeWidget->header()->resizeSection(1, 16);
ui->treeWidget->setExpandsOnDoubleClick(false);
ui->treeWidget->setContextMenuPolicy(Qt::CustomContextMenu);
ui->treeWidget->installEventFilter(this);
ui->filterBar->installEventFilter(this);
QPushButton* closeButton = new QPushButton(ui->filterBar);
closeButton->setFlat(true);
closeButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarCloseButton));
ui->filterBar->addWidget(closeButton, LineEdit::RightSide);
ui->filterBar->hide();
ui->treeWidget->setItemDelegate(new TabManagerDelegate(ui->treeWidget));
connect(closeButton, SIGNAL(clicked(bool)), this, SLOT(filterBarClosed()));
connect(ui->filterBar, SIGNAL(textChanged(QString)), this, SLOT(filterChanged(QString)));
connect(ui->treeWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(onItemActivated(QTreeWidgetItem*,int)));
connect(ui->treeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(customContextMenuRequested(QPoint)));
connect(ui->treeWidget, SIGNAL(requestRefreshTree()), this, SLOT(delayedRefreshTree()));
}
TabManagerWidget::~TabManagerWidget()
{
delete ui;
}
void TabManagerWidget::setGroupType(GroupType type)
{
m_groupType = type;
}
QString TabManagerWidget::domainFromUrl(const QUrl &url, bool useHostName)
{
QString appendString = QL1S(":");
QString urlString = url.toString();
if (url.scheme() == "file") {
return tr("Local File System:");
}
else if (url.scheme() == "qupzilla" || urlString.isEmpty()) {
return tr("QupZilla:");
}
else if (url.scheme() == "ftp") {
appendString.prepend(tr(" [FTP]"));
}
QString host = url.host();
if (host.isEmpty()) {
return urlString.append(appendString);
}
if (useHostName || host.contains(QRegExp("^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$"))) {
if (host.startsWith("www.", Qt::CaseInsensitive)) {
host.remove(0, 4);
}
return host.append(appendString);
}
else {
const QString registeredDomain = s_tldExtractor->registrableDomain(host);
if (!registeredDomain.isEmpty()) {
host = registeredDomain;
}
return host.append(appendString);
}
}
void TabManagerWidget::delayedRefreshTree(WebPage* p)
{
if (m_refreshBlocked || m_waitForRefresh) {
return;
}
if (m_isRefreshing && !p) {
return;
}
m_webPage = p;
m_waitForRefresh = true;
QTimer::singleShot(50, this, SLOT(refreshTree()));
}
void TabManagerWidget::refreshTree()
{
if (m_refreshBlocked) {
return;
}
if (m_isRefreshing && !m_webPage) {
return;
}
// store selected items
QList<QWidget*> selectedTabs;
for (int i = 0; i < ui->treeWidget->topLevelItemCount(); ++i) {
QTreeWidgetItem* winItem = ui->treeWidget->topLevelItem(i);
if (winItem->checkState(0) == Qt::Unchecked) {
continue;
}
for (int j = 0; j < winItem->childCount(); ++j) {
TabItem* tabItem = static_cast<TabItem*>(winItem->child(j));
if (!tabItem || tabItem->checkState(0) == Qt::Unchecked) {
continue;
}
selectedTabs << tabItem->webTab();
}
}
ui->treeWidget->clear();
ui->treeWidget->setEnableDragTabs(m_groupType == GroupByWindow);
QTreeWidgetItem* currentTabItem = nullptr;
if (m_groupType == GroupByHost) {
currentTabItem = groupByDomainName(true);
}
else if (m_groupType == GroupByDomain) {
currentTabItem = groupByDomainName();
}
else { // fallback to GroupByWindow
m_groupType = GroupByWindow;
currentTabItem = groupByWindow();
}
// restore selected items
for (int i = 0; i < ui->treeWidget->topLevelItemCount(); ++i) {
QTreeWidgetItem* winItem = ui->treeWidget->topLevelItem(i);
for (int j = 0; j < winItem->childCount(); ++j) {
TabItem* tabItem = static_cast<TabItem*>(winItem->child(j));
if (tabItem && selectedTabs.contains(tabItem->webTab())) {
tabItem->setCheckState(0, Qt::Checked);
}
}
}
filterChanged(m_filterText, true);
ui->treeWidget->expandAll();
if (currentTabItem)
ui->treeWidget->scrollToItem(currentTabItem, QAbstractItemView::EnsureVisible);
m_isRefreshing = false;
m_waitForRefresh = false;
}
void TabManagerWidget::onItemActivated(QTreeWidgetItem* item, int column)
{
TabItem* tabItem = static_cast<TabItem*>(item);
if (!tabItem) {
return;
}
BrowserWindow* mainWindow = tabItem->window();
QWidget* tabWidget = tabItem->webTab();
if (column == 1) {
if (item->childCount() > 0)
QMetaObject::invokeMethod(mainWindow ? mainWindow : mApp->getWindow(), "addTab");
else if (tabWidget && mainWindow)
mainWindow->tabWidget()->requestCloseTab(mainWindow->tabWidget()->indexOf(tabWidget));
return;
}
if (!mainWindow) {
return;
}
if (mainWindow->isMinimized()) {
mainWindow->showNormal();
}
else {
mainWindow->show();
}
mainWindow->activateWindow();
mainWindow->raise();
mainWindow->weView()->setFocus();
if (tabWidget && tabWidget != mainWindow->tabWidget()->currentWidget()) {
mainWindow->tabWidget()->setCurrentIndex(mainWindow->tabWidget()->indexOf(tabWidget));
}
}
bool TabManagerWidget::isTabSelected()
{
bool selected = false;
for (int i = 0; i < ui->treeWidget->topLevelItemCount(); ++i) {
QTreeWidgetItem* parentItem = ui->treeWidget->topLevelItem(i);
if (parentItem->checkState(0) != Qt::Unchecked) {
selected = true;
break;
}
}
return selected;
}
void TabManagerWidget::customContextMenuRequested(const QPoint &pos)
{
QMenu* menu = nullptr;
TabItem* item = static_cast<TabItem*>(ui->treeWidget->itemAt(pos));
if (item) {
BrowserWindow* mainWindow = item->window();
QWidget* tabWidget = item->webTab();
if (mainWindow && tabWidget) {
int index = mainWindow->tabWidget()->indexOf(tabWidget);
// if items are not grouped by Window then actions "Close Other Tabs",
// "Close Tabs To The Bottom" and "Close Tabs To The Top"
// are ambiguous and should be hidden.
TabContextMenu::Options options = TabContextMenu::VerticalTabs;
if (m_groupType == GroupByWindow) {
options |= TabContextMenu::ShowCloseOtherTabsActions;
}
menu = new TabContextMenu(index, mainWindow, options);
menu->addSeparator();
}
}
if (!menu)
menu = new QMenu;
menu->setAttribute(Qt::WA_DeleteOnClose);
QAction* action;
QMenu groupTypeSubmenu(tr("Group by"));
action = groupTypeSubmenu.addAction(tr("&Window"), this, SLOT(changeGroupType()));
action->setData(GroupByWindow);
action->setCheckable(true);
action->setChecked(m_groupType == GroupByWindow);
action = groupTypeSubmenu.addAction(tr("&Domain"), this, SLOT(changeGroupType()));
action->setData(GroupByDomain);
action->setCheckable(true);
action->setChecked(m_groupType == GroupByDomain);
action = groupTypeSubmenu.addAction(tr("&Host"), this, SLOT(changeGroupType()));
action->setData(GroupByHost);
action->setCheckable(true);
action->setChecked(m_groupType == GroupByHost);
menu->addMenu(&groupTypeSubmenu);
if (m_isDefaultWidget) {
menu->addAction(QIcon(":/tabmanager/data/side-by-side.png"), tr("&Show side by side"), this, SIGNAL(showSideBySide()))->setObjectName("sideBySide");
}
menu->addSeparator();
if (isTabSelected()) {
menu->addAction(QIcon(":/tabmanager/data/tab-detach.png"), tr("&Detach checked tabs"), this, SLOT(processActions()))->setObjectName("detachSelection");
menu->addAction(QIcon(":/tabmanager/data/tab-bookmark.png"), tr("Book&mark checked tabs"), this, SLOT(processActions()))->setObjectName("bookmarkSelection");
menu->addAction(QIcon(":/tabmanager/data/tab-close.png"), tr("&Close checked tabs"), this, SLOT(processActions()))->setObjectName("closeSelection");
menu->addAction(tr("&Unload checked tabs"), this, SLOT(processActions()))->setObjectName("unloadSelection");
}
menu->exec(ui->treeWidget->viewport()->mapToGlobal(pos));
}
void TabManagerWidget::filterChanged(const QString &filter, bool force)
{
if (force || filter != m_filterText) {
m_filterText = filter.simplified();
ui->treeWidget->itemDelegate()->setProperty("filterText", m_filterText);
if (m_filterText.isEmpty()) {
for (int i = 0; i < ui->treeWidget->topLevelItemCount(); ++i) {
QTreeWidgetItem* parentItem = ui->treeWidget->topLevelItem(i);
for (int j = 0; j < parentItem->childCount(); ++j) {
QTreeWidgetItem* childItem = parentItem->child(j);
childItem->setHidden(false);
}
parentItem->setHidden(false);
parentItem->setExpanded(true);
}
return;
}
const QRegularExpression filterRegExp(filter.simplified().replace(QChar(' '), QLatin1String(".*"))
.append(QLatin1String(".*")).prepend(QLatin1String(".*")),
QRegularExpression::CaseInsensitiveOption);
for (int i = 0; i < ui->treeWidget->topLevelItemCount(); ++i) {
QTreeWidgetItem* parentItem = ui->treeWidget->topLevelItem(i);
int visibleChildCount = 0;
for (int j = 0; j < parentItem->childCount(); ++j) {
TabItem* childItem = static_cast<TabItem*>(parentItem->child(j));
if (!childItem) {
continue;
}
if (childItem->text(0).contains(filterRegExp) || childItem->webTab()->url().toString().simplified().contains(filterRegExp)) {
++visibleChildCount;
childItem->setHidden(false);
}
else {
childItem->setHidden(true);
}
}
if (visibleChildCount == 0) {
parentItem->setHidden(true);
}
else {
parentItem->setHidden(false);
parentItem->setExpanded(true);
}
}
}
}
void TabManagerWidget::filterBarClosed()
{
ui->filterBar->clear();
ui->filterBar->hide();
ui->treeWidget->setFocusProxy(0);
ui->treeWidget->setFocus();
}
bool TabManagerWidget::eventFilter(QObject* obj, QEvent* event)
{
if (event->type() == QEvent::KeyPress) {
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
const QString text = keyEvent->text().simplified();
if (obj == ui->treeWidget) {
// switch to tab/window on enter
if (keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Return) {
onItemActivated(ui->treeWidget->currentItem(), 0);
return QObject::eventFilter(obj, event);
}
if (!text.isEmpty() || ((keyEvent->modifiers() & Qt::ControlModifier) && keyEvent->key() == Qt::Key_F)) {
ui->filterBar->show();
ui->treeWidget->setFocusProxy(ui->filterBar);
ui->filterBar->setFocus();
if (!text.isEmpty() && text.at(0).isPrint()) {
ui->filterBar->setText(ui->filterBar->text() + text);
}
return true;
}
}
else if (obj == ui->filterBar) {
bool isNavigationOrActionKey = keyEvent->key() == Qt::Key_Up ||
keyEvent->key() == Qt::Key_Down ||
keyEvent->key() == Qt::Key_PageDown ||
keyEvent->key() == Qt::Key_PageUp ||
keyEvent->key() == Qt::Key_Enter ||
keyEvent->key() == Qt::Key_Return;
// send scroll or action press key to treeWidget
if (isNavigationOrActionKey) {
QKeyEvent ev(QKeyEvent::KeyPress, keyEvent->key(), keyEvent->modifiers());
QApplication::sendEvent(ui->treeWidget, &ev);
return false;
}
}
}
if (obj == ui->treeWidget && (event->type() == QEvent::Resize || event->type() == QEvent::Show))
ui->treeWidget->setColumnHidden(1, ui->treeWidget->viewport()->width() < 150);
return QObject::eventFilter(obj, event);
}
void TabManagerWidget::processActions()
{
if (!sender()) {
return;
}
m_refreshBlocked = true;
QHash<BrowserWindow*, WebTab*> selectedTabs;
const QString &command = sender()->objectName();
for (int i = 0; i < ui->treeWidget->topLevelItemCount(); ++i) {
QTreeWidgetItem* winItem = ui->treeWidget->topLevelItem(i);
if (winItem->checkState(0) == Qt::Unchecked) {
continue;
}
for (int j = 0; j < winItem->childCount(); ++j) {
TabItem* tabItem = static_cast<TabItem*>(winItem->child(j));
if (!tabItem || tabItem->checkState(0) == Qt::Unchecked) {
continue;
}
BrowserWindow* mainWindow = tabItem->window();
WebTab* webTab = tabItem->webTab();
// current supported actions are not applied to pinned tabs
if (webTab->isPinned()) {
tabItem->setCheckState(0, Qt::Unchecked);
continue;
}
selectedTabs.insertMulti(mainWindow, webTab);
}
winItem->setCheckState(0, Qt::Unchecked);
}
if (!selectedTabs.isEmpty()) {
if (command == "closeSelection") {
closeSelectedTabs(selectedTabs);
}
else if (command == "detachSelection") {
detachSelectedTabs(selectedTabs);
}
else if (command == "bookmarkSelection") {
bookmarkSelectedTabs(selectedTabs);
}
else if (command == "unloadSelection") {
unloadSelectedTabs(selectedTabs);
}
}
m_refreshBlocked = false;
delayedRefreshTree();
}
void TabManagerWidget::changeGroupType()
{
QAction* action = qobject_cast<QAction*>(sender());
if (action) {
int type = action->data().toInt();
if (m_groupType != GroupType(type)) {
m_groupType = GroupType(type);
delayedRefreshTree();
emit groupTypeChanged(m_groupType);
}
}
}
void TabManagerWidget::closeSelectedTabs(const QHash<BrowserWindow*, WebTab*> &tabsHash)
{
if (tabsHash.isEmpty()) {
return;
}
const QList<BrowserWindow*> &windows = tabsHash.uniqueKeys();
foreach (BrowserWindow* mainWindow, windows) {
QList<WebTab*> tabs = tabsHash.values(mainWindow);
foreach (WebTab* webTab, tabs) {
mainWindow->tabWidget()->requestCloseTab(webTab->tabIndex());
}
}
}
static void detachTabsTo(BrowserWindow* targetWindow, const QHash<BrowserWindow*, WebTab*> &tabsHash)
{
const QList<BrowserWindow*> &windows = tabsHash.uniqueKeys();
foreach (BrowserWindow* mainWindow, windows) {
const QList<WebTab*> &tabs = tabsHash.values(mainWindow);
foreach (WebTab* webTab, tabs) {
mainWindow->tabWidget()->detachTab(webTab);
if (mainWindow && mainWindow->tabCount() == 0) {
mainWindow->close();
mainWindow = 0;
}
targetWindow->tabWidget()->addView(webTab, Qz::NT_NotSelectedTab);
}
}
}
void TabManagerWidget::detachSelectedTabs(const QHash<BrowserWindow*, WebTab*> &tabsHash)
{
if (tabsHash.isEmpty() ||
(tabsHash.uniqueKeys().size() == 1 &&
tabsHash.size() == tabsHash.keys().at(0)->tabCount())) {
return;
}
BrowserWindow* newWindow = mApp->createWindow(Qz::BW_OtherRestoredWindow);
newWindow->move(mApp->desktop()->availableGeometry(this).topLeft() + QPoint(30, 30));
detachTabsTo(newWindow, tabsHash);
}
bool TabManagerWidget::bookmarkSelectedTabs(const QHash<BrowserWindow*, WebTab*> &tabsHash)
{
QDialog* dialog = new QDialog(getQupZilla(), Qt::WindowStaysOnTopHint | Qt::MSWindowsFixedSizeDialogHint);
QBoxLayout* layout = new QBoxLayout(QBoxLayout::TopToBottom, dialog);
QLabel* label = new QLabel(dialog);
BookmarksFoldersButton* folderButton = new BookmarksFoldersButton(dialog);
QDialogButtonBox* box = new QDialogButtonBox(dialog);
box->addButton(QDialogButtonBox::Ok);
box->addButton(QDialogButtonBox::Cancel);
QObject::connect(box, SIGNAL(rejected()), dialog, SLOT(reject()));
QObject::connect(box, SIGNAL(accepted()), dialog, SLOT(accept()));
layout->addWidget(label);
layout->addWidget(folderButton);
layout->addWidget(box);
label->setText(tr("Choose folder for bookmarks:"));
dialog->setWindowTitle(tr("Bookmark Selected Tabs"));
QSize size = dialog->size();
size.setWidth(350);
dialog->resize(size);
dialog->exec();
if (dialog->result() == QDialog::Rejected) {
return false;
}
foreach (WebTab* tab, tabsHash) {
if (!tab->url().isEmpty()) {
BookmarkItem* bookmark = new BookmarkItem(BookmarkItem::Url);
bookmark->setTitle(tab->title());
bookmark->setUrl(tab->url());
mApp->bookmarks()->addBookmark(folderButton->selectedFolder(), bookmark);
}
}
delete dialog;
return true;
}
void TabManagerWidget::unloadSelectedTabs(const QHash<BrowserWindow*, WebTab*> &tabsHash)
{
if (tabsHash.isEmpty()) {
return;
}
const QList<BrowserWindow*> &windows = tabsHash.uniqueKeys();
foreach (BrowserWindow* mainWindow, windows) {
QList<WebTab*> tabs = tabsHash.values(mainWindow);
foreach (WebTab* webTab, tabs) {
mainWindow->tabWidget()->unloadTab(webTab->tabIndex());
}
}
}
QTreeWidgetItem* TabManagerWidget::groupByDomainName(bool useHostName)
{
QTreeWidgetItem* currentTabItem = nullptr;
QList<BrowserWindow*> windows = mApp->windows();
int currentWindowIdx = windows.indexOf(getQupZilla());
if (currentWindowIdx == -1) {
// getQupZilla() instance is closing
return nullptr;
}
QMap<QString, QTreeWidgetItem*> tabsGroupedByDomain;
for (int win = 0; win < windows.count(); ++win) {
BrowserWindow* mainWin = windows.at(win);
QList<WebTab*> tabs = mainWin->tabWidget()->allTabs();
for (int tab = 0; tab < tabs.count(); ++tab) {
WebTab* webTab = tabs.at(tab);
if (webTab->webView() && m_webPage == webTab->webView()->page()) {
m_webPage = 0;
continue;
}
QString domain = domainFromUrl(webTab->url(), useHostName);
if (!tabsGroupedByDomain.contains(domain)) {
TabItem* groupItem = new TabItem(ui->treeWidget, false, false, 0, false);
groupItem->setTitle(domain);
groupItem->setIsActiveOrCaption(true);
tabsGroupedByDomain.insert(domain, groupItem);
}
QTreeWidgetItem* groupItem = tabsGroupedByDomain.value(domain);
TabItem* tabItem = new TabItem(ui->treeWidget, false, true, groupItem);
tabItem->setBrowserWindow(mainWin);
tabItem->setWebTab(webTab);
if (webTab == mainWin->weView()->webTab()) {
tabItem->setIsActiveOrCaption(true);
if (mainWin == getQupZilla())
currentTabItem = tabItem;
}
tabItem->updateIcon();
tabItem->setTitle(webTab->title());
}
}
ui->treeWidget->insertTopLevelItems(0, tabsGroupedByDomain.values());
return currentTabItem;
}
QTreeWidgetItem* TabManagerWidget::groupByWindow()
{
QTreeWidgetItem* currentTabItem = nullptr;
QList<BrowserWindow*> windows = mApp->windows();
int currentWindowIdx = windows.indexOf(getQupZilla());
if (currentWindowIdx == -1) {
return nullptr;
}
m_isRefreshing = true;
if (!m_isDefaultWidget) {
windows.move(currentWindowIdx, 0);
currentWindowIdx = 0;
}
for (int win = 0; win < windows.count(); ++win) {
BrowserWindow* mainWin = windows.at(win);
TabItem* winItem = new TabItem(ui->treeWidget, true, false);
winItem->setBrowserWindow(mainWin);
winItem->setText(0, tr("Window %1").arg(QString::number(win + 1)));
winItem->setToolTip(0, tr("Double click to switch"));
winItem->setIsActiveOrCaption(win == currentWindowIdx);
QList<WebTab*> tabs = mainWin->tabWidget()->allTabs();
for (int tab = 0; tab < tabs.count(); ++tab) {
WebTab* webTab = tabs.at(tab);
if (webTab->webView() && m_webPage == webTab->webView()->page()) {
m_webPage = 0;
continue;
}
TabItem* tabItem = new TabItem(ui->treeWidget, true, true, winItem);
tabItem->setBrowserWindow(mainWin);
tabItem->setWebTab(webTab);
if (webTab == mainWin->weView()->webTab()) {
tabItem->setIsActiveOrCaption(true);
if (mainWin == getQupZilla())
currentTabItem = tabItem;
}
tabItem->updateIcon();
tabItem->setTitle(webTab->title());
}
}
return currentTabItem;
}
BrowserWindow* TabManagerWidget::getQupZilla()
{
if (m_isDefaultWidget || !p_QupZilla) {
return mApp->getWindow();
}
else {
return p_QupZilla.data();
}
}
TabItem::TabItem(QTreeWidget* treeWidget, bool supportDrag, bool isTab, QTreeWidgetItem* parent, bool addToTree)
: QObject()
, QTreeWidgetItem(addToTree ? (parent ? parent : treeWidget->invisibleRootItem()) : 0, 1)
, m_treeWidget(treeWidget)
, m_window(0)
, m_webTab(0)
, m_isTab(isTab)
{
Qt::ItemFlags flgs = flags() | (parent ? Qt::ItemIsUserCheckable : Qt::ItemIsUserCheckable | Qt::ItemIsTristate);
if (supportDrag) {
if (isTab) {
flgs |= Qt::ItemIsDragEnabled | Qt::ItemNeverHasChildren;
flgs &= ~Qt::ItemIsDropEnabled;
}
else {
flgs |= Qt::ItemIsDropEnabled;
flgs &= ~Qt::ItemIsDragEnabled;
}
}
setFlags(flgs);
setCheckState(0, Qt::Unchecked);
}
BrowserWindow* TabItem::window() const
{
return m_window;
}
void TabItem::setBrowserWindow(BrowserWindow* window)
{
m_window = window;
}
WebTab* TabItem::webTab() const
{
return m_webTab;
}
void TabItem::setWebTab(WebTab* webTab)
{
m_webTab = webTab;
if (m_webTab->isRestored())
setIsActiveOrCaption(m_webTab->isCurrentTab());
else
setIsSavedTab(true);
connect(m_webTab->webView(), SIGNAL(titleChanged(QString)), this, SLOT(setTitle(QString)));
connect(m_webTab->webView(), SIGNAL(iconChanged(QIcon)), this, SLOT(updateIcon()));
auto pageChanged = [this](WebPage *page) {
connect(page, &WebPage::audioMutedChanged, this, &TabItem::updateIcon);
connect(page, &WebPage::loadFinished, this, &TabItem::updateIcon);
connect(page, &WebPage::loadStarted, this, &TabItem::updateIcon);
};
pageChanged(m_webTab->webView()->page());
connect(m_webTab->webView(), &WebView::pageChanged, this, pageChanged);
}
void TabItem::updateIcon()
{
if (!m_webTab)
return;
if (!m_webTab->isLoading()) {
if (!m_webTab->isPinned()) {
if (m_webTab->isMuted()) {
setIcon(0, QIcon::fromTheme(QSL("audio-volume-muted"), QIcon(QSL(":icons/other/audiomuted.svg"))));
}
else if (!m_webTab->isMuted() && m_webTab->webView()->page()->recentlyAudible()) {
setIcon(0, QIcon::fromTheme(QSL("audio-volume-high"), QIcon(QSL(":icons/other/audioplaying.svg"))));
}
else {
setIcon(0, m_webTab->icon());
}
}
else {
setIcon(0, QIcon(":tabmanager/data/tab-pinned.png"));
}
if (m_webTab->isRestored())
setIsActiveOrCaption(m_webTab->isCurrentTab());
else
setIsSavedTab(true);
}
else {
setIcon(0, QIcon(":tabmanager/data/tab-loading.png"));
setIsActiveOrCaption(m_webTab->isCurrentTab());
}
}
void TabItem::setTitle(const QString &title)
{
setText(0, title);
setToolTip(0, title);
}
void TabItem::setIsActiveOrCaption(bool yes)
{
setData(0, ActiveOrCaptionRole, yes ? QVariant(true) : QVariant());
setIsSavedTab(false);
}
void TabItem::setIsSavedTab(bool yes)
{
setData(0, SavedRole, yes ? QVariant(true) : QVariant());
}
bool TabItem::isTab() const
{
return m_isTab;
}
TabTreeWidget::TabTreeWidget(QWidget *parent)
: QTreeWidget(parent)
{
invisibleRootItem()->setFlags(invisibleRootItem()->flags() & ~Qt::ItemIsDropEnabled);
}
Qt::DropActions TabTreeWidget::supportedDropActions() const
{
return Qt::MoveAction | Qt::CopyAction;
}
#define MIMETYPE QLatin1String("application/qupzilla.tabs")
QStringList TabTreeWidget::mimeTypes() const
{
QStringList types;
types.append(MIMETYPE);
return types;
}
QMimeData *TabTreeWidget::mimeData(const QList<QTreeWidgetItem*> items) const
{
QMimeData* mimeData = new QMimeData();
QByteArray encodedData;
QDataStream stream(&encodedData, QIODevice::WriteOnly);
if (items.size() > 0) {
TabItem* tabItem = static_cast<TabItem*>(items.at(0));
if (!tabItem || !tabItem->isTab())
return 0;
stream << (quintptr) tabItem->window() << (quintptr) tabItem->webTab();
mimeData->setData(MIMETYPE, encodedData);
return mimeData;
}
return 0;
}
bool TabTreeWidget::dropMimeData(QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action)
{
if (action == Qt::IgnoreAction) {
return true;
}
TabItem* parentItem = static_cast<TabItem*>(parent);
if (!data->hasFormat(MIMETYPE) || !parentItem) {
return false;
}
Q_ASSERT(!parentItem->isTab());
BrowserWindow* targetWindow = parentItem->window();
QByteArray encodedData = data->data(MIMETYPE);
QDataStream stream(&encodedData, QIODevice::ReadOnly);
if (!stream.atEnd()) {
quintptr webTabPtr;
quintptr windowPtr;
stream >> windowPtr >> webTabPtr;
WebTab* webTab = (WebTab*) webTabPtr;
BrowserWindow* window = (BrowserWindow*) windowPtr;
if (window == targetWindow) {
if (index > 0 && webTab->tabIndex() < index)
--index;
if (webTab->isPinned() && index >= targetWindow->tabWidget()->pinnedTabsCount())
index = targetWindow->tabWidget()->pinnedTabsCount() - 1;
if (!webTab->isPinned() && index < targetWindow->tabWidget()->pinnedTabsCount())
index = targetWindow->tabWidget()->pinnedTabsCount();
if (index != webTab->tabIndex()) {
targetWindow->tabWidget()->tabBar()->moveTab(webTab->tabIndex(), index);
if (!webTab->isCurrentTab())
emit requestRefreshTree();
}
else {
return false;
}
}
else if (!webTab->isPinned()) {
QHash<BrowserWindow*, WebTab*> tabsHash;
tabsHash.insert(window, webTab);
detachTabsTo(targetWindow, tabsHash);
if (index < targetWindow->tabWidget()->pinnedTabsCount())
index = targetWindow->tabWidget()->pinnedTabsCount();
targetWindow->tabWidget()->tabBar()->moveTab(webTab->tabIndex(), index);
}
}
return true;
}
void TabTreeWidget::setEnableDragTabs(bool enable)
{
setDragEnabled(enable);
setAcceptDrops(enable);
viewport()->setAcceptDrops(enable);
setDropIndicatorShown(enable);
}
| 31.671795
| 165
| 0.60761
|
JamesMBallard
|
7af253211c133ff1d64a36449099be624c5d6939
| 314
|
cpp
|
C++
|
Sandbox/src/main.cpp
|
WhoseTheNerd/Fusion
|
35ab536388392b3ba2e14f288eecbc292abd7dea
|
[
"Apache-2.0"
] | 4
|
2018-11-12T18:43:02.000Z
|
2020-02-02T10:18:56.000Z
|
Sandbox/src/main.cpp
|
WhoseTheNerd/Fusion
|
35ab536388392b3ba2e14f288eecbc292abd7dea
|
[
"Apache-2.0"
] | 2
|
2018-12-22T13:18:05.000Z
|
2019-07-24T20:15:45.000Z
|
Sandbox/src/main.cpp
|
WhoseTheNerd/Fusion
|
35ab536388392b3ba2e14f288eecbc292abd7dea
|
[
"Apache-2.0"
] | null | null | null |
#define F_MAIN_APP
#include <Fusion.h>
#include "SandboxLayer.h"
class SandboxApp : public Fusion::Application
{
public:
SandboxApp()
{
PushLayer(Fusion::CreateRef<Sandbox::SandboxLayer>());
}
};
Fusion::Scope<Fusion::Application> Fusion::CreateApplication()
{
return Fusion::CreateScope<SandboxApp>();
}
| 16.526316
| 62
| 0.735669
|
WhoseTheNerd
|
7af62dc3a32990df3f3b89549c6273f24df6473e
| 2,614
|
cpp
|
C++
|
examples/fxflow/MainWindow.cpp
|
moiggi/nodeeditor
|
8b2ffcfaa934bc69ff9f52e27b4a24859431541d
|
[
"BSD-3-Clause"
] | null | null | null |
examples/fxflow/MainWindow.cpp
|
moiggi/nodeeditor
|
8b2ffcfaa934bc69ff9f52e27b4a24859431541d
|
[
"BSD-3-Clause"
] | null | null | null |
examples/fxflow/MainWindow.cpp
|
moiggi/nodeeditor
|
8b2ffcfaa934bc69ff9f52e27b4a24859431541d
|
[
"BSD-3-Clause"
] | null | null | null |
#include "MainWindow.h"
#include "ui_mainwindow.h"
#include <nodes/Node>
#include <nodes/NodeData>
#include <nodes/FlowScene>
#include <nodes/FlowView>
#include <nodes/FlowViewStyle>
#include <nodes/NodeStyle>
#include <nodes/ConnectionStyle>
#include <nodes/DataModelRegistry>
#include <QApplication>
#include <QScreen>
#include <QFile>
#include "ImageSourceDataModel.hpp"
#include "ImageDisplayDataModel.hpp"
#include "BlurEffectDataModel.hpp"
#include "AlphaBlendEffectDataModel.hpp"
using QtNodes::DataModelRegistry;
using QtNodes::FlowScene;
using QtNodes::FlowView;
using QtNodes::Node;
namespace {
std::shared_ptr<DataModelRegistry> registerDataModels() {
auto ret = std::make_shared<DataModelRegistry>();
ret->registerModel<ImageSourceDataModel>("Sources");
ret->registerModel<ImageDisplayDataModel>("Displays");
ret->registerModel<BlurEffectDataModel>("Effects");
ret->registerModel<AlphaBlendEffectDataModel>("Effects");
return ret;
}
void setStyle() {
QFile file(":Style.json");
if (!file.open(QIODevice::ReadOnly))
{
qWarning() << "Couldn't open Style.json";
return;
}
QString style = file.readAll();
QtNodes::FlowViewStyle::setStyle(style);
QtNodes::NodeStyle::setNodeStyle(style);
QtNodes::ConnectionStyle::setConnectionStyle(style);
}
} //namespace
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow) {
ui->setupUi(this);
::setStyle();
auto scene = new FlowScene(registerDataModels(), this);
ui->effectNodeView->setScene(scene);
connect(scene, &FlowScene::nodeContextMenu, this, [](Node& n, const QPointF& pos) {
qInfo() << "context menu of node: " << n.nodeDataModel()->name() << " @ " << pos;
});
connect(scene, &FlowScene::focusNodeChanged, this, [](Node* newFocus, Node* oldFocus) {
qInfo() << "node focus changed: from" <<
(oldFocus ? oldFocus->nodeDataModel()->name() : "null") << " to " <<
(newFocus ? newFocus->nodeDataModel()->name() : "null");
});
connect(scene, &FlowScene::selectedNodeChanged, this, [](std::vector<Node*> nodes) {
QString selected("selected nodes = ");
for (auto* node : nodes) {
selected += node->nodeDataModel()->name();
}
qDebug() << selected;
});
int screenHeight = QGuiApplication::primaryScreen()->size().height();
ui->imageNodeViewSplitter->setSizes({screenHeight*2/3, screenHeight*1/3});
int screenWidth = QGuiApplication::primaryScreen()->size().width();
ui->effectUISplitter->setSizes({screenWidth*3/4, screenWidth*1/4});
setWindowTitle("FxFlow");
}
MainWindow::~MainWindow() {
delete ui;
}
| 27.515789
| 89
| 0.700459
|
moiggi
|
7afb671172a3c5b0000b57aa60bb884eed9d3444
| 3,206
|
cc
|
C++
|
procedures/wavefrontobj_procedure/ObjBuffer.cc
|
tsubo164/Fujiyama-Renderer
|
a451548ba2f0f6379b523e0abf1df57c664f444c
|
[
"MIT"
] | 36
|
2015-05-28T05:41:10.000Z
|
2021-06-07T15:43:54.000Z
|
procedures/wavefrontobj_procedure/ObjBuffer.cc
|
tsubo164/Fujiyama-Renderer
|
a451548ba2f0f6379b523e0abf1df57c664f444c
|
[
"MIT"
] | 1
|
2015-03-06T16:44:10.000Z
|
2015-06-25T05:45:49.000Z
|
procedures/wavefrontobj_procedure/ObjBuffer.cc
|
tsubo164/Fujiyama-Renderer
|
a451548ba2f0f6379b523e0abf1df57c664f444c
|
[
"MIT"
] | 6
|
2015-01-16T00:15:31.000Z
|
2018-07-08T22:00:08.000Z
|
// Copyright (c) 2011-2020 Hiroshi Tsubokawa
// See LICENSE and README
#include "ObjBuffer.h"
int ObjBufferToMesh(const ObjBuffer &buffer, Mesh &mesh)
{
const int vertex_count = buffer.vertex_count;
const int face_count = buffer.face_count;
const std::vector<Vector> &P = buffer.vertex_position;
const std::vector<Vector> &Np = buffer.point_normal;
const std::vector<Vector> &Nv = buffer.vertex_normal;
const std::vector<Index3> &indices = buffer.position_indices;
const std::vector<int> &face_group_id = buffer.face_group_id;
// P
mesh.SetPointCount(vertex_count);
mesh.AddPointPosition();
for (int i = 0; i < vertex_count; i++) {
mesh.SetPointPosition(i, P[i]);
}
// indices
mesh.SetFaceCount(face_count);
mesh.AddFaceIndices();
for (int i = 0; i < face_count; i++) {
mesh.SetFaceIndices(i, indices[i]);
}
// N
if (!Np.empty()) {
mesh.AddPointNormal();
for (int i = 0; i < vertex_count; i++) {
mesh.SetPointNormal(i, Np[i]);
}
} else if (!Nv.empty()) {
// vertex normal values
Mesh::VertexAttributeAccessor<Vector> vertex_normal = mesh.GetVertexNormal();
Index value_count = buffer.vertex_normal.size();
vertex_normal.ResizeValue(value_count);
for (Index i = 0; i < value_count; i++) {
vertex_normal.SetValue(i, Nv[i]);
}
// vertex normal indices
Index index_count = buffer.normal_indices.size();
vertex_normal.ResizeIndex(index_count * 3);
for (Index i = 0; i < index_count; i++) {
vertex_normal.SetIndex(i * 3 + 0, buffer.normal_indices[i][0]);
vertex_normal.SetIndex(i * 3 + 1, buffer.normal_indices[i][1]);
vertex_normal.SetIndex(i * 3 + 2, buffer.normal_indices[i][2]);
}
}
// face group id
mesh.AddFaceGroupID();
for (int i = 0; i < face_count; i++) {
mesh.SetFaceGroupID(i, face_group_id[i]);
}
// flatten group names
std::vector<std::string> group_names(buffer.group_name_to_id.size());
for (std::map<std::string,int>::const_iterator it = buffer.group_name_to_id.begin();
it != buffer.group_name_to_id.end();
++it) {
const int id = it->second;
group_names[id] = it->first;
}
// set group names
if (!group_names.empty()) {
for (std::size_t i = 0; i < group_names.size(); i++) {
mesh.CreateFaceGroup(group_names[i]);
}
}
mesh.ComputeBounds();
return 0;
}
int ObjBufferComputeNormals(ObjBuffer &buffer)
{
const int vertex_count = buffer.vertex_count;
const int face_count = buffer.face_count;
std::vector<Vector> &P = buffer.vertex_position;
std::vector<Vector> &N = buffer.point_normal;
std::vector<Index3> &indices = buffer.position_indices;
if (P.empty() || indices.empty()) {
return -1;
}
if (!buffer.vertex_normal.empty()) {
return 0;
}
N.resize(vertex_count);
// accumulate N
for (int i = 0; i < face_count; i++) {
const int i0 = indices[i].i0;
const int i1 = indices[i].i1;
const int i2 = indices[i].i2;
const Vector Ng = TriComputeFaceNormal(P[i0], P[i1], P[i2]);
N[i0] += Ng;
N[i1] += Ng;
N[i2] += Ng;
}
// normalize N
for (int i = 0; i < vertex_count; i++) {
N[i] = Normalize(N[i]);
}
return 0;
}
| 27.169492
| 86
| 0.641609
|
tsubo164
|
7afbd7524a0c7582071908e14d160417cc85a9be
| 2,466
|
hpp
|
C++
|
presence/psensor.hpp
|
wak-google/phosphor-fan-presence
|
4978e06c45cfe70f5ccfc6cdce92a35ae5546198
|
[
"Apache-2.0"
] | null | null | null |
presence/psensor.hpp
|
wak-google/phosphor-fan-presence
|
4978e06c45cfe70f5ccfc6cdce92a35ae5546198
|
[
"Apache-2.0"
] | null | null | null |
presence/psensor.hpp
|
wak-google/phosphor-fan-presence
|
4978e06c45cfe70f5ccfc6cdce92a35ae5546198
|
[
"Apache-2.0"
] | 1
|
2017-02-14T01:46:05.000Z
|
2017-02-14T01:46:05.000Z
|
#pragma once
#include <cstdint>
namespace phosphor
{
namespace fan
{
namespace presence
{
/**
* @class PresenceSensor
* @brief PresenceSensor interface.
*
* Provide concrete implementations of PresenceSensor to realize
* new presence detection methods.
*
* Note that implementations drive the inventory update process via
* a redundancy policy (rpolicy.hpp) - it is not enough to implement
* the interfaces below.
*/
class PresenceSensor
{
public:
PresenceSensor(const PresenceSensor&) = default;
PresenceSensor& operator=(const PresenceSensor&) = default;
PresenceSensor(PresenceSensor&&) = default;
PresenceSensor& operator=(PresenceSensor&&) = default;
virtual ~PresenceSensor() = default;
PresenceSensor() : id(nextId)
{
nextId++;
}
/**
* @brief start
*
* Implementations should peform any preparation
* for detecting presence. Typical implementations
* might register signal callbacks or start
* a polling loop.
*
* @return The state of the sensor.
*/
virtual bool start() = 0;
/**
* @brief stop
*
* Implementations should stop issuing presence
* state change notifications. Typical implementations
* might de-register signal callbacks or terminate
* polling loops.
*/
virtual void stop() = 0;
/**
* @brief Check the sensor.
*
* Implementations should perform an offline (the start
* method has not been invoked) query of the presence
* state.
*
* @return The state of the sensor.
*/
virtual bool present() = 0;
/**
* @brief Mark the sensor as failed.
*
* Implementations should log an an event if the
* system policy requires it.
*
* Provide a default noop implementation.
*/
virtual void fail() {}
friend bool operator==(const PresenceSensor& l, const PresenceSensor& r);
private:
/** @brief Unique sensor ID. */
std::size_t id;
/** @brief The next unique sensor ID. */
static std::size_t nextId;
};
inline bool operator==(const PresenceSensor& l, const PresenceSensor &r)
{
return l.id == r.id;
}
} // namespace presence
} // namespace fan
} // namespace phosphor
| 25.6875
| 81
| 0.593268
|
wak-google
|
7afd0beb6eb7291d3d2590691599def05b06cecb
| 474
|
hpp
|
C++
|
src/window_create_info.hpp
|
zfccxt/calcium
|
9cc3a00904c05e675bdb5d35eef0f5356796e564
|
[
"MIT"
] | null | null | null |
src/window_create_info.hpp
|
zfccxt/calcium
|
9cc3a00904c05e675bdb5d35eef0f5356796e564
|
[
"MIT"
] | null | null | null |
src/window_create_info.hpp
|
zfccxt/calcium
|
9cc3a00904c05e675bdb5d35eef0f5356796e564
|
[
"MIT"
] | null | null | null |
#pragma once
#include <cstddef>
#include <string>
#include "colour.hpp"
#include "winding_order.hpp"
namespace cl {
struct WindowCreateInfo {
size_t width = 1280;
size_t height = 720;
std::string title;
bool center = true;
bool enable_backface_cull = true;
WindingOrder front_face = WindingOrder::kClockwise;
bool enable_depth_test = true; // TODO: fully implement this
bool enable_resize = true;
bool enable_vsync = true;
Colour clear_colour;
};
}
| 18.96
| 62
| 0.727848
|
zfccxt
|
7afd440cbed11d69ed87e7ad86886da78ec66e81
| 578
|
cc
|
C++
|
src/lib/utils.cc
|
ppwwyyxx/Ray-Tracing-Engine
|
af3ec164d6b5e5b592a54a75282432d610423ffb
|
[
"MIT"
] | 101
|
2015-01-01T09:24:45.000Z
|
2022-01-22T12:00:24.000Z
|
src/lib/utils.cc
|
ppwwyyxx/Ray-Tracing-Engine
|
af3ec164d6b5e5b592a54a75282432d610423ffb
|
[
"MIT"
] | 1
|
2018-11-23T03:53:47.000Z
|
2018-11-23T05:31:52.000Z
|
src/lib/utils.cc
|
ppwwyyxx/Ray-Tracing-Engine
|
af3ec164d6b5e5b592a54a75282432d610423ffb
|
[
"MIT"
] | 32
|
2015-01-05T15:35:33.000Z
|
2021-12-08T08:17:17.000Z
|
// File: utils.cc
// Author: Yuxin Wu <ppwwyyxxc@gmail.com>
#include "lib/utils.hh"
using namespace std;
string TERM_COLOR(int k) {
// k = 0 ~ 4
ostringstream ss;
ss << "\x1b[3" << k + 2 << "m";
return ss.str();
}
void c_printf(const char* col, const char* fmt, ...) {
va_list ap;
va_start(ap, fmt);
printf("%s", col);
vprintf(fmt, ap);
printf(COLOR_RESET);
va_end(ap);
}
void c_fprintf(const char* col, FILE* fp, const char* fmt, ...) {
va_list ap;
va_start(ap, fmt);
fprintf(fp, "%s", col);
vfprintf(fp, fmt, ap);
fprintf(fp, COLOR_RESET);
va_end(ap);
}
| 17.515152
| 65
| 0.621107
|
ppwwyyxx
|
7afd4adfc1a4233ca2a6af50ef78455d5ffb3eda
| 1,191
|
cpp
|
C++
|
C++/competitive/LeetCode/merge_sorted_array.cpp
|
dipakpawar152000/programming
|
f343857d413c7dcce876c7720c0ffc4e44b63a48
|
[
"Apache-2.0"
] | 33
|
2019-10-20T15:28:26.000Z
|
2021-12-17T22:34:22.000Z
|
C++/competitive/LeetCode/merge_sorted_array.cpp
|
dipakpawar152000/programming
|
f343857d413c7dcce876c7720c0ffc4e44b63a48
|
[
"Apache-2.0"
] | 111
|
2019-05-10T18:52:55.000Z
|
2022-02-04T08:53:42.000Z
|
C++/competitive/LeetCode/merge_sorted_array.cpp
|
dipakpawar152000/programming
|
f343857d413c7dcce876c7720c0ffc4e44b63a48
|
[
"Apache-2.0"
] | 141
|
2019-10-20T15:00:02.000Z
|
2021-03-23T05:51:12.000Z
|
// Copyright 2018 Aman Mehara
//
// 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 <vector>
void merge(std::vector<int>& array_1, int size_1, std::vector<int>& array_2,
int size_2) {
int index = size_1 + size_2 - 1;
int index_1 = size_1 - 1;
int index_2 = size_2 - 1;
while (index_1 >= 0 && index_2 >= 0) {
array_1[index--] = (array_1[index_1] >= array_2[index_2])
? array_1[index_1--]
: array_2[index_2--];
}
while (index_1 >= 0) {
array_1[index--] = array_1[index_1--];
}
while (index_2 >= 0) {
array_1[index--] = array_2[index_2--];
}
}
| 33.083333
| 76
| 0.620487
|
dipakpawar152000
|
7aff3d7f328320eeee555f5743b2451da23beff5
| 193
|
cpp
|
C++
|
src/World/MapTile.cpp
|
tylerreisinger/pony-td
|
ed6c3a82de38a2f1981957c081d16f3959d0c2cb
|
[
"MIT"
] | null | null | null |
src/World/MapTile.cpp
|
tylerreisinger/pony-td
|
ed6c3a82de38a2f1981957c081d16f3959d0c2cb
|
[
"MIT"
] | null | null | null |
src/World/MapTile.cpp
|
tylerreisinger/pony-td
|
ed6c3a82de38a2f1981957c081d16f3959d0c2cb
|
[
"MIT"
] | null | null | null |
#include "MapTile.h"
#include <utility>
MapTile::MapTile(FloorTile floor_tile) : m_floor_tile(std::move(floor_tile)) {}
const FloorTile& MapTile::floor_tile() const { return m_floor_tile; }
| 24.125
| 79
| 0.751295
|
tylerreisinger
|
bb007543e3c345b2761b098ed95d55b408795f5b
| 5,143
|
cpp
|
C++
|
test/unit/test_util_check.cpp
|
eth-cscs/DLA-interface
|
78e24b875601e8830df7bfac18d2f47de39acb9b
|
[
"BSD-3-Clause"
] | 9
|
2018-05-14T12:31:07.000Z
|
2022-01-14T10:09:27.000Z
|
test/unit/test_util_check.cpp
|
eth-cscs/DLA-interface
|
78e24b875601e8830df7bfac18d2f47de39acb9b
|
[
"BSD-3-Clause"
] | 42
|
2018-01-23T13:17:04.000Z
|
2022-02-25T13:47:02.000Z
|
test/unit/test_util_check.cpp
|
eth-cscs/DLA-interface
|
78e24b875601e8830df7bfac18d2f47de39acb9b
|
[
"BSD-3-Clause"
] | 2
|
2018-04-27T07:33:47.000Z
|
2019-04-11T14:06:56.000Z
|
#include "util_check.h"
#include <utility>
#include <stdexcept>
#include "gtest/gtest.h"
#include "matrix_index.h"
using namespace dla_interface;
using namespace testing;
class MockMatrix {
public:
MockMatrix(std::pair<SizeType, SizeType> size) : size_(size) {}
std::pair<SizeType, SizeType> size() const {
return size_;
}
private:
std::pair<SizeType, SizeType> size_;
};
class MockComm {
public:
MockComm() {}
MockComm(const MockComm&) = delete;
MockComm(MockComm&&) = delete;
MockComm& operator=(const MockComm&) = delete;
MockComm& operator=(MockComm&&) = delete;
};
class MockDistMatrix {
public:
MockDistMatrix(std::pair<SizeType, SizeType> size, std::pair<SizeType, SizeType> block_size,
Global2DIndex base_index, const MockComm& comm)
: size_(size), block_size_(block_size), base_index_(base_index), comm_(&comm) {}
std::pair<SizeType, SizeType> size() const {
return size_;
}
std::pair<SizeType, SizeType> blockSize() const {
return block_size_;
}
Global2DIndex baseIndex() const {
return base_index_;
}
const MockComm& commGrid() const {
return *comm_;
}
private:
std::pair<SizeType, SizeType> size_;
std::pair<SizeType, SizeType> block_size_;
Global2DIndex base_index_;
const MockComm* comm_;
};
TEST(CheckUtilTest, CheckIsSquare) {
MockComm comm;
for (int m : {3, 7, 14, 15}) {
for (int n : {3, 7, 14, 15}) {
MockMatrix mat_test(std::make_pair(m, n));
MockDistMatrix dist_mat_test(std::make_pair(m, n), std::make_pair(m / 2, n / 2),
Global2DIndex(m, n), comm);
if (m == n) {
EXPECT_NO_THROW(dlai__util__checkIsSquare(mat_test));
EXPECT_NO_THROW(dlai__util__checkIsSquare(dist_mat_test));
}
else {
EXPECT_THROW(dlai__util__checkIsSquare(mat_test), std::invalid_argument);
EXPECT_THROW(dlai__util__checkIsSquare(dist_mat_test), std::invalid_argument);
}
}
}
}
TEST(CheckUtilTest, CheckBlocksAreSquare) {
MockComm comm;
for (int mb : {3, 7, 14, 15}) {
for (int nb : {3, 7, 14, 15}) {
MockDistMatrix dist_mat_test(std::make_pair(7, 5), std::make_pair(mb, nb),
Global2DIndex(0, 2), comm);
if (mb == nb)
EXPECT_NO_THROW(dlai__util__checkBlocksAreSquare(dist_mat_test));
else
EXPECT_THROW(dlai__util__checkBlocksAreSquare(dist_mat_test), std::invalid_argument);
}
}
}
TEST(CheckUtilTest, CheckBaseIndexAtBlock) {
MockComm comm;
for (int mb : {3, 7, 14, 15}) {
for (int nb : {3, 7, 14, 15}) {
for (int ia : {3, 7, 14, 15}) {
for (int ja : {3, 7, 14, 15}) {
MockDistMatrix dist_mat_test(std::make_pair(7, 5), std::make_pair(mb, nb),
Global2DIndex(ia, ja), comm);
if (ia % mb == 0 && ja % nb == 0)
EXPECT_NO_THROW(dlai__util__checkBaseIndexAtBlock(dist_mat_test));
else
EXPECT_THROW(dlai__util__checkBaseIndexAtBlock(dist_mat_test), std::invalid_argument);
}
}
}
}
}
TEST(CheckUtilTest, CheckSameComm2D) {
MockComm comm1;
MockComm comm2;
MockComm comm3;
std::vector<MockDistMatrix> mat1;
std::vector<MockDistMatrix> mat2;
std::vector<MockDistMatrix> mat3;
for (int m : {13, 17}) {
for (int n : {18, 23}) {
for (int mb : {3, 5}) {
for (int nb : {3, 5}) {
for (int ia : {3, 7}) {
for (int ja : {3, 7}) {
mat1.emplace_back(std::make_pair(m, n), std::make_pair(mb, nb), Global2DIndex(ia, ja),
comm1);
mat2.emplace_back(std::make_pair(m, n), std::make_pair(mb, nb), Global2DIndex(ia, ja),
comm2);
mat3.emplace_back(std::make_pair(m, n), std::make_pair(mb, nb), Global2DIndex(ia, ja),
comm3);
}
}
}
}
}
}
int i0 = 0;
for (size_t i1 = 0; i1 < mat1.size(); ++i1) {
EXPECT_NO_THROW(dlai__util__checkSameComm2D(mat1[i0], mat1[i1]));
EXPECT_NO_THROW(dlai__util__checkSameComm2D(mat2[i0], mat2[i1]));
EXPECT_NO_THROW(dlai__util__checkSameComm2D(mat3[i0], mat3[i1]));
EXPECT_THROW(dlai__util__checkSameComm2D(mat1[i0], mat2[i1]), std::invalid_argument);
EXPECT_THROW(dlai__util__checkSameComm2D(mat1[i0], mat3[i1]), std::invalid_argument);
for (size_t i2 = 0; i2 < mat1.size(); ++i2) {
EXPECT_NO_THROW(dlai__util__checkSameComm2D(mat1[i0], mat1[i1], mat1[i2]));
EXPECT_NO_THROW(dlai__util__checkSameComm2D(mat2[i0], mat2[i1], mat2[i2]));
EXPECT_NO_THROW(dlai__util__checkSameComm2D(mat3[i0], mat3[i1], mat3[i2]));
EXPECT_THROW(dlai__util__checkSameComm2D(mat1[i0], mat1[i1], mat2[i2]), std::invalid_argument);
EXPECT_THROW(dlai__util__checkSameComm2D(mat1[i0], mat2[i1], mat1[i2]), std::invalid_argument);
EXPECT_THROW(dlai__util__checkSameComm2D(mat1[i0], mat2[i1], mat2[i2]), std::invalid_argument);
EXPECT_THROW(dlai__util__checkSameComm2D(mat1[i0], mat2[i1], mat3[i2]), std::invalid_argument);
}
}
}
| 34.059603
| 101
| 0.626288
|
eth-cscs
|
bb01ef490444042e217f29370106795b930b3207
| 868
|
cpp
|
C++
|
02_Estructuras y Archivos/Ejercicios/E13_Archivos05.cpp
|
vazeri/Programacion-Orientada-a-Objetos
|
57d1dc413956e50d31f34c0bb339b32a176f9616
|
[
"MIT"
] | null | null | null |
02_Estructuras y Archivos/Ejercicios/E13_Archivos05.cpp
|
vazeri/Programacion-Orientada-a-Objetos
|
57d1dc413956e50d31f34c0bb339b32a176f9616
|
[
"MIT"
] | null | null | null |
02_Estructuras y Archivos/Ejercicios/E13_Archivos05.cpp
|
vazeri/Programacion-Orientada-a-Objetos
|
57d1dc413956e50d31f34c0bb339b32a176f9616
|
[
"MIT"
] | null | null | null |
//Hacer un programa que cuente el numero de palabras que contiene un archivo de texto
#include <fstream>
#include <ctype.h>
#include <string>
#include <iostream>
#include<exception>
using namespace std;
int main()
{
ifstream X1;
ifstream X2;
char b,c,ban;
X1.open("A.txt");
X2.open("B.txt");
if (!X1 || !X2)
{
cout<<"No hay archivo";
exit(1);
}
if(X1.get(c)==X2.get(c))
X1.get(b);
X2.get(c);
while(X1.get(b) && X2.get(c))
{
if(b==c)
ban=1;
else
ban=0;
}
if (ban==1)
cout<<"Los archivos son iguales";
else
cout<<"Los archivos NO son iguales";
}
/* cout<<"Los archivos son iguales";
else
cout<<"No son iguales los archivos";
X1.close();
X2.close(); */
}}
| 20.186047
| 86
| 0.496544
|
vazeri
|
bb022f2a12dfa936473249ae2f6855d5e0b6816d
| 10,582
|
cpp
|
C++
|
tests/unittests/MemberTests.cpp
|
toddstrader/slang
|
77a31619e27dc25f6b29a53a5003e1781c6b3034
|
[
"MIT"
] | null | null | null |
tests/unittests/MemberTests.cpp
|
toddstrader/slang
|
77a31619e27dc25f6b29a53a5003e1781c6b3034
|
[
"MIT"
] | null | null | null |
tests/unittests/MemberTests.cpp
|
toddstrader/slang
|
77a31619e27dc25f6b29a53a5003e1781c6b3034
|
[
"MIT"
] | null | null | null |
#include "Test.h"
#include <nlohmann/json.hpp>
TEST_CASE("Nets") {
auto tree = SyntaxTree::fromText(R"(
module Top;
wire logic f = 1;
endmodule
)");
Compilation compilation;
compilation.addSyntaxTree(tree);
NO_COMPILATION_ERRORS;
}
TEST_CASE("Bad signed specifier") {
auto tree = SyntaxTree::fromText(R"(
module Top;
bit signed;
endmodule
)");
Compilation compilation;
compilation.addSyntaxTree(tree);
auto& diags = compilation.getAllDiagnostics();
REQUIRE(diags.size() == 1);
CHECK(diags[0].code == diag::ExpectedDeclarator);
}
TEST_CASE("Continuous Assignments") {
auto tree = SyntaxTree::fromText(R"(
module Top;
wire foo;
assign foo = 1, foo = 'z;
logic bar;
assign bar = 1;
endmodule
)");
Compilation compilation;
compilation.addSyntaxTree(tree);
NO_COMPILATION_ERRORS;
}
TEST_CASE("User defined nettypes") {
auto tree1 = SyntaxTree::fromText(R"(
module m;
import p::*;
typedef logic[10:0] stuff;
nettype foo bar;
nettype stuff baz;
// test that enum members get hoisted here
nettype enum { SDF = 42 } blah;
foo a = 1;
bar b = 2;
baz c = 3;
blah d = SDF;
bar e[5];
endmodule
)");
auto tree2 = SyntaxTree::fromText(R"(
package p;
nettype logic [3:0] foo;
endpackage
)");
Compilation compilation;
compilation.addSyntaxTree(tree1);
compilation.addSyntaxTree(tree2);
NO_COMPILATION_ERRORS;
auto& root = compilation.getRoot();
CHECK(root.lookupName<NetSymbol>("m.a").getType().toString() == "logic[3:0]");
CHECK(root.lookupName<NetSymbol>("m.b").netType.name == "bar");
CHECK(root.lookupName<NetSymbol>("m.b").netType.getAliasTarget()->name == "foo");
CHECK(root.lookupName<NetSymbol>("m.b").getType().toString() == "logic[3:0]");
CHECK(root.lookupName<NetSymbol>("m.c").getType().toString() == "logic[10:0]");
CHECK(root.lookupName<NetSymbol>("m.e").getType().toString() == "logic[3:0]$[0:4]");
}
TEST_CASE("JSON dump") {
auto tree = SyntaxTree::fromText(R"(
interface I;
modport m(input f);
endinterface
package p1;
parameter int BLAH = 1;
endpackage
module Top;
wire foo;
assign foo = 1;
(* foo, bar = 1 *) I array [3] ();
always_comb begin
end
if (1) begin
end
for (genvar i = 0; i < 10; i++) begin
end
import p1::BLAH;
import p1::*;
logic f;
I stuff();
Child child(.i(stuff), .f);
function logic func(logic bar);
endfunction
endmodule
module Child(I.m i, input logic f = 1);
endmodule
)");
Compilation compilation;
compilation.addSyntaxTree(tree);
NO_COMPILATION_ERRORS;
// This basic test just makes sure that JSON dumping doesn't crash.
json output = compilation.getRoot();
output.dump();
}
TEST_CASE("Attributes") {
auto tree = SyntaxTree::fromText(R"(
module m;
(* foo, bar = 1 *) (* baz = 1 + 2 * 3 *) wire foo, bar;
(* blah *) n n1((* blah2 *) 0);
(* blah3 *);
function logic func;
return 0;
endfunction
int j;
always_comb begin : block
(* blah4 *) func (* blah5 *) ();
j = 3 + (* blah6 *) 4;
end
endmodule
module n((* asdf *) input foo);
endmodule
)");
Compilation compilation;
compilation.addSyntaxTree(tree);
NO_COMPILATION_ERRORS;
auto& root = compilation.getRoot();
auto attrs = compilation.getAttributes(*root.lookupName("m.bar"));
REQUIRE(attrs.size() == 3);
CHECK(attrs[0]->value.integer() == SVInt(1));
CHECK(attrs[1]->value.integer() == SVInt(1));
CHECK(attrs[2]->value.integer() == SVInt(7));
auto& n1 = root.lookupName<InstanceSymbol>("m.n1");
attrs = compilation.getAttributes(n1);
REQUIRE(attrs.size() == 1);
CHECK(attrs[0]->name == "blah");
auto ports = n1.membersOfType<PortSymbol>();
REQUIRE(ports.size() == 1);
auto& fooPort = *ports.begin();
attrs = compilation.getAttributes(fooPort);
REQUIRE(attrs.size() == 1);
CHECK(attrs[0]->name == "asdf");
attrs = fooPort.getConnectionAttributes();
REQUIRE(attrs.size() == 1);
CHECK(attrs[0]->name == "blah2");
auto& m = root.lookupName<InstanceSymbol>("m");
attrs = compilation.getAttributes(*m.membersOfType<EmptyMemberSymbol>().begin());
REQUIRE(attrs.size() == 1);
CHECK(attrs[0]->name == "blah3");
auto& block = root.lookupName<SequentialBlockSymbol>("m.block");
auto stmtList = block.getBody().as<StatementList>().list;
REQUIRE(stmtList.size() == 2);
attrs = compilation.getAttributes(*stmtList[0]);
REQUIRE(attrs.size() == 1);
CHECK(attrs[0]->name == "blah4");
auto& call = stmtList[0]->as<ExpressionStatement>().expr.as<CallExpression>();
attrs = compilation.getAttributes(call);
REQUIRE(attrs.size() == 1);
CHECK(attrs[0]->name == "blah5");
auto& assign = stmtList[1]->as<ExpressionStatement>().expr.as<AssignmentExpression>();
attrs = compilation.getAttributes(assign.right().as<BinaryExpression>());
REQUIRE(attrs.size() == 1);
CHECK(attrs[0]->name == "blah6");
}
TEST_CASE("Attribute diagnostics") {
auto tree = SyntaxTree::fromText(R"(
module m;
(* foo, foo = 2 *) wire foo;
(* foo,, *) wire bar;
(* foo = 1 + (* nested *) 3 *) wire baz;
endmodule
)");
Compilation compilation;
compilation.addSyntaxTree(tree);
auto& diags = compilation.getAllDiagnostics();
auto it = diags.begin();
CHECK((it++)->code == diag::DuplicateAttribute);
CHECK((it++)->code == diag::ExpectedIdentifier);
CHECK((it++)->code == diag::MisplacedTrailingSeparator);
CHECK((it++)->code == diag::AttributesNotAllowed);
CHECK(it == diags.end());
auto& root = compilation.getRoot();
auto attrs = compilation.getAttributes(*root.lookupName("m.foo"));
REQUIRE(attrs.size() == 1);
CHECK(attrs[0]->value.integer() == SVInt(2));
}
TEST_CASE("Time units declarations") {
auto tree = SyntaxTree::fromText(R"(
timeunit 10us;
module m;
timeunit 10ns / 10ps;
logic f;
// Further decls ok as long as identical
timeprecision 10ps;
timeunit 10ns;
timeunit 10ns / 10ps;
endmodule
module n;
endmodule
`timescale 100s / 10fs
module o;
endmodule
package p;
timeprecision 1ps;
endpackage
)");
Compilation compilation;
compilation.addSyntaxTree(tree);
NO_COMPILATION_ERRORS;
CHECK(compilation.getDefinition("m")->getTimeScale() == TimeScale("10ns", "10ps"));
CHECK(compilation.getDefinition("n")->getTimeScale() == TimeScale("10us", "1ns"));
CHECK(compilation.getDefinition("o")->getTimeScale() == TimeScale("100s", "10fs"));
CHECK(compilation.getPackage("p")->getTimeScale() == TimeScale("100s", "1ps"));
}
TEST_CASE("Time units error cases") {
auto tree = SyntaxTree::fromText(R"(
module m;
timeunit;
endmodule
module n;
logic f;
timeunit 10ns;
timeunit 100ns / 10ps;
endmodule
module o;
timeunit 20ns;
endmodule
)");
Compilation compilation;
compilation.addSyntaxTree(tree);
auto& diags = compilation.getAllDiagnostics();
auto it = diags.begin();
CHECK((it++)->code == diag::ExpectedTimeLiteral);
CHECK((it++)->code == diag::TimeScaleFirstInScope);
CHECK((it++)->code == diag::MismatchedTimeScales);
CHECK((it++)->code == diag::InvalidTimeScaleSpecifier);
CHECK(it == diags.end());
}
TEST_CASE("Port decl in ANSI module") {
auto tree = SyntaxTree::fromText(R"(
module m(input logic a);
input b;
endmodule
)");
Compilation compilation;
compilation.addSyntaxTree(tree);
auto& diags = compilation.getAllDiagnostics();
auto it = diags.begin();
CHECK((it++)->code == diag::PortDeclInANSIModule);
CHECK(it == diags.end());
}
TEST_CASE("Type parameters") {
auto tree = SyntaxTree::fromText(R"(
module m #(parameter type foo_t = int, foo_t foo = 1) ();
if (foo) begin
parameter type asdf = shortint, basdf = logic;
end
endmodule
)");
Compilation compilation;
compilation.addSyntaxTree(tree);
NO_COMPILATION_ERRORS;
}
TEST_CASE("Type parameters 2") {
auto tree = SyntaxTree::fromText(R"(
module m #(parameter type foo_t, foo_t foo = 1) ();
if (foo) begin
parameter type asdf = shortint, basdf = logic;
end
endmodule
module top;
m #(longint) m1();
endmodule
)");
Compilation compilation;
compilation.addSyntaxTree(tree);
NO_COMPILATION_ERRORS;
}
TEST_CASE("Type parameters 3") {
auto tree = SyntaxTree::fromText(R"(
module m #(parameter type foo_t, foo_t foo = 1) ();
if (foo) begin
parameter type asdf = shortint, basdf = logic;
end
endmodule
module top;
typedef struct packed { logic l; } asdf;
m #(.foo_t(asdf)) m1();
endmodule
)");
Compilation compilation;
compilation.addSyntaxTree(tree);
NO_COMPILATION_ERRORS;
}
TEST_CASE("Type parameters 4") {
auto tree = SyntaxTree::fromText(R"(
module m;
parameter int i = 0;
localparam j = i;
parameter type t = int;
t t1 = 2;
endmodule
module top;
m #(1, shortint) m1();
endmodule
)");
Compilation compilation;
compilation.addSyntaxTree(tree);
NO_COMPILATION_ERRORS;
}
TEST_CASE("Type parameters -- bad replacement") {
auto tree = SyntaxTree::fromText(R"(
module m #(parameter type foo_t, foo_t foo = 1) ();
if (foo) begin
parameter type asdf = shortint, basdf = logic;
end
endmodule
module top;
typedef struct { logic l; } asdf;
m #(asdf) m1();
endmodule
)");
Compilation compilation;
compilation.addSyntaxTree(tree);
auto& diags = compilation.getAllDiagnostics();
REQUIRE(diags.size() == 1);
CHECK(diags[0].code == diag::BadAssignment);
}
TEST_CASE("Type parameters unset -- ok") {
auto tree = SyntaxTree::fromText(R"(
module m #(parameter type foo_t = int, foo_t foo = 1) ();
if (foo) begin
parameter type asdf = shortint, basdf = logic;
end
endmodule
module top;
m #(.foo_t()) m1();
endmodule
)");
Compilation compilation;
compilation.addSyntaxTree(tree);
NO_COMPILATION_ERRORS;
}
TEST_CASE("Type parameters unset -- bad") {
auto tree = SyntaxTree::fromText(R"(
module m #(parameter type foo_t, foo_t foo = 1) ();
if (foo) begin
parameter type asdf = shortint, basdf = logic;
end
endmodule
module top;
m #(.foo_t()) m1();
endmodule
)");
Compilation compilation;
compilation.addSyntaxTree(tree);
auto& diags = compilation.getAllDiagnostics();
REQUIRE(diags.size() == 1);
CHECK(diags[0].code == diag::ParamHasNoValue);
}
| 23.359823
| 90
| 0.639104
|
toddstrader
|
bb0505d68e9fac69826312d8cb3365825004ca7e
| 655
|
cpp
|
C++
|
leetcode.com/0672 Bulb Switcher II/better.cpp
|
sky-bro/AC
|
29bfa3f13994612887e18065fa6e854b9a29633d
|
[
"MIT"
] | 1
|
2020-08-20T11:02:49.000Z
|
2020-08-20T11:02:49.000Z
|
leetcode.com/0672 Bulb Switcher II/better.cpp
|
sky-bro/AC
|
29bfa3f13994612887e18065fa6e854b9a29633d
|
[
"MIT"
] | null | null | null |
leetcode.com/0672 Bulb Switcher II/better.cpp
|
sky-bro/AC
|
29bfa3f13994612887e18065fa6e854b9a29633d
|
[
"MIT"
] | 1
|
2022-01-01T23:23:13.000Z
|
2022-01-01T23:23:13.000Z
|
#include <iostream>
#include <vector>
#include "leetcode.hpp"
using namespace std;
// ref: Java O(1)
// https://leetcode.com/problems/bulb-switcher-ii/discuss/107269/Java-O(1)
class Solution {
public:
// n and m both fit in range [0, 1000].
int flipLights(int n, int m) {
if (m == 0 || n == 0) return 1;
if (n == 1) return 2;
if (n == 2 && m == 1) return 3;
if (n == 2) return 4;
if (m == 1) return 4;
if (m == 2) return 7;
if (m >= 3) return 8;
return 8;
}
};
int main(int argc, char const *argv[]) {
int m, n;
Solution s;
while (cin >> n >> m) {
cout << s.flipLights(n, m) << endl;
}
return 0;
}
| 19.848485
| 74
| 0.549618
|
sky-bro
|
bb063426c666552e49b490499ad965083ddb803a
| 923
|
cpp
|
C++
|
Codeforces/Gym101466E.cpp
|
HeRaNO/OI-ICPC-Codes
|
4a4639cd3e347b472520065ca6ab8caadde6906d
|
[
"MIT"
] | 18
|
2019-01-01T13:16:59.000Z
|
2022-02-28T04:51:50.000Z
|
Codeforces/Gym101466E.cpp
|
HeRaNO/OI-ICPC-Codes
|
4a4639cd3e347b472520065ca6ab8caadde6906d
|
[
"MIT"
] | null | null | null |
Codeforces/Gym101466E.cpp
|
HeRaNO/OI-ICPC-Codes
|
4a4639cd3e347b472520065ca6ab8caadde6906d
|
[
"MIT"
] | 5
|
2019-09-13T08:48:17.000Z
|
2022-02-19T06:59:03.000Z
|
#include <bits/stdc++.h>
#define MAXN 100010
using namespace std;
char a[MAXN],b[MAXN],s[MAXN];
int n,k,ans,l,r,nxt[MAXN];
inline void GetNext(char S[], int len)
{
int i = 0, j = -1;
nxt[0] = -1;
while (i != len)
{
if (!~j || S[i] == S[j]) nxt[++i] = ++j;
else j = nxt[j];
}
return ;
}
inline int KMP(char S[], char T[], int lb, int la)
{
int ans = 0;
int i = 0, j = 0;
while (i < lb && j < la)
{
if (!~j || S[i] == T[j])
{
++i; ++j;
if (j == la)
{
++ans; j = nxt[j - 1]; --i;
}
}
else j = nxt[j];
}
return ans;
}
bool check(int m)
{
for (int i=0;i<m;i++) s[i]=b[i];
GetNext(b,m);
return KMP(a,s,n,m)>=k;
}
int main()
{
gets(a);
n=strlen(a);
gets(b);
l=0;r=strlen(b);
scanf("%d",&k);
while (l<=r)
{
int m=l+r>>1;
if (check(m)){ans=m;l=m+1;}
else r=m-1;
}
if (!ans) return puts("IMPOSSIBLE"),0;
for (int i=0;i<ans;i++) putchar(b[i]);putchar('\n');
return 0;
}
| 14.887097
| 53
| 0.489707
|
HeRaNO
|
bb0b2d728991476a275de3820c3d490f35ab9d26
| 1,015
|
hpp
|
C++
|
src/InvokerConfig.hpp
|
TsarN/invoke
|
26b6d17bee32b7bf0f4edfa2f297473cebe185ba
|
[
"MIT"
] | null | null | null |
src/InvokerConfig.hpp
|
TsarN/invoke
|
26b6d17bee32b7bf0f4edfa2f297473cebe185ba
|
[
"MIT"
] | null | null | null |
src/InvokerConfig.hpp
|
TsarN/invoke
|
26b6d17bee32b7bf0f4edfa2f297473cebe185ba
|
[
"MIT"
] | null | null | null |
#ifndef INVOKE_INVOKERCONFIG_HPP
#define INVOKE_INVOKERCONFIG_HPP
#include <string>
#include <vector>
#include "InvokerProfile.hpp"
class InvokerConfig {
public:
explicit InvokerConfig(const InvokerProfile &profile);
double timeLimit = -1;
double wallLimit = -1;
long memoryLimit = -1;
int stdin_fd = 0;
int stdout_fd = 1;
int stderr_fd = 2;
bool log = false;
std::string exe;
std::string workingDirectory;
std::vector<std::string> args;
std::vector<std::string> envp;
std::vector<std::string> writeableFiles;
bool inheritEnvironment = false;
const InvokerProfile &profile;
};
class InvokerResult {
public:
int exitCode = 0;
int error = 0;
std::string errorMessage;
double cpuUsage = 0.0;
double wallClock = 0.0;
long memoryUsage = 0;
bool securityViolation = false;
bool timeLimitExceeded = false;
bool wallLimitExceeded = false;
bool memoryLimitExceeded = false;
};
#endif //INVOKE_INVOKERCONFIG_HPP
| 19.901961
| 58
| 0.684729
|
TsarN
|
bb0d637f18c3a336bf1cf54c0fef06642aa8c44f
| 883
|
hpp
|
C++
|
include/async/logger_wostream.hpp
|
MadNiko/async
|
5f384380e8f4ec40ea78c277455ca5180559bd07
|
[
"BSD-3-Clause"
] | null | null | null |
include/async/logger_wostream.hpp
|
MadNiko/async
|
5f384380e8f4ec40ea78c277455ca5180559bd07
|
[
"BSD-3-Clause"
] | null | null | null |
include/async/logger_wostream.hpp
|
MadNiko/async
|
5f384380e8f4ec40ea78c277455ca5180559bd07
|
[
"BSD-3-Clause"
] | null | null | null |
#pragma once
#include <iostream>
#include <async\logger.hpp>
namespace async
{
class ASYNC_LIB_API logger_wostream : public logger
{
public:
logger_wostream(std::wostream& stream) noexcept;
public:
virtual void message(std::wstring_view text) noexcept override;
virtual void exception(std::exception_ptr except, std::wstring_view failed_action) noexcept override;
virtual void enter_to_scope(std::wstring_view scope_name) noexcept override;
virtual void leave_scope(std::wstring_view scope_name) noexcept override;
private:
std::size_t print_head();
std::wostream& print_multiline(std::size_t head_size, std::wstring_view text);
private:
std::wostream& m_str_ref;
};
} // namespace async
#ifdef ASYNC_LIB_HEADERS_ONLY
# include <async\logger_wostream_impl.hpp>
#endif
| 19.195652
| 109
| 0.704417
|
MadNiko
|
bb0ec29179010ef2a7823eff6879e657180a9c07
| 2,453
|
cc
|
C++
|
src/kudu/ranger/mini_ranger-test.cc
|
bbhavsar/kudu
|
d23ee5d38ddc4317f431dd65df0c825c00cc968a
|
[
"Apache-2.0"
] | 6
|
2020-05-12T02:18:48.000Z
|
2021-04-15T20:39:21.000Z
|
src/kudu/ranger/mini_ranger-test.cc
|
bbhavsar/kudu
|
d23ee5d38ddc4317f431dd65df0c825c00cc968a
|
[
"Apache-2.0"
] | 16
|
2020-01-19T07:17:00.000Z
|
2020-06-10T09:43:55.000Z
|
src/kudu/ranger/mini_ranger-test.cc
|
bbhavsar/kudu
|
d23ee5d38ddc4317f431dd65df0c825c00cc968a
|
[
"Apache-2.0"
] | 1
|
2020-03-13T09:59:08.000Z
|
2020-03-13T09:59:08.000Z
|
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
#include "kudu/ranger/mini_ranger.h"
#include <string>
#include <utility>
#include <vector>
#include <gtest/gtest.h>
#include "kudu/ranger/ranger.pb.h"
#include "kudu/util/curl_util.h"
#include "kudu/util/path_util.h"
#include "kudu/util/faststring.h"
#include "kudu/util/test_macros.h"
#include "kudu/util/test_util.h"
using std::string;
namespace kudu {
namespace ranger {
class MiniRangerTest : public KuduTest {
public:
MiniRangerTest()
: ranger_("127.0.0.1") {}
void SetUp() override {
ASSERT_OK(ranger_.Start());
}
protected:
MiniRanger ranger_;
};
TEST_F(MiniRangerTest, TestGrantPrivilege) {
PolicyItem item;
item.first.emplace_back("testuser");
item.second.emplace_back(ActionPB::ALTER);
AuthorizationPolicy policy;
policy.databases.emplace_back("foo");
policy.tables.emplace_back("bar");
policy.items.emplace_back(std::move(item));
ASSERT_OK(ranger_.AddPolicy(std::move(policy)));
}
TEST_F(MiniRangerTest, TestPersistence) {
PolicyItem item;
item.first.emplace_back("testuser");
item.second.emplace_back(ActionPB::ALTER);
AuthorizationPolicy policy;
policy.databases.emplace_back("foo");
policy.tables.emplace_back("bar");
policy.items.emplace_back(std::move(item));
ASSERT_OK(ranger_.AddPolicy(policy));
ASSERT_OK(ranger_.Stop());
ASSERT_OK(ranger_.Start());
EasyCurl curl;
curl.set_auth(CurlAuthType::BASIC, "admin", "admin");
faststring result;
ASSERT_OK(curl.FetchURL(JoinPathSegments(ranger_.admin_url(), "service/plugins/policies/count"),
&result));
ASSERT_EQ("1", result.ToString());
}
} // namespace ranger
} // namespace kudu
| 27.875
| 98
| 0.732165
|
bbhavsar
|
bb10eee616e26c4d587aec452175646046b69035
| 2,540
|
cxx
|
C++
|
sample/exafmm-dev-13274dd4ac68/wrappers/test_petiga.cxx
|
naoyam/tapas-reduce
|
90ebf7eb6a2db232fc5ae0b4bff6b7ac3cf9b7d3
|
[
"MIT"
] | null | null | null |
sample/exafmm-dev-13274dd4ac68/wrappers/test_petiga.cxx
|
naoyam/tapas-reduce
|
90ebf7eb6a2db232fc5ae0b4bff6b7ac3cf9b7d3
|
[
"MIT"
] | null | null | null |
sample/exafmm-dev-13274dd4ac68/wrappers/test_petiga.cxx
|
naoyam/tapas-reduce
|
90ebf7eb6a2db232fc5ae0b4bff6b7ac3cf9b7d3
|
[
"MIT"
] | null | null | null |
#include <mpi.h>
#include <cmath>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <sstream>
extern "C" void FMM_Init();
extern "C" void FMM_Finalize();
extern "C" void FMM_Partition(int & ni, double * xi, double * yi, double * zi, double * vi,
int & nj, double * xj, double * yj, double * zj, double * vj);
extern "C" void FMM_Laplace(int ni, double * xi, double * yi, double * zi, double * vi,
int nj, double * xj, double * yj, double * zj, double * vj);
extern "C" void Direct_Laplace(int ni, double * xi, double * yi, double * zi, double * vi,
int nj, double * xj, double * yj, double * zj, double * vj);
int main(int argc, char ** argv) {
const int Nmax = 1000000;
int ni = 500;
int nj = 1000;
int stringLength = 20;
double * xi = new double [Nmax];
double * yi = new double [Nmax];
double * zi = new double [Nmax];
double * vi = new double [Nmax];
double * xj = new double [Nmax];
double * yj = new double [Nmax];
double * zj = new double [Nmax];
double * vj = new double [Nmax];
double * v2 = new double [Nmax];
int mpisize, mpirank;
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &mpisize);
MPI_Comm_rank(MPI_COMM_WORLD, &mpirank);
srand48(mpirank);
for (int i=0; i<ni; i++) {
xi[i] = drand48() - .5;
yi[i] = drand48() - .5;
zi[i] = drand48() - .5;
vi[i] = 0;
}
for (int i=0; i<nj; i++) {
xj[i] = drand48() - .5;
yj[i] = drand48() - .5;
zj[i] = drand48() - .5;
vj[i] = 1. / nj;
}
FMM_Init();
FMM_Partition(ni, xi, yi, zi, vi, nj, xj, yj, zj, vj);
FMM_Laplace(ni, xi, yi, zi, vi, nj, xj, yj, zj, vj);
for (int i=0; i<ni; i++) {
v2[i] = 0;
}
Direct_Laplace(ni, xi, yi, zi, v2, nj, xj, yj, zj, vj);
double potDif = 0, potNrm = 0;
for (int i=0; i<ni; i++) {
potDif += (vi[i] - v2[i]) * (vi[i] - v2[i]);
potNrm += v2[i] * v2[i];
}
double potDifGlob, potNrmGlob;
MPI_Reduce(&potDif, &potDifGlob, 1, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);
MPI_Reduce(&potNrm, &potNrmGlob, 1, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);
if (mpirank == 0) {
std::cout << "--- FMM vs. Direct ---------------" << std::endl;
std::cout << std::setw(stringLength) << std::left << std::scientific
<< "Rel. L2 Error (pot)" << " : " << std::sqrt(potDifGlob/potNrmGlob) << std::endl;
}
delete[] xi;
delete[] yi;
delete[] zi;
delete[] vi;
delete[] xj;
delete[] yj;
delete[] zj;
delete[] vj;
delete[] v2;
FMM_Finalize();
MPI_Finalize();
}
| 29.882353
| 92
| 0.574803
|
naoyam
|
bb1125c59766e0bb14088b0523e9a1eb251e83ea
| 4,993
|
cc
|
C++
|
cpp/demo/smtp_main_stub.cc
|
propaganda-gold/deeprev
|
0c6ccf83131a879ed858acdb0675e75ebf2f2d3d
|
[
"BSD-3-Clause"
] | null | null | null |
cpp/demo/smtp_main_stub.cc
|
propaganda-gold/deeprev
|
0c6ccf83131a879ed858acdb0675e75ebf2f2d3d
|
[
"BSD-3-Clause"
] | 2
|
2021-05-11T16:29:38.000Z
|
2022-01-22T12:28:49.000Z
|
cpp/demo/smtp_main_stub.cc
|
propaganda-gold/deeprev
|
0c6ccf83131a879ed858acdb0675e75ebf2f2d3d
|
[
"BSD-3-Clause"
] | null | null | null |
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
/* <DESC>
* Send e-mail with SMTP
* </DESC>
*/
#include <curl/curl.h>
#include <stdio.h>
#include <string.h>
/*
* For an SMTP example using the multi interface please see smtp-multi.c.
*/
/* The libcurl options want plain addresses, the viewable headers in the mail
* can very well get a full name as well.
*/
#define FROM_ADDR "<sender@example.org>"
#define TO_ADDR "<addressee@example.net>"
#define CC_ADDR "<info@example.org>"
#define FROM_MAIL "Sender Person " FROM_ADDR
#define TO_MAIL "A Receiver " TO_ADDR
#define CC_MAIL "John CC Smith " CC_ADDR
static const char *payload_text[] = {
"Date: Mon, 29 Nov 2010 21:54:29 +1100\r\n",
"To: " TO_MAIL "\r\n",
"From: " FROM_MAIL "\r\n",
"Cc: " CC_MAIL "\r\n",
"Message-ID: <dcd7cb36-11db-487a-9f3a-e652a9458efd@"
"rfcpedant.example.org>\r\n",
"Subject: SMTP example message\r\n",
"\r\n", /* empty line to divide headers from body, see RFC5322 */
"The body of the message starts here.\r\n",
"\r\n",
"It could be a lot of lines, could be MIME encoded, whatever.\r\n",
"Check RFC5322.\r\n",
NULL};
struct upload_status {
int lines_read;
};
static size_t payload_source(void *ptr, size_t size, size_t nmemb,
void *userp) {
struct upload_status *upload_ctx = (struct upload_status *)userp;
const char *data;
if ((size == 0) || (nmemb == 0) || ((size * nmemb) < 1)) {
return 0;
}
data = payload_text[upload_ctx->lines_read];
if (data) {
size_t len = strlen(data);
memcpy(ptr, data, len);
upload_ctx->lines_read++;
return len;
}
return 0;
}
int main(void) {
CURL *curl;
CURLcode res = CURLE_OK;
struct curl_slist *recipients = NULL;
struct upload_status upload_ctx;
upload_ctx.lines_read = 0;
curl = curl_easy_init();
if (curl) {
/* This is the URL for your mailserver */
curl_easy_setopt(curl, CURLOPT_URL, "smtp://mail.example.com");
/* Note that this option isn't strictly required, omitting it will result
* in libcurl sending the MAIL FROM command with empty sender data. All
* autoresponses should have an empty reverse-path, and should be directed
* to the address in the reverse-path which triggered them. Otherwise,
* they could cause an endless loop. See RFC 5321 Section 4.5.5 for more
* details.
*/
curl_easy_setopt(curl, CURLOPT_MAIL_FROM, FROM_ADDR);
/* Add two recipients, in this particular case they correspond to the
* To: and Cc: addressees in the header, but they could be any kind of
* recipient. */
recipients = curl_slist_append(recipients, TO_ADDR);
recipients = curl_slist_append(recipients, CC_ADDR);
curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients);
/* We're using a callback function to specify the payload (the headers and
* body of the message). You could just use the CURLOPT_READDATA option to
* specify a FILE pointer to read from. */
curl_easy_setopt(curl, CURLOPT_READFUNCTION, payload_source);
curl_easy_setopt(curl, CURLOPT_READDATA, &upload_ctx);
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
/* Send the message */
res = curl_easy_perform(curl);
/* Check for errors */
if (res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(res));
/* Free the list of recipients */
curl_slist_free_all(recipients);
/* curl won't send the QUIT command until you call cleanup, so you should
* be able to re-use this connection for additional messages (setting
* CURLOPT_MAIL_FROM and CURLOPT_MAIL_RCPT as required, and calling
* curl_easy_perform() again. It may not be a good idea to keep the
* connection open for a very long time though (more than a few minutes
* may result in the server timing out the connection), and you do want to
* clean up in the end.
*/
curl_easy_cleanup(curl);
}
return (int)res;
}
| 33.736486
| 78
| 0.631484
|
propaganda-gold
|
bb14e332faaecd5704fc153ba478726ab8fe1a1d
| 1,197
|
cpp
|
C++
|
Lab/Salazar_Uriel_Lab6/Employee.cpp
|
salazaru/Cpp_Programming_Objects
|
8cc1e7d4b96b31a1ff57f2296d025d14b032d1c7
|
[
"MIT"
] | 1
|
2016-03-10T02:47:46.000Z
|
2016-03-10T02:47:46.000Z
|
Lab/Salazar_Uriel_Lab6/Employee.cpp
|
salazaru/Salazar_Uriel_CSC17A_32232
|
8cc1e7d4b96b31a1ff57f2296d025d14b032d1c7
|
[
"MIT"
] | null | null | null |
Lab/Salazar_Uriel_Lab6/Employee.cpp
|
salazaru/Salazar_Uriel_CSC17A_32232
|
8cc1e7d4b96b31a1ff57f2296d025d14b032d1c7
|
[
"MIT"
] | null | null | null |
#include <iostream>
#include "Employee.h"
#include "Date.h"
using namespace std;
Employee::Employee(
const string &first, const string &last, const string &ssn,
int month, int day, int year)
: firstName(first), lastName(last), socialSecurityNumber(ssn),
birthDate(month, day, year)
{
}
void Employee::setFirstName(const string &first)
{
firstName = first;
}
string Employee::getFirstName() const
{
return firstName;
}
void Employee::setLastName(const string &last)
{
lastName = last;
}
string Employee::getLastName() const
{
return lastName;
}
void Employee::setSocialSecurityNumber(const string &ssn)
{
socialSecurityNumber = ssn;
}
string Employee::getSocialSecurityNumber() const
{
return socialSecurityNumber;
}
void Employee::setBirthDate(int month, int day, int year)
{
birthDate.setDate(month, day, year);
}
Date Employee::getBirthDate() const
{
return birthDate;
}
void Employee::print() const
{
cout << getFirstName() << ' ' << getLastName()
<< "\nsocial security number: " << getSocialSecurityNumber()
<< "\ndate of birth: " << getBirthDate();
}
| 19.95
| 70
| 0.651629
|
salazaru
|
bb16ed8d601629bfb5a6bcf98abb5ea786475c86
| 1,991
|
cpp
|
C++
|
src/Main.cpp
|
LBYPatrick/World-Of-Waifus
|
50d6158c9d67349268015bfe782c7288208a3e4c
|
[
"MIT"
] | null | null | null |
src/Main.cpp
|
LBYPatrick/World-Of-Waifus
|
50d6158c9d67349268015bfe782c7288208a3e4c
|
[
"MIT"
] | null | null | null |
src/Main.cpp
|
LBYPatrick/World-Of-Waifus
|
50d6158c9d67349268015bfe782c7288208a3e4c
|
[
"MIT"
] | null | null | null |
#include "Includes.hpp"
#include "Utils.hpp"
#include "Thread.hpp"
using namespace std;
string getModPath() {
if (fs::exists("bin64/paths.xml")) {
ifstream i("bin64/paths.xml");
string buffer;
while (getline(i, buffer)) {
if (buffer.find("res_mods") != string::npos) {
return Utils::SubString(buffer, buffer.find("<Path>") + 9, buffer.find("</Path>") - 1);
break;
}
}
}
return string();
}
int main(int argc, char *const argv[]) {
vector<Thread> threadPool;
//Get WOWS Mod Path
string modPath = getModPath();
if (modPath.length() == 0) {
Utils::printLn("Failed to find valid paths.xml!");
return 1;
}
//Get Mods List & Load
if (fs::exists("mods")) {
//Purge res_mods/<version_number> and create a new one
if(fs::exists(modPath)) {
fs::remove_all(modPath);
}
Utils::createDirectory(modPath);
int numMods = Utils::getFolderList("mods").size();
Utils::printLn(Utils::getPrintableTime() + " " + to_string(numMods) + " mods found. Start Working.");
for (auto &i : fs::directory_iterator("mods")) {
string source = i.path().u8string(),
target = modPath;
threadPool.push_back(Thread(thread([&] {
Utils::markLink(source, target);
Utils::printLn(Utils::getPrintableTime()
+ " "
+ "Finished Mounting "
+ Utils::SubString(source, source.rfind("\\") + 1)
+ ".");
})));
threadPool.back().run();
}
}
Utils::printLn( "\n" + Utils::getPrintableTime() + " " + "All done. This window will close shortly.");
std::this_thread::sleep_for(2s);
return 0;
}
| 26.197368
| 110
| 0.487695
|
LBYPatrick
|
bb189286b4a2582c860b5816aa9afaabd55ae43d
| 12,806
|
cpp
|
C++
|
src/age_emulator_gb/age_gb_memory.cpp
|
c-sp/AGE
|
054bc4c7c0fe703439b73575d56a23eb3700d695
|
[
"Apache-2.0"
] | 2
|
2022-02-12T12:51:14.000Z
|
2022-02-13T19:14:36.000Z
|
src/age_emulator_gb/age_gb_memory.cpp
|
c-sp/AGE
|
054bc4c7c0fe703439b73575d56a23eb3700d695
|
[
"Apache-2.0"
] | 4
|
2021-05-19T18:11:22.000Z
|
2021-09-27T18:17:26.000Z
|
src/age_emulator_gb/age_gb_memory.cpp
|
c-sp/AGE
|
054bc4c7c0fe703439b73575d56a23eb3700d695
|
[
"Apache-2.0"
] | null | null | null |
//
// Copyright 2020 Christoph Sprenger
//
// 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 <algorithm>
#include <age_debug.hpp>
#include "age_gb_memory.hpp"
namespace
{
constexpr age::uint16_t gb_cia_ofs_title = 0x0134;
uint16_t mbc2_ram_address(uint16_t address)
{
uint16_t ram_offset = address - 0xA000;
return 0xA000 + (ram_offset & 0x1FF);
}
bool is_cartridge_ram(uint16_t address)
{
return (address & 0xE000) == 0xA000;
}
} // namespace
//---------------------------------------------------------
//
// public methods
//
//---------------------------------------------------------
const age::uint8_t* age::gb_memory::get_video_ram() const
{
return &m_memory[m_video_ram_offset];
}
const age::uint8_t* age::gb_memory::get_rom_header() const
{
return m_memory.data();
}
std::string age::gb_memory::get_cartridge_title() const
{
const char* buffer = reinterpret_cast<const char*>(&m_memory[gb_cia_ofs_title]);
std::string result = {buffer, 16};
return result;
}
age::uint8_vector age::gb_memory::get_persistent_ram() const
{
uint8_vector result;
if (m_has_battery)
{
int cart_ram_size = m_num_cart_ram_banks * gb_cart_ram_bank_size;
AGE_ASSERT(cart_ram_size > 0)
result.resize(static_cast<unsigned>(cart_ram_size));
std::copy(begin(m_memory) + m_cart_ram_offset,
begin(m_memory) + m_cart_ram_offset + cart_ram_size,
begin(result));
}
else
{
result = uint8_vector();
}
return result;
}
void age::gb_memory::set_persistent_ram(const uint8_vector& source)
{
if (m_has_battery)
{
AGE_ASSERT(source.size() <= int_max)
int source_size = static_cast<int>(source.size());
int cart_ram_size = m_num_cart_ram_banks * gb_cart_ram_bank_size;
// copy persistent ram
int bytes_to_copy = std::min(cart_ram_size, source_size);
std::copy(begin(source),
begin(source) + bytes_to_copy,
begin(m_memory) + m_cart_ram_offset);
// fill up with zeroes, if the source vector is smaller than the actual persistent ram
if (cart_ram_size > source_size)
{
std::fill(begin(m_memory) + m_cart_ram_offset + source_size,
begin(m_memory) + m_cart_ram_offset + cart_ram_size,
0);
}
}
}
age::uint8_t age::gb_memory::read_byte(uint16_t address) const
{
AGE_ASSERT(address < 0xFE00)
// rom, video ram & work ram
if (!is_cartridge_ram(address))
{
return m_memory[get_offset(address)];
}
// cartridge ram not readable
if (!m_cart_ram_enabled)
{
log() << "read [" << log_hex16(address) << "] = 0xFF: cartridge RAM disabled";
return 0xFF;
}
// read MBC2 ram
if (m_is_mbc2)
{
return m_memory[get_offset(mbc2_ram_address(address))] | 0xF0;
}
// read regular cartridge ram
return m_memory[get_offset(address)];
}
age::uint8_t age::gb_memory::read_svbk() const
{
return m_svbk;
}
age::uint8_t age::gb_memory::read_vbk() const
{
return m_vbk;
}
void age::gb_memory::write_byte(uint16_t address, uint8_t value)
{
AGE_ASSERT(address < 0xFE00)
// access MBC
if (address < 0x8000)
{
m_mbc_writer(*this, address, value);
return;
}
// write video ram & work ram
if (!is_cartridge_ram(address))
{
m_memory[get_offset(address)] = value;
return;
}
// cartridge ram not writable
if (!m_cart_ram_enabled)
{
log() << "write [" << log_hex16(address) << "] = " << log_hex8(value) << " ignored: cartridge RAM disabled";
return;
}
// write MBC2 ram
if (m_is_mbc2)
{
m_memory[get_offset(mbc2_ram_address(address))] = value | 0xF0;
}
// write regular cartridge ram
m_memory[get_offset(address)] = value;
}
void age::gb_memory::write_svbk(uint8_t value)
{
m_svbk = value | 0xF8;
int bank_id = value & 0x07;
if (bank_id == 0)
{
bank_id = 1;
}
log() << "switch to SVBK bank " << bank_id;
int offset = bank_id * gb_work_ram_bank_size;
m_offsets[0xD] = m_work_ram_offset + offset - 0xD000;
m_offsets[0xF] = m_work_ram_offset + offset - 0xF000;
}
void age::gb_memory::write_vbk(uint8_t value)
{
m_vbk = value | 0xFE;
auto bank = m_vbk & 1;
log() << "switch to VBK bank " << bank;
auto offset = bank * gb_video_ram_bank_size;
m_offsets[8] = m_video_ram_offset + offset - 0x8000;
m_offsets[9] = m_offsets[8];
}
//---------------------------------------------------------
//
// private methods
//
//---------------------------------------------------------
unsigned age::gb_memory::get_offset(uint16_t address) const
{
auto offset = m_offsets[address >> 12];
offset += address;
AGE_ASSERT(offset >= 0)
AGE_ASSERT(static_cast<unsigned>(offset) < m_memory.size())
return static_cast<unsigned>(offset);
}
void age::gb_memory::set_ram_accessible(uint8_t value)
{
m_cart_ram_enabled = ((value & 0x0F) == 0x0A) && (m_num_cart_ram_banks > 0);
log() << "enable cartridge ram = " << log_hex8(value)
<< " (cartridge ram " << (m_cart_ram_enabled ? "enabled" : "disabled") << ")";
}
void age::gb_memory::set_rom_banks(int low_bank_id, int high_bank_id)
{
AGE_ASSERT(low_bank_id >= 0)
AGE_ASSERT(high_bank_id >= 0)
AGE_ASSERT(m_num_cart_rom_banks >= 0)
low_bank_id &= m_num_cart_rom_banks - 1;
high_bank_id &= m_num_cart_rom_banks - 1;
m_offsets[0] = low_bank_id * gb_cart_rom_bank_size;
m_offsets[1] = m_offsets[0];
m_offsets[2] = m_offsets[0];
m_offsets[3] = m_offsets[0];
m_offsets[4] = high_bank_id * gb_cart_rom_bank_size - 0x4000;
m_offsets[5] = m_offsets[4];
m_offsets[6] = m_offsets[4];
m_offsets[7] = m_offsets[4];
log() << "switch to rom banks " << log_hex(low_bank_id) << " @ 0x0000-0x3FFF, "
<< log_hex(high_bank_id) << " @ 0x4000-0x7FFF";
}
void age::gb_memory::set_ram_bank(int bank_id)
{
AGE_ASSERT(bank_id >= 0)
bank_id &= m_num_cart_ram_banks - 1;
m_offsets[0xA] = m_cart_ram_offset + bank_id * gb_cart_ram_bank_size - 0xA000;
m_offsets[0xB] = m_offsets[0xA];
log() << "switch to ram bank " << log_hex(bank_id);
}
//---------------------------------------------------------
//
// private methods: mbc
//
//---------------------------------------------------------
age::gb_memory::mbc_writer age::gb_memory::get_mbc_writer(gb_mbc_data& mbc, uint8_t mbc_type)
{
mbc_writer result;
switch (mbc_type)
{
//case 0x00:
//case 0x08:
//case 0x09:
default:
return write_to_mbc_no_op;
case 0x01:
case 0x02:
case 0x03:
mbc = gb_mbc1_data{.m_bank1 = 1, .m_bank2 = 0, .m_mode1 = false};
return write_to_mbc1;
case 0x05:
case 0x06:
return write_to_mbc2;
case 0x0F:
case 0x10:
case 0x11:
case 0x12:
case 0x13:
return write_to_mbc3;
case 0x19:
case 0x1A:
case 0x1B:
mbc = gb_mbc5_data{.m_2000 = 1, .m_3000 = 0};
return write_to_mbc5;
case 0x1C:
case 0x1D:
case 0x1E:
mbc = gb_mbc5_data{.m_2000 = 1, .m_3000 = 0};
return write_to_mbc5_rumble;
}
}
void age::gb_memory::write_to_mbc_no_op(gb_memory& memory, uint16_t offset, uint8_t value)
{
AGE_UNUSED(memory);
AGE_UNUSED(offset);
AGE_UNUSED(value);
memory.log() << "write to [" << log_hex16(offset) << "] = " << log_hex8(value) << " ignored: no MBC configured";
}
void age::gb_memory::write_to_mbc1(gb_memory& memory, uint16_t offset, uint8_t value)
{
AGE_ASSERT(offset < 0x8000)
// workaround for older STL implementations
// (we actually want to use std::get<gb_mbc1_data> here ...)
auto* p_mbc_data = std::get_if<gb_mbc1_data>(&memory.m_mbc_data);
auto& mbc_data = *p_mbc_data;
switch (offset & 0x6000)
{
case 0x0000:
// (de)activate ram
memory.set_ram_accessible(value);
return;
case 0x2000:
// select rom bank (lower 5 bits)
mbc_data.m_bank1 = ((value & 0x1F) == 0) ? value + 1 : value;
break;
case 0x4000:
// select rom/ram bank
mbc_data.m_bank2 = value;
break;
case 0x6000:
// select MBC1 mode:
// - mode 0: bank2 affects 0x4000-0x7FFF
// - mode 1: bank2 affects 0x0000-0x7FFF, 0xA000-0xBFFF
mbc_data.m_mode1 = (value & 0x01) > 0;
break;
}
//
// verified by mooneye-gb tests
//
// - The value written to 0x4000 is used for rom bank switching
// independent of the MBC1 mode.
// - With MBC1 mode 1 the value written to 0x4000 switches the
// rom bank at 0x0000.
//
// emulator-only/mbc1/rom_8Mb
// emulator-only/mbc1/rom_16Mb
//
int mbc_high_bits = mbc_data.m_bank2 & 0x03;
int high_rom_bits = mbc_high_bits << (memory.m_mbc1_multi_cart ? 4 : 5);
int low_rom_bank_id = mbc_data.m_mode1 ? high_rom_bits : 0;
int high_rom_bank_id = high_rom_bits + (mbc_data.m_bank1 & (memory.m_mbc1_multi_cart ? 0x0FU : 0x1FU));
int ram_bank_id = mbc_data.m_mode1 ? mbc_high_bits : 0;
// set rom & ram banks
AGE_ASSERT(memory.m_mbc1_multi_cart || ((high_rom_bank_id & 0x1F) > 0))
memory.set_rom_banks(low_rom_bank_id, high_rom_bank_id);
memory.set_ram_bank(ram_bank_id);
}
void age::gb_memory::write_to_mbc2(gb_memory& memory, uint16_t offset, uint8_t value)
{
AGE_ASSERT(offset < 0x8000)
// writes to $4000-$7FFF have no effect
if (offset >= 0x4000)
{
return;
}
// (de)activate ram
if ((offset & 0x100) == 0)
{
memory.set_ram_accessible(value);
}
// switch rom bank
else
{
int rom_bank_id = value & 0x0F;
memory.set_rom_banks(0, (rom_bank_id == 0) ? 1 : rom_bank_id);
}
}
void age::gb_memory::write_to_mbc3(gb_memory& memory, uint16_t offset, uint8_t value)
{
AGE_ASSERT(offset < 0x8000)
switch (offset & 0x6000)
{
case 0x0000:
// (de)activate ram
memory.set_ram_accessible(value);
break;
case 0x2000: {
// select rom bank
int rom_bank_id = value & 0x7F;
if (rom_bank_id == 0)
{
rom_bank_id = 1;
}
memory.set_rom_banks(0, rom_bank_id);
break;
}
case 0x4000:
// select ram bank
memory.set_ram_bank(value & 0x03);
break;
case 0x6000:
// latch real time clock
break;
}
}
void age::gb_memory::write_to_mbc5(gb_memory& memory, uint16_t offset, uint8_t value)
{
AGE_ASSERT(offset < 0x8000)
// workaround for older STL implementations
// (we actually want to use std::get<gb_mbc1_data> here ...)
auto* p_mbc_data = std::get_if<gb_mbc5_data>(&memory.m_mbc_data);
auto& mbc_data = *p_mbc_data;
switch (offset & 0x6000)
{
case 0x0000:
// (de)activate ram
memory.set_ram_accessible(value);
break;
case 0x2000:
// select rom bank (lower 5 bits)
if ((offset & 0x1000) == 0)
{
mbc_data.m_2000 = value;
}
else
{
mbc_data.m_3000 = value;
}
memory.set_rom_banks(0, ((mbc_data.m_3000 & 0x01) << 8) + mbc_data.m_2000);
break;
case 0x4000:
// select ram bank
memory.set_ram_bank(value & 0x0F);
break;
}
}
void age::gb_memory::write_to_mbc5_rumble(gb_memory& memory, uint16_t offset, uint8_t value)
{
AGE_ASSERT(offset < 0x8000)
// clear rumble motor bit
if ((offset & 0x6000) == 0x4000)
{
value &= 0x07;
}
// behave like MBC5
write_to_mbc5(memory, offset, value);
}
| 24.914397
| 116
| 0.586366
|
c-sp
|
bb1b23b8f30083780e16d50e4733816ad1054831
| 2,375
|
cpp
|
C++
|
avrdude/libftd2xx0.4.16_x86_64/libusb-0.1.12/tests/descriptor_test.cpp
|
makagucci/cARM
|
fc4311125cd60f875c9e56735f0df6ff4407c7c9
|
[
"Beerware"
] | 10
|
2017-01-20T05:16:03.000Z
|
2017-01-20T05:16:18.000Z
|
avrdude/libftd2xx0.4.16_x86_64/libusb-0.1.12/tests/descriptor_test.cpp
|
makagucci/cARM
|
fc4311125cd60f875c9e56735f0df6ff4407c7c9
|
[
"Beerware"
] | null | null | null |
avrdude/libftd2xx0.4.16_x86_64/libusb-0.1.12/tests/descriptor_test.cpp
|
makagucci/cARM
|
fc4311125cd60f875c9e56735f0df6ff4407c7c9
|
[
"Beerware"
] | null | null | null |
// -*- C++;indent-tabs-mode: t; tab-width: 4; c-basic-offset: 4; -*-
/*
* descriptor_test.cpp
*
* Test suite program for C++ bindings
*/
#include <iostream>
#include <iomanip>
#include "usbpp.h"
using namespace std;
int main(void)
{
USB::Busses buslist;
cout << "bus/device idVendor/idProduct" << endl;
// buslist.init();
USB::Bus *bus;
list<USB::Bus *>::const_iterator biter;
USB::Device *device;
list<USB::Device *>::const_iterator diter;
int i, j, k, l;
for (biter = buslist.begin(); biter != buslist.end(); biter++) {
bus = *biter;
for (diter = bus->begin(); diter != bus->end(); diter++) {
device = *diter;
cout << bus->directoryName() << "/"
<< device->fileName() << " "
<< ios::uppercase << hex << setw(4) << setfill('0')
<< device->idVendor() << "/"
<< ios::uppercase << hex << setw(4) << setfill('0')
<< device->idProduct() << endl;
if (device->Vendor() != "") {
cout << "- Manufacturer : " << device->Vendor() << endl;
} else {
cout << "- Unable to fetch manufacturer string" << endl;
}
if (device->Product() != "") {
cout << "- Product : " << device->Product() << endl;
} else {
cout << "- Unable to fetch product string" << endl;
}
if (device->SerialNumber() != "") {
cout << "- Serial Number: " << device->SerialNumber() << endl;
}
USB::Configuration *this_Configuration;
this_Configuration = device->firstConfiguration();
for (i=0; i < device->numConfigurations(); i++) {
this_Configuration->dumpDescriptor();
USB::Interface *this_Interface;
this_Interface = this_Configuration->firstInterface();
for (j=0; j < this_Configuration->numInterfaces(); j++) {
USB::AltSetting *this_AltSetting;
this_AltSetting = this_Interface->firstAltSetting();
for (k=0; k < this_Interface->numAltSettings(); k++) {
this_AltSetting->dumpDescriptor();
USB::Endpoint *this_Endpoint;
this_Endpoint = this_AltSetting->firstEndpoint();
for (l=0; l < this_AltSetting->numEndpoints(); l++) {
this_Endpoint->dumpDescriptor();
this_Endpoint = this_AltSetting->nextEndpoint();
}
this_AltSetting = this_Interface->nextAltSetting();
}
this_Interface = this_Configuration->nextInterface();
}
this_Configuration = device->nextConfiguration();
}
}
}
return 0;
}
| 28.614458
| 68
| 0.604211
|
makagucci
|
bb1bf75fc1e890a060cf95d53355670fa7acb917
| 5,633
|
cpp
|
C++
|
deform_control/external_libs/OpenSceneGraph-2.8.5/src/osgWrappers/osgParticle/ModularEmitter.cpp
|
UM-ARM-Lab/mab_ms
|
f199f05b88060182cfbb47706bd1ff3479032c43
|
[
"BSD-2-Clause"
] | 3
|
2018-08-20T12:12:43.000Z
|
2021-06-06T09:43:27.000Z
|
deform_control/external_libs/OpenSceneGraph-2.8.5/src/osgWrappers/osgParticle/ModularEmitter.cpp
|
UM-ARM-Lab/mab_ms
|
f199f05b88060182cfbb47706bd1ff3479032c43
|
[
"BSD-2-Clause"
] | null | null | null |
deform_control/external_libs/OpenSceneGraph-2.8.5/src/osgWrappers/osgParticle/ModularEmitter.cpp
|
UM-ARM-Lab/mab_ms
|
f199f05b88060182cfbb47706bd1ff3479032c43
|
[
"BSD-2-Clause"
] | 1
|
2022-03-31T03:12:23.000Z
|
2022-03-31T03:12:23.000Z
|
// ***************************************************************************
//
// Generated automatically by genwrapper.
// Please DO NOT EDIT this file!
//
// ***************************************************************************
#include <osgIntrospection/ReflectionMacros>
#include <osgIntrospection/TypedMethodInfo>
#include <osgIntrospection/StaticMethodInfo>
#include <osgIntrospection/Attributes>
#include <osg/CopyOp>
#include <osg/NodeVisitor>
#include <osg/Object>
#include <osgParticle/Counter>
#include <osgParticle/ModularEmitter>
#include <osgParticle/Placer>
#include <osgParticle/Shooter>
// Must undefine IN and OUT macros defined in Windows headers
#ifdef IN
#undef IN
#endif
#ifdef OUT
#undef OUT
#endif
BEGIN_OBJECT_REFLECTOR(osgParticle::ModularEmitter)
I_DeclaringFile("osgParticle/ModularEmitter");
I_BaseType(osgParticle::Emitter);
I_Constructor0(____ModularEmitter,
"",
"");
I_ConstructorWithDefaults2(IN, const osgParticle::ModularEmitter &, copy, , IN, const osg::CopyOp &, copyop, osg::CopyOp::SHALLOW_COPY,
____ModularEmitter__C5_ModularEmitter_R1__C5_osg_CopyOp_R1,
"",
"");
I_Method0(osg::Object *, cloneType,
Properties::VIRTUAL,
__osg_Object_P1__cloneType,
"clone an object of the same type as the node. ",
"");
I_Method1(osg::Object *, clone, IN, const osg::CopyOp &, copyop,
Properties::VIRTUAL,
__osg_Object_P1__clone__C5_osg_CopyOp_R1,
"return a clone of a node, with Object* return type. ",
"");
I_Method1(bool, isSameKindAs, IN, const osg::Object *, obj,
Properties::VIRTUAL,
__bool__isSameKindAs__C5_osg_Object_P1,
"return true if this and obj are of the same kind of object. ",
"");
I_Method0(const char *, className,
Properties::VIRTUAL,
__C5_char_P1__className,
"return the name of the node's class type. ",
"");
I_Method0(const char *, libraryName,
Properties::VIRTUAL,
__C5_char_P1__libraryName,
"return the name of the node's library. ",
"");
I_Method1(void, accept, IN, osg::NodeVisitor &, nv,
Properties::VIRTUAL,
__void__accept__osg_NodeVisitor_R1,
"Visitor Pattern : calls the apply method of a NodeVisitor with this node's type. ",
"");
I_Method0(osgParticle::Counter *, getCounter,
Properties::NON_VIRTUAL,
__Counter_P1__getCounter,
"Get the counter object. ",
"");
I_Method0(const osgParticle::Counter *, getCounter,
Properties::NON_VIRTUAL,
__C5_Counter_P1__getCounter,
"Get the const Counter object. ",
"");
I_Method1(void, setCounter, IN, osgParticle::Counter *, c,
Properties::NON_VIRTUAL,
__void__setCounter__Counter_P1,
"Set the Counter object. ",
"");
I_Method0(float, getNumParticlesToCreateMovementCompensationRatio,
Properties::NON_VIRTUAL,
__float__getNumParticlesToCreateMovementCompensationRatio,
"Get the ratio between number of particle to create in compensation for movement of the emitter. ",
"");
I_Method1(void, setNumParticlesToCreateMovementCompensationRatio, IN, float, r,
Properties::NON_VIRTUAL,
__void__setNumParticlesToCreateMovementCompensationRatio__float,
"Set the ratio between number of particle to create in compenstation for movement of the emitter. ",
"");
I_Method0(osgParticle::Placer *, getPlacer,
Properties::NON_VIRTUAL,
__Placer_P1__getPlacer,
"Get the Placer object. ",
"");
I_Method0(const osgParticle::Placer *, getPlacer,
Properties::NON_VIRTUAL,
__C5_Placer_P1__getPlacer,
"Get the const Placer object. ",
"");
I_Method1(void, setPlacer, IN, osgParticle::Placer *, p,
Properties::NON_VIRTUAL,
__void__setPlacer__Placer_P1,
"Set the Placer object. ",
"");
I_Method0(osgParticle::Shooter *, getShooter,
Properties::NON_VIRTUAL,
__Shooter_P1__getShooter,
"Get the Shooter object. ",
"");
I_Method0(const osgParticle::Shooter *, getShooter,
Properties::NON_VIRTUAL,
__C5_Shooter_P1__getShooter,
"Get the const Shooter object. ",
"");
I_Method1(void, setShooter, IN, osgParticle::Shooter *, s,
Properties::NON_VIRTUAL,
__void__setShooter__Shooter_P1,
"Set the Shooter object. ",
"");
I_ProtectedMethod1(void, emit, IN, double, dt,
Properties::VIRTUAL,
Properties::NON_CONST,
__void__emit__double,
"",
"");
I_SimpleProperty(osgParticle::Counter *, Counter,
__Counter_P1__getCounter,
__void__setCounter__Counter_P1);
I_SimpleProperty(float, NumParticlesToCreateMovementCompensationRatio,
0,
__void__setNumParticlesToCreateMovementCompensationRatio__float);
I_SimpleProperty(osgParticle::Placer *, Placer,
__Placer_P1__getPlacer,
__void__setPlacer__Placer_P1);
I_SimpleProperty(osgParticle::Shooter *, Shooter,
__Shooter_P1__getShooter,
__void__setShooter__Shooter_P1);
END_REFLECTOR
| 39.118056
| 136
| 0.611575
|
UM-ARM-Lab
|
bb1c1c7b2f5a9987397bfbf8bf87c2f1b99d4c2f
| 3,120
|
cpp
|
C++
|
dep/include/yse/JuceLibraryCode/examples/Demo/Source/Demos/CodeEditorDemo.cpp
|
ChrSacher/MyEngine
|
8fe71fd9e84b9536148e0d4ebb4e53751ab49ce8
|
[
"Apache-2.0"
] | 2
|
2015-10-27T21:36:59.000Z
|
2017-03-17T21:52:19.000Z
|
dep/include/yse/JuceLibraryCode/examples/Demo/Source/Demos/CodeEditorDemo.cpp
|
ChrSacher/MyEngine
|
8fe71fd9e84b9536148e0d4ebb4e53751ab49ce8
|
[
"Apache-2.0"
] | null | null | null |
dep/include/yse/JuceLibraryCode/examples/Demo/Source/Demos/CodeEditorDemo.cpp
|
ChrSacher/MyEngine
|
8fe71fd9e84b9536148e0d4ebb4e53751ab49ce8
|
[
"Apache-2.0"
] | null | null | null |
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2015 - ROLI Ltd.
Permission is granted to use this software under the terms of either:
a) the GPL v2 (or any later version)
b) the Affero GPL v3
Details of these licenses can be found at: www.gnu.org/licenses
JUCE 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.
------------------------------------------------------------------------------
To release a closed-source product which uses JUCE, commercial licenses are
available: visit www.juce.com for more information.
==============================================================================
*/
#include "../JuceDemoHeader.h"
//==============================================================================
class CodeEditorDemo : public Component,
private FilenameComponentListener
{
public:
CodeEditorDemo()
: fileChooser ("File", File::nonexistent, true, false, false,
"*.cpp;*.h;*.hpp;*.c;*.mm;*.m", String(),
"Choose a C++ file to open it in the editor")
{
setOpaque (true);
// Create the editor..
addAndMakeVisible (editor = new CodeEditorComponent (codeDocument, &cppTokeniser));
editor->loadContent ("\n"
"/* Code editor demo!\n"
"\n"
" To see a real-world example of the code editor\n"
" in action, try the Introjucer!\n"
"\n"
"*/\n"
"\n");
// Create a file chooser control to load files into it..
addAndMakeVisible (fileChooser);
fileChooser.addListener (this);
}
~CodeEditorDemo()
{
fileChooser.removeListener (this);
}
void paint (Graphics& g) override
{
g.fillAll (Colours::lightgrey);
}
void resized() override
{
Rectangle<int> r (getLocalBounds().reduced (8));
fileChooser.setBounds (r.removeFromTop (25));
editor->setBounds (r.withTrimmedTop (8));
}
private:
// this is the document that the editor component is showing
CodeDocument codeDocument;
// this is a tokeniser to apply the C++ syntax highlighting
CPlusPlusCodeTokeniser cppTokeniser;
// the editor component
ScopedPointer<CodeEditorComponent> editor;
FilenameComponent fileChooser;
void filenameComponentChanged (FilenameComponent*) override
{
editor->loadContent (fileChooser.getCurrentFile().loadFileAsString());
}
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (CodeEditorDemo)
};
// This static object will register this demo type in a global list of demos..
static JuceDemoType<CodeEditorDemo> demo ("10 Components: Code Editor");
| 31.836735
| 91
| 0.552885
|
ChrSacher
|
bb1e983ca949afa38e38b5e676b6c020cc774aec
| 6,504
|
cpp
|
C++
|
Sail/src/Sail/graphics/shader/basic/SimpleTextureShader.cpp
|
h3nx/Sail
|
96c13ee50bf9666c01bb8bb263e0c2dc3ba0eff9
|
[
"MIT"
] | null | null | null |
Sail/src/Sail/graphics/shader/basic/SimpleTextureShader.cpp
|
h3nx/Sail
|
96c13ee50bf9666c01bb8bb263e0c2dc3ba0eff9
|
[
"MIT"
] | null | null | null |
Sail/src/Sail/graphics/shader/basic/SimpleTextureShader.cpp
|
h3nx/Sail
|
96c13ee50bf9666c01bb8bb263e0c2dc3ba0eff9
|
[
"MIT"
] | null | null | null |
#include "SimpleTextureShader.h"
using namespace DirectX::SimpleMath;
D3D11_INPUT_ELEMENT_DESC SimpleTextureShader::IED[2] = {
{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },
};
SimpleTextureShader::SimpleTextureShader() {
ModelDataBuffer defaultBuffer = { Vector4::One, Matrix::Identity, Matrix::Identity };
m_transformBuffer = std::unique_ptr<ShaderComponent::ConstantBuffer>(new ShaderComponent::ConstantBuffer(&defaultBuffer, sizeof(ModelDataBuffer)));
m_sampler = std::make_unique<ShaderComponent::Sampler>();
ClippingPlaneBuffer defaultClippingBuffer = { Vector4(0.f, 0.f, 0.f, 0.f) };
m_clippingPlaneBuffer = std::unique_ptr<ShaderComponent::ConstantBuffer>(new ShaderComponent::ConstantBuffer(&defaultClippingBuffer, sizeof(ClippingPlaneBuffer)));
// Compile shader and add to this shaderSet
auto vsBlob = compileShader(L"SimpleTextureShader.hlsl", "VSMain", "vs_5_0");
setVertexShader(vsBlob);
// Compile shader and add to this shaderSet
auto psBlob = compileShader(L"SimpleTextureShader.hlsl", "PSMain", "ps_5_0");
setPixelShader(psBlob);
// Create the inputlayout
Application::getInstance()->getDXManager()->getDevice()->CreateInputLayout(IED, 2, vsBlob->GetBufferPointer(), vsBlob->GetBufferSize(), &m_inputLayout);
// Done with the blobs, release them
Memory::safeRelease(vsBlob);
Memory::safeRelease(psBlob);
}
SimpleTextureShader::~SimpleTextureShader() {
Memory::safeRelease(m_inputLayout);
}
void SimpleTextureShader::updateCamera(Camera& cam) {
m_vpMatrix = cam.getViewProjection();
}
void SimpleTextureShader::updateBuffer(const DirectX::SimpleMath::Vector4& color, const DirectX::SimpleMath::Matrix& w, const DirectX::SimpleMath::Matrix& vp) const {
ModelDataBuffer data = { color, w.Transpose(), vp.Transpose() };
m_transformBuffer->updateData(&data, sizeof(data));
}
void SimpleTextureShader::setClippingPlane(const DirectX::SimpleMath::Vector4& clippingPlane) {
ClippingPlaneBuffer data = { clippingPlane };
m_clippingPlaneBuffer->updateData(&data, sizeof(data));
}
void SimpleTextureShader::bind() {
ShaderSet::bind();
// Set input layout as active
Application::getInstance()->getDXManager()->getDeviceContext()->IASetInputLayout(m_inputLayout);
// Bind the transform constant buffer
m_transformBuffer->bind(ShaderComponent::VS, 0);
// Bind clipping plane buffer
m_clippingPlaneBuffer->bind(ShaderComponent::VS, 1);
// Bind sampler
m_sampler->bind();
}
void SimpleTextureShader::createBufferFromModelData(ID3D11Buffer** vertexBuffer, ID3D11Buffer** indexBuffer, ID3D11Buffer** instanceBuffer, const void* data) {
Model::Data modelData = *(Model::Data*)data;
if (modelData.numVertices <= 0 || !modelData.positions)
Logger::Error("numVertices or position data not set for model");
if (!modelData.texCoords) {
Logger::Warning("Texture coordinates not set for model that will render with a texture shader");
}
// Create the vertex array that this shader uses
SimpleTextureShader::Vertex* vertices = new SimpleTextureShader::Vertex[modelData.numVertices];
for (UINT i = 0; i < modelData.numVertices; i++) {
vertices[i].position = modelData.positions[i];
if (modelData.texCoords)
vertices[i].texCoord = modelData.texCoords[i];
else
vertices[i].texCoord = Vector2(0.f, 0.f);
}
D3D11_BUFFER_DESC vbd;
ZeroMemory(&vbd, sizeof(vbd));
vbd.Usage = D3D11_USAGE_IMMUTABLE;
vbd.ByteWidth = modelData.numVertices * sizeof(SimpleTextureShader::Vertex);
vbd.BindFlags = D3D11_BIND_VERTEX_BUFFER;
vbd.CPUAccessFlags = 0;
D3D11_SUBRESOURCE_DATA vertexData;
ZeroMemory(&vertexData, sizeof(vertexData));
vertexData.pSysMem = vertices;
// Create the vertex buffer
ThrowIfFailed(Application::getInstance()->getDXManager()->getDevice()->CreateBuffer(&vbd, &vertexData, vertexBuffer));
// Delete vertices from cpu memory
Memory::safeDeleteArr(vertices);
// Set up index buffer if indices are set
if (modelData.numIndices > 0) {
ULONG* indices = new ULONG[modelData.numIndices];
// Fill the array with the model indices
for (UINT i = 0; i < modelData.numIndices; i++) {
indices[i] = modelData.indices[i];
}
// Set up index buffer description
D3D11_BUFFER_DESC ibd;
ZeroMemory(&ibd, sizeof(ibd));
ibd.Usage = D3D11_USAGE_IMMUTABLE;
ibd.ByteWidth = modelData.numIndices * sizeof(UINT);
ibd.BindFlags = D3D11_BIND_INDEX_BUFFER;
ibd.CPUAccessFlags = 0;
D3D11_SUBRESOURCE_DATA indexData;
ZeroMemory(&indexData, sizeof(indexData));
indexData.pSysMem = indices;
// Create the index buffer
ThrowIfFailed(Application::getInstance()->getDXManager()->getDevice()->CreateBuffer(&ibd, &indexData, indexBuffer));
// Delete indices from cpu memory
Memory::safeDeleteArr(indices);
}
}
void SimpleTextureShader::draw(Model& model, bool bindFirst) {
// TODO: remove
//if (bindFirst) {
// // Bind the shaders
// // Bind the input layout
// // bind constant buffer
// bind();
//}
//// Update the world matrix to match this model
//auto modelColor = model.getMaterial()->getColor();
//updateBuffer(modelColor, model.getTransform().getMatrix(), m_vpMatrix);
//// Bind the texture if it exists
//UINT numTextures;
//auto tex = model.getMaterial()->getTextures(numTextures);
//if (tex)
// Application::getInstance()->getDXManager()->getDeviceContext()->PSSetShaderResources(0, numTextures, tex);
//// Bind vertex buffer
//UINT stride = sizeof(SimpleTextureShader::Vertex);
//UINT offset = 0;
//Application::getInstance()->getDXManager()->getDeviceContext()->IASetVertexBuffers(0, 1, model.getVertexBuffer(), &stride, &offset);
//// Bind index buffer if one exists
//auto* iBuffer = model.getIndexBuffer();
//if (iBuffer)
// Application::getInstance()->getDXManager()->getDeviceContext()->IASetIndexBuffer(iBuffer, DXGI_FORMAT_R32_UINT, 0);
//// Set topology
//Application::getInstance()->getDXManager()->getDeviceContext()->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
//// Draw
//if (iBuffer)
// Application::getInstance()->getDXManager()->getDeviceContext()->DrawIndexed(model.getNumIndices(), 0, 0);
//else
// Application::getInstance()->getDXManager()->getDeviceContext()->Draw(model.getNumVertices(), 0);
//ID3D11ShaderResourceView* nullSRV[5] = { nullptr, nullptr, nullptr, nullptr, nullptr };
//Application::getInstance()->getDXManager()->getDeviceContext()->PSSetShaderResources(0, 5, nullSRV);
}
| 36.539326
| 166
| 0.747386
|
h3nx
|
bb1f0f656cfcbb9839e610c3c0eb24ab2b902c2f
| 1,332
|
cpp
|
C++
|
CppProject/product.cpp
|
maximlo91/Store-Management-System
|
1da6136baf964834834925f0d4ac1adac2cb306f
|
[
"MIT"
] | null | null | null |
CppProject/product.cpp
|
maximlo91/Store-Management-System
|
1da6136baf964834834925f0d4ac1adac2cb306f
|
[
"MIT"
] | null | null | null |
CppProject/product.cpp
|
maximlo91/Store-Management-System
|
1da6136baf964834834925f0d4ac1adac2cb306f
|
[
"MIT"
] | null | null | null |
#pragma warning(disable: 4996)
#include <iostream>
#include <string>
#include "product.h"
#include "general.h"
using namespace std;
const char* Product::categories[] = {"Children","Office","Electricity","Clothes"};
int Product::s_counter = 0;
//constructor .
Product::Product(Item e_category, const string& itemName, int price,Seller& itemSeller) :
m_serialNum(Product::s_counter), e_category(e_category), m_itemSeller(&itemSeller), m_price(price), m_itemName(itemName)
{
Product::s_counter++;
}
//destructor .
Product::~Product()
{
}
//returns a category .
const char* Product::getCategory() const
{
return Product::categories[e_category-1];
}
//returns a name .
const string& Product::getName() const
{
return this->m_itemName;
}
//returns a price .
int Product::getPrice() const
{
return this->m_price;
}
//returns a id .
int Product::getId() const
{
return this->m_serialNum;
}
// returns a pointer to a seller of an item
Seller* Product::getSeller() const
{
return this->m_itemSeller;
}
// overloaded ostream, prints product info
std::ostream& operator<<(std::ostream& out, const Product& product)
{
out << "Product Name: " << product.m_itemName << "\nProduct Category: " << product.getCategory() << "\nProdcut ID: " <<
product.getId() << "\nProduct Price: " << product.getPrice() << endl;
return out;
}
| 21.483871
| 121
| 0.704955
|
maximlo91
|
bb244c4e99cee843542cc93c74b2a689745c651f
| 2,707
|
hpp
|
C++
|
breath/counting/signed_count.hpp
|
erez-o/breath
|
adf197b4e959beffce11e090c5e806d2ff4df38a
|
[
"BSD-3-Clause"
] | null | null | null |
breath/counting/signed_count.hpp
|
erez-o/breath
|
adf197b4e959beffce11e090c5e806d2ff4df38a
|
[
"BSD-3-Clause"
] | null | null | null |
breath/counting/signed_count.hpp
|
erez-o/breath
|
adf197b4e959beffce11e090c5e806d2ff4df38a
|
[
"BSD-3-Clause"
] | null | null | null |
// ===========================================================================
// Copyright 2007 Gennaro Prota
//
// Licensed under the 3-Clause BSD License.
// (See accompanying file 3_CLAUSE_BSD_LICENSE.txt or
// <https://opensource.org/licenses/BSD-3-Clause>.)
// ___________________________________________________________________________
//
//! \file
//! \brief Arrays and containers element counter.
//!
//! An extension of \c container::size() to cover both standard
//! containers and built-in arrays.
//!
//! The syntax is, uniformly, \c breath::count( a ) regardless of
//! the actual type of \c a. See also begin_end.hpp.
//!
//! Following C++ best practices, these templates return a \e signed
//! integer. They are made obsolete in C++20 by the namespace-scope
//! \c std::ssize()'s. However our version avoids any fancy
//! derivation of the return type, even for containers; and, for
//! containers again, has a conditional noexcept that the standard
//! version is not required to have.
// ---------------------------------------------------------------------------
#ifndef BREATH_GUARD_ivBlyIgMoh0KJl1p5J44xFCWiI9nPqRi
#define BREATH_GUARD_ivBlyIgMoh0KJl1p5J44xFCWiI9nPqRi
#include "breath/top_level_namespace.hpp"
#include "breath/diagnostics/assert.hpp"
#include "breath/preprocessing/prevent_macro_expansion.hpp"
#include <cstddef>
#include <limits>
namespace breath_ns {
// signed_count():
// ===============
//
//! \return
//! The number of elements of the array argument (obviously, \c
//! n). See also the file-level documentation.
// ---------------------------------------------------------------------------
template< typename T, std::ptrdiff_t n >
constexpr std::ptrdiff_t
signed_count( T const ( & )[ n ] ) noexcept
{
return n ;
}
// signed_count():
// ===============
//
//! \return
//! The value of \c t.size() converted to \c std::ptrdiff_t. See
//! also the file-level documentation.
// ---------------------------------------------------------------------------
template< typename T >
constexpr std::ptrdiff_t
signed_count( T const & t ) noexcept( noexcept( t.size() ) )
{
typedef std::ptrdiff_t
return_type ;
BREATH_ASSERT(
t.size() <= std::numeric_limits< return_type >::max
BREATH_PREVENT_MACRO_EXPANSION ()
) ;
return static_cast< return_type >( t.size() ) ;
}
}
#endif
// Local Variables:
// mode: c++
// indent-tabs-mode: nil
// c-basic-offset: 4
// End:
// vim: set ft=cpp et sts=4 sw=4:
| 33.012195
| 78
| 0.559291
|
erez-o
|
bb24f5903b0733ec5b5f9a9bf18deb5493a48743
| 7,524
|
cpp
|
C++
|
Axis.CommonLibrary/domain/elements/ElementGeometry.cpp
|
renato-yuzup/axis-fem
|
2e8d325eb9c8e99285f513b4c1218ef53eb0ab22
|
[
"MIT"
] | 2
|
2021-07-23T08:49:54.000Z
|
2021-07-29T22:07:30.000Z
|
Axis.CommonLibrary/domain/elements/ElementGeometry.cpp
|
renato-yuzup/axis-fem
|
2e8d325eb9c8e99285f513b4c1218ef53eb0ab22
|
[
"MIT"
] | null | null | null |
Axis.CommonLibrary/domain/elements/ElementGeometry.cpp
|
renato-yuzup/axis-fem
|
2e8d325eb9c8e99285f513b4c1218ef53eb0ab22
|
[
"MIT"
] | null | null | null |
#include "ElementGeometry.hpp"
#include "foundation/ArgumentException.hpp"
#include "foundation/OutOfBoundsException.hpp"
#include "System.hpp"
#include "foundation/memory/pointer.hpp"
namespace ade = axis::domain::elements;
namespace adi = axis::domain::integration;
namespace afb = axis::foundation::blas;
namespace afm = axis::foundation::memory;
ade::ElementGeometry::ElementGeometry( int numNodes )
{
InitGeometry(numNodes);
points_ = NULLPTR;
}
ade::ElementGeometry::ElementGeometry( int numNodes, int numIntegrationPoints )
{
InitGeometry(numNodes);
numIntegrPoints_ = numIntegrationPoints;
points_ = System::ModelMemory().Allocate(sizeof(afm::RelativePointer)*numIntegrationPoints);
}
void ade::ElementGeometry::InitGeometry( int numNodes )
{
// check for a valid number of nodes
if (numNodes < 1)
{
throw axis::foundation::ArgumentException(_TEXT("numNodes"));
}
// create arrays
#if defined(AXIS_NO_MEMORY_ARENA)
nodes_ = new Node*[numNodes];
Node **nodes = nodes_;
#else
nodes_ = System::ModelMemory().Allocate(sizeof(afm::RelativePointer) * numNodes);
afm::RelativePointer *nodes = (afm::RelativePointer*)*nodes_;
#endif
numNodes_ = numNodes;
for (int i = 0; i < numNodes; i++)
{
nodes[i] = NULLPTR;
}
// init variables
numIntegrPoints_ = 0;
}
ade::ElementGeometry::~ElementGeometry( void )
{
if(numIntegrPoints_ > 0)
{
afm::RelativePointer *ptr = (afm::RelativePointer *)*points_;
for (int i = 0; i < numIntegrPoints_; i++)
{
adi::IntegrationPoint& p = absref<adi::IntegrationPoint>(ptr[i]);
System::ModelMemory().Deallocate(ptr[i]);
p.Destroy();
}
System::ModelMemory().Deallocate(points_);
}
#if defined(AXIS_NO_MEMORY_ARENA)
delete [] nodes_;
#else
System::ModelMemory().Deallocate(nodes_);
#endif
}
#if defined(AXIS_NO_MEMORY_ARENA)
void ade::ElementGeometry::SetNode( int nodeIndex, Node& node )
#else
void ade::ElementGeometry::SetNode( int nodeIndex, const afm::RelativePointer& node )
#endif
{
if (nodeIndex < 0 || nodeIndex >= numNodes_)
{
throw axis::foundation::OutOfBoundsException();
}
#if defined(AXIS_NO_MEMORY_ARENA)
nodes_[nodeIndex] = &node;
#else
afm::RelativePointer * n = (afm::RelativePointer*)*nodes_;
n[nodeIndex] = node;
#endif
}
const ade::Node& ade::ElementGeometry::GetNode( int nodeId ) const
{
#if defined(AXIS_NO_MEMORY_ARENA)
return *nodes_[nodeId];
#else
const afm::RelativePointer * n = absptr<afm::RelativePointer>(nodes_);
return absref<Node>(n[nodeId]);
#endif
}
ade::Node& ade::ElementGeometry::GetNode( int nodeId )
{
#if defined(AXIS_NO_MEMORY_ARENA)
return *nodes_[nodeId];
#else
afm::RelativePointer * n = absptr<afm::RelativePointer>(nodes_);
return absref<Node>(n[nodeId]);
#endif
}
const ade::Node& ade::ElementGeometry::operator[]( int nodeId ) const
{
#if defined(AXIS_NO_MEMORY_ARENA)
return *nodes_[nodeId];
#else
const afm::RelativePointer * n = absptr<afm::RelativePointer>(nodes_);
return absref<Node>(n[nodeId]);
#endif
}
ade::Node& ade::ElementGeometry::operator[]( int nodeId )
{
#if defined(AXIS_NO_MEMORY_ARENA)
return *nodes_[nodeId];
#else
afm::RelativePointer * n = absptr<afm::RelativePointer>(nodes_);
return absref<Node>(n[nodeId]);
#endif
}
int ade::ElementGeometry::GetNodeCount( void ) const
{
return numNodes_;
}
void ade::ElementGeometry::ExtractLocalField( afb::ColumnVector& localField,
const afb::ColumnVector& globalField ) const
{
// build a matrix large enough for local field
int totalDof = GetTotalDofCount();
int pos = 0;
#if defined(AXIS_NO_MEMORY_ARENA)
Node** n = nodes_;
#else
const afm::RelativePointer * n = absptr<afm::RelativePointer>(nodes_);
#endif
for (int i = 0; i < numNodes_; i++)
{
const Node& node = absref<Node>(n[i]);
int nodeDofCount = node.GetDofCount();
for (int j = 0; j < nodeDofCount; j++)
{
localField(pos) = globalField(node[j].GetId());
++pos;
}
}
}
bool ade::ElementGeometry::HasIntegrationPoints( void ) const
{
return (numIntegrPoints_ > 0);
}
const adi::IntegrationPoint& ade::ElementGeometry::GetIntegrationPoint( int index ) const
{
if (index < 0 || index >= numIntegrPoints_)
{
throw axis::foundation::OutOfBoundsException();
}
afm::RelativePointer *points = (afm::RelativePointer *)*points_;
return absref<adi::IntegrationPoint>(points[index]);
}
adi::IntegrationPoint& ade::ElementGeometry::GetIntegrationPoint( int index )
{
if (index < 0 || index >= numIntegrPoints_)
{
throw axis::foundation::OutOfBoundsException();
}
afm::RelativePointer *points = (afm::RelativePointer *)*points_;
return absref<adi::IntegrationPoint>(points[index]);
}
void ade::ElementGeometry::SetIntegrationPoint( int index, const afm::RelativePointer& point )
{
if (index < 0 || index >= numIntegrPoints_)
{
throw axis::foundation::OutOfBoundsException();
}
afm::RelativePointer *points = (afm::RelativePointer *)*points_;
points[index] = point;
}
int ade::ElementGeometry::GetIntegrationPointCount( void ) const
{
return numIntegrPoints_;
}
bool ade::ElementGeometry::HasNode( const ade::Node& node ) const
{
#if defined(AXIS_NO_MEMORY_ARENA)
Node** n = nodes_;
#else
afm::RelativePointer * n = (afm::RelativePointer*)*nodes_;
#endif
for (int i = 0; i < numNodes_; ++i)
{
if (absptr<Node>(n[i]) == &node) return true;
}
return false;
}
int ade::ElementGeometry::GetNodeIndex( const ade::Node& node ) const
{
#if defined(AXIS_NO_MEMORY_ARENA)
Node** n = nodes_;
#else
afm::RelativePointer * n = (afm::RelativePointer*)*nodes_;
#endif
for (int i = 0; i < numNodes_; ++i)
{
if (absptr<Node>(n[i]) == &node) return i;
}
return -1;
}
int ade::ElementGeometry::GetTotalDofCount( void ) const
{
#if defined(AXIS_NO_MEMORY_ARENA)
Node** n = nodes_;
#else
afm::RelativePointer * n = (afm::RelativePointer*)*nodes_;
#endif
int totalDof = 0;
for (int i = 0; i < numNodes_; ++i)
{
totalDof += absref<Node>(n[i]).GetDofCount();
}
return totalDof;
}
#if !defined(AXIS_NO_MEMORY_ARENA)
afm::RelativePointer ade::ElementGeometry::Create( int numNodes, int integrationPointCount )
{
afm::RelativePointer ptr = System::ModelMemory().Allocate(sizeof(ElementGeometry));
new (*ptr) ElementGeometry(numNodes, integrationPointCount);
return ptr;
}
afm::RelativePointer ade::ElementGeometry::Create( int numNodes )
{
afm::RelativePointer ptr = System::ModelMemory().Allocate(sizeof(ElementGeometry));
new (*ptr) ElementGeometry(numNodes);
return ptr;
}
void * ade::ElementGeometry::operator new( size_t bytes )
{
// It is supposed that the finite element object will remain in memory
// until the end of the program. That's why we discard the relative
// pointer. We ignore the fact that an exception might occur in
// constructor because if it does happen, the program will end.
afm::RelativePointer ptr = System::GlobalMemory().Allocate(bytes);
return *ptr;
}
void * ade::ElementGeometry::operator new( size_t, void *ptr )
{
return ptr;
}
void ade::ElementGeometry::operator delete( void * )
{
// Since the relative pointer was discarded, we can't discard memory.
// If it is really necessary, to free up resources, obliterating
// memory pool is a better approach.
}
void ade::ElementGeometry::operator delete( void *, void * )
{
// Since the relative pointer was discarded, we can't discard memory.
// If it is really necessary, to free up resources, obliterating
// memory pool is a better approach.
}
#endif
| 26.216028
| 94
| 0.708931
|
renato-yuzup
|
bb27df86b6a8cf4ebe84294be726370deb451ed0
| 2,923
|
cpp
|
C++
|
src/transforms/vision/unit_test/random_affine_test.cpp
|
jychoi-hpc/lbann
|
4232883aee90448e8beb89967ce30fee9c4a68bf
|
[
"Apache-2.0"
] | null | null | null |
src/transforms/vision/unit_test/random_affine_test.cpp
|
jychoi-hpc/lbann
|
4232883aee90448e8beb89967ce30fee9c4a68bf
|
[
"Apache-2.0"
] | 66
|
2018-04-04T22:24:42.000Z
|
2020-10-23T01:50:34.000Z
|
src/transforms/vision/unit_test/random_affine_test.cpp
|
jychoi-hpc/lbann
|
4232883aee90448e8beb89967ce30fee9c4a68bf
|
[
"Apache-2.0"
] | null | null | null |
// MUST include this
#include <catch2/catch.hpp>
// File being tested
#include <lbann/transforms/vision/random_affine.hpp>
#include "helper.hpp"
// Note: This is *random* so we only do basic checks.
TEST_CASE("Testing random affine preprocessing", "[preproc]") {
lbann::utils::type_erased_matrix mat = lbann::utils::type_erased_matrix(El::Matrix<uint8_t>());
// For simplicity, we'll only use a 3-channel matrix here.
identity(mat.template get<uint8_t>(), 10, 10, 3);
std::vector<size_t> dims = {3, 10, 10};
SECTION("rotation") {
auto affiner = lbann::transform::random_affine(0.0, 90.0, 0, 0, 0, 0, 0, 0);
SECTION("applying the transform") {
REQUIRE_NOTHROW(affiner.apply(mat, dims));
SECTION("transform does not change dims") {
REQUIRE(dims[0] == 3);
REQUIRE(dims[1] == 10);
REQUIRE(dims[2] == 10);
}
SECTION("transform does not change matrix type") {
REQUIRE_NOTHROW(mat.template get<uint8_t>());
}
}
}
SECTION("translate") {
auto affiner = lbann::transform::random_affine(0, 0, 0.1, 0.1, 0, 0, 0, 0);
SECTION("applying the transform") {
REQUIRE_NOTHROW(affiner.apply(mat, dims));
SECTION("transform does not change dims") {
REQUIRE(dims[0] == 3);
REQUIRE(dims[1] == 10);
REQUIRE(dims[2] == 10);
}
SECTION("transform does not change matrix type") {
REQUIRE_NOTHROW(mat.template get<uint8_t>());
}
}
}
SECTION("scale") {
auto affiner = lbann::transform::random_affine(0, 0, 0, 0, 0.0, 2.0, 0, 0);
SECTION("applying the transform") {
REQUIRE_NOTHROW(affiner.apply(mat, dims));
SECTION("transform does not change dims") {
REQUIRE(dims[0] == 3);
REQUIRE(dims[1] == 10);
REQUIRE(dims[2] == 10);
}
SECTION("transform does not change matrix type") {
REQUIRE_NOTHROW(mat.template get<uint8_t>());
}
}
}
SECTION("shear") {
auto affiner = lbann::transform::random_affine(0, 0, 0, 0, 0, 0, 0.0, 45.0);
SECTION("applying the transform") {
REQUIRE_NOTHROW(affiner.apply(mat, dims));
SECTION("transform does not change dims") {
REQUIRE(dims[0] == 3);
REQUIRE(dims[1] == 10);
REQUIRE(dims[2] == 10);
}
SECTION("transform does not change matrix type") {
REQUIRE_NOTHROW(mat.template get<uint8_t>());
}
}
}
SECTION("all") {
auto affiner = lbann::transform::random_affine(
0.0, 90.0, 0.1, 0.1, 0.0, 2.0, 0.0, 45.0);
SECTION("applying the transform") {
REQUIRE_NOTHROW(affiner.apply(mat, dims));
SECTION("transform does not change dims") {
REQUIRE(dims[0] == 3);
REQUIRE(dims[1] == 10);
REQUIRE(dims[2] == 10);
}
SECTION("transform does not change matrix type") {
REQUIRE_NOTHROW(mat.template get<uint8_t>());
}
}
}
}
| 28.940594
| 97
| 0.59391
|
jychoi-hpc
|
bb2819488732cdb10144f8467b2b9371ae358f8f
| 239
|
cpp
|
C++
|
docs/mfc/reference/codesnippet/CPP/cricheditctrl-class_33.cpp
|
bobbrow/cpp-docs
|
769b186399141c4ea93400863a7d8463987bf667
|
[
"CC-BY-4.0",
"MIT"
] | 965
|
2017-06-25T23:57:11.000Z
|
2022-03-31T14:17:32.000Z
|
docs/mfc/reference/codesnippet/CPP/cricheditctrl-class_33.cpp
|
bobbrow/cpp-docs
|
769b186399141c4ea93400863a7d8463987bf667
|
[
"CC-BY-4.0",
"MIT"
] | 3,272
|
2017-06-24T00:26:34.000Z
|
2022-03-31T22:14:07.000Z
|
docs/mfc/reference/codesnippet/CPP/cricheditctrl-class_33.cpp
|
bobbrow/cpp-docs
|
769b186399141c4ea93400863a7d8463987bf667
|
[
"CC-BY-4.0",
"MIT"
] | 951
|
2017-06-25T12:36:14.000Z
|
2022-03-26T22:49:06.000Z
|
CHARFORMAT cf;
// Modify the word format so that the selected word is
// displayed in bold and not striked out.
cf.cbSize = sizeof(cf);
cf.dwMask = CFM_STRIKEOUT | CFM_BOLD;
cf.dwEffects = CFE_BOLD;
m_myRichEditCtrl.SetWordCharFormat(cf);
| 29.875
| 54
| 0.769874
|
bobbrow
|
bb2e1045791455bec7e6731c7e4f2db10f6ff609
| 1,270
|
cpp
|
C++
|
src/gct/is_bgra.cpp
|
Fadis/gct
|
bde211f9336e945e4db21f5abb4ce01dcad78049
|
[
"MIT"
] | 1
|
2022-03-03T09:27:09.000Z
|
2022-03-03T09:27:09.000Z
|
src/gct/is_bgra.cpp
|
Fadis/gct
|
bde211f9336e945e4db21f5abb4ce01dcad78049
|
[
"MIT"
] | 1
|
2021-12-02T03:45:45.000Z
|
2021-12-03T23:44:37.000Z
|
src/gct/is_bgra.cpp
|
Fadis/gct
|
bde211f9336e945e4db21f5abb4ce01dcad78049
|
[
"MIT"
] | null | null | null |
#include <gct/format.hpp>
namespace gct {
bool is_bgra( vk::Format format ) {
if( format == vk::Format::eB4G4R4A4UnormPack16) return true;
else if( format == vk::Format::eB5G6R5UnormPack16) return true;
else if( format == vk::Format::eB5G5R5A1UnormPack16) return true;
else if( format == vk::Format::eB8G8R8Unorm) return true;
else if( format == vk::Format::eB8G8R8Snorm) return true;
else if( format == vk::Format::eB8G8R8Uscaled) return true;
else if( format == vk::Format::eB8G8R8Sscaled) return true;
else if( format == vk::Format::eB8G8R8Uint) return true;
else if( format == vk::Format::eB8G8R8Sint) return true;
else if( format == vk::Format::eB8G8R8Srgb) return true;
else if( format == vk::Format::eB8G8R8A8Unorm) return true;
else if( format == vk::Format::eB8G8R8A8Snorm) return true;
else if( format == vk::Format::eB8G8R8A8Uscaled) return true;
else if( format == vk::Format::eB8G8R8A8Sscaled) return true;
else if( format == vk::Format::eB8G8R8A8Uint) return true;
else if( format == vk::Format::eB8G8R8A8Sint) return true;
else if( format == vk::Format::eB8G8R8A8Srgb) return true;
else if( format == vk::Format::eB10G11R11UfloatPack32) return true;
else return false;
}
}
| 47.037037
| 71
| 0.685827
|
Fadis
|
bb2ea0b7844a55c68b9f7edf1048828b7691db8c
| 3,309
|
cpp
|
C++
|
test/functional/gfalt_test_copy_file_mkdir.cpp
|
adevress/gfal2
|
ce8945d1c153e26c5d10ad43d1940b8dcace0579
|
[
"Apache-2.0"
] | null | null | null |
test/functional/gfalt_test_copy_file_mkdir.cpp
|
adevress/gfal2
|
ce8945d1c153e26c5d10ad43d1940b8dcace0579
|
[
"Apache-2.0"
] | null | null | null |
test/functional/gfalt_test_copy_file_mkdir.cpp
|
adevress/gfal2
|
ce8945d1c153e26c5d10ad43d1940b8dcace0579
|
[
"Apache-2.0"
] | 1
|
2020-04-28T09:36:46.000Z
|
2020-04-28T09:36:46.000Z
|
/**
* Compile command : gcc -o gfalt_copyfile gfalt_copyfile.c `pkg-config --libs --cflags gfal_transfer`
*/
#include <gtest/gtest.h>
#include <gfal_api.h>
#include <stdio.h>
#include <stdlib.h>
#include <utils/exceptions/gerror_to_cpp.h>
#include <transfer/gfal_transfer.h>
#include <common/gfal_lib_test.h>
#include <common/gfal_gtest_asserts.h>
#include <list>
class CopyTestMkdir: public testing::Test {
public:
static const char* source_root;
static const char* destination_root;
char source[2048];
char destination[2048];
gfal2_context_t handle;
gfalt_params_t params;
std::list<std::string> directories;
CopyTestMkdir() {
GError *error = NULL;
handle = gfal2_context_new(&error);
Gfal::gerror_to_cpp(&error);
params = gfalt_params_handle_new(NULL);
gfalt_set_create_parent_dir(params, TRUE, NULL);
}
virtual ~CopyTestMkdir() {
gfal2_context_free(handle);
gfalt_params_handle_delete(params, NULL);
}
virtual void SetUp() {
generate_random_uri(source_root, "copyfile_replace_source", source, 2048);
RecordProperty("Source", source);
RecordProperty("Destination", source);
GError* error = NULL;
int ret = generate_file_if_not_exists(handle, source, "file:///etc/hosts", &error);
EXPECT_PRED_FORMAT2(AssertGfalSuccess, ret, error);
}
virtual void TearDown() {
gfal_unlink(source);
gfal_unlink(destination);
std::list<std::string>::const_iterator i;
for (i = directories.begin(); i != directories.end(); ++i)
gfal_rmdir(i->c_str());
directories.clear();
}
};
const char* CopyTestMkdir::source_root;
const char* CopyTestMkdir::destination_root;
TEST_F(CopyTestMkdir, CopyNested)
{
char first_level[2048];
char second_level[2048];
char third_level[2048];
generate_random_uri(destination_root, "generate_folder", first_level, 2048);
generate_random_uri(first_level, "generate_folder2", second_level, 2048);
generate_random_uri(second_level, "generate_folder3", third_level, 2048);
generate_random_uri(third_level, "generate_dest_file", destination, 2048);
directories.push_front(first_level);
directories.push_front(second_level);
directories.push_front(third_level);
GError *error = NULL;
int ret = 0;
ret = gfalt_copy_file(handle, params, source, destination, &error);
EXPECT_PRED_FORMAT2(AssertGfalSuccess, ret, error);
}
TEST_F(CopyTestMkdir, CopyAtRoot)
{
generate_random_uri(destination_root, "simple_file_at_root", destination, 2048);
GError *error = NULL;
int ret = 0;
ret = gfalt_copy_file(handle, params, source, destination, &error);
EXPECT_PRED_FORMAT2(AssertGfalSuccess, ret, error);
}
int main(int argc, char** argv)
{
testing::InitGoogleTest(&argc, argv);
if (argc < 2) {
printf("Missing source and destination base urls\n");
printf("\t%s [options] srm://host/base/path/ srm://destination/base/path/\n", argv[0]);
return 1;
}
CopyTestMkdir::source_root = argv[1];
CopyTestMkdir::destination_root = argv[2];
// gfal_set_verbose(GFAL_VERBOSE_TRACE | GFAL_VERBOSE_VERBOSE | GFAL_VERBOSE_DEBUG);
return RUN_ALL_TESTS();
}
| 27.347107
| 102
| 0.68903
|
adevress
|
bb329733361f1d7ce48a9156918d00aed2690e55
| 4,402
|
cpp
|
C++
|
Source/FPSProject/FPSHud.cpp
|
ellji/FPSProject
|
d1ae8b45acd52426aa4391caaae01ccd13c09a80
|
[
"MIT"
] | null | null | null |
Source/FPSProject/FPSHud.cpp
|
ellji/FPSProject
|
d1ae8b45acd52426aa4391caaae01ccd13c09a80
|
[
"MIT"
] | null | null | null |
Source/FPSProject/FPSHud.cpp
|
ellji/FPSProject
|
d1ae8b45acd52426aa4391caaae01ccd13c09a80
|
[
"MIT"
] | null | null | null |
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
#include "FPSProject.h"
//#include "CardInvUIWidget.h"
#include "FPSHud.h"
AFPSHud::AFPSHud(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{
// set the crosshair texture
static ConstructorHelpers::FObjectFinder<UTexture2D> CrosshairTexObj(TEXT("Texture2D'/Game/UI/Textures/crosshair.crosshair'"));
CrosshairTex = CrosshairTexObj.Object;
static ConstructorHelpers::FObjectFinder<UTexture2D> GrowTexObj(TEXT("Texture2D'/Game/UI/Textures/gui_card_grow.gui_card_grow'"));
UICardTexAtlas.Add(GrowTexObj.Object);
static ConstructorHelpers::FObjectFinder<UTexture2D> ShrinkTexObj(TEXT("Texture2D'/Game/UI/Textures/gui_card_shrink.gui_card_shrink'"));
UICardTexAtlas.Add(ShrinkTexObj.Object);
static ConstructorHelpers::FObjectFinder<UTexture2D> JumpTexObj(TEXT("Texture2D'/Game/UI/Textures/card_jump.card_jump'"));
UICardTexAtlas.Add(JumpTexObj.Object);
LeftInset = 20.0f;
BottomInset = 150.0f;
HighlightScale = 1.2f;
}
void AFPSHud::BeginPlay()
{
if (GetOwningPlayerController() != NULL)
{
PlayerController = Cast<AFPSCharacter>(GetOwningPlayerController()->GetPawn());
}
//// So far only TSharedPtr<SCardInvUIWidget> has been created, now create the actual object
//// Create a SCardInvUIWidget on heap, our CardInvUIWidget shared pointer provides a handle to object
//// widget will not self-destruct unless the hud's sharedptr (and all other sharedptrs) destruct first
//SAssignNew(CardInvUIWidget, SCardInvUIWidget).OwnerHUD(this);
//// pass our viewport a weak ptr to our widget
//if (GEngine->IsValidLowLevel())
//{
// GEngine->GameViewport->
// // viewport's weak ptr will not give viewport ownership of widget
// AddViewportWidgetContent(SNew(SWeakWidget).PossiblyNullContent(CardInvUIWidget.ToSharedRef()));
//}
//if (CardInvUIWidget.IsValid())
//{
// // set widget's properties as visible (sets child widget properties recursively
// CardInvUIWidget->SetVisibility(EVisibility::Visible);
//}
}
void AFPSHud::DrawHUD()
{
Super::DrawHUD();
if (!Canvas) return;
DrawCrosshair();
DrawInventory();
}
void AFPSHud::DrawCrosshair()
{
// draw simple crosshair
// in the middle of the screen
const FVector2D Center(Canvas->ClipX * 0.5f, Canvas->ClipY * 0.5f);
// offset by half the texture's dimensions to align in the centre
const FVector2D CrosshairDrawPosition(
(Center.X - CrosshairTex->GetSurfaceWidth() * 0.5f),
(Center.Y - CrosshairTex->GetSurfaceHeight() * 0.5f));
// draw
FCanvasTileItem TileItem(CrosshairDrawPosition, CrosshairTex->Resource, FLinearColor::White);
TileItem.BlendMode = SE_BLEND_Translucent;
Canvas->DrawItem(TileItem);
}
void AFPSHud::DrawInventory()
{
FVector2D CardScale = FVector2D(1.0f, 1.0f);
for (int32 i = 0; i < PlayerController->ItemInventory.Num(); i++)
{
// get the card type to draw
ECardType::Type CardType = PlayerController->ItemInventory[i].GetValue();
CardScale.X = UICardTexAtlas[CardType]->GetSurfaceWidth() * 0.2f;
CardScale.Y = UICardTexAtlas[CardType]->GetSurfaceHeight() * 0.2f;
FVector2D CardPosition = FVector2D(
LeftInset + (i * UICardTexAtlas[CardType]->GetSurfaceWidth() * 0.2f),
Canvas->ClipY - BottomInset);
// make the card larger if it's the selected card
if (i == PlayerController->SelectedInventoryItem)
{
// move the card up because it's selected
CardPosition.Y = CardPosition.Y - ((CardScale.Y * HighlightScale) - CardScale.Y);
CardScale.X = CardScale.X * HighlightScale;
CardScale.Y = CardScale.Y * HighlightScale;
}
else if (i > PlayerController->SelectedInventoryItem)
{
CardPosition.X = CardPosition.X + (CardScale.X - (CardScale.X / HighlightScale));
}
DrawCard(CardType, CardPosition, CardScale);
//reset
CardScale = FVector2D(1.0f, 1.0f);
}
}
void AFPSHud::DrawCard(ECardType::Type CardType, FVector2D Position, FVector2D Scale)
{
FCanvasTileItem TileItem(Position, UICardTexAtlas[CardType]->Resource, Scale, FLinearColor::White);
TileItem.BlendMode = SE_BLEND_Translucent;
Canvas->DrawItem(TileItem);
}
void AFPSHud::DrawTextString()
{
//Text and Font
FCanvasTextItem NewText(
FVector2D(10.0f, 100.0f),
FText::FromString("Hello"),
TextFont,
FColor::Red
);
NewText.bOutlined = true;
NewText.OutlineColor = FColor::Black;
NewText.OutlineColor.A = FColor::Red.A * 2;
Canvas->DrawItem(NewText);
}
| 30.569444
| 137
| 0.74239
|
ellji
|
bb338cd9ab1314e902f43b4f53526e7e9ec22fa7
| 4,352
|
cpp
|
C++
|
Engine/Source/Graphics/Vulkan/VulkanCmdList.cpp
|
IcanCUthere/Gravity-Engine
|
3d61e7b78543572850efd9de3870a684ab476c7a
|
[
"MIT"
] | null | null | null |
Engine/Source/Graphics/Vulkan/VulkanCmdList.cpp
|
IcanCUthere/Gravity-Engine
|
3d61e7b78543572850efd9de3870a684ab476c7a
|
[
"MIT"
] | null | null | null |
Engine/Source/Graphics/Vulkan/VulkanCmdList.cpp
|
IcanCUthere/Gravity-Engine
|
3d61e7b78543572850efd9de3870a684ab476c7a
|
[
"MIT"
] | null | null | null |
module;
#include <vulkan/vulkan.h>
#include "Core/DebugUtils.h"
module Graphics:Vulkan.CmdList;
import :Vulkan.Context;
import :Vulkan.Viewport;
import :Vulkan.Queue;
namespace GFX
{
AVulkanCmdList::AVulkanCmdList(const VkCommandBuffer handle, const VkCommandBufferLevel level, const VkPipelineStageFlags waitStages)
: Handle(handle), Semaphore(true), Level(level), WaitStages(waitStages)
{
}
AVulkanCmdList::AVulkanCmdList(AVulkanCmdList&& other)
: Handle(other.Handle), Level(other.Level), WaitStages(other.WaitStages), Semaphore(std::move(other.Semaphore))
{
other.Handle = VK_NULL_HANDLE;
other.Level = VK_COMMAND_BUFFER_LEVEL_MAX_ENUM;
other.WaitStages = VK_PIPELINE_STAGE_FLAG_BITS_MAX_ENUM;
}
void AVulkanCmdList::operator=(AVulkanCmdList&& other)
{
Handle = other.Handle;
Level = other.Level;
WaitStages = other.WaitStages;
Semaphore = std::move(other.Semaphore);
other.Handle = VK_NULL_HANDLE;
other.Level = VK_COMMAND_BUFFER_LEVEL_MAX_ENUM;
other.WaitStages = VK_PIPELINE_STAGE_FLAG_BITS_MAX_ENUM;
}
void AVulkanCmdList::BeginRecording(const ERenderStage stage, const IViewport* viewport)
{
const AVulkanViewport* vViewport = (AVulkanViewport*)viewport;
VkCommandBufferInheritanceInfo inheritanceInfo;
inheritanceInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO;
inheritanceInfo.pNext = nullptr;
inheritanceInfo.occlusionQueryEnable = false;
inheritanceInfo.queryFlags = 0;
inheritanceInfo.pipelineStatistics = 0;
VkCommandBufferBeginInfo beginInfo;
beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
beginInfo.pNext = nullptr;
if (stage == ERenderStage::Transfer) {
inheritanceInfo.framebuffer = VK_NULL_HANDLE;
inheritanceInfo.renderPass = VK_NULL_HANDLE;
inheritanceInfo.subpass = (uint32_t)stage;
beginInfo.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
beginInfo.pInheritanceInfo = nullptr;
}
else {
inheritanceInfo.framebuffer = vViewport->GetSwapchain().GetFramebuffer().GetHandle();
inheritanceInfo.renderPass = vViewport->GetSwapchain().GetRenderPass().GetHandle();
inheritanceInfo.subpass = (uint32_t)stage;
beginInfo.flags = VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT | VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
beginInfo.pInheritanceInfo = (Level == VK_COMMAND_BUFFER_LEVEL_SECONDARY ? &inheritanceInfo : nullptr);
}
vkValidate(vkf::vkBeginCommandBuffer(Handle, &beginInfo))
}
void AVulkanCmdList::StopRecording()
{
vkValidate(vkf::vkEndCommandBuffer(Handle))
}
void AVulkanCmdList::Submit(const ISemaphore* waitSemaphore)
{
const AVulkanSemaphore* vSemaphore = (AVulkanSemaphore*)waitSemaphore;
Semaphore.WaitForSignal();
Semaphore.ResetFence();
VkQueue submitQueue = nullptr;
switch (WaitStages) {
case VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT: submitQueue = AVulkanContext::GetDevice().GetRenderQueue().GetHandle(); break;
case VK_PIPELINE_STAGE_TRANSFER_BIT: submitQueue = AVulkanContext::GetDevice().GetTransferQueue().GetHandle(); break;
case VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT: /*TODO: implement compute queue*/ break;
default: verify(0, "No valid submit queue found.");
}
VkSubmitInfo submitInfo = {};
submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
submitInfo.pNext = nullptr;
submitInfo.pWaitDstStageMask = &WaitStages;
submitInfo.waitSemaphoreCount = (vSemaphore ? 1 : 0);
submitInfo.pWaitSemaphores = &vSemaphore->GetSemaphore();
submitInfo.commandBufferCount = 1;
submitInfo.pCommandBuffers = &Handle;
submitInfo.signalSemaphoreCount = 1;
submitInfo.pSignalSemaphores = &Semaphore.GetSemaphore();
vkValidate(vkf::vkQueueSubmit(submitQueue, 1, &submitInfo, Semaphore.GetFence()))
}
void AVulkanCmdList::Reset()
{
Semaphore.WaitForSignal();
vkValidate(vkf::vkResetCommandBuffer(Handle, 0))
}
void AVulkanCmdList::ConsumeLists(const std::vector<ICmdList*>& lists)
{
std::vector<VkCommandBuffer> handles;
for (const ICmdList* list : lists) {
AVulkanCmdList* vList = (AVulkanCmdList*)list;
handles.push_back(vList->GetHandle());
}
vkf::vkCmdExecuteCommands(Handle, (uint32_t)handles.size(), handles.data());
}
void AVulkanCmdList::WaitToFinish() const
{
Semaphore.WaitForSignal();
}
ISemaphore* AVulkanCmdList::GetSemaphore() const
{
return (ISemaphore*)&Semaphore;
}
}
| 32.969697
| 134
| 0.777803
|
IcanCUthere
|
7d6a6526026b9c3749bfc1bb1150338f05a1ff78
| 4,073
|
cpp
|
C++
|
command.cpp
|
SAE-Geneve/classylabyrinth-PaulOwO
|
9229d3a5295dbed86892cefc03496c35a1997789
|
[
"MIT"
] | null | null | null |
command.cpp
|
SAE-Geneve/classylabyrinth-PaulOwO
|
9229d3a5295dbed86892cefc03496c35a1997789
|
[
"MIT"
] | null | null | null |
command.cpp
|
SAE-Geneve/classylabyrinth-PaulOwO
|
9229d3a5295dbed86892cefc03496c35a1997789
|
[
"MIT"
] | null | null | null |
#include <vector>
#include "command.h"
#include "character.h"
#include "player.h"
#include <iostream>
#include "world.h"
void Command::North()
{
Player player = world_.GetPlayer();
if (world_.get_tile_at_position(player.GetX(),player.GetY() - 1) != '.')
return;
else
player.SetY(player.GetY() - 1);
world_.SetPlayer(player);
}
void Command::South()
{
Player player = world_.GetPlayer();
if (world_.get_tile_at_position(player.GetX(), player.GetY() + 1) != '.')
return;
else
player.SetY(player.GetY() + 1);
world_.SetPlayer(player);
}
void Command::East()
{
Player player = world_.GetPlayer();
if (world_.get_tile_at_position(player.GetX() + 1, player.GetY()) != '.')
return;
else
player.SetX(player.GetX() + 1);
world_.SetPlayer(player);
}
void Command::West()
{
Player player = world_.GetPlayer();
if (world_.get_tile_at_position(player.GetX() - 1, player.GetY()) != '.')
return;
else
player.SetX(player.GetX() - 1);
world_.SetPlayer(player);
}
/*void Command::Attack(Character1,Character2)
{
Character2.health_points -= std::max(0, Character1.attack - Character2.defence);
set_player(player);
set_enemy(enemy, enemy.x, enemy.y);
}*/
void Command::PlayerAttack()
{
Player player = world_.GetPlayer();
std::vector<Enemy> enemy_vec;
if (world_.get_tile_at_position(player.GetX(), player.GetY() - 1) == 'E')
enemy_vec.push_back(world_.GetEnemy(player.GetX(), player.GetY() - 1));
if (world_.get_tile_at_position(player.GetX(), player.GetY() + 1) == 'E')
enemy_vec.push_back(world_.GetEnemy(player.GetX(), player.GetY() + 1));
if (world_.get_tile_at_position(player.GetX() - 1, player.GetY()) == 'E')
enemy_vec.push_back(world_.GetEnemy(player.GetX() - 1, player.GetY()));
if (world_.get_tile_at_position(player.GetX() + 1, player.GetY()) == 'E')
enemy_vec.push_back(world_.GetEnemy(player.GetX() + 1, player.GetY()));
for (auto& enemy : enemy_vec)
enemy.SetHealthPoints(enemy.GetHealthPoints() - player.GetAttack() + enemy.GetDefence());
}
void Command::EnemyAttack()
{
}
void Command::Tick()
{
Player player = world_.GetPlayer();
player.Regen();
//EnnemyAttack()
}
void Command::ShowState()
{
Player player = world_.GetPlayer();
// Show the maze to the user.
std::cout << "Maze :\n";
for (int i = -1; i < 2; ++i)
{
std::cout << "\t +---+---+---+\n\t";
for (int j = -1; j < 2; ++j)
{
std::cout
<< " | "
<< (char)world_.get_tile_at_position(player.GetX() + j, player.GetY() + i);
}
std::cout << " |\n";
}
std::cout << "\t +---+---+---+\n\n";
std::cout << "Player(" << player.GetX() << ", " << player.GetY() << ") :\n";
std::cout << "\tname : ";
player.PrintName();
std::cout << "\n\thealth points : " << player.GetHealthPoints() << "\n";
std::cout << "\n";
for (int i = -1; i < 2; ++i)
{
for (int j = -1; j < 2; ++j)
{
if ('E' ==
world_.get_tile_at_position(player.GetX() + i, player.GetY() + j))
{
Enemy enemy = world_.GetEnemy(player.GetX() + i, player.GetY() + j);
std::cout
<< "Enemy(" << player.GetX() + i
<< ", " << player.GetY() + j
<< ")\n";
std::cout << "\tname : ";
enemy.PrintName();
std::cout << "\n\thealth points : " << enemy.GetHealthPoints() << "\n";
std::cout << "\n";
}
}
}
}
void Command::ShowHelp()
{
std::cout << "Valid options:\n"
<< "\t[q]uit -> quit the game.\n"
<< "\t[n]orth -> move north.\n"
<< "\t[s]outh -> move south.\n"
<< "\t[e]ast -> move east.\n"
<< "\t[w]est -> move west.\n"
<< "\t[a]ttack -> attack enemy.\n"
<< "\t[h]elp -> show help.\n";
}
char Command::GetCommand()
{
std::cout << "] ";
std::string command_str;
std::getline(std::cin, command_str);
return command_str[0];
}
void Command::ExecuteCommand()
{
switch (GetCommand())
{
case 'q':
std::cout << "Ciao!\n";
exit(0);
case 'n':
return North();
break;
case 's':
return South();
break;
case 'e':
return East();
break;
case 'w':
return West();
break;
case 'a':
return PlayerAttack();
break;
case 'h':
default:
ShowHelp();
break;
}
Tick();
}
| 22.016216
| 91
| 0.599067
|
SAE-Geneve
|
7d6ac821dfb47fe447c915208b6ad81622943da1
| 8,312
|
cpp
|
C++
|
Remove_bad_split_good/llcpImp.cpp
|
awagsta/Data-Structures-and-Algorithms
|
d32dc118ff7392421dd61c0ff8cca0eebb27747a
|
[
"MIT"
] | null | null | null |
Remove_bad_split_good/llcpImp.cpp
|
awagsta/Data-Structures-and-Algorithms
|
d32dc118ff7392421dd61c0ff8cca0eebb27747a
|
[
"MIT"
] | null | null | null |
Remove_bad_split_good/llcpImp.cpp
|
awagsta/Data-Structures-and-Algorithms
|
d32dc118ff7392421dd61c0ff8cca0eebb27747a
|
[
"MIT"
] | null | null | null |
#include <iostream>
#include <cstdlib>
#include "llcpInt.h"
using namespace std;
int FindListLength(Node* headPtr)
{
int length = 0;
while (headPtr != 0)
{
++length;
headPtr = headPtr->link;
}
return length;
}
bool IsSortedUp(Node* headPtr)
{
if (headPtr == 0 || headPtr->link == 0) // empty or 1-node
return true;
while (headPtr->link != 0) // not at last node
{
if (headPtr->link->data < headPtr->data)
return false;
headPtr = headPtr->link;
}
return true;
}
void InsertAsHead(Node*& headPtr, int value)
{
Node *newNodePtr = new Node;
newNodePtr->data = value;
newNodePtr->link = headPtr;
headPtr = newNodePtr;
}
void InsertAsTail(Node*& headPtr, int value)
{
Node *newNodePtr = new Node;
newNodePtr->data = value;
newNodePtr->link = 0;
if (headPtr == 0)
headPtr = newNodePtr;
else
{
Node *cursor = headPtr;
while (cursor->link != 0) // not at last node
cursor = cursor->link;
cursor->link = newNodePtr;
}
}
void InsertSortedUp(Node*& headPtr, int value)
{
Node *precursor = 0,
*cursor = headPtr;
while (cursor != 0 && cursor->data < value)
{
precursor = cursor;
cursor = cursor->link;
}
Node *newNodePtr = new Node;
newNodePtr->data = value;
newNodePtr->link = cursor;
if (cursor == headPtr)
headPtr = newNodePtr;
else
precursor->link = newNodePtr;
///////////////////////////////////////////////////////////
/* using-only-cursor (no precursor) version
Node *newNodePtr = new Node;
newNodePtr->data = value;
//newNodePtr->link = 0;
//if (headPtr == 0)
// headPtr = newNodePtr;
//else if (headPtr->data >= value)
//{
// newNodePtr->link = headPtr;
// headPtr = newNodePtr;
//}
if (headPtr == 0 || headPtr->data >= value)
{
newNodePtr->link = headPtr;
headPtr = newNodePtr;
}
//else if (headPtr->link == 0)
// head->link = newNodePtr;
else
{
Node *cursor = headPtr;
while (cursor->link != 0 && cursor->link->data < value)
cursor = cursor->link;
//if (cursor->link != 0)
// newNodePtr->link = cursor->link;
newNodePtr->link = cursor->link;
cursor->link = newNodePtr;
}
////////////////// commented lines removed //////////////////
Node *newNodePtr = new Node;
newNodePtr->data = value;
if (headPtr == 0 || headPtr->data >= value)
{
newNodePtr->link = headPtr;
headPtr = newNodePtr;
}
else
{
Node *cursor = headPtr;
while (cursor->link != 0 && cursor->link->data < value)
cursor = cursor->link;
newNodePtr->link = cursor->link;
cursor->link = newNodePtr;
}
*/
///////////////////////////////////////////////////////////
}
bool DelFirstTargetNode(Node*& headPtr, int target)
{
Node *precursor = 0,
*cursor = headPtr;
while (cursor != 0 && cursor->data != target)
{
precursor = cursor;
cursor = cursor->link;
}
if (cursor == 0)
{
cout << target << " not found." << endl;
return false;
}
if (cursor == headPtr) //OR precursor == 0
headPtr = headPtr->link;
else
precursor->link = cursor->link;
delete cursor;
return true;
}
bool DelNodeBefore1stMatch(Node*& headPtr, int target)
{
if (headPtr == 0 || headPtr->link == 0 || headPtr->data == target) return false;
Node *cur = headPtr->link, *pre = headPtr, *prepre = 0;
while (cur != 0 && cur->data != target)
{
prepre = pre;
pre = cur;
cur = cur->link;
}
if (cur == 0) return false;
if (cur == headPtr->link)
{
headPtr = cur;
delete pre;
}
else
{
prepre->link = cur;
delete pre;
}
return true;
}
void ShowAll(ostream& outs, Node* headPtr)
{
while (headPtr != 0)
{
outs << headPtr->data << " ";
headPtr = headPtr->link;
}
outs << endl;
}
void FindMinMax(Node* headPtr, int& minValue, int& maxValue)
{
if (headPtr == 0)
{
cerr << "FindMinMax() attempted on empty list" << endl;
cerr << "Minimum and maximum values not set" << endl;
}
else
{
minValue = maxValue = headPtr->data;
while (headPtr->link != 0)
{
headPtr = headPtr->link;
if (headPtr->data < minValue)
minValue = headPtr->data;
else if (headPtr->data > maxValue)
maxValue = headPtr->data;
}
}
}
double FindAverage(Node* headPtr)
{
if (headPtr == 0)
{
cerr << "FindAverage() attempted on empty list" << endl;
cerr << "An arbitrary zero value is returned" << endl;
return 0.0;
}
else
{
int sum = 0,
count = 0;
while (headPtr != 0)
{
++count;
sum += headPtr->data;
headPtr = headPtr->link;
}
return double(sum) / count;
}
}
void ListClear(Node*& headPtr, int noMsg)
{
int count = 0;
Node *cursor = headPtr;
while (headPtr != 0)
{
headPtr = headPtr->link;
delete cursor;
cursor = headPtr;
++count;
}
if (noMsg) return;
clog << "Dynamic memory for " << count << " nodes freed"
<< endl;
}
void RemBadSplitGood(Node*& head1Ptr, Node*& head2Ptr, Node*& head3Ptr)
{
Node * pre = 0;
Node * cursor = head1Ptr;
head2Ptr = 0;
head3Ptr = 0;
Node *h2Current = 0, *h3Current = 0;
while(cursor != 0)
{
if(head1Ptr->data != 6 && !(head1Ptr->data >= 0 && head1Ptr->data <= 9) )
{
head1Ptr = head1Ptr->link;
delete cursor;
cursor = head1Ptr;
}
else if(cursor->data == 6)
{
pre = cursor;
cursor = cursor->link;
}
else if(cursor->data >= 0 && cursor->data <= 5)
{
if(cursor == head1Ptr)
{
Node * temp = cursor;
head1Ptr = head1Ptr->link;
cursor = head1Ptr;
temp->link = 0;
if(head2Ptr == 0)
{
head2Ptr = temp;
h2Current = head2Ptr;
}
else
{
h2Current->link = temp;
h2Current = h2Current->link;
}
}
else // cursor is not the head node
{
pre->link = cursor->link;
Node * temp = cursor;
cursor = cursor->link;
temp->link = 0;
if(head2Ptr == 0)
{
head2Ptr = temp;
h2Current = head2Ptr;
}
else
{
h2Current->link = temp;
h2Current = h2Current->link;
}
}
}
else if(cursor->data >= 7 && cursor->data <= 9)
{
if(cursor == head1Ptr)
{
Node * temp = cursor;
head1Ptr = head1Ptr->link;
cursor = head1Ptr;
temp->link = 0;
if(head3Ptr == 0)
{
head3Ptr = temp;
h3Current = head3Ptr;
}
else
{
h3Current->link = temp;
h3Current = h3Current->link;
}
}
else // cursor is not the head node
{
pre->link = cursor->link;
Node * temp = cursor;
cursor = cursor->link;
temp->link = 0;
if(head3Ptr == 0)
{
head3Ptr = temp;
h3Current = head3Ptr;
}
else
{
h3Current->link = temp;
h3Current = h3Current->link;
}
}
}
else // value not between 0 and 9 inclusive
{
pre->link = cursor->link;
delete cursor;
cursor = cursor->link;
}
}
// if any of the lists are empty, indicate this with a -99 sentinel value
if(head1Ptr == 0)
{
head1Ptr = new Node;
head1Ptr->link = 0;
head1Ptr->data = -99;
}
if(head2Ptr == 0)
{
head2Ptr = new Node;
head2Ptr->link = 0;
head2Ptr->data = -99;
}
if(head3Ptr == 0)
{
head3Ptr = new Node;
head3Ptr->link = 0;
head3Ptr->data = -99;
}
}
| 22.106383
| 83
| 0.490014
|
awagsta
|
7d6e1e01c3570d095c4fbfbedccf7574a4d14520
| 2,190
|
cpp
|
C++
|
libmcell/generated/gen_geometry_utils.cpp
|
mcellteam/mcell
|
3920aec22c55013b78f7d6483b81f70a0d564d22
|
[
"MIT"
] | 25
|
2015-03-25T16:36:01.000Z
|
2022-01-17T14:28:43.000Z
|
libmcell/generated/gen_geometry_utils.cpp
|
mcellteam/mcell
|
3920aec22c55013b78f7d6483b81f70a0d564d22
|
[
"MIT"
] | 31
|
2015-02-12T22:15:18.000Z
|
2022-03-30T22:43:24.000Z
|
libmcell/generated/gen_geometry_utils.cpp
|
mcellteam/mcell
|
3920aec22c55013b78f7d6483b81f70a0d564d22
|
[
"MIT"
] | 12
|
2016-01-15T23:20:19.000Z
|
2021-02-10T06:18:00.000Z
|
/******************************************************************************
*
* Copyright (C) 2021 by
* The Salk Institute for Biological Studies
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
*
******************************************************************************/
#include <sstream>
#include "api/pybind11_stl_include.h"
#include "api/python_export_utils.h"
#include "gen_geometry_utils.h"
#include "api/geometry_object.h"
#include "api/model.h"
namespace MCell {
namespace API {
void define_pybinding_geometry_utils(py::module& m) {
m.def_submodule("geometry_utils")
.def("create_box", &geometry_utils::create_box, py::arg("name"), py::arg("edge_dimension") = FLT_UNSET, py::arg("xyz_dimensions") = std::vector<double>(), "Creates a GeometryObject in the shape of a cube whose center is at (0, 0, 0).\n- name: Name of the created geometry object.\n\n- edge_dimension: Specifies length of each edge of the box in um. \nNone of x/y/z dimensions can be set.\n\n\n- xyz_dimensions: Specifies x/y/z sizes of the box in um. Parameter edge_dimension must not be set.\n\n")
.def("create_icosphere", &geometry_utils::create_icosphere, py::arg("name"), py::arg("radius"), py::arg("subdivisions"), "Creates a GeometryObject in the shape of an icosphere whose center is at (0, 0, 0).\n- name: Name of the created geometry object.\n\n- radius: Specifies radius of the sphere.\n\n- subdivisions: Number of subdivisions from the initial icosphere. \nThe higher this value will be the smoother the icosphere will be.\nAllowed range is between 1 and 8.\n\n\n")
.def("validate_volumetric_mesh", &geometry_utils::validate_volumetric_mesh, py::arg("model"), py::arg("geometry_object"), "Checks that the mesh was correctly analyzed, that it has volume and \nall edges have neighboring walls.\nMust be called after model initialization. \nThrows exception with detained message if validation did not pass. \n\n- model: Model object after initialization.\n\n- geometry_object: Geometry object to be checked.\n\n")
;
}
} // namespace API
} // namespace MCell
| 66.363636
| 504
| 0.688128
|
mcellteam
|
7d6e6edf8734373c350df18da046d23f69b68988
| 1,050
|
hpp
|
C++
|
src/cpp/Robot.hpp
|
Ewpratten/FRC-2018-OpenCV
|
8509cd61823181bd7bdc43bceb3cd5046d8e83f2
|
[
"BSD-3-Clause"
] | null | null | null |
src/cpp/Robot.hpp
|
Ewpratten/FRC-2018-OpenCV
|
8509cd61823181bd7bdc43bceb3cd5046d8e83f2
|
[
"BSD-3-Clause"
] | null | null | null |
src/cpp/Robot.hpp
|
Ewpratten/FRC-2018-OpenCV
|
8509cd61823181bd7bdc43bceb3cd5046d8e83f2
|
[
"BSD-3-Clause"
] | null | null | null |
#ifndef _ROBOT_HG_
#define _ROBOT_HG_
#include <WPILib.h>
#include <Commands/Command.h>
#include <Commands/DriveWithJoystick.hpp>
#include <Commands/DriveWithTriggers.hpp>
#include <Commands/GenericControl.hpp>
#include <Commands/CVControl.hpp>
#include <Commands/Scheduler.h>
#include <SmartDashboard/SendableChooser.h>
class Robot: public frc::TimedRobot {
public:
// Robot Positions
~Robot();
void RobotInit() override;
void DisabledInit() override;
void DisabledPeriodic() override;
void AutonomousInit() override;
void AutonomousPeriodic() override;
void TeleopInit() override;
void TeleopPeriodic() override;
void TestInit() override;
void TestPeriodic() override;
// declare the commands
DriveWithJoystick* pDriveWithJoystick;
DriveWithTriggers* pDriveWithTriggers;
GenericControl* pGenericControl;
CVControl* pVision;
private:
int GetAutoType();
frc::SendableChooser<int> scRobotPosition;
frc::SendableChooser<int> scRobotRole;
frc::SendableChooser<int> scOverrideAuto;
frc::Command* pAutonomousCommand;
};
#endif
| 23.863636
| 43
| 0.785714
|
Ewpratten
|
7d70ab9e221924593360e8260babd08711c521de
| 1,376
|
cpp
|
C++
|
orca/gporca/libnaucrates/src/md/IMDProvider.cpp
|
vitessedata/gpdb.4.3.99.x
|
9462aad5df1bf120a2a87456b1f9574712227da4
|
[
"PostgreSQL",
"Apache-2.0"
] | 3
|
2017-12-10T16:41:21.000Z
|
2020-07-08T12:59:12.000Z
|
orca/gporca/libnaucrates/src/md/IMDProvider.cpp
|
vitessedata/gpdb.4.3.99.x
|
9462aad5df1bf120a2a87456b1f9574712227da4
|
[
"PostgreSQL",
"Apache-2.0"
] | null | null | null |
orca/gporca/libnaucrates/src/md/IMDProvider.cpp
|
vitessedata/gpdb.4.3.99.x
|
9462aad5df1bf120a2a87456b1f9574712227da4
|
[
"PostgreSQL",
"Apache-2.0"
] | 4
|
2017-12-10T16:41:35.000Z
|
2020-11-28T12:20:30.000Z
|
//---------------------------------------------------------------------------
// Greenplum Database
// Copyright (C) 2012 EMC Corp.
//
// @filename:
// IMDProvider.cpp
//
// @doc:
// Abstract class for retrieving metadata from an external location
//
// @owner:
//
//
// @test:
//
//
//---------------------------------------------------------------------------
#include "naucrates/md/IMDProvider.h"
#include "naucrates/md/CMDIdGPDB.h"
using namespace gpmd;
//---------------------------------------------------------------------------
// @function:
// IMDProvider::PmdidTypeGPDB
//
// @doc:
// Return the mdid for the requested type
//
//---------------------------------------------------------------------------
IMDId *
IMDProvider::PmdidTypeGPDB
(
IMemoryPool *pmp,
CSystemId
#ifdef GPOS_DEBUG
sysid
#endif // GPOS_DEBUG
,
IMDType::ETypeInfo eti
)
{
GPOS_ASSERT(IMDId::EmdidGPDB == sysid.Emdidt());
GPOS_ASSERT(IMDType::EtiGeneric > eti);
switch(eti)
{
case IMDType::EtiInt2:
return GPOS_NEW(pmp) CMDIdGPDB(GPDB_INT2);
case IMDType::EtiInt4:
return GPOS_NEW(pmp) CMDIdGPDB(GPDB_INT4);
case IMDType::EtiInt8:
return GPOS_NEW(pmp) CMDIdGPDB(GPDB_INT8);
case IMDType::EtiBool:
return GPOS_NEW(pmp) CMDIdGPDB(GPDB_BOOL);
case IMDType::EtiOid:
return GPOS_NEW(pmp) CMDIdGPDB(GPDB_OID);
default:
return NULL;
}
}
// EOF
| 19.657143
| 77
| 0.534884
|
vitessedata
|
7d721de4f52be0839911e50daf631d081fe92375
| 14,349
|
hpp
|
C++
|
core/os/MacOS/src/cogs/os/gui/scroll_bar.hpp
|
cogmine/cogs
|
ef1c369a36a4f811704e0ced0493c3a6f8eca821
|
[
"MIT"
] | 5
|
2019-02-08T15:59:14.000Z
|
2022-01-22T19:12:33.000Z
|
core/os/MacOS/src/cogs/os/gui/scroll_bar.hpp
|
cogmine/cogs
|
ef1c369a36a4f811704e0ced0493c3a6f8eca821
|
[
"MIT"
] | 1
|
2019-12-03T03:11:34.000Z
|
2019-12-03T03:11:34.000Z
|
core/os/MacOS/src/cogs/os/gui/scroll_bar.hpp
|
cogmine/cogs
|
ef1c369a36a4f811704e0ced0493c3a6f8eca821
|
[
"MIT"
] | null | null | null |
//
// Copyright (C) 2000-2020 - Colen M. Garoutte-Carson <colen at cogmine.com>, Cog Mine LLC
//
// Status: Good
#ifndef COGS_HEADER_OS_GUI_SCROLL_BAR
#define COGS_HEADER_OS_GUI_SCROLL_BAR
#include "cogs/sync/transactable.hpp"
#include "cogs/sync/resettable_timer.hpp"
#include "cogs/gui/scroll_bar.hpp"
#include "cogs/math/boolean.hpp"
#include "cogs/mem/rcnew.hpp"
#include "cogs/os/gui/nsview.hpp"
namespace cogs {
namespace os {
class scroll_bar;
};
};
@interface objc_scroll_bar : NSScroller
{
@public
cogs::weak_rcptr<cogs::os::scroll_bar> m_cppScrollBar;
}
-(BOOL)isFlipped;
-(void)scrolled:(id)sender;
-(void)preferredScrollerStyleChanged:(NSNotification*)notification;
+(BOOL)isCompatibleWithOverlayScrollers;
-(void)drawRect:(NSRect)dirtyRect;
-(void)drawKnob;
-(void)defaultDrawKnob;
-(void)drawKnobSlotInRect:(NSRect)slotRect highlight:(BOOL)flag;
-(void)defaultDrawKnobSlotInRect:(NSRect)slotRect highlight:(BOOL)flag;
-(void)fade:(NSTimer*)timer;
@end
namespace cogs {
namespace os {
class scroll_bar : public nsview_pane, public gui::scroll_bar_interface
{
private:
volatile transactable<gui::scroll_bar_state> m_state;
volatile double m_pos = 0;
volatile boolean m_canAutoFade;
volatile boolean m_shouldAutoFade;
gfx::dimension m_dimension;
gfx::range m_currentRange;
gfx::size m_currentDefaultSize;
bool m_isHiddenWhenInactive;
bool m_isHidden = false;
CGFloat m_knobAlpha;
bool m_isKnobSlotVisible;
rcref<resettable_timer> m_fadeDelayTimer;
boolean m_fadeDelayDispatched;
__strong NSTimer* m_fadeTimer = nullptr;
rcptr<task<void> > m_fadeDelayTask;
delegated_dependency_property<gui::scroll_bar_state> m_stateProperty;
delegated_dependency_property<double> m_positionProperty;
delegated_dependency_property<bool> m_canAutoFadeProperty;
delegated_dependency_property<bool> m_shouldAutoFadeProperty;
void set_scroll_bar_state(const gui::scroll_bar_state& newState, double newPos)
{
start_fade_delay();
rcptr<gui::scroll_bar> sb = get_bridge().template static_cast_to<gui::scroll_bar>();
objc_scroll_bar* objcScrollBar = (objc_scroll_bar*)get_NSView();
for (;;)
{
if (newState.m_thumbSize >= newState.m_max)
{
if (!!m_isHiddenWhenInactive)
{
if (!m_isHidden)
{
m_isHidden = true;
sb->hide();
}
break;
}
[objcScrollBar setEnabled: NO];
}
else
{
double maxPos = newState.m_max - newState.m_thumbSize;
double pos = newPos;
if (pos > maxPos)
pos = maxPos;
[objcScrollBar setEnabled: YES] ;
[objcScrollBar setDoubleValue: (pos / maxPos) ];
[objcScrollBar setKnobProportion: (newState.m_thumbSize / newState.m_max) ];
}
if (!!m_isHidden)
{
m_isHidden = false;
sb->show();
}
break;
}
}
// Will execute in main thread
void delay_expired()
{
m_fadeDelayDispatched = false;
objc_scroll_bar* objcScrollBar = (objc_scroll_bar*)get_NSView();
m_fadeTimer = [NSTimer timerWithTimeInterval: 0.05 target: objcScrollBar selector: @selector(fade:) userInfo: nil repeats: YES];
[[NSRunLoop mainRunLoop] addTimer: m_fadeTimer forMode: NSRunLoopCommonModes];
}
void stop_fade(CGFloat knobAlpha = 1.0)
{
if (!!m_fadeTimer)
{
[m_fadeTimer invalidate];
m_fadeTimer = nullptr;
}
if (m_knobAlpha != knobAlpha)
{
m_knobAlpha = knobAlpha;
objc_scroll_bar* objcScrollBar = (objc_scroll_bar*)get_NSView();
[objcScrollBar setNeedsDisplay: YES];
}
}
void start_fade_delay()
{
if (m_isFadeSupressed || !m_shouldAutoFade || !m_canAutoFade)
return;
stop_fade();
if (m_fadeDelayDispatched)
{
if (m_fadeDelayTimer->reschedule(make_measure<seconds>(1)))
return; // Succeeded in postponing the existing timer. All done
// The timer must have already fired.
// We are on the main thread, and delay_expired must be pending after us.
// Cancellation should succeed.
m_fadeDelayTask->cancel();
}
else
{
// The timer was not running. Start it.
m_fadeDelayDispatched = true;
m_fadeDelayTimer->reset(make_measure<seconds>(1));
}
m_fadeDelayTask = m_fadeDelayTimer->dispatch([r{ this_weak_rcptr }]()
{
// move to main thread
rcptr<scroll_bar> r2 = r;
if (!r2)
return signaled();
return r2->get_subsystem()->dispatch([r]()
{
rcptr<scroll_bar> r2 = r;
if (!!r2)
r2->delay_expired();
});
});
}
volatile boolean m_isFadeSupressed;
// Must only be called from main thread.
// m_isFadeSupressed can be read from any thread, but should only be modified in the main thread.
void suppress_fade()
{
if (!m_isFadeSupressed)
{
m_isFadeSupressed = true;
if (m_shouldAutoFade && m_canAutoFade)
stop_fade(1.0);
}
}
// Must only be called from main thread
void unsuppress_fade()
{
if (!!m_isFadeSupressed)
{
m_isFadeSupressed = false;
start_fade_delay();
}
}
public:
explicit scroll_bar(const rcref<volatile nsview_subsystem>& uiSubsystem)
: nsview_pane(uiSubsystem),
m_fadeDelayTimer(rcnew(resettable_timer)),
m_stateProperty(uiSubsystem, [this]()
{
return *(m_state.begin_read());
}, [this](const gui::scroll_bar_state& state)
{
gui::scroll_bar_state newState = state;
gui::scroll_bar_state oldState = newState;
m_state.swap_contents(oldState);
if (newState != oldState)
{
double curPos = cogs::atomic::load(m_pos);
set_scroll_bar_state(newState, curPos);
m_stateProperty.changed();
}
m_stateProperty.set_complete();
}),
m_positionProperty(uiSubsystem, [this]()
{
return cogs::atomic::load(m_pos);
}, [this](double d)
{
double newPos = d;
double oldPos = cogs::atomic::exchange(m_pos, newPos);
if (newPos != oldPos)
{
set_scroll_bar_state(*(m_state.begin_read()), newPos);
m_positionProperty.changed();
}
m_positionProperty.set_complete();
}),
m_canAutoFadeProperty(uiSubsystem, [this]()
{
return m_canAutoFade;
}, [this](bool b)
{
bool oldValue = m_canAutoFade.exchange(b);
if (b != oldValue)
{
if (m_shouldAutoFade)
{
objc_scroll_bar* objcScrollBar = (objc_scroll_bar*)get_NSView();
if (objcScrollBar)
{
if (!b)
{
stop_fade(1.0);
[objcScrollBar setScrollerStyle: NSScrollerStyleLegacy];
[objcScrollBar setNeedsDisplay: YES];
}
else
{
stop_fade(0.0);
[objcScrollBar setScrollerStyle: NSScrollerStyleOverlay];
[objcScrollBar setNeedsDisplay: YES];
}
}
}
m_canAutoFadeProperty.changed();
}
m_canAutoFadeProperty.set_complete();
}),
m_shouldAutoFadeProperty(uiSubsystem, [this]()
{
return m_shouldAutoFade;
}, [this](bool b)
{
bool oldValue = m_shouldAutoFade.exchange(b);
if (b != oldValue)
{
if (m_canAutoFade)
{
objc_scroll_bar* objcScrollBar = (objc_scroll_bar*)get_NSView();
if (objcScrollBar)
{
if (!b)
{
stop_fade(1.0);
[objcScrollBar setScrollerStyle: NSScrollerStyleLegacy];
[objcScrollBar setNeedsDisplay: YES];
}
else
{
stop_fade(0.0);
[objcScrollBar setScrollerStyle: NSScrollerStyleOverlay];
[objcScrollBar setNeedsDisplay: YES];
}
}
}
m_shouldAutoFadeProperty.changed();
}
m_shouldAutoFadeProperty.set_complete();
})
{
}
~scroll_bar()
{
objc_scroll_bar* objcScrollBar = (objc_scroll_bar*)get_NSView();
if (!!objcScrollBar)
objcScrollBar->m_cppScrollBar.release();
}
virtual void installing()
{
rcptr<gui::scroll_bar> sb = get_bridge().template static_cast_to<gui::scroll_bar>();
m_dimension = sb->get_dimension();
m_isHiddenWhenInactive = sb->is_hidden_when_inactive();
// use bogus frame just for the purpose of detecting dimension.
NSRect bogusBounds;
bogusBounds.origin.x = bogusBounds.origin.y = 0;
if (m_dimension == gfx::dimension::horizontal)
{
bogusBounds.size.width = 100;
bogusBounds.size.height = 10;
}
else
{
bogusBounds.size.width = 10;
bogusBounds.size.height = 100;
}
__strong objc_scroll_bar* objcScrollBar = [[objc_scroll_bar alloc] initWithFrame:bogusBounds];
objcScrollBar->m_cppScrollBar = this_rcptr;
bogusBounds.origin.x = bogusBounds.origin.y = 0;
m_isKnobSlotVisible = true;
[objcScrollBar setTarget:objcScrollBar];
[objcScrollBar setAction: @selector(scrolled:)];
NSScrollerStyle preferredStyle = [NSScroller preferredScrollerStyle];
bool canAutoFade = (preferredStyle == NSScrollerStyleOverlay);
bool shouldAutoFade = sb->get_should_auto_fade_property()->get();
m_canAutoFade = canAutoFade;
m_shouldAutoFade = shouldAutoFade;
if (shouldAutoFade && canAutoFade)
{
[objcScrollBar setScrollerStyle: preferredStyle];
m_knobAlpha = 0.0;
}
else
{
[objcScrollBar setScrollerStyle: NSScrollerStyleLegacy];
m_knobAlpha = 1.0;
}
m_stateProperty.bind_from(sb->get_state_property());
m_positionProperty.bind(sb->get_position_property(), false);
m_canAutoFadeProperty.bind_to(get_can_auto_fade_property(sb.dereference()));
m_shouldAutoFadeProperty.bind_from(sb->get_should_auto_fade_property());
[[NSNotificationCenter defaultCenter] addObserver:objcScrollBar selector:@selector(preferredScrollerStyleChanged:) name:NSPreferredScrollerStyleDidChangeNotification object:nil];
install_NSView(objcScrollBar);
nsview_pane::installing();
}
void scrolled()
{
transactable<gui::scroll_bar_state>::read_token rt;
m_state.begin_read(rt);
bool setPosition = true;
double oldPos = cogs::atomic::load(m_pos);
double pos = oldPos;
double max = rt->m_max;
double thumbSize = rt->m_thumbSize;
double maxPos = max;
maxPos -= thumbSize;
objc_scroll_bar* objcScrollBar = (objc_scroll_bar*)get_NSView();
NSScrollerPart part = [objcScrollBar hitPart];
switch (part)
{
case NSScrollerDecrementPage:
if (pos <= thumbSize)
pos = 0;
else
pos -= thumbSize;
break;
case NSScrollerIncrementPage:
pos += thumbSize;
if (pos > maxPos)
pos = maxPos;
break;
//case NSScrollerDecrementLine:
// if (pos > 0)
// --pos;
// break;
//case NSScrollerIncrementLine:
// if (pos < maxPos)
// ++pos;
// break;
case NSScrollerKnob:
case NSScrollerKnobSlot:
{
double curValue = [objcScrollBar doubleValue];
double scaledUp = curValue * maxPos;
pos = (longest)scaledUp;
}
case NSScrollerNoPart:
default:
setPosition = false;
break;
}
if (pos != oldPos)
{
if (!!setPosition)
[objcScrollBar setDoubleValue: (pos/maxPos) ];
// sets are serialized in the UI thread. No need to worry about synchronizing with other writes.
m_positionProperty.set(pos);
}
}
virtual void calculate_range()
{
objc_scroll_bar* objcScrollBar = (objc_scroll_bar*)get_NSView();
m_currentRange.clear();
double scrollBarWidth = (longest)[NSScroller scrollerWidthForControlSize:[objcScrollBar controlSize] scrollerStyle:[objcScrollBar scrollerStyle]];
m_currentRange.get_max(!m_dimension) = scrollBarWidth;
m_currentDefaultSize.set(scrollBarWidth, scrollBarWidth);
}
virtual gfx::range get_range() const { return m_currentRange; }
virtual std::optional<gfx::size> get_default_size() const { return m_currentDefaultSize; }
virtual bool is_focusable() const { return false; }
void set_can_auto_fade(bool b)
{
m_canAutoFadeProperty.set(b);
}
void drawKnob()
{
objc_scroll_bar* objcScrollBar = (objc_scroll_bar*)get_NSView();
NSGraphicsContext* curContext = [NSGraphicsContext currentContext];
CGContextRef context = [curContext CGContext];
CGContextSaveGState(context);
CGContextSetAlpha(context, m_knobAlpha);
[objcScrollBar defaultDrawKnob];
CGContextRestoreGState(context);
}
void drawKnobSlotInRect(const NSRect& slotRect, bool highlightFlag)
{
objc_scroll_bar* objcScrollBar = (objc_scroll_bar*)get_NSView();
NSGraphicsContext* curContext = [NSGraphicsContext currentContext];
CGContextRef context = [curContext CGContext];
CGContextSaveGState(context);
CGContextSetAlpha(context, m_knobAlpha);
[objcScrollBar defaultDrawKnobSlotInRect: slotRect highlight: highlightFlag];
CGContextRestoreGState(context);
}
void fade()
{
objc_scroll_bar* objcScrollBar = (objc_scroll_bar*)get_NSView();
CGFloat alpha = m_knobAlpha - 0.2;
if (alpha > 0) {
m_knobAlpha = alpha;
[objcScrollBar setNeedsDisplay: YES];
}
else
{
[m_fadeTimer invalidate];
m_fadeTimer = nullptr;
}
}
virtual void cursor_entering(const gfx::point& pt)
{
suppress_fade();
nsview_pane::cursor_entering(pt);
}
virtual void cursor_leaving()
{
unsuppress_fade();
nsview_pane::cursor_leaving();
}
};
inline std::pair<rcref<gui::bridgeable_pane>, rcref<gui::scroll_bar_interface> > nsview_subsystem::create_scroll_bar() volatile
{
rcref<scroll_bar> sb = rcnew(scroll_bar)(this_rcref);
return std::make_pair(sb, sb);
}
}
}
#ifdef COGS_OBJECTIVE_C_CODE
@implementation objc_scroll_bar
-(BOOL)isFlipped
{
return YES;
}
-(void)scrolled:(id)sender
{
cogs::rcptr<cogs::os::scroll_bar> cppScrollBar = m_cppScrollBar;
if (!!cppScrollBar)
cppScrollBar->scrolled();
}
-(void)preferredScrollerStyleChanged:(NSNotification*)notification
{
cogs::rcptr<cogs::os::scroll_bar> cppScrollBar = m_cppScrollBar;
if (!!cppScrollBar)
{
NSScrollerStyle scrollerStyle = [NSScroller preferredScrollerStyle];
cppScrollBar->set_can_auto_fade(scrollerStyle == NSScrollerStyleOverlay);
}
}
+(BOOL)isCompatibleWithOverlayScrollers
{
return YES;
}
-(void)drawKnob
{
cogs::rcptr<cogs::os::scroll_bar> cppScrollBar = m_cppScrollBar;
if (!!cppScrollBar)
cppScrollBar->drawKnob();
else
[super drawKnob];
}
-(void)defaultDrawKnob
{
[super drawKnob];
}
-(void)drawKnobSlotInRect:(NSRect)slotRect highlight:(BOOL)flag
{
cogs::rcptr<cogs::os::scroll_bar> cppScrollBar = m_cppScrollBar;
if (!!cppScrollBar)
cppScrollBar->drawKnobSlotInRect(slotRect, flag);
else
[super drawKnobSlotInRect:slotRect highlight:flag];
}
-(void)defaultDrawKnobSlotInRect:(NSRect)slotRect highlight:(BOOL)flag
{
[super drawKnobSlotInRect:slotRect highlight:flag];
}
-(void)drawRect:(NSRect)dirtyRect
{
[super drawRect:dirtyRect];
}
-(void)fade:(NSTimer*)timer
{
cogs::rcptr<cogs::os::scroll_bar> cppScrollBar = m_cppScrollBar;
if (!!cppScrollBar)
cppScrollBar->fade();
}
@end
#endif
#endif
| 24.075503
| 180
| 0.716008
|
cogmine
|
7d7405fde349eeea40da5273dfd334848c18f502
| 619
|
cpp
|
C++
|
0801-0900/0892-Surface Area of 3D Shapes/0892-Surface Area of 3D Shapes.cpp
|
jiadaizhao/LeetCode
|
4ddea0a532fe7c5d053ffbd6870174ec99fc2d60
|
[
"MIT"
] | 49
|
2018-05-05T02:53:10.000Z
|
2022-03-30T12:08:09.000Z
|
0801-0900/0892-Surface Area of 3D Shapes/0892-Surface Area of 3D Shapes.cpp
|
jolly-fellow/LeetCode
|
ab20b3ec137ed05fad1edda1c30db04ab355486f
|
[
"MIT"
] | 11
|
2017-12-15T22:31:44.000Z
|
2020-10-02T12:42:49.000Z
|
0801-0900/0892-Surface Area of 3D Shapes/0892-Surface Area of 3D Shapes.cpp
|
jolly-fellow/LeetCode
|
ab20b3ec137ed05fad1edda1c30db04ab355486f
|
[
"MIT"
] | 28
|
2017-12-05T10:56:51.000Z
|
2022-01-26T18:18:27.000Z
|
class Solution {
public:
int surfaceArea(vector<vector<int>>& grid) {
int total = 0;
for (int i = 0; i < grid.size(); ++i) {
for (int j = 0; j < grid[i].size(); ++j) {
if (grid[i][j] > 0) {
total += grid[i][j] * 4 + 2;
if (i > 0) {
total -= min(grid[i - 1][j], grid[i][j]) * 2;
}
if (j > 0) {
total -= min(grid[i][j - 1], grid[i][j]) * 2;
}
}
}
}
return total;
}
};
| 28.136364
| 69
| 0.295638
|
jiadaizhao
|
7d7596ce9bafa625f38c75830bfe88ae69abba1a
| 9,524
|
cpp
|
C++
|
libs2eplugins/src/s2e/Plugins/Lua/LuaFunctionInstrumentation.cpp
|
sebastianpoeplau/s2e
|
995cac6126e7d80337e8c4a72bfa9a87eea7eb68
|
[
"MIT"
] | 55
|
2019-12-20T03:25:14.000Z
|
2022-01-16T07:19:47.000Z
|
libs2eplugins/src/s2e/Plugins/Lua/LuaFunctionInstrumentation.cpp
|
Moirai7/s2e
|
5a321f76d1a862c3898b9d24de621109b0c12b7d
|
[
"MIT"
] | 2
|
2020-11-02T08:01:00.000Z
|
2022-03-27T02:59:18.000Z
|
libs2eplugins/src/s2e/Plugins/Lua/LuaFunctionInstrumentation.cpp
|
Moirai7/s2e
|
5a321f76d1a862c3898b9d24de621109b0c12b7d
|
[
"MIT"
] | 11
|
2020-08-06T03:59:45.000Z
|
2022-02-25T02:31:59.000Z
|
///
/// Copyright (C) 2015, Dependable Systems Laboratory, EPFL
/// Copyright (C) 2014-2019, Cyberhaven
///
/// 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 <s2e/ConfigFile.h>
#include <s2e/S2E.h>
#include <s2e/S2EExecutor.h>
#include <s2e/Utils.h>
#include <s2e/Plugins/ExecutionMonitors/FunctionMonitor.h>
#include <s2e/Plugins/Support/KeyValueStore.h>
#include "LuaFunctionInstrumentation.h"
#include "LuaFunctionInstrumentationState.h"
#include "LuaS2EExecutionState.h"
namespace s2e {
namespace plugins {
S2E_DEFINE_PLUGIN(LuaFunctionInstrumentation, "Execute Lua code on a function call", "LuaFunctionInstrumentation",
"FunctionMonitor", "LuaBindings");
class LuaFunctionInstrumentationPluginState : public PluginState {
private:
bool m_child;
public:
LuaFunctionInstrumentationPluginState() : m_child(false){};
virtual LuaFunctionInstrumentationPluginState *clone() const {
return new LuaFunctionInstrumentationPluginState(*this);
}
static PluginState *factory(Plugin *p, S2EExecutionState *s) {
return new LuaFunctionInstrumentationPluginState();
}
bool isChild() const {
return m_child;
}
void makeChild(bool child) {
m_child = child;
}
};
/*************************************************************************/
static std::string readStringOrFail(S2E *s2e, const std::string &key) {
bool ok;
ConfigFile *cfg = s2e->getConfig();
std::string ret = cfg->getString(key, "", &ok);
if (!ok) {
s2e->getWarningsStream() << "LuaFunctionInstrumentation: " << key << " is missing\n";
exit(-1);
}
return ret;
}
static uint64_t readIntOrFail(S2E *s2e, const std::string &key) {
bool ok;
ConfigFile *cfg = s2e->getConfig();
uint64_t ret = cfg->getInt(key, 0, &ok);
if (!ok) {
s2e->getWarningsStream() << "LuaFunctionInstrumentation: " << key << " is missing\n";
exit(-1);
}
return ret;
}
static bool readBoolOrFail(S2E *s2e, const std::string &key) {
bool ok;
ConfigFile *cfg = s2e->getConfig();
bool ret = cfg->getBool(key, 0, &ok);
if (!ok) {
s2e->getWarningsStream() << "LuaFunctionInstrumentation: " << key << " is missing\n";
exit(-1);
}
return ret;
}
void LuaFunctionInstrumentation::initialize() {
m_functionMonitor = s2e()->getPlugin<FunctionMonitor>();
m_kvs = s2e()->getPlugin<KeyValueStore>();
bool ok;
ConfigFile *cfg = s2e()->getConfig();
ConfigFile::string_list keys = cfg->getListKeys(getConfigKey() + ".instrumentation", &ok);
if (!ok) {
getWarningsStream() << "must have an .instrumentation section\n";
exit(-1);
}
for (auto const &key : keys) {
std::stringstream ss;
ss << getConfigKey() << ".instrumentation." << key;
std::string moduleName = readStringOrFail(s2e(), ss.str() + ".module_name");
std::string instrumentationName = readStringOrFail(s2e(), ss.str() + ".name");
uint64_t pc = readIntOrFail(s2e(), ss.str() + ".pc");
unsigned paramCount = readIntOrFail(s2e(), ss.str() + ".param_count");
bool fork = readBoolOrFail(s2e(), ss.str() + ".fork");
std::string cc = readStringOrFail(s2e(), ss.str() + ".convention");
Instrumentation::CallingConvention convention;
if (cc == "stdcall") {
convention = Instrumentation::STDCALL;
} else if (cc == "cdecl") {
convention = Instrumentation::CDECL;
} else {
getWarningsStream() << "unknown calling convention" << cc << "\n";
exit(-1);
}
if (!registerInstrumentation(
Instrumentation(moduleName, pc, paramCount, instrumentationName, convention, fork))) {
exit(-1);
}
}
m_functionMonitor->onCall.connect(sigc::mem_fun(*this, &LuaFunctionInstrumentation::onCall));
}
void LuaFunctionInstrumentation::onCall(S2EExecutionState *state, const ModuleDescriptorConstPtr &source,
const ModuleDescriptorConstPtr &dest, uint64_t callerPc, uint64_t calleePc,
const FunctionMonitor::ReturnSignalPtr &returnSignal) {
if (!dest) {
return;
}
// TODO: need faster lookup
for (auto const &instrumentation : m_instrumentations) {
if (instrumentation->pc == calleePc && instrumentation->moduleName == dest->Name) {
invokeInstrumentation(state, *instrumentation, true);
returnSignal->connect(
sigc::bind(sigc::mem_fun(*this, &LuaFunctionInstrumentation::onRet), instrumentation));
}
}
}
void LuaFunctionInstrumentation::onRet(S2EExecutionState *state, const ModuleDescriptorConstPtr &source,
const ModuleDescriptorConstPtr &dest, uint64_t returnSite,
InstrumentationPtr instrumentation) {
invokeInstrumentation(state, *instrumentation, false);
}
bool LuaFunctionInstrumentation::registerInstrumentation(const Instrumentation &instrumentation) {
for (auto const &annot : m_instrumentations) {
if (*annot == instrumentation) {
getWarningsStream() << "attempting to register existing instrumentation\n";
return false;
}
}
m_instrumentations.push_back(std::make_shared<Instrumentation>(instrumentation));
getDebugStream() << "loaded " << instrumentation.instrumentationName << " " << instrumentation.moduleName << "!"
<< hexval(instrumentation.pc) << " convention: " << instrumentation.convention << "\n";
return true;
}
void LuaFunctionInstrumentation::forkInstrumentation(S2EExecutionState *state, const Instrumentation &entry) {
DECLARE_PLUGINSTATE_N(LuaFunctionInstrumentationPluginState, p, state);
if (p->isChild()) {
return;
}
std::stringstream ss;
ss << "instrumentation_" << entry.instrumentationName << "_child";
// Use the KVS to make sure that we exercise the annotated function only once
if (m_kvs) {
bool exists = false;
m_kvs->put(ss.str(), "1", exists);
if (exists) {
return;
}
}
klee::ref<klee::Expr> cond = state->createSymbolicValue<uint8_t>(ss.str(), 0);
cond = klee::Expr::createIsZero(cond);
S2EExecutor::StatePair sp = s2e()->getExecutor()->forkCondition(state, cond);
S2EExecutionState *s1 = static_cast<S2EExecutionState *>(sp.first);
S2EExecutionState *s2 = static_cast<S2EExecutionState *>(sp.second);
DECLARE_PLUGINSTATE_N(LuaFunctionInstrumentationPluginState, p1, s1);
p1->makeChild(false);
DECLARE_PLUGINSTATE_N(LuaFunctionInstrumentationPluginState, p2, s2);
p2->makeChild(true);
}
void LuaFunctionInstrumentation::invokeInstrumentation(S2EExecutionState *state, const Instrumentation &entry,
bool isCall) {
lua_State *L = s2e()->getConfig()->getState();
LuaS2EExecutionState luaS2EState(state);
LuaFunctionInstrumentationState luaInstrumentation;
if (isCall && entry.fork) {
DECLARE_PLUGINSTATE_N(LuaFunctionInstrumentationPluginState, p, state);
forkInstrumentation(state, entry);
luaInstrumentation.setChild(p->isChild());
p->makeChild(false);
}
lua_getglobal(L, entry.instrumentationName.c_str());
Lunar<LuaS2EExecutionState>::push(L, &luaS2EState);
Lunar<LuaFunctionInstrumentationState>::push(L, &luaInstrumentation);
if (entry.paramCount > 0 && state->getPointerSize() == 8) {
s2e()->getExecutor()->terminateState(*state, "64-bit support not implemented");
}
lua_pushboolean(L, isCall);
uint64_t pointerSize = state->getPointerSize();
uint64_t paramSp = state->regs()->getSp() + pointerSize;
for (unsigned i = 0; i < entry.paramCount; ++i) {
uint64_t address = paramSp + i * pointerSize;
lua_pushinteger(L, address);
}
lua_call(L, 3 + entry.paramCount, 0);
if (luaInstrumentation.exitCpuLoop()) {
throw CpuExitException();
}
if (isCall && luaInstrumentation.doSkip()) {
if (entry.convention == Instrumentation::STDCALL) {
state->bypassFunction(entry.paramCount);
} else {
state->bypassFunction(0);
}
throw CpuExitException();
}
}
} // namespace plugins
} // namespace s2e
| 35.014706
| 116
| 0.650147
|
sebastianpoeplau
|
7d7ea7062e666fb13f7449a3bf72c0b43d3da71a
| 2,433
|
cpp
|
C++
|
test/operation/exec.cpp
|
egranata/krakatau
|
866a26580e9890d5fb0961280b9827f347b3776e
|
[
"Apache-2.0"
] | 13
|
2019-05-02T23:28:36.000Z
|
2021-04-04T02:38:01.000Z
|
test/operation/exec.cpp
|
egranata/krakatau
|
866a26580e9890d5fb0961280b9827f347b3776e
|
[
"Apache-2.0"
] | 28
|
2019-05-04T16:09:37.000Z
|
2019-06-18T02:03:50.000Z
|
test/operation/exec.cpp
|
egranata/krakatau
|
866a26580e9890d5fb0961280b9827f347b3776e
|
[
"Apache-2.0"
] | 1
|
2020-07-23T20:06:40.000Z
|
2020-07-23T20:06:40.000Z
|
// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <machine/state.h>
#include <operation/push.h>
#include <operation/exec.h>
#include <operation/dup.h>
#include <value/value.h>
#include <operation/block.h>
#include <gtest/gtest.h>
#include <value/number.h>
#include <value/operation.h>
#include <value/error.h>
#include <rtti/rtti.h>
#include <value/bind.h>
#include <operation/bind.h>
#include <value/empty.h>
TEST(Exec, Block) {
MachineState s;
auto blk = std::make_shared<Block>();
blk->add(std::make_shared<Push>(Value::fromNumber(12)));
blk->add(std::make_shared<Dup>());
s.stack().push(Value::fromBlock(blk));
Exec e;
ASSERT_EQ(Operation::Result::SUCCESS, e.execute(s));
ASSERT_EQ(2, s.stack().size());
ASSERT_TRUE(s.stack().peek()->isOfClass<Value_Number>());
}
TEST(Exec, Operation) {
MachineState s;
auto oper = std::shared_ptr<Operation>(new Push(Value::fromNumber(12)));
s.stack().push(Value::fromOperation(oper));
Exec e;
ASSERT_EQ(Operation::Result::SUCCESS, e.execute(s));
ASSERT_EQ(1, s.stack().size());
ASSERT_TRUE(s.stack().peek()->isOfClass<Value_Number>());
}
TEST(Exec, NotBlock) {
MachineState s;
Exec e;
s.stack().push(Value::empty());
ASSERT_EQ(Operation::Result::ERROR, e.execute(s));
ASSERT_EQ(2, s.stack().size());
ASSERT_TRUE(s.stack().peek()->isOfClass<Value_Error>());
ASSERT_EQ(ErrorCode::TYPE_MISMATCH, runtime_ptr_cast<Value_Error>(s.stack().peek())->value());
}
TEST(Exec, Bind) {
MachineState s;
Exec e;
s.stack().push(Value::fromBind(std::make_shared<PartialBind>(Value::fromNumber(123), std::make_shared<Dup>())));
ASSERT_EQ(Operation::Result::SUCCESS, e.execute(s));
ASSERT_EQ(2, s.stack().size());
ASSERT_TRUE(Value::fromNumber(123)->equals(s.stack().pop()));
ASSERT_TRUE(Value::fromNumber(123)->equals(s.stack().pop()));
}
| 34.267606
| 116
| 0.685984
|
egranata
|
7d7f75355ff8f074d94ef4a92ad36d3fe50d55c9
| 48
|
hpp
|
C++
|
src/boost_preprocessor_list_to_tuple.hpp
|
miathedev/BoostForArduino
|
919621dcd0c157094bed4df752b583ba6ea6409e
|
[
"BSL-1.0"
] | 10
|
2018-03-17T00:58:42.000Z
|
2021-07-06T02:48:49.000Z
|
src/boost_preprocessor_list_to_tuple.hpp
|
miathedev/BoostForArduino
|
919621dcd0c157094bed4df752b583ba6ea6409e
|
[
"BSL-1.0"
] | 2
|
2021-03-26T15:17:35.000Z
|
2021-05-20T23:55:08.000Z
|
src/boost_preprocessor_list_to_tuple.hpp
|
miathedev/BoostForArduino
|
919621dcd0c157094bed4df752b583ba6ea6409e
|
[
"BSL-1.0"
] | 4
|
2019-05-28T21:06:37.000Z
|
2021-07-06T03:06:52.000Z
|
#include <boost/preprocessor/list/to_tuple.hpp>
| 24
| 47
| 0.8125
|
miathedev
|
7d7fb8c2d059d53e033a0ebb83481f72df87ebd5
| 57,296
|
cpp
|
C++
|
src/drivers/cosmica.cpp
|
pierrelouys/PSP-MAME4ALL
|
54374b0579b7e2377f015ac155d8f519addfaa1a
|
[
"Unlicense"
] | 1
|
2021-01-25T20:16:33.000Z
|
2021-01-25T20:16:33.000Z
|
src/drivers/cosmica.cpp
|
pierrelouys/PSP-MAME4ALL
|
54374b0579b7e2377f015ac155d8f519addfaa1a
|
[
"Unlicense"
] | 1
|
2021-05-24T20:28:35.000Z
|
2021-05-25T14:44:54.000Z
|
src/drivers/cosmica.cpp
|
PSP-Archive/PSP-MAME4ALL
|
54374b0579b7e2377f015ac155d8f519addfaa1a
|
[
"Unlicense"
] | null | null | null |
/*Se anula todo lo referente a Space Panic y Cosmic Guerrilla*/
/***************************************************************************
Space Panic memory map
0000-3FFF ROM
4000-5BFF Video RAM (Bitmap)
5C00-5FFF RAM
6000-601F Sprite Controller
4 bytes per sprite
byte 1 - 80 = ?
40 = Rotate sprite left/right
3F = Sprite Number (Conversion to my layout via table)
byte 2 - X co-ordinate
byte 3 - Y co-ordinate
byte 4 - 08 = Switch sprite bank
07 = Colour
6800 IN1 - Player controls. See input port setup for mappings
6801 IN2 - Player 2 controls for cocktail mode. See input port setup for mappings.
6802 DSW - Dip switches
6803 IN0 - Coinage and player start
700C-700E Colour Map Selector
(Not Implemented)
7000-700B Various triggers, Sound etc
700F Ditto
7800 80 = Flash Screen?
I/O ports:
read:
write:
***************************************************************************/
#include "driver.h"
#include "vidhrdw/generic.h"
#include "z80/z80.h"
/**************************************************/
/* Cosmic routines */
/**************************************************/
int PixelClock = 0;
extern unsigned char *cosmic_videoram;
void cosmic_videoram_w(int offset,int data);
void cosmic_flipscreen_w(int offset, int data);
int cosmic_vh_start(void);
void cosmic_vh_stop(void);
void cosmic_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
void cosmic_vh_screenrefresh_sprites(struct osd_bitmap *bitmap,int full_refresh);
//static struct MemoryReadAddress readmem[] =
//{
// { 0x4000, 0x5FFF, MRA_RAM },
// { 0x0000, 0x3fff, MRA_ROM },
// { 0x6800, 0x6800, input_port_0_r }, /* IN1 */
// { 0x6801, 0x6801, input_port_1_r }, /* IN2 */
// { 0x6802, 0x6802, input_port_2_r }, /* DSW */
// { 0x6803, 0x6803, input_port_3_r }, /* IN0 */
// { -1 } /* end of table */
//};
static struct DACinterface dac_interface =
{
1,
{ 100 }
};
/* Se anula porque da error
static struct Samplesinterface samples_interface =
{
9, /* 9 channels * /
25 /* volume * /
}; Fin Se anula porque da error*/
/**************************************************/
/* Space Panic specific routines */
/************************************************** /
void panic_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
void panic_colourmap_select(int offset,int data);
int panic_interrupt(void);
static struct MemoryWriteAddress panic_writemem[] =
{
{ 0x4000, 0x43FF, MWA_RAM },
{ 0x4400, 0x5BFF, cosmic_videoram_w, &cosmic_videoram },
{ 0x5C00, 0x5FFF, MWA_RAM },
{ 0x6000, 0x601F, MWA_RAM, &spriteram, &spriteram_size },
{ 0x0000, 0x3fff, MWA_ROM },
{ 0x700C, 0x700E, panic_colourmap_select },
{ -1 } /* end of table * /
};
INPUT_PORTS_START( input_ports )
PORT_START /* IN1 * /
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 )
PORT_START /* IN2 * /
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_COCKTAIL )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY | IPF_COCKTAIL )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY | IPF_COCKTAIL )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY | IPF_COCKTAIL )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
PORT_START /* DSW * /
PORT_DIPNAME( 0x07, 0x00, "Coin_A", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "1C_1C" )
PORT_DIPSETTING( 0x05, "2C_3C" )
PORT_DIPSETTING( 0x01, "1C_2C" )
PORT_DIPSETTING( 0x02, "1C_3C" )
PORT_DIPSETTING( 0x03, "1C_4C" )
PORT_DIPSETTING( 0x04, "1C_5C" )
/* 0x06 and 0x07 disabled * /
PORT_DIPNAME( 0x08, 0x00, "Cabinet", IP_KEY_NONE)
PORT_DIPSETTING( 0x00, "Upright" )
PORT_DIPSETTING( 0x08, "Cocktail" )
PORT_DIPNAME( 0x10, 0x00, "Bonus_Life", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "3000" )
PORT_DIPSETTING( 0x10, "5000" )
PORT_DIPNAME( 0x20, 0x00, "Lives", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "3" )
PORT_DIPSETTING( 0x20, "4" )
PORT_DIPNAME( 0xc0, 0x40, "Coin_B", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "2C_1C" )
PORT_DIPSETTING( 0x40, "1C_1C" )
PORT_DIPSETTING( 0x80, "1C_2C" )
PORT_DIPSETTING( 0xc0, "1C_3C" )
PORT_START /* IN0 * /
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
INPUT_PORTS_END
/* Main Sprites * /
static struct GfxLayout panic_spritelayout0 =
{
16,16, /* 16*16 sprites *
48 , /* 64 sprites * /
2, /* 2 bits per pixel * /
{ 4096*8, 0 }, /* the two bitplanes are separated /
{ 0,1,2,3,4,5,6,7,16*8+0,16*8+1,16*8+2,16*8+3,16*8+4,16*8+5,16*8+6,16*8+7 },
{ 15*8, 14*8, 13*8, 12*8, 11*8, 10*8, 9*8, 8*8, 7*8, 6*8, 5*8, 4*8, 3*8, 2*8, 1*8, 0*8 },
32*8 /* every sprite takes 32 consecutive bytes * /
};
/* Man Top * /
static struct GfxLayout panic_spritelayout1 =
{
16,16, /* 16*16 sprites * /
16 , /* 16 sprites * /
2, /* 2 bits per pixel * /
{ 4096*8, 0 }, /* the two bitplanes are separated * /
{ 0,1,2,3,4,5,6,7,16*8+0,16*8+1,16*8+2,16*8+3,16*8+4,16*8+5,16*8+6,16*8+7 },
{ 15*8, 14*8, 13*8, 12*8, 11*8, 10*8, 9*8, 8*8, 7*8, 6*8, 5*8, 4*8, 3*8, 2*8, 1*8, 0*8 },
32*8 /* every sprite takes 32 consecutive bytes * /
};
static struct GfxDecodeInfo panic_gfxdecodeinfo[] =
{
{ 1, 0x0A00, &panic_spritelayout0, 0, 8 }, /* Monsters * /
{ 1, 0x0200, &panic_spritelayout0, 0, 8 }, /* Monsters eating Man * /
{ 1, 0x0800, &panic_spritelayout1, 0, 8 }, /* Man * /
{ -1 } /* end of array * /
};
static struct MachineDriver panic_machine_driver =
{
/* basic machine hardware * /
{
{
CPU_Z80,
2000000, /* 2 Mhz? * /
0,
readmem,panic_writemem,0,0,
panic_interrupt,2
}
},
60, DEFAULT_60HZ_VBLANK_DURATION, /* frames per second, vblank duration * /
1, /* single CPU, no need for interleaving * /
0,
/* video hardware * /
32*8, 24*8, { 0*8, 32*8-1, 0*8, 24*8-1 },
panic_gfxdecodeinfo,
16, 8*4,
panic_vh_convert_color_prom,
VIDEO_TYPE_RASTER|VIDEO_SUPPORTS_DIRTY,
0,
cosmic_vh_start,
cosmic_vh_stop,
cosmic_vh_screenrefresh,
/* sound hardware * /
0,0,0,0
};
static int panic_hiload(void)
{
unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];
/* wait for default to be copied * /
if (RAM[0x40c1] == 0x00 && RAM[0x40c2] == 0x03 && RAM[0x40c3] == 0x04)
{
void *f;
if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
{
RAM[0x4004] = 0x01; /* Prevent program resetting high score * /
osd_fread(f,&RAM[0x40C1],5);
osd_fread(f,&RAM[0x5C00],12);
osd_fclose(f);
}
return 1;
}
else return 0; /* we can't load the hi scores yet * /
}
static void panic_hisave(void)
{
void *f;
unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];
if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,1)) != 0)
{
osd_fwrite(f,&RAM[0x40C1],5);
osd_fwrite(f,&RAM[0x5C00],12);
osd_fclose(f);
}
}
int panic_interrupt(void)
{
static int count=0;
count++;
if (count == 1)
{
return 0x00cf; /* RST 08h * /
}
else
{
count=0;
return 0x00d7; /* RST 10h * /
}
}
ROM_START( panic_rom )
ROM_REGION(0x10000) /* 64k for code * /
ROM_LOAD( "spcpanic.1", 0x0000, 0x0800, 0x405ae6f9 ) /* Code * /
ROM_LOAD( "spcpanic.2", 0x0800, 0x0800, 0xb6a286c5 )
ROM_LOAD( "spcpanic.3", 0x1000, 0x0800, 0x85ae8b2e )
ROM_LOAD( "spcpanic.4", 0x1800, 0x0800, 0xb6d4f52f )
ROM_LOAD( "spcpanic.5", 0x2000, 0x0800, 0x5b80f277 )
ROM_LOAD( "spcpanic.6", 0x2800, 0x0800, 0xb73babf0 )
ROM_LOAD( "spcpanic.7", 0x3000, 0x0800, 0xfc27f4e5 )
ROM_REGION_DISPOSE(0x2000) /* temporary space for graphics (disposed after conversion) * /
ROM_LOAD( "spcpanic.9", 0x0000, 0x0800, 0xeec78b4c )
ROM_LOAD( "spcpanic.10", 0x0800, 0x0800, 0xc9631c2d )
ROM_LOAD( "spcpanic.12", 0x1000, 0x0800, 0xe83423d0 )
ROM_LOAD( "spcpanic.11", 0x1800, 0x0800, 0xacea9df4 )
ROM_REGION(0x0820) /* color PROMs * /
ROM_LOAD( "82s123.sp", 0x0000, 0x0020, 0x35d43d2f )
ROM_LOAD( "spcpanic.8", 0x0020, 0x0800, 0x7da0b321 )
ROM_END
ROM_START( panica_rom )
ROM_REGION(0x10000) /* 64k for code * /
ROM_LOAD( "panica.1", 0x0000, 0x0800, 0x289720ce ) /* Code * /
ROM_LOAD( "spcpanic.2", 0x0800, 0x0800, 0xb6a286c5 )
ROM_LOAD( "spcpanic.3", 0x1000, 0x0800, 0x85ae8b2e )
ROM_LOAD( "spcpanic.4", 0x1800, 0x0800, 0xb6d4f52f )
ROM_LOAD( "spcpanic.5", 0x2000, 0x0800, 0x5b80f277 )
ROM_LOAD( "spcpanic.6", 0x2800, 0x0800, 0xb73babf0 )
ROM_LOAD( "panica.7", 0x3000, 0x0800, 0x3641cb7f )
ROM_REGION_DISPOSE(0x2000) /* temporary space for graphics (disposed after conversion) * /
ROM_LOAD( "spcpanic.9", 0x0000, 0x0800, 0xeec78b4c )
ROM_LOAD( "spcpanic.10", 0x0800, 0x0800, 0xc9631c2d )
ROM_LOAD( "spcpanic.12", 0x1000, 0x0800, 0xe83423d0 )
ROM_LOAD( "spcpanic.11", 0x1800, 0x0800, 0xacea9df4 )
ROM_REGION(0x0820) /* color PROMs * /
ROM_LOAD( "82s123.sp", 0x0000, 0x0020, 0x35d43d2f )
ROM_LOAD( "spcpanic.8", 0x0020, 0x0800, 0x7da0b321 )
ROM_END
ROM_START( panicger_rom )
ROM_REGION(0x10000) /* 64k for code * /
ROM_LOAD( "spacepan.001", 0x0000, 0x0800, 0xa6d9515a ) /* Code * /
ROM_LOAD( "spacepan.002", 0x0800, 0x0800, 0xcfc22663 )
ROM_LOAD( "spacepan.003", 0x1000, 0x0800, 0xe1f36893 )
ROM_LOAD( "spacepan.004", 0x1800, 0x0800, 0x01be297c )
ROM_LOAD( "spacepan.005", 0x2000, 0x0800, 0xe0d54805 )
ROM_LOAD( "spacepan.006", 0x2800, 0x0800, 0xaae1458e )
ROM_LOAD( "spacepan.007", 0x3000, 0x0800, 0x14e46e70 )
ROM_REGION_DISPOSE(0x2000) /* temporary space for graphics (disposed after conversion) * /
ROM_LOAD( "spcpanic.9", 0x0000, 0x0800, 0xeec78b4c )
ROM_LOAD( "spcpanic.10", 0x0800, 0x0800, 0xc9631c2d )
ROM_LOAD( "spcpanic.12", 0x1000, 0x0800, 0xe83423d0 )
ROM_LOAD( "spcpanic.11", 0x1800, 0x0800, 0xacea9df4 )
ROM_REGION(0x0820) /* color PROMs * /
ROM_LOAD( "82s123.sp", 0x0000, 0x0020, 0x35d43d2f )
ROM_LOAD( "spcpanic.8", 0x0020, 0x0800, 0x7da0b321 )
ROM_END
struct GameDriver panic_driver =
{
__FILE__,
0,
"panic",
"Space Panic (set 1)",
"1980",
"Universal",
"Mike Coates (MAME driver)\nMarco Cassili",
0,
&panic_machine_driver,
0,
panic_rom,
0, 0,
0,
0, /* sound_prom * /
input_ports,
PROM_MEMORY_REGION(2), 0, 0,
ORIENTATION_ROTATE_270,
panic_hiload, panic_hisave
};
struct GameDriver panica_driver =
{
__FILE__,
&panic_driver,
"panica",
"Space Panic (set 2)",
"1980",
"Universal",
"Mike Coates (MAME driver)\nMarco Cassili",
0,
&panic_machine_driver,
0,
panica_rom,
0, 0,
0,
0, /* sound_prom * /
input_ports,
PROM_MEMORY_REGION(2), 0, 0,
ORIENTATION_ROTATE_270,
panic_hiload, panic_hisave
};
struct GameDriver panicger_driver =
{
__FILE__,
&panic_driver,
"panicger",
"Space Panic (German)",
"1980",
"Universal (ADP Automaten license)",
"Mike Coates (MAME driver)\nMarco Cassili",
0,
&panic_machine_driver,
0,
panicger_rom,
0, 0,
0,
0, /* sound_prom * /
input_ports,
PROM_MEMORY_REGION(2), 0, 0,
ORIENTATION_ROTATE_270,
panic_hiload, panic_hisave
};
/**************************************************/
/* Cosmic Alien specific routines */
/**************************************************/
void cosmicalien_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
void cosmicalien_colourmap_select(int offset,int data);
int cosmicalien_interrupt(void)
{
PixelClock = (PixelClock + 2) & 63;
if (PixelClock == 0)
{
if (readinputport(3) & 1) /* Left Coin */
return nmi_interrupt();
else
return ignore_interrupt();
}
else
return ignore_interrupt();
}
int cosmicalien_video_address_r(int offset)
{
return PixelClock;
}
static struct MemoryReadAddress cosmicalien_readmem[] =
{
{ 0x4000, 0x5FFF, MRA_RAM },
{ 0x0000, 0x3fff, MRA_ROM },
{ 0x6800, 0x6800, input_port_0_r }, /* IN1 */
{ 0x6801, 0x6801, input_port_1_r }, /* IN2 */
{ 0x6802, 0x6802, input_port_2_r }, /* DSW */
{ 0x6803, 0x6803, cosmicalien_video_address_r },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress cosmicalien_writemem[] =
{
{ 0x4000, 0x43ff, MWA_RAM },
{ 0x4400, 0x5bff, cosmic_videoram_w, &cosmic_videoram},
{ 0x5c00, 0x5fff, MWA_RAM },
{ 0x6000, 0x601f, MWA_RAM ,&spriteram, &spriteram_size },
{ 0x7000, 0x700B, MWA_RAM }, /* Sound Triggers */
{ 0x700C, 0x700C, cosmicalien_colourmap_select },
{ -1 } /* end of table */
};
INPUT_PORTS_START( cosmicalien_input_ports )
PORT_START /* IN0 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START /* IN1 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_COCKTAIL )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY | IPF_COCKTAIL )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START /* IN2 */
PORT_DIPNAME( 0x01, 0x00, "Cabinet", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Upright" )
PORT_DIPSETTING( 0x01, "Cocktail" )
PORT_DIPNAME( 0x02, 0x02, "Lives", IP_KEY_NONE )
PORT_DIPSETTING( 0x02, "3" )
PORT_DIPSETTING( 0x00, "5" )
PORT_DIPNAME( 0x0c, 0x00, "Coinage", IP_KEY_NONE )
PORT_DIPSETTING( 0x08, "2C_1C" )
PORT_DIPSETTING( 0x00, "1C_1C" )
PORT_DIPSETTING( 0x04, "1C_2C" )
/* 0c gives 1C_1C */
PORT_DIPNAME( 0x30, 0x30, "Bonus_Life", IP_KEY_NONE )
PORT_DIPSETTING( 0x30, "5000" )
PORT_DIPSETTING( 0x20, "10000" )
PORT_DIPSETTING( 0x10, "15000" )
PORT_DIPSETTING( 0x00, "None" )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
/* The coin slots are not memory mapped. Coin causes a NMI, */
/* This fake input port is used by the interrupt */
/* handler to be notified of coin insertions. We use IMPULSE to */
/* trigger exactly one interrupt, without having to check when the */
/* user releases the key. */
PORT_START /* FAKE */
PORT_BITX(0x01, IP_ACTIVE_HIGH, IPT_COIN1 | IPF_IMPULSE,
"Coin", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 1 )
INPUT_PORTS_END
static struct GfxLayout cosmicalien_spritelayout16 =
{
16,16, /* 16*16 sprites */
64, /* 64 sprites */
2, /* 2 bits per pixel */
{ 0, 64*16*16 }, /* the two bitplanes are separated */
{ 0,1,2,3,4,5,6,7,16*8+0,16*8+1,16*8+2,16*8+3,16*8+4,16*8+5,16*8+6,16*8+7},
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
32*8 /* every sprite takes 32 consecutive bytes */
};
static struct GfxLayout cosmicalien_spritelayout32 =
{
32,32, /* 32*32 sprites */
16, /* 16 sprites */
2, /* 2 bits per pixel */
{ 0, 64*16*16 }, /* the two bitplanes are separated */
{ 0,1,2,3,4,5,6,7,
32*8+0, 32*8+1, 32*8+2, 32*8+3, 32*8+4, 32*8+5, 32*8+6, 32*8+7,
64*8+0, 64*8+1, 64*8+2, 64*8+3, 64*8+4, 64*8+5, 64*8+6, 64*8+7,
96*8+0, 96*8+1, 96*8+2, 96*8+3, 96*8+4, 96*8+5, 96*8+6, 96*8+7 },
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8, 16*8, 17*8,18*8,19*8,20*8,21*8,22*8,23*8,24*8,25*8,26*8,27*8,28*8,29*8,30*8,31*8 },
128*8 /* every sprite takes 128 consecutive bytes */
};
static struct GfxDecodeInfo cosmicalien_gfxdecodeinfo[] =
{
{ 1, 0x0000, &cosmicalien_spritelayout16, 0, 8 },
{ 1, 0x0000, &cosmicalien_spritelayout32, 0, 8 },
{ -1 } /* end of array */
};
/* HSC 12/02/98 */
static int cosmicalienhiload(void)
{
static int firsttime = 0;
unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];
/* check if the hi score table has already been initialized */
/* the high score table is intialized to all 0, so first of all */
/* we dirty it, then we wait for it to be cleared again */
if (firsttime == 0)
{
fast_memset(&RAM[0x400e],0xff,4); /* high score */
firsttime = 1;
}
/* check if the hi score table has already been initialized */
if (memcmp(&RAM[0x400e],"\x00\x00\x00",3) == 0 )
{
void *f;
if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
{
osd_fread(f,&RAM[0x400e],3);
osd_fclose(f);
}
firsttime = 0;
return 1;
}
else return 0; /* we can't load the hi scores yet */
}
static void cosmicalienhisave(void)
{
void *f;
unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];
if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,1)) != 0)
{
osd_fwrite(f,&RAM[0x400e],3);
osd_fclose(f);
}
}
static struct MachineDriver cosmicalien_machine_driver =
{
/* basic machine hardware */
{
{
CPU_Z80,
1081600,
0,
cosmicalien_readmem,cosmicalien_writemem,0,0,
cosmicalien_interrupt,32
}
},
60, 2500, /* frames per second, vblank duration */
1, /* single CPU, no need for interleaving */
0,
/* video hardware */
32*8, 24*8, { 0*8, 32*8-1, 0*8, 24*8-1 },
cosmicalien_gfxdecodeinfo,
8, 16*4,
cosmicalien_vh_convert_color_prom,
VIDEO_TYPE_RASTER|VIDEO_SUPPORTS_DIRTY,
0,
cosmic_vh_start,
cosmic_vh_stop,
cosmic_vh_screenrefresh_sprites,
/* sound hardware */
0,0,0,0
};
ROM_START( cosmicalien_rom )
ROM_REGION(0x10000) /* 64k for code */
ROM_LOAD( "r1", 0x0000, 0x0800, 0x535ee0c5 )
ROM_LOAD( "r2", 0x0800, 0x0800, 0xed3cf8f7 )
ROM_LOAD( "r3", 0x1000, 0x0800, 0x6a111e5e )
ROM_LOAD( "r4", 0x1800, 0x0800, 0xc9b5ca2a )
ROM_LOAD( "r5", 0x2000, 0x0800, 0x43666d68 )
ROM_REGION_DISPOSE(0x1000) /* temporary space for graphics (disposed after conversion) */
ROM_LOAD( "r6", 0x0000, 0x0800, 0x431e866c )
ROM_LOAD( "r7", 0x0800, 0x0800, 0xaa6c6079 )
ROM_REGION(0x0420) /* color PROMs */
ROM_LOAD( "bpr1", 0x0000, 0x0020, 0xdfb60f19 )
ROM_LOAD( "r9", 0x0020, 0x0400, 0xea4ee931 )
ROM_END
struct GameDriver cosmica_driver =
{
__FILE__,
0,
"cosmica",
"Cosmic Alien",
"1980",
"Universal",
"Lee Taylor",
0,
&cosmicalien_machine_driver,
0,
cosmicalien_rom,
0, 0,
0,
0, /* sound_prom */
cosmicalien_input_ports,
PROM_MEMORY_REGION(2), 0, 0,
ORIENTATION_ROTATE_270,
cosmicalienhiload, cosmicalienhisave /* hsc 12/02/98 */
};
/*************************************************************************/
/* Cosmic Guerilla specific routines */
/*************************************************************************/
/* 0000-03FF ROM COSMICG.1 */
/* 0400-07FF ROM COSMICG.2 */
/* 0800-0BFF ROM COSMICG.3 */
/* 0C00-0FFF ROM COSMICG.4 */
/* 1000-13FF ROM COSMICG.5 */
/* 1400-17FF ROM COSMICG.6 */
/* 1800-1BFF ROM COSMICG.7 */
/* 1C00-1FFF ROM COSMICG.8 - Graphics */
/* */
/* 2000-23FF RAM */
/* 2400-3FEF Screen RAM */
/* 3FF0-3FFF CRT Controller registers (3FF0, register, 3FF4 Data) */
/* */
/* CRTC data */
/* ROM COSMICG.9 - Color Prom */
/* */
/* CR Bits (Inputs) */
/* 0000-0003 A9-A13 from CRTC Pixel Clock */
/* 0004-000B Controls */
/* 000C-000F Dip Switches */
/* */
/* CR Bits (Outputs) */
/* 0016-0017 Colourmap Selector */
/************************************************************************* /
void cosmicguerilla_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
void cosmicguerilla_output_w(int offset, int data);
void cosmicguerilla_colourmap_select(int offset,int data);
int cosmicguerilla_read_pixel_clock(int offset);
static struct MemoryReadAddress cosmicguerilla_readmem[] =
{
{ 0x2000, 0x3fff, MRA_RAM},
{ 0x0000, 0x1fff, MRA_ROM},
{ -1 } /* end of table * /
};
static struct MemoryWriteAddress cosmicguerilla_writemem[] =
{
{ 0x2000, 0x23ff, MWA_RAM },
{ 0x2400, 0x3bff, cosmic_videoram_w, &cosmic_videoram },
{ 0x3C00, 0x3fff, MWA_RAM },
{ 0x0000, 0x1fff, MWA_ROM },
{ -1 } /* end of table * /
};
/*static const char *cosmicguerilla_sample_names[] =
{
"*cosmicg",
"cg_m0.wav", /* 8 Different pitches of March Sound * /
"cg_m1.wav",
"cg_m2.wav",
"cg_m3.wav",
"cg_m4.wav",
"cg_m5.wav",
"cg_m6.wav",
"cg_m7.wav",
"cg_att.wav", /* Killer Attack * /
"cg_chnc.wav", /* Bonus Chance * /
"cg_gotb.wav", /* Got Bonus - have not got correct sound for * /
"cg_dest.wav", /* Gun Destroy * /
"cg_gun.wav", /* Gun Shot * /
"cg_gotm.wav", /* Got Monster * /
"cg_ext.wav", /* Coin Extend * /
0 /* end of array * /
};
* /
static struct IOReadPort cosmicguerilla_readport[] =
{
{ 0x00, 0x00, cosmicguerilla_read_pixel_clock },
{ 0x01, 0x01, input_port_1_r },
{ -1 } /* end of table * /
};
static struct IOWritePort cosmicguerilla_writeport[] =
{
{ 0x00, 0x15, cosmicguerilla_output_w },
{ 0x16, 0x17, cosmicguerilla_colourmap_select },
{ -1 } /* end of table * /
};
/***********eliminamos por ahora***************** /
void cosmicguerilla_output_w(int offset, int data)
{/*
static int MarchSelect;
static int GunDieSelect;
static int SoundEnable;
int Count;
/* Sound Enable / Disable * /
if (offset == 12)
{
SoundEnable = data;
if (data == 0)
for(Count=0;Count<9;Count++) sample_stop(Count);
}
if (SoundEnable)
{
switch (offset)
{
/* The schematics show a direct link to the sound amp */
/* as other cosmic series games, but it never seems to */
/* be used for anything. It is implemented for sake of */
/* completness. Maybe it plays a tune if you win ? * /
case 1 : DAC_data_w(0, -data);
break;
/* March Sound * /
case 2 : if (errorlog) fprintf(errorlog,"March = %d\n",MarchSelect);
if (data) sample_start (0, MarchSelect, 0);
break;
case 3 : MarchSelect = (MarchSelect & 0xFE) | data;
break;
case 4 : MarchSelect = (MarchSelect & 0xFD) | (data << 1);
break;
case 5 : MarchSelect = (MarchSelect & 0xFB) | (data << 2);
break;
/* Killer Attack (crawly thing at bottom of screen) * /
case 6 : if (data)
sample_start(1, 8, 1);
else
sample_stop(1);
break;
/* Bonus Chance & Got Bonus * /
case 7 : if (data)
{
sample_stop(4);
sample_start(4, 10, 0);
}
break;
case 8 : if (data)
{
if (!sample_playing(4)) sample_start(4, 9, 1);
}
else
sample_stop(4);
break;
/* Got Ship * /
case 9 : if (data) sample_start(3, 11, 0);
break;
case 11: /* Watchdog * /
break;
/* Got Monster / Gunshot * /
case 13: if (data) sample_start(8, 13-GunDieSelect, 0);
break;
case 14: GunDieSelect = data;
break;
/* Coin Extend (extra base) * /
case 15: if (data) sample_start(5, 14, 0);
break;
}
}
if((errorlog) && (offset != 11))
fprintf(errorlog,"Output %x=%x\n",offset,data);* /
}
/***********************fin eliminacion*********************** /
int cosmicguerilla_read_pixel_clock(int offset)
{
/* The top four address lines from the CRTC are bits 0-3 * /
return (input_port_0_r(0) & 0xf0) | PixelClock;
}
int cosmicguerilla_interrupt(void)
{
/* Increment Pixel Clock * /
PixelClock = (PixelClock + 1) & 15;
/* Insert Coin * /
if ((readinputport(2) & 1) & (PixelClock == 0)) /* Coin * /
{
return 4;
}
else
{
return ignore_interrupt();
}
}
static void cosmicguerilla_decode(void)
{
/* Roms have data pins connected different from normal * /
int Count;
unsigned char Scrambled,Normal;
for(Count=0x1fff;Count>=0;Count--)
{
Scrambled = Machine->memory_region[0][Count];
Normal = (Scrambled >> 3 & 0x11)
| (Scrambled >> 1 & 0x22)
| (Scrambled << 1 & 0x44)
| (Scrambled << 3 & 0x88);
Machine->memory_region[0][Count] = Normal;
}
/* Patch to avoid crash - Seems like duff romcheck routine */
/* I would expect it to be bitrot, but have two romsets */
/* from different sources with the same problem! * /
Machine->memory_region[0][0x1e9e] = 0x04;
Machine->memory_region[0][0x1e9f] = 0xc0;
}
/* These are used for the CR handling - This can be used to */
/* from 1 to 16 bits from any bit offset between 0 and 4096 */
/* Offsets are in BYTES, so bits 0-7 are at offset 0 etc. * /
INPUT_PORTS_START( cosmicguerilla_input_ports )
PORT_START /* 4-7 * /
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY )
PORT_START /* 8-15 * /
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_COCKTAIL)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY | IPF_COCKTAIL)
PORT_DIPNAME( 0x30, 0x30, "Bonus_Life", IP_KEY_NONE )
PORT_DIPSETTING( 0x10, "1000" )
PORT_DIPSETTING( 0x20, "1500" )
PORT_DIPSETTING( 0x30, "2000" )
PORT_DIPSETTING( 0x00, "None" )
PORT_DIPNAME( 0x40, 0x00, "Coinage", IP_KEY_NONE )
PORT_DIPSETTING( 0x40, "2C_1C" )
PORT_DIPSETTING( 0x00, "1C_1C" )
PORT_DIPNAME( 0x80, 0x00, "Lives", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "3" )
PORT_DIPSETTING( 0x80, "5" )
PORT_START /* Hard wired settings */
/* The coin slots are not memory mapped. Coin causes INT 4 */
/* This fake input port is used by the interrupt handler */
/* to be notified of coin insertions. We use IMPULSE to */
/* trigger exactly one interrupt, without having to check */
/* when the user releases the key. * /
PORT_BITX(0x01, IP_ACTIVE_HIGH, IPT_COIN1 | IPF_IMPULSE,
"Coin", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 1 )
/* This dip switch is not read by the program at any time */
/* but is wired to enable or disable the flip screen output * /
PORT_DIPNAME( 0x02, 0x00, "Cabinet", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Upright" )
PORT_DIPSETTING( 0x02, "Cocktail" )
/* This odd setting is marked as shown on the schematic, */
/* and again, is not read by the program, but wired into */
/* the watchdog circuit. The book says to leave it off * /
PORT_DIPNAME( 0x04, 0x00, "Unused", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Off" )
PORT_DIPSETTING( 0x04, "On" )
INPUT_PORTS_END
static int cosmicguerillahiload(void)
{
static int firsttime = 0;
unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];
/* check if the hi score table has already been initialized */
/* the high score table is intialized to all 0, so first of all */
/* we dirty it, then we wait for it to be cleared again * /
if (firsttime == 0)
{
fast_memset(&RAM[0x3c10],0xff,4); /* high score * /
firsttime = 1;
}
/* check if the hi score table has already been initialized * /
if (memcmp(&RAM[0x3c10],"\x00\x00\x00\x00",4) == 0 )
{
void *f;
if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
{
osd_fread(f,&RAM[0x3c10],4);
osd_fclose(f);
}
firsttime = 0;
return 1;
}
else return 0; /* we can't load the hi scores yet * /
}
static void cosmicguerillahisave(void)
{
void *f;
unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];
if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,1)) != 0)
{
osd_fwrite(f,&RAM[0x3c10],4);
osd_fclose(f);
}
}
static struct MachineDriver cosmicguerilla_machine_driver =
{
/* basic machine hardware * /
{
{
CPU_TMS9900,
1228500, /* 9.828 Mhz Crystal * /
0,
cosmicguerilla_readmem,cosmicguerilla_writemem,
cosmicguerilla_readport,cosmicguerilla_writeport,
cosmicguerilla_interrupt,16
}
},
60, 0, /* frames per second, vblank duration * /
1, /* single CPU, no need for interleaving * /
0,
/* video hardware * /
32*8, 24*8, { 0*8, 32*8-1, 0*8, 24*8-1 },
0, /* no gfxdecodeinfo - bitmapped display * /
16,8*4,
cosmicguerilla_vh_convert_color_prom,
VIDEO_TYPE_RASTER,
0,
cosmic_vh_start,
cosmic_vh_stop,
cosmic_vh_screenrefresh,
/* sound hardware * /
0,0,0,0/*,
{
/*{
SOUND_SAMPLES,
&samples_interface
},* /
{
SOUND_DAC,
&dac_interface
}
}* /
};
ROM_START( cosmicguerilla_rom )
ROM_REGION(0x10000) /* 8k for code * /
ROM_LOAD( "cosmicg1.bin", 0x0000, 0x0400, 0xe1b9f894 )
ROM_LOAD( "cosmicg2.bin", 0x0400, 0x0400, 0x35c75346 )
ROM_LOAD( "cosmicg3.bin", 0x0800, 0x0400, 0x82a49b48 )
ROM_LOAD( "cosmicg4.bin", 0x0C00, 0x0400, 0x1c1c934c )
ROM_LOAD( "cosmicg5.bin", 0x1000, 0x0400, 0xb1c00fbf )
ROM_LOAD( "cosmicg6.bin", 0x1400, 0x0400, 0xf03454ce )
ROM_LOAD( "cosmicg7.bin", 0x1800, 0x0400, 0xf33ebae7 )
ROM_LOAD( "cosmicg8.bin", 0x1C00, 0x0400, 0x472e4990 )
ROM_REGION(0x0400) /* Colour Prom * /
ROM_LOAD( "cosmicg9.bin", 0x0000, 0x0400, 0x689c2c96 )
ROM_END
struct GameDriver cosmicg_driver =
{
__FILE__,
0,
"cosmicg",
"Cosmic Guerilla",
"1979",
"Universal",
"Andy Jones\nMike Coates",
0,
&cosmicguerilla_machine_driver,
0,
cosmicguerilla_rom,
cosmicguerilla_decode, 0,
0, /*cosmicguerilla_sample_names,* /
0, /* sound_prom * /
cosmicguerilla_input_ports,
PROM_MEMORY_REGION(1), 0, 0,
ORIENTATION_ROTATE_270,
cosmicguerillahiload, cosmicguerillahisave
};
/***************************************************************************
Magical Spot 2 memory map (preliminary)
0000-2fff ROM
6000-63ff RAM
6400-7fff Video RAM
read:
write:
***************************************************************************/
void magspot2_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
void magspot2_colourmap_w(int offset, int data);
static int magspot2_interrupt(void)
{
/* Coin 1 causes an IRQ, Coin 2 an NMI */
if (input_port_4_r(0) & 0x01)
{
return interrupt();
}
if (input_port_4_r(0) & 0x02)
{
return nmi_interrupt();
}
return ignore_interrupt();
}
static int magspot2_coinage_dip_r(int offset)
{
return (input_port_5_r(0) & (1 << (7 - offset))) ? 0 : 1;
}
static struct MemoryReadAddress magspot2_readmem[] =
{
{ 0x0000, 0x2fff, MRA_ROM },
{ 0x3800, 0x3807, magspot2_coinage_dip_r },
{ 0x5000, 0x5000, input_port_0_r },
{ 0x5001, 0x5001, input_port_1_r },
{ 0x5002, 0x5002, input_port_2_r },
{ 0x5003, 0x5003, input_port_3_r },
{ 0x6000, 0x7fff, MRA_RAM },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress magspot2_writemem[] =
{
{ 0x0000, 0x2fff, MWA_ROM },
{ 0x4000, 0x401f, MWA_RAM, &spriteram, &spriteram_size},
{ 0x4800, 0x4800, DAC_data_w },
{ 0x480D, 0x480D, magspot2_colourmap_w },
{ 0x480F, 0x480F, cosmic_flipscreen_w },
{ 0x6000, 0x63ff, MWA_RAM },
{ 0x6400, 0x7bff, cosmic_videoram_w, &cosmic_videoram, &videoram_size},
{ 0x7c00, 0x7fff, MWA_RAM },
{ -1 } /* end of table */
};
INPUT_PORTS_START( magspot2_input_ports )
PORT_START /* IN0 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY )
PORT_BIT( 0x1c, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY )
PORT_DIPNAME( 0xc0, 0x40, "Bonus Game", IP_KEY_NONE )
PORT_DIPSETTING( 0x40, "5000" )
PORT_DIPSETTING( 0x80, "10000" )
PORT_DIPSETTING( 0xc0, "15000" )
PORT_DIPSETTING( 0x00, "None" )
PORT_START /* IN1 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY | IPF_COCKTAIL )
PORT_BIT( 0x1c, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_COCKTAIL )
PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START /* IN2 */
PORT_DIPNAME( 0x03, 0x01, "Bonus_Life", IP_KEY_NONE )
PORT_DIPSETTING( 0x01, "2000" )
PORT_DIPSETTING( 0x02, "3000" )
PORT_DIPSETTING( 0x03, "5000" )
PORT_DIPSETTING( 0x00, "None" )
PORT_DIPNAME( 0x04, 0x00, "Unknown", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Off" )
PORT_DIPSETTING( 0x04, "On" )
PORT_DIPNAME( 0x18, 0x08, "Lives", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "2" )
PORT_DIPSETTING( 0x08, "3" )
PORT_DIPSETTING( 0x10, "4" )
PORT_DIPSETTING( 0x18, "5" )
PORT_DIPNAME( 0x20, 0x00, "Cabinet", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Upright" )
PORT_DIPSETTING( 0x20, "Cocktail" )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
PORT_START /* IN3 */
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_VBLANK )
PORT_BIT( 0x3e, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
/* Fake port to handle coins */
PORT_START /* IN4 */
PORT_BITX(0x01, IP_ACTIVE_HIGH, IPT_COIN1 | IPF_IMPULSE,
"Coin", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 1 )
PORT_BITX(0x02, IP_ACTIVE_HIGH, IPT_COIN2 | IPF_IMPULSE,
"Coin", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 1 )
/* Fake port to handle coinage dip switches. Each bit goes to 3800-3807 */
PORT_START /* IN5 */
PORT_DIPNAME( 0x0f, 0x00, "Coin_A", IP_KEY_NONE )
PORT_DIPSETTING( 0x0c, "4C_1C" )
PORT_DIPSETTING( 0x08, "3C_1C" )
PORT_DIPSETTING( 0x0d, "4 Coins/2 Credits" )
PORT_DIPSETTING( 0x05, "2C_1C" )
PORT_DIPSETTING( 0x09, "3C_2C" )
PORT_DIPSETTING( 0x0e, "4C_3C" )
PORT_DIPSETTING( 0x0f, "4 Coins/4 Credits" )
PORT_DIPSETTING( 0x0a, "3 Coins/3 Credits" )
PORT_DIPSETTING( 0x06, "2 Coins/2 Credits" )
PORT_DIPSETTING( 0x00, "1C_1C" )
PORT_DIPSETTING( 0x0b, "3C_4C" )
PORT_DIPSETTING( 0x07, "2C_3C" )
PORT_DIPSETTING( 0x01, "1C_2C" )
PORT_DIPSETTING( 0x02, "1C_3C" )
PORT_DIPSETTING( 0x03, "1C_4C" )
PORT_DIPSETTING( 0x04, "1C_5C" )
PORT_DIPNAME( 0xf0, 0x00, "Coin_B", IP_KEY_NONE )
PORT_DIPSETTING( 0xc0, "4C_1C" )
PORT_DIPSETTING( 0x80, "3C_1C" )
PORT_DIPSETTING( 0xd0, "4 Coins/2 Credits" )
PORT_DIPSETTING( 0x50, "2C_1C" )
PORT_DIPSETTING( 0x90, "3C_2C" )
PORT_DIPSETTING( 0xe0, "4C_3C" )
PORT_DIPSETTING( 0xf0, "4 Coins/4 Credits" )
PORT_DIPSETTING( 0xa0, "3 Coins/3 Credits" )
PORT_DIPSETTING( 0x60, "2 Coins/2 Credits" )
PORT_DIPSETTING( 0x00, "1C_1C" )
PORT_DIPSETTING( 0xb0, "3C_4C" )
PORT_DIPSETTING( 0x70, "2C_3C" )
PORT_DIPSETTING( 0x10, "1C_2C" )
PORT_DIPSETTING( 0x20, "1C_3C" )
PORT_DIPSETTING( 0x30, "1C_4C" )
PORT_DIPSETTING( 0x40, "1C_5C" )
INPUT_PORTS_END
static struct MachineDriver magspot2_machine_driver =
{
/* basic machine hardware */
{
{
CPU_Z80,
18432000/6, /* 3.072 Mhz ???? */
0,
magspot2_readmem,magspot2_writemem,0,0,
magspot2_interrupt,1
},
},
60, DEFAULT_REAL_60HZ_VBLANK_DURATION, /* frames per second, vblank duration */
1, /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
0,
/* video hardware */
32*8, 24*8, { 0*8, 32*8-1, 0*8, 24*8-1 },
cosmicalien_gfxdecodeinfo,
16, 16*4,
magspot2_vh_convert_color_prom,
VIDEO_TYPE_RASTER|VIDEO_SUPPORTS_DIRTY,
0,
cosmic_vh_start,
cosmic_vh_stop,
cosmic_vh_screenrefresh_sprites,
/* sound hardware */
0,0,0,0,
{
{
SOUND_DAC,
&dac_interface
}
}
};
ROM_START( magspot2_rom )
ROM_REGION(0x10000) /* 64k for code */
ROM_LOAD( "my1", 0x0000, 0x0800, 0xc0085ade )
ROM_LOAD( "my2", 0x0800, 0x0800, 0xd534a68b )
ROM_LOAD( "my3", 0x1000, 0x0800, 0x25513b2a )
ROM_LOAD( "my5", 0x1800, 0x0800, 0x8836bbc4 )
ROM_LOAD( "my4", 0x2000, 0x0800, 0x6a08ab94 )
ROM_LOAD( "my6", 0x2800, 0x0800, 0x77c6d109 )
ROM_REGION_DISPOSE(0x1000) /* temporary space for graphics (disposed after conversion) */
ROM_LOAD( "my7", 0x0000, 0x0800, 0x1ab338d3 )
ROM_LOAD( "my8", 0x0800, 0x0800, 0x9e1d63a2 )
ROM_REGION(0x0420) /* color proms */
ROM_LOAD( "m13", 0x0000, 0x0020, 0x36e2aa2a )
ROM_LOAD( "my9", 0x0020, 0x0400, 0x89f23ebd )
ROM_END
struct GameDriver magspot2_driver =
{
__FILE__,
0,
"magspot2",
"Magical Spot II",
"1980",
"Universal",
"Zsolt Vasvari",
0,
&magspot2_machine_driver,
0,
magspot2_rom,
0, 0,
0,
0, /* sound_prom */
magspot2_input_ports,
PROM_MEMORY_REGION(2), 0, 0,
ORIENTATION_ROTATE_270,
0, 0
};
/***************************************************************************
Devil Zone
***************************************************************************/
void devzone_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
static struct MemoryReadAddress devzone_readmem[] =
{
{ 0x0000, 0x2fff, MRA_ROM },
{ 0x5000, 0x5000, input_port_0_r },
{ 0x5001, 0x5001, input_port_1_r },
{ 0x5002, 0x5002, input_port_2_r },
{ 0x5003, 0x5003, input_port_3_r },
{ 0x6000, 0x6001, MRA_RAM },
{ 0x6002, 0x6002, input_port_5_r },
{ 0x6003, 0x7fff, MRA_RAM },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress devzone_writemem[] =
{
{ 0x0000, 0x2fff, MWA_ROM },
{ 0x4000, 0x401f, MWA_RAM, &spriteram, &spriteram_size},
{ 0x4800, 0x4800, DAC_data_w },
{ 0x480D, 0x480D, magspot2_colourmap_w },
{ 0x480F, 0x480F, cosmic_flipscreen_w },
{ 0x6000, 0x63ff, MWA_RAM },
{ 0x6400, 0x7bff, cosmic_videoram_w, &cosmic_videoram, &videoram_size},
{ 0x7c00, 0x7fff, MWA_RAM },
{ -1 } /* end of table */
};
static struct MachineDriver devzone_machine_driver =
{
/* basic machine hardware */
{
{
CPU_Z80,
18432000/6, /* 3.072 Mhz ???? */
0,
devzone_readmem,devzone_writemem,0,0,
magspot2_interrupt,1
},
},
60, DEFAULT_REAL_60HZ_VBLANK_DURATION, /* frames per second, vblank duration */
1, /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
0,
/* video hardware */
32*8, 24*8, { 0*8, 32*8-1, 0*8, 24*8-1 },
cosmicalien_gfxdecodeinfo,
16, 16*4,
devzone_vh_convert_color_prom,
VIDEO_TYPE_RASTER|VIDEO_SUPPORTS_DIRTY,
0,
cosmic_vh_start,
cosmic_vh_stop,
cosmic_vh_screenrefresh_sprites,
/* sound hardware */
0,0,0,0,
{
{
SOUND_DAC,
&dac_interface
}
}
};
INPUT_PORTS_START( devzone_input_ports )
PORT_START /* IN0 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY )
PORT_BIT( 0x1c, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY )
PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START /* IN1 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY | IPF_COCKTAIL )
PORT_BIT( 0x1c, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_COCKTAIL )
PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START /* IN2 */
PORT_DIPNAME( 0x03, 0x01, "Bonus_Life", IP_KEY_NONE )
PORT_DIPSETTING( 0x01, "4000" )
PORT_DIPSETTING( 0x02, "6000" )
PORT_DIPSETTING( 0x03, "8000" )
PORT_DIPSETTING( 0x00, "None" )
PORT_DIPNAME( 0x0c, 0x0c, "Coinage", IP_KEY_NONE )
PORT_DIPSETTING( 0x0c, "Use Coin A & B" )
PORT_DIPSETTING( 0x04, "2C_1C" )
PORT_DIPSETTING( 0x00, "1C_1C" )
PORT_DIPSETTING( 0x08, "1C_2C" )
PORT_DIPNAME( 0x10, 0x10, "Lives", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "2" )
PORT_DIPSETTING( 0x10, "3" )
PORT_DIPNAME( 0x20, 0x00, "Cabinet", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Upright" )
PORT_DIPSETTING( 0x20, "Cocktail" )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
PORT_START /* IN3 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_VBLANK )
PORT_BIT( 0x3e, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
/* Fake port to handle coins */
PORT_START /* IN4 */
PORT_BITX(0x01, IP_ACTIVE_HIGH, IPT_COIN1 | IPF_IMPULSE,
"Coin", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 1 )
PORT_BITX(0x02, IP_ACTIVE_HIGH, IPT_COIN2 | IPF_IMPULSE,
"Coin", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 1 )
PORT_START /* IN5 */
PORT_DIPNAME( 0x0f, 0x00, "Coin_A", IP_KEY_NONE )
PORT_DIPSETTING( 0x0c, "4C_1C" )
PORT_DIPSETTING( 0x08, "3C_1C" )
PORT_DIPSETTING( 0x0d, "4 Coins/2 Credits" )
PORT_DIPSETTING( 0x05, "2C_1C" )
PORT_DIPSETTING( 0x09, "3C_2C" )
PORT_DIPSETTING( 0x0e, "4C_3C" )
PORT_DIPSETTING( 0x0f, "4 Coins/4 Credits" )
PORT_DIPSETTING( 0x0a, "3 Coins/3 Credits" )
PORT_DIPSETTING( 0x06, "2 Coins/2 Credits" )
PORT_DIPSETTING( 0x00, "1C_1C" )
PORT_DIPSETTING( 0x0b, "3C_4C" )
PORT_DIPSETTING( 0x07, "2C_3C" )
PORT_DIPSETTING( 0x01, "1C_2C" )
PORT_DIPSETTING( 0x02, "1C_3C" )
PORT_DIPSETTING( 0x03, "1C_4C" )
PORT_DIPSETTING( 0x04, "1C_5C" )
PORT_DIPNAME( 0xf0, 0x10, "Coin_B", IP_KEY_NONE )
PORT_DIPSETTING( 0xc0, "4C_1C" )
PORT_DIPSETTING( 0x80, "3C_1C" )
PORT_DIPSETTING( 0xd0, "4 Coins/2 Credits" )
PORT_DIPSETTING( 0x50, "2C_1C" )
PORT_DIPSETTING( 0x90, "3C_2C" )
PORT_DIPSETTING( 0xe0, "4C_3C" )
PORT_DIPSETTING( 0xf0, "4 Coins/4 Credits" )
PORT_DIPSETTING( 0xa0, "3 Coins/3 Credits" )
PORT_DIPSETTING( 0x60, "2 Coins/2 Credits" )
PORT_DIPSETTING( 0x00, "1C_1C" )
PORT_DIPSETTING( 0xb0, "3C_4C" )
PORT_DIPSETTING( 0x70, "2C_3C" )
PORT_DIPSETTING( 0x10, "1C_2C" )
PORT_DIPSETTING( 0x20, "1C_3C" )
PORT_DIPSETTING( 0x30, "1C_4C" )
PORT_DIPSETTING( 0x40, "1C_5C" )
INPUT_PORTS_END
ROM_START( devzone_rom )
ROM_REGION(0x10000) /* 64k for code */
ROM_LOAD( "dv1.e3", 0x0000, 0x0800, 0xc70faf00 )
ROM_LOAD( "dv2.e4", 0x0800, 0x0800, 0xeacfed61 )
ROM_LOAD( "dv3.e5", 0x1000, 0x0800, 0x7973317e )
ROM_LOAD( "dv5.e7", 0x1800, 0x0800, 0xb71a3989 )
ROM_LOAD( "dv4.e6", 0x2000, 0x0800, 0xa58c5b8c )
ROM_LOAD( "dv6.e8", 0x2800, 0x0800, 0x3930fb67 )
ROM_REGION_DISPOSE(0x1000) /* temporary space for graphics (disposed after conversion) */
ROM_LOAD( "dv7.n1", 0x0000, 0x0800, 0xe7562fcf )
ROM_LOAD( "dv8.n2", 0x0800, 0x0800, 0xda1cbec1 )
ROM_REGION(0x0400) /* color proms */
ROM_LOAD( "dz9.e2", 0x0000, 0x0400, 0x693855b6 )
ROM_END
struct GameDriver devzone_driver =
{
__FILE__,
0,
"devzone",
"Devil Zone",
"1980",
"Universal",
"Zsolt Vasvari\nMike Coates",
GAME_WRONG_COLORS,
&devzone_machine_driver,
0,
devzone_rom,
0, 0,
0,
0, /* sound_prom */
devzone_input_ports,
PROM_MEMORY_REGION(2), 0, 0,
ORIENTATION_ROTATE_270,
0, 0
};
/***************************************************************************
No Mans Land
***************************************************************************/
void nomanland_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
void nomanland_background_w(int offset, int data);
static struct GfxLayout nomanland_treelayout =
{
32,32, /* 16*16 sprites */
4, /* 8 sprites */
2, /* 2 bits per pixel */
{ 0, 8*128*8 }, /* the two bitplanes are separated */
{ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 },
{ 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32, 8*32, 9*32, 10*32, 11*32, 12*32, 13*32, 14*32, 15*32,
16*32, 17*32, 18*32, 19*32, 20*32, 21*32, 22*32, 23*32, 24*32, 25*32, 26*32, 27*32, 28*32, 29*32, 30*32, 31*32 },
128*8 /* every sprite takes 128 consecutive bytes */
};
static struct GfxLayout nomanland_waterlayout =
{
16,32, /* 16*32 sprites */
32, /* 16 sprites */
2, /* 2 bits per pixel */
{ 0, 8*128*8 }, /* the two bitplanes are separated */
{ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 },
{ 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32, 8*32, 9*32, 10*32, 11*32, 12*32, 13*32, 14*32, 15*32,
16*32, 17*32, 18*32, 19*32, 20*32, 21*32, 22*32, 23*32, 24*32, 25*32, 26*32, 27*32, 28*32, 29*32, 30*32, 31*32 },
32 /* To create a set of sprites 1 pixel displaced */
};
static struct GfxDecodeInfo nomanland_gfxdecodeinfo[] =
{
{ 1, 0x0000, &cosmicalien_spritelayout16, 0, 8 },
{ 1, 0x1000, &nomanland_treelayout, 0, 9 },
{ 1, 0x1200, &nomanland_waterlayout, 0, 10 },
{ -1 } /* end of array */
};
int nomanland_interrupt(void)
{
if (readinputport(4) & 1) /* Left Coin */
return nmi_interrupt();
else
return ignore_interrupt();
}
/* Has 8 way joystick, remap combinations to missing directions */
int nomanland_port_r(int offset)
{
int control;
int fire = input_port_3_r(0);
if (offset)
control = input_port_1_r(0);
else
control = input_port_0_r(0);
/* If firing - stop tank */
if ((fire & 0xc0) == 0) return 0xff;
/* set bit according to 8 way direction */
if ((control & 0x82) == 0 ) return 0xfe; /* Up & Left */
if ((control & 0x0a) == 0 ) return 0xfb; /* Down & Left */
if ((control & 0x28) == 0 ) return 0xef; /* Down & Right */
if ((control & 0xa0) == 0 ) return 0xbf; /* Up & Right */
return control;
}
static struct MemoryReadAddress nomanland_readmem[] =
{
{ 0x0000, 0x2fff, MRA_ROM },
{ 0x3800, 0x3807, magspot2_coinage_dip_r },
{ 0x5000, 0x5001, nomanland_port_r },
{ 0x5002, 0x5002, input_port_2_r },
{ 0x5003, 0x5003, input_port_3_r },
{ 0x6000, 0x7fff, MRA_RAM },
{ -1 } /* end of table */
};
static struct MemoryReadAddress nomanland2_readmem[] =
{
{ 0x0000, 0x2fff, MRA_ROM },
// { 0x3800, 0x3807, magspot2_coinage_dip_r },
{ 0x5000, 0x5001, nomanland_port_r },
{ 0x5002, 0x5002, input_port_2_r },
{ 0x5003, 0x5003, input_port_3_r },
{ 0x6000, 0x7fff, MRA_RAM },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress nomanland_writemem[] =
{
{ 0x0000, 0x2fff, MWA_ROM },
{ 0x4000, 0x401f, MWA_RAM, &spriteram, &spriteram_size},
{ 0x4807, 0x4807, nomanland_background_w },
{ 0x480A, 0x480A, DAC_data_w },
{ 0x480D, 0x480D, magspot2_colourmap_w },
{ 0x480F, 0x480F, cosmic_flipscreen_w },
{ 0x6000, 0x63ff, MWA_RAM },
{ 0x6400, 0x7bff, cosmic_videoram_w, &cosmic_videoram, &videoram_size},
{ 0x7c00, 0x7fff, MWA_RAM },
{ -1 } /* end of table */
};
ROM_START( nomanland_rom )
ROM_REGION(0x10000) /* 64k for code */
ROM_LOAD( "1.bin", 0x0000, 0x0800, 0xba117ba6 )
ROM_LOAD( "2.bin", 0x0800, 0x0800, 0xe5ed654f )
ROM_LOAD( "3.bin", 0x1000, 0x0800, 0x7fc42724 )
ROM_LOAD( "5.bin", 0x1800, 0x0800, 0x9cc2f1d9 )
ROM_LOAD( "4.bin", 0x2000, 0x0800, 0x0e8cd46a )
ROM_LOAD( "6.bin", 0x2800, 0x0800, 0xba472ba5 )
ROM_REGION_DISPOSE(0x1800) /* temporary space for graphics (disposed after conversion) */
ROM_LOAD( "nml7.n1", 0x0800, 0x0800, 0xd08ed22f )
ROM_LOAD( "nml8.n2", 0x0000, 0x0800, 0x739009b4 )
ROM_LOAD( "nl11.ic7", 0x1000, 0x0400, 0xe717b241 )
ROM_LOAD( "nl10.ic4", 0x1400, 0x0400, 0x5b13f64e )
ROM_REGION(0x0420) /* color proms */
ROM_LOAD( "nml.clr", 0x0000, 0x0020, 0x65e911f9 )
ROM_LOAD( "nl9.e2", 0x0020, 0x0400, 0x9e05f14e )
ROM_END
ROM_START( nomanlandg_rom )
ROM_REGION(0x10000) /* 64k for code */
ROM_LOAD( "nml1.e3", 0x0000, 0x0800, 0xe212ed91 )
ROM_LOAD( "nml2.e4", 0x0800, 0x0800, 0xf66ef3d8 )
ROM_LOAD( "nml3.e5", 0x1000, 0x0800, 0xd422fc8a )
ROM_LOAD( "nml5.e7", 0x1800, 0x0800, 0xd58952ac )
ROM_LOAD( "nml4.e6", 0x2000, 0x0800, 0x994c9afb )
ROM_LOAD( "nml6.e8", 0x2800, 0x0800, 0x01ed2d8c )
ROM_REGION_DISPOSE(0x1800) /* temporary space for graphics (disposed after conversion) */
ROM_LOAD( "nml7.n1", 0x0800, 0x0800, 0xd08ed22f )
ROM_LOAD( "nml8.n2", 0x0000, 0x0800, 0x739009b4 )
ROM_LOAD( "nl11.ic7", 0x1000, 0x0400, 0xe717b241 )
ROM_LOAD( "nl10.ic4", 0x1400, 0x0400, 0x5b13f64e )
ROM_REGION(0x0420) /* color proms */
ROM_LOAD( "nml.clr", 0x0000, 0x0020, 0x65e911f9 )
ROM_LOAD( "nl9.e2", 0x0020, 0x0400, 0x9e05f14e )
ROM_END
static struct MachineDriver nomanland_machine_driver =
{
/* basic machine hardware */
{
{
CPU_Z80,
18432000/6, /* 3.072 Mhz ???? */
0,
nomanland_readmem,nomanland_writemem,0,0,
nomanland_interrupt,1
},
},
60, DEFAULT_REAL_60HZ_VBLANK_DURATION, /* frames per second, vblank duration */
1, /* 1 CPU slice per frame */
0,
/* video hardware */
32*8, 24*8, { 0*8, 32*8-1, 0*8, 24*8-1 },
nomanland_gfxdecodeinfo,
16, 16*4,
nomanland_vh_convert_color_prom,
VIDEO_TYPE_RASTER|VIDEO_SUPPORTS_DIRTY,
0,
cosmic_vh_start,
cosmic_vh_stop,
cosmic_vh_screenrefresh_sprites,
/* sound hardware */
0,0,0,0,
{
{
SOUND_DAC,
&dac_interface
}
}
};
static struct MachineDriver nomanland2_machine_driver =
{
/* basic machine hardware */
{
{
CPU_Z80,
18432000/6, /* 3.072 Mhz ???? */
0,
nomanland2_readmem,nomanland_writemem,0,0,
nomanland_interrupt,1
},
},
60, DEFAULT_REAL_60HZ_VBLANK_DURATION, /* frames per second, vblank duration */
1, /* 1 CPU slice per frame */
0,
/* video hardware */
32*8, 24*8, { 0*8, 32*8-1, 0*8, 24*8-1 },
nomanland_gfxdecodeinfo,
16, 16*4,
nomanland_vh_convert_color_prom,
VIDEO_TYPE_RASTER/VIDEO_SUPPORTS_DIRTY,
0,
cosmic_vh_start,
cosmic_vh_stop,
cosmic_vh_screenrefresh_sprites,
/* sound hardware */
0,0,0,0,
{
{
SOUND_DAC,
&dac_interface
}
}
};
INPUT_PORTS_START( nomanland_input_ports )
PORT_START /* Controls - Remapped for game */
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
PORT_BIT( 0x55, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START /* IN1 */
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
PORT_BIT( 0x55, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START /* IN2 */
PORT_DIPNAME( 0x03, 0x02, "Bonus_Life", IP_KEY_NONE )
PORT_DIPSETTING( 0x01, "2000" )
PORT_DIPSETTING( 0x02, "3000" )
PORT_DIPSETTING( 0x03, "5000" )
PORT_DIPSETTING( 0x00, "None" )
PORT_DIPNAME( 0x0c, 0x00, "Coinage", IP_KEY_NONE )
PORT_DIPSETTING( 0x04, "2C_1C" )
PORT_DIPSETTING( 0x00, "1C_1C" )
PORT_DIPSETTING( 0x0c, "2 Coins/2 Credits" )
PORT_DIPSETTING( 0x08, "1C_2C" )
PORT_DIPNAME( 0x10, 0x00, "Lives", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "3" )
PORT_DIPSETTING( 0x10, "5" )
PORT_DIPNAME( 0x20, 0x00, "Cabinet", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Upright" )
PORT_DIPSETTING( 0x20, "Cocktail" )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
PORT_START /* IN3 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_VBLANK )
PORT_BIT( 0x3e, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
/* Fake port to handle coins */
PORT_START /* IN4 */
PORT_BITX(0x01, IP_ACTIVE_HIGH, IPT_COIN1 | IPF_IMPULSE,
"Coin", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 1 )
#if 0
Although the port is read, the game does not appear to use these
PORT_START /* IN5 */
PORT_DIPNAME( 0xf0, 0x00, "Coinage", IP_KEY_NONE )
PORT_DIPSETTING( 0xc0, "4C_1C" )
PORT_DIPSETTING( 0x80, "3C_1C" )
PORT_DIPSETTING( 0xd0, "4 Coins/2 Credits" )
PORT_DIPSETTING( 0x50, "2C_1C" )
PORT_DIPSETTING( 0x90, "3C_2C" )
PORT_DIPSETTING( 0xe0, "4C_3C" )
PORT_DIPSETTING( 0xf0, "4 Coins/4 Credits" )
PORT_DIPSETTING( 0xa0, "3 Coins/3 Credits" )
PORT_DIPSETTING( 0x60, "2 Coins/2 Credits" )
PORT_DIPSETTING( 0x00, "1C_1C" )
PORT_DIPSETTING( 0xb0, "3C_4C" )
PORT_DIPSETTING( 0x70, "2C_3C" )
PORT_DIPSETTING( 0x10, "1C_2C" )
PORT_DIPSETTING( 0x20, "1C_3C" )
PORT_DIPSETTING( 0x30, "1C_4C" )
PORT_DIPSETTING( 0x40, "1C_5C" )
#endif
INPUT_PORTS_END
INPUT_PORTS_START( nomanland2_input_ports )
PORT_START /* Controls - Remapped for game */
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
PORT_BIT( 0x55, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START /* IN1 */
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
PORT_BIT( 0x55, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START /* IN2 */
PORT_DIPNAME( 0x03, 0x02, "Bonus_Life", IP_KEY_NONE )
PORT_DIPSETTING( 0x01, "3000" )
PORT_DIPSETTING( 0x02, "5000" )
PORT_DIPSETTING( 0x03, "8000" )
PORT_DIPSETTING( 0x00, "None" )
PORT_DIPNAME( 0x0c, 0x00, "Coinage", IP_KEY_NONE )
PORT_DIPSETTING( 0x04, "2C_1C" )
PORT_DIPSETTING( 0x00, "1C_1C" )
// PORT_DIPSETTING( 0x0c, "2 Coins/2 Credits" ) Seems to do 1/1 ?
PORT_DIPSETTING( 0x08, "1C_2C" )
PORT_DIPNAME( 0x10, 0x00, "Lives", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "2" )
PORT_DIPSETTING( 0x10, "3" )
PORT_DIPNAME( 0x20, 0x00, "Cabinet", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Upright" )
PORT_DIPSETTING( 0x20, "Cocktail" )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
PORT_START /* IN3 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_VBLANK )
PORT_BIT( 0x3e, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
/* Fake port to handle coins */
PORT_START /* IN4 */
PORT_BITX(0x01, IP_ACTIVE_HIGH, IPT_COIN1 | IPF_IMPULSE,
"Coin", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 1 )
INPUT_PORTS_END
struct GameDriver nomnlnd_driver =
{
__FILE__,
0,
"nomnlnd",
"No Man's Land",
"1980?",
"Universal",
"Mike Coates",
GAME_WRONG_COLORS,
&nomanland_machine_driver,
0,
nomanland_rom,
0, 0,
0,
0, /* sound_prom */
nomanland_input_ports,
PROM_MEMORY_REGION(2), 0, 0,
ORIENTATION_ROTATE_270,
0, 0
};
struct GameDriver nomnlndg_driver =
{
__FILE__,
&nomnlnd_driver,
"nomnlndg",
"No Man's Land (Gottlieb)",
"1980?",
"Universal (Gottlieb license)",
"Mike Coates",
GAME_WRONG_COLORS,
&nomanland2_machine_driver,
0,
nomanlandg_rom,
0, 0,
0,
0, /* sound_prom */
nomanland2_input_ports,
PROM_MEMORY_REGION(2), 0, 0,
ORIENTATION_ROTATE_270,
0, 0
};
| 29.352459
| 172
| 0.638823
|
pierrelouys
|
7d80836b17d9e97d4b9005008b5b88c3e3a74a6a
| 572
|
hpp
|
C++
|
include/basic_csv_file_def.hpp
|
MarkusJx/csv
|
35a945c789215ad6e817bd52de7d08c9842920b9
|
[
"MIT"
] | null | null | null |
include/basic_csv_file_def.hpp
|
MarkusJx/csv
|
35a945c789215ad6e817bd52de7d08c9842920b9
|
[
"MIT"
] | null | null | null |
include/basic_csv_file_def.hpp
|
MarkusJx/csv
|
35a945c789215ad6e817bd52de7d08c9842920b9
|
[
"MIT"
] | null | null | null |
#ifndef MARKUSJX_CSV_BASIC_CSV_FILE_DEF_HPP
#define MARKUSJX_CSV_BASIC_CSV_FILE_DEF_HPP
#include "escape_sequence_generator.hpp"
namespace markusjx {
/**
* A csv file
*
* @tparam T the char type of the file
* @tparam Sep the separator to use
* @tparam _escape_generator_ the escape sequence generator to use
*/
template<class T, char Sep = ';', class _escape_generator_ = util::escape_sequence_generator<util::std_basic_string<T>, Sep>>
class basic_csv_file;
} //namespace markusjx
#endif //MARKUSJX_CSV_BASIC_CSV_FILE_DEF_HPP
| 30.105263
| 129
| 0.73951
|
MarkusJx
|
7d809872f30787c25f2ac2006a245718cad63d7a
| 768
|
hpp
|
C++
|
include/dudp/server.hpp
|
swrh/dudp
|
b0159edd90f8cda10c150a7c2b9cf71d5443c7b6
|
[
"BSD-3-Clause"
] | null | null | null |
include/dudp/server.hpp
|
swrh/dudp
|
b0159edd90f8cda10c150a7c2b9cf71d5443c7b6
|
[
"BSD-3-Clause"
] | null | null | null |
include/dudp/server.hpp
|
swrh/dudp
|
b0159edd90f8cda10c150a7c2b9cf71d5443c7b6
|
[
"BSD-3-Clause"
] | null | null | null |
#if !defined(_DUDP_SERVER_HPP_)
#define _DUDP_SERVER_HPP_
#include <array>
#include <memory>
#include <string>
#include <boost/asio/io_service.hpp>
#include <boost/asio/ip/udp.hpp>
namespace dudp {
class
server
{
private:
boost::asio::ip::udp::socket socket_;
boost::asio::ip::udp::endpoint remote_endpoint_;
std::array<char, 1024> recv_buffer_;
public:
server(boost::asio::io_service &service, uint16_t port);
protected:
void start_receive();
void handle_receive(const boost::system::error_code &error, std::size_t bytes_transferred);
void handle_send(std::shared_ptr<std::string> message, const boost::system::error_code &error, std::size_t bytes_transferred);
};
}
#endif // !defined(_DUDP_SERVER_HPP_)
// vim:set sw=4 ts=4 et:
| 21.942857
| 130
| 0.727865
|
swrh
|
7d80cb5e3304cc76c8bc88c252e07bea5429a27f
| 6,175
|
cpp
|
C++
|
kernel/runtime/dmzRuntimeResourcesObserver.cpp
|
shillcock/dmz
|
02174b45089e12cd7f0840d5259a00403cd1ccff
|
[
"MIT"
] | 2
|
2015-11-05T03:03:40.000Z
|
2016-02-03T21:50:40.000Z
|
kernel/runtime/dmzRuntimeResourcesObserver.cpp
|
dmzgroup/dmz
|
fc2d9ddcb04ed71f4106b8d33539529807b3dea6
|
[
"MIT"
] | null | null | null |
kernel/runtime/dmzRuntimeResourcesObserver.cpp
|
dmzgroup/dmz
|
fc2d9ddcb04ed71f4106b8d33539529807b3dea6
|
[
"MIT"
] | null | null | null |
#include "dmzRuntimeContext.h"
#include "dmzRuntimeContextResources.h"
#include <dmzRuntimeHandle.h>
#include <dmzRuntimeLog.h>
#include <dmzRuntimePluginInfo.h>
#include <dmzRuntimeResourcesObserver.h>
/*!
\file dmzRuntimeResourcesObserver.h
\ingroup Runtime
\brief Contains ResourcesObserver class.
\enum dmz::ResourcesActivateModeEnum
\ingroup Runtime
\brief Resources callback activate mode.
\enum dmz::ResourcesUpdateTypeEnum
\ingroup Runtime
\brief Resources update callback type.
\class dmz::ResourcesObserver
\ingroup Runtime
\brief Observes changes in runtime Resources.
*/
struct dmz::ResourcesObserver::State {
RuntimeHandle *handlePtr;
const Handle ObsHandle;
Log log;
RuntimeContextResources *rc;
UInt32 mask;
UInt32 warnMask;
State (const Handle TheObsHandle, const String &ObsName, RuntimeContext *context) :
handlePtr (
TheObsHandle == 0 ?
new RuntimeHandle (ObsName + ".ResourcesObserver", context) :
0),
ObsHandle (handlePtr ? handlePtr->get_runtime_handle () : TheObsHandle),
log (ObsName + "ResourcesObserver", context),
rc (context ? context->get_resources_context () : 0),
mask (0),
warnMask (0) {
if (rc) { rc->ref (); }
}
~State () {
if (rc) { rc->unref (); rc = 0; }
if (handlePtr) { delete handlePtr; handlePtr = 0; }
}
};
/*!
\brief Constructor.
\param[in] context Pointer to the RuntimeContext.
*/
dmz::ResourcesObserver::ResourcesObserver (RuntimeContext *context) :
__state (*(new State (0, "<Anonymous Resources Observer>", context))) {;}
/*!
\brief Constructor.
\param[in] Info Reference to the PluginInfo.
*/
dmz::ResourcesObserver::ResourcesObserver (const PluginInfo &Info) :
__state (*(new State (Info.get_handle (), Info.get_name (), Info.get_context ()))) {
}
//! Destructor.
dmz::ResourcesObserver::~ResourcesObserver () {
set_resources_observer_callback_mask (ResourcesDumpNone, 0);
delete &__state;
}
//! Returns a mask of active callbacks.
dmz::UInt32
dmz::ResourcesObserver::get_resources_observer_callback_mask () const {
return __state.mask;
}
/*!
\brief Activates dmz::ResourcesObserver::update_resource() callback.
\param[in] Mode Specifies if all currently defined resources should be dumped to observer
upon activation.
\param[in] TheMask A mask specifying which callbacks to activate.
\return Returns a mask of all callbacks that were activated.
*/
dmz::UInt32
dmz::ResourcesObserver::set_resources_observer_callback_mask (
const ResourcesActivateModeEnum Mode,
const UInt32 TheMask) {
if (__state.rc) {
const Boolean Dump = (Mode == ResourcesDumpAll);
const Handle ObsHandle = __state.ObsHandle;
if (ResourcesPathMask & TheMask) {
if ((ResourcesPathMask & __state.mask) == 0) {
if (__state.rc->pathObsTable.store (ObsHandle, this)) {
__state.mask |= ResourcesPathMask;
if (Dump) {
HashTableStringIterator it;
StringContainer *ptr (0);
while (__state.rc->pathTable.get_next (it, ptr)) {
update_resources_path (it.get_hash_key (), ResourcesCreated);
}
}
}
}
}
else if (ResourcesPathMask & __state.mask) {
__state.mask &= ~ResourcesPathMask;
__state.rc->pathObsTable.remove (ObsHandle);
}
if (ResourcesResourceMask & TheMask) {
if ((ResourcesResourceMask & __state.mask) == 0) {
if (__state.rc->rcObsTable.store (ObsHandle, this)) {
__state.mask |= ResourcesResourceMask;
if (Dump) {
HashTableStringIterator it;
Config *ptr (0);
while (__state.rc->rcTable.get_next (it, ptr)) {
update_resource (it.get_hash_key (), ResourcesCreated);
}
}
}
}
}
else if (ResourcesResourceMask & __state.mask) {
__state.mask &= ~ResourcesResourceMask;
__state.rc->rcObsTable.remove (ObsHandle);
}
}
return __state.mask;
}
/*!
\brief Dumps the current Resources to the observer.
\details The dmz::ResourcesObserver::update_resource() Mode parameter will be set to dmz::ResourcesDumped.
*/
void
dmz::ResourcesObserver::dump_current_resources () {
if (__state.rc) {
if (__state.mask & ResourcesPathMask) {
HashTableStringIterator it;
StringContainer *ptr (0);
while (__state.rc->pathTable.get_next (it, ptr)) {
update_resources_path (it.get_hash_key (), ResourcesDumped);
}
}
if (__state.mask & ResourcesResourceMask) {
HashTableStringIterator it;
Config *ptr (0);
while (__state.rc->rcTable.get_next (it, ptr)) {
update_resource (it.get_hash_key (), ResourcesDumped);
}
}
}
}
/*!
\brief Function invoked when runtime Resources paths are create, updated, or removed.
\param[in] Name String containing name of path being updated.
\param[in] Type Type of update.
*/
void
dmz::ResourcesObserver::update_resources_path (
const String &Name,
const ResourcesUpdateTypeEnum Type) {
if ((ResourcesPathMask & __state.warnMask) == 0) {
__state.warnMask |= ResourcesPathMask;
__state.log.warn << "Base dmz::ResourcesObserver::update_resources_path called."
<< " Function should have been overridden?" << endl;
}
}
/*!
\brief Function invoked when runtime Resources are create, updated, or removed.
\param[in] Name String containing name of resource being updated.
\param[in] Type Type of update.
*/
void
dmz::ResourcesObserver::update_resource (
const String &Name,
const ResourcesUpdateTypeEnum Type) {
if ((ResourcesResourceMask & __state.warnMask) == 0) {
__state.warnMask |= ResourcesResourceMask;
__state.log.warn << "Base dmz::ResourcesObserver::update_resource called."
<< " Function should have been overridden?" << endl;
}
}
| 24.311024
| 106
| 0.645506
|
shillcock
|
7d82aaa7a32c67507092871e5b5d6de80bfcbe8b
| 87
|
cpp
|
C++
|
src/cpp_code/unity_build.cpp
|
michalsta/mocos_helper
|
e33f29246c70ce1dbd477eeed2374ba902e46cfe
|
[
"MIT"
] | null | null | null |
src/cpp_code/unity_build.cpp
|
michalsta/mocos_helper
|
e33f29246c70ce1dbd477eeed2374ba902e46cfe
|
[
"MIT"
] | null | null | null |
src/cpp_code/unity_build.cpp
|
michalsta/mocos_helper
|
e33f29246c70ce1dbd477eeed2374ba902e46cfe
|
[
"MIT"
] | null | null | null |
#include "mocosMath.cpp"
#include "weighted_sampling.cpp"
#include "age_dep_sampler.h"
| 21.75
| 32
| 0.793103
|
michalsta
|
7d8495bf05507e3aa970d8f074866587ad2ed7d6
| 3,929
|
cpp
|
C++
|
simple_demo/plain_executables/DataSource.cpp
|
cd606/tm_examples
|
5ea8e9774f5070fbcc073c71c39bcb7febef88a7
|
[
"Apache-2.0"
] | 1
|
2020-05-22T08:47:00.000Z
|
2020-05-22T08:47:00.000Z
|
simple_demo/plain_executables/DataSource.cpp
|
cd606/tm_examples
|
5ea8e9774f5070fbcc073c71c39bcb7febef88a7
|
[
"Apache-2.0"
] | null | null | null |
simple_demo/plain_executables/DataSource.cpp
|
cd606/tm_examples
|
5ea8e9774f5070fbcc073c71c39bcb7febef88a7
|
[
"Apache-2.0"
] | null | null | null |
#include <tm_kit/infra/Environments.hpp>
#include <tm_kit/infra/TerminationController.hpp>
#include <tm_kit/infra/RealTimeApp.hpp>
#include <tm_kit/basic/ByteData.hpp>
#include <tm_kit/basic/VoidStruct.hpp>
#include <tm_kit/basic/TrivialBoostLoggingComponent.hpp>
#include <tm_kit/basic/real_time_clock/ClockComponent.hpp>
#include <tm_kit/basic/real_time_clock/ClockImporter.hpp>
#include <tm_kit/transport/BoostUUIDComponent.hpp>
#include <tm_kit/transport/zeromq/ZeroMQComponent.hpp>
#include <tm_kit/transport/zeromq/ZeroMQImporterExporter.hpp>
#include <tm_kit/transport/rabbitmq/RabbitMQComponent.hpp>
#include <tm_kit/transport/rabbitmq/RabbitMQImporterExporter.hpp>
#include <tm_kit/transport/HeartbeatAndAlertComponent.hpp>
#include <tm_kit/transport/MultiTransportBroadcastPublisherManagingUtils.hpp>
#include "simple_demo/data_structures/InputDataStructure.hpp"
#include "simple_demo/external_logic/DataSource.hpp"
#include <iostream>
#include <sstream>
using namespace dev::cd606::tm;
using namespace simple_demo;
using TheEnvironment = infra::Environment<
infra::CheckTimeComponent<false>,
infra::TrivialExitControlComponent,
basic::TrivialBoostLoggingComponent,
basic::real_time_clock::ClockComponent,
transport::BoostUUIDComponent,
transport::zeromq::ZeroMQComponent,
transport::rabbitmq::RabbitMQComponent,
transport::web_socket::WebSocketComponent,
transport::json_rest::JsonRESTComponent,
transport::HeartbeatAndAlertComponent
>;
using M = infra::RealTimeApp<TheEnvironment>;
class DataSourceImporter final : public M::AbstractImporter<InputDataPOCO>, public DataSourceListener {
private:
TheEnvironment *env_;
DataSource source_;
public:
DataSourceImporter() : env_(nullptr), source_() {}
~DataSourceImporter() {}
virtual void start(TheEnvironment *env) override final {
env_ = env;
source_.start(this);
env->sendAlert("simple_demo.data_source.info", infra::LogLevel::Info, "Data source started");
}
virtual void onData(DataFromSource const &data) override final {
publish(M::pureInnerData<InputDataPOCO>(env_, InputDataPOCO {data.value}, false));
}
};
int main(int argc, char **argv) {
TheEnvironment env;
env.transport::json_rest::JsonRESTComponent::setDocRoot(56788, "../simple_demo/plain_executables/datasource_web");
transport::initializeHeartbeatAndAlertComponent
(&env, "simple_demo DataSource", "rabbitmq://127.0.0.1::guest:guest:amq.topic[durable=true]");
env.setStatus("program", transport::HeartbeatMessage::Status::Good);
using R = infra::AppRunner<M>;
R r(&env);
auto addTopic = basic::SerializationActions<M>::template addConstTopic<InputDataPOCO>("input.data");
auto publisherSink = transport::MultiTransportBroadcastPublisherManagingUtils<R>
::oneBroadcastPublisherWithProtocol<basic::proto_interop::Proto, InputDataPOCO>(
r
, "input data publisher"
, "zeromq://localhost:12345"
);
auto publisherSink2 = transport::MultiTransportBroadcastPublisherManagingUtils<R>
::oneBroadcastPublisherWithProtocol<std::void_t, InputDataPOCO>(
r
, "input data publisher 2"
, "websocket://localhost:56789:::/data[ignoreTopic=true]"
);
auto source = M::importer(new DataSourceImporter());
auto toPub = r.execute("addTopic", addTopic
, r.importItem("source", source));
r.connect(
toPub.clone()
, publisherSink
);
r.connect(
toPub.clone()
, publisherSink2
);
transport::attachHeartbeatAndAlertComponent(r, &env, "simple_demo.plain_executables.data_source.heartbeat", std::chrono::seconds(10));
r.finalize();
infra::terminationController(infra::TerminateAtTimePoint {
infra::withtime_utils::parseLocalTodayActualTime(23, 59, 59)
});
return 0;
}
| 36.719626
| 138
| 0.73072
|
cd606
|
7d8ab812e8f22cb480326a57aeafb12e5ecd35e2
| 105
|
cpp
|
C++
|
Source/FSD/Private/RetirementReward.cpp
|
trumank/DRG-Mods
|
2febc879f2ffe83498ac913c114d0e933427e93e
|
[
"MIT"
] | 8
|
2021-07-10T20:06:05.000Z
|
2022-03-04T19:03:50.000Z
|
Source/FSD/Private/RetirementReward.cpp
|
trumank/DRG-Mods
|
2febc879f2ffe83498ac913c114d0e933427e93e
|
[
"MIT"
] | 9
|
2022-01-13T20:49:44.000Z
|
2022-03-27T22:56:48.000Z
|
Source/FSD/Private/RetirementReward.cpp
|
trumank/DRG-Mods
|
2febc879f2ffe83498ac913c114d0e933427e93e
|
[
"MIT"
] | 2
|
2021-07-10T20:05:42.000Z
|
2022-03-14T17:05:35.000Z
|
#include "RetirementReward.h"
URetirementReward::URetirementReward() {
this->characterID = NULL;
}
| 15
| 40
| 0.733333
|
trumank
|
7d8ae4ee372c289ebda3efd3bb80874368db22a6
| 1,427
|
cpp
|
C++
|
src/XSRenderer/XSScreenshot.cpp
|
Razish/AIE-pathfinding
|
366e19c7d20c626969e95e4ba9614127ed69e865
|
[
"MIT"
] | 1
|
2015-09-11T06:38:19.000Z
|
2015-09-11T06:38:19.000Z
|
src/XSRenderer/XSScreenshot.cpp
|
Razish/AIE-pathfinding
|
366e19c7d20c626969e95e4ba9614127ed69e865
|
[
"MIT"
] | null | null | null |
src/XSRenderer/XSScreenshot.cpp
|
Razish/AIE-pathfinding
|
366e19c7d20c626969e95e4ba9614127ed69e865
|
[
"MIT"
] | null | null | null |
#include "XSCommon/XSCommon.h"
#include "XSCommon/XSCvar.h"
#include "XSCommon/XSCommand.h"
#include "XSRenderer/XSRenderer.h"
#include "XSRenderer/XSBackend.h"
#include "XSRenderer/XSImagePNG.h"
#include "XSRenderer/XSRenderCommand.h"
namespace XS {
namespace Renderer {
namespace Backend {
static const size_t numScreenshotsPerFrame = 4u;
static const char *GetScreenshotName( void ) {
static char timestamp[numScreenshotsPerFrame][XS_MAX_FILENAME];
time_t rawtime;
time( &rawtime );
static uint32_t index = 0u;
char *p = timestamp[index];
strftime( p, sizeof(timestamp[index]), "%Y-%m-%d_%H-%M-%S.png", localtime( &rawtime ) );
index++;
index &= numScreenshotsPerFrame;
return p;
}
void Cmd_Screenshot( const commandContext_t * const context ) {
const int32_t w = vid_width->GetInt(), h = vid_height->GetInt();
glBindBuffer( GL_PIXEL_PACK_BUFFER, defaultPbo );
glReadPixels( 0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, NULL );
GLsync sync = glFenceSync( GL_SYNC_GPU_COMMANDS_COMPLETE, 0 );
RenderCommand cmd( RenderCommand::Type::SCREENSHOT );
cmd.screenshot.name = GetScreenshotName();
cmd.screenshot.width = w;
cmd.screenshot.height = h;
cmd.screenshot.pbo = defaultPbo;
cmd.screenshot.sync = sync;
//TODO: wait until next frame
cmd.Execute();
}
} // namespace Backend
} // namespace Renderer
} // namespace XS
| 27.980392
| 92
| 0.695865
|
Razish
|