blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 3 264 | content_id stringlengths 40 40 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | repo_name stringlengths 5 140 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 986
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 3.89k 681M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 23
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 145
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 10.4M | extension stringclasses 122
values | content stringlengths 3 10.4M | authors listlengths 1 1 | author_id stringlengths 0 158 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c17c6eebd7a109117bda5f86c5df0596b60e18b3 | ac8b97d3ad78f1e053be2d69a9dd115e009b9e30 | /src/dvm/DVMC.h | d2e04c839c52a07d43f64715b095c8a9b8a8d69b | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | bubdm/DIONS | 679e05ca736e208f86549ac5dde947dda2b0726d | a0b34425f2a0a3055e619c8b4225debb68f27bc6 | refs/heads/master | 2023-07-23T04:23:19.496917 | 2021-09-06T15:04:16 | 2021-09-06T15:04:16 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 644 | h | // Aldvm: Ethereum C++ client, tools and libraries.
// Copyright 2014-2019 Aldvm Authors.
// Licensed under the GNU General Public License, Version 3.
#pragma once
#include <libdvm/VMFace.h>
#include <string>
#include <utility>
#include <vector>
namespace dev
{
namespace dvm
{
/// The wrapper implementing the VMFace interface with a DVMC VM as a backend.
class DVMC : public dvmc::VM, public VMFace
{
public:
DVMC(dvmc_vm* _vm, std::vector<std::pair<std::string, std::string>> const& _options) noexcept;
owning_bytes_ref exec(u256& io_gas, ExtVMFace& _ext, OnOpFunc const& _onOp) final;
};
} // namespace dvm
} // namespace dev
| [
"51786421+blastdoor7@users.noreply.github.com"
] | 51786421+blastdoor7@users.noreply.github.com |
d3a24b92a8e8f8bac75f3cac2bcbd8693a38317b | 5ac13fa1746046451f1989b5b8734f40d6445322 | /minimangalore/Nebula2/code/nebula2/src/kernel/nloghandler.cc | 5ec272c498a35213ba303805c4f92a49847f184b | [] | no_license | moltenguy1/minimangalore | 9f2edf7901e7392490cc22486a7cf13c1790008d | 4d849672a6f25d8e441245d374b6bde4b59cbd48 | refs/heads/master | 2020-04-23T08:57:16.492734 | 2009-08-01T09:13:33 | 2009-08-01T09:13:33 | 35,933,330 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,047 | cc | //------------------------------------------------------------------------------
// nloghandler.cc
// (C) 2003 RadonLabs GmbH
//------------------------------------------------------------------------------
#include "kernel/nloghandler.h"
//------------------------------------------------------------------------------
/**
*/
nLogHandler::nLogHandler() :
isOpen(false)
{
// empty
}
//------------------------------------------------------------------------------
/**
*/
nLogHandler::~nLogHandler()
{
// empty
}
//------------------------------------------------------------------------------
/**
*/
bool
nLogHandler::Open()
{
n_assert(!this->isOpen);
this->isOpen = true;
return true;
}
//------------------------------------------------------------------------------
/**
*/
void
nLogHandler::Close()
{
n_assert(this->isOpen);
this->isOpen = false;
}
//------------------------------------------------------------------------------
/**
*/
void
nLogHandler::Print(const char* /* str*/, va_list /* argList */)
{
// empty
}
//------------------------------------------------------------------------------
/**
*/
void
nLogHandler::Message(const char* /* str */, va_list /* argList */)
{
// empty
}
//------------------------------------------------------------------------------
/**
*/
void
nLogHandler::Error(const char* /* str */, va_list /* argList */)
{
// empty
}
//------------------------------------------------------------------------------
/**
- 26-Mar-05 kims created
*/
void
nLogHandler::OutputDebug(const char* /* str */, va_list /* argList */)
{
// empty
}
//------------------------------------------------------------------------------
/**
Subclasses may log all messages in an internal line buffer. If they
chose to do so, this must be a nLineBuffer class and override the
GetLineBuffer() method.
*/
nLineBuffer*
nLogHandler::GetLineBuffer()
{
return 0;
}
| [
"BawooiT@d1c0eb94-fc07-11dd-a7be-4b3ef3b0700c"
] | BawooiT@d1c0eb94-fc07-11dd-a7be-4b3ef3b0700c |
5c7902bf47a9f14336c4c6bf9c57f30a85d55c46 | 15496ef8e55b49b055858d848bb69c4a45779e59 | /TPV2/TPV2/game/FighterGunSystem.cpp | f33ed1c895215110b1cc9c51a8c571d9d4e11b98 | [] | no_license | madelino22/TPV2P3 | 72430c5194138e20940e48808efdffae59b90cdf | 77372f8a7bf6d1ea80b4c776f01c1706710a5036 | refs/heads/main | 2023-05-09T11:18:49.377546 | 2021-05-28T07:48:09 | 2021-05-28T07:48:09 | 366,112,803 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,150 | cpp | #include "FighterGunSystem.h"
#include "GameManagerSystem.h"
#include "NetworkSystem.h"
#include "../ecs/Manager.h"
#include "../sdlutils/SDLUtils.h"
void FighterGunSystem::init()
{
bulletsSystem = manager_->getSystem<BulletsSystem>();
}
void FighterGunSystem::update()
{
if (manager_->getSystem<GameManagerSystem>()->getState() == GameManagerSystem::RUNNING)
{
if (ih().keyDownEvent()) {
//Si se presiona la s, dispara
if (ih().keyDownEvent()) {
if (ih().isKeyDown(SDLK_s) && sdlutils().currRealTime() >= timer + 250) {
//Cada vez que dispare hayq eu ver la id ya que en el init no vale ya qeu se peude cambiar la posicion del jugador des
if (manager_->getSystem<NetworkSystem>()->getId() == 0)tr = manager_->getComponent<Transform>(manager_->getHandler<LeftFighter>());
else tr = manager_->getComponent<Transform>(manager_->getHandler<RightFighter>());
auto& pos = tr->getPos();
auto& vel = tr->getVel();
auto r = tr->getRot();
timer = sdlutils().currRealTime();
bulletsSystem->shoot(pos, vel, 50, 50, tr);
manager_->getSystem<NetworkSystem>()->tryShoot();
}
}
}
}
} | [
"madelino@ucm.es"
] | madelino@ucm.es |
cacb4bef152acb6c552ef43c16f7f76191e7c4a0 | c1abe6fd0969dbcafa646639feabfda58509c985 | /Engine/src/util_random.cpp | 598967808f193cc7fd60ff474f037766f1be0064 | [] | no_license | quepas/Aberrant-Furious-Frostbite | 638bbebc4db82372562b3c017e36a19b9e763373 | c78236750f9540ca7d108ab12ac9c1405ee604b7 | refs/heads/master | 2021-01-22T12:12:35.131772 | 2014-10-09T19:57:13 | 2014-10-09T19:57:13 | 16,526,991 | 1 | 0 | null | 2014-08-10T19:59:09 | 2014-02-04T21:56:07 | C++ | UTF-8 | C++ | false | false | 539 | cpp | #include "util_random.hpp"
#include <random>
using std::string;
using std::random_device;
using std::mt19937;
using std::uniform_int_distribution;
namespace aff {
namespace util {
namespace random {
string util::random::Generate32Chars()
{
string result;
random_device device;
mt19937 generator(device());
uniform_int_distribution<> distribution(0, standard_chars.length() - 1);
for (int i = 0; i < 32; ++i) {
result += standard_chars[distribution(generator)];
}
return result;
}
// aff::util::random::
}}}
| [
"oneinchman.dev@gmail.com"
] | oneinchman.dev@gmail.com |
14b9949e8a30c17ae5d2d1f7fb63cbf1a1bea344 | 69d74c80d0b156247cc3b615ef6891ce219d7163 | /osc/oscDatabaseQuery.h | b1ec1f9f74a6a3e05e16b5f1582f19e84881757d | [] | no_license | abouchereau2/orchids | 9004a8d062584964ddae7fe69a4eeb78522501ad | 48bf8e22b6e4517da40a2c1b4a496fa214916286 | refs/heads/master | 2022-01-07T18:27:03.828897 | 2019-06-24T08:18:54 | 2019-06-24T08:18:54 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,957 | h | //
// oscDatabaseQuery.h
// Orchids
//
// Created by Antoine Bouchereau on 24/07/14.
// Copyright (c) 2014 Antoine Bouchereau. All rights reserved.
//
#ifndef __Orchids__oscDatabaseQuery__
#define __Orchids__oscDatabaseQuery__
#include "Orchids.h"
class BDBTxn;
/**
* @brief Add a sound directory (recursive) to the database
* @param m Received OSC message to parse
* @param txn Pointer to the current database connector
*/
void addSoundDirectories ( const osc::ReceivedMessage& m, BDBTxn* txn );
/**
* @brief Recover a previous backup of the database
* @param m Received OSC message to parse
* @param txn Pointer to the current database connector
*/
void recoverDBBackup ( const osc::ReceivedMessage& m, BDBTxn* txn );
/**
* @brief Remove a sound directory from the database
* @param m Received OSC message to parse
* @param txn Pointer to the current database connector
*/
void removeSoundDirectory ( const osc::ReceivedMessage& m, BDBTxn* txn );
/**
* @brief Remove a sound directory from the database
* @param m Received OSC message to parse
* @param txn Pointer to the current database connector
*/
void reanalyzeSoundDirectory ( const osc::ReceivedMessage& m, BDBTxn* txn );
/**
* @brief Refresh a sound directory in the database
* @param m Received OSC message to parse
* @param txn Pointer to the current database connector
*/
void refreshSoundDirectories( const osc::ReceivedMessage& m, BDBTxn* txn );
/**
* @brief Get symbolic informations from a sound
* @param m Received OSC message to parse
* @param txn Pointer to the current database connector
*/
void getSymbolics ( const osc::ReceivedMessage& m, BDBTxn* txn );
/**
* @brief Launch a query to perform on database
* @param m Received OSC message to parse
* @param txn Pointer to the current database connector
*/
void getSoundsQuery ( const osc::ReceivedMessage& m, BDBTxn* txn );
/**
* @brief Get min and maximum values of a descriptor
* @param m Received OSC message to parse
* @param txn Pointer to the current database connector
*/
void getDescriptorMinMax ( const osc::ReceivedMessage& m, BDBTxn* txn );
/**
* @brief Get min and maximum values for multiple descriptors
* @param m Received OSC message to parse
* @param txn Pointer to the current database connector
*/
void getMultipleDescriptorMinMax ( const osc::ReceivedMessage& m, BDBTxn* txn );
/**
* @brief Get one descriptor from one sound
* @param m Received OSC message to parse
* @param txn Pointer to the current database connector
*/
void getSingle ( const osc::ReceivedMessage& m, BDBTxn* txn );
/**
* @brief Return a list of all values for a field in database
* @param m Received OSC message to parse
* @param txn Pointer to the current database connector
*/
void getIndexList ( const osc::ReceivedMessage& m, BDBTxn* txn );
#endif /* defined(__Orchids__oscDatabaseQuery__) */ | [
"esling@m2903.ircam.fr"
] | esling@m2903.ircam.fr |
0fa4cace4824489b47da9889ff10e90cbb32d73a | 0aed36f07a9e806bef50baffa7f8777abca1ea79 | /Vector.cpp | a7478363379caa759a159788b4c6303a34e55750 | [] | no_license | Nishant1201/LinearAlgebraCPP | 83869921585504117be4fabf36c529e4918f9a90 | 8fe18ddc51ff459b5276199107440043b1890e8f | refs/heads/main | 2022-12-26T22:05:14.893264 | 2020-10-13T17:52:50 | 2020-10-13T17:52:50 | 303,779,835 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,870 | cpp | #include <cmath>
#include <cassert>
#include "Vector.hpp"
// Constructor for vector of a given size
// Allocates memory, and initialises entries
// to zero
Vector::Vector(int size)
{
assert(size > 0);
mSize = size;
mData = new myReal [mSize];
for (int i=0; i<mSize; i++)
{
mData[i] = 0.0;
}
}
// Overridden copy constructor
// Allocates memory for new vector, and copies
// entries of other vector into it
Vector::Vector(const Vector& otherVector)
{
mSize = otherVector.GetSize();
mData = new double [mSize];
for (int i=0; i<mSize; i++)
{
mData[i] = otherVector.mData[i];
}
}
// Overridden destructor to correctly free memory
Vector::~Vector()
{
// std::cout << "Destructor is executed " << std::endl;
delete[] mData;
}
// Method to get the size of a vector
int Vector::GetSize() const
{
return mSize;
}
// Overloading square brackets
// Note that this uses `zero-based' indexing,
// and a check on the validity of the index
myReal& Vector::operator[](int i)
{
assert(i > -1 && i < mSize);
return mData[i];
}
// Read-only variant of []
// Note that this uses `zero-based' indexing,
// and a check on the validity of the index
myReal Vector::Read(int i) const
{
assert(i > -1 && i < mSize);
return mData[i];
}
// Overloading round brackets
// Note that this uses `one-based' indexing,
// and a check on the validity of the index
myReal& Vector::operator()(int i)
{
assert(i > 0 && i < mSize+1);
return mData[i-1];
}
// Overloading the assignment operator
Vector& Vector::operator=(const Vector& otherVector)
{
assert(mSize == otherVector.mSize);
for (int i=0; i<mSize; i++)
{
mData[i] = otherVector.mData[i];
}
return *this;
}
// Overloading the unary + operator
Vector Vector::operator+() const
{
Vector v(mSize);
for (int i=0; i<mSize; i++)
{
v[i] = mData[i];
}
return v;
}
// Overloading the unary - operator
Vector Vector::operator-() const
{
Vector v(mSize);
for (int i=0; i<mSize; i++)
{
v[i] = -mData[i];
}
return v;
}
// Overloading the binary + operator
Vector Vector::operator+(const Vector& v1) const
{
assert(mSize == v1.mSize);
Vector v(mSize);
for (int i=0; i<mSize; i++)
{
v[i] = mData[i] + v1.mData[i];
}
return v;
}
// Overloading the binary - operator
Vector Vector::operator-(const Vector& v1) const
{
assert(mSize == v1.mSize);
Vector v(mSize);
for (int i=0; i<mSize; i++)
{
v[i] = mData[i] - v1.mData[i];
}
return v;
}
// Overloading scalar multiplication
Vector Vector::operator*(myReal k) const
{
Vector v(mSize);
for (int i=0; i<mSize; i++)
{
v[i] = k*mData[i];
}
return v;
}
// Overload * operator for dot product
myReal Vector::operator*(const Vector& v1) const
{
assert(mSize == v1.mSize);
myReal sum(0.0);
for(int i=0; i<mSize; i++)
{
sum += mData[i] * v1.mData[i];
// sum = sum + mData[i] * v1.mData[i];
}
return sum;
}
// Method to calculate norm (with default value p=2)
// corresponding to the Euclidean norm
myReal Vector::CalculateNorm(int p) const
{
myReal norm_val, sum(0.0);
for (int i=0; i<mSize; i++)
{
sum += pow(fabs(mData[i]), p);
}
norm_val = pow(sum, 1.0/((myReal) (p)));
return norm_val;
}
// Method to calculate unit vector
// corresponding to this vector
Vector Vector::unit_vector() const
{
Vector u(this->mSize);
for(int i=0; i<mSize; i++)
{
u.mData[i] = this->mData[i] / this->CalculateNorm();
}
return u;
}
// MATLAB style friend to get the size of a vector
int length(const Vector& v)
{
return v.mSize;
}
// overload output stream <<
std::ostream& operator<<(std::ostream& os, const Vector v1)
{
for(int i=0; i<v1.mSize; i++)
{
os << v1.mData[i] << " ";
}
std::cout << std::endl;
return os;
}
| [
"nishant.aesidel@gmail.com"
] | nishant.aesidel@gmail.com |
71dad4cedf2e94b1f914b7895832e4b8569bfa46 | 570a21c39b9af163ef0793c149b83f6a302bd84c | /folly/detail/test/PerfScopedTest.cpp | f6223b4eecc572099a6a5c393f8a7f6ece526f2e | [
"MIT",
"Apache-2.0"
] | permissive | facebook/folly | 544d17b45bda70c51ba593f920e0200bde177927 | ab45d9b6a7a2a24b2a725447387f36772dd2cc4a | refs/heads/main | 2023-08-17T10:31:22.589640 | 2023-08-17T09:29:35 | 2023-08-17T09:29:35 | 4,524,181 | 23,991 | 5,805 | Apache-2.0 | 2023-08-23T18:23:26 | 2012-06-01T20:49:04 | C++ | UTF-8 | C++ | false | false | 2,593 | cpp | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* 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 <folly/detail/PerfScoped.h>
#include <folly/portability/GMock.h>
#include <folly/portability/GTest.h>
#include <folly/portability/Unistd.h>
#include <thread>
#if FOLLY_PERF_IS_SUPPORTED
namespace folly {
namespace detail {
namespace {
// This is obviously not amazing
// but if perf didn't start properly,
// we won't get any results.
template <typename Test>
void retryWithTimeOuts(Test test) {
for (auto timeOut = std::chrono::seconds(1);
timeOut != std::chrono::seconds(10);
++timeOut) {
if (test(timeOut)) {
return;
}
}
}
TEST(PerfScopedTest, Stat) {
std::string output;
retryWithTimeOuts([&](auto timeOut) {
{
PerfScoped perf{{"stat"}, &output};
std::this_thread::sleep_for(timeOut);
}
return !output.empty();
});
ASSERT_THAT(
output, ::testing::HasSubstr("Performance counter stats for process id"));
}
TEST(PerfScopedTest, Move) {
std::string output;
retryWithTimeOuts([&](auto timeOut) {
{
PerfScoped assignHere;
{
PerfScoped fromHere{{"stat"}, &output};
assignHere = std::move(fromHere);
std::this_thread::sleep_for(timeOut);
}
// because assign here is still alive, should not do anything.
EXPECT_TRUE(output.empty());
}
std::this_thread::sleep_for(timeOut);
// Now that all guards are off, should be fine.
return !output.empty();
});
ASSERT_FALSE(output.empty());
}
TEST(PerfScopedTest, Record) {
std::string output;
retryWithTimeOuts([&](auto timeOut) {
{
PerfScoped perf{{"record"}, &output};
std::this_thread::sleep_for(timeOut);
}
return !output.empty();
});
ASSERT_FALSE(output.empty());
}
TEST(PerfScopedTest, StatNoOutput) {
// Just verifying that this doesn't crash.
PerfScoped perf{{"stat"}};
std::this_thread::sleep_for(std::chrono::seconds(1));
}
} // namespace
} // namespace detail
} // namespace folly
#endif // defined(__linux__)
| [
"facebook-github-bot@users.noreply.github.com"
] | facebook-github-bot@users.noreply.github.com |
ff0b0be7f09d2dd9f2942a54f63d3fc4aaddf97d | c2c9e9bd2644d89e573e50e00993a2c07076d2e2 | /ThirdParties/Poco/XML/src/xmlparse.cpp | cb484d6f28b09b94c4a2c754cd3a0b746cfd6222 | [
"BSL-1.0",
"MIT",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | TotteKarlsson/dsl | eeab84f4b6d0c951d73ff275b734b503ddb081c0 | 3807cbe5f90a3cd495979eafa8cf5485367b634c | refs/heads/master | 2021-06-17T11:38:02.395605 | 2019-12-11T17:51:41 | 2019-12-11T17:51:41 | 166,859,372 | 0 | 0 | NOASSERTION | 2019-06-11T18:45:24 | 2019-01-21T18:17:04 | Pascal | UTF-8 | C++ | false | false | 193,917 | cpp | /* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
See the file COPYING for copying permission.
*/
#include <stddef.h>
#include <string.h> /* memset(), memcpy() */
#include <assert.h>
#define XML_BUILDING_EXPAT 1
#ifdef COMPILED_FROM_DSP
#include "winconfig.h"
#elif defined(MACOS_CLASSIC)
#include "macconfig.h"
#elif defined(__amigaos__)
#include "amigaconfig.h"
#elif defined(__WATCOMC__)
#include "watcomconfig.h"
#elif defined(HAVE_EXPAT_CONFIG_H)
#include "expat_config.h"
#endif /* ndef COMPILED_FROM_DSP */
#include "ascii.h"
#include "Poco/XML/expat.h"
#ifdef XML_UNICODE
#define XML_ENCODE_MAX XML_UTF16_ENCODE_MAX
#define XmlConvert XmlUtf16Convert
#define XmlGetInternalEncoding XmlGetUtf16InternalEncoding
#define XmlGetInternalEncodingNS XmlGetUtf16InternalEncodingNS
#define XmlEncode XmlUtf16Encode
/* Using pointer subtraction to convert to integer type. */
#define MUST_CONVERT(enc, s) (!(enc)->isUtf16 || (((char *)(s) - (char *)NULL) & 1))
typedef unsigned short ICHAR;
#else
#define XML_ENCODE_MAX XML_UTF8_ENCODE_MAX
#define XmlConvert XmlUtf8Convert
#define XmlGetInternalEncoding XmlGetUtf8InternalEncoding
#define XmlGetInternalEncodingNS XmlGetUtf8InternalEncodingNS
#define XmlEncode XmlUtf8Encode
#define MUST_CONVERT(enc, s) (!(enc)->isUtf8)
typedef char ICHAR;
#endif
#ifndef XML_NS
#define XmlInitEncodingNS XmlInitEncoding
#define XmlInitUnknownEncodingNS XmlInitUnknownEncoding
#undef XmlGetInternalEncodingNS
#define XmlGetInternalEncodingNS XmlGetInternalEncoding
#define XmlParseXmlDeclNS XmlParseXmlDecl
#endif
#ifdef XML_UNICODE
#ifdef XML_UNICODE_WCHAR_T
#define XML_T(x) (const wchar_t)x
#define XML_L(x) L ## x
#else
#define XML_T(x) (const unsigned short)x
#define XML_L(x) x
#endif
#else
#define XML_T(x) x
#define XML_L(x) x
#endif
/* Round up n to be a multiple of sz, where sz is a power of 2. */
#define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1))
/* Handle the case where memmove() doesn't exist. */
#ifndef HAVE_MEMMOVE
#ifdef HAVE_BCOPY
#define memmove(d,s,l) bcopy((s),(d),(l))
#else
#error memmove does not exist on this platform, nor is a substitute available
#endif /* HAVE_BCOPY */
#endif /* HAVE_MEMMOVE */
#include "internal.h"
#include "xmltok.h"
#include "xmlrole.h"
typedef const XML_Char *KEY;
typedef struct {
KEY name;
} NAMED;
typedef struct {
NAMED **v;
unsigned char power;
size_t size;
size_t used;
const XML_Memory_Handling_Suite *mem;
} HASH_TABLE;
/* Basic character hash algorithm, taken from Python's string hash:
h = h * 1000003 ^ character, the constant being a prime number.
*/
#ifdef XML_UNICODE
#define CHAR_HASH(h, c) \
(((h) * 0xF4243) ^ (unsigned short)(c))
#else
#define CHAR_HASH(h, c) \
(((h) * 0xF4243) ^ (unsigned char)(c))
#endif
/* For probing (after a collision) we need a step size relative prime
to the hash table size, which is a power of 2. We use double-hashing,
since we can calculate a second hash value cheaply by taking those bits
of the first hash value that were discarded (masked out) when the table
index was calculated: index = hash & mask, where mask = table->size - 1.
We limit the maximum step size to table->size / 4 (mask >> 2) and make
it odd, since odd numbers are always relative prime to a power of 2.
*/
#define SECOND_HASH(hash, mask, power) \
((((hash) & ~(mask)) >> ((power) - 1)) & ((mask) >> 2))
#define PROBE_STEP(hash, mask, power) \
((unsigned char)((SECOND_HASH(hash, mask, power)) | 1))
typedef struct {
NAMED **p;
NAMED **end;
} HASH_TABLE_ITER;
#define INIT_TAG_BUF_SIZE 32 /* must be a multiple of sizeof(XML_Char) */
#define INIT_DATA_BUF_SIZE 1024
#define INIT_ATTS_SIZE 16
#define INIT_ATTS_VERSION 0xFFFFFFFF
#define INIT_BLOCK_SIZE 1024
#define INIT_BUFFER_SIZE 1024
#define EXPAND_SPARE 24
typedef struct binding {
struct prefix *prefix;
struct binding *nextTagBinding;
struct binding *prevPrefixBinding;
const struct attribute_id *attId;
XML_Char *uri;
int uriLen;
int uriAlloc;
} BINDING;
typedef struct prefix {
const XML_Char *name;
BINDING *binding;
} PREFIX;
typedef struct {
const XML_Char *str;
const XML_Char *localPart;
const XML_Char *prefix;
int strLen;
int uriLen;
int prefixLen;
} TAG_NAME;
/* TAG represents an open element.
The name of the element is stored in both the document and API
encodings. The memory buffer 'buf' is a separately-allocated
memory area which stores the name. During the XML_Parse()/
XMLParseBuffer() when the element is open, the memory for the 'raw'
version of the name (in the document encoding) is shared with the
document buffer. If the element is open across calls to
XML_Parse()/XML_ParseBuffer(), the buffer is re-allocated to
contain the 'raw' name as well.
A parser re-uses these structures, maintaining a list of allocated
TAG objects in a free list.
*/
typedef struct tag {
struct tag *parent; /* parent of this element */
const char *rawName; /* tagName in the original encoding */
int rawNameLength;
TAG_NAME name; /* tagName in the API encoding */
char *buf; /* buffer for name components */
char *bufEnd; /* end of the buffer */
BINDING *bindings;
} TAG;
typedef struct {
const XML_Char *name;
const XML_Char *textPtr;
int textLen; /* length in XML_Chars */
int processed; /* # of processed bytes - when suspended */
const XML_Char *systemId;
const XML_Char *base;
const XML_Char *publicId;
const XML_Char *notation;
XML_Bool open;
XML_Bool is_param;
XML_Bool is_internal; /* true if declared in internal subset outside PE */
} ENTITY;
typedef struct {
enum XML_Content_Type type;
enum XML_Content_Quant quant;
const XML_Char * name;
int firstchild;
int lastchild;
int childcnt;
int nextsib;
} CONTENT_SCAFFOLD;
#define INIT_SCAFFOLD_ELEMENTS 32
typedef struct block {
struct block *next;
int size;
XML_Char s[1];
} BLOCK;
typedef struct {
BLOCK *blocks;
BLOCK *freeBlocks;
const XML_Char *end;
XML_Char *ptr;
XML_Char *start;
const XML_Memory_Handling_Suite *mem;
} STRING_POOL;
/* The XML_Char before the name is used to determine whether
an attribute has been specified. */
typedef struct attribute_id {
XML_Char *name;
PREFIX *prefix;
XML_Bool maybeTokenized;
XML_Bool xmlns;
} ATTRIBUTE_ID;
typedef struct {
const ATTRIBUTE_ID *id;
XML_Bool isCdata;
const XML_Char *value;
} DEFAULT_ATTRIBUTE;
typedef struct {
unsigned long version;
unsigned long hash;
const XML_Char *uriName;
} NS_ATT;
typedef struct {
const XML_Char *name;
PREFIX *prefix;
const ATTRIBUTE_ID *idAtt;
int nDefaultAtts;
int allocDefaultAtts;
DEFAULT_ATTRIBUTE *defaultAtts;
} ELEMENT_TYPE;
typedef struct {
HASH_TABLE generalEntities;
HASH_TABLE elementTypes;
HASH_TABLE attributeIds;
HASH_TABLE prefixes;
STRING_POOL pool;
STRING_POOL entityValuePool;
/* false once a parameter entity reference has been skipped */
XML_Bool keepProcessing;
/* true once an internal or external PE reference has been encountered;
this includes the reference to an external subset */
XML_Bool hasParamEntityRefs;
XML_Bool standalone;
#ifdef XML_DTD
/* indicates if external PE has been read */
XML_Bool paramEntityRead;
HASH_TABLE paramEntities;
#endif /* XML_DTD */
PREFIX defaultPrefix;
/* === scaffolding for building content model === */
XML_Bool in_eldecl;
CONTENT_SCAFFOLD *scaffold;
unsigned contentStringLen;
unsigned scaffSize;
unsigned scaffCount;
int scaffLevel;
int *scaffIndex;
} DTD;
typedef struct open_internal_entity {
const char *internalEventPtr;
const char *internalEventEndPtr;
struct open_internal_entity *next;
ENTITY *entity;
int startTagLevel;
XML_Bool betweenDecl; /* WFC: PE Between Declarations */
} OPEN_INTERNAL_ENTITY;
typedef enum XML_Error PTRCALL Processor(XML_Parser parser,
const char *start,
const char *end,
const char **endPtr);
static Processor prologProcessor;
static Processor prologInitProcessor;
static Processor contentProcessor;
static Processor cdataSectionProcessor;
#ifdef XML_DTD
static Processor ignoreSectionProcessor;
static Processor externalParEntProcessor;
static Processor externalParEntInitProcessor;
static Processor entityValueProcessor;
static Processor entityValueInitProcessor;
#endif /* XML_DTD */
static Processor epilogProcessor;
static Processor errorProcessor;
static Processor externalEntityInitProcessor;
static Processor externalEntityInitProcessor2;
static Processor externalEntityInitProcessor3;
static Processor externalEntityContentProcessor;
static Processor internalEntityProcessor;
static enum XML_Error
handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName);
static enum XML_Error
processXmlDecl(XML_Parser parser, int isGeneralTextEntity,
const char *s, const char *next);
static enum XML_Error
initializeEncoding(XML_Parser parser);
static enum XML_Error
doProlog(XML_Parser parser, const ENCODING *enc, const char *s,
const char *end, int tok, const char *next, const char **nextPtr,
XML_Bool haveMore);
static enum XML_Error
processInternalEntity(XML_Parser parser, ENTITY *entity,
XML_Bool betweenDecl);
static enum XML_Error
doContent(XML_Parser parser, int startTagLevel, const ENCODING *enc,
const char *start, const char *end, const char **endPtr,
XML_Bool haveMore);
static enum XML_Error
doCdataSection(XML_Parser parser, const ENCODING *, const char **startPtr,
const char *end, const char **nextPtr, XML_Bool haveMore);
#ifdef XML_DTD
static enum XML_Error
doIgnoreSection(XML_Parser parser, const ENCODING *, const char **startPtr,
const char *end, const char **nextPtr, XML_Bool haveMore);
#endif /* XML_DTD */
static enum XML_Error
storeAtts(XML_Parser parser, const ENCODING *, const char *s,
TAG_NAME *tagNamePtr, BINDING **bindingsPtr);
static enum XML_Error
addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId,
const XML_Char *uri, BINDING **bindingsPtr);
static int
defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *, XML_Bool isCdata,
XML_Bool isId, const XML_Char *dfltValue, XML_Parser parser);
static enum XML_Error
storeAttributeValue(XML_Parser parser, const ENCODING *, XML_Bool isCdata,
const char *, const char *, STRING_POOL *);
static enum XML_Error
appendAttributeValue(XML_Parser parser, const ENCODING *, XML_Bool isCdata,
const char *, const char *, STRING_POOL *);
static ATTRIBUTE_ID *
getAttributeId(XML_Parser parser, const ENCODING *enc, const char *start,
const char *end);
static int
setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *);
static enum XML_Error
storeEntityValue(XML_Parser parser, const ENCODING *enc, const char *start,
const char *end);
static int
reportProcessingInstruction(XML_Parser parser, const ENCODING *enc,
const char *start, const char *end);
static int
reportComment(XML_Parser parser, const ENCODING *enc, const char *start,
const char *end);
static void
reportDefault(XML_Parser parser, const ENCODING *enc, const char *start,
const char *end);
static const XML_Char * getContext(XML_Parser parser);
static XML_Bool
setContext(XML_Parser parser, const XML_Char *context);
static void FASTCALL normalizePublicId(XML_Char *s);
static DTD * dtdCreate(const XML_Memory_Handling_Suite *ms);
/* do not call if parentParser != NULL */
static void dtdReset(DTD *p, const XML_Memory_Handling_Suite *ms);
static void
dtdDestroy(DTD *p, XML_Bool isDocEntity, const XML_Memory_Handling_Suite *ms);
static int
dtdCopy(DTD *newDtd, const DTD *oldDtd, const XML_Memory_Handling_Suite *ms);
static int
copyEntityTable(HASH_TABLE *, STRING_POOL *, const HASH_TABLE *);
static NAMED *
lookup(HASH_TABLE *table, KEY name, size_t createSize);
static void FASTCALL
hashTableInit(HASH_TABLE *, const XML_Memory_Handling_Suite *ms);
static void FASTCALL hashTableClear(HASH_TABLE *);
static void FASTCALL hashTableDestroy(HASH_TABLE *);
static void FASTCALL
hashTableIterInit(HASH_TABLE_ITER *, const HASH_TABLE *);
static NAMED * FASTCALL hashTableIterNext(HASH_TABLE_ITER *);
static void FASTCALL
poolInit(STRING_POOL *, const XML_Memory_Handling_Suite *ms);
static void FASTCALL poolClear(STRING_POOL *);
static void FASTCALL poolDestroy(STRING_POOL *);
static XML_Char *
poolAppend(STRING_POOL *pool, const ENCODING *enc,
const char *ptr, const char *end);
static XML_Char *
poolStoreString(STRING_POOL *pool, const ENCODING *enc,
const char *ptr, const char *end);
static XML_Bool FASTCALL poolGrow(STRING_POOL *pool);
static const XML_Char * FASTCALL
poolCopyString(STRING_POOL *pool, const XML_Char *s);
static const XML_Char *
poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n);
static const XML_Char * FASTCALL
poolAppendString(STRING_POOL *pool, const XML_Char *s);
static int FASTCALL nextScaffoldPart(XML_Parser parser);
static XML_Content * build_model(XML_Parser parser);
static ELEMENT_TYPE *
getElementType(XML_Parser parser, const ENCODING *enc,
const char *ptr, const char *end);
static XML_Parser
parserCreate(const XML_Char *encodingName,
const XML_Memory_Handling_Suite *memsuite,
const XML_Char *nameSep,
DTD *dtd);
static void
parserInit(XML_Parser parser, const XML_Char *encodingName);
#define poolStart(pool) ((pool)->start)
#define poolEnd(pool) ((pool)->ptr)
#define poolLength(pool) ((pool)->ptr - (pool)->start)
#define poolChop(pool) ((void)--(pool->ptr))
#define poolLastChar(pool) (((pool)->ptr)[-1])
#define poolDiscard(pool) ((pool)->ptr = (pool)->start)
#define poolFinish(pool) ((pool)->start = (pool)->ptr)
#define poolAppendChar(pool, c) \
(((pool)->ptr == (pool)->end && !poolGrow(pool)) \
? 0 \
: ((*((pool)->ptr)++ = c), 1))
struct XML_ParserStruct {
/* The first member must be userData so that the XML_GetUserData
macro works. */
void *m_userData;
void *m_handlerArg;
char *m_buffer;
const XML_Memory_Handling_Suite m_mem;
/* first character to be parsed */
const char *m_bufferPtr;
/* past last character to be parsed */
char *m_bufferEnd;
/* allocated end of buffer */
const char *m_bufferLim;
XML_Index m_parseEndByteIndex;
const char *m_parseEndPtr;
XML_Char *m_dataBuf;
XML_Char *m_dataBufEnd;
XML_StartElementHandler m_startElementHandler;
XML_EndElementHandler m_endElementHandler;
XML_CharacterDataHandler m_characterDataHandler;
XML_ProcessingInstructionHandler m_processingInstructionHandler;
XML_CommentHandler m_commentHandler;
XML_StartCdataSectionHandler m_startCdataSectionHandler;
XML_EndCdataSectionHandler m_endCdataSectionHandler;
XML_DefaultHandler m_defaultHandler;
XML_StartDoctypeDeclHandler m_startDoctypeDeclHandler;
XML_EndDoctypeDeclHandler m_endDoctypeDeclHandler;
XML_UnparsedEntityDeclHandler m_unparsedEntityDeclHandler;
XML_NotationDeclHandler m_notationDeclHandler;
XML_StartNamespaceDeclHandler m_startNamespaceDeclHandler;
XML_EndNamespaceDeclHandler m_endNamespaceDeclHandler;
XML_NotStandaloneHandler m_notStandaloneHandler;
XML_ExternalEntityRefHandler m_externalEntityRefHandler;
XML_Parser m_externalEntityRefHandlerArg;
XML_SkippedEntityHandler m_skippedEntityHandler;
XML_UnknownEncodingHandler m_unknownEncodingHandler;
XML_ElementDeclHandler m_elementDeclHandler;
XML_AttlistDeclHandler m_attlistDeclHandler;
XML_EntityDeclHandler m_entityDeclHandler;
XML_XmlDeclHandler m_xmlDeclHandler;
const ENCODING *m_encoding;
INIT_ENCODING m_initEncoding;
const ENCODING *m_internalEncoding;
const XML_Char *m_protocolEncodingName;
XML_Bool m_ns;
XML_Bool m_ns_triplets;
void *m_unknownEncodingMem;
void *m_unknownEncodingData;
void *m_unknownEncodingHandlerData;
void (XMLCALL *m_unknownEncodingRelease)(void *);
PROLOG_STATE m_prologState;
Processor *m_processor;
enum XML_Error m_errorCode;
const char *m_eventPtr;
const char *m_eventEndPtr;
const char *m_positionPtr;
OPEN_INTERNAL_ENTITY *m_openInternalEntities;
OPEN_INTERNAL_ENTITY *m_freeInternalEntities;
XML_Bool m_defaultExpandInternalEntities;
int m_tagLevel;
ENTITY *m_declEntity;
const XML_Char *m_doctypeName;
const XML_Char *m_doctypeSysid;
const XML_Char *m_doctypePubid;
const XML_Char *m_declAttributeType;
const XML_Char *m_declNotationName;
const XML_Char *m_declNotationPublicId;
ELEMENT_TYPE *m_declElementType;
ATTRIBUTE_ID *m_declAttributeId;
XML_Bool m_declAttributeIsCdata;
XML_Bool m_declAttributeIsId;
DTD *m_dtd;
const XML_Char *m_curBase;
TAG *m_tagStack;
TAG *m_freeTagList;
BINDING *m_inheritedBindings;
BINDING *m_freeBindingList;
int m_attsSize;
int m_nSpecifiedAtts;
int m_idAttIndex;
ATTRIBUTE *m_atts;
NS_ATT *m_nsAtts;
unsigned long m_nsAttsVersion;
unsigned char m_nsAttsPower;
POSITION m_position;
STRING_POOL m_tempPool;
STRING_POOL m_temp2Pool;
char *m_groupConnector;
unsigned int m_groupSize;
XML_Char m_namespaceSeparator;
XML_Parser m_parentParser;
XML_ParsingStatus m_parsingStatus;
#ifdef XML_DTD
XML_Bool m_isParamEntity;
XML_Bool m_useForeignDTD;
enum XML_ParamEntityParsing m_paramEntityParsing;
#endif
};
#define MALLOC(s) (parser->m_mem.malloc_fcn((s)))
#define REALLOC(p,s) (parser->m_mem.realloc_fcn((p),(s)))
#define FREE(p) (parser->m_mem.free_fcn((p)))
#define userData (parser->m_userData)
#define handlerArg (parser->m_handlerArg)
#define startElementHandler (parser->m_startElementHandler)
#define endElementHandler (parser->m_endElementHandler)
#define characterDataHandler (parser->m_characterDataHandler)
#define processingInstructionHandler \
(parser->m_processingInstructionHandler)
#define commentHandler (parser->m_commentHandler)
#define startCdataSectionHandler \
(parser->m_startCdataSectionHandler)
#define endCdataSectionHandler (parser->m_endCdataSectionHandler)
#define defaultHandler (parser->m_defaultHandler)
#define startDoctypeDeclHandler (parser->m_startDoctypeDeclHandler)
#define endDoctypeDeclHandler (parser->m_endDoctypeDeclHandler)
#define unparsedEntityDeclHandler \
(parser->m_unparsedEntityDeclHandler)
#define notationDeclHandler (parser->m_notationDeclHandler)
#define startNamespaceDeclHandler \
(parser->m_startNamespaceDeclHandler)
#define endNamespaceDeclHandler (parser->m_endNamespaceDeclHandler)
#define notStandaloneHandler (parser->m_notStandaloneHandler)
#define externalEntityRefHandler \
(parser->m_externalEntityRefHandler)
#define externalEntityRefHandlerArg \
(parser->m_externalEntityRefHandlerArg)
#define internalEntityRefHandler \
(parser->m_internalEntityRefHandler)
#define skippedEntityHandler (parser->m_skippedEntityHandler)
#define unknownEncodingHandler (parser->m_unknownEncodingHandler)
#define elementDeclHandler (parser->m_elementDeclHandler)
#define attlistDeclHandler (parser->m_attlistDeclHandler)
#define entityDeclHandler (parser->m_entityDeclHandler)
#define xmlDeclHandler (parser->m_xmlDeclHandler)
#define encoding (parser->m_encoding)
#define initEncoding (parser->m_initEncoding)
#define internalEncoding (parser->m_internalEncoding)
#define unknownEncodingMem (parser->m_unknownEncodingMem)
#define unknownEncodingData (parser->m_unknownEncodingData)
#define unknownEncodingHandlerData \
(parser->m_unknownEncodingHandlerData)
#define unknownEncodingRelease (parser->m_unknownEncodingRelease)
#define protocolEncodingName (parser->m_protocolEncodingName)
#define ns (parser->m_ns)
#define ns_triplets (parser->m_ns_triplets)
#define prologState (parser->m_prologState)
#define processor (parser->m_processor)
#define errorCode (parser->m_errorCode)
#define eventPtr (parser->m_eventPtr)
#define eventEndPtr (parser->m_eventEndPtr)
#define positionPtr (parser->m_positionPtr)
#define position (parser->m_position)
#define openInternalEntities (parser->m_openInternalEntities)
#define freeInternalEntities (parser->m_freeInternalEntities)
#define defaultExpandInternalEntities \
(parser->m_defaultExpandInternalEntities)
#define tagLevel (parser->m_tagLevel)
#define buffer (parser->m_buffer)
#define bufferPtr (parser->m_bufferPtr)
#define bufferEnd (parser->m_bufferEnd)
#define parseEndByteIndex (parser->m_parseEndByteIndex)
#define parseEndPtr (parser->m_parseEndPtr)
#define bufferLim (parser->m_bufferLim)
#define dataBuf (parser->m_dataBuf)
#define dataBufEnd (parser->m_dataBufEnd)
#define _dtd (parser->m_dtd)
#define curBase (parser->m_curBase)
#define declEntity (parser->m_declEntity)
#define doctypeName (parser->m_doctypeName)
#define doctypeSysid (parser->m_doctypeSysid)
#define doctypePubid (parser->m_doctypePubid)
#define declAttributeType (parser->m_declAttributeType)
#define declNotationName (parser->m_declNotationName)
#define declNotationPublicId (parser->m_declNotationPublicId)
#define declElementType (parser->m_declElementType)
#define declAttributeId (parser->m_declAttributeId)
#define declAttributeIsCdata (parser->m_declAttributeIsCdata)
#define declAttributeIsId (parser->m_declAttributeIsId)
#define freeTagList (parser->m_freeTagList)
#define freeBindingList (parser->m_freeBindingList)
#define inheritedBindings (parser->m_inheritedBindings)
#define tagStack (parser->m_tagStack)
#define atts (parser->m_atts)
#define attsSize (parser->m_attsSize)
#define nSpecifiedAtts (parser->m_nSpecifiedAtts)
#define idAttIndex (parser->m_idAttIndex)
#define nsAtts (parser->m_nsAtts)
#define nsAttsVersion (parser->m_nsAttsVersion)
#define nsAttsPower (parser->m_nsAttsPower)
#define tempPool (parser->m_tempPool)
#define temp2Pool (parser->m_temp2Pool)
#define groupConnector (parser->m_groupConnector)
#define groupSize (parser->m_groupSize)
#define namespaceSeparator (parser->m_namespaceSeparator)
#define parentParser (parser->m_parentParser)
#define ps_parsing (parser->m_parsingStatus.parsing)
#define ps_finalBuffer (parser->m_parsingStatus.finalBuffer)
#ifdef XML_DTD
#define isParamEntity (parser->m_isParamEntity)
#define useForeignDTD (parser->m_useForeignDTD)
#define paramEntityParsing (parser->m_paramEntityParsing)
#endif /* XML_DTD */
XML_Parser XMLCALL
XML_ParserCreate(const XML_Char *encodingName)
{
return XML_ParserCreate_MM(encodingName, NULL, NULL);
}
XML_Parser XMLCALL
XML_ParserCreateNS(const XML_Char *encodingName, XML_Char nsSep)
{
XML_Char tmp[2];
*tmp = nsSep;
return XML_ParserCreate_MM(encodingName, NULL, tmp);
}
static const XML_Char implicitContext[] = {
ASCII_x, ASCII_m, ASCII_l, ASCII_EQUALS, ASCII_h, ASCII_t, ASCII_t, ASCII_p,
ASCII_COLON, ASCII_SLASH, ASCII_SLASH, ASCII_w, ASCII_w, ASCII_w,
ASCII_PERIOD, ASCII_w, ASCII_3, ASCII_PERIOD, ASCII_o, ASCII_r, ASCII_g,
ASCII_SLASH, ASCII_X, ASCII_M, ASCII_L, ASCII_SLASH, ASCII_1, ASCII_9,
ASCII_9, ASCII_8, ASCII_SLASH, ASCII_n, ASCII_a, ASCII_m, ASCII_e,
ASCII_s, ASCII_p, ASCII_a, ASCII_c, ASCII_e, '\0'
};
XML_Parser XMLCALL
XML_ParserCreate_MM(const XML_Char *encodingName,
const XML_Memory_Handling_Suite *memsuite,
const XML_Char *nameSep)
{
XML_Parser parser = parserCreate(encodingName, memsuite, nameSep, NULL);
if (parser != NULL && ns) {
/* implicit context only set for root parser, since child
parsers (i.e. external entity parsers) will inherit it
*/
if (!setContext(parser, implicitContext)) {
XML_ParserFree(parser);
return NULL;
}
}
return parser;
}
static XML_Parser
parserCreate(const XML_Char *encodingName,
const XML_Memory_Handling_Suite *memsuite,
const XML_Char *nameSep,
DTD *dtd)
{
XML_Parser parser;
if (memsuite) {
XML_Memory_Handling_Suite *mtemp;
parser = (XML_Parser)
memsuite->malloc_fcn(sizeof(struct XML_ParserStruct));
if (parser != NULL) {
mtemp = (XML_Memory_Handling_Suite *)&(parser->m_mem);
mtemp->malloc_fcn = memsuite->malloc_fcn;
mtemp->realloc_fcn = memsuite->realloc_fcn;
mtemp->free_fcn = memsuite->free_fcn;
}
}
else {
XML_Memory_Handling_Suite *mtemp;
parser = (XML_Parser)malloc(sizeof(struct XML_ParserStruct));
if (parser != NULL) {
mtemp = (XML_Memory_Handling_Suite *)&(parser->m_mem);
mtemp->malloc_fcn = malloc;
mtemp->realloc_fcn = realloc;
mtemp->free_fcn = free;
}
}
if (!parser)
return parser;
buffer = NULL;
bufferLim = NULL;
attsSize = INIT_ATTS_SIZE;
atts = (ATTRIBUTE *)MALLOC(attsSize * sizeof(ATTRIBUTE));
if (atts == NULL) {
FREE(parser);
return NULL;
}
dataBuf = (XML_Char *)MALLOC(INIT_DATA_BUF_SIZE * sizeof(XML_Char));
if (dataBuf == NULL) {
FREE(atts);
FREE(parser);
return NULL;
}
dataBufEnd = dataBuf + INIT_DATA_BUF_SIZE;
if (dtd)
_dtd = dtd;
else {
_dtd = dtdCreate(&parser->m_mem);
if (_dtd == NULL) {
FREE(dataBuf);
FREE(atts);
FREE(parser);
return NULL;
}
}
freeBindingList = NULL;
freeTagList = NULL;
freeInternalEntities = NULL;
groupSize = 0;
groupConnector = NULL;
unknownEncodingHandler = NULL;
unknownEncodingHandlerData = NULL;
namespaceSeparator = ASCII_EXCL;
ns = XML_FALSE;
ns_triplets = XML_FALSE;
nsAtts = NULL;
nsAttsVersion = 0;
nsAttsPower = 0;
poolInit(&tempPool, &(parser->m_mem));
poolInit(&temp2Pool, &(parser->m_mem));
parserInit(parser, encodingName);
if (encodingName && !protocolEncodingName) {
XML_ParserFree(parser);
return NULL;
}
if (nameSep) {
ns = XML_TRUE;
internalEncoding = XmlGetInternalEncodingNS();
namespaceSeparator = *nameSep;
}
else {
internalEncoding = XmlGetInternalEncoding();
}
return parser;
}
static void
parserInit(XML_Parser parser, const XML_Char *encodingName)
{
processor = prologInitProcessor;
XmlPrologStateInit(&prologState);
protocolEncodingName = (encodingName != NULL
? poolCopyString(&tempPool, encodingName)
: NULL);
curBase = NULL;
XmlInitEncoding(&initEncoding, &encoding, 0);
userData = NULL;
handlerArg = NULL;
startElementHandler = NULL;
endElementHandler = NULL;
characterDataHandler = NULL;
processingInstructionHandler = NULL;
commentHandler = NULL;
startCdataSectionHandler = NULL;
endCdataSectionHandler = NULL;
defaultHandler = NULL;
startDoctypeDeclHandler = NULL;
endDoctypeDeclHandler = NULL;
unparsedEntityDeclHandler = NULL;
notationDeclHandler = NULL;
startNamespaceDeclHandler = NULL;
endNamespaceDeclHandler = NULL;
notStandaloneHandler = NULL;
externalEntityRefHandler = NULL;
externalEntityRefHandlerArg = parser;
skippedEntityHandler = NULL;
elementDeclHandler = NULL;
attlistDeclHandler = NULL;
entityDeclHandler = NULL;
xmlDeclHandler = NULL;
bufferPtr = buffer;
bufferEnd = buffer;
parseEndByteIndex = 0;
parseEndPtr = NULL;
declElementType = NULL;
declAttributeId = NULL;
declEntity = NULL;
doctypeName = NULL;
doctypeSysid = NULL;
doctypePubid = NULL;
declAttributeType = NULL;
declNotationName = NULL;
declNotationPublicId = NULL;
declAttributeIsCdata = XML_FALSE;
declAttributeIsId = XML_FALSE;
memset(&position, 0, sizeof(POSITION));
errorCode = XML_ERROR_NONE;
eventPtr = NULL;
eventEndPtr = NULL;
positionPtr = NULL;
openInternalEntities = NULL;
defaultExpandInternalEntities = XML_TRUE;
tagLevel = 0;
tagStack = NULL;
inheritedBindings = NULL;
nSpecifiedAtts = 0;
unknownEncodingMem = NULL;
unknownEncodingRelease = NULL;
unknownEncodingData = NULL;
parentParser = NULL;
ps_parsing = XML_INITIALIZED;
#ifdef XML_DTD
isParamEntity = XML_FALSE;
useForeignDTD = XML_FALSE;
paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER;
#endif
}
/* moves list of bindings to freeBindingList */
static void FASTCALL
moveToFreeBindingList(XML_Parser parser, BINDING *bindings)
{
while (bindings) {
BINDING *b = bindings;
bindings = bindings->nextTagBinding;
b->nextTagBinding = freeBindingList;
freeBindingList = b;
}
}
XML_Bool XMLCALL
XML_ParserReset(XML_Parser parser, const XML_Char *encodingName)
{
TAG *tStk;
OPEN_INTERNAL_ENTITY *openEntityList;
if (parentParser)
return XML_FALSE;
/* move tagStack to freeTagList */
tStk = tagStack;
while (tStk) {
TAG *tag = tStk;
tStk = tStk->parent;
tag->parent = freeTagList;
moveToFreeBindingList(parser, tag->bindings);
tag->bindings = NULL;
freeTagList = tag;
}
/* move openInternalEntities to freeInternalEntities */
openEntityList = openInternalEntities;
while (openEntityList) {
OPEN_INTERNAL_ENTITY *openEntity = openEntityList;
openEntityList = openEntity->next;
openEntity->next = freeInternalEntities;
freeInternalEntities = openEntity;
}
moveToFreeBindingList(parser, inheritedBindings);
FREE(unknownEncodingMem);
if (unknownEncodingRelease)
unknownEncodingRelease(unknownEncodingData);
poolClear(&tempPool);
poolClear(&temp2Pool);
parserInit(parser, encodingName);
dtdReset(_dtd, &parser->m_mem);
return setContext(parser, implicitContext);
}
enum XML_Status XMLCALL
XML_SetEncoding(XML_Parser parser, const XML_Char *encodingName)
{
/* Block after XML_Parse()/XML_ParseBuffer() has been called.
XXX There's no way for the caller to determine which of the
XXX possible error cases caused the XML_STATUS_ERROR return.
*/
if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED)
return XML_STATUS_ERROR;
if (encodingName == NULL)
protocolEncodingName = NULL;
else {
protocolEncodingName = poolCopyString(&tempPool, encodingName);
if (!protocolEncodingName)
return XML_STATUS_ERROR;
}
return XML_STATUS_OK;
}
XML_Parser XMLCALL
XML_ExternalEntityParserCreate(XML_Parser oldParser,
const XML_Char *context,
const XML_Char *encodingName)
{
XML_Parser parser = oldParser;
DTD *newDtd = NULL;
DTD *oldDtd = _dtd;
XML_StartElementHandler oldStartElementHandler = startElementHandler;
XML_EndElementHandler oldEndElementHandler = endElementHandler;
XML_CharacterDataHandler oldCharacterDataHandler = characterDataHandler;
XML_ProcessingInstructionHandler oldProcessingInstructionHandler
= processingInstructionHandler;
XML_CommentHandler oldCommentHandler = commentHandler;
XML_StartCdataSectionHandler oldStartCdataSectionHandler
= startCdataSectionHandler;
XML_EndCdataSectionHandler oldEndCdataSectionHandler
= endCdataSectionHandler;
XML_DefaultHandler oldDefaultHandler = defaultHandler;
XML_UnparsedEntityDeclHandler oldUnparsedEntityDeclHandler
= unparsedEntityDeclHandler;
XML_NotationDeclHandler oldNotationDeclHandler = notationDeclHandler;
XML_StartNamespaceDeclHandler oldStartNamespaceDeclHandler
= startNamespaceDeclHandler;
XML_EndNamespaceDeclHandler oldEndNamespaceDeclHandler
= endNamespaceDeclHandler;
XML_NotStandaloneHandler oldNotStandaloneHandler = notStandaloneHandler;
XML_ExternalEntityRefHandler oldExternalEntityRefHandler
= externalEntityRefHandler;
XML_SkippedEntityHandler oldSkippedEntityHandler = skippedEntityHandler;
XML_UnknownEncodingHandler oldUnknownEncodingHandler
= unknownEncodingHandler;
XML_ElementDeclHandler oldElementDeclHandler = elementDeclHandler;
XML_AttlistDeclHandler oldAttlistDeclHandler = attlistDeclHandler;
XML_EntityDeclHandler oldEntityDeclHandler = entityDeclHandler;
XML_XmlDeclHandler oldXmlDeclHandler = xmlDeclHandler;
ELEMENT_TYPE * oldDeclElementType = declElementType;
void *oldUserData = userData;
void *oldHandlerArg = handlerArg;
XML_Bool oldDefaultExpandInternalEntities = defaultExpandInternalEntities;
XML_Parser oldExternalEntityRefHandlerArg = externalEntityRefHandlerArg;
#ifdef XML_DTD
enum XML_ParamEntityParsing oldParamEntityParsing = paramEntityParsing;
int oldInEntityValue = prologState.inEntityValue;
#endif
XML_Bool oldns_triplets = ns_triplets;
#ifdef XML_DTD
if (!context)
newDtd = oldDtd;
#endif /* XML_DTD */
/* Note that the magical uses of the pre-processor to make field
access look more like C++ require that `parser' be overwritten
here. This makes this function more painful to follow than it
would be otherwise.
*/
if (ns) {
XML_Char tmp[2];
*tmp = namespaceSeparator;
parser = parserCreate(encodingName, &parser->m_mem, tmp, newDtd);
}
else {
parser = parserCreate(encodingName, &parser->m_mem, NULL, newDtd);
}
if (!parser)
return NULL;
startElementHandler = oldStartElementHandler;
endElementHandler = oldEndElementHandler;
characterDataHandler = oldCharacterDataHandler;
processingInstructionHandler = oldProcessingInstructionHandler;
commentHandler = oldCommentHandler;
startCdataSectionHandler = oldStartCdataSectionHandler;
endCdataSectionHandler = oldEndCdataSectionHandler;
defaultHandler = oldDefaultHandler;
unparsedEntityDeclHandler = oldUnparsedEntityDeclHandler;
notationDeclHandler = oldNotationDeclHandler;
startNamespaceDeclHandler = oldStartNamespaceDeclHandler;
endNamespaceDeclHandler = oldEndNamespaceDeclHandler;
notStandaloneHandler = oldNotStandaloneHandler;
externalEntityRefHandler = oldExternalEntityRefHandler;
skippedEntityHandler = oldSkippedEntityHandler;
unknownEncodingHandler = oldUnknownEncodingHandler;
elementDeclHandler = oldElementDeclHandler;
attlistDeclHandler = oldAttlistDeclHandler;
entityDeclHandler = oldEntityDeclHandler;
xmlDeclHandler = oldXmlDeclHandler;
declElementType = oldDeclElementType;
userData = oldUserData;
if (oldUserData == oldHandlerArg)
handlerArg = userData;
else
handlerArg = parser;
if (oldExternalEntityRefHandlerArg != oldParser)
externalEntityRefHandlerArg = oldExternalEntityRefHandlerArg;
defaultExpandInternalEntities = oldDefaultExpandInternalEntities;
ns_triplets = oldns_triplets;
parentParser = oldParser;
#ifdef XML_DTD
paramEntityParsing = oldParamEntityParsing;
prologState.inEntityValue = oldInEntityValue;
if (context) {
#endif /* XML_DTD */
if (!dtdCopy(_dtd, oldDtd, &parser->m_mem)
|| !setContext(parser, context)) {
XML_ParserFree(parser);
return NULL;
}
processor = externalEntityInitProcessor;
#ifdef XML_DTD
}
else {
/* The DTD instance referenced by _dtd is shared between the document's
root parser and external PE parsers, therefore one does not need to
call setContext. In addition, one also *must* not call setContext,
because this would overwrite existing prefix->binding pointers in
_dtd with ones that get destroyed with the external PE parser.
This would leave those prefixes with dangling pointers.
*/
isParamEntity = XML_TRUE;
XmlPrologStateInitExternalEntity(&prologState);
processor = externalParEntInitProcessor;
}
#endif /* XML_DTD */
return parser;
}
static void FASTCALL
destroyBindings(BINDING *bindings, XML_Parser parser)
{
for (;;) {
BINDING *b = bindings;
if (!b)
break;
bindings = b->nextTagBinding;
FREE(b->uri);
FREE(b);
}
}
void XMLCALL
XML_ParserFree(XML_Parser parser)
{
TAG *tagList;
OPEN_INTERNAL_ENTITY *entityList;
if (parser == NULL)
return;
/* free tagStack and freeTagList */
tagList = tagStack;
for (;;) {
TAG *p;
if (tagList == NULL) {
if (freeTagList == NULL)
break;
tagList = freeTagList;
freeTagList = NULL;
}
p = tagList;
tagList = tagList->parent;
FREE(p->buf);
destroyBindings(p->bindings, parser);
FREE(p);
}
/* free openInternalEntities and freeInternalEntities */
entityList = openInternalEntities;
for (;;) {
OPEN_INTERNAL_ENTITY *openEntity;
if (entityList == NULL) {
if (freeInternalEntities == NULL)
break;
entityList = freeInternalEntities;
freeInternalEntities = NULL;
}
openEntity = entityList;
entityList = entityList->next;
FREE(openEntity);
}
destroyBindings(freeBindingList, parser);
destroyBindings(inheritedBindings, parser);
poolDestroy(&tempPool);
poolDestroy(&temp2Pool);
#ifdef XML_DTD
/* external parameter entity parsers share the DTD structure
parser->m_dtd with the root parser, so we must not destroy it
*/
if (!isParamEntity && _dtd)
#else
if (_dtd)
#endif /* XML_DTD */
dtdDestroy(_dtd, (XML_Bool)!parentParser, &parser->m_mem);
FREE((void *)atts);
FREE(groupConnector);
FREE(buffer);
FREE(dataBuf);
FREE(nsAtts);
FREE(unknownEncodingMem);
if (unknownEncodingRelease)
unknownEncodingRelease(unknownEncodingData);
FREE(parser);
}
void XMLCALL
XML_UseParserAsHandlerArg(XML_Parser parser)
{
handlerArg = parser;
}
enum XML_Error XMLCALL
XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD)
{
#ifdef XML_DTD
/* block after XML_Parse()/XML_ParseBuffer() has been called */
if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED)
return XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING;
useForeignDTD = useDTD;
return XML_ERROR_NONE;
#else
return XML_ERROR_FEATURE_REQUIRES_XML_DTD;
#endif
}
void XMLCALL
XML_SetReturnNSTriplet(XML_Parser parser, int do_nst)
{
/* block after XML_Parse()/XML_ParseBuffer() has been called */
if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED)
return;
ns_triplets = do_nst ? XML_TRUE : XML_FALSE;
}
void XMLCALL
XML_SetUserData(XML_Parser parser, void *p)
{
if (handlerArg == userData)
handlerArg = userData = p;
else
userData = p;
}
enum XML_Status XMLCALL
XML_SetBase(XML_Parser parser, const XML_Char *p)
{
if (p) {
p = poolCopyString(&_dtd->pool, p);
if (!p)
return XML_STATUS_ERROR;
curBase = p;
}
else
curBase = NULL;
return XML_STATUS_OK;
}
const XML_Char * XMLCALL
XML_GetBase(XML_Parser parser)
{
return curBase;
}
int XMLCALL
XML_GetSpecifiedAttributeCount(XML_Parser parser)
{
return nSpecifiedAtts;
}
int XMLCALL
XML_GetIdAttributeIndex(XML_Parser parser)
{
return idAttIndex;
}
void XMLCALL
XML_SetElementHandler(XML_Parser parser,
XML_StartElementHandler start,
XML_EndElementHandler end)
{
startElementHandler = start;
endElementHandler = end;
}
void XMLCALL
XML_SetStartElementHandler(XML_Parser parser,
XML_StartElementHandler start) {
startElementHandler = start;
}
void XMLCALL
XML_SetEndElementHandler(XML_Parser parser,
XML_EndElementHandler end) {
endElementHandler = end;
}
void XMLCALL
XML_SetCharacterDataHandler(XML_Parser parser,
XML_CharacterDataHandler handler)
{
characterDataHandler = handler;
}
void XMLCALL
XML_SetProcessingInstructionHandler(XML_Parser parser,
XML_ProcessingInstructionHandler handler)
{
processingInstructionHandler = handler;
}
void XMLCALL
XML_SetCommentHandler(XML_Parser parser,
XML_CommentHandler handler)
{
commentHandler = handler;
}
void XMLCALL
XML_SetCdataSectionHandler(XML_Parser parser,
XML_StartCdataSectionHandler start,
XML_EndCdataSectionHandler end)
{
startCdataSectionHandler = start;
endCdataSectionHandler = end;
}
void XMLCALL
XML_SetStartCdataSectionHandler(XML_Parser parser,
XML_StartCdataSectionHandler start) {
startCdataSectionHandler = start;
}
void XMLCALL
XML_SetEndCdataSectionHandler(XML_Parser parser,
XML_EndCdataSectionHandler end) {
endCdataSectionHandler = end;
}
void XMLCALL
XML_SetDefaultHandler(XML_Parser parser,
XML_DefaultHandler handler)
{
defaultHandler = handler;
defaultExpandInternalEntities = XML_FALSE;
}
void XMLCALL
XML_SetDefaultHandlerExpand(XML_Parser parser,
XML_DefaultHandler handler)
{
defaultHandler = handler;
defaultExpandInternalEntities = XML_TRUE;
}
void XMLCALL
XML_SetDoctypeDeclHandler(XML_Parser parser,
XML_StartDoctypeDeclHandler start,
XML_EndDoctypeDeclHandler end)
{
startDoctypeDeclHandler = start;
endDoctypeDeclHandler = end;
}
void XMLCALL
XML_SetStartDoctypeDeclHandler(XML_Parser parser,
XML_StartDoctypeDeclHandler start) {
startDoctypeDeclHandler = start;
}
void XMLCALL
XML_SetEndDoctypeDeclHandler(XML_Parser parser,
XML_EndDoctypeDeclHandler end) {
endDoctypeDeclHandler = end;
}
void XMLCALL
XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
XML_UnparsedEntityDeclHandler handler)
{
unparsedEntityDeclHandler = handler;
}
void XMLCALL
XML_SetNotationDeclHandler(XML_Parser parser,
XML_NotationDeclHandler handler)
{
notationDeclHandler = handler;
}
void XMLCALL
XML_SetNamespaceDeclHandler(XML_Parser parser,
XML_StartNamespaceDeclHandler start,
XML_EndNamespaceDeclHandler end)
{
startNamespaceDeclHandler = start;
endNamespaceDeclHandler = end;
}
void XMLCALL
XML_SetStartNamespaceDeclHandler(XML_Parser parser,
XML_StartNamespaceDeclHandler start) {
startNamespaceDeclHandler = start;
}
void XMLCALL
XML_SetEndNamespaceDeclHandler(XML_Parser parser,
XML_EndNamespaceDeclHandler end) {
endNamespaceDeclHandler = end;
}
void XMLCALL
XML_SetNotStandaloneHandler(XML_Parser parser,
XML_NotStandaloneHandler handler)
{
notStandaloneHandler = handler;
}
void XMLCALL
XML_SetExternalEntityRefHandler(XML_Parser parser,
XML_ExternalEntityRefHandler handler)
{
externalEntityRefHandler = handler;
}
void XMLCALL
XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg)
{
if (arg)
externalEntityRefHandlerArg = (XML_Parser)arg;
else
externalEntityRefHandlerArg = parser;
}
void XMLCALL
XML_SetSkippedEntityHandler(XML_Parser parser,
XML_SkippedEntityHandler handler)
{
skippedEntityHandler = handler;
}
void XMLCALL
XML_SetUnknownEncodingHandler(XML_Parser parser,
XML_UnknownEncodingHandler handler,
void *data)
{
unknownEncodingHandler = handler;
unknownEncodingHandlerData = data;
}
void XMLCALL
XML_SetElementDeclHandler(XML_Parser parser,
XML_ElementDeclHandler eldecl)
{
elementDeclHandler = eldecl;
}
void XMLCALL
XML_SetAttlistDeclHandler(XML_Parser parser,
XML_AttlistDeclHandler attdecl)
{
attlistDeclHandler = attdecl;
}
void XMLCALL
XML_SetEntityDeclHandler(XML_Parser parser,
XML_EntityDeclHandler handler)
{
entityDeclHandler = handler;
}
void XMLCALL
XML_SetXmlDeclHandler(XML_Parser parser,
XML_XmlDeclHandler handler) {
xmlDeclHandler = handler;
}
int XMLCALL
XML_SetParamEntityParsing(XML_Parser parser,
enum XML_ParamEntityParsing peParsing)
{
/* block after XML_Parse()/XML_ParseBuffer() has been called */
if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED)
return 0;
#ifdef XML_DTD
paramEntityParsing = peParsing;
return 1;
#else
return peParsing == XML_PARAM_ENTITY_PARSING_NEVER;
#endif
}
enum XML_Status XMLCALL
XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
{
switch (ps_parsing) {
case XML_SUSPENDED:
errorCode = XML_ERROR_SUSPENDED;
return XML_STATUS_ERROR;
case XML_FINISHED:
errorCode = XML_ERROR_FINISHED;
return XML_STATUS_ERROR;
default:
ps_parsing = XML_PARSING;
}
if (len == 0) {
ps_finalBuffer = (XML_Bool)isFinal;
if (!isFinal)
return XML_STATUS_OK;
positionPtr = bufferPtr;
parseEndPtr = bufferEnd;
/* If data are left over from last buffer, and we now know that these
data are the final chunk of input, then we have to check them again
to detect errors based on that fact.
*/
errorCode = processor(parser, bufferPtr, parseEndPtr, &bufferPtr);
if (errorCode == XML_ERROR_NONE) {
switch (ps_parsing) {
case XML_SUSPENDED:
XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position);
positionPtr = bufferPtr;
return XML_STATUS_SUSPENDED;
case XML_INITIALIZED:
case XML_PARSING:
ps_parsing = XML_FINISHED;
/* fall through */
default:
return XML_STATUS_OK;
}
}
eventEndPtr = eventPtr;
processor = errorProcessor;
return XML_STATUS_ERROR;
}
#ifndef XML_CONTEXT_BYTES
else if (bufferPtr == bufferEnd) {
const char *end;
int nLeftOver;
enum XML_Error result;
parseEndByteIndex += len;
positionPtr = s;
ps_finalBuffer = (XML_Bool)isFinal;
errorCode = processor(parser, s, parseEndPtr = s + len, &end);
if (errorCode != XML_ERROR_NONE) {
eventEndPtr = eventPtr;
processor = errorProcessor;
return XML_STATUS_ERROR;
}
else {
switch (ps_parsing) {
case XML_SUSPENDED:
result = XML_STATUS_SUSPENDED;
break;
case XML_INITIALIZED:
case XML_PARSING:
result = XML_STATUS_OK;
if (isFinal) {
ps_parsing = XML_FINISHED;
return result;
}
}
}
XmlUpdatePosition(encoding, positionPtr, end, &position);
nLeftOver = s + len - end;
if (nLeftOver) {
if (buffer == NULL || nLeftOver > bufferLim - buffer) {
/* FIXME avoid integer overflow */
char *temp;
temp = (buffer == NULL
? (char *)MALLOC(len * 2)
: (char *)REALLOC(buffer, len * 2));
if (temp == NULL) {
errorCode = XML_ERROR_NO_MEMORY;
eventPtr = eventEndPtr = NULL;
processor = errorProcessor;
return XML_STATUS_ERROR;
}
buffer = temp;
bufferLim = buffer + len * 2;
}
memcpy(buffer, end, nLeftOver);
}
bufferPtr = buffer;
bufferEnd = buffer + nLeftOver;
positionPtr = bufferPtr;
parseEndPtr = bufferEnd;
eventPtr = bufferPtr;
eventEndPtr = bufferPtr;
return result;
}
#endif /* not defined XML_CONTEXT_BYTES */
else {
void *buff = XML_GetBuffer(parser, len);
if (buff == NULL)
return XML_STATUS_ERROR;
else {
memcpy(buff, s, len);
return XML_ParseBuffer(parser, len, isFinal);
}
}
}
enum XML_Status XMLCALL
XML_ParseBuffer(XML_Parser parser, int len, int isFinal)
{
const char *start;
enum XML_Status result = XML_STATUS_OK;
switch (ps_parsing) {
case XML_SUSPENDED:
errorCode = XML_ERROR_SUSPENDED;
return XML_STATUS_ERROR;
case XML_FINISHED:
errorCode = XML_ERROR_FINISHED;
return XML_STATUS_ERROR;
default:
ps_parsing = XML_PARSING;
}
start = bufferPtr;
positionPtr = start;
bufferEnd += len;
parseEndPtr = bufferEnd;
parseEndByteIndex += len;
ps_finalBuffer = (XML_Bool)isFinal;
errorCode = processor(parser, start, parseEndPtr, &bufferPtr);
if (errorCode != XML_ERROR_NONE) {
eventEndPtr = eventPtr;
processor = errorProcessor;
return XML_STATUS_ERROR;
}
else {
switch (ps_parsing) {
case XML_SUSPENDED:
result = XML_STATUS_SUSPENDED;
break;
case XML_INITIALIZED:
case XML_PARSING:
if (isFinal) {
ps_parsing = XML_FINISHED;
return result;
}
default: ; /* should not happen */
}
}
XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position);
positionPtr = bufferPtr;
return result;
}
void * XMLCALL
XML_GetBuffer(XML_Parser parser, int len)
{
switch (ps_parsing) {
case XML_SUSPENDED:
errorCode = XML_ERROR_SUSPENDED;
return NULL;
case XML_FINISHED:
errorCode = XML_ERROR_FINISHED;
return NULL;
default: ;
}
if (len > bufferLim - bufferEnd) {
/* FIXME avoid integer overflow */
int neededSize = len + (int)(bufferEnd - bufferPtr);
#ifdef XML_CONTEXT_BYTES
int keep = (int)(bufferPtr - buffer);
if (keep > XML_CONTEXT_BYTES)
keep = XML_CONTEXT_BYTES;
neededSize += keep;
#endif /* defined XML_CONTEXT_BYTES */
if (neededSize <= bufferLim - buffer) {
#ifdef XML_CONTEXT_BYTES
if (keep < bufferPtr - buffer) {
int offset = (int)(bufferPtr - buffer) - keep;
memmove(buffer, &buffer[offset], bufferEnd - bufferPtr + keep);
bufferEnd -= offset;
bufferPtr -= offset;
}
#else
memmove(buffer, bufferPtr, bufferEnd - bufferPtr);
bufferEnd = buffer + (bufferEnd - bufferPtr);
bufferPtr = buffer;
#endif /* not defined XML_CONTEXT_BYTES */
}
else {
char *newBuf;
int bufferSize = (int)(bufferLim - bufferPtr);
if (bufferSize == 0)
bufferSize = INIT_BUFFER_SIZE;
do {
bufferSize *= 2;
} while (bufferSize < neededSize);
newBuf = (char *)MALLOC(bufferSize);
if (newBuf == 0) {
errorCode = XML_ERROR_NO_MEMORY;
return NULL;
}
bufferLim = newBuf + bufferSize;
#ifdef XML_CONTEXT_BYTES
if (bufferPtr) {
int keep = (int)(bufferPtr - buffer);
if (keep > XML_CONTEXT_BYTES)
keep = XML_CONTEXT_BYTES;
memcpy(newBuf, &bufferPtr[-keep], bufferEnd - bufferPtr + keep);
FREE(buffer);
buffer = newBuf;
bufferEnd = buffer + (bufferEnd - bufferPtr) + keep;
bufferPtr = buffer + keep;
}
else {
bufferEnd = newBuf + (bufferEnd - bufferPtr);
bufferPtr = buffer = newBuf;
}
#else
if (bufferPtr) {
memcpy(newBuf, bufferPtr, bufferEnd - bufferPtr);
FREE(buffer);
}
bufferEnd = newBuf + (bufferEnd - bufferPtr);
bufferPtr = buffer = newBuf;
#endif /* not defined XML_CONTEXT_BYTES */
}
eventPtr = eventEndPtr = NULL;
positionPtr = NULL;
}
return bufferEnd;
}
enum XML_Status XMLCALL
XML_StopParser(XML_Parser parser, XML_Bool resumable)
{
switch (ps_parsing) {
case XML_SUSPENDED:
if (resumable) {
errorCode = XML_ERROR_SUSPENDED;
return XML_STATUS_ERROR;
}
ps_parsing = XML_FINISHED;
break;
case XML_FINISHED:
errorCode = XML_ERROR_FINISHED;
return XML_STATUS_ERROR;
default:
if (resumable) {
#ifdef XML_DTD
if (isParamEntity) {
errorCode = XML_ERROR_SUSPEND_PE;
return XML_STATUS_ERROR;
}
#endif
ps_parsing = XML_SUSPENDED;
}
else
ps_parsing = XML_FINISHED;
}
return XML_STATUS_OK;
}
enum XML_Status XMLCALL
XML_ResumeParser(XML_Parser parser)
{
enum XML_Status result = XML_STATUS_OK;
if (ps_parsing != XML_SUSPENDED) {
errorCode = XML_ERROR_NOT_SUSPENDED;
return XML_STATUS_ERROR;
}
ps_parsing = XML_PARSING;
errorCode = processor(parser, bufferPtr, parseEndPtr, &bufferPtr);
if (errorCode != XML_ERROR_NONE) {
eventEndPtr = eventPtr;
processor = errorProcessor;
return XML_STATUS_ERROR;
}
else {
switch (ps_parsing) {
case XML_SUSPENDED:
result = XML_STATUS_SUSPENDED;
break;
case XML_INITIALIZED:
case XML_PARSING:
if (ps_finalBuffer) {
ps_parsing = XML_FINISHED;
return result;
}
default: ;
}
}
XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position);
positionPtr = bufferPtr;
return result;
}
void XMLCALL
XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status)
{
assert(status != NULL);
*status = parser->m_parsingStatus;
}
enum XML_Error XMLCALL
XML_GetErrorCode(XML_Parser parser)
{
return errorCode;
}
XML_Index XMLCALL
XML_GetCurrentByteIndex(XML_Parser parser)
{
if (eventPtr)
return parseEndByteIndex - (parseEndPtr - eventPtr);
return -1;
}
int XMLCALL
XML_GetCurrentByteCount(XML_Parser parser)
{
if (eventEndPtr && eventPtr)
return (int)(eventEndPtr - eventPtr);
return 0;
}
const char * XMLCALL
XML_GetInputContext(XML_Parser parser, int *offset, int *size)
{
#ifdef XML_CONTEXT_BYTES
if (eventPtr && buffer) {
*offset = (int)(eventPtr - buffer);
*size = (int)(bufferEnd - buffer);
return buffer;
}
#endif /* defined XML_CONTEXT_BYTES */
return (char *) 0;
}
XML_Size XMLCALL
XML_GetCurrentLineNumber(XML_Parser parser)
{
if (eventPtr && eventPtr >= positionPtr) {
XmlUpdatePosition(encoding, positionPtr, eventPtr, &position);
positionPtr = eventPtr;
}
return position.lineNumber + 1;
}
XML_Size XMLCALL
XML_GetCurrentColumnNumber(XML_Parser parser)
{
if (eventPtr && eventPtr >= positionPtr) {
XmlUpdatePosition(encoding, positionPtr, eventPtr, &position);
positionPtr = eventPtr;
}
return position.columnNumber;
}
void XMLCALL
XML_FreeContentModel(XML_Parser parser, XML_Content *model)
{
FREE(model);
}
void * XMLCALL
XML_MemMalloc(XML_Parser parser, size_t size)
{
return MALLOC(size);
}
void * XMLCALL
XML_MemRealloc(XML_Parser parser, void *ptr, size_t size)
{
return REALLOC(ptr, size);
}
void XMLCALL
XML_MemFree(XML_Parser parser, void *ptr)
{
FREE(ptr);
}
void XMLCALL
XML_DefaultCurrent(XML_Parser parser)
{
if (defaultHandler) {
if (openInternalEntities)
reportDefault(parser,
internalEncoding,
openInternalEntities->internalEventPtr,
openInternalEntities->internalEventEndPtr);
else
reportDefault(parser, encoding, eventPtr, eventEndPtr);
}
}
const XML_LChar * XMLCALL
XML_ErrorString(enum XML_Error code)
{
static const XML_LChar* const message[] = {
0,
XML_L("out of memory"),
XML_L("syntax error"),
XML_L("no element found"),
XML_L("not well-formed (invalid token)"),
XML_L("unclosed token"),
XML_L("partial character"),
XML_L("mismatched tag"),
XML_L("duplicate attribute"),
XML_L("junk after document element"),
XML_L("illegal parameter entity reference"),
XML_L("undefined entity"),
XML_L("recursive entity reference"),
XML_L("asynchronous entity"),
XML_L("reference to invalid character number"),
XML_L("reference to binary entity"),
XML_L("reference to external entity in attribute"),
XML_L("XML or text declaration not at start of entity"),
XML_L("unknown encoding"),
XML_L("encoding specified in XML declaration is incorrect"),
XML_L("unclosed CDATA section"),
XML_L("error in processing external entity reference"),
XML_L("document is not standalone"),
XML_L("unexpected parser state - please send a bug report"),
XML_L("entity declared in parameter entity"),
XML_L("requested feature requires XML_DTD support in Expat"),
XML_L("cannot change setting once parsing has begun"),
XML_L("unbound prefix"),
XML_L("must not undeclare prefix"),
XML_L("incomplete markup in parameter entity"),
XML_L("XML declaration not well-formed"),
XML_L("text declaration not well-formed"),
XML_L("illegal character(s) in public id"),
XML_L("parser suspended"),
XML_L("parser not suspended"),
XML_L("parsing aborted"),
XML_L("parsing finished"),
XML_L("cannot suspend in external parameter entity"),
XML_L("reserved prefix (xml) must not be undeclared or bound to another namespace name"),
XML_L("reserved prefix (xmlns) must not be declared or undeclared"),
XML_L("prefix must not be bound to one of the reserved namespace names")
};
if (code > 0 && code < sizeof(message)/sizeof(message[0]))
return message[code];
return NULL;
}
const XML_LChar * XMLCALL
XML_ExpatVersion(void) {
/* V1 is used to string-ize the version number. However, it would
string-ize the actual version macro *names* unless we get them
substituted before being passed to V1. CPP is defined to expand
a macro, then rescan for more expansions. Thus, we use V2 to expand
the version macros, then CPP will expand the resulting V1() macro
with the correct numerals. */
/* ### I'm assuming cpp is portable in this respect... */
#define V1(a,b,c) XML_L(#a)XML_L(".")XML_L(#b)XML_L(".")XML_L(#c)
#define V2(a,b,c) XML_L("expat_")V1(a,b,c)
return V2(XML_MAJOR_VERSION, XML_MINOR_VERSION, XML_MICRO_VERSION);
#undef V1
#undef V2
}
XML_Expat_Version XMLCALL
XML_ExpatVersionInfo(void)
{
XML_Expat_Version version;
version.major = XML_MAJOR_VERSION;
version.minor = XML_MINOR_VERSION;
version.micro = XML_MICRO_VERSION;
return version;
}
const XML_Feature * XMLCALL
XML_GetFeatureList(void)
{
static const XML_Feature features[] = {
{XML_FEATURE_SIZEOF_XML_CHAR, XML_L("sizeof(XML_Char)"),
sizeof(XML_Char)},
{XML_FEATURE_SIZEOF_XML_LCHAR, XML_L("sizeof(XML_LChar)"),
sizeof(XML_LChar)},
#ifdef XML_UNICODE
{XML_FEATURE_UNICODE, XML_L("XML_UNICODE"), 0},
#endif
#ifdef XML_UNICODE_WCHAR_T
{XML_FEATURE_UNICODE_WCHAR_T, XML_L("XML_UNICODE_WCHAR_T"), 0},
#endif
#ifdef XML_DTD
{XML_FEATURE_DTD, XML_L("XML_DTD"), 0},
#endif
#ifdef XML_CONTEXT_BYTES
{XML_FEATURE_CONTEXT_BYTES, XML_L("XML_CONTEXT_BYTES"),
XML_CONTEXT_BYTES},
#endif
#ifdef XML_MIN_SIZE
{XML_FEATURE_MIN_SIZE, XML_L("XML_MIN_SIZE"), 0},
#endif
#ifdef XML_NS
{XML_FEATURE_NS, XML_L("XML_NS"), 0},
#endif
#ifdef XML_LARGE_SIZE
{XML_FEATURE_LARGE_SIZE, XML_L("XML_LARGE_SIZE"), 0},
#endif
{XML_FEATURE_END, NULL, 0}
};
return features;
}
/* Initially tag->rawName always points into the parse buffer;
for those TAG instances opened while the current parse buffer was
processed, and not yet closed, we need to store tag->rawName in a more
permanent location, since the parse buffer is about to be discarded.
*/
static XML_Bool
storeRawNames(XML_Parser parser)
{
TAG *tag = tagStack;
while (tag) {
int bufSize;
int nameLen = sizeof(XML_Char) * (tag->name.strLen + 1);
char *rawNameBuf = tag->buf + nameLen;
/* Stop if already stored. Since tagStack is a stack, we can stop
at the first entry that has already been copied; everything
below it in the stack is already been accounted for in a
previous call to this function.
*/
if (tag->rawName == rawNameBuf)
break;
/* For re-use purposes we need to ensure that the
size of tag->buf is a multiple of sizeof(XML_Char).
*/
bufSize = nameLen + ROUND_UP(tag->rawNameLength, sizeof(XML_Char));
if (bufSize > tag->bufEnd - tag->buf) {
char *temp = (char *)REALLOC(tag->buf, bufSize);
if (temp == NULL)
return XML_FALSE;
/* if tag->name.str points to tag->buf (only when namespace
processing is off) then we have to update it
*/
if (tag->name.str == (XML_Char *)tag->buf)
tag->name.str = (XML_Char *)temp;
/* if tag->name.localPart is set (when namespace processing is on)
then update it as well, since it will always point into tag->buf
*/
if (tag->name.localPart)
tag->name.localPart = (XML_Char *)temp + (tag->name.localPart -
(XML_Char *)tag->buf);
tag->buf = temp;
tag->bufEnd = temp + bufSize;
rawNameBuf = temp + nameLen;
}
memcpy(rawNameBuf, tag->rawName, tag->rawNameLength);
tag->rawName = rawNameBuf;
tag = tag->parent;
}
return XML_TRUE;
}
static enum XML_Error PTRCALL
contentProcessor(XML_Parser parser,
const char *start,
const char *end,
const char **endPtr)
{
enum XML_Error result = doContent(parser, 0, encoding, start, end,
endPtr, (XML_Bool)!ps_finalBuffer);
if (result == XML_ERROR_NONE) {
if (!storeRawNames(parser))
return XML_ERROR_NO_MEMORY;
}
return result;
}
static enum XML_Error PTRCALL
externalEntityInitProcessor(XML_Parser parser,
const char *start,
const char *end,
const char **endPtr)
{
enum XML_Error result = initializeEncoding(parser);
if (result != XML_ERROR_NONE)
return result;
processor = externalEntityInitProcessor2;
return externalEntityInitProcessor2(parser, start, end, endPtr);
}
static enum XML_Error PTRCALL
externalEntityInitProcessor2(XML_Parser parser,
const char *start,
const char *end,
const char **endPtr)
{
const char *next = start; /* XmlContentTok doesn't always set the last arg */
int tok = XmlContentTok(encoding, start, end, &next);
switch (tok) {
case XML_TOK_BOM:
/* If we are at the end of the buffer, this would cause the next stage,
i.e. externalEntityInitProcessor3, to pass control directly to
doContent (by detecting XML_TOK_NONE) without processing any xml text
declaration - causing the error XML_ERROR_MISPLACED_XML_PI in doContent.
*/
if (next == end && !ps_finalBuffer) {
*endPtr = next;
return XML_ERROR_NONE;
}
start = next;
break;
case XML_TOK_PARTIAL:
if (!ps_finalBuffer) {
*endPtr = start;
return XML_ERROR_NONE;
}
eventPtr = start;
return XML_ERROR_UNCLOSED_TOKEN;
case XML_TOK_PARTIAL_CHAR:
if (!ps_finalBuffer) {
*endPtr = start;
return XML_ERROR_NONE;
}
eventPtr = start;
return XML_ERROR_PARTIAL_CHAR;
}
processor = externalEntityInitProcessor3;
return externalEntityInitProcessor3(parser, start, end, endPtr);
}
static enum XML_Error PTRCALL
externalEntityInitProcessor3(XML_Parser parser,
const char *start,
const char *end,
const char **endPtr)
{
int tok;
const char *next = start; /* XmlContentTok doesn't always set the last arg */
eventPtr = start;
tok = XmlContentTok(encoding, start, end, &next);
eventEndPtr = next;
switch (tok) {
case XML_TOK_XML_DECL:
{
enum XML_Error result;
result = processXmlDecl(parser, 1, start, next);
if (result != XML_ERROR_NONE)
return result;
switch (ps_parsing) {
case XML_SUSPENDED:
*endPtr = next;
return XML_ERROR_NONE;
case XML_FINISHED:
return XML_ERROR_ABORTED;
default:
start = next;
}
}
break;
case XML_TOK_PARTIAL:
if (!ps_finalBuffer) {
*endPtr = start;
return XML_ERROR_NONE;
}
return XML_ERROR_UNCLOSED_TOKEN;
case XML_TOK_PARTIAL_CHAR:
if (!ps_finalBuffer) {
*endPtr = start;
return XML_ERROR_NONE;
}
return XML_ERROR_PARTIAL_CHAR;
}
processor = externalEntityContentProcessor;
tagLevel = 1;
return externalEntityContentProcessor(parser, start, end, endPtr);
}
static enum XML_Error PTRCALL
externalEntityContentProcessor(XML_Parser parser,
const char *start,
const char *end,
const char **endPtr)
{
enum XML_Error result = doContent(parser, 1, encoding, start, end,
endPtr, (XML_Bool)!ps_finalBuffer);
if (result == XML_ERROR_NONE) {
if (!storeRawNames(parser))
return XML_ERROR_NO_MEMORY;
}
return result;
}
static enum XML_Error
doContent(XML_Parser parser,
int startTagLevel,
const ENCODING *enc,
const char *s,
const char *end,
const char **nextPtr,
XML_Bool haveMore)
{
/* save one level of indirection */
DTD * const dtd = _dtd;
const char **eventPP;
const char **eventEndPP;
if (enc == encoding) {
eventPP = &eventPtr;
eventEndPP = &eventEndPtr;
}
else {
eventPP = &(openInternalEntities->internalEventPtr);
eventEndPP = &(openInternalEntities->internalEventEndPtr);
}
*eventPP = s;
for (;;) {
const char *next = s; /* XmlContentTok doesn't always set the last arg */
int tok = XmlContentTok(enc, s, end, &next);
*eventEndPP = next;
switch (tok) {
case XML_TOK_TRAILING_CR:
if (haveMore) {
*nextPtr = s;
return XML_ERROR_NONE;
}
*eventEndPP = end;
if (characterDataHandler) {
XML_Char c = 0xA;
characterDataHandler(handlerArg, &c, 1);
}
else if (defaultHandler)
reportDefault(parser, enc, s, end);
/* We are at the end of the final buffer, should we check for
XML_SUSPENDED, XML_FINISHED?
*/
if (startTagLevel == 0)
return XML_ERROR_NO_ELEMENTS;
if (tagLevel != startTagLevel)
return XML_ERROR_ASYNC_ENTITY;
*nextPtr = end;
return XML_ERROR_NONE;
case XML_TOK_NONE:
if (haveMore) {
*nextPtr = s;
return XML_ERROR_NONE;
}
if (startTagLevel > 0) {
if (tagLevel != startTagLevel)
return XML_ERROR_ASYNC_ENTITY;
*nextPtr = s;
return XML_ERROR_NONE;
}
return XML_ERROR_NO_ELEMENTS;
case XML_TOK_INVALID:
*eventPP = next;
return XML_ERROR_INVALID_TOKEN;
case XML_TOK_PARTIAL:
if (haveMore) {
*nextPtr = s;
return XML_ERROR_NONE;
}
return XML_ERROR_UNCLOSED_TOKEN;
case XML_TOK_PARTIAL_CHAR:
if (haveMore) {
*nextPtr = s;
return XML_ERROR_NONE;
}
return XML_ERROR_PARTIAL_CHAR;
case XML_TOK_ENTITY_REF:
{
const XML_Char *name;
ENTITY *entity;
XML_Char ch = (XML_Char) XmlPredefinedEntityName(enc,
s + enc->minBytesPerChar,
next - enc->minBytesPerChar);
if (ch) {
if (characterDataHandler)
characterDataHandler(handlerArg, &ch, 1);
else if (defaultHandler)
reportDefault(parser, enc, s, next);
break;
}
name = poolStoreString(&dtd->pool, enc,
s + enc->minBytesPerChar,
next - enc->minBytesPerChar);
if (!name)
return XML_ERROR_NO_MEMORY;
entity = (ENTITY *)lookup(&dtd->generalEntities, name, 0);
poolDiscard(&dtd->pool);
/* First, determine if a check for an existing declaration is needed;
if yes, check that the entity exists, and that it is internal,
otherwise call the skipped entity or default handler.
*/
if (!dtd->hasParamEntityRefs || dtd->standalone) {
if (!entity)
return XML_ERROR_UNDEFINED_ENTITY;
else if (!entity->is_internal)
return XML_ERROR_ENTITY_DECLARED_IN_PE;
}
else if (!entity) {
if (skippedEntityHandler)
skippedEntityHandler(handlerArg, name, 0);
else if (defaultHandler)
reportDefault(parser, enc, s, next);
break;
}
if (entity->open)
return XML_ERROR_RECURSIVE_ENTITY_REF;
if (entity->notation)
return XML_ERROR_BINARY_ENTITY_REF;
if (entity->textPtr) {
enum XML_Error result;
if (!defaultExpandInternalEntities) {
if (skippedEntityHandler)
skippedEntityHandler(handlerArg, entity->name, 0);
else if (defaultHandler)
reportDefault(parser, enc, s, next);
break;
}
result = processInternalEntity(parser, entity, XML_FALSE);
if (result != XML_ERROR_NONE)
return result;
}
else if (externalEntityRefHandler) {
const XML_Char *context;
entity->open = XML_TRUE;
context = getContext(parser);
entity->open = XML_FALSE;
if (!context)
return XML_ERROR_NO_MEMORY;
if (!externalEntityRefHandler(externalEntityRefHandlerArg,
context,
entity->base,
entity->systemId,
entity->publicId))
return XML_ERROR_EXTERNAL_ENTITY_HANDLING;
poolDiscard(&tempPool);
}
else if (defaultHandler)
reportDefault(parser, enc, s, next);
break;
}
case XML_TOK_START_TAG_NO_ATTS:
/* fall through */
case XML_TOK_START_TAG_WITH_ATTS:
{
TAG *tag;
enum XML_Error result;
XML_Char *toPtr;
if (freeTagList) {
tag = freeTagList;
freeTagList = freeTagList->parent;
}
else {
tag = (TAG *)MALLOC(sizeof(TAG));
if (!tag)
return XML_ERROR_NO_MEMORY;
tag->buf = (char *)MALLOC(INIT_TAG_BUF_SIZE);
if (!tag->buf) {
FREE(tag);
return XML_ERROR_NO_MEMORY;
}
tag->bufEnd = tag->buf + INIT_TAG_BUF_SIZE;
}
tag->bindings = NULL;
tag->parent = tagStack;
tagStack = tag;
tag->name.localPart = NULL;
tag->name.prefix = NULL;
tag->rawName = s + enc->minBytesPerChar;
tag->rawNameLength = XmlNameLength(enc, tag->rawName);
++tagLevel;
{
const char *rawNameEnd = tag->rawName + tag->rawNameLength;
const char *fromPtr = tag->rawName;
toPtr = (XML_Char *)tag->buf;
for (;;) {
int bufSize;
int convLen;
XmlConvert(enc,
&fromPtr, rawNameEnd,
(ICHAR **)&toPtr, (ICHAR *)tag->bufEnd - 1);
convLen = (int)(toPtr - (XML_Char *)tag->buf);
if (fromPtr == rawNameEnd) {
tag->name.strLen = convLen;
break;
}
bufSize = (int)(tag->bufEnd - tag->buf) << 1;
{
char *temp = (char *)REALLOC(tag->buf, bufSize);
if (temp == NULL)
return XML_ERROR_NO_MEMORY;
tag->buf = temp;
tag->bufEnd = temp + bufSize;
toPtr = (XML_Char *)temp + convLen;
}
}
}
tag->name.str = (XML_Char *)tag->buf;
*toPtr = XML_T('\0');
result = storeAtts(parser, enc, s, &(tag->name), &(tag->bindings));
if (result)
return result;
if (startElementHandler)
startElementHandler(handlerArg, tag->name.str,
(const XML_Char **)atts);
else if (defaultHandler)
reportDefault(parser, enc, s, next);
poolClear(&tempPool);
break;
}
case XML_TOK_EMPTY_ELEMENT_NO_ATTS:
/* fall through */
case XML_TOK_EMPTY_ELEMENT_WITH_ATTS:
{
const char *rawName = s + enc->minBytesPerChar;
enum XML_Error result;
BINDING *bindings = NULL;
XML_Bool noElmHandlers = XML_TRUE;
TAG_NAME name;
name.str = poolStoreString(&tempPool, enc, rawName,
rawName + XmlNameLength(enc, rawName));
if (!name.str)
return XML_ERROR_NO_MEMORY;
poolFinish(&tempPool);
result = storeAtts(parser, enc, s, &name, &bindings);
if (result)
return result;
poolFinish(&tempPool);
if (startElementHandler) {
startElementHandler(handlerArg, name.str, (const XML_Char **)atts);
noElmHandlers = XML_FALSE;
}
if (endElementHandler) {
if (startElementHandler)
*eventPP = *eventEndPP;
endElementHandler(handlerArg, name.str);
noElmHandlers = XML_FALSE;
}
if (noElmHandlers && defaultHandler)
reportDefault(parser, enc, s, next);
poolClear(&tempPool);
while (bindings) {
BINDING *b = bindings;
if (endNamespaceDeclHandler)
endNamespaceDeclHandler(handlerArg, b->prefix->name);
bindings = bindings->nextTagBinding;
b->nextTagBinding = freeBindingList;
freeBindingList = b;
b->prefix->binding = b->prevPrefixBinding;
}
}
if (tagLevel == 0)
return epilogProcessor(parser, next, end, nextPtr);
break;
case XML_TOK_END_TAG:
if (tagLevel == startTagLevel)
return XML_ERROR_ASYNC_ENTITY;
else {
int len;
const char *rawName;
TAG *tag = tagStack;
tagStack = tag->parent;
tag->parent = freeTagList;
freeTagList = tag;
rawName = s + enc->minBytesPerChar*2;
len = XmlNameLength(enc, rawName);
if (len != tag->rawNameLength
|| memcmp(tag->rawName, rawName, len) != 0) {
*eventPP = rawName;
return XML_ERROR_TAG_MISMATCH;
}
--tagLevel;
if (endElementHandler) {
const XML_Char *localPart;
const XML_Char *prefix;
XML_Char *uri;
localPart = tag->name.localPart;
if (ns && localPart) {
/* localPart and prefix may have been overwritten in
tag->name.str, since this points to the binding->uri
buffer which gets re-used; so we have to add them again
*/
uri = (XML_Char *)tag->name.str + tag->name.uriLen;
/* don't need to check for space - already done in storeAtts() */
while (*localPart) *uri++ = *localPart++;
prefix = (XML_Char *)tag->name.prefix;
if (ns_triplets && prefix) {
*uri++ = namespaceSeparator;
while (*prefix) *uri++ = *prefix++;
}
*uri = XML_T('\0');
}
endElementHandler(handlerArg, tag->name.str);
}
else if (defaultHandler)
reportDefault(parser, enc, s, next);
while (tag->bindings) {
BINDING *b = tag->bindings;
if (endNamespaceDeclHandler)
endNamespaceDeclHandler(handlerArg, b->prefix->name);
tag->bindings = tag->bindings->nextTagBinding;
b->nextTagBinding = freeBindingList;
freeBindingList = b;
b->prefix->binding = b->prevPrefixBinding;
}
if (tagLevel == 0)
return epilogProcessor(parser, next, end, nextPtr);
}
break;
case XML_TOK_CHAR_REF:
{
int n = XmlCharRefNumber(enc, s);
if (n < 0)
return XML_ERROR_BAD_CHAR_REF;
if (characterDataHandler) {
XML_Char buf[XML_ENCODE_MAX];
characterDataHandler(handlerArg, buf, XmlEncode(n, (ICHAR *)buf));
}
else if (defaultHandler)
reportDefault(parser, enc, s, next);
}
break;
case XML_TOK_XML_DECL:
return XML_ERROR_MISPLACED_XML_PI;
case XML_TOK_DATA_NEWLINE:
if (characterDataHandler) {
XML_Char c = 0xA;
characterDataHandler(handlerArg, &c, 1);
}
else if (defaultHandler)
reportDefault(parser, enc, s, next);
break;
case XML_TOK_CDATA_SECT_OPEN:
{
enum XML_Error result;
if (startCdataSectionHandler)
startCdataSectionHandler(handlerArg);
#if 0
/* Suppose you doing a transformation on a document that involves
changing only the character data. You set up a defaultHandler
and a characterDataHandler. The defaultHandler simply copies
characters through. The characterDataHandler does the
transformation and writes the characters out escaping them as
necessary. This case will fail to work if we leave out the
following two lines (because & and < inside CDATA sections will
be incorrectly escaped).
However, now we have a start/endCdataSectionHandler, so it seems
easier to let the user deal with this.
*/
else if (characterDataHandler)
characterDataHandler(handlerArg, dataBuf, 0);
#endif
else if (defaultHandler)
reportDefault(parser, enc, s, next);
result = doCdataSection(parser, enc, &next, end, nextPtr, haveMore);
if (result != XML_ERROR_NONE)
return result;
else if (!next) {
processor = cdataSectionProcessor;
return result;
}
}
break;
case XML_TOK_TRAILING_RSQB:
if (haveMore) {
*nextPtr = s;
return XML_ERROR_NONE;
}
if (characterDataHandler) {
if (MUST_CONVERT(enc, s)) {
ICHAR *dataPtr = (ICHAR *)dataBuf;
XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd);
characterDataHandler(handlerArg, dataBuf,
(int)(dataPtr - (ICHAR *)dataBuf));
}
else
characterDataHandler(handlerArg,
(XML_Char *)s,
(int)((XML_Char *)end - (XML_Char *)s));
}
else if (defaultHandler)
reportDefault(parser, enc, s, end);
/* We are at the end of the final buffer, should we check for
XML_SUSPENDED, XML_FINISHED?
*/
if (startTagLevel == 0) {
*eventPP = end;
return XML_ERROR_NO_ELEMENTS;
}
if (tagLevel != startTagLevel) {
*eventPP = end;
return XML_ERROR_ASYNC_ENTITY;
}
*nextPtr = end;
return XML_ERROR_NONE;
case XML_TOK_DATA_CHARS:
{
XML_CharacterDataHandler charDataHandler = characterDataHandler;
if (charDataHandler) {
if (MUST_CONVERT(enc, s)) {
for (;;) {
ICHAR *dataPtr = (ICHAR *)dataBuf;
XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);
*eventEndPP = s;
charDataHandler(handlerArg, dataBuf,
(int)(dataPtr - (ICHAR *)dataBuf));
if (s == next)
break;
*eventPP = s;
}
}
else
charDataHandler(handlerArg,
(XML_Char *)s,
(int)((XML_Char *)next - (XML_Char *)s));
}
else if (defaultHandler)
reportDefault(parser, enc, s, next);
}
break;
case XML_TOK_PI:
if (!reportProcessingInstruction(parser, enc, s, next))
return XML_ERROR_NO_MEMORY;
break;
case XML_TOK_COMMENT:
if (!reportComment(parser, enc, s, next))
return XML_ERROR_NO_MEMORY;
break;
default:
if (defaultHandler)
reportDefault(parser, enc, s, next);
break;
}
*eventPP = s = next;
switch (ps_parsing) {
case XML_SUSPENDED:
*nextPtr = next;
return XML_ERROR_NONE;
case XML_FINISHED:
return XML_ERROR_ABORTED;
default: ;
}
}
/* not reached */
}
/* Precondition: all arguments must be non-NULL;
Purpose:
- normalize attributes
- check attributes for well-formedness
- generate namespace aware attribute names (URI, prefix)
- build list of attributes for startElementHandler
- default attributes
- process namespace declarations (check and report them)
- generate namespace aware element name (URI, prefix)
*/
static enum XML_Error
storeAtts(XML_Parser parser, const ENCODING *enc,
const char *attStr, TAG_NAME *tagNamePtr,
BINDING **bindingsPtr)
{
DTD * const dtd = _dtd; /* save one level of indirection */
ELEMENT_TYPE *elementType;
int nDefaultAtts;
const XML_Char **appAtts; /* the attribute list for the application */
int attIndex = 0;
int prefixLen;
int i;
int n;
XML_Char *uri;
int nPrefixes = 0;
BINDING *binding;
const XML_Char *localPart;
/* lookup the element type name */
elementType = (ELEMENT_TYPE *)lookup(&dtd->elementTypes, tagNamePtr->str,0);
if (!elementType) {
const XML_Char *name = poolCopyString(&dtd->pool, tagNamePtr->str);
if (!name)
return XML_ERROR_NO_MEMORY;
elementType = (ELEMENT_TYPE *)lookup(&dtd->elementTypes, name,
sizeof(ELEMENT_TYPE));
if (!elementType)
return XML_ERROR_NO_MEMORY;
if (ns && !setElementTypePrefix(parser, elementType))
return XML_ERROR_NO_MEMORY;
}
nDefaultAtts = elementType->nDefaultAtts;
/* get the attributes from the tokenizer */
n = XmlGetAttributes(enc, attStr, attsSize, atts);
if (n + nDefaultAtts > attsSize) {
int oldAttsSize = attsSize;
ATTRIBUTE *temp;
attsSize = n + nDefaultAtts + INIT_ATTS_SIZE;
temp = (ATTRIBUTE *)REALLOC((void *)atts, attsSize * sizeof(ATTRIBUTE));
if (temp == NULL)
return XML_ERROR_NO_MEMORY;
atts = temp;
if (n > oldAttsSize)
XmlGetAttributes(enc, attStr, n, atts);
}
appAtts = (const XML_Char **)atts;
for (i = 0; i < n; i++) {
/* add the name and value to the attribute list */
ATTRIBUTE_ID *attId = getAttributeId(parser, enc, atts[i].name,
atts[i].name
+ XmlNameLength(enc, atts[i].name));
if (!attId)
return XML_ERROR_NO_MEMORY;
/* Detect duplicate attributes by their QNames. This does not work when
namespace processing is turned on and different prefixes for the same
namespace are used. For this case we have a check further down.
*/
if ((attId->name)[-1]) {
if (enc == encoding)
eventPtr = atts[i].name;
return XML_ERROR_DUPLICATE_ATTRIBUTE;
}
(attId->name)[-1] = 1;
appAtts[attIndex++] = attId->name;
if (!atts[i].normalized) {
enum XML_Error result;
XML_Bool isCdata = XML_TRUE;
/* figure out whether declared as other than CDATA */
if (attId->maybeTokenized) {
int j;
for (j = 0; j < nDefaultAtts; j++) {
if (attId == elementType->defaultAtts[j].id) {
isCdata = elementType->defaultAtts[j].isCdata;
break;
}
}
}
/* normalize the attribute value */
result = storeAttributeValue(parser, enc, isCdata,
atts[i].valuePtr, atts[i].valueEnd,
&tempPool);
if (result)
return result;
appAtts[attIndex] = poolStart(&tempPool);
poolFinish(&tempPool);
}
else {
/* the value did not need normalizing */
appAtts[attIndex] = poolStoreString(&tempPool, enc, atts[i].valuePtr,
atts[i].valueEnd);
if (appAtts[attIndex] == 0)
return XML_ERROR_NO_MEMORY;
poolFinish(&tempPool);
}
/* handle prefixed attribute names */
if (attId->prefix) {
if (attId->xmlns) {
/* deal with namespace declarations here */
enum XML_Error result = addBinding(parser, attId->prefix, attId,
appAtts[attIndex], bindingsPtr);
if (result)
return result;
--attIndex;
}
else {
/* deal with other prefixed names later */
attIndex++;
nPrefixes++;
(attId->name)[-1] = 2;
}
}
else
attIndex++;
}
/* set-up for XML_GetSpecifiedAttributeCount and XML_GetIdAttributeIndex */
nSpecifiedAtts = attIndex;
if (elementType->idAtt && (elementType->idAtt->name)[-1]) {
for (i = 0; i < attIndex; i += 2)
if (appAtts[i] == elementType->idAtt->name) {
idAttIndex = i;
break;
}
}
else
idAttIndex = -1;
/* do attribute defaulting */
for (i = 0; i < nDefaultAtts; i++) {
const DEFAULT_ATTRIBUTE *da = elementType->defaultAtts + i;
if (!(da->id->name)[-1] && da->value) {
if (da->id->prefix) {
if (da->id->xmlns) {
enum XML_Error result = addBinding(parser, da->id->prefix, da->id,
da->value, bindingsPtr);
if (result)
return result;
}
else {
(da->id->name)[-1] = 2;
nPrefixes++;
appAtts[attIndex++] = da->id->name;
appAtts[attIndex++] = da->value;
}
}
else {
(da->id->name)[-1] = 1;
appAtts[attIndex++] = da->id->name;
appAtts[attIndex++] = da->value;
}
}
}
appAtts[attIndex] = 0;
/* expand prefixed attribute names, check for duplicates,
and clear flags that say whether attributes were specified */
i = 0;
if (nPrefixes) {
int j; /* hash table index */
unsigned long version = nsAttsVersion;
int nsAttsSize = (int)1 << nsAttsPower;
/* size of hash table must be at least 2 * (# of prefixed attributes) */
if ((nPrefixes << 1) >> nsAttsPower) { /* true for nsAttsPower = 0 */
NS_ATT *temp;
/* hash table size must also be a power of 2 and >= 8 */
while (nPrefixes >> nsAttsPower++);
if (nsAttsPower < 3)
nsAttsPower = 3;
nsAttsSize = (int)1 << nsAttsPower;
temp = (NS_ATT *)REALLOC(nsAtts, nsAttsSize * sizeof(NS_ATT));
if (!temp)
return XML_ERROR_NO_MEMORY;
nsAtts = temp;
version = 0; /* force re-initialization of nsAtts hash table */
}
/* using a version flag saves us from initializing nsAtts every time */
if (!version) { /* initialize version flags when version wraps around */
version = INIT_ATTS_VERSION;
for (j = nsAttsSize; j != 0; )
nsAtts[--j].version = version;
}
nsAttsVersion = --version;
/* expand prefixed names and check for duplicates */
for (; i < attIndex; i += 2) {
const XML_Char *s = appAtts[i];
if (s[-1] == 2) { /* prefixed */
ATTRIBUTE_ID *id;
const BINDING *b;
unsigned long uriHash = 0;
((XML_Char *)s)[-1] = 0; /* clear flag */
id = (ATTRIBUTE_ID *)lookup(&dtd->attributeIds, s, 0);
b = id->prefix->binding;
if (!b)
return XML_ERROR_UNBOUND_PREFIX;
/* as we expand the name we also calculate its hash value */
for (j = 0; j < b->uriLen; j++) {
const XML_Char c = b->uri[j];
if (!poolAppendChar(&tempPool, c))
return XML_ERROR_NO_MEMORY;
uriHash = CHAR_HASH(uriHash, c);
}
while (*s++ != XML_T(ASCII_COLON))
;
do { /* copies null terminator */
const XML_Char c = *s;
if (!poolAppendChar(&tempPool, *s))
return XML_ERROR_NO_MEMORY;
uriHash = CHAR_HASH(uriHash, c);
} while (*s++);
{ /* Check hash table for duplicate of expanded name (uriName).
Derived from code in lookup(HASH_TABLE *table, ...).
*/
unsigned char step = 0;
unsigned long mask = nsAttsSize - 1;
j = uriHash & mask; /* index into hash table */
while (nsAtts[j].version == version) {
/* for speed we compare stored hash values first */
if (uriHash == nsAtts[j].hash) {
const XML_Char *s1 = poolStart(&tempPool);
const XML_Char *s2 = nsAtts[j].uriName;
/* s1 is null terminated, but not s2 */
for (; *s1 == *s2 && *s1 != 0; s1++, s2++);
if (*s1 == 0)
return XML_ERROR_DUPLICATE_ATTRIBUTE;
}
if (!step)
step = PROBE_STEP(uriHash, mask, nsAttsPower);
j < step ? (j += nsAttsSize - step) : (j -= step);
}
}
if (ns_triplets) { /* append namespace separator and prefix */
tempPool.ptr[-1] = namespaceSeparator;
s = b->prefix->name;
do {
if (!poolAppendChar(&tempPool, *s))
return XML_ERROR_NO_MEMORY;
} while (*s++);
}
/* store expanded name in attribute list */
s = poolStart(&tempPool);
poolFinish(&tempPool);
appAtts[i] = s;
/* fill empty slot with new version, uriName and hash value */
nsAtts[j].version = version;
nsAtts[j].hash = uriHash;
nsAtts[j].uriName = s;
if (!--nPrefixes) {
i += 2;
break;
}
}
else /* not prefixed */
((XML_Char *)s)[-1] = 0; /* clear flag */
}
}
/* clear flags for the remaining attributes */
for (; i < attIndex; i += 2)
((XML_Char *)(appAtts[i]))[-1] = 0;
for (binding = *bindingsPtr; binding; binding = binding->nextTagBinding)
binding->attId->name[-1] = 0;
if (!ns)
return XML_ERROR_NONE;
/* expand the element type name */
if (elementType->prefix) {
binding = elementType->prefix->binding;
if (!binding)
return XML_ERROR_UNBOUND_PREFIX;
localPart = tagNamePtr->str;
while (*localPart++ != XML_T(ASCII_COLON))
;
}
else if (dtd->defaultPrefix.binding) {
binding = dtd->defaultPrefix.binding;
localPart = tagNamePtr->str;
}
else
return XML_ERROR_NONE;
prefixLen = 0;
if (ns_triplets && binding->prefix->name) {
for (; binding->prefix->name[prefixLen++];)
; /* prefixLen includes null terminator */
}
tagNamePtr->localPart = localPart;
tagNamePtr->uriLen = binding->uriLen;
tagNamePtr->prefix = binding->prefix->name;
tagNamePtr->prefixLen = prefixLen;
for (i = 0; localPart[i++];)
; /* i includes null terminator */
n = i + binding->uriLen + prefixLen;
if (n > binding->uriAlloc) {
TAG *p;
uri = (XML_Char *)MALLOC((n + EXPAND_SPARE) * sizeof(XML_Char));
if (!uri)
return XML_ERROR_NO_MEMORY;
binding->uriAlloc = n + EXPAND_SPARE;
memcpy(uri, binding->uri, binding->uriLen * sizeof(XML_Char));
for (p = tagStack; p; p = p->parent)
if (p->name.str == binding->uri)
p->name.str = uri;
FREE(binding->uri);
binding->uri = uri;
}
/* if namespaceSeparator != '\0' then uri includes it already */
uri = binding->uri + binding->uriLen;
memcpy(uri, localPart, i * sizeof(XML_Char));
/* we always have a namespace separator between localPart and prefix */
if (prefixLen) {
uri += i - 1;
*uri = namespaceSeparator; /* replace null terminator */
memcpy(uri + 1, binding->prefix->name, prefixLen * sizeof(XML_Char));
}
tagNamePtr->str = binding->uri;
return XML_ERROR_NONE;
}
/* addBinding() overwrites the value of prefix->binding without checking.
Therefore one must keep track of the old value outside of addBinding().
*/
static enum XML_Error
addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId,
const XML_Char *uri, BINDING **bindingsPtr)
{
static const XML_Char xmlNamespace[] = {
ASCII_h, ASCII_t, ASCII_t, ASCII_p, ASCII_COLON, ASCII_SLASH, ASCII_SLASH,
ASCII_w, ASCII_w, ASCII_w, ASCII_PERIOD, ASCII_w, ASCII_3, ASCII_PERIOD,
ASCII_o, ASCII_r, ASCII_g, ASCII_SLASH, ASCII_X, ASCII_M, ASCII_L,
ASCII_SLASH, ASCII_1, ASCII_9, ASCII_9, ASCII_8, ASCII_SLASH,
ASCII_n, ASCII_a, ASCII_m, ASCII_e, ASCII_s, ASCII_p, ASCII_a, ASCII_c,
ASCII_e, '\0'
};
static const int xmlLen =
(int)sizeof(xmlNamespace)/sizeof(XML_Char) - 1;
static const XML_Char xmlnsNamespace[] = {
ASCII_h, ASCII_t, ASCII_t, ASCII_p, ASCII_COLON, ASCII_SLASH, ASCII_SLASH,
ASCII_w, ASCII_w, ASCII_w, ASCII_PERIOD, ASCII_w, ASCII_3, ASCII_PERIOD,
ASCII_o, ASCII_r, ASCII_g, ASCII_SLASH, ASCII_2, ASCII_0, ASCII_0,
ASCII_0, ASCII_SLASH, ASCII_x, ASCII_m, ASCII_l, ASCII_n, ASCII_s,
ASCII_SLASH, '\0'
};
static const int xmlnsLen =
(int)sizeof(xmlnsNamespace)/sizeof(XML_Char) - 1;
XML_Bool mustBeXML = XML_FALSE;
XML_Bool isXML = XML_TRUE;
XML_Bool isXMLNS = XML_TRUE;
BINDING *b;
int len;
/* empty URI is only valid for default namespace per XML NS 1.0 (not 1.1) */
if (*uri == XML_T('\0') && prefix->name)
return XML_ERROR_UNDECLARING_PREFIX;
if (prefix->name
&& prefix->name[0] == XML_T(ASCII_x)
&& prefix->name[1] == XML_T(ASCII_m)
&& prefix->name[2] == XML_T(ASCII_l)) {
/* Not allowed to bind xmlns */
if (prefix->name[3] == XML_T(ASCII_n)
&& prefix->name[4] == XML_T(ASCII_s)
&& prefix->name[5] == XML_T('\0'))
return XML_ERROR_RESERVED_PREFIX_XMLNS;
if (prefix->name[3] == XML_T('\0'))
mustBeXML = XML_TRUE;
}
for (len = 0; uri[len]; len++) {
if (isXML && (len > xmlLen || uri[len] != xmlNamespace[len]))
isXML = XML_FALSE;
if (!mustBeXML && isXMLNS
&& (len > xmlnsLen || uri[len] != xmlnsNamespace[len]))
isXMLNS = XML_FALSE;
}
isXML = isXML && len == xmlLen;
isXMLNS = isXMLNS && len == xmlnsLen;
if (mustBeXML != isXML)
return mustBeXML ? XML_ERROR_RESERVED_PREFIX_XML
: XML_ERROR_RESERVED_NAMESPACE_URI;
if (isXMLNS)
return XML_ERROR_RESERVED_NAMESPACE_URI;
if (namespaceSeparator)
len++;
if (freeBindingList) {
b = freeBindingList;
if (len > b->uriAlloc) {
XML_Char *temp = (XML_Char *)REALLOC(b->uri,
sizeof(XML_Char) * (len + EXPAND_SPARE));
if (temp == NULL)
return XML_ERROR_NO_MEMORY;
b->uri = temp;
b->uriAlloc = len + EXPAND_SPARE;
}
freeBindingList = b->nextTagBinding;
}
else {
b = (BINDING *)MALLOC(sizeof(BINDING));
if (!b)
return XML_ERROR_NO_MEMORY;
b->uri = (XML_Char *)MALLOC(sizeof(XML_Char) * (len + EXPAND_SPARE));
if (!b->uri) {
FREE(b);
return XML_ERROR_NO_MEMORY;
}
b->uriAlloc = len + EXPAND_SPARE;
}
b->uriLen = len;
memcpy(b->uri, uri, len * sizeof(XML_Char));
if (namespaceSeparator)
b->uri[len - 1] = namespaceSeparator;
b->prefix = prefix;
b->attId = attId;
b->prevPrefixBinding = prefix->binding;
/* NULL binding when default namespace undeclared */
if (*uri == XML_T('\0') && prefix == &_dtd->defaultPrefix)
prefix->binding = NULL;
else
prefix->binding = b;
b->nextTagBinding = *bindingsPtr;
*bindingsPtr = b;
/* if attId == NULL then we are not starting a namespace scope */
if (attId && startNamespaceDeclHandler)
startNamespaceDeclHandler(handlerArg, prefix->name,
prefix->binding ? uri : 0);
return XML_ERROR_NONE;
}
/* The idea here is to avoid using stack for each CDATA section when
the whole file is parsed with one call.
*/
static enum XML_Error PTRCALL
cdataSectionProcessor(XML_Parser parser,
const char *start,
const char *end,
const char **endPtr)
{
enum XML_Error result = doCdataSection(parser, encoding, &start, end,
endPtr, (XML_Bool)!ps_finalBuffer);
if (result != XML_ERROR_NONE)
return result;
if (start) {
if (parentParser) { /* we are parsing an external entity */
processor = externalEntityContentProcessor;
return externalEntityContentProcessor(parser, start, end, endPtr);
}
else {
processor = contentProcessor;
return contentProcessor(parser, start, end, endPtr);
}
}
return result;
}
/* startPtr gets set to non-null if the section is closed, and to null if
the section is not yet closed.
*/
static enum XML_Error
doCdataSection(XML_Parser parser,
const ENCODING *enc,
const char **startPtr,
const char *end,
const char **nextPtr,
XML_Bool haveMore)
{
const char *s = *startPtr;
const char **eventPP;
const char **eventEndPP;
if (enc == encoding) {
eventPP = &eventPtr;
*eventPP = s;
eventEndPP = &eventEndPtr;
}
else {
eventPP = &(openInternalEntities->internalEventPtr);
eventEndPP = &(openInternalEntities->internalEventEndPtr);
}
*eventPP = s;
*startPtr = NULL;
for (;;) {
const char *next;
int tok = XmlCdataSectionTok(enc, s, end, &next);
*eventEndPP = next;
switch (tok) {
case XML_TOK_CDATA_SECT_CLOSE:
if (endCdataSectionHandler)
endCdataSectionHandler(handlerArg);
#if 0
/* see comment under XML_TOK_CDATA_SECT_OPEN */
else if (characterDataHandler)
characterDataHandler(handlerArg, dataBuf, 0);
#endif
else if (defaultHandler)
reportDefault(parser, enc, s, next);
*startPtr = next;
*nextPtr = next;
if (ps_parsing == XML_FINISHED)
return XML_ERROR_ABORTED;
else
return XML_ERROR_NONE;
case XML_TOK_DATA_NEWLINE:
if (characterDataHandler) {
XML_Char c = 0xA;
characterDataHandler(handlerArg, &c, 1);
}
else if (defaultHandler)
reportDefault(parser, enc, s, next);
break;
case XML_TOK_DATA_CHARS:
{
XML_CharacterDataHandler charDataHandler = characterDataHandler;
if (charDataHandler) {
if (MUST_CONVERT(enc, s)) {
for (;;) {
ICHAR *dataPtr = (ICHAR *)dataBuf;
XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);
*eventEndPP = next;
charDataHandler(handlerArg, dataBuf,
(int)(dataPtr - (ICHAR *)dataBuf));
if (s == next)
break;
*eventPP = s;
}
}
else
charDataHandler(handlerArg,
(XML_Char *)s,
(int)((XML_Char *)next - (XML_Char *)s));
}
else if (defaultHandler)
reportDefault(parser, enc, s, next);
}
break;
case XML_TOK_INVALID:
*eventPP = next;
return XML_ERROR_INVALID_TOKEN;
case XML_TOK_PARTIAL_CHAR:
if (haveMore) {
*nextPtr = s;
return XML_ERROR_NONE;
}
return XML_ERROR_PARTIAL_CHAR;
case XML_TOK_PARTIAL:
case XML_TOK_NONE:
if (haveMore) {
*nextPtr = s;
return XML_ERROR_NONE;
}
return XML_ERROR_UNCLOSED_CDATA_SECTION;
default:
*eventPP = next;
return XML_ERROR_UNEXPECTED_STATE;
}
*eventPP = s = next;
switch (ps_parsing) {
case XML_SUSPENDED:
*nextPtr = next;
return XML_ERROR_NONE;
case XML_FINISHED:
return XML_ERROR_ABORTED;
default: ;
}
}
/* not reached */
}
#ifdef XML_DTD
/* The idea here is to avoid using stack for each IGNORE section when
the whole file is parsed with one call.
*/
static enum XML_Error PTRCALL
ignoreSectionProcessor(XML_Parser parser,
const char *start,
const char *end,
const char **endPtr)
{
enum XML_Error result = doIgnoreSection(parser, encoding, &start, end,
endPtr, (XML_Bool)!ps_finalBuffer);
if (result != XML_ERROR_NONE)
return result;
if (start) {
processor = prologProcessor;
return prologProcessor(parser, start, end, endPtr);
}
return result;
}
/* startPtr gets set to non-null is the section is closed, and to null
if the section is not yet closed.
*/
static enum XML_Error
doIgnoreSection(XML_Parser parser,
const ENCODING *enc,
const char **startPtr,
const char *end,
const char **nextPtr,
XML_Bool haveMore)
{
const char *next;
int tok;
const char *s = *startPtr;
const char **eventPP;
const char **eventEndPP;
if (enc == encoding) {
eventPP = &eventPtr;
*eventPP = s;
eventEndPP = &eventEndPtr;
}
else {
eventPP = &(openInternalEntities->internalEventPtr);
eventEndPP = &(openInternalEntities->internalEventEndPtr);
}
*eventPP = s;
*startPtr = NULL;
tok = XmlIgnoreSectionTok(enc, s, end, &next);
*eventEndPP = next;
switch (tok) {
case XML_TOK_IGNORE_SECT:
if (defaultHandler)
reportDefault(parser, enc, s, next);
*startPtr = next;
*nextPtr = next;
if (ps_parsing == XML_FINISHED)
return XML_ERROR_ABORTED;
else
return XML_ERROR_NONE;
case XML_TOK_INVALID:
*eventPP = next;
return XML_ERROR_INVALID_TOKEN;
case XML_TOK_PARTIAL_CHAR:
if (haveMore) {
*nextPtr = s;
return XML_ERROR_NONE;
}
return XML_ERROR_PARTIAL_CHAR;
case XML_TOK_PARTIAL:
case XML_TOK_NONE:
if (haveMore) {
*nextPtr = s;
return XML_ERROR_NONE;
}
return XML_ERROR_SYNTAX; /* XML_ERROR_UNCLOSED_IGNORE_SECTION */
default:
*eventPP = next;
return XML_ERROR_UNEXPECTED_STATE;
}
/* not reached */
}
#endif /* XML_DTD */
static enum XML_Error
initializeEncoding(XML_Parser parser)
{
const char *s;
#ifdef XML_UNICODE
char encodingBuf[128];
if (!protocolEncodingName)
s = NULL;
else {
int i;
for (i = 0; protocolEncodingName[i]; i++) {
if (i == sizeof(encodingBuf) - 1
|| (protocolEncodingName[i] & ~0x7f) != 0) {
encodingBuf[0] = '\0';
break;
}
encodingBuf[i] = (char)protocolEncodingName[i];
}
encodingBuf[i] = '\0';
s = encodingBuf;
}
#else
s = protocolEncodingName;
#endif
if ((ns ? XmlInitEncodingNS : XmlInitEncoding)(&initEncoding, &encoding, s))
return XML_ERROR_NONE;
return handleUnknownEncoding(parser, protocolEncodingName);
}
static enum XML_Error
processXmlDecl(XML_Parser parser, int isGeneralTextEntity,
const char *s, const char *next)
{
const char *encodingName = NULL;
const XML_Char *storedEncName = NULL;
const ENCODING *newEncoding = NULL;
const char *version = NULL;
const char *versionend;
const XML_Char *storedversion = NULL;
int standalone = -1;
if (!(ns
? XmlParseXmlDeclNS
: XmlParseXmlDecl)(isGeneralTextEntity,
encoding,
s,
next,
&eventPtr,
&version,
&versionend,
&encodingName,
&newEncoding,
&standalone)) {
if (isGeneralTextEntity)
return XML_ERROR_TEXT_DECL;
else
return XML_ERROR_XML_DECL;
}
if (!isGeneralTextEntity && standalone == 1) {
_dtd->standalone = XML_TRUE;
#ifdef XML_DTD
if (paramEntityParsing == XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE)
paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER;
#endif /* XML_DTD */
}
if (xmlDeclHandler) {
if (encodingName != NULL) {
storedEncName = poolStoreString(&temp2Pool,
encoding,
encodingName,
encodingName
+ XmlNameLength(encoding, encodingName));
if (!storedEncName)
return XML_ERROR_NO_MEMORY;
poolFinish(&temp2Pool);
}
if (version) {
storedversion = poolStoreString(&temp2Pool,
encoding,
version,
versionend - encoding->minBytesPerChar);
if (!storedversion)
return XML_ERROR_NO_MEMORY;
}
xmlDeclHandler(handlerArg, storedversion, storedEncName, standalone);
}
else if (defaultHandler)
reportDefault(parser, encoding, s, next);
if (protocolEncodingName == NULL) {
if (newEncoding) {
if (newEncoding->minBytesPerChar != encoding->minBytesPerChar) {
eventPtr = encodingName;
return XML_ERROR_INCORRECT_ENCODING;
}
encoding = newEncoding;
}
else if (encodingName) {
enum XML_Error result;
if (!storedEncName) {
storedEncName = poolStoreString(
&temp2Pool, encoding, encodingName,
encodingName + XmlNameLength(encoding, encodingName));
if (!storedEncName)
return XML_ERROR_NO_MEMORY;
}
result = handleUnknownEncoding(parser, storedEncName);
poolClear(&temp2Pool);
if (result == XML_ERROR_UNKNOWN_ENCODING)
eventPtr = encodingName;
return result;
}
}
if (storedEncName || storedversion)
poolClear(&temp2Pool);
return XML_ERROR_NONE;
}
static enum XML_Error
handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName)
{
if (unknownEncodingHandler) {
XML_Encoding info;
int i;
for (i = 0; i < 256; i++)
info.map[i] = -1;
info.convert = NULL;
info.data = NULL;
info.release = NULL;
if (unknownEncodingHandler(unknownEncodingHandlerData, encodingName,
&info)) {
ENCODING *enc;
unknownEncodingMem = MALLOC(XmlSizeOfUnknownEncoding());
if (!unknownEncodingMem) {
if (info.release)
info.release(info.data);
return XML_ERROR_NO_MEMORY;
}
enc = (ns
? XmlInitUnknownEncodingNS
: XmlInitUnknownEncoding)(unknownEncodingMem,
info.map,
info.convert,
info.data);
if (enc) {
unknownEncodingData = info.data;
unknownEncodingRelease = info.release;
encoding = enc;
return XML_ERROR_NONE;
}
}
if (info.release != NULL)
info.release(info.data);
}
return XML_ERROR_UNKNOWN_ENCODING;
}
static enum XML_Error PTRCALL
prologInitProcessor(XML_Parser parser,
const char *s,
const char *end,
const char **nextPtr)
{
enum XML_Error result = initializeEncoding(parser);
if (result != XML_ERROR_NONE)
return result;
processor = prologProcessor;
return prologProcessor(parser, s, end, nextPtr);
}
#ifdef XML_DTD
static enum XML_Error PTRCALL
externalParEntInitProcessor(XML_Parser parser,
const char *s,
const char *end,
const char **nextPtr)
{
enum XML_Error result = initializeEncoding(parser);
if (result != XML_ERROR_NONE)
return result;
/* we know now that XML_Parse(Buffer) has been called,
so we consider the external parameter entity read */
_dtd->paramEntityRead = XML_TRUE;
if (prologState.inEntityValue) {
processor = entityValueInitProcessor;
return entityValueInitProcessor(parser, s, end, nextPtr);
}
else {
processor = externalParEntProcessor;
return externalParEntProcessor(parser, s, end, nextPtr);
}
}
static enum XML_Error PTRCALL
entityValueInitProcessor(XML_Parser parser,
const char *s,
const char *end,
const char **nextPtr)
{
int tok;
const char *start = s;
const char *next = start;
eventPtr = start;
for (;;) {
tok = XmlPrologTok(encoding, start, end, &next);
eventEndPtr = next;
if (tok <= 0) {
if (!ps_finalBuffer && tok != XML_TOK_INVALID) {
*nextPtr = s;
return XML_ERROR_NONE;
}
switch (tok) {
case XML_TOK_INVALID:
return XML_ERROR_INVALID_TOKEN;
case XML_TOK_PARTIAL:
return XML_ERROR_UNCLOSED_TOKEN;
case XML_TOK_PARTIAL_CHAR:
return XML_ERROR_PARTIAL_CHAR;
case XML_TOK_NONE: /* start == end */
default:
break;
}
/* found end of entity value - can store it now */
return storeEntityValue(parser, encoding, s, end);
}
else if (tok == XML_TOK_XML_DECL) {
enum XML_Error result;
result = processXmlDecl(parser, 0, start, next);
if (result != XML_ERROR_NONE)
return result;
switch (ps_parsing) {
case XML_SUSPENDED:
*nextPtr = next;
return XML_ERROR_NONE;
case XML_FINISHED:
return XML_ERROR_ABORTED;
default:
*nextPtr = next;
}
/* stop scanning for text declaration - we found one */
processor = entityValueProcessor;
return entityValueProcessor(parser, next, end, nextPtr);
}
/* If we are at the end of the buffer, this would cause XmlPrologTok to
return XML_TOK_NONE on the next call, which would then cause the
function to exit with *nextPtr set to s - that is what we want for other
tokens, but not for the BOM - we would rather like to skip it;
then, when this routine is entered the next time, XmlPrologTok will
return XML_TOK_INVALID, since the BOM is still in the buffer
*/
else if (tok == XML_TOK_BOM && next == end && !ps_finalBuffer) {
*nextPtr = next;
return XML_ERROR_NONE;
}
start = next;
eventPtr = start;
}
}
static enum XML_Error PTRCALL
externalParEntProcessor(XML_Parser parser,
const char *s,
const char *end,
const char **nextPtr)
{
const char *next = s;
int tok;
tok = XmlPrologTok(encoding, s, end, &next);
if (tok <= 0) {
if (!ps_finalBuffer && tok != XML_TOK_INVALID) {
*nextPtr = s;
return XML_ERROR_NONE;
}
switch (tok) {
case XML_TOK_INVALID:
return XML_ERROR_INVALID_TOKEN;
case XML_TOK_PARTIAL:
return XML_ERROR_UNCLOSED_TOKEN;
case XML_TOK_PARTIAL_CHAR:
return XML_ERROR_PARTIAL_CHAR;
case XML_TOK_NONE: /* start == end */
default:
break;
}
}
/* This would cause the next stage, i.e. doProlog to be passed XML_TOK_BOM.
However, when parsing an external subset, doProlog will not accept a BOM
as valid, and report a syntax error, so we have to skip the BOM
*/
else if (tok == XML_TOK_BOM) {
s = next;
tok = XmlPrologTok(encoding, s, end, &next);
}
processor = prologProcessor;
return doProlog(parser, encoding, s, end, tok, next,
nextPtr, (XML_Bool)!ps_finalBuffer);
}
static enum XML_Error PTRCALL
entityValueProcessor(XML_Parser parser,
const char *s,
const char *end,
const char **nextPtr)
{
const char *start = s;
const char *next = s;
const ENCODING *enc = encoding;
int tok;
for (;;) {
tok = XmlPrologTok(enc, start, end, &next);
if (tok <= 0) {
if (!ps_finalBuffer && tok != XML_TOK_INVALID) {
*nextPtr = s;
return XML_ERROR_NONE;
}
switch (tok) {
case XML_TOK_INVALID:
return XML_ERROR_INVALID_TOKEN;
case XML_TOK_PARTIAL:
return XML_ERROR_UNCLOSED_TOKEN;
case XML_TOK_PARTIAL_CHAR:
return XML_ERROR_PARTIAL_CHAR;
case XML_TOK_NONE: /* start == end */
default:
break;
}
/* found end of entity value - can store it now */
return storeEntityValue(parser, enc, s, end);
}
start = next;
}
}
#endif /* XML_DTD */
static enum XML_Error PTRCALL
prologProcessor(XML_Parser parser,
const char *s,
const char *end,
const char **nextPtr)
{
const char *next = s;
int tok = XmlPrologTok(encoding, s, end, &next);
return doProlog(parser, encoding, s, end, tok, next,
nextPtr, (XML_Bool)!ps_finalBuffer);
}
static enum XML_Error
doProlog(XML_Parser parser,
const ENCODING *enc,
const char *s,
const char *end,
int tok,
const char *next,
const char **nextPtr,
XML_Bool haveMore)
{
#ifdef XML_DTD
static const XML_Char externalSubsetName[] = { ASCII_HASH , '\0' };
#endif /* XML_DTD */
static const XML_Char atypeCDATA[] =
{ ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' };
static const XML_Char atypeID[] = { ASCII_I, ASCII_D, '\0' };
static const XML_Char atypeIDREF[] =
{ ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, '\0' };
static const XML_Char atypeIDREFS[] =
{ ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, ASCII_S, '\0' };
static const XML_Char atypeENTITY[] =
{ ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_Y, '\0' };
static const XML_Char atypeENTITIES[] = { ASCII_E, ASCII_N,
ASCII_T, ASCII_I, ASCII_T, ASCII_I, ASCII_E, ASCII_S, '\0' };
static const XML_Char atypeNMTOKEN[] = {
ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, '\0' };
static const XML_Char atypeNMTOKENS[] = { ASCII_N, ASCII_M, ASCII_T,
ASCII_O, ASCII_K, ASCII_E, ASCII_N, ASCII_S, '\0' };
static const XML_Char notationPrefix[] = { ASCII_N, ASCII_O, ASCII_T,
ASCII_A, ASCII_T, ASCII_I, ASCII_O, ASCII_N, ASCII_LPAREN, '\0' };
static const XML_Char enumValueSep[] = { ASCII_PIPE, '\0' };
static const XML_Char enumValueStart[] = { ASCII_LPAREN, '\0' };
/* save one level of indirection */
DTD * const dtd = _dtd;
const char **eventPP;
const char **eventEndPP;
enum XML_Content_Quant quant;
if (enc == encoding) {
eventPP = &eventPtr;
eventEndPP = &eventEndPtr;
}
else {
eventPP = &(openInternalEntities->internalEventPtr);
eventEndPP = &(openInternalEntities->internalEventEndPtr);
}
for (;;) {
int role;
XML_Bool handleDefault = XML_TRUE;
*eventPP = s;
*eventEndPP = next;
if (tok <= 0) {
if (haveMore && tok != XML_TOK_INVALID) {
*nextPtr = s;
return XML_ERROR_NONE;
}
switch (tok) {
case XML_TOK_INVALID:
*eventPP = next;
return XML_ERROR_INVALID_TOKEN;
case XML_TOK_PARTIAL:
return XML_ERROR_UNCLOSED_TOKEN;
case XML_TOK_PARTIAL_CHAR:
return XML_ERROR_PARTIAL_CHAR;
case -XML_TOK_PROLOG_S:
tok = -tok;
break;
case XML_TOK_NONE:
#ifdef XML_DTD
/* for internal PE NOT referenced between declarations */
if (enc != encoding && !openInternalEntities->betweenDecl) {
*nextPtr = s;
return XML_ERROR_NONE;
}
/* WFC: PE Between Declarations - must check that PE contains
complete markup, not only for external PEs, but also for
internal PEs if the reference occurs between declarations.
*/
if (isParamEntity || enc != encoding) {
if (XmlTokenRole(&prologState, XML_TOK_NONE, end, end, enc)
== XML_ROLE_ERROR)
return XML_ERROR_INCOMPLETE_PE;
*nextPtr = s;
return XML_ERROR_NONE;
}
#endif /* XML_DTD */
return XML_ERROR_NO_ELEMENTS;
default:
tok = -tok;
next = end;
break;
}
}
role = XmlTokenRole(&prologState, tok, s, next, enc);
switch (role) {
case XML_ROLE_XML_DECL:
{
enum XML_Error result = processXmlDecl(parser, 0, s, next);
if (result != XML_ERROR_NONE)
return result;
enc = encoding;
handleDefault = XML_FALSE;
}
break;
case XML_ROLE_DOCTYPE_NAME:
if (startDoctypeDeclHandler) {
doctypeName = poolStoreString(&tempPool, enc, s, next);
if (!doctypeName)
return XML_ERROR_NO_MEMORY;
poolFinish(&tempPool);
doctypePubid = NULL;
handleDefault = XML_FALSE;
}
doctypeSysid = NULL; /* always initialize to NULL */
break;
case XML_ROLE_DOCTYPE_INTERNAL_SUBSET:
if (startDoctypeDeclHandler) {
startDoctypeDeclHandler(handlerArg, doctypeName, doctypeSysid,
doctypePubid, 1);
doctypeName = NULL;
poolClear(&tempPool);
handleDefault = XML_FALSE;
}
break;
#ifdef XML_DTD
case XML_ROLE_TEXT_DECL:
{
enum XML_Error result = processXmlDecl(parser, 1, s, next);
if (result != XML_ERROR_NONE)
return result;
enc = encoding;
handleDefault = XML_FALSE;
}
break;
#endif /* XML_DTD */
case XML_ROLE_DOCTYPE_PUBLIC_ID:
#ifdef XML_DTD
useForeignDTD = XML_FALSE;
declEntity = (ENTITY *)lookup(&dtd->paramEntities,
externalSubsetName,
sizeof(ENTITY));
if (!declEntity)
return XML_ERROR_NO_MEMORY;
#endif /* XML_DTD */
dtd->hasParamEntityRefs = XML_TRUE;
if (startDoctypeDeclHandler) {
XML_Char *pubId;
if (!XmlIsPublicId(enc, s, next, eventPP))
return XML_ERROR_PUBLICID;
pubId = poolStoreString(&tempPool, enc,
s + enc->minBytesPerChar,
next - enc->minBytesPerChar);
if (!pubId)
return XML_ERROR_NO_MEMORY;
normalizePublicId(pubId);
poolFinish(&tempPool);
doctypePubid = pubId;
handleDefault = XML_FALSE;
goto alreadyChecked;
}
/* fall through */
case XML_ROLE_ENTITY_PUBLIC_ID:
if (!XmlIsPublicId(enc, s, next, eventPP))
return XML_ERROR_PUBLICID;
alreadyChecked:
if (dtd->keepProcessing && declEntity) {
XML_Char *tem = poolStoreString(&dtd->pool,
enc,
s + enc->minBytesPerChar,
next - enc->minBytesPerChar);
if (!tem)
return XML_ERROR_NO_MEMORY;
normalizePublicId(tem);
declEntity->publicId = tem;
poolFinish(&dtd->pool);
if (entityDeclHandler)
handleDefault = XML_FALSE;
}
break;
case XML_ROLE_DOCTYPE_CLOSE:
if (doctypeName) {
startDoctypeDeclHandler(handlerArg, doctypeName,
doctypeSysid, doctypePubid, 0);
poolClear(&tempPool);
handleDefault = XML_FALSE;
}
/* doctypeSysid will be non-NULL in the case of a previous
XML_ROLE_DOCTYPE_SYSTEM_ID, even if startDoctypeDeclHandler
was not set, indicating an external subset
*/
#ifdef XML_DTD
if (doctypeSysid || useForeignDTD) {
XML_Bool hadParamEntityRefs = dtd->hasParamEntityRefs;
dtd->hasParamEntityRefs = XML_TRUE;
if (paramEntityParsing && externalEntityRefHandler) {
ENTITY *entity = (ENTITY *)lookup(&dtd->paramEntities,
externalSubsetName,
sizeof(ENTITY));
if (!entity)
return XML_ERROR_NO_MEMORY;
if (useForeignDTD)
entity->base = curBase;
dtd->paramEntityRead = XML_FALSE;
if (!externalEntityRefHandler(externalEntityRefHandlerArg,
0,
entity->base,
entity->systemId,
entity->publicId))
return XML_ERROR_EXTERNAL_ENTITY_HANDLING;
if (dtd->paramEntityRead) {
if (!dtd->standalone &&
notStandaloneHandler &&
!notStandaloneHandler(handlerArg))
return XML_ERROR_NOT_STANDALONE;
}
/* if we didn't read the foreign DTD then this means that there
is no external subset and we must reset dtd->hasParamEntityRefs
*/
else if (!doctypeSysid)
dtd->hasParamEntityRefs = hadParamEntityRefs;
/* end of DTD - no need to update dtd->keepProcessing */
}
useForeignDTD = XML_FALSE;
}
#endif /* XML_DTD */
if (endDoctypeDeclHandler) {
endDoctypeDeclHandler(handlerArg);
handleDefault = XML_FALSE;
}
break;
case XML_ROLE_INSTANCE_START:
#ifdef XML_DTD
/* if there is no DOCTYPE declaration then now is the
last chance to read the foreign DTD
*/
if (useForeignDTD) {
XML_Bool hadParamEntityRefs = dtd->hasParamEntityRefs;
dtd->hasParamEntityRefs = XML_TRUE;
if (paramEntityParsing && externalEntityRefHandler) {
ENTITY *entity = (ENTITY *)lookup(&dtd->paramEntities,
externalSubsetName,
sizeof(ENTITY));
if (!entity)
return XML_ERROR_NO_MEMORY;
entity->base = curBase;
dtd->paramEntityRead = XML_FALSE;
if (!externalEntityRefHandler(externalEntityRefHandlerArg,
0,
entity->base,
entity->systemId,
entity->publicId))
return XML_ERROR_EXTERNAL_ENTITY_HANDLING;
if (dtd->paramEntityRead) {
if (!dtd->standalone &&
notStandaloneHandler &&
!notStandaloneHandler(handlerArg))
return XML_ERROR_NOT_STANDALONE;
}
/* if we didn't read the foreign DTD then this means that there
is no external subset and we must reset dtd->hasParamEntityRefs
*/
else
dtd->hasParamEntityRefs = hadParamEntityRefs;
/* end of DTD - no need to update dtd->keepProcessing */
}
}
#endif /* XML_DTD */
processor = contentProcessor;
return contentProcessor(parser, s, end, nextPtr);
case XML_ROLE_ATTLIST_ELEMENT_NAME:
declElementType = getElementType(parser, enc, s, next);
if (!declElementType)
return XML_ERROR_NO_MEMORY;
goto checkAttListDeclHandler;
case XML_ROLE_ATTRIBUTE_NAME:
declAttributeId = getAttributeId(parser, enc, s, next);
if (!declAttributeId)
return XML_ERROR_NO_MEMORY;
declAttributeIsCdata = XML_FALSE;
declAttributeType = NULL;
declAttributeIsId = XML_FALSE;
goto checkAttListDeclHandler;
case XML_ROLE_ATTRIBUTE_TYPE_CDATA:
declAttributeIsCdata = XML_TRUE;
declAttributeType = atypeCDATA;
goto checkAttListDeclHandler;
case XML_ROLE_ATTRIBUTE_TYPE_ID:
declAttributeIsId = XML_TRUE;
declAttributeType = atypeID;
goto checkAttListDeclHandler;
case XML_ROLE_ATTRIBUTE_TYPE_IDREF:
declAttributeType = atypeIDREF;
goto checkAttListDeclHandler;
case XML_ROLE_ATTRIBUTE_TYPE_IDREFS:
declAttributeType = atypeIDREFS;
goto checkAttListDeclHandler;
case XML_ROLE_ATTRIBUTE_TYPE_ENTITY:
declAttributeType = atypeENTITY;
goto checkAttListDeclHandler;
case XML_ROLE_ATTRIBUTE_TYPE_ENTITIES:
declAttributeType = atypeENTITIES;
goto checkAttListDeclHandler;
case XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN:
declAttributeType = atypeNMTOKEN;
goto checkAttListDeclHandler;
case XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS:
declAttributeType = atypeNMTOKENS;
checkAttListDeclHandler:
if (dtd->keepProcessing && attlistDeclHandler)
handleDefault = XML_FALSE;
break;
case XML_ROLE_ATTRIBUTE_ENUM_VALUE:
case XML_ROLE_ATTRIBUTE_NOTATION_VALUE:
if (dtd->keepProcessing && attlistDeclHandler) {
const XML_Char *prefix;
if (declAttributeType) {
prefix = enumValueSep;
}
else {
prefix = (role == XML_ROLE_ATTRIBUTE_NOTATION_VALUE
? notationPrefix
: enumValueStart);
}
if (!poolAppendString(&tempPool, prefix))
return XML_ERROR_NO_MEMORY;
if (!poolAppend(&tempPool, enc, s, next))
return XML_ERROR_NO_MEMORY;
declAttributeType = tempPool.start;
handleDefault = XML_FALSE;
}
break;
case XML_ROLE_IMPLIED_ATTRIBUTE_VALUE:
case XML_ROLE_REQUIRED_ATTRIBUTE_VALUE:
if (dtd->keepProcessing) {
if (!defineAttribute(declElementType, declAttributeId,
declAttributeIsCdata, declAttributeIsId,
0, parser))
return XML_ERROR_NO_MEMORY;
if (attlistDeclHandler && declAttributeType) {
if (*declAttributeType == XML_T(ASCII_LPAREN)
|| (*declAttributeType == XML_T(ASCII_N)
&& declAttributeType[1] == XML_T(ASCII_O))) {
/* Enumerated or Notation type */
if (!poolAppendChar(&tempPool, XML_T(ASCII_RPAREN))
|| !poolAppendChar(&tempPool, XML_T('\0')))
return XML_ERROR_NO_MEMORY;
declAttributeType = tempPool.start;
poolFinish(&tempPool);
}
*eventEndPP = s;
attlistDeclHandler(handlerArg, declElementType->name,
declAttributeId->name, declAttributeType,
0, role == XML_ROLE_REQUIRED_ATTRIBUTE_VALUE);
poolClear(&tempPool);
handleDefault = XML_FALSE;
}
}
break;
case XML_ROLE_DEFAULT_ATTRIBUTE_VALUE:
case XML_ROLE_FIXED_ATTRIBUTE_VALUE:
if (dtd->keepProcessing) {
const XML_Char *attVal;
enum XML_Error result =
storeAttributeValue(parser, enc, declAttributeIsCdata,
s + enc->minBytesPerChar,
next - enc->minBytesPerChar,
&dtd->pool);
if (result)
return result;
attVal = poolStart(&dtd->pool);
poolFinish(&dtd->pool);
/* ID attributes aren't allowed to have a default */
if (!defineAttribute(declElementType, declAttributeId,
declAttributeIsCdata, XML_FALSE, attVal, parser))
return XML_ERROR_NO_MEMORY;
if (attlistDeclHandler && declAttributeType) {
if (*declAttributeType == XML_T(ASCII_LPAREN)
|| (*declAttributeType == XML_T(ASCII_N)
&& declAttributeType[1] == XML_T(ASCII_O))) {
/* Enumerated or Notation type */
if (!poolAppendChar(&tempPool, XML_T(ASCII_RPAREN))
|| !poolAppendChar(&tempPool, XML_T('\0')))
return XML_ERROR_NO_MEMORY;
declAttributeType = tempPool.start;
poolFinish(&tempPool);
}
*eventEndPP = s;
attlistDeclHandler(handlerArg, declElementType->name,
declAttributeId->name, declAttributeType,
attVal,
role == XML_ROLE_FIXED_ATTRIBUTE_VALUE);
poolClear(&tempPool);
handleDefault = XML_FALSE;
}
}
break;
case XML_ROLE_ENTITY_VALUE:
if (dtd->keepProcessing) {
enum XML_Error result = storeEntityValue(parser, enc,
s + enc->minBytesPerChar,
next - enc->minBytesPerChar);
if (declEntity) {
declEntity->textPtr = poolStart(&dtd->entityValuePool);
declEntity->textLen = (int)(poolLength(&dtd->entityValuePool));
poolFinish(&dtd->entityValuePool);
if (entityDeclHandler) {
*eventEndPP = s;
entityDeclHandler(handlerArg,
declEntity->name,
declEntity->is_param,
declEntity->textPtr,
declEntity->textLen,
curBase, 0, 0, 0);
handleDefault = XML_FALSE;
}
}
else
poolDiscard(&dtd->entityValuePool);
if (result != XML_ERROR_NONE)
return result;
}
break;
case XML_ROLE_DOCTYPE_SYSTEM_ID:
#ifdef XML_DTD
useForeignDTD = XML_FALSE;
#endif /* XML_DTD */
dtd->hasParamEntityRefs = XML_TRUE;
if (startDoctypeDeclHandler) {
doctypeSysid = poolStoreString(&tempPool, enc,
s + enc->minBytesPerChar,
next - enc->minBytesPerChar);
if (doctypeSysid == NULL)
return XML_ERROR_NO_MEMORY;
poolFinish(&tempPool);
handleDefault = XML_FALSE;
}
#ifdef XML_DTD
else
/* use externalSubsetName to make doctypeSysid non-NULL
for the case where no startDoctypeDeclHandler is set */
doctypeSysid = externalSubsetName;
#endif /* XML_DTD */
if (!dtd->standalone
#ifdef XML_DTD
&& !paramEntityParsing
#endif /* XML_DTD */
&& notStandaloneHandler
&& !notStandaloneHandler(handlerArg))
return XML_ERROR_NOT_STANDALONE;
#ifndef XML_DTD
break;
#else /* XML_DTD */
if (!declEntity) {
declEntity = (ENTITY *)lookup(&dtd->paramEntities,
externalSubsetName,
sizeof(ENTITY));
if (!declEntity)
return XML_ERROR_NO_MEMORY;
declEntity->publicId = NULL;
}
/* fall through */
#endif /* XML_DTD */
case XML_ROLE_ENTITY_SYSTEM_ID:
if (dtd->keepProcessing && declEntity) {
declEntity->systemId = poolStoreString(&dtd->pool, enc,
s + enc->minBytesPerChar,
next - enc->minBytesPerChar);
if (!declEntity->systemId)
return XML_ERROR_NO_MEMORY;
declEntity->base = curBase;
poolFinish(&dtd->pool);
if (entityDeclHandler)
handleDefault = XML_FALSE;
}
break;
case XML_ROLE_ENTITY_COMPLETE:
if (dtd->keepProcessing && declEntity && entityDeclHandler) {
*eventEndPP = s;
entityDeclHandler(handlerArg,
declEntity->name,
declEntity->is_param,
0,0,
declEntity->base,
declEntity->systemId,
declEntity->publicId,
0);
handleDefault = XML_FALSE;
}
break;
case XML_ROLE_ENTITY_NOTATION_NAME:
if (dtd->keepProcessing && declEntity) {
declEntity->notation = poolStoreString(&dtd->pool, enc, s, next);
if (!declEntity->notation)
return XML_ERROR_NO_MEMORY;
poolFinish(&dtd->pool);
if (unparsedEntityDeclHandler) {
*eventEndPP = s;
unparsedEntityDeclHandler(handlerArg,
declEntity->name,
declEntity->base,
declEntity->systemId,
declEntity->publicId,
declEntity->notation);
handleDefault = XML_FALSE;
}
else if (entityDeclHandler) {
*eventEndPP = s;
entityDeclHandler(handlerArg,
declEntity->name,
0,0,0,
declEntity->base,
declEntity->systemId,
declEntity->publicId,
declEntity->notation);
handleDefault = XML_FALSE;
}
}
break;
case XML_ROLE_GENERAL_ENTITY_NAME:
{
if (XmlPredefinedEntityName(enc, s, next)) {
declEntity = NULL;
break;
}
if (dtd->keepProcessing) {
const XML_Char *name = poolStoreString(&dtd->pool, enc, s, next);
if (!name)
return XML_ERROR_NO_MEMORY;
declEntity = (ENTITY *)lookup(&dtd->generalEntities, name,
sizeof(ENTITY));
if (!declEntity)
return XML_ERROR_NO_MEMORY;
if (declEntity->name != name) {
poolDiscard(&dtd->pool);
declEntity = NULL;
}
else {
poolFinish(&dtd->pool);
declEntity->publicId = NULL;
declEntity->is_param = XML_FALSE;
/* if we have a parent parser or are reading an internal parameter
entity, then the entity declaration is not considered "internal"
*/
declEntity->is_internal = !(parentParser || openInternalEntities);
if (entityDeclHandler)
handleDefault = XML_FALSE;
}
}
else {
poolDiscard(&dtd->pool);
declEntity = NULL;
}
}
break;
case XML_ROLE_PARAM_ENTITY_NAME:
#ifdef XML_DTD
if (dtd->keepProcessing) {
const XML_Char *name = poolStoreString(&dtd->pool, enc, s, next);
if (!name)
return XML_ERROR_NO_MEMORY;
declEntity = (ENTITY *)lookup(&dtd->paramEntities,
name, sizeof(ENTITY));
if (!declEntity)
return XML_ERROR_NO_MEMORY;
if (declEntity->name != name) {
poolDiscard(&dtd->pool);
declEntity = NULL;
}
else {
poolFinish(&dtd->pool);
declEntity->publicId = NULL;
declEntity->is_param = XML_TRUE;
/* if we have a parent parser or are reading an internal parameter
entity, then the entity declaration is not considered "internal"
*/
declEntity->is_internal = !(parentParser || openInternalEntities);
if (entityDeclHandler)
handleDefault = XML_FALSE;
}
}
else {
poolDiscard(&dtd->pool);
declEntity = NULL;
}
#else /* not XML_DTD */
declEntity = NULL;
#endif /* XML_DTD */
break;
case XML_ROLE_NOTATION_NAME:
declNotationPublicId = NULL;
declNotationName = NULL;
if (notationDeclHandler) {
declNotationName = poolStoreString(&tempPool, enc, s, next);
if (!declNotationName)
return XML_ERROR_NO_MEMORY;
poolFinish(&tempPool);
handleDefault = XML_FALSE;
}
break;
case XML_ROLE_NOTATION_PUBLIC_ID:
if (!XmlIsPublicId(enc, s, next, eventPP))
return XML_ERROR_PUBLICID;
if (declNotationName) { /* means notationDeclHandler != NULL */
XML_Char *tem = poolStoreString(&tempPool,
enc,
s + enc->minBytesPerChar,
next - enc->minBytesPerChar);
if (!tem)
return XML_ERROR_NO_MEMORY;
normalizePublicId(tem);
declNotationPublicId = tem;
poolFinish(&tempPool);
handleDefault = XML_FALSE;
}
break;
case XML_ROLE_NOTATION_SYSTEM_ID:
if (declNotationName && notationDeclHandler) {
const XML_Char *systemId
= poolStoreString(&tempPool, enc,
s + enc->minBytesPerChar,
next - enc->minBytesPerChar);
if (!systemId)
return XML_ERROR_NO_MEMORY;
*eventEndPP = s;
notationDeclHandler(handlerArg,
declNotationName,
curBase,
systemId,
declNotationPublicId);
handleDefault = XML_FALSE;
}
poolClear(&tempPool);
break;
case XML_ROLE_NOTATION_NO_SYSTEM_ID:
if (declNotationPublicId && notationDeclHandler) {
*eventEndPP = s;
notationDeclHandler(handlerArg,
declNotationName,
curBase,
0,
declNotationPublicId);
handleDefault = XML_FALSE;
}
poolClear(&tempPool);
break;
case XML_ROLE_ERROR:
switch (tok) {
case XML_TOK_PARAM_ENTITY_REF:
/* PE references in internal subset are
not allowed within declarations. */
return XML_ERROR_PARAM_ENTITY_REF;
case XML_TOK_XML_DECL:
return XML_ERROR_MISPLACED_XML_PI;
default:
return XML_ERROR_SYNTAX;
}
#ifdef XML_DTD
case XML_ROLE_IGNORE_SECT:
{
enum XML_Error result;
if (defaultHandler)
reportDefault(parser, enc, s, next);
handleDefault = XML_FALSE;
result = doIgnoreSection(parser, enc, &next, end, nextPtr, haveMore);
if (result != XML_ERROR_NONE)
return result;
else if (!next) {
processor = ignoreSectionProcessor;
return result;
}
}
break;
#endif /* XML_DTD */
case XML_ROLE_GROUP_OPEN:
if (prologState.level >= groupSize) {
if (groupSize) {
char *temp = (char *)REALLOC(groupConnector, groupSize *= 2);
if (temp == NULL)
return XML_ERROR_NO_MEMORY;
groupConnector = temp;
if (dtd->scaffIndex) {
int *temp = (int *)REALLOC(dtd->scaffIndex,
groupSize * sizeof(int));
if (temp == NULL)
return XML_ERROR_NO_MEMORY;
dtd->scaffIndex = temp;
}
}
else {
groupConnector = (char *)MALLOC(groupSize = 32);
if (!groupConnector)
return XML_ERROR_NO_MEMORY;
}
}
groupConnector[prologState.level] = 0;
if (dtd->in_eldecl) {
int myindex = nextScaffoldPart(parser);
if (myindex < 0)
return XML_ERROR_NO_MEMORY;
dtd->scaffIndex[dtd->scaffLevel] = myindex;
dtd->scaffLevel++;
dtd->scaffold[myindex].type = XML_CTYPE_SEQ;
if (elementDeclHandler)
handleDefault = XML_FALSE;
}
break;
case XML_ROLE_GROUP_SEQUENCE:
if (groupConnector[prologState.level] == ASCII_PIPE)
return XML_ERROR_SYNTAX;
groupConnector[prologState.level] = ASCII_COMMA;
if (dtd->in_eldecl && elementDeclHandler)
handleDefault = XML_FALSE;
break;
case XML_ROLE_GROUP_CHOICE:
if (groupConnector[prologState.level] == ASCII_COMMA)
return XML_ERROR_SYNTAX;
if (dtd->in_eldecl
&& !groupConnector[prologState.level]
&& (dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel - 1]].type
!= XML_CTYPE_MIXED)
) {
dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel - 1]].type
= XML_CTYPE_CHOICE;
if (elementDeclHandler)
handleDefault = XML_FALSE;
}
groupConnector[prologState.level] = ASCII_PIPE;
break;
case XML_ROLE_PARAM_ENTITY_REF:
#ifdef XML_DTD
case XML_ROLE_INNER_PARAM_ENTITY_REF:
dtd->hasParamEntityRefs = XML_TRUE;
if (!paramEntityParsing)
dtd->keepProcessing = dtd->standalone;
else {
const XML_Char *name;
ENTITY *entity;
name = poolStoreString(&dtd->pool, enc,
s + enc->minBytesPerChar,
next - enc->minBytesPerChar);
if (!name)
return XML_ERROR_NO_MEMORY;
entity = (ENTITY *)lookup(&dtd->paramEntities, name, 0);
poolDiscard(&dtd->pool);
/* first, determine if a check for an existing declaration is needed;
if yes, check that the entity exists, and that it is internal,
otherwise call the skipped entity handler
*/
if (prologState.documentEntity &&
(dtd->standalone
? !openInternalEntities
: !dtd->hasParamEntityRefs)) {
if (!entity)
return XML_ERROR_UNDEFINED_ENTITY;
else if (!entity->is_internal)
return XML_ERROR_ENTITY_DECLARED_IN_PE;
}
else if (!entity) {
dtd->keepProcessing = dtd->standalone;
/* cannot report skipped entities in declarations */
if ((role == XML_ROLE_PARAM_ENTITY_REF) && skippedEntityHandler) {
skippedEntityHandler(handlerArg, name, 1);
handleDefault = XML_FALSE;
}
break;
}
if (entity->open)
return XML_ERROR_RECURSIVE_ENTITY_REF;
if (entity->textPtr) {
enum XML_Error result;
XML_Bool betweenDecl =
(role == XML_ROLE_PARAM_ENTITY_REF ? XML_TRUE : XML_FALSE);
result = processInternalEntity(parser, entity, betweenDecl);
if (result != XML_ERROR_NONE)
return result;
handleDefault = XML_FALSE;
break;
}
if (externalEntityRefHandler) {
dtd->paramEntityRead = XML_FALSE;
entity->open = XML_TRUE;
if (!externalEntityRefHandler(externalEntityRefHandlerArg,
0,
entity->base,
entity->systemId,
entity->publicId)) {
entity->open = XML_FALSE;
return XML_ERROR_EXTERNAL_ENTITY_HANDLING;
}
entity->open = XML_FALSE;
handleDefault = XML_FALSE;
if (!dtd->paramEntityRead) {
dtd->keepProcessing = dtd->standalone;
break;
}
}
else {
dtd->keepProcessing = dtd->standalone;
break;
}
}
#endif /* XML_DTD */
if (!dtd->standalone &&
notStandaloneHandler &&
!notStandaloneHandler(handlerArg))
return XML_ERROR_NOT_STANDALONE;
break;
/* Element declaration stuff */
case XML_ROLE_ELEMENT_NAME:
if (elementDeclHandler) {
declElementType = getElementType(parser, enc, s, next);
if (!declElementType)
return XML_ERROR_NO_MEMORY;
dtd->scaffLevel = 0;
dtd->scaffCount = 0;
dtd->in_eldecl = XML_TRUE;
handleDefault = XML_FALSE;
}
break;
case XML_ROLE_CONTENT_ANY:
case XML_ROLE_CONTENT_EMPTY:
if (dtd->in_eldecl) {
if (elementDeclHandler) {
XML_Content * content = (XML_Content *) MALLOC(sizeof(XML_Content));
if (!content)
return XML_ERROR_NO_MEMORY;
content->quant = XML_CQUANT_NONE;
content->name = NULL;
content->numchildren = 0;
content->children = NULL;
content->type = ((role == XML_ROLE_CONTENT_ANY) ?
XML_CTYPE_ANY :
XML_CTYPE_EMPTY);
*eventEndPP = s;
elementDeclHandler(handlerArg, declElementType->name, content);
handleDefault = XML_FALSE;
}
dtd->in_eldecl = XML_FALSE;
}
break;
case XML_ROLE_CONTENT_PCDATA:
if (dtd->in_eldecl) {
dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel - 1]].type
= XML_CTYPE_MIXED;
if (elementDeclHandler)
handleDefault = XML_FALSE;
}
break;
case XML_ROLE_CONTENT_ELEMENT:
quant = XML_CQUANT_NONE;
goto elementContent;
case XML_ROLE_CONTENT_ELEMENT_OPT:
quant = XML_CQUANT_OPT;
goto elementContent;
case XML_ROLE_CONTENT_ELEMENT_REP:
quant = XML_CQUANT_REP;
goto elementContent;
case XML_ROLE_CONTENT_ELEMENT_PLUS:
quant = XML_CQUANT_PLUS;
elementContent:
if (dtd->in_eldecl) {
ELEMENT_TYPE *el;
const XML_Char *name;
int nameLen;
const char *nxt = (quant == XML_CQUANT_NONE
? next
: next - enc->minBytesPerChar);
int myindex = nextScaffoldPart(parser);
if (myindex < 0)
return XML_ERROR_NO_MEMORY;
dtd->scaffold[myindex].type = XML_CTYPE_NAME;
dtd->scaffold[myindex].quant = quant;
el = getElementType(parser, enc, s, nxt);
if (!el)
return XML_ERROR_NO_MEMORY;
name = el->name;
dtd->scaffold[myindex].name = name;
nameLen = 0;
for (; name[nameLen++]; );
dtd->contentStringLen += nameLen;
if (elementDeclHandler)
handleDefault = XML_FALSE;
}
break;
case XML_ROLE_GROUP_CLOSE:
quant = XML_CQUANT_NONE;
goto closeGroup;
case XML_ROLE_GROUP_CLOSE_OPT:
quant = XML_CQUANT_OPT;
goto closeGroup;
case XML_ROLE_GROUP_CLOSE_REP:
quant = XML_CQUANT_REP;
goto closeGroup;
case XML_ROLE_GROUP_CLOSE_PLUS:
quant = XML_CQUANT_PLUS;
closeGroup:
if (dtd->in_eldecl) {
if (elementDeclHandler)
handleDefault = XML_FALSE;
dtd->scaffLevel--;
dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel]].quant = quant;
if (dtd->scaffLevel == 0) {
if (!handleDefault) {
XML_Content *model = build_model(parser);
if (!model)
return XML_ERROR_NO_MEMORY;
*eventEndPP = s;
elementDeclHandler(handlerArg, declElementType->name, model);
}
dtd->in_eldecl = XML_FALSE;
dtd->contentStringLen = 0;
}
}
break;
/* End element declaration stuff */
case XML_ROLE_PI:
if (!reportProcessingInstruction(parser, enc, s, next))
return XML_ERROR_NO_MEMORY;
handleDefault = XML_FALSE;
break;
case XML_ROLE_COMMENT:
if (!reportComment(parser, enc, s, next))
return XML_ERROR_NO_MEMORY;
handleDefault = XML_FALSE;
break;
case XML_ROLE_NONE:
switch (tok) {
case XML_TOK_BOM:
handleDefault = XML_FALSE;
break;
}
break;
case XML_ROLE_DOCTYPE_NONE:
if (startDoctypeDeclHandler)
handleDefault = XML_FALSE;
break;
case XML_ROLE_ENTITY_NONE:
if (dtd->keepProcessing && entityDeclHandler)
handleDefault = XML_FALSE;
break;
case XML_ROLE_NOTATION_NONE:
if (notationDeclHandler)
handleDefault = XML_FALSE;
break;
case XML_ROLE_ATTLIST_NONE:
if (dtd->keepProcessing && attlistDeclHandler)
handleDefault = XML_FALSE;
break;
case XML_ROLE_ELEMENT_NONE:
if (elementDeclHandler)
handleDefault = XML_FALSE;
break;
} /* end of big switch */
if (handleDefault && defaultHandler)
reportDefault(parser, enc, s, next);
switch (ps_parsing) {
case XML_SUSPENDED:
*nextPtr = next;
return XML_ERROR_NONE;
case XML_FINISHED:
return XML_ERROR_ABORTED;
default:
s = next;
tok = XmlPrologTok(enc, s, end, &next);
}
}
/* not reached */
}
static enum XML_Error PTRCALL
epilogProcessor(XML_Parser parser,
const char *s,
const char *end,
const char **nextPtr)
{
processor = epilogProcessor;
eventPtr = s;
for (;;) {
const char *next = NULL;
int tok = XmlPrologTok(encoding, s, end, &next);
eventEndPtr = next;
switch (tok) {
/* report partial linebreak - it might be the last token */
case -XML_TOK_PROLOG_S:
if (defaultHandler) {
reportDefault(parser, encoding, s, next);
if (ps_parsing == XML_FINISHED)
return XML_ERROR_ABORTED;
}
*nextPtr = next;
return XML_ERROR_NONE;
case XML_TOK_NONE:
*nextPtr = s;
return XML_ERROR_NONE;
case XML_TOK_PROLOG_S:
if (defaultHandler)
reportDefault(parser, encoding, s, next);
break;
case XML_TOK_PI:
if (!reportProcessingInstruction(parser, encoding, s, next))
return XML_ERROR_NO_MEMORY;
break;
case XML_TOK_COMMENT:
if (!reportComment(parser, encoding, s, next))
return XML_ERROR_NO_MEMORY;
break;
case XML_TOK_INVALID:
eventPtr = next;
return XML_ERROR_INVALID_TOKEN;
case XML_TOK_PARTIAL:
if (!ps_finalBuffer) {
*nextPtr = s;
return XML_ERROR_NONE;
}
return XML_ERROR_UNCLOSED_TOKEN;
case XML_TOK_PARTIAL_CHAR:
if (!ps_finalBuffer) {
*nextPtr = s;
return XML_ERROR_NONE;
}
return XML_ERROR_PARTIAL_CHAR;
default:
return XML_ERROR_JUNK_AFTER_DOC_ELEMENT;
}
eventPtr = s = next;
switch (ps_parsing) {
case XML_SUSPENDED:
*nextPtr = next;
return XML_ERROR_NONE;
case XML_FINISHED:
return XML_ERROR_ABORTED;
default: ;
}
}
}
static enum XML_Error
processInternalEntity(XML_Parser parser, ENTITY *entity,
XML_Bool betweenDecl)
{
const char *textStart, *textEnd;
const char *next;
enum XML_Error result;
OPEN_INTERNAL_ENTITY *openEntity;
if (freeInternalEntities) {
openEntity = freeInternalEntities;
freeInternalEntities = openEntity->next;
}
else {
openEntity = (OPEN_INTERNAL_ENTITY *)MALLOC(sizeof(OPEN_INTERNAL_ENTITY));
if (!openEntity)
return XML_ERROR_NO_MEMORY;
}
entity->open = XML_TRUE;
entity->processed = 0;
openEntity->next = openInternalEntities;
openInternalEntities = openEntity;
openEntity->entity = entity;
openEntity->startTagLevel = tagLevel;
openEntity->betweenDecl = betweenDecl;
openEntity->internalEventPtr = NULL;
openEntity->internalEventEndPtr = NULL;
textStart = (char *)entity->textPtr;
textEnd = (char *)(entity->textPtr + entity->textLen);
#ifdef XML_DTD
if (entity->is_param) {
int tok = XmlPrologTok(internalEncoding, textStart, textEnd, &next);
result = doProlog(parser, internalEncoding, textStart, textEnd, tok,
next, &next, XML_FALSE);
}
else
#endif /* XML_DTD */
result = doContent(parser, tagLevel, internalEncoding, textStart,
textEnd, &next, XML_FALSE);
if (result == XML_ERROR_NONE) {
if (textEnd != next && ps_parsing == XML_SUSPENDED) {
entity->processed = (int)(next - textStart);
processor = internalEntityProcessor;
}
else {
entity->open = XML_FALSE;
openInternalEntities = openEntity->next;
/* put openEntity back in list of free instances */
openEntity->next = freeInternalEntities;
freeInternalEntities = openEntity;
}
}
return result;
}
static enum XML_Error PTRCALL
internalEntityProcessor(XML_Parser parser,
const char *s,
const char *end,
const char **nextPtr)
{
ENTITY *entity;
const char *textStart, *textEnd;
const char *next;
enum XML_Error result;
OPEN_INTERNAL_ENTITY *openEntity = openInternalEntities;
if (!openEntity)
return XML_ERROR_UNEXPECTED_STATE;
entity = openEntity->entity;
textStart = ((char *)entity->textPtr) + entity->processed;
textEnd = (char *)(entity->textPtr + entity->textLen);
#ifdef XML_DTD
if (entity->is_param) {
int tok = XmlPrologTok(internalEncoding, textStart, textEnd, &next);
result = doProlog(parser, internalEncoding, textStart, textEnd, tok,
next, &next, XML_FALSE);
}
else
#endif /* XML_DTD */
result = doContent(parser, openEntity->startTagLevel, internalEncoding,
textStart, textEnd, &next, XML_FALSE);
if (result != XML_ERROR_NONE)
return result;
else if (textEnd != next && ps_parsing == XML_SUSPENDED) {
entity->processed = (int)(next - (char *)entity->textPtr);
return result;
}
else {
entity->open = XML_FALSE;
openInternalEntities = openEntity->next;
/* put openEntity back in list of free instances */
openEntity->next = freeInternalEntities;
freeInternalEntities = openEntity;
}
#ifdef XML_DTD
if (entity->is_param) {
int tok;
processor = prologProcessor;
tok = XmlPrologTok(encoding, s, end, &next);
return doProlog(parser, encoding, s, end, tok, next, nextPtr,
(XML_Bool)!ps_finalBuffer);
}
else
#endif /* XML_DTD */
{
processor = contentProcessor;
/* see externalEntityContentProcessor vs contentProcessor */
return doContent(parser, parentParser ? 1 : 0, encoding, s, end,
nextPtr, (XML_Bool)!ps_finalBuffer);
}
}
static enum XML_Error PTRCALL
errorProcessor(XML_Parser parser,
const char *s,
const char *end,
const char **nextPtr)
{
return errorCode;
}
static enum XML_Error
storeAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata,
const char *ptr, const char *end,
STRING_POOL *pool)
{
enum XML_Error result = appendAttributeValue(parser, enc, isCdata, ptr,
end, pool);
if (result)
return result;
if (!isCdata && poolLength(pool) && poolLastChar(pool) == 0x20)
poolChop(pool);
if (!poolAppendChar(pool, XML_T('\0')))
return XML_ERROR_NO_MEMORY;
return XML_ERROR_NONE;
}
static enum XML_Error
appendAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata,
const char *ptr, const char *end,
STRING_POOL *pool)
{
DTD * const dtd = _dtd; /* save one level of indirection */
for (;;) {
const char *next;
int tok = XmlAttributeValueTok(enc, ptr, end, &next);
switch (tok) {
case XML_TOK_NONE:
return XML_ERROR_NONE;
case XML_TOK_INVALID:
if (enc == encoding)
eventPtr = next;
return XML_ERROR_INVALID_TOKEN;
case XML_TOK_PARTIAL:
if (enc == encoding)
eventPtr = ptr;
return XML_ERROR_INVALID_TOKEN;
case XML_TOK_CHAR_REF:
{
XML_Char buf[XML_ENCODE_MAX];
int i;
int n = XmlCharRefNumber(enc, ptr);
if (n < 0) {
if (enc == encoding)
eventPtr = ptr;
return XML_ERROR_BAD_CHAR_REF;
}
if (!isCdata
&& n == 0x20 /* space */
&& (poolLength(pool) == 0 || poolLastChar(pool) == 0x20))
break;
n = XmlEncode(n, (ICHAR *)buf);
if (!n) {
if (enc == encoding)
eventPtr = ptr;
return XML_ERROR_BAD_CHAR_REF;
}
for (i = 0; i < n; i++) {
if (!poolAppendChar(pool, buf[i]))
return XML_ERROR_NO_MEMORY;
}
}
break;
case XML_TOK_DATA_CHARS:
if (!poolAppend(pool, enc, ptr, next))
return XML_ERROR_NO_MEMORY;
break;
case XML_TOK_TRAILING_CR:
next = ptr + enc->minBytesPerChar;
/* fall through */
case XML_TOK_ATTRIBUTE_VALUE_S:
case XML_TOK_DATA_NEWLINE:
if (!isCdata && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20))
break;
if (!poolAppendChar(pool, 0x20))
return XML_ERROR_NO_MEMORY;
break;
case XML_TOK_ENTITY_REF:
{
const XML_Char *name;
ENTITY *entity;
char checkEntityDecl;
XML_Char ch = (XML_Char) XmlPredefinedEntityName(enc,
ptr + enc->minBytesPerChar,
next - enc->minBytesPerChar);
if (ch) {
if (!poolAppendChar(pool, ch))
return XML_ERROR_NO_MEMORY;
break;
}
name = poolStoreString(&temp2Pool, enc,
ptr + enc->minBytesPerChar,
next - enc->minBytesPerChar);
if (!name)
return XML_ERROR_NO_MEMORY;
entity = (ENTITY *)lookup(&dtd->generalEntities, name, 0);
poolDiscard(&temp2Pool);
/* First, determine if a check for an existing declaration is needed;
if yes, check that the entity exists, and that it is internal.
*/
if (pool == &dtd->pool) /* are we called from prolog? */
checkEntityDecl =
#ifdef XML_DTD
prologState.documentEntity &&
#endif /* XML_DTD */
(dtd->standalone
? !openInternalEntities
: !dtd->hasParamEntityRefs);
else /* if (pool == &tempPool): we are called from content */
checkEntityDecl = !dtd->hasParamEntityRefs || dtd->standalone;
if (checkEntityDecl) {
if (!entity)
return XML_ERROR_UNDEFINED_ENTITY;
else if (!entity->is_internal)
return XML_ERROR_ENTITY_DECLARED_IN_PE;
}
else if (!entity) {
/* Cannot report skipped entity here - see comments on
skippedEntityHandler.
if (skippedEntityHandler)
skippedEntityHandler(handlerArg, name, 0);
*/
/* Cannot call the default handler because this would be
out of sync with the call to the startElementHandler.
if ((pool == &tempPool) && defaultHandler)
reportDefault(parser, enc, ptr, next);
*/
break;
}
if (entity->open) {
if (enc == encoding)
eventPtr = ptr;
return XML_ERROR_RECURSIVE_ENTITY_REF;
}
if (entity->notation) {
if (enc == encoding)
eventPtr = ptr;
return XML_ERROR_BINARY_ENTITY_REF;
}
if (!entity->textPtr) {
if (enc == encoding)
eventPtr = ptr;
return XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF;
}
else {
enum XML_Error result;
const XML_Char *textEnd = entity->textPtr + entity->textLen;
entity->open = XML_TRUE;
result = appendAttributeValue(parser, internalEncoding, isCdata,
(char *)entity->textPtr,
(char *)textEnd, pool);
entity->open = XML_FALSE;
if (result)
return result;
}
}
break;
default:
if (enc == encoding)
eventPtr = ptr;
return XML_ERROR_UNEXPECTED_STATE;
}
ptr = next;
}
/* not reached */
}
static enum XML_Error
storeEntityValue(XML_Parser parser,
const ENCODING *enc,
const char *entityTextPtr,
const char *entityTextEnd)
{
DTD * const dtd = _dtd; /* save one level of indirection */
STRING_POOL *pool = &(dtd->entityValuePool);
enum XML_Error result = XML_ERROR_NONE;
#ifdef XML_DTD
int oldInEntityValue = prologState.inEntityValue;
prologState.inEntityValue = 1;
#endif /* XML_DTD */
/* never return Null for the value argument in EntityDeclHandler,
since this would indicate an external entity; therefore we
have to make sure that entityValuePool.start is not null */
if (!pool->blocks) {
if (!poolGrow(pool))
return XML_ERROR_NO_MEMORY;
}
for (;;) {
const char *next;
int tok = XmlEntityValueTok(enc, entityTextPtr, entityTextEnd, &next);
switch (tok) {
case XML_TOK_PARAM_ENTITY_REF:
#ifdef XML_DTD
if (isParamEntity || enc != encoding) {
const XML_Char *name;
ENTITY *entity;
name = poolStoreString(&tempPool, enc,
entityTextPtr + enc->minBytesPerChar,
next - enc->minBytesPerChar);
if (!name) {
result = XML_ERROR_NO_MEMORY;
goto endEntityValue;
}
entity = (ENTITY *)lookup(&dtd->paramEntities, name, 0);
poolDiscard(&tempPool);
if (!entity) {
/* not a well-formedness error - see XML 1.0: WFC Entity Declared */
/* cannot report skipped entity here - see comments on
skippedEntityHandler
if (skippedEntityHandler)
skippedEntityHandler(handlerArg, name, 0);
*/
dtd->keepProcessing = dtd->standalone;
goto endEntityValue;
}
if (entity->open) {
if (enc == encoding)
eventPtr = entityTextPtr;
result = XML_ERROR_RECURSIVE_ENTITY_REF;
goto endEntityValue;
}
if (entity->systemId) {
if (externalEntityRefHandler) {
dtd->paramEntityRead = XML_FALSE;
entity->open = XML_TRUE;
if (!externalEntityRefHandler(externalEntityRefHandlerArg,
0,
entity->base,
entity->systemId,
entity->publicId)) {
entity->open = XML_FALSE;
result = XML_ERROR_EXTERNAL_ENTITY_HANDLING;
goto endEntityValue;
}
entity->open = XML_FALSE;
if (!dtd->paramEntityRead)
dtd->keepProcessing = dtd->standalone;
}
else
dtd->keepProcessing = dtd->standalone;
}
else {
entity->open = XML_TRUE;
result = storeEntityValue(parser,
internalEncoding,
(char *)entity->textPtr,
(char *)(entity->textPtr
+ entity->textLen));
entity->open = XML_FALSE;
if (result)
goto endEntityValue;
}
break;
}
#endif /* XML_DTD */
/* In the internal subset, PE references are not legal
within markup declarations, e.g entity values in this case. */
eventPtr = entityTextPtr;
result = XML_ERROR_PARAM_ENTITY_REF;
goto endEntityValue;
case XML_TOK_NONE:
result = XML_ERROR_NONE;
goto endEntityValue;
case XML_TOK_ENTITY_REF:
case XML_TOK_DATA_CHARS:
if (!poolAppend(pool, enc, entityTextPtr, next)) {
result = XML_ERROR_NO_MEMORY;
goto endEntityValue;
}
break;
case XML_TOK_TRAILING_CR:
next = entityTextPtr + enc->minBytesPerChar;
/* fall through */
case XML_TOK_DATA_NEWLINE:
if (pool->end == pool->ptr && !poolGrow(pool)) {
result = XML_ERROR_NO_MEMORY;
goto endEntityValue;
}
*(pool->ptr)++ = 0xA;
break;
case XML_TOK_CHAR_REF:
{
XML_Char buf[XML_ENCODE_MAX];
int i;
int n = XmlCharRefNumber(enc, entityTextPtr);
if (n < 0) {
if (enc == encoding)
eventPtr = entityTextPtr;
result = XML_ERROR_BAD_CHAR_REF;
goto endEntityValue;
}
n = XmlEncode(n, (ICHAR *)buf);
if (!n) {
if (enc == encoding)
eventPtr = entityTextPtr;
result = XML_ERROR_BAD_CHAR_REF;
goto endEntityValue;
}
for (i = 0; i < n; i++) {
if (pool->end == pool->ptr && !poolGrow(pool)) {
result = XML_ERROR_NO_MEMORY;
goto endEntityValue;
}
*(pool->ptr)++ = buf[i];
}
}
break;
case XML_TOK_PARTIAL:
if (enc == encoding)
eventPtr = entityTextPtr;
result = XML_ERROR_INVALID_TOKEN;
goto endEntityValue;
case XML_TOK_INVALID:
if (enc == encoding)
eventPtr = next;
result = XML_ERROR_INVALID_TOKEN;
goto endEntityValue;
default:
if (enc == encoding)
eventPtr = entityTextPtr;
result = XML_ERROR_UNEXPECTED_STATE;
goto endEntityValue;
}
entityTextPtr = next;
}
endEntityValue:
#ifdef XML_DTD
prologState.inEntityValue = oldInEntityValue;
#endif /* XML_DTD */
return result;
}
static void FASTCALL
normalizeLines(XML_Char *s)
{
XML_Char *p;
for (;; s++) {
if (*s == XML_T('\0'))
return;
if (*s == 0xD)
break;
}
p = s;
do {
if (*s == 0xD) {
*p++ = 0xA;
if (*++s == 0xA)
s++;
}
else
*p++ = *s++;
} while (*s);
*p = XML_T('\0');
}
static int
reportProcessingInstruction(XML_Parser parser, const ENCODING *enc,
const char *start, const char *end)
{
const XML_Char *target;
XML_Char *data;
const char *tem;
if (!processingInstructionHandler) {
if (defaultHandler)
reportDefault(parser, enc, start, end);
return 1;
}
start += enc->minBytesPerChar * 2;
tem = start + XmlNameLength(enc, start);
target = poolStoreString(&tempPool, enc, start, tem);
if (!target)
return 0;
poolFinish(&tempPool);
data = poolStoreString(&tempPool, enc,
XmlSkipS(enc, tem),
end - enc->minBytesPerChar*2);
if (!data)
return 0;
normalizeLines(data);
processingInstructionHandler(handlerArg, target, data);
poolClear(&tempPool);
return 1;
}
static int
reportComment(XML_Parser parser, const ENCODING *enc,
const char *start, const char *end)
{
XML_Char *data;
if (!commentHandler) {
if (defaultHandler)
reportDefault(parser, enc, start, end);
return 1;
}
data = poolStoreString(&tempPool,
enc,
start + enc->minBytesPerChar * 4,
end - enc->minBytesPerChar * 3);
if (!data)
return 0;
normalizeLines(data);
commentHandler(handlerArg, data);
poolClear(&tempPool);
return 1;
}
static void
reportDefault(XML_Parser parser, const ENCODING *enc,
const char *s, const char *end)
{
if (MUST_CONVERT(enc, s)) {
const char **eventPP;
const char **eventEndPP;
if (enc == encoding) {
eventPP = &eventPtr;
eventEndPP = &eventEndPtr;
}
else {
eventPP = &(openInternalEntities->internalEventPtr);
eventEndPP = &(openInternalEntities->internalEventEndPtr);
}
do {
ICHAR *dataPtr = (ICHAR *)dataBuf;
XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd);
*eventEndPP = s;
defaultHandler(handlerArg, dataBuf, (int)(dataPtr - (ICHAR *)dataBuf));
*eventPP = s;
} while (s != end);
}
else
defaultHandler(handlerArg, (XML_Char *)s, (int)((XML_Char *)end - (XML_Char *)s));
}
static int
defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *attId, XML_Bool isCdata,
XML_Bool isId, const XML_Char *value, XML_Parser parser)
{
DEFAULT_ATTRIBUTE *att;
if (value || isId) {
/* The handling of default attributes gets messed up if we have
a default which duplicates a non-default. */
int i;
for (i = 0; i < type->nDefaultAtts; i++)
if (attId == type->defaultAtts[i].id)
return 1;
if (isId && !type->idAtt && !attId->xmlns)
type->idAtt = attId;
}
if (type->nDefaultAtts == type->allocDefaultAtts) {
if (type->allocDefaultAtts == 0) {
type->allocDefaultAtts = 8;
type->defaultAtts = (DEFAULT_ATTRIBUTE *)MALLOC(type->allocDefaultAtts
* sizeof(DEFAULT_ATTRIBUTE));
if (!type->defaultAtts)
return 0;
}
else {
DEFAULT_ATTRIBUTE *temp;
int count = type->allocDefaultAtts * 2;
temp = (DEFAULT_ATTRIBUTE *)
REALLOC(type->defaultAtts, (count * sizeof(DEFAULT_ATTRIBUTE)));
if (temp == NULL)
return 0;
type->allocDefaultAtts = count;
type->defaultAtts = temp;
}
}
att = type->defaultAtts + type->nDefaultAtts;
att->id = attId;
att->value = value;
att->isCdata = isCdata;
if (!isCdata)
attId->maybeTokenized = XML_TRUE;
type->nDefaultAtts += 1;
return 1;
}
static int
setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *elementType)
{
DTD * const dtd = _dtd; /* save one level of indirection */
const XML_Char *name;
for (name = elementType->name; *name; name++) {
if (*name == XML_T(ASCII_COLON)) {
PREFIX *prefix;
const XML_Char *s;
for (s = elementType->name; s != name; s++) {
if (!poolAppendChar(&dtd->pool, *s))
return 0;
}
if (!poolAppendChar(&dtd->pool, XML_T('\0')))
return 0;
prefix = (PREFIX *)lookup(&dtd->prefixes, poolStart(&dtd->pool),
sizeof(PREFIX));
if (!prefix)
return 0;
if (prefix->name == poolStart(&dtd->pool))
poolFinish(&dtd->pool);
else
poolDiscard(&dtd->pool);
elementType->prefix = prefix;
}
}
return 1;
}
static ATTRIBUTE_ID *
getAttributeId(XML_Parser parser, const ENCODING *enc,
const char *start, const char *end)
{
DTD * const dtd = _dtd; /* save one level of indirection */
ATTRIBUTE_ID *id;
const XML_Char *name;
if (!poolAppendChar(&dtd->pool, XML_T('\0')))
return NULL;
name = poolStoreString(&dtd->pool, enc, start, end);
if (!name)
return NULL;
/* skip quotation mark - its storage will be re-used (like in name[-1]) */
++name;
id = (ATTRIBUTE_ID *)lookup(&dtd->attributeIds, name, sizeof(ATTRIBUTE_ID));
if (!id)
return NULL;
if (id->name != name)
poolDiscard(&dtd->pool);
else {
poolFinish(&dtd->pool);
if (!ns)
;
else if (name[0] == XML_T(ASCII_x)
&& name[1] == XML_T(ASCII_m)
&& name[2] == XML_T(ASCII_l)
&& name[3] == XML_T(ASCII_n)
&& name[4] == XML_T(ASCII_s)
&& (name[5] == XML_T('\0') || name[5] == XML_T(ASCII_COLON))) {
if (name[5] == XML_T('\0'))
id->prefix = &dtd->defaultPrefix;
else
id->prefix = (PREFIX *)lookup(&dtd->prefixes, name + 6, sizeof(PREFIX));
id->xmlns = XML_TRUE;
}
else {
int i;
for (i = 0; name[i]; i++) {
/* attributes without prefix are *not* in the default namespace */
if (name[i] == XML_T(ASCII_COLON)) {
int j;
for (j = 0; j < i; j++) {
if (!poolAppendChar(&dtd->pool, name[j]))
return NULL;
}
if (!poolAppendChar(&dtd->pool, XML_T('\0')))
return NULL;
id->prefix = (PREFIX *)lookup(&dtd->prefixes, poolStart(&dtd->pool),
sizeof(PREFIX));
if (id->prefix->name == poolStart(&dtd->pool))
poolFinish(&dtd->pool);
else
poolDiscard(&dtd->pool);
break;
}
}
}
}
return id;
}
#define CONTEXT_SEP XML_T(ASCII_FF)
static const XML_Char *
getContext(XML_Parser parser)
{
DTD * const dtd = _dtd; /* save one level of indirection */
HASH_TABLE_ITER iter;
XML_Bool needSep = XML_FALSE;
if (dtd->defaultPrefix.binding) {
int i;
int len;
if (!poolAppendChar(&tempPool, XML_T(ASCII_EQUALS)))
return NULL;
len = dtd->defaultPrefix.binding->uriLen;
if (namespaceSeparator)
len--;
for (i = 0; i < len; i++)
if (!poolAppendChar(&tempPool, dtd->defaultPrefix.binding->uri[i]))
return NULL;
needSep = XML_TRUE;
}
hashTableIterInit(&iter, &(dtd->prefixes));
for (;;) {
int i;
int len;
const XML_Char *s;
PREFIX *prefix = (PREFIX *)hashTableIterNext(&iter);
if (!prefix)
break;
if (!prefix->binding)
continue;
if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP))
return NULL;
for (s = prefix->name; *s; s++)
if (!poolAppendChar(&tempPool, *s))
return NULL;
if (!poolAppendChar(&tempPool, XML_T(ASCII_EQUALS)))
return NULL;
len = prefix->binding->uriLen;
if (namespaceSeparator)
len--;
for (i = 0; i < len; i++)
if (!poolAppendChar(&tempPool, prefix->binding->uri[i]))
return NULL;
needSep = XML_TRUE;
}
hashTableIterInit(&iter, &(dtd->generalEntities));
for (;;) {
const XML_Char *s;
ENTITY *e = (ENTITY *)hashTableIterNext(&iter);
if (!e)
break;
if (!e->open)
continue;
if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP))
return NULL;
for (s = e->name; *s; s++)
if (!poolAppendChar(&tempPool, *s))
return 0;
needSep = XML_TRUE;
}
if (!poolAppendChar(&tempPool, XML_T('\0')))
return NULL;
return tempPool.start;
}
static XML_Bool
setContext(XML_Parser parser, const XML_Char *context)
{
DTD * const dtd = _dtd; /* save one level of indirection */
const XML_Char *s = context;
while (*context != XML_T('\0')) {
if (*s == CONTEXT_SEP || *s == XML_T('\0')) {
ENTITY *e;
if (!poolAppendChar(&tempPool, XML_T('\0')))
return XML_FALSE;
e = (ENTITY *)lookup(&dtd->generalEntities, poolStart(&tempPool), 0);
if (e)
e->open = XML_TRUE;
if (*s != XML_T('\0'))
s++;
context = s;
poolDiscard(&tempPool);
}
else if (*s == XML_T(ASCII_EQUALS)) {
PREFIX *prefix;
if (poolLength(&tempPool) == 0)
prefix = &dtd->defaultPrefix;
else {
if (!poolAppendChar(&tempPool, XML_T('\0')))
return XML_FALSE;
prefix = (PREFIX *)lookup(&dtd->prefixes, poolStart(&tempPool),
sizeof(PREFIX));
if (!prefix)
return XML_FALSE;
if (prefix->name == poolStart(&tempPool)) {
prefix->name = poolCopyString(&dtd->pool, prefix->name);
if (!prefix->name)
return XML_FALSE;
}
poolDiscard(&tempPool);
}
for (context = s + 1;
*context != CONTEXT_SEP && *context != XML_T('\0');
context++)
if (!poolAppendChar(&tempPool, *context))
return XML_FALSE;
if (!poolAppendChar(&tempPool, XML_T('\0')))
return XML_FALSE;
if (addBinding(parser, prefix, NULL, poolStart(&tempPool),
&inheritedBindings) != XML_ERROR_NONE)
return XML_FALSE;
poolDiscard(&tempPool);
if (*context != XML_T('\0'))
++context;
s = context;
}
else {
if (!poolAppendChar(&tempPool, *s))
return XML_FALSE;
s++;
}
}
return XML_TRUE;
}
static void FASTCALL
normalizePublicId(XML_Char *publicId)
{
XML_Char *p = publicId;
XML_Char *s;
for (s = publicId; *s; s++) {
switch (*s) {
case 0x20:
case 0xD:
case 0xA:
if (p != publicId && p[-1] != 0x20)
*p++ = 0x20;
break;
default:
*p++ = *s;
}
}
if (p != publicId && p[-1] == 0x20)
--p;
*p = XML_T('\0');
}
static DTD *
dtdCreate(const XML_Memory_Handling_Suite *ms)
{
DTD *p = (DTD *)ms->malloc_fcn(sizeof(DTD));
if (p == NULL)
return p;
poolInit(&(p->pool), ms);
poolInit(&(p->entityValuePool), ms);
hashTableInit(&(p->generalEntities), ms);
hashTableInit(&(p->elementTypes), ms);
hashTableInit(&(p->attributeIds), ms);
hashTableInit(&(p->prefixes), ms);
#ifdef XML_DTD
p->paramEntityRead = XML_FALSE;
hashTableInit(&(p->paramEntities), ms);
#endif /* XML_DTD */
p->defaultPrefix.name = NULL;
p->defaultPrefix.binding = NULL;
p->in_eldecl = XML_FALSE;
p->scaffIndex = NULL;
p->scaffold = NULL;
p->scaffLevel = 0;
p->scaffSize = 0;
p->scaffCount = 0;
p->contentStringLen = 0;
p->keepProcessing = XML_TRUE;
p->hasParamEntityRefs = XML_FALSE;
p->standalone = XML_FALSE;
return p;
}
static void
dtdReset(DTD *p, const XML_Memory_Handling_Suite *ms)
{
HASH_TABLE_ITER iter;
hashTableIterInit(&iter, &(p->elementTypes));
for (;;) {
ELEMENT_TYPE *e = (ELEMENT_TYPE *)hashTableIterNext(&iter);
if (!e)
break;
if (e->allocDefaultAtts != 0)
ms->free_fcn(e->defaultAtts);
}
hashTableClear(&(p->generalEntities));
#ifdef XML_DTD
p->paramEntityRead = XML_FALSE;
hashTableClear(&(p->paramEntities));
#endif /* XML_DTD */
hashTableClear(&(p->elementTypes));
hashTableClear(&(p->attributeIds));
hashTableClear(&(p->prefixes));
poolClear(&(p->pool));
poolClear(&(p->entityValuePool));
p->defaultPrefix.name = NULL;
p->defaultPrefix.binding = NULL;
p->in_eldecl = XML_FALSE;
ms->free_fcn(p->scaffIndex);
p->scaffIndex = NULL;
ms->free_fcn(p->scaffold);
p->scaffold = NULL;
p->scaffLevel = 0;
p->scaffSize = 0;
p->scaffCount = 0;
p->contentStringLen = 0;
p->keepProcessing = XML_TRUE;
p->hasParamEntityRefs = XML_FALSE;
p->standalone = XML_FALSE;
}
static void
dtdDestroy(DTD *p, XML_Bool isDocEntity, const XML_Memory_Handling_Suite *ms)
{
HASH_TABLE_ITER iter;
hashTableIterInit(&iter, &(p->elementTypes));
for (;;) {
ELEMENT_TYPE *e = (ELEMENT_TYPE *)hashTableIterNext(&iter);
if (!e)
break;
if (e->allocDefaultAtts != 0)
ms->free_fcn(e->defaultAtts);
}
hashTableDestroy(&(p->generalEntities));
#ifdef XML_DTD
hashTableDestroy(&(p->paramEntities));
#endif /* XML_DTD */
hashTableDestroy(&(p->elementTypes));
hashTableDestroy(&(p->attributeIds));
hashTableDestroy(&(p->prefixes));
poolDestroy(&(p->pool));
poolDestroy(&(p->entityValuePool));
if (isDocEntity) {
ms->free_fcn(p->scaffIndex);
ms->free_fcn(p->scaffold);
}
ms->free_fcn(p);
}
/* Do a deep copy of the DTD. Return 0 for out of memory, non-zero otherwise.
The new DTD has already been initialized.
*/
static int
dtdCopy(DTD *newDtd, const DTD *oldDtd, const XML_Memory_Handling_Suite *ms)
{
HASH_TABLE_ITER iter;
/* Copy the prefix table. */
hashTableIterInit(&iter, &(oldDtd->prefixes));
for (;;) {
const XML_Char *name;
const PREFIX *oldP = (PREFIX *)hashTableIterNext(&iter);
if (!oldP)
break;
name = poolCopyString(&(newDtd->pool), oldP->name);
if (!name)
return 0;
if (!lookup(&(newDtd->prefixes), name, sizeof(PREFIX)))
return 0;
}
hashTableIterInit(&iter, &(oldDtd->attributeIds));
/* Copy the attribute id table. */
for (;;) {
ATTRIBUTE_ID *newA;
const XML_Char *name;
const ATTRIBUTE_ID *oldA = (ATTRIBUTE_ID *)hashTableIterNext(&iter);
if (!oldA)
break;
/* Remember to allocate the scratch byte before the name. */
if (!poolAppendChar(&(newDtd->pool), XML_T('\0')))
return 0;
name = poolCopyString(&(newDtd->pool), oldA->name);
if (!name)
return 0;
++name;
newA = (ATTRIBUTE_ID *)lookup(&(newDtd->attributeIds), name,
sizeof(ATTRIBUTE_ID));
if (!newA)
return 0;
newA->maybeTokenized = oldA->maybeTokenized;
if (oldA->prefix) {
newA->xmlns = oldA->xmlns;
if (oldA->prefix == &oldDtd->defaultPrefix)
newA->prefix = &newDtd->defaultPrefix;
else
newA->prefix = (PREFIX *)lookup(&(newDtd->prefixes),
oldA->prefix->name, 0);
}
}
/* Copy the element type table. */
hashTableIterInit(&iter, &(oldDtd->elementTypes));
for (;;) {
int i;
ELEMENT_TYPE *newE;
const XML_Char *name;
const ELEMENT_TYPE *oldE = (ELEMENT_TYPE *)hashTableIterNext(&iter);
if (!oldE)
break;
name = poolCopyString(&(newDtd->pool), oldE->name);
if (!name)
return 0;
newE = (ELEMENT_TYPE *)lookup(&(newDtd->elementTypes), name,
sizeof(ELEMENT_TYPE));
if (!newE)
return 0;
if (oldE->nDefaultAtts) {
newE->defaultAtts = (DEFAULT_ATTRIBUTE *)
ms->malloc_fcn(oldE->nDefaultAtts * sizeof(DEFAULT_ATTRIBUTE));
if (!newE->defaultAtts) {
ms->free_fcn(newE);
return 0;
}
}
if (oldE->idAtt)
newE->idAtt = (ATTRIBUTE_ID *)
lookup(&(newDtd->attributeIds), oldE->idAtt->name, 0);
newE->allocDefaultAtts = newE->nDefaultAtts = oldE->nDefaultAtts;
if (oldE->prefix)
newE->prefix = (PREFIX *)lookup(&(newDtd->prefixes),
oldE->prefix->name, 0);
for (i = 0; i < newE->nDefaultAtts; i++) {
newE->defaultAtts[i].id = (ATTRIBUTE_ID *)
lookup(&(newDtd->attributeIds), oldE->defaultAtts[i].id->name, 0);
newE->defaultAtts[i].isCdata = oldE->defaultAtts[i].isCdata;
if (oldE->defaultAtts[i].value) {
newE->defaultAtts[i].value
= poolCopyString(&(newDtd->pool), oldE->defaultAtts[i].value);
if (!newE->defaultAtts[i].value)
return 0;
}
else
newE->defaultAtts[i].value = NULL;
}
}
/* Copy the entity tables. */
if (!copyEntityTable(&(newDtd->generalEntities),
&(newDtd->pool),
&(oldDtd->generalEntities)))
return 0;
#ifdef XML_DTD
if (!copyEntityTable(&(newDtd->paramEntities),
&(newDtd->pool),
&(oldDtd->paramEntities)))
return 0;
newDtd->paramEntityRead = oldDtd->paramEntityRead;
#endif /* XML_DTD */
newDtd->keepProcessing = oldDtd->keepProcessing;
newDtd->hasParamEntityRefs = oldDtd->hasParamEntityRefs;
newDtd->standalone = oldDtd->standalone;
/* Don't want deep copying for scaffolding */
newDtd->in_eldecl = oldDtd->in_eldecl;
newDtd->scaffold = oldDtd->scaffold;
newDtd->contentStringLen = oldDtd->contentStringLen;
newDtd->scaffSize = oldDtd->scaffSize;
newDtd->scaffLevel = oldDtd->scaffLevel;
newDtd->scaffIndex = oldDtd->scaffIndex;
return 1;
} /* End dtdCopy */
static int
copyEntityTable(HASH_TABLE *newTable,
STRING_POOL *newPool,
const HASH_TABLE *oldTable)
{
HASH_TABLE_ITER iter;
const XML_Char *cachedOldBase = NULL;
const XML_Char *cachedNewBase = NULL;
hashTableIterInit(&iter, oldTable);
for (;;) {
ENTITY *newE;
const XML_Char *name;
const ENTITY *oldE = (ENTITY *)hashTableIterNext(&iter);
if (!oldE)
break;
name = poolCopyString(newPool, oldE->name);
if (!name)
return 0;
newE = (ENTITY *)lookup(newTable, name, sizeof(ENTITY));
if (!newE)
return 0;
if (oldE->systemId) {
const XML_Char *tem = poolCopyString(newPool, oldE->systemId);
if (!tem)
return 0;
newE->systemId = tem;
if (oldE->base) {
if (oldE->base == cachedOldBase)
newE->base = cachedNewBase;
else {
cachedOldBase = oldE->base;
tem = poolCopyString(newPool, cachedOldBase);
if (!tem)
return 0;
cachedNewBase = newE->base = tem;
}
}
if (oldE->publicId) {
tem = poolCopyString(newPool, oldE->publicId);
if (!tem)
return 0;
newE->publicId = tem;
}
}
else {
const XML_Char *tem = poolCopyStringN(newPool, oldE->textPtr,
oldE->textLen);
if (!tem)
return 0;
newE->textPtr = tem;
newE->textLen = oldE->textLen;
}
if (oldE->notation) {
const XML_Char *tem = poolCopyString(newPool, oldE->notation);
if (!tem)
return 0;
newE->notation = tem;
}
newE->is_param = oldE->is_param;
newE->is_internal = oldE->is_internal;
}
return 1;
}
#define INIT_POWER 6
static XML_Bool FASTCALL
keyeq(KEY s1, KEY s2)
{
for (; *s1 == *s2; s1++, s2++)
if (*s1 == 0)
return XML_TRUE;
return XML_FALSE;
}
static unsigned long FASTCALL
hash(KEY s)
{
unsigned long h = 0;
while (*s)
h = CHAR_HASH(h, *s++);
return h;
}
static NAMED *
lookup(HASH_TABLE *table, KEY name, size_t createSize)
{
size_t i;
if (table->size == 0) {
size_t tsize;
if (!createSize)
return NULL;
table->power = INIT_POWER;
/* table->size is a power of 2 */
table->size = (size_t)1 << INIT_POWER;
tsize = table->size * sizeof(NAMED *);
table->v = (NAMED **)table->mem->malloc_fcn(tsize);
if (!table->v) {
table->size = 0;
return NULL;
}
memset(table->v, 0, tsize);
i = hash(name) & ((unsigned long)table->size - 1);
}
else {
unsigned long h = hash(name);
unsigned long mask = (unsigned long)table->size - 1;
unsigned char step = 0;
i = h & mask;
while (table->v[i]) {
if (keyeq(name, table->v[i]->name))
return table->v[i];
if (!step)
step = PROBE_STEP(h, mask, table->power);
i < step ? (i += table->size - step) : (i -= step);
}
if (!createSize)
return NULL;
/* check for overflow (table is half full) */
if (table->used >> (table->power - 1)) {
unsigned char newPower = table->power + 1;
size_t newSize = (size_t)1 << newPower;
unsigned long newMask = (unsigned long)newSize - 1;
size_t tsize = newSize * sizeof(NAMED *);
NAMED **newV = (NAMED **)table->mem->malloc_fcn(tsize);
if (!newV)
return NULL;
memset(newV, 0, tsize);
for (i = 0; i < table->size; i++)
if (table->v[i]) {
unsigned long newHash = hash(table->v[i]->name);
size_t j = newHash & newMask;
step = 0;
while (newV[j]) {
if (!step)
step = PROBE_STEP(newHash, newMask, newPower);
j < step ? (j += newSize - step) : (j -= step);
}
newV[j] = table->v[i];
}
table->mem->free_fcn(table->v);
table->v = newV;
table->power = newPower;
table->size = newSize;
i = h & newMask;
step = 0;
while (table->v[i]) {
if (!step)
step = PROBE_STEP(h, newMask, newPower);
i < step ? (i += newSize - step) : (i -= step);
}
}
}
table->v[i] = (NAMED *)table->mem->malloc_fcn(createSize);
if (!table->v[i])
return NULL;
memset(table->v[i], 0, createSize);
table->v[i]->name = name;
(table->used)++;
return table->v[i];
}
static void FASTCALL
hashTableClear(HASH_TABLE *table)
{
size_t i;
for (i = 0; i < table->size; i++) {
table->mem->free_fcn(table->v[i]);
table->v[i] = NULL;
}
table->used = 0;
}
static void FASTCALL
hashTableDestroy(HASH_TABLE *table)
{
size_t i;
for (i = 0; i < table->size; i++)
table->mem->free_fcn(table->v[i]);
table->mem->free_fcn(table->v);
}
static void FASTCALL
hashTableInit(HASH_TABLE *p, const XML_Memory_Handling_Suite *ms)
{
p->power = 0;
p->size = 0;
p->used = 0;
p->v = NULL;
p->mem = ms;
}
static void FASTCALL
hashTableIterInit(HASH_TABLE_ITER *iter, const HASH_TABLE *table)
{
iter->p = table->v;
iter->end = iter->p + table->size;
}
static NAMED * FASTCALL
hashTableIterNext(HASH_TABLE_ITER *iter)
{
while (iter->p != iter->end) {
NAMED *tem = *(iter->p)++;
if (tem)
return tem;
}
return NULL;
}
static void FASTCALL
poolInit(STRING_POOL *pool, const XML_Memory_Handling_Suite *ms)
{
pool->blocks = NULL;
pool->freeBlocks = NULL;
pool->start = NULL;
pool->ptr = NULL;
pool->end = NULL;
pool->mem = ms;
}
static void FASTCALL
poolClear(STRING_POOL *pool)
{
if (!pool->freeBlocks)
pool->freeBlocks = pool->blocks;
else {
BLOCK *p = pool->blocks;
while (p) {
BLOCK *tem = p->next;
p->next = pool->freeBlocks;
pool->freeBlocks = p;
p = tem;
}
}
pool->blocks = NULL;
pool->start = NULL;
pool->ptr = NULL;
pool->end = NULL;
}
static void FASTCALL
poolDestroy(STRING_POOL *pool)
{
BLOCK *p = pool->blocks;
while (p) {
BLOCK *tem = p->next;
pool->mem->free_fcn(p);
p = tem;
}
p = pool->freeBlocks;
while (p) {
BLOCK *tem = p->next;
pool->mem->free_fcn(p);
p = tem;
}
}
static XML_Char *
poolAppend(STRING_POOL *pool, const ENCODING *enc,
const char *ptr, const char *end)
{
if (!pool->ptr && !poolGrow(pool))
return NULL;
for (;;) {
XmlConvert(enc, &ptr, end, (ICHAR **)&(pool->ptr), (ICHAR *)pool->end);
if (ptr == end)
break;
if (!poolGrow(pool))
return NULL;
}
return pool->start;
}
static const XML_Char * FASTCALL
poolCopyString(STRING_POOL *pool, const XML_Char *s)
{
do {
if (!poolAppendChar(pool, *s))
return NULL;
} while (*s++);
s = pool->start;
poolFinish(pool);
return s;
}
static const XML_Char *
poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n)
{
if (!pool->ptr && !poolGrow(pool))
return NULL;
for (; n > 0; --n, s++) {
if (!poolAppendChar(pool, *s))
return NULL;
}
s = pool->start;
poolFinish(pool);
return s;
}
static const XML_Char * FASTCALL
poolAppendString(STRING_POOL *pool, const XML_Char *s)
{
while (*s) {
if (!poolAppendChar(pool, *s))
return NULL;
s++;
}
return pool->start;
}
static XML_Char *
poolStoreString(STRING_POOL *pool, const ENCODING *enc,
const char *ptr, const char *end)
{
if (!poolAppend(pool, enc, ptr, end))
return NULL;
if (pool->ptr == pool->end && !poolGrow(pool))
return NULL;
*(pool->ptr)++ = 0;
return pool->start;
}
static XML_Bool FASTCALL
poolGrow(STRING_POOL *pool)
{
if (pool->freeBlocks) {
if (pool->start == 0) {
pool->blocks = pool->freeBlocks;
pool->freeBlocks = pool->freeBlocks->next;
pool->blocks->next = NULL;
pool->start = pool->blocks->s;
pool->end = pool->start + pool->blocks->size;
pool->ptr = pool->start;
return XML_TRUE;
}
if (pool->end - pool->start < pool->freeBlocks->size) {
BLOCK *tem = pool->freeBlocks->next;
pool->freeBlocks->next = pool->blocks;
pool->blocks = pool->freeBlocks;
pool->freeBlocks = tem;
memcpy(pool->blocks->s, pool->start,
(pool->end - pool->start) * sizeof(XML_Char));
pool->ptr = pool->blocks->s + (pool->ptr - pool->start);
pool->start = pool->blocks->s;
pool->end = pool->start + pool->blocks->size;
return XML_TRUE;
}
}
if (pool->blocks && pool->start == pool->blocks->s) {
int blockSize = (int)(pool->end - pool->start)*2;
BLOCK *temp = (BLOCK *)
pool->mem->realloc_fcn(pool->blocks,
(offsetof(BLOCK, s)
+ blockSize * sizeof(XML_Char)));
if (temp == NULL)
return XML_FALSE;
pool->blocks = temp;
pool->blocks->size = blockSize;
pool->ptr = pool->blocks->s + (pool->ptr - pool->start);
pool->start = pool->blocks->s;
pool->end = pool->start + blockSize;
}
else {
BLOCK *tem;
int blockSize = (int)(pool->end - pool->start);
if (blockSize < INIT_BLOCK_SIZE)
blockSize = INIT_BLOCK_SIZE;
else
blockSize *= 2;
tem = (BLOCK *)pool->mem->malloc_fcn(offsetof(BLOCK, s)
+ blockSize * sizeof(XML_Char));
if (!tem)
return XML_FALSE;
tem->size = blockSize;
tem->next = pool->blocks;
pool->blocks = tem;
if (pool->ptr != pool->start)
memcpy(tem->s, pool->start,
(pool->ptr - pool->start) * sizeof(XML_Char));
pool->ptr = tem->s + (pool->ptr - pool->start);
pool->start = tem->s;
pool->end = tem->s + blockSize;
}
return XML_TRUE;
}
static int FASTCALL
nextScaffoldPart(XML_Parser parser)
{
DTD * const dtd = _dtd; /* save one level of indirection */
CONTENT_SCAFFOLD * me;
int next;
if (!dtd->scaffIndex) {
dtd->scaffIndex = (int *)MALLOC(groupSize * sizeof(int));
if (!dtd->scaffIndex)
return -1;
dtd->scaffIndex[0] = 0;
}
if (dtd->scaffCount >= dtd->scaffSize) {
CONTENT_SCAFFOLD *temp;
if (dtd->scaffold) {
temp = (CONTENT_SCAFFOLD *)
REALLOC(dtd->scaffold, dtd->scaffSize * 2 * sizeof(CONTENT_SCAFFOLD));
if (temp == NULL)
return -1;
dtd->scaffSize *= 2;
}
else {
temp = (CONTENT_SCAFFOLD *)MALLOC(INIT_SCAFFOLD_ELEMENTS
* sizeof(CONTENT_SCAFFOLD));
if (temp == NULL)
return -1;
dtd->scaffSize = INIT_SCAFFOLD_ELEMENTS;
}
dtd->scaffold = temp;
}
next = dtd->scaffCount++;
me = &dtd->scaffold[next];
if (dtd->scaffLevel) {
CONTENT_SCAFFOLD *parent = &dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel-1]];
if (parent->lastchild) {
dtd->scaffold[parent->lastchild].nextsib = next;
}
if (!parent->childcnt)
parent->firstchild = next;
parent->lastchild = next;
parent->childcnt++;
}
me->firstchild = me->lastchild = me->childcnt = me->nextsib = 0;
return next;
}
static void
build_node(XML_Parser parser,
int src_node,
XML_Content *dest,
XML_Content **contpos,
XML_Char **strpos)
{
DTD * const dtd = _dtd; /* save one level of indirection */
dest->type = dtd->scaffold[src_node].type;
dest->quant = dtd->scaffold[src_node].quant;
if (dest->type == XML_CTYPE_NAME) {
const XML_Char *src;
dest->name = *strpos;
src = dtd->scaffold[src_node].name;
for (;;) {
*(*strpos)++ = *src;
if (!*src)
break;
src++;
}
dest->numchildren = 0;
dest->children = NULL;
}
else {
unsigned int i;
int cn;
dest->numchildren = dtd->scaffold[src_node].childcnt;
dest->children = *contpos;
*contpos += dest->numchildren;
for (i = 0, cn = dtd->scaffold[src_node].firstchild;
i < dest->numchildren;
i++, cn = dtd->scaffold[cn].nextsib) {
build_node(parser, cn, &(dest->children[i]), contpos, strpos);
}
dest->name = NULL;
}
}
static XML_Content *
build_model (XML_Parser parser)
{
DTD * const dtd = _dtd; /* save one level of indirection */
XML_Content *ret;
XML_Content *cpos;
XML_Char * str;
int allocsize = (dtd->scaffCount * sizeof(XML_Content)
+ (dtd->contentStringLen * sizeof(XML_Char)));
ret = (XML_Content *)MALLOC(allocsize);
if (!ret)
return NULL;
str = (XML_Char *) (&ret[dtd->scaffCount]);
cpos = &ret[1];
build_node(parser, 0, ret, &cpos, &str);
return ret;
}
static ELEMENT_TYPE *
getElementType(XML_Parser parser,
const ENCODING *enc,
const char *ptr,
const char *end)
{
DTD * const dtd = _dtd; /* save one level of indirection */
const XML_Char *name = poolStoreString(&dtd->pool, enc, ptr, end);
ELEMENT_TYPE *ret;
if (!name)
return NULL;
ret = (ELEMENT_TYPE *) lookup(&dtd->elementTypes, name, sizeof(ELEMENT_TYPE));
if (!ret)
return NULL;
if (ret->name != name)
poolDiscard(&dtd->pool);
else {
poolFinish(&dtd->pool);
if (!setElementTypePrefix(parser, ret))
return NULL;
}
return ret;
}
| [
"totte@dunescientific.com"
] | totte@dunescientific.com |
45d8f1386b604e8f35036e1767ca853d75bb3747 | 166bc8fe5a26d028799e19a1d638c801cd52a1a5 | /FInalProject/Render.h | 3e6d49030da0347dc21fb4b4f429f211d3f2e8c0 | [] | no_license | christiandaley/Biderectional-Path-Tracer | fb525e8e16b3582d959bf355d9b7afebf1fb7388 | 0398b5609a9c3bb2c320490678a7e1a5ef673ea9 | refs/heads/master | 2020-07-10T07:12:29.254973 | 2019-08-24T19:21:27 | 2019-08-24T19:21:27 | 204,201,653 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,779 | h | #ifndef RENDER_H
#define RENDER_H
#include <cmath>
#include <iostream>
#include "scene_io.h"
#define MULTITHREAD
//#define NUM_THREADS 2
#define IMPORTANCE_SAMPLING
#define LIGHT_TRACING
#define X_SAMPLES 64
#define Y_SAMPLES 64
#define EPSILON 0.000001
#define RUSSIAN_ROULETTE 0.8
#define MY_PI 3.14159265359
#define MAX_DEPTH 10
#define MIN(a, b) ((a) <= (b) ? (a) : (b))
#define MAX(a, b) ((a) >= (b) ? (a) : (b))
struct Vector3d {
double x, y, z;
Vector3d(const float *a) {
x = a[0];
y = a[1];
z = a[2];
}
Vector3d() {
x = 0.0, y = 0.0, z = 0.0;
}
Vector3d cross(const Vector3d &v) const {
Vector3d result;
result.x = (this->y * v.z) - (this->z * v.y);
result.y = -((this->x * v.z) - (this->z * v.x));
result.z = (this->x * v.y) - (this->y * v.x);
return result;
}
void normalize() {
double m = this->mag();
this->x /= m;
this->y /= m;
this->z /= m;
}
double mag() const {
return sqrt(this->x * this->x + this->y * this->y + this->z * this->z);
}
double dist2(const Vector3d &v) const {
double dx = this->x - v.x;
double dy = this->y - v.y;
double dz = this->z - v.z;
return dx * dx + dy * dy + dz * dz;
}
void print() const {
std::cout << x << ", " << y << ", " << z << std::endl;
}
};
typedef Vector3d Point3d;
typedef Vector3d Color3d;
struct Ray {
Point3d O;
Vector3d D;
};
void render(const SceneIO *scene, const int xres, const int yres, const char *name);
Vector3d operator+(const Vector3d &v1, const Vector3d &v2);
Vector3d operator-(const Vector3d &v1, const Vector3d &v2);
double operator*(const Vector3d &v1, const Vector3d &v2);
Vector3d operator*(const Vector3d &v1, const double c);
Vector3d operator*(const double c, const Vector3d &v1);
Vector3d operator-(const Vector3d &v);
#endif
| [
"christiandaley@gmail.com"
] | christiandaley@gmail.com |
11bca4d836ff9934c8997bba50ca7543a15e0a50 | 5eb0a285d333ed91fabf4463e60b0bbc3986c729 | /src/qt/bitcoin.cpp | 7525220c66ef180a44d0f3523d06d7334a22ab26 | [
"MIT"
] | permissive | CoinsSource/SourceCoin | 476b991aa0e61e7b29790a2e9356abd71d2cee3d | 3d0c384a8bf3f80cbf5e22e92d962a7ab67d6413 | refs/heads/master | 2020-12-24T14:09:27.854057 | 2014-05-06T19:42:37 | 2014-05-06T19:42:37 | 18,747,715 | 1 | 1 | null | 2014-05-06T19:42:37 | 2014-04-14T03:54:51 | C++ | UTF-8 | C++ | false | false | 9,173 | cpp | /*
* W.J. van der Laan 2011-2012
*/
#include "bitcoingui.h"
#include "clientmodel.h"
#include "walletmodel.h"
#include "optionsmodel.h"
#include "guiutil.h"
#include "guiconstants.h"
#include "init.h"
#include "ui_interface.h"
#include "qtipcserver.h"
#include <QApplication>
#include <QMessageBox>
#include <QTextCodec>
#include <QLocale>
#include <QTranslator>
#include <QSplashScreen>
#include <QLibraryInfo>
#if defined(BITCOIN_NEED_QT_PLUGINS) && !defined(_BITCOIN_QT_PLUGINS_INCLUDED)
#define _BITCOIN_QT_PLUGINS_INCLUDED
#define __INSURE__
#include <QtPlugin>
Q_IMPORT_PLUGIN(qcncodecs)
Q_IMPORT_PLUGIN(qjpcodecs)
Q_IMPORT_PLUGIN(qtwcodecs)
Q_IMPORT_PLUGIN(qkrcodecs)
Q_IMPORT_PLUGIN(qtaccessiblewidgets)
#endif
// Need a global reference for the notifications to find the GUI
static BitcoinGUI *guiref;
static QSplashScreen *splashref;
static void ThreadSafeMessageBox(const std::string& message, const std::string& caption, int style)
{
// Message from network thread
if(guiref)
{
bool modal = (style & CClientUIInterface::MODAL);
// in case of modal message, use blocking connection to wait for user to click OK
QMetaObject::invokeMethod(guiref, "error",
modal ? GUIUtil::blockingGUIThreadConnection() : Qt::QueuedConnection,
Q_ARG(QString, QString::fromStdString(caption)),
Q_ARG(QString, QString::fromStdString(message)),
Q_ARG(bool, modal));
}
else
{
printf("%s: %s\n", caption.c_str(), message.c_str());
fprintf(stderr, "%s: %s\n", caption.c_str(), message.c_str());
}
}
static bool ThreadSafeAskFee(int64 nFeeRequired, const std::string& strCaption)
{
if(!guiref)
return false;
if(nFeeRequired < MIN_TX_FEE || nFeeRequired <= nTransactionFee || fDaemon)
return true;
bool payFee = false;
QMetaObject::invokeMethod(guiref, "askFee", GUIUtil::blockingGUIThreadConnection(),
Q_ARG(qint64, nFeeRequired),
Q_ARG(bool*, &payFee));
return payFee;
}
static void ThreadSafeHandleURI(const std::string& strURI)
{
if(!guiref)
return;
QMetaObject::invokeMethod(guiref, "handleURI", GUIUtil::blockingGUIThreadConnection(),
Q_ARG(QString, QString::fromStdString(strURI)));
}
static void InitMessage(const std::string &message)
{
if(splashref)
{
splashref->showMessage(QString::fromStdString(message), Qt::AlignBottom|Qt::AlignHCenter, QColor(255,255,200));
QApplication::instance()->processEvents();
}
}
static void QueueShutdown()
{
QMetaObject::invokeMethod(QCoreApplication::instance(), "quit", Qt::QueuedConnection);
}
/*
Translate string to current locale using Qt.
*/
static std::string Translate(const char* psz)
{
return QCoreApplication::translate("bitcoin-core", psz).toStdString();
}
/* Handle runaway exceptions. Shows a message box with the problem and quits the program.
*/
static void handleRunawayException(std::exception *e)
{
PrintExceptionContinue(e, "Runaway exception");
QMessageBox::critical(0, "Runaway exception", BitcoinGUI::tr("A fatal error occurred. SourceCoin can no longer continue safely and will quit.") + QString("\n\n") + QString::fromStdString(strMiscWarning));
exit(1);
}
#ifndef BITCOIN_QT_TEST
int main(int argc, char *argv[])
{
// Do this early as we don't want to bother initializing if we are just calling IPC
ipcScanRelay(argc, argv);
// Internal string conversion is all UTF-8
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
QTextCodec::setCodecForCStrings(QTextCodec::codecForTr());
Q_INIT_RESOURCE(bitcoin);
QApplication app(argc, argv);
// Install global event filter that makes sure that long tooltips can be word-wrapped
app.installEventFilter(new GUIUtil::ToolTipToRichTextFilter(TOOLTIP_WRAP_THRESHOLD, &app));
// Command-line options take precedence:
ParseParameters(argc, argv);
// ... then bitcoin.conf:
if (!boost::filesystem::is_directory(GetDataDir(false)))
{
// This message can not be translated, as translation is not initialized yet
// (which not yet possible because lang=XX can be overridden in bitcoin.conf in the data directory)
QMessageBox::critical(0, "SourceCoin",
QString("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(mapArgs["-datadir"])));
return 1;
}
ReadConfigFile(mapArgs, mapMultiArgs);
// Application identification (must be set before OptionsModel is initialized,
// as it is used to locate QSettings)
app.setOrganizationName("SourceCoin");
app.setOrganizationDomain("SourceCoin.su");
if(GetBoolArg("-testnet")) // Separate UI settings for testnet
app.setApplicationName("SourceCoin-Qt-testnet");
else
app.setApplicationName("SourceCoin-Qt");
// ... then GUI settings:
OptionsModel optionsModel;
// Get desired locale (e.g. "de_DE") from command line or use system locale
QString lang_territory = QString::fromStdString(GetArg("-lang", QLocale::system().name().toStdString()));
QString lang = lang_territory;
// Convert to "de" only by truncating "_DE"
lang.truncate(lang_territory.lastIndexOf('_'));
QTranslator qtTranslatorBase, qtTranslator, translatorBase, translator;
// Load language files for configured locale:
// - First load the translator for the base language, without territory
// - Then load the more specific locale translator
// Load e.g. qt_de.qm
if (qtTranslatorBase.load("qt_" + lang, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
app.installTranslator(&qtTranslatorBase);
// Load e.g. qt_de_DE.qm
if (qtTranslator.load("qt_" + lang_territory, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
app.installTranslator(&qtTranslator);
// Load e.g. bitcoin_de.qm (shortcut "de" needs to be defined in bitcoin.qrc)
if (translatorBase.load(lang, ":/translations/"))
app.installTranslator(&translatorBase);
// Load e.g. bitcoin_de_DE.qm (shortcut "de_DE" needs to be defined in bitcoin.qrc)
if (translator.load(lang_territory, ":/translations/"))
app.installTranslator(&translator);
// Subscribe to global signals from core
uiInterface.ThreadSafeMessageBox.connect(ThreadSafeMessageBox);
uiInterface.ThreadSafeAskFee.connect(ThreadSafeAskFee);
uiInterface.ThreadSafeHandleURI.connect(ThreadSafeHandleURI);
uiInterface.InitMessage.connect(InitMessage);
uiInterface.QueueShutdown.connect(QueueShutdown);
uiInterface.Translate.connect(Translate);
// Show help message immediately after parsing command-line options (for "-lang") and setting locale,
// but before showing splash screen.
if (mapArgs.count("-?") || mapArgs.count("--help"))
{
GUIUtil::HelpMessageBox help;
help.showOrPrint();
return 1;
}
QSplashScreen splash(QPixmap(":/images/splash"), 0);
if (GetBoolArg("-splash", true) && !GetBoolArg("-min"))
{
splash.show();
splash.setAutoFillBackground(true);
splashref = &splash;
}
app.processEvents();
app.setQuitOnLastWindowClosed(false);
try
{
// Regenerate startup link, to fix links to old versions
if (GUIUtil::GetStartOnSystemStartup())
GUIUtil::SetStartOnSystemStartup(true);
BitcoinGUI window;
guiref = &window;
if(AppInit2())
{
{
// Put this in a block, so that the Model objects are cleaned up before
// calling Shutdown().
optionsModel.Upgrade(); // Must be done after AppInit2
if (splashref)
splash.finish(&window);
ClientModel clientModel(&optionsModel);
WalletModel walletModel(pwalletMain, &optionsModel);
window.setClientModel(&clientModel);
window.setWalletModel(&walletModel);
// If -min option passed, start window minimized.
if(GetBoolArg("-min"))
{
window.showMinimized();
}
else
{
window.show();
}
// Place this here as guiref has to be defined if we don't want to lose URIs
ipcInit(argc, argv);
app.exec();
window.hide();
window.setClientModel(0);
window.setWalletModel(0);
guiref = 0;
}
// Shutdown the core and its threads, but don't exit Bitcoin-Qt here
Shutdown(NULL);
}
else
{
return 1;
}
} catch (std::exception& e) {
handleRunawayException(&e);
} catch (...) {
handleRunawayException(NULL);
}
return 0;
}
#endif // BITCOIN_QT_TEST
| [
"coins@coinssource.com"
] | coins@coinssource.com |
a34d8ac0ef753456ab90dc261674ba788167a5b8 | 5071bffd61b92bb5b6a17bf009bceee01d0bba1e | /CockpitSim/Airplane.h | ba8a1cc3221b16dc02703bbb9a3fe0fc9df20486 | [] | no_license | louis-etne/CockpitSim | f28e1c30a9e931d9b13da97eec74eabeb11f2e66 | 5be982f79cc984086ae7468319bc11689fad6028 | refs/heads/master | 2022-01-20T15:10:41.142168 | 2019-06-17T21:18:26 | 2019-06-17T21:18:26 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 118 | h | #pragma once
class Airplane
{
public:
Airplane();
double get_speed() const;
private:
double _speed{ 0.0 };
};
| [
"louis.etienne82@orange.fr"
] | louis.etienne82@orange.fr |
0d106212be83d00f9861af6c14eb5e734007a6c9 | 128586639f766e764daf39d5b0c22f9a68569b6c | /GroupShiftedStrings.cpp | 2b848eaae8bd215318223671a57f34f1c4a500c3 | [] | no_license | ruihanxu2/leetCode_FBtag | b21d0b084420fb583ef474c8bbd0c3a6c2b0c038 | 35e2f4e28d7668371b63ec790b98df72f15139e4 | refs/heads/master | 2020-08-03T00:18:55.277512 | 2019-10-23T20:35:23 | 2019-10-23T20:35:23 | 211,560,815 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 960 | cpp | class Solution {
public:
vector<vector<string>> groupStrings(vector<string>& strings) {
unordered_map<string, vector<string> > m;
for(auto s : strings){
m[shift(s)].emplace_back(s);
}
vector<vector<string> > res;
for(auto p : m){
res.emplace_back(p.second);
}
return res;
}
string shift(string s){
string tmp;
for(int i = 1; i < s.size(); i++){
int diff = s[i] - s[i-1];
if(diff < 0) diff+=26;
tmp+=('a' + diff);
}
return tmp;
}
};
//
//Given a string, we can "shift" each of its letter to its successive letter, for example: "abc" -> "bcd". We can keep "shifting" which forms the sequence:
//
//"abc" -> "bcd" -> ... -> "xyz"
//Given a list of strings which contains only lowercase alphabets, group all strings that belong to the same shifting sequence.
//
//Example:
//
//Input: ["abc", "bcd", "acef", "xyz", "az", "ba", "a", "z"],
//Output:
//[
// ["abc","bcd","xyz"],
// ["az","ba"],
// ["acef"],
// ["a","z"]
//] | [
"ruihanxu2@gmail.com"
] | ruihanxu2@gmail.com |
a3ff59e9833978f0eba1e1b93ef7fa46437fd0ce | 8ffddb86c818c33bef8e9f78896441ca09772396 | /MapGraphics/MapGraphics/tileSources/GridTileSource.cpp | e00ed13803fc56dee0cb2a2defbd4ba0bbf03cfd | [] | no_license | Userpc1010/BaseRepository | bb62aef2bfee212f2bf25a81fbc0ee8bb1c3816b | ee968ca53efad1dce8380856f7b10a39e4227111 | refs/heads/master | 2020-07-09T03:51:49.083597 | 2020-04-24T18:18:06 | 2020-04-24T18:18:06 | 203,867,687 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,410 | cpp | #include "GridTileSource.h"
#include <cmath>
#include <QPainter>
#include <QStringBuilder>
#include <QtDebug>
const qreal PI = 3.14159265358979323846;
const qreal deg2rad = PI / 180.0;
const qreal rad2deg = 180.0 / PI;
GridTileSource::GridTileSource() :
MapTileSource()
{
this->setCacheMode(MapTileSource::NoCaching);
}
GridTileSource::~GridTileSource()
{
qDebug() << this << "Закрытие";
}
QPointF GridTileSource::ll2qgs(const QPointF &ll, quint8 zoomLevel) const
{
const qreal tilesOnOneEdge = pow(2.0,zoomLevel);
const quint16 tileSize = this->tileSize();
qreal x = (ll.x()+180.0) * (tilesOnOneEdge*tileSize)/360.0; // coord to pixel!
qreal y = (1-(log(tan(PI/4.0+(ll.y()*deg2rad)/2)) /PI)) /2.0 * (tilesOnOneEdge*tileSize);
return QPoint(int(x), int(y));
}
QPointF GridTileSource::qgs2ll(const QPointF &qgs, quint8 zoomLevel) const
{
const qreal tilesOnOneEdge = pow(2.0,zoomLevel);
const quint16 tileSize = this->tileSize();
qreal longitude = (qgs.x()*(360.0/(tilesOnOneEdge*tileSize)))-180.0;
qreal latitude = rad2deg*(atan(sinh((1.0-qgs.y()*(2.0/(tilesOnOneEdge*tileSize)))*PI)));
return QPointF(longitude, latitude);
}
quint64 GridTileSource::tilesOnZoomLevel(quint8 zoomLevel) const
{
return pow(4.0,zoomLevel);
}
quint16 GridTileSource::tileSize() const
{
return 256;
}
quint8 GridTileSource::minZoomLevel(QPointF ll)
{
Q_UNUSED(ll)
return 0;
}
quint8 GridTileSource::maxZoomLevel(QPointF ll)
{
Q_UNUSED(ll)
return 50;
}
QString GridTileSource::name() const
{
return "Отображение сетки";
}
QString GridTileSource::tileFileExtension() const
{
return ".png";
}
void GridTileSource::fetchTile(quint32 x, quint32 y, quint8 z)
{
quint64 leftScenePixel = x*this->tileSize();
quint64 topScenePixel = y*this->tileSize();
quint64 rightScenePixel = leftScenePixel + this->tileSize();
quint64 bottomScenePixel = topScenePixel + this->tileSize();
QImage * toRet = new QImage(this->tileSize(),
this->tileSize(),
QImage::Format_ARGB32_Premultiplied);
//It is important to fill with transparent first!
toRet->fill(qRgba(0,0,0,0));
QPainter painter(toRet);
painter.setPen(Qt::black);
//painter.fillRect(toRet->rect(),QColor(0,0,0,0));
qreal everyNDegrees = 10.0;
//Longitude
for(qreal lon = -180.0; lon <= 180.0; lon += everyNDegrees)
{
QPointF geoPos(lon,0.0);
QPointF qgsScenePos = this->ll2qgs(geoPos,z);
if (qgsScenePos.x() < leftScenePixel || qgsScenePos.x() > rightScenePixel)
continue;
painter.drawLine(qgsScenePos.x() - leftScenePixel,
0,
qgsScenePos.x() - leftScenePixel,
this->tileSize());
}
//Latitude
for (qreal lat = -90.0; lat < 90.0; lat += everyNDegrees)
{
QPointF geoPos(0.0,lat);
QPointF qgsScenePos = this->ll2qgs(geoPos,z);
if (qgsScenePos.y() < topScenePixel || qgsScenePos.y() > bottomScenePixel)
continue;
painter.drawLine(0,
qgsScenePos.y() - topScenePixel,
this->tileSize(),
qgsScenePos.y() - topScenePixel);
}
painter.end();
this->prepareNewlyReceivedTile(x,y,z,toRet);
}
| [
"ru.sencis@mail.ru"
] | ru.sencis@mail.ru |
7965d84913aadcd2d2ed062128317b6a794bb9b5 | 2312c592803c8b2c4440c1447e74404a14a61106 | /FinBudget/FinBudgetView.h | 62c7c206cb5ee77c49131d11f4f3f89c2b2aa76b | [
"MIT"
] | permissive | dextercai/FinBudgetMFC | 12db3fa1fe0888a85410358e7a13aff87a96d6c7 | 3641c3f18b6cf87ce43903b591c24c73a995d481 | refs/heads/master | 2020-06-14T13:03:06.987414 | 2019-07-03T13:17:46 | 2019-07-03T13:17:46 | 195,011,352 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,727 | h |
// FinBudgetView.h: CFinBudgetView 类的接口
//
#pragma once
#include "FinBudgetDebtManager.h"
#include "FinBudgetFlowManager.h"
#include "FinBudgetSupport.h"
class CFinBudgetView : public CFormView
{
protected: // 仅从序列化创建
CFinBudgetView() noexcept;
DECLARE_DYNCREATE(CFinBudgetView)
public:
#ifdef AFX_DESIGN_TIME
enum{ IDD = IDD_FINBUDGET_FORM };
#endif
// 特性
public:
CFinBudgetDoc* GetDocument() const;
// 操作
public:
afx_msg void OnBnClickedButtonDebtAdmin();
afx_msg void OnBnClickedButtonDebtReport();
afx_msg void OnBnClickedButtonFlowAdmin();
afx_msg void OnBnClickedButtonFlowReport();
// 重写
public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
virtual void OnInitialUpdate(); // 构造后第一次调用
virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void OnPrint(CDC* pDC, CPrintInfo* pInfo);
// 实现
public:
virtual ~CFinBudgetView();
FinBudgetDebtManager FDM;
FinBudgetFlowManager FFM;
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// 生成的消息映射函数
protected:
DECLARE_MESSAGE_MAP()
public:
// CListCtrl m_mian_list;
// CListCtrl m_main_list;
CListCtrl m_MAIN_LIST;
afx_msg void OnFileSave();
afx_msg void OnFileOpen();
afx_msg void On32782();
afx_msg void OnFileNew();
};
#ifndef _DEBUG // FinBudgetView.cpp 中的调试版本
inline CFinBudgetDoc* CFinBudgetView::GetDocument() const
{ return reinterpret_cast<CFinBudgetDoc*>(m_pDocument); }
#endif
| [
"caiwenzhe2021@gmail.com"
] | caiwenzhe2021@gmail.com |
b4159cd7abca9b3a5c285e2200467be470a01d77 | 3d8465855bad309c7fae42a75f138c9ef049bd36 | /SSTreeMaker/SSTrimAndSlimCommon.h | a01e17ff61ee1e1ca55d1ce0bc111a4af913e9e9 | [] | no_license | susy2015/SensitivityStudy | ecf2a4559ea838eefec109ba69003b0e5713aef5 | f0887e9f77298689718d0c44343d623facfcd5ec | refs/heads/master | 2021-01-17T20:52:11.190556 | 2017-04-21T17:43:34 | 2017-04-21T17:43:34 | 60,807,313 | 0 | 0 | null | 2017-04-21T17:43:34 | 2016-06-09T21:10:10 | C++ | UTF-8 | C++ | false | false | 958 | h | #ifndef _SSTrimAndSlimCommon_H_
#define _SSTrimAndSlimCommon_H_
#include <string>
#include <iostream>
#include <vector>
#include "SusyAnaTools/Tools/NTupleReader.h"
#include "SusyAnaTools/Tools/baselineDef.h"
bool useNewTagger = true;
bool useLegacycfg = false;
const int nth_slash_nametag_MC = 10;
inline size_t find_Nth
(
const std::string & str , // where to work
unsigned N , // N'th ocurrence
const std::string & find // what to 'find'
)
{
if ( 0==N ) { return std::string::npos; }
size_t pos,from=0;
unsigned i=0;
while ( i<N )
{
pos=str.find(find,from);
if ( std::string::npos == pos ) { break; }
from = pos + 1; // from = pos + find.size();
++i;
}
return pos;
}
inline double GetHTTops( std::vector<TLorentzVector> vTops )
{
int HTTops = 0;
for(auto Top : vTops)
{
HTTops += Top.Pt();
}
return HTTops;
} // ----- end of function VarPerEvent::GetnTops -----
#endif
| [
"hua.wei@cern.ch"
] | hua.wei@cern.ch |
18d63d4de40846133e8c80f21c0a89ad8818f105 | b9ecef64ebc2af3b8076f2127de1af0c81c1c98d | /constant/polyMesh/neighbour | be27e7005e30584ea8166d136f8b8be93af83f20 | [] | no_license | wegiangb/inventasFlow | b5bd8c16e5002aa6640d13aefd617a509980a938 | edccf7bdb78e6e3572b1850f7ce8c9d75aca1e25 | refs/heads/master | 2021-05-16T03:55:20.499110 | 2017-02-09T00:29:54 | 2017-02-09T00:29:54 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 166,550 | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class labelList;
note "nPoints:24906 nCells:18429 nFaces:67740 nInternalFaces:30489";
location "constant/polyMesh";
object neighbour;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30489
(
1
39
6045
12369
2
40
16244
3
41
9329
4
42
14048
5
43
13204
6
44
12697
7
45
9809
8
46
15959
9
47
11407
10
48
12097
11
49
11601
12
50
12945
13
51
6130
14
52
13177
15
53
11186
16
54
14300
17
55
12621
18
56
13468
19
57
6465
20
58
10199
21
59
13659
22
60
10649
23
61
15163
24
62
7000
25
63
11352
26
64
9917
27
65
15202
28
66
7268
29
67
13341
30
68
13824
31
69
12409
32
70
6838
33
71
12612
34
72
12186
35
73
9865
36
74
15592
37
75
8212
38
76
13641
77
1521
14310
40
78
6046
41
79
42
80
43
81
44
82
45
83
46
84
47
85
48
86
49
87
50
88
51
89
52
90
53
91
54
92
55
93
56
94
57
95
58
96
59
97
60
98
61
99
62
100
63
101
64
102
65
103
66
104
67
105
68
106
69
107
70
108
71
109
72
110
73
111
74
112
75
113
76
114
77
115
116
1522
79
117
6047
80
118
81
119
82
120
83
121
84
122
85
123
86
124
87
125
88
126
89
127
90
128
91
129
92
130
93
131
94
132
95
133
96
134
97
135
98
136
99
137
100
138
101
139
102
140
103
141
104
142
105
143
106
144
107
145
108
146
109
147
110
148
111
149
112
150
113
151
114
152
115
153
116
154
155
1523
118
156
6048
119
157
120
158
121
159
122
160
123
161
124
162
125
163
126
164
127
165
128
166
129
167
130
168
131
169
132
170
133
171
134
172
135
173
136
174
137
175
138
176
139
177
140
178
141
179
142
180
143
181
144
182
145
183
146
184
147
185
148
186
149
187
150
188
151
189
152
190
153
191
154
192
155
193
194
1524
157
195
6049
158
196
159
197
160
198
161
199
162
200
163
201
164
202
165
203
166
204
167
205
168
206
169
207
170
208
171
209
172
210
173
211
174
212
175
213
176
214
177
215
178
216
179
217
180
218
181
219
182
220
183
221
184
222
185
223
186
224
187
225
188
226
189
227
190
228
191
229
192
230
193
231
194
232
233
1525
196
234
6050
197
235
198
236
199
237
200
238
201
239
202
240
203
241
204
242
205
243
206
244
207
245
208
246
209
247
210
248
211
249
212
250
213
251
214
252
215
253
216
254
217
255
218
256
219
257
220
258
221
259
222
260
223
261
224
262
225
263
226
264
227
265
228
266
229
267
230
268
231
269
232
270
233
271
272
1526
235
273
6051
236
274
237
275
238
276
239
277
240
278
241
279
242
280
243
281
244
282
245
283
246
284
247
285
248
286
249
287
250
288
251
289
252
290
253
291
254
292
255
293
256
294
257
295
258
296
259
297
260
298
261
299
262
300
263
301
264
302
265
303
266
304
267
305
268
306
269
307
270
308
271
309
272
310
311
1527
274
312
6052
275
313
276
314
277
315
278
316
279
317
280
318
281
319
282
320
283
321
284
322
285
323
286
324
287
325
288
326
289
327
290
328
291
329
292
330
293
331
294
332
295
333
296
334
297
335
298
336
299
337
300
338
301
339
302
340
303
341
304
342
305
343
306
344
307
345
308
346
309
347
310
348
311
349
350
1528
313
351
6053
314
352
315
353
316
354
317
355
318
356
319
357
320
358
321
359
322
360
323
361
324
362
325
363
326
364
327
365
328
366
329
367
330
368
331
369
332
370
333
371
334
372
335
373
336
374
337
375
338
376
339
377
340
378
341
379
342
380
343
381
344
382
345
383
346
384
347
385
348
386
349
387
350
388
389
1529
352
390
6054
353
391
354
392
355
393
356
394
357
395
358
396
359
397
360
398
361
399
362
400
363
401
364
402
365
403
366
404
367
405
368
406
369
407
370
408
371
409
372
410
373
411
374
412
375
413
376
414
377
415
378
416
379
417
380
418
381
419
382
420
383
421
384
422
385
423
386
424
387
425
388
426
389
427
428
1530
391
429
6055
392
430
393
431
394
432
395
433
396
434
397
435
398
436
399
437
400
438
401
439
402
440
403
441
404
442
405
443
406
444
407
445
408
446
409
447
410
448
411
449
412
450
413
451
414
452
415
453
416
454
417
455
418
456
419
457
420
458
421
459
422
460
423
461
424
462
425
463
426
464
427
465
428
466
467
1531
430
468
6056
431
469
432
470
433
471
434
472
435
473
436
474
437
475
438
476
439
477
440
478
441
479
442
480
443
481
444
482
445
483
446
484
447
485
448
486
449
487
450
488
451
489
452
490
453
491
454
492
455
493
456
494
457
495
458
496
459
497
460
498
461
499
462
500
463
501
464
502
465
503
466
504
467
505
506
1532
469
507
6057
470
508
471
509
472
510
473
511
474
512
475
513
476
514
477
515
478
516
479
517
480
518
481
519
482
520
483
521
484
522
485
523
486
524
487
525
488
526
489
527
490
528
491
529
492
530
493
531
494
532
495
533
496
534
497
535
498
536
499
537
500
538
501
539
502
540
503
541
504
542
505
543
506
544
545
1533
508
546
6058
509
547
510
548
511
549
512
550
513
551
514
552
515
553
516
554
517
555
518
556
519
557
520
558
521
559
522
560
523
561
524
562
525
563
526
564
527
565
528
566
529
567
530
568
531
569
532
570
533
571
534
572
535
573
536
574
537
575
538
576
539
577
540
578
541
579
542
580
543
581
544
582
545
583
584
1534
547
585
6059
548
586
549
587
550
588
551
589
552
590
553
591
554
592
555
593
556
594
557
595
558
596
559
597
560
598
561
599
562
600
563
601
564
602
565
603
566
604
567
605
568
606
569
607
570
608
571
609
572
610
573
611
574
612
575
613
576
614
577
615
578
616
579
617
580
618
581
619
582
620
583
621
584
622
623
1535
586
624
6060
587
625
588
626
589
627
590
628
591
629
592
630
593
631
594
632
595
633
596
634
597
635
598
636
599
637
600
638
601
639
602
640
603
641
604
642
605
643
606
644
607
645
608
646
609
647
610
648
611
649
612
650
613
651
614
652
615
653
616
654
617
655
618
656
619
657
620
658
621
659
622
660
623
661
662
1536
625
663
6061
626
664
627
665
628
666
629
667
630
668
631
669
632
670
633
671
634
672
635
673
636
674
637
675
638
676
639
677
640
678
641
679
642
680
643
681
644
682
645
683
646
684
647
685
648
686
649
687
650
688
651
689
652
690
653
691
654
692
655
693
656
694
657
695
658
696
659
697
660
698
661
699
662
700
701
1537
664
702
6062
665
703
666
704
667
705
668
706
669
707
670
708
671
709
672
710
673
711
674
712
675
713
676
714
677
715
678
716
679
717
680
718
681
719
682
720
683
721
684
722
685
723
686
724
687
725
688
726
689
727
690
728
691
729
692
730
693
731
694
732
695
733
696
734
697
735
698
736
699
737
700
738
701
739
740
1538
703
741
6063
704
742
705
743
706
744
707
745
708
746
709
747
710
748
711
749
712
750
713
751
714
752
715
753
716
754
717
755
718
756
719
757
720
758
721
759
722
760
723
761
724
762
725
763
726
764
727
765
728
766
729
767
730
768
731
769
732
770
733
771
734
772
735
773
736
774
737
775
738
776
739
777
740
778
779
1539
742
780
6064
743
781
744
782
745
783
746
784
747
785
748
786
749
787
750
788
751
789
752
790
753
791
754
792
755
793
756
794
757
795
758
796
759
797
760
798
761
799
762
800
763
801
764
802
765
803
766
804
767
805
768
806
769
807
770
808
771
809
772
810
773
811
774
812
775
813
776
814
777
815
778
816
779
817
818
1540
781
819
6065
782
820
783
821
784
822
785
823
786
824
787
825
788
826
789
827
790
828
791
829
792
830
793
831
794
832
795
833
796
834
797
835
798
836
799
837
800
838
801
839
802
840
803
841
804
842
805
843
806
844
807
845
808
846
809
847
810
848
811
849
812
850
813
851
814
852
815
853
816
854
817
855
818
856
857
1541
820
858
6066
821
859
822
860
823
861
824
862
825
863
826
864
827
865
828
866
829
867
830
868
831
869
832
870
833
871
834
872
835
873
836
874
837
875
838
876
839
877
840
878
841
879
842
880
843
881
844
882
845
883
846
884
847
885
848
886
849
887
850
888
851
889
852
890
853
891
854
892
855
893
856
894
857
895
896
1542
859
897
6067
860
898
861
899
862
900
863
901
864
902
865
903
866
904
867
905
868
906
869
907
870
908
871
909
872
910
873
911
874
912
875
913
876
914
877
915
878
916
879
917
880
918
881
919
882
920
883
921
884
922
885
923
886
924
887
925
888
926
889
927
890
928
891
929
892
930
893
931
894
932
895
933
896
934
935
1543
898
936
6068
899
937
900
938
901
939
902
940
903
941
904
942
905
943
906
944
907
945
908
946
909
947
910
948
911
949
912
950
913
951
914
952
915
953
916
954
917
955
918
956
919
957
920
958
921
959
922
960
923
961
924
962
925
963
926
964
927
965
928
966
929
967
930
968
931
969
932
970
933
971
934
972
935
973
974
1544
937
975
6069
938
976
939
977
940
978
941
979
942
980
943
981
944
982
945
983
946
984
947
985
948
986
949
987
950
988
951
989
952
990
953
991
954
992
955
993
956
994
957
995
958
996
959
997
960
998
961
999
962
1000
963
1001
964
1002
965
1003
966
1004
967
1005
968
1006
969
1007
970
1008
971
1009
972
1010
973
1011
974
1012
1013
1545
976
1014
6070
977
1015
978
1016
979
1017
980
1018
981
1019
982
1020
983
1021
984
1022
985
1023
986
1024
987
1025
988
1026
989
1027
990
1028
991
1029
992
1030
993
1031
994
1032
995
1033
996
1034
997
1035
998
1036
999
1037
1000
1038
1001
1039
1002
1040
1003
1041
1004
1042
1005
1043
1006
1044
1007
1045
1008
1046
1009
1047
1010
1048
1011
1049
1012
1050
1013
1051
1052
1546
1015
1053
6071
1016
1054
1017
1055
1018
1056
1019
1057
1020
1058
1021
1059
1022
1060
1023
1061
1024
1062
1025
1063
1026
1064
1027
1065
1028
1066
1029
1067
1030
1068
1031
1069
1032
1070
1033
1071
1034
1072
1035
1073
1036
1074
1037
1075
1038
1076
1039
1077
1040
1078
1041
1079
1042
1080
1043
1081
1044
1082
1045
1083
1046
1084
1047
1085
1048
1086
1049
1087
1050
1088
1051
1089
1052
1090
1091
1547
1054
1092
6072
1055
1093
1056
1094
1057
1095
1058
1096
1059
1097
1060
1098
1061
1099
1062
1100
1063
1101
1064
1102
1065
1103
1066
1104
1067
1105
1068
1106
1069
1107
1070
1108
1071
1109
1072
1110
1073
1111
1074
1112
1075
1113
1076
1114
1077
1115
1078
1116
1079
1117
1080
1118
1081
1119
1082
1120
1083
1121
1084
1122
1085
1123
1086
1124
1087
1125
1088
1126
1089
1127
1090
1128
1091
1129
1130
1548
1093
1131
6073
1094
1132
1095
1133
1096
1134
1097
1135
1098
1136
1099
1137
1100
1138
1101
1139
1102
1140
1103
1141
1104
1142
1105
1143
1106
1144
1107
1145
1108
1146
1109
1147
1110
1148
1111
1149
1112
1150
1113
1151
1114
1152
1115
1153
1116
1154
1117
1155
1118
1156
1119
1157
1120
1158
1121
1159
1122
1160
1123
1161
1124
1162
1125
1163
1126
1164
1127
1165
1128
1166
1129
1167
1130
1168
1169
1549
1132
1170
6074
1133
1171
1134
1172
1135
1173
1136
1174
1137
1175
1138
1176
1139
1177
1140
1178
1141
1179
1142
1180
1143
1181
1144
1182
1145
1183
1146
1184
1147
1185
1148
1186
1149
1187
1150
1188
1151
1189
1152
1190
1153
1191
1154
1192
1155
1193
1156
1194
1157
1195
1158
1196
1159
1197
1160
1198
1161
1199
1162
1200
1163
1201
1164
1202
1165
1203
1166
1204
1167
1205
1168
1206
1169
1207
1208
1550
1171
1209
6075
1172
1210
1173
1211
1174
1212
1175
1213
1176
1214
1177
1215
1178
1216
1179
1217
1180
1218
1181
1219
1182
1220
1183
1221
1184
1222
1185
1223
1186
1224
1187
1225
1188
1226
1189
1227
1190
1228
1191
1229
1192
1230
1193
1231
1194
1232
1195
1233
1196
1234
1197
1235
1198
1236
1199
1237
1200
1238
1201
1239
1202
1240
1203
1241
1204
1242
1205
1243
1206
1244
1207
1245
1208
1246
1247
1551
1210
1248
6076
1211
1249
1212
1250
1213
1251
1214
1252
1215
1253
1216
1254
1217
1255
1218
1256
1219
1257
1220
1258
1221
1259
1222
1260
1223
1261
1224
1262
1225
1263
1226
1264
1227
1265
1228
1266
1229
1267
1230
1268
1231
1269
1232
1270
1233
1271
1234
1272
1235
1273
1236
1274
1237
1275
1238
1276
1239
1277
1240
1278
1241
1279
1242
1280
1243
1281
1244
1282
1245
1283
1246
1284
1247
1285
1286
1552
1249
1287
6077
1250
1288
1251
1289
1252
1290
1253
1291
1254
1292
1255
1293
1256
1294
1257
1295
1258
1296
1259
1297
1260
1298
1261
1299
1262
1300
1263
1301
1264
1302
1265
1303
1266
1304
1267
1305
1268
1306
1269
1307
1270
1308
1271
1309
1272
1310
1273
1311
1274
1312
1275
1313
1276
1314
1277
1315
1278
1316
1279
1317
1280
1318
1281
1319
1282
1320
1283
1321
1284
1322
1285
1323
1286
1324
1325
1553
1288
1326
6078
1289
1327
1290
1328
1291
1329
1292
1330
1293
1331
1294
1332
1295
1333
1296
1334
1297
1335
1298
1336
1299
1337
1300
1338
1301
1339
1302
1340
1303
1341
1304
1342
1305
1343
1306
1344
1307
1345
1308
1346
1309
1347
1310
1348
1311
1349
1312
1350
1313
1351
1314
1352
1315
1353
1316
1354
1317
1355
1318
1356
1319
1357
1320
1358
1321
1359
1322
1360
1323
1361
1324
1362
1325
1363
1364
1554
1327
1365
6079
1328
1366
1329
1367
1330
1368
1331
1369
1332
1370
1333
1371
1334
1372
1335
1373
1336
1374
1337
1375
1338
1376
1339
1377
1340
1378
1341
1379
1342
1380
1343
1381
1344
1382
1345
1383
1346
1384
1347
1385
1348
1386
1349
1387
1350
1388
1351
1389
1352
1390
1353
1391
1354
1392
1355
1393
1356
1394
1357
1395
1358
1396
1359
1397
1360
1398
1361
1399
1362
1400
1363
1401
1364
1402
1403
1555
1366
1404
6080
1367
1405
1368
1406
1369
1407
1370
1408
1371
1409
1372
1410
1373
1411
1374
1412
1375
1413
1376
1414
1377
1415
1378
1416
1379
1417
1380
1418
1381
1419
1382
1420
1383
1421
1384
1422
1385
1423
1386
1424
1387
1425
1388
1426
1389
1427
1390
1428
1391
1429
1392
1430
1393
1431
1394
1432
1395
1433
1396
1434
1397
1435
1398
1436
1399
1437
1400
1438
1401
1439
1402
1440
1403
1441
1442
1556
1405
1443
6081
1406
1444
1407
1445
1408
1446
1409
1447
1410
1448
1411
1449
1412
1450
1413
1451
1414
1452
1415
1453
1416
1454
1417
1455
1418
1456
1419
1457
1420
1458
1421
1459
1422
1460
1423
1461
1424
1462
1425
1463
1426
1464
1427
1465
1428
1466
1429
1467
1430
1468
1431
1469
1432
1470
1433
1471
1434
1472
1435
1473
1436
1474
1437
1475
1438
1476
1439
1477
1440
1478
1441
1479
1442
1480
1481
1557
1444
1482
6082
1445
1483
1446
1484
1447
1485
1448
1486
1449
1487
1450
1488
1451
1489
1452
1490
1453
1491
1454
1492
1455
1493
1456
1494
1457
1495
1458
1496
1459
1497
1460
1498
1461
1499
1462
1500
1463
1501
1464
1502
1465
1503
1466
1504
1467
1505
1468
1506
1469
1507
1470
1508
1471
1509
1472
1510
1473
1511
1474
1512
1475
1513
1476
1514
1477
1515
1478
1516
1479
1517
1480
1518
1481
1519
1520
1558
1483
6083
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1559
1522
1560
14311
1523
1561
1524
1562
1525
1563
1526
1564
1527
1565
1528
1566
1529
1567
1530
1568
1531
1569
1532
1570
1533
1571
1534
1572
1535
1573
1536
1574
1537
1575
1538
1576
1539
1577
1540
1578
1541
1579
1542
1580
1543
1581
1544
1582
1545
1583
1546
1584
1547
1585
1548
1586
1549
1587
1550
1588
1551
1589
1552
1590
1553
1591
1554
1592
1555
1593
1556
1594
1557
1595
1558
1596
1559
1597
1598
1561
1599
10530
1562
1600
1563
1601
1564
1602
1565
1603
1566
1604
1567
1605
1568
1606
1569
1607
1570
1608
1571
1609
1572
1610
1573
1611
1574
1612
1575
1613
1576
1614
1577
1615
1578
1616
1579
1617
1580
1618
1581
1619
1582
1620
1583
1621
1584
1622
1585
1623
1586
1624
1587
1625
1588
1626
1589
1627
1590
1628
1591
1629
1592
1630
1593
1631
1594
1632
1595
1633
1596
1634
1597
1635
1598
1636
1637
1600
1638
6811
1601
1639
1602
1640
1603
1641
1604
1642
1605
1643
1606
1644
1607
1645
1608
1646
1609
1647
1610
1648
1611
1649
1612
1650
1613
1651
1614
1652
1615
1653
1616
1654
1617
1655
1618
1656
1619
1657
1620
1658
1621
1659
1622
1660
1623
1661
1624
1662
1625
1663
1626
1664
1627
1665
1628
1666
1629
1667
1630
1668
1631
1669
1632
1670
1633
1671
1634
1672
1635
1673
1636
1674
1637
1675
1676
1639
1677
14527
1640
1678
1641
1679
1642
1680
1643
1681
1644
1682
1645
1683
1646
1684
1647
1685
1648
1686
1649
1687
1650
1688
1651
1689
1652
1690
1653
1691
1654
1692
1655
1693
1656
1694
1657
1695
1658
1696
1659
1697
1660
1698
1661
1699
1662
1700
1663
1701
1664
1702
1665
1703
1666
1704
1667
1705
1668
1706
1669
1707
1670
1708
1671
1709
1672
1710
1673
1711
1674
1712
1675
1713
1676
1714
1715
1678
1716
7294
1679
1717
1680
1718
1681
1719
1682
1720
1683
1721
1684
1722
1685
1723
1686
1724
1687
1725
1688
1726
1689
1727
1690
1728
1691
1729
1692
1730
1693
1731
1694
1732
1695
1733
1696
1734
1697
1735
1698
1736
1699
1737
1700
1738
1701
1739
1702
1740
1703
1741
1704
1742
1705
1743
1706
1744
1707
1745
1708
1746
1709
1747
1710
1748
1711
1749
1712
1750
1713
1751
1714
1752
1715
1753
1754
1717
1755
14759
1718
1756
1719
1757
1720
1758
1721
1759
1722
1760
1723
1761
1724
1762
1725
1763
1726
1764
1727
1765
1728
1766
1729
1767
1730
1768
1731
1769
1732
1770
1733
1771
1734
1772
1735
1773
1736
1774
1737
1775
1738
1776
1739
1777
1740
1778
1741
1779
1742
1780
1743
1781
1744
1782
1745
1783
1746
1784
1747
1785
1748
1786
1749
1787
1750
1788
1751
1789
1752
1790
1753
1791
1754
1792
1793
1756
1794
11580
1757
1795
1758
1796
1759
1797
1760
1798
1761
1799
1762
1800
1763
1801
1764
1802
1765
1803
1766
1804
1767
1805
1768
1806
1769
1807
1770
1808
1771
1809
1772
1810
1773
1811
1774
1812
1775
1813
1776
1814
1777
1815
1778
1816
1779
1817
1780
1818
1781
1819
1782
1820
1783
1821
1784
1822
1785
1823
1786
1824
1787
1825
1788
1826
1789
1827
1790
1828
1791
1829
1792
1830
1793
1831
1832
1795
1833
15323
1796
1834
1797
1835
1798
1836
1799
1837
1800
1838
1801
1839
1802
1840
1803
1841
1804
1842
1805
1843
1806
1844
1807
1845
1808
1846
1809
1847
1810
1848
1811
1849
1812
1850
1813
1851
1814
1852
1815
1853
1816
1854
1817
1855
1818
1856
1819
1857
1820
1858
1821
1859
1822
1860
1823
1861
1824
1862
1825
1863
1826
1864
1827
1865
1828
1866
1829
1867
1830
1868
1831
1869
1832
1870
1871
1834
1872
15477
1835
1873
1836
1874
1837
1875
1838
1876
1839
1877
1840
1878
1841
1879
1842
1880
1843
1881
1844
1882
1845
1883
1846
1884
1847
1885
1848
1886
1849
1887
1850
1888
1851
1889
1852
1890
1853
1891
1854
1892
1855
1893
1856
1894
1857
1895
1858
1896
1859
1897
1860
1898
1861
1899
1862
1900
1863
1901
1864
1902
1865
1903
1866
1904
1867
1905
1868
1906
1869
1907
1870
1908
1871
1909
1910
1873
1911
15040
1874
1912
1875
1913
1876
1914
1877
1915
1878
1916
1879
1917
1880
1918
1881
1919
1882
1920
1883
1921
1884
1922
1885
1923
1886
1924
1887
1925
1888
1926
1889
1927
1890
1928
1891
1929
1892
1930
1893
1931
1894
1932
1895
1933
1896
1934
1897
1935
1898
1936
1899
1937
1900
1938
1901
1939
1902
1940
1903
1941
1904
1942
1905
1943
1906
1944
1907
1945
1908
1946
1909
1947
1910
1948
1949
1912
1950
12935
1913
1951
1914
1952
1915
1953
1916
1954
1917
1955
1918
1956
1919
1957
1920
1958
1921
1959
1922
1960
1923
1961
1924
1962
1925
1963
1926
1964
1927
1965
1928
1966
1929
1967
1930
1968
1931
1969
1932
1970
1933
1971
1934
1972
1935
1973
1936
1974
1937
1975
1938
1976
1939
1977
1940
1978
1941
1979
1942
1980
1943
1981
1944
1982
1945
1983
1946
1984
1947
1985
1948
1986
1949
1987
1988
1951
1989
16048
1952
1990
1953
1991
1954
1992
1955
1993
1956
1994
1957
1995
1958
1996
1959
1997
1960
1998
1961
1999
1962
2000
1963
2001
1964
2002
1965
2003
1966
2004
1967
2005
1968
2006
1969
2007
1970
2008
1971
2009
1972
2010
1973
2011
1974
2012
1975
2013
1976
2014
1977
2015
1978
2016
1979
2017
1980
2018
1981
2019
1982
2020
1983
2021
1984
2022
1985
2023
1986
2024
1987
2025
1988
2026
2027
1990
2028
11481
1991
2029
1992
2030
1993
2031
1994
2032
1995
2033
1996
2034
1997
2035
1998
2036
1999
2037
2000
2038
2001
2039
2002
2040
2003
2041
2004
2042
2005
2043
2006
2044
2007
2045
2008
2046
2009
2047
2010
2048
2011
2049
2012
2050
2013
2051
2014
2052
2015
2053
2016
2054
2017
2055
2018
2056
2019
2057
2020
2058
2021
2059
2022
2060
2023
2061
2024
2062
2025
2063
2026
2064
2027
2065
2066
2029
2067
13416
2030
2068
2031
2069
2032
2070
2033
2071
2034
2072
2035
2073
2036
2074
2037
2075
2038
2076
2039
2077
2040
2078
2041
2079
2042
2080
2043
2081
2044
2082
2045
2083
2046
2084
2047
2085
2048
2086
2049
2087
2050
2088
2051
2089
2052
2090
2053
2091
2054
2092
2055
2093
2056
2094
2057
2095
2058
2096
2059
2097
2060
2098
2061
2099
2062
2100
2063
2101
2064
2102
2065
2103
2066
2104
2105
2068
2106
13979
2069
2107
2070
2108
2071
2109
2072
2110
2073
2111
2074
2112
2075
2113
2076
2114
2077
2115
2078
2116
2079
2117
2080
2118
2081
2119
2082
2120
2083
2121
2084
2122
2085
2123
2086
2124
2087
2125
2088
2126
2089
2127
2090
2128
2091
2129
2092
2130
2093
2131
2094
2132
2095
2133
2096
2134
2097
2135
2098
2136
2099
2137
2100
2138
2101
2139
2102
2140
2103
2141
2104
2142
2105
2143
2144
2107
2145
9548
2108
2146
2109
2147
2110
2148
2111
2149
2112
2150
2113
2151
2114
2152
2115
2153
2116
2154
2117
2155
2118
2156
2119
2157
2120
2158
2121
2159
2122
2160
2123
2161
2124
2162
2125
2163
2126
2164
2127
2165
2128
2166
2129
2167
2130
2168
2131
2169
2132
2170
2133
2171
2134
2172
2135
2173
2136
2174
2137
2175
2138
2176
2139
2177
2140
2178
2141
2179
2142
2180
2143
2181
2144
2182
2183
2146
2184
16182
2147
2185
2148
2186
2149
2187
2150
2188
2151
2189
2152
2190
2153
2191
2154
2192
2155
2193
2156
2194
2157
2195
2158
2196
2159
2197
2160
2198
2161
2199
2162
2200
2163
2201
2164
2202
2165
2203
2166
2204
2167
2205
2168
2206
2169
2207
2170
2208
2171
2209
2172
2210
2173
2211
2174
2212
2175
2213
2176
2214
2177
2215
2178
2216
2179
2217
2180
2218
2181
2219
2182
2220
2183
2221
2222
2185
2223
10273
2186
2224
2187
2225
2188
2226
2189
2227
2190
2228
2191
2229
2192
2230
2193
2231
2194
2232
2195
2233
2196
2234
2197
2235
2198
2236
2199
2237
2200
2238
2201
2239
2202
2240
2203
2241
2204
2242
2205
2243
2206
2244
2207
2245
2208
2246
2209
2247
2210
2248
2211
2249
2212
2250
2213
2251
2214
2252
2215
2253
2216
2254
2217
2255
2218
2256
2219
2257
2220
2258
2221
2259
2222
2260
2261
2224
2262
7573
2225
2263
2226
2264
2227
2265
2228
2266
2229
2267
2230
2268
2231
2269
2232
2270
2233
2271
2234
2272
2235
2273
2236
2274
2237
2275
2238
2276
2239
2277
2240
2278
2241
2279
2242
2280
2243
2281
2244
2282
2245
2283
2246
2284
2247
2285
2248
2286
2249
2287
2250
2288
2251
2289
2252
2290
2253
2291
2254
2292
2255
2293
2256
2294
2257
2295
2258
2296
2259
2297
2260
2298
2261
2299
2300
2263
2301
15091
2264
2302
2265
2303
2266
2304
2267
2305
2268
2306
2269
2307
2270
2308
2271
2309
2272
2310
2273
2311
2274
2312
2275
2313
2276
2314
2277
2315
2278
2316
2279
2317
2280
2318
2281
2319
2282
2320
2283
2321
2284
2322
2285
2323
2286
2324
2287
2325
2288
2326
2289
2327
2290
2328
2291
2329
2292
2330
2293
2331
2294
2332
2295
2333
2296
2334
2297
2335
2298
2336
2299
2337
2300
2338
2339
2302
2340
12038
2303
2341
2304
2342
2305
2343
2306
2344
2307
2345
2308
2346
2309
2347
2310
2348
2311
2349
2312
2350
2313
2351
2314
2352
2315
2353
2316
2354
2317
2355
2318
2356
2319
2357
2320
2358
2321
2359
2322
2360
2323
2361
2324
2362
2325
2363
2326
2364
2327
2365
2328
2366
2329
2367
2330
2368
2331
2369
2332
2370
2333
2371
2334
2372
2335
2373
2336
2374
2337
2375
2338
2376
2339
2377
2378
2341
2379
14900
2342
2380
2343
2381
2344
2382
2345
2383
2346
2384
2347
2385
2348
2386
2349
2387
2350
2388
2351
2389
2352
2390
2353
2391
2354
2392
2355
2393
2356
2394
2357
2395
2358
2396
2359
2397
2360
2398
2361
2399
2362
2400
2363
2401
2364
2402
2365
2403
2366
2404
2367
2405
2368
2406
2369
2407
2370
2408
2371
2409
2372
2410
2373
2411
2374
2412
2375
2413
2376
2414
2377
2415
2378
2416
2417
2380
2418
13335
2381
2419
2382
2420
2383
2421
2384
2422
2385
2423
2386
2424
2387
2425
2388
2426
2389
2427
2390
2428
2391
2429
2392
2430
2393
2431
2394
2432
2395
2433
2396
2434
2397
2435
2398
2436
2399
2437
2400
2438
2401
2439
2402
2440
2403
2441
2404
2442
2405
2443
2406
2444
2407
2445
2408
2446
2409
2447
2410
2448
2411
2449
2412
2450
2413
2451
2414
2452
2415
2453
2416
2454
2417
2455
2456
2419
2457
15030
2420
2458
2421
2459
2422
2460
2423
2461
2424
2462
2425
2463
2426
2464
2427
2465
2428
2466
2429
2467
2430
2468
2431
2469
2432
2470
2433
2471
2434
2472
2435
2473
2436
2474
2437
2475
2438
2476
2439
2477
2440
2478
2441
2479
2442
2480
2443
2481
2444
2482
2445
2483
2446
2484
2447
2485
2448
2486
2449
2487
2450
2488
2451
2489
2452
2490
2453
2491
2454
2492
2455
2493
2456
2494
2495
2458
2496
13978
2459
2497
2460
2498
2461
2499
2462
2500
2463
2501
2464
2502
2465
2503
2466
2504
2467
2505
2468
2506
2469
2507
2470
2508
2471
2509
2472
2510
2473
2511
2474
2512
2475
2513
2476
2514
2477
2515
2478
2516
2479
2517
2480
2518
2481
2519
2482
2520
2483
2521
2484
2522
2485
2523
2486
2524
2487
2525
2488
2526
2489
2527
2490
2528
2491
2529
2492
2530
2493
2531
2494
2532
2495
2533
2534
2497
2535
13417
2498
2536
2499
2537
2500
2538
2501
2539
2502
2540
2503
2541
2504
2542
2505
2543
2506
2544
2507
2545
2508
2546
2509
2547
2510
2548
2511
2549
2512
2550
2513
2551
2514
2552
2515
2553
2516
2554
2517
2555
2518
2556
2519
2557
2520
2558
2521
2559
2522
2560
2523
2561
2524
2562
2525
2563
2526
2564
2527
2565
2528
2566
2529
2567
2530
2568
2531
2569
2532
2570
2533
2571
2534
2572
2573
2536
2574
11482
2537
2575
2538
2576
2539
2577
2540
2578
2541
2579
2542
2580
2543
2581
2544
2582
2545
2583
2546
2584
2547
2585
2548
2586
2549
2587
2550
2588
2551
2589
2552
2590
2553
2591
2554
2592
2555
2593
2556
2594
2557
2595
2558
2596
2559
2597
2560
2598
2561
2599
2562
2600
2563
2601
2564
2602
2565
2603
2566
2604
2567
2605
2568
2606
2569
2607
2570
2608
2571
2609
2572
2610
2573
2611
2612
2575
2613
16047
2576
2614
2577
2615
2578
2616
2579
2617
2580
2618
2581
2619
2582
2620
2583
2621
2584
2622
2585
2623
2586
2624
2587
2625
2588
2626
2589
2627
2590
2628
2591
2629
2592
2630
2593
2631
2594
2632
2595
2633
2596
2634
2597
2635
2598
2636
2599
2637
2600
2638
2601
2639
2602
2640
2603
2641
2604
2642
2605
2643
2606
2644
2607
2645
2608
2646
2609
2647
2610
2648
2611
2649
2612
2650
2651
2614
2652
12936
2615
2653
2616
2654
2617
2655
2618
2656
2619
2657
2620
2658
2621
2659
2622
2660
2623
2661
2624
2662
2625
2663
2626
2664
2627
2665
2628
2666
2629
2667
2630
2668
2631
2669
2632
2670
2633
2671
2634
2672
2635
2673
2636
2674
2637
2675
2638
2676
2639
2677
2640
2678
2641
2679
2642
2680
2643
2681
2644
2682
2645
2683
2646
2684
2647
2685
2648
2686
2649
2687
2650
2688
2651
2689
2690
2653
2691
15041
2654
2692
2655
2693
2656
2694
2657
2695
2658
2696
2659
2697
2660
2698
2661
2699
2662
2700
2663
2701
2664
2702
2665
2703
2666
2704
2667
2705
2668
2706
2669
2707
2670
2708
2671
2709
2672
2710
2673
2711
2674
2712
2675
2713
2676
2714
2677
2715
2678
2716
2679
2717
2680
2718
2681
2719
2682
2720
2683
2721
2684
2722
2685
2723
2686
2724
2687
2725
2688
2726
2689
2727
2690
2728
2729
2692
2730
15476
2693
2731
2694
2732
2695
2733
2696
2734
2697
2735
2698
2736
2699
2737
2700
2738
2701
2739
2702
2740
2703
2741
2704
2742
2705
2743
2706
2744
2707
2745
2708
2746
2709
2747
2710
2748
2711
2749
2712
2750
2713
2751
2714
2752
2715
2753
2716
2754
2717
2755
2718
2756
2719
2757
2720
2758
2721
2759
2722
2760
2723
2761
2724
2762
2725
2763
2726
2764
2727
2765
2728
2766
2729
2767
2768
2731
2769
15322
2732
2770
2733
2771
2734
2772
2735
2773
2736
2774
2737
2775
2738
2776
2739
2777
2740
2778
2741
2779
2742
2780
2743
2781
2744
2782
2745
2783
2746
2784
2747
2785
2748
2786
2749
2787
2750
2788
2751
2789
2752
2790
2753
2791
2754
2792
2755
2793
2756
2794
2757
2795
2758
2796
2759
2797
2760
2798
2761
2799
2762
2800
2763
2801
2764
2802
2765
2803
2766
2804
2767
2805
2768
2806
2807
2770
2808
11581
2771
2809
2772
2810
2773
2811
2774
2812
2775
2813
2776
2814
2777
2815
2778
2816
2779
2817
2780
2818
2781
2819
2782
2820
2783
2821
2784
2822
2785
2823
2786
2824
2787
2825
2788
2826
2789
2827
2790
2828
2791
2829
2792
2830
2793
2831
2794
2832
2795
2833
2796
2834
2797
2835
2798
2836
2799
2837
2800
2838
2801
2839
2802
2840
2803
2841
2804
2842
2805
2843
2806
2844
2807
2845
2846
2809
2847
14758
2810
2848
2811
2849
2812
2850
2813
2851
2814
2852
2815
2853
2816
2854
2817
2855
2818
2856
2819
2857
2820
2858
2821
2859
2822
2860
2823
2861
2824
2862
2825
2863
2826
2864
2827
2865
2828
2866
2829
2867
2830
2868
2831
2869
2832
2870
2833
2871
2834
2872
2835
2873
2836
2874
2837
2875
2838
2876
2839
2877
2840
2878
2841
2879
2842
2880
2843
2881
2844
2882
2845
2883
2846
2884
2885
2848
2886
7295
2849
2887
2850
2888
2851
2889
2852
2890
2853
2891
2854
2892
2855
2893
2856
2894
2857
2895
2858
2896
2859
2897
2860
2898
2861
2899
2862
2900
2863
2901
2864
2902
2865
2903
2866
2904
2867
2905
2868
2906
2869
2907
2870
2908
2871
2909
2872
2910
2873
2911
2874
2912
2875
2913
2876
2914
2877
2915
2878
2916
2879
2917
2880
2918
2881
2919
2882
2920
2883
2921
2884
2922
2885
2923
2924
2887
2925
14528
2888
2926
2889
2927
2890
2928
2891
2929
2892
2930
2893
2931
2894
2932
2895
2933
2896
2934
2897
2935
2898
2936
2899
2937
2900
2938
2901
2939
2902
2940
2903
2941
2904
2942
2905
2943
2906
2944
2907
2945
2908
2946
2909
2947
2910
2948
2911
2949
2912
2950
2913
2951
2914
2952
2915
2953
2916
2954
2917
2955
2918
2956
2919
2957
2920
2958
2921
2959
2922
2960
2923
2961
2924
2962
2963
2926
2964
6810
2927
2965
2928
2966
2929
2967
2930
2968
2931
2969
2932
2970
2933
2971
2934
2972
2935
2973
2936
2974
2937
2975
2938
2976
2939
2977
2940
2978
2941
2979
2942
2980
2943
2981
2944
2982
2945
2983
2946
2984
2947
2985
2948
2986
2949
2987
2950
2988
2951
2989
2952
2990
2953
2991
2954
2992
2955
2993
2956
2994
2957
2995
2958
2996
2959
2997
2960
2998
2961
2999
2962
3000
2963
3001
3002
2965
3003
10531
2966
3004
2967
3005
2968
3006
2969
3007
2970
3008
2971
3009
2972
3010
2973
3011
2974
3012
2975
3013
2976
3014
2977
3015
2978
3016
2979
3017
2980
3018
2981
3019
2982
3020
2983
3021
2984
3022
2985
3023
2986
3024
2987
3025
2988
3026
2989
3027
2990
3028
2991
3029
2992
3030
2993
3031
2994
3032
2995
3033
2996
3034
2997
3035
2998
3036
2999
3037
3000
3038
3001
3039
3002
3040
3041
3004
3042
14312
3005
3043
3006
3044
3007
3045
3008
3046
3009
3047
3010
3048
3011
3049
3012
3050
3013
3051
3014
3052
3015
3053
3016
3054
3017
3055
3018
3056
3019
3057
3020
3058
3021
3059
3022
3060
3023
3061
3024
3062
3025
3063
3026
3064
3027
3065
3028
3066
3029
3067
3030
3068
3031
3069
3032
3070
3033
3071
3034
3072
3035
3073
3036
3074
3037
3075
3038
3076
3039
3077
3040
3078
3041
3079
3080
3043
3081
14313
3044
3082
3045
3083
3046
3084
3047
3085
3048
3086
3049
3087
3050
3088
3051
3089
3052
3090
3053
3091
3054
3092
3055
3093
3056
3094
3057
3095
3058
3096
3059
3097
3060
3098
3061
3099
3062
3100
3063
3101
3064
3102
3065
3103
3066
3104
3067
3105
3068
3106
3069
3107
3070
3108
3071
3109
3072
3110
3073
3111
3074
3112
3075
3113
3076
3114
3077
3115
3078
3116
3079
3117
3080
3118
3119
3082
3120
13642
3083
3121
3084
3122
3085
3123
3086
3124
3087
3125
3088
3126
3089
3127
3090
3128
3091
3129
3092
3130
3093
3131
3094
3132
3095
3133
3096
3134
3097
3135
3098
3136
3099
3137
3100
3138
3101
3139
3102
3140
3103
3141
3104
3142
3105
3143
3106
3144
3107
3145
3108
3146
3109
3147
3110
3148
3111
3149
3112
3150
3113
3151
3114
3152
3115
3153
3116
3154
3117
3155
3118
3156
3119
3157
3158
3121
3159
8213
3122
3160
3123
3161
3124
3162
3125
3163
3126
3164
3127
3165
3128
3166
3129
3167
3130
3168
3131
3169
3132
3170
3133
3171
3134
3172
3135
3173
3136
3174
3137
3175
3138
3176
3139
3177
3140
3178
3141
3179
3142
3180
3143
3181
3144
3182
3145
3183
3146
3184
3147
3185
3148
3186
3149
3187
3150
3188
3151
3189
3152
3190
3153
3191
3154
3192
3155
3193
3156
3194
3157
3195
3158
3196
3197
3160
3198
15593
3161
3199
3162
3200
3163
3201
3164
3202
3165
3203
3166
3204
3167
3205
3168
3206
3169
3207
3170
3208
3171
3209
3172
3210
3173
3211
3174
3212
3175
3213
3176
3214
3177
3215
3178
3216
3179
3217
3180
3218
3181
3219
3182
3220
3183
3221
3184
3222
3185
3223
3186
3224
3187
3225
3188
3226
3189
3227
3190
3228
3191
3229
3192
3230
3193
3231
3194
3232
3195
3233
3196
3234
3197
3235
3236
3199
3237
9864
3200
3238
3201
3239
3202
3240
3203
3241
3204
3242
3205
3243
3206
3244
3207
3245
3208
3246
3209
3247
3210
3248
3211
3249
3212
3250
3213
3251
3214
3252
3215
3253
3216
3254
3217
3255
3218
3256
3219
3257
3220
3258
3221
3259
3222
3260
3223
3261
3224
3262
3225
3263
3226
3264
3227
3265
3228
3266
3229
3267
3230
3268
3231
3269
3232
3270
3233
3271
3234
3272
3235
3273
3236
3274
3275
3238
3276
12185
3239
3277
3240
3278
3241
3279
3242
3280
3243
3281
3244
3282
3245
3283
3246
3284
3247
3285
3248
3286
3249
3287
3250
3288
3251
3289
3252
3290
3253
3291
3254
3292
3255
3293
3256
3294
3257
3295
3258
3296
3259
3297
3260
3298
3261
3299
3262
3300
3263
3301
3264
3302
3265
3303
3266
3304
3267
3305
3268
3306
3269
3307
3270
3308
3271
3309
3272
3310
3273
3311
3274
3312
3275
3313
3314
3277
3315
12613
3278
3316
3279
3317
3280
3318
3281
3319
3282
3320
3283
3321
3284
3322
3285
3323
3286
3324
3287
3325
3288
3326
3289
3327
3290
3328
3291
3329
3292
3330
3293
3331
3294
3332
3295
3333
3296
3334
3297
3335
3298
3336
3299
3337
3300
3338
3301
3339
3302
3340
3303
3341
3304
3342
3305
3343
3306
3344
3307
3345
3308
3346
3309
3347
3310
3348
3311
3349
3312
3350
3313
3351
3314
3352
3353
3316
3354
6837
3317
3355
3318
3356
3319
3357
3320
3358
3321
3359
3322
3360
3323
3361
3324
3362
3325
3363
3326
3364
3327
3365
3328
3366
3329
3367
3330
3368
3331
3369
3332
3370
3333
3371
3334
3372
3335
3373
3336
3374
3337
3375
3338
3376
3339
3377
3340
3378
3341
3379
3342
3380
3343
3381
3344
3382
3345
3383
3346
3384
3347
3385
3348
3386
3349
3387
3350
3388
3351
3389
3352
3390
3353
3391
3392
3355
3393
12408
3356
3394
3357
3395
3358
3396
3359
3397
3360
3398
3361
3399
3362
3400
3363
3401
3364
3402
3365
3403
3366
3404
3367
3405
3368
3406
3369
3407
3370
3408
3371
3409
3372
3410
3373
3411
3374
3412
3375
3413
3376
3414
3377
3415
3378
3416
3379
3417
3380
3418
3381
3419
3382
3420
3383
3421
3384
3422
3385
3423
3386
3424
3387
3425
3388
3426
3389
3427
3390
3428
3391
3429
3392
3430
3431
3394
3432
13825
3395
3433
3396
3434
3397
3435
3398
3436
3399
3437
3400
3438
3401
3439
3402
3440
3403
3441
3404
3442
3405
3443
3406
3444
3407
3445
3408
3446
3409
3447
3410
3448
3411
3449
3412
3450
3413
3451
3414
3452
3415
3453
3416
3454
3417
3455
3418
3456
3419
3457
3420
3458
3421
3459
3422
3460
3423
3461
3424
3462
3425
3463
3426
3464
3427
3465
3428
3466
3429
3467
3430
3468
3431
3469
3470
3433
3471
13340
3434
3472
3435
3473
3436
3474
3437
3475
3438
3476
3439
3477
3440
3478
3441
3479
3442
3480
3443
3481
3444
3482
3445
3483
3446
3484
3447
3485
3448
3486
3449
3487
3450
3488
3451
3489
3452
3490
3453
3491
3454
3492
3455
3493
3456
3494
3457
3495
3458
3496
3459
3497
3460
3498
3461
3499
3462
3500
3463
3501
3464
3502
3465
3503
3466
3504
3467
3505
3468
3506
3469
3507
3470
3508
3509
3472
3510
7267
3473
3511
3474
3512
3475
3513
3476
3514
3477
3515
3478
3516
3479
3517
3480
3518
3481
3519
3482
3520
3483
3521
3484
3522
3485
3523
3486
3524
3487
3525
3488
3526
3489
3527
3490
3528
3491
3529
3492
3530
3493
3531
3494
3532
3495
3533
3496
3534
3497
3535
3498
3536
3499
3537
3500
3538
3501
3539
3502
3540
3503
3541
3504
3542
3505
3543
3506
3544
3507
3545
3508
3546
3509
3547
3548
3511
3549
15201
3512
3550
3513
3551
3514
3552
3515
3553
3516
3554
3517
3555
3518
3556
3519
3557
3520
3558
3521
3559
3522
3560
3523
3561
3524
3562
3525
3563
3526
3564
3527
3565
3528
3566
3529
3567
3530
3568
3531
3569
3532
3570
3533
3571
3534
3572
3535
3573
3536
3574
3537
3575
3538
3576
3539
3577
3540
3578
3541
3579
3542
3580
3543
3581
3544
3582
3545
3583
3546
3584
3547
3585
3548
3586
3587
3550
3588
9918
3551
3589
3552
3590
3553
3591
3554
3592
3555
3593
3556
3594
3557
3595
3558
3596
3559
3597
3560
3598
3561
3599
3562
3600
3563
3601
3564
3602
3565
3603
3566
3604
3567
3605
3568
3606
3569
3607
3570
3608
3571
3609
3572
3610
3573
3611
3574
3612
3575
3613
3576
3614
3577
3615
3578
3616
3579
3617
3580
3618
3581
3619
3582
3620
3583
3621
3584
3622
3585
3623
3586
3624
3587
3625
3626
3589
3627
11353
3590
3628
3591
3629
3592
3630
3593
3631
3594
3632
3595
3633
3596
3634
3597
3635
3598
3636
3599
3637
3600
3638
3601
3639
3602
3640
3603
3641
3604
3642
3605
3643
3606
3644
3607
3645
3608
3646
3609
3647
3610
3648
3611
3649
3612
3650
3613
3651
3614
3652
3615
3653
3616
3654
3617
3655
3618
3656
3619
3657
3620
3658
3621
3659
3622
3660
3623
3661
3624
3662
3625
3663
3626
3664
3665
3628
3666
6999
3629
3667
3630
3668
3631
3669
3632
3670
3633
3671
3634
3672
3635
3673
3636
3674
3637
3675
3638
3676
3639
3677
3640
3678
3641
3679
3642
3680
3643
3681
3644
3682
3645
3683
3646
3684
3647
3685
3648
3686
3649
3687
3650
3688
3651
3689
3652
3690
3653
3691
3654
3692
3655
3693
3656
3694
3657
3695
3658
3696
3659
3697
3660
3698
3661
3699
3662
3700
3663
3701
3664
3702
3665
3703
3704
3667
3705
15164
3668
3706
3669
3707
3670
3708
3671
3709
3672
3710
3673
3711
3674
3712
3675
3713
3676
3714
3677
3715
3678
3716
3679
3717
3680
3718
3681
3719
3682
3720
3683
3721
3684
3722
3685
3723
3686
3724
3687
3725
3688
3726
3689
3727
3690
3728
3691
3729
3692
3730
3693
3731
3694
3732
3695
3733
3696
3734
3697
3735
3698
3736
3699
3737
3700
3738
3701
3739
3702
3740
3703
3741
3704
3742
3743
3706
3744
10650
3707
3745
3708
3746
3709
3747
3710
3748
3711
3749
3712
3750
3713
3751
3714
3752
3715
3753
3716
3754
3717
3755
3718
3756
3719
3757
3720
3758
3721
3759
3722
3760
3723
3761
3724
3762
3725
3763
3726
3764
3727
3765
3728
3766
3729
3767
3730
3768
3731
3769
3732
3770
3733
3771
3734
3772
3735
3773
3736
3774
3737
3775
3738
3776
3739
3777
3740
3778
3741
3779
3742
3780
3743
3781
3782
3745
3783
13660
3746
3784
3747
3785
3748
3786
3749
3787
3750
3788
3751
3789
3752
3790
3753
3791
3754
3792
3755
3793
3756
3794
3757
3795
3758
3796
3759
3797
3760
3798
3761
3799
3762
3800
3763
3801
3764
3802
3765
3803
3766
3804
3767
3805
3768
3806
3769
3807
3770
3808
3771
3809
3772
3810
3773
3811
3774
3812
3775
3813
3776
3814
3777
3815
3778
3816
3779
3817
3780
3818
3781
3819
3782
3820
3821
3784
3822
10198
3785
3823
3786
3824
3787
3825
3788
3826
3789
3827
3790
3828
3791
3829
3792
3830
3793
3831
3794
3832
3795
3833
3796
3834
3797
3835
3798
3836
3799
3837
3800
3838
3801
3839
3802
3840
3803
3841
3804
3842
3805
3843
3806
3844
3807
3845
3808
3846
3809
3847
3810
3848
3811
3849
3812
3850
3813
3851
3814
3852
3815
3853
3816
3854
3817
3855
3818
3856
3819
3857
3820
3858
3821
3859
3860
3823
3861
6464
3824
3862
3825
3863
3826
3864
3827
3865
3828
3866
3829
3867
3830
3868
3831
3869
3832
3870
3833
3871
3834
3872
3835
3873
3836
3874
3837
3875
3838
3876
3839
3877
3840
3878
3841
3879
3842
3880
3843
3881
3844
3882
3845
3883
3846
3884
3847
3885
3848
3886
3849
3887
3850
3888
3851
3889
3852
3890
3853
3891
3854
3892
3855
3893
3856
3894
3857
3895
3858
3896
3859
3897
3860
3898
3899
3862
3900
13469
3863
3901
3864
3902
3865
3903
3866
3904
3867
3905
3868
3906
3869
3907
3870
3908
3871
3909
3872
3910
3873
3911
3874
3912
3875
3913
3876
3914
3877
3915
3878
3916
3879
3917
3880
3918
3881
3919
3882
3920
3883
3921
3884
3922
3885
3923
3886
3924
3887
3925
3888
3926
3889
3927
3890
3928
3891
3929
3892
3930
3893
3931
3894
3932
3895
3933
3896
3934
3897
3935
3898
3936
3899
3937
3938
3901
3939
12622
3902
3940
3903
3941
3904
3942
3905
3943
3906
3944
3907
3945
3908
3946
3909
3947
3910
3948
3911
3949
3912
3950
3913
3951
3914
3952
3915
3953
3916
3954
3917
3955
3918
3956
3919
3957
3920
3958
3921
3959
3922
3960
3923
3961
3924
3962
3925
3963
3926
3964
3927
3965
3928
3966
3929
3967
3930
3968
3931
3969
3932
3970
3933
3971
3934
3972
3935
3973
3936
3974
3937
3975
3938
3976
3977
3940
3978
14301
3941
3979
3942
3980
3943
3981
3944
3982
3945
3983
3946
3984
3947
3985
3948
3986
3949
3987
3950
3988
3951
3989
3952
3990
3953
3991
3954
3992
3955
3993
3956
3994
3957
3995
3958
3996
3959
3997
3960
3998
3961
3999
3962
4000
3963
4001
3964
4002
3965
4003
3966
4004
3967
4005
3968
4006
3969
4007
3970
4008
3971
4009
3972
4010
3973
4011
3974
4012
3975
4013
3976
4014
3977
4015
4016
3979
4017
11187
3980
4018
3981
4019
3982
4020
3983
4021
3984
4022
3985
4023
3986
4024
3987
4025
3988
4026
3989
4027
3990
4028
3991
4029
3992
4030
3993
4031
3994
4032
3995
4033
3996
4034
3997
4035
3998
4036
3999
4037
4000
4038
4001
4039
4002
4040
4003
4041
4004
4042
4005
4043
4006
4044
4007
4045
4008
4046
4009
4047
4010
4048
4011
4049
4012
4050
4013
4051
4014
4052
4015
4053
4016
4054
4055
4018
4056
13178
4019
4057
4020
4058
4021
4059
4022
4060
4023
4061
4024
4062
4025
4063
4026
4064
4027
4065
4028
4066
4029
4067
4030
4068
4031
4069
4032
4070
4033
4071
4034
4072
4035
4073
4036
4074
4037
4075
4038
4076
4039
4077
4040
4078
4041
4079
4042
4080
4043
4081
4044
4082
4045
4083
4046
4084
4047
4085
4048
4086
4049
4087
4050
4088
4051
4089
4052
4090
4053
4091
4054
4092
4055
4093
4094
4057
4095
6131
4058
4096
4059
4097
4060
4098
4061
4099
4062
4100
4063
4101
4064
4102
4065
4103
4066
4104
4067
4105
4068
4106
4069
4107
4070
4108
4071
4109
4072
4110
4073
4111
4074
4112
4075
4113
4076
4114
4077
4115
4078
4116
4079
4117
4080
4118
4081
4119
4082
4120
4083
4121
4084
4122
4085
4123
4086
4124
4087
4125
4088
4126
4089
4127
4090
4128
4091
4129
4092
4130
4093
4131
4094
4132
4133
4096
4134
12946
4097
4135
4098
4136
4099
4137
4100
4138
4101
4139
4102
4140
4103
4141
4104
4142
4105
4143
4106
4144
4107
4145
4108
4146
4109
4147
4110
4148
4111
4149
4112
4150
4113
4151
4114
4152
4115
4153
4116
4154
4117
4155
4118
4156
4119
4157
4120
4158
4121
4159
4122
4160
4123
4161
4124
4162
4125
4163
4126
4164
4127
4165
4128
4166
4129
4167
4130
4168
4131
4169
4132
4170
4133
4171
4172
4135
4173
11602
4136
4174
4137
4175
4138
4176
4139
4177
4140
4178
4141
4179
4142
4180
4143
4181
4144
4182
4145
4183
4146
4184
4147
4185
4148
4186
4149
4187
4150
4188
4151
4189
4152
4190
4153
4191
4154
4192
4155
4193
4156
4194
4157
4195
4158
4196
4159
4197
4160
4198
4161
4199
4162
4200
4163
4201
4164
4202
4165
4203
4166
4204
4167
4205
4168
4206
4169
4207
4170
4208
4171
4209
4172
4210
4211
4174
4212
12098
4175
4213
4176
4214
4177
4215
4178
4216
4179
4217
4180
4218
4181
4219
4182
4220
4183
4221
4184
4222
4185
4223
4186
4224
4187
4225
4188
4226
4189
4227
4190
4228
4191
4229
4192
4230
4193
4231
4194
4232
4195
4233
4196
4234
4197
4235
4198
4236
4199
4237
4200
4238
4201
4239
4202
4240
4203
4241
4204
4242
4205
4243
4206
4244
4207
4245
4208
4246
4209
4247
4210
4248
4211
4249
4250
4213
4251
11408
4214
4252
4215
4253
4216
4254
4217
4255
4218
4256
4219
4257
4220
4258
4221
4259
4222
4260
4223
4261
4224
4262
4225
4263
4226
4264
4227
4265
4228
4266
4229
4267
4230
4268
4231
4269
4232
4270
4233
4271
4234
4272
4235
4273
4236
4274
4237
4275
4238
4276
4239
4277
4240
4278
4241
4279
4242
4280
4243
4281
4244
4282
4245
4283
4246
4284
4247
4285
4248
4286
4249
4287
4250
4288
4289
4252
4290
15960
4253
4291
4254
4292
4255
4293
4256
4294
4257
4295
4258
4296
4259
4297
4260
4298
4261
4299
4262
4300
4263
4301
4264
4302
4265
4303
4266
4304
4267
4305
4268
4306
4269
4307
4270
4308
4271
4309
4272
4310
4273
4311
4274
4312
4275
4313
4276
4314
4277
4315
4278
4316
4279
4317
4280
4318
4281
4319
4282
4320
4283
4321
4284
4322
4285
4323
4286
4324
4287
4325
4288
4326
4289
4327
4328
4291
4329
9808
4292
4330
4293
4331
4294
4332
4295
4333
4296
4334
4297
4335
4298
4336
4299
4337
4300
4338
4301
4339
4302
4340
4303
4341
4304
4342
4305
4343
4306
4344
4307
4345
4308
4346
4309
4347
4310
4348
4311
4349
4312
4350
4313
4351
4314
4352
4315
4353
4316
4354
4317
4355
4318
4356
4319
4357
4320
4358
4321
4359
4322
4360
4323
4361
4324
4362
4325
4363
4326
4364
4327
4365
4328
4366
4367
4330
4368
12696
4331
4369
4332
4370
4333
4371
4334
4372
4335
4373
4336
4374
4337
4375
4338
4376
4339
4377
4340
4378
4341
4379
4342
4380
4343
4381
4344
4382
4345
4383
4346
4384
4347
4385
4348
4386
4349
4387
4350
4388
4351
4389
4352
4390
4353
4391
4354
4392
4355
4393
4356
4394
4357
4395
4358
4396
4359
4397
4360
4398
4361
4399
4362
4400
4363
4401
4364
4402
4365
4403
4366
4404
4367
4405
4406
4369
4407
13205
4370
4408
4371
4409
4372
4410
4373
4411
4374
4412
4375
4413
4376
4414
4377
4415
4378
4416
4379
4417
4380
4418
4381
4419
4382
4420
4383
4421
4384
4422
4385
4423
4386
4424
4387
4425
4388
4426
4389
4427
4390
4428
4391
4429
4392
4430
4393
4431
4394
4432
4395
4433
4396
4434
4397
4435
4398
4436
4399
4437
4400
4438
4401
4439
4402
4440
4403
4441
4404
4442
4405
4443
4406
4444
4445
4408
4446
14047
4409
4447
4410
4448
4411
4449
4412
4450
4413
4451
4414
4452
4415
4453
4416
4454
4417
4455
4418
4456
4419
4457
4420
4458
4421
4459
4422
4460
4423
4461
4424
4462
4425
4463
4426
4464
4427
4465
4428
4466
4429
4467
4430
4468
4431
4469
4432
4470
4433
4471
4434
4472
4435
4473
4436
4474
4437
4475
4438
4476
4439
4477
4440
4478
4441
4479
4442
4480
4443
4481
4444
4482
4445
4483
4484
4447
4485
9330
4448
4486
4449
4487
4450
4488
4451
4489
4452
4490
4453
4491
4454
4492
4455
4493
4456
4494
4457
4495
4458
4496
4459
4497
4460
4498
4461
4499
4462
4500
4463
4501
4464
4502
4465
4503
4466
4504
4467
4505
4468
4506
4469
4507
4470
4508
4471
4509
4472
4510
4473
4511
4474
4512
4475
4513
4476
4514
4477
4515
4478
4516
4479
4517
4480
4518
4481
4519
4482
4520
4483
4521
4484
4522
4523
4486
4524
16243
4487
4525
4488
4526
4489
4527
4490
4528
4491
4529
4492
4530
4493
4531
4494
4532
4495
4533
4496
4534
4497
4535
4498
4536
4499
4537
4500
4538
4501
4539
4502
4540
4503
4541
4504
4542
4505
4543
4506
4544
4507
4545
4508
4546
4509
4547
4510
4548
4511
4549
4512
4550
4513
4551
4514
4552
4515
4553
4516
4554
4517
4555
4518
4556
4519
4557
4520
4558
4521
4559
4522
4560
4523
4561
4562
4525
4563
12371
4526
4564
4527
4565
4528
4566
4529
4567
4530
4568
4531
4569
4532
4570
4533
4571
4534
4572
4535
4573
4536
4574
4537
4575
4538
4576
4539
4577
4540
4578
4541
4579
4542
4580
4543
4581
4544
4582
4545
4583
4546
4584
4547
4585
4548
4586
4549
4587
4550
4588
4551
4589
4552
4590
4553
4591
4554
4592
4555
4593
4556
4594
4557
4595
4558
4596
4559
4597
4560
4598
4561
4599
4562
4600
4601
4564
4602
12372
4565
4603
4566
4604
4567
4605
4568
4606
4569
4607
4570
4608
4571
4609
4572
4610
4573
4611
4574
4612
4575
4613
4576
4614
4577
4615
4578
4616
4579
4617
4580
4618
4581
4619
4582
4620
4583
4621
4584
4622
4585
4623
4586
4624
4587
4625
4588
4626
4589
4627
4590
4628
4591
4629
4592
4630
4593
4631
4594
4632
4595
4633
4596
4634
4597
4635
4598
4636
4599
4637
4600
4638
4601
4639
4640
4603
4641
15907
4604
4642
4605
4643
4606
4644
4607
4645
4608
4646
4609
4647
4610
4648
4611
4649
4612
4650
4613
4651
4614
4652
4615
4653
4616
4654
4617
4655
4618
4656
4619
4657
4620
4658
4621
4659
4622
4660
4623
4661
4624
4662
4625
4663
4626
4664
4627
4665
4628
4666
4629
4667
4630
4668
4631
4669
4632
4670
4633
4671
4634
4672
4635
4673
4636
4674
4637
4675
4638
4676
4639
4677
4640
4678
4679
4642
4680
9016
4643
4681
4644
4682
4645
4683
4646
4684
4647
4685
4648
4686
4649
4687
4650
4688
4651
4689
4652
4690
4653
4691
4654
4692
4655
4693
4656
4694
4657
4695
4658
4696
4659
4697
4660
4698
4661
4699
4662
4700
4663
4701
4664
4702
4665
4703
4666
4704
4667
4705
4668
4706
4669
4707
4670
4708
4671
4709
4672
4710
4673
4711
4674
4712
4675
4713
4676
4714
4677
4715
4678
4716
4679
4717
4718
4681
4719
15389
4682
4720
4683
4721
4684
4722
4685
4723
4686
4724
4687
4725
4688
4726
4689
4727
4690
4728
4691
4729
4692
4730
4693
4731
4694
4732
4695
4733
4696
4734
4697
4735
4698
4736
4699
4737
4700
4738
4701
4739
4702
4740
4703
4741
4704
4742
4705
4743
4706
4744
4707
4745
4708
4746
4709
4747
4710
4748
4711
4749
4712
4750
4713
4751
4714
4752
4715
4753
4716
4754
4717
4755
4718
4756
4757
4720
4758
12126
4721
4759
4722
4760
4723
4761
4724
4762
4725
4763
4726
4764
4727
4765
4728
4766
4729
4767
4730
4768
4731
4769
4732
4770
4733
4771
4734
4772
4735
4773
4736
4774
4737
4775
4738
4776
4739
4777
4740
4778
4741
4779
4742
4780
4743
4781
4744
4782
4745
4783
4746
4784
4747
4785
4748
4786
4749
4787
4750
4788
4751
4789
4752
4790
4753
4791
4754
4792
4755
4793
4756
4794
4757
4795
4796
4759
4797
13635
4760
4798
4761
4799
4762
4800
4763
4801
4764
4802
4765
4803
4766
4804
4767
4805
4768
4806
4769
4807
4770
4808
4771
4809
4772
4810
4773
4811
4774
4812
4775
4813
4776
4814
4777
4815
4778
4816
4779
4817
4780
4818
4781
4819
4782
4820
4783
4821
4784
4822
4785
4823
4786
4824
4787
4825
4788
4826
4789
4827
4790
4828
4791
4829
4792
4830
4793
4831
4794
4832
4795
4833
4796
4834
4835
4798
4836
11001
4799
4837
4800
4838
4801
4839
4802
4840
4803
4841
4804
4842
4805
4843
4806
4844
4807
4845
4808
4846
4809
4847
4810
4848
4811
4849
4812
4850
4813
4851
4814
4852
4815
4853
4816
4854
4817
4855
4818
4856
4819
4857
4820
4858
4821
4859
4822
4860
4823
4861
4824
4862
4825
4863
4826
4864
4827
4865
4828
4866
4829
4867
4830
4868
4831
4869
4832
4870
4833
4871
4834
4872
4835
4873
4874
4837
4875
13401
4838
4876
4839
4877
4840
4878
4841
4879
4842
4880
4843
4881
4844
4882
4845
4883
4846
4884
4847
4885
4848
4886
4849
4887
4850
4888
4851
4889
4852
4890
4853
4891
4854
4892
4855
4893
4856
4894
4857
4895
4858
4896
4859
4897
4860
4898
4861
4899
4862
4900
4863
4901
4864
4902
4865
4903
4866
4904
4867
4905
4868
4906
4869
4907
4870
4908
4871
4909
4872
4910
4873
4911
4874
4912
4913
4876
4914
13560
4877
4915
4878
4916
4879
4917
4880
4918
4881
4919
4882
4920
4883
4921
4884
4922
4885
4923
4886
4924
4887
4925
4888
4926
4889
4927
4890
4928
4891
4929
4892
4930
4893
4931
4894
4932
4895
4933
4896
4934
4897
4935
4898
4936
4899
4937
4900
4938
4901
4939
4902
4940
4903
4941
4904
4942
4905
4943
4906
4944
4907
4945
4908
4946
4909
4947
4910
4948
4911
4949
4912
4950
4913
4951
4952
4915
4953
15875
4916
4954
4917
4955
4918
4956
4919
4957
4920
4958
4921
4959
4922
4960
4923
4961
4924
4962
4925
4963
4926
4964
4927
4965
4928
4966
4929
4967
4930
4968
4931
4969
4932
4970
4933
4971
4934
4972
4935
4973
4936
4974
4937
4975
4938
4976
4939
4977
4940
4978
4941
4979
4942
4980
4943
4981
4944
4982
4945
4983
4946
4984
4947
4985
4948
4986
4949
4987
4950
4988
4951
4989
4952
4990
4991
4954
4992
14496
4955
4993
4956
4994
4957
4995
4958
4996
4959
4997
4960
4998
4961
4999
4962
5000
4963
5001
4964
5002
4965
5003
4966
5004
4967
5005
4968
5006
4969
5007
4970
5008
4971
5009
4972
5010
4973
5011
4974
5012
4975
5013
4976
5014
4977
5015
4978
5016
4979
5017
4980
5018
4981
5019
4982
5020
4983
5021
4984
5022
4985
5023
4986
5024
4987
5025
4988
5026
4989
5027
4990
5028
4991
5029
5030
4993
5031
7707
4994
5032
4995
5033
4996
5034
4997
5035
4998
5036
4999
5037
5000
5038
5001
5039
5002
5040
5003
5041
5004
5042
5005
5043
5006
5044
5007
5045
5008
5046
5009
5047
5010
5048
5011
5049
5012
5050
5013
5051
5014
5052
5015
5053
5016
5054
5017
5055
5018
5056
5019
5057
5020
5058
5021
5059
5022
5060
5023
5061
5024
5062
5025
5063
5026
5064
5027
5065
5028
5066
5029
5067
5030
5068
5069
5032
5070
13333
5033
5071
5034
5072
5035
5073
5036
5074
5037
5075
5038
5076
5039
5077
5040
5078
5041
5079
5042
5080
5043
5081
5044
5082
5045
5083
5046
5084
5047
5085
5048
5086
5049
5087
5050
5088
5051
5089
5052
5090
5053
5091
5054
5092
5055
5093
5056
5094
5057
5095
5058
5096
5059
5097
5060
5098
5061
5099
5062
5100
5063
5101
5064
5102
5065
5103
5066
5104
5067
5105
5068
5106
5069
5107
5108
5071
5109
6551
5072
5110
5073
5111
5074
5112
5075
5113
5076
5114
5077
5115
5078
5116
5079
5117
5080
5118
5081
5119
5082
5120
5083
5121
5084
5122
5085
5123
5086
5124
5087
5125
5088
5126
5089
5127
5090
5128
5091
5129
5092
5130
5093
5131
5094
5132
5095
5133
5096
5134
5097
5135
5098
5136
5099
5137
5100
5138
5101
5139
5102
5140
5103
5141
5104
5142
5105
5143
5106
5144
5107
5145
5108
5146
5147
5110
5148
16143
5111
5149
5112
5150
5113
5151
5114
5152
5115
5153
5116
5154
5117
5155
5118
5156
5119
5157
5120
5158
5121
5159
5122
5160
5123
5161
5124
5162
5125
5163
5126
5164
5127
5165
5128
5166
5129
5167
5130
5168
5131
5169
5132
5170
5133
5171
5134
5172
5135
5173
5136
5174
5137
5175
5138
5176
5139
5177
5140
5178
5141
5179
5142
5180
5143
5181
5144
5182
5145
5183
5146
5184
5147
5185
5186
5149
5187
11030
5150
5188
5151
5189
5152
5190
5153
5191
5154
5192
5155
5193
5156
5194
5157
5195
5158
5196
5159
5197
5160
5198
5161
5199
5162
5200
5163
5201
5164
5202
5165
5203
5166
5204
5167
5205
5168
5206
5169
5207
5170
5208
5171
5209
5172
5210
5173
5211
5174
5212
5175
5213
5176
5214
5177
5215
5178
5216
5179
5217
5180
5218
5181
5219
5182
5220
5183
5221
5184
5222
5185
5223
5186
5224
5225
5188
5226
7738
5189
5227
5190
5228
5191
5229
5192
5230
5193
5231
5194
5232
5195
5233
5196
5234
5197
5235
5198
5236
5199
5237
5200
5238
5201
5239
5202
5240
5203
5241
5204
5242
5205
5243
5206
5244
5207
5245
5208
5246
5209
5247
5210
5248
5211
5249
5212
5250
5213
5251
5214
5252
5215
5253
5216
5254
5217
5255
5218
5256
5219
5257
5220
5258
5221
5259
5222
5260
5223
5261
5224
5262
5225
5263
5264
5227
5265
14553
5228
5266
5229
5267
5230
5268
5231
5269
5232
5270
5233
5271
5234
5272
5235
5273
5236
5274
5237
5275
5238
5276
5239
5277
5240
5278
5241
5279
5242
5280
5243
5281
5244
5282
5245
5283
5246
5284
5247
5285
5248
5286
5249
5287
5250
5288
5251
5289
5252
5290
5253
5291
5254
5292
5255
5293
5256
5294
5257
5295
5258
5296
5259
5297
5260
5298
5261
5299
5262
5300
5263
5301
5264
5302
5303
5266
5304
16481
5267
5305
5268
5306
5269
5307
5270
5308
5271
5309
5272
5310
5273
5311
5274
5312
5275
5313
5276
5314
5277
5315
5278
5316
5279
5317
5280
5318
5281
5319
5282
5320
5283
5321
5284
5322
5285
5323
5286
5324
5287
5325
5288
5326
5289
5327
5290
5328
5291
5329
5292
5330
5293
5331
5294
5332
5295
5333
5296
5334
5297
5335
5298
5336
5299
5337
5300
5338
5301
5339
5302
5340
5303
5341
5342
5305
5343
14277
5306
5344
5307
5345
5308
5346
5309
5347
5310
5348
5311
5349
5312
5350
5313
5351
5314
5352
5315
5353
5316
5354
5317
5355
5318
5356
5319
5357
5320
5358
5321
5359
5322
5360
5323
5361
5324
5362
5325
5363
5326
5364
5327
5365
5328
5366
5329
5367
5330
5368
5331
5369
5332
5370
5333
5371
5334
5372
5335
5373
5336
5374
5337
5375
5338
5376
5339
5377
5340
5378
5341
5379
5342
5380
5381
5344
5382
16480
5345
5383
5346
5384
5347
5385
5348
5386
5349
5387
5350
5388
5351
5389
5352
5390
5353
5391
5354
5392
5355
5393
5356
5394
5357
5395
5358
5396
5359
5397
5360
5398
5361
5399
5362
5400
5363
5401
5364
5402
5365
5403
5366
5404
5367
5405
5368
5406
5369
5407
5370
5408
5371
5409
5372
5410
5373
5411
5374
5412
5375
5413
5376
5414
5377
5415
5378
5416
5379
5417
5380
5418
5381
5419
5420
5383
5421
14554
5384
5422
5385
5423
5386
5424
5387
5425
5388
5426
5389
5427
5390
5428
5391
5429
5392
5430
5393
5431
5394
5432
5395
5433
5396
5434
5397
5435
5398
5436
5399
5437
5400
5438
5401
5439
5402
5440
5403
5441
5404
5442
5405
5443
5406
5444
5407
5445
5408
5446
5409
5447
5410
5448
5411
5449
5412
5450
5413
5451
5414
5452
5415
5453
5416
5454
5417
5455
5418
5456
5419
5457
5420
5458
5459
5422
5460
7739
5423
5461
5424
5462
5425
5463
5426
5464
5427
5465
5428
5466
5429
5467
5430
5468
5431
5469
5432
5470
5433
5471
5434
5472
5435
5473
5436
5474
5437
5475
5438
5476
5439
5477
5440
5478
5441
5479
5442
5480
5443
5481
5444
5482
5445
5483
5446
5484
5447
5485
5448
5486
5449
5487
5450
5488
5451
5489
5452
5490
5453
5491
5454
5492
5455
5493
5456
5494
5457
5495
5458
5496
5459
5497
5498
5461
5499
11031
5462
5500
5463
5501
5464
5502
5465
5503
5466
5504
5467
5505
5468
5506
5469
5507
5470
5508
5471
5509
5472
5510
5473
5511
5474
5512
5475
5513
5476
5514
5477
5515
5478
5516
5479
5517
5480
5518
5481
5519
5482
5520
5483
5521
5484
5522
5485
5523
5486
5524
5487
5525
5488
5526
5489
5527
5490
5528
5491
5529
5492
5530
5493
5531
5494
5532
5495
5533
5496
5534
5497
5535
5498
5536
5537
5500
5538
16144
5501
5539
5502
5540
5503
5541
5504
5542
5505
5543
5506
5544
5507
5545
5508
5546
5509
5547
5510
5548
5511
5549
5512
5550
5513
5551
5514
5552
5515
5553
5516
5554
5517
5555
5518
5556
5519
5557
5520
5558
5521
5559
5522
5560
5523
5561
5524
5562
5525
5563
5526
5564
5527
5565
5528
5566
5529
5567
5530
5568
5531
5569
5532
5570
5533
5571
5534
5572
5535
5573
5536
5574
5537
5575
5576
5539
5577
6552
5540
5578
5541
5579
5542
5580
5543
5581
5544
5582
5545
5583
5546
5584
5547
5585
5548
5586
5549
5587
5550
5588
5551
5589
5552
5590
5553
5591
5554
5592
5555
5593
5556
5594
5557
5595
5558
5596
5559
5597
5560
5598
5561
5599
5562
5600
5563
5601
5564
5602
5565
5603
5566
5604
5567
5605
5568
5606
5569
5607
5570
5608
5571
5609
5572
5610
5573
5611
5574
5612
5575
5613
5576
5614
5615
5578
5616
13334
5579
5617
5580
5618
5581
5619
5582
5620
5583
5621
5584
5622
5585
5623
5586
5624
5587
5625
5588
5626
5589
5627
5590
5628
5591
5629
5592
5630
5593
5631
5594
5632
5595
5633
5596
5634
5597
5635
5598
5636
5599
5637
5600
5638
5601
5639
5602
5640
5603
5641
5604
5642
5605
5643
5606
5644
5607
5645
5608
5646
5609
5647
5610
5648
5611
5649
5612
5650
5613
5651
5614
5652
5615
5653
5654
5617
5655
7708
5618
5656
5619
5657
5620
5658
5621
5659
5622
5660
5623
5661
5624
5662
5625
5663
5626
5664
5627
5665
5628
5666
5629
5667
5630
5668
5631
5669
5632
5670
5633
5671
5634
5672
5635
5673
5636
5674
5637
5675
5638
5676
5639
5677
5640
5678
5641
5679
5642
5680
5643
5681
5644
5682
5645
5683
5646
5684
5647
5685
5648
5686
5649
5687
5650
5688
5651
5689
5652
5690
5653
5691
5654
5692
5693
5656
5694
14495
5657
5695
5658
5696
5659
5697
5660
5698
5661
5699
5662
5700
5663
5701
5664
5702
5665
5703
5666
5704
5667
5705
5668
5706
5669
5707
5670
5708
5671
5709
5672
5710
5673
5711
5674
5712
5675
5713
5676
5714
5677
5715
5678
5716
5679
5717
5680
5718
5681
5719
5682
5720
5683
5721
5684
5722
5685
5723
5686
5724
5687
5725
5688
5726
5689
5727
5690
5728
5691
5729
5692
5730
5693
5731
5732
5695
5733
15876
5696
5734
5697
5735
5698
5736
5699
5737
5700
5738
5701
5739
5702
5740
5703
5741
5704
5742
5705
5743
5706
5744
5707
5745
5708
5746
5709
5747
5710
5748
5711
5749
5712
5750
5713
5751
5714
5752
5715
5753
5716
5754
5717
5755
5718
5756
5719
5757
5720
5758
5721
5759
5722
5760
5723
5761
5724
5762
5725
5763
5726
5764
5727
5765
5728
5766
5729
5767
5730
5768
5731
5769
5732
5770
5771
5734
5772
13561
5735
5773
5736
5774
5737
5775
5738
5776
5739
5777
5740
5778
5741
5779
5742
5780
5743
5781
5744
5782
5745
5783
5746
5784
5747
5785
5748
5786
5749
5787
5750
5788
5751
5789
5752
5790
5753
5791
5754
5792
5755
5793
5756
5794
5757
5795
5758
5796
5759
5797
5760
5798
5761
5799
5762
5800
5763
5801
5764
5802
5765
5803
5766
5804
5767
5805
5768
5806
5769
5807
5770
5808
5771
5809
5810
5773
5811
13400
5774
5812
5775
5813
5776
5814
5777
5815
5778
5816
5779
5817
5780
5818
5781
5819
5782
5820
5783
5821
5784
5822
5785
5823
5786
5824
5787
5825
5788
5826
5789
5827
5790
5828
5791
5829
5792
5830
5793
5831
5794
5832
5795
5833
5796
5834
5797
5835
5798
5836
5799
5837
5800
5838
5801
5839
5802
5840
5803
5841
5804
5842
5805
5843
5806
5844
5807
5845
5808
5846
5809
5847
5810
5848
5849
5812
5850
11002
5813
5851
5814
5852
5815
5853
5816
5854
5817
5855
5818
5856
5819
5857
5820
5858
5821
5859
5822
5860
5823
5861
5824
5862
5825
5863
5826
5864
5827
5865
5828
5866
5829
5867
5830
5868
5831
5869
5832
5870
5833
5871
5834
5872
5835
5873
5836
5874
5837
5875
5838
5876
5839
5877
5840
5878
5841
5879
5842
5880
5843
5881
5844
5882
5845
5883
5846
5884
5847
5885
5848
5886
5849
5887
5888
5851
5889
13636
5852
5890
5853
5891
5854
5892
5855
5893
5856
5894
5857
5895
5858
5896
5859
5897
5860
5898
5861
5899
5862
5900
5863
5901
5864
5902
5865
5903
5866
5904
5867
5905
5868
5906
5869
5907
5870
5908
5871
5909
5872
5910
5873
5911
5874
5912
5875
5913
5876
5914
5877
5915
5878
5916
5879
5917
5880
5918
5881
5919
5882
5920
5883
5921
5884
5922
5885
5923
5886
5924
5887
5925
5888
5926
5927
5890
5928
12125
5891
5929
5892
5930
5893
5931
5894
5932
5895
5933
5896
5934
5897
5935
5898
5936
5899
5937
5900
5938
5901
5939
5902
5940
5903
5941
5904
5942
5905
5943
5906
5944
5907
5945
5908
5946
5909
5947
5910
5948
5911
5949
5912
5950
5913
5951
5914
5952
5915
5953
5916
5954
5917
5955
5918
5956
5919
5957
5920
5958
5921
5959
5922
5960
5923
5961
5924
5962
5925
5963
5926
5964
5927
5965
5966
5929
5967
15390
5930
5968
5931
5969
5932
5970
5933
5971
5934
5972
5935
5973
5936
5974
5937
5975
5938
5976
5939
5977
5940
5978
5941
5979
5942
5980
5943
5981
5944
5982
5945
5983
5946
5984
5947
5985
5948
5986
5949
5987
5950
5988
5951
5989
5952
5990
5953
5991
5954
5992
5955
5993
5956
5994
5957
5995
5958
5996
5959
5997
5960
5998
5961
5999
5962
6000
5963
6001
5964
6002
5965
6003
5966
6004
6005
5968
6006
9015
5969
6007
5970
6008
5971
6009
5972
6010
5973
6011
5974
6012
5975
6013
5976
6014
5977
6015
5978
6016
5979
6017
5980
6018
5981
6019
5982
6020
5983
6021
5984
6022
5985
6023
5986
6024
5987
6025
5988
6026
5989
6027
5990
6028
5991
6029
5992
6030
5993
6031
5994
6032
5995
6033
5996
6034
5997
6035
5998
6036
5999
6037
6000
6038
6001
6039
6002
6040
6003
6041
6004
6042
6005
6043
6044
6007
6045
15906
6008
6046
6009
6047
6010
6048
6011
6049
6012
6050
6013
6051
6014
6052
6015
6053
6016
6054
6017
6055
6018
6056
6019
6057
6020
6058
6021
6059
6022
6060
6023
6061
6024
6062
6025
6063
6026
6064
6027
6065
6028
6066
6029
6067
6030
6068
6031
6069
6032
6070
6033
6071
6034
6072
6035
6073
6036
6074
6037
6075
6038
6076
6039
6077
6040
6078
6041
6079
6042
6080
6043
6081
6044
6082
6083
6046
12370
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6486
7034
18002
6177
14102
16602
6104
9504
14069
6105
9503
14070
6090
6774
9547
6091
6773
9546
8907
11979
8906
11978
6115
13078
17933
6116
13079
17934
6111
6795
17271
6112
6796
17270
6121
7860
15905
6122
7859
15904
6117
9983
15543
6118
9984
15544
6125
11933
15221
6126
11934
15222
6110
9936
9962
6109
9935
9961
8027
13276
8026
13275
6130
9155
16195
6131
9156
16196
6129
7550
11774
6917
15601
6916
15602
12041
12769
12042
12770
6166
12840
17037
6167
12841
17036
6295
10921
6296
10920
7815
15835
7816
15836
6160
8887
14178
6161
8888
14177
8698
12378
8699
12377
6138
7168
12881
6139
7169
12880
11093
17241
11094
17242
6207
10281
18099
6208
10280
18100
6981
8447
13154
13155
6134
7429
8882
6135
7430
8883
11405
14897
11406
14896
6186
12878
13670
6185
12877
13671
6190
8866
6189
8865
6191
9003
17197
6192
9002
17198
6152
6480
9482
6153
6481
9483
6193
10871
14574
6194
10872
14575
6385
9880
16110
6386
9881
16111
6181
6684
8561
6180
6683
8562
6262
9383
13156
6263
9382
13157
6183
17800
6184
17799
6164
12878
15918
6165
12877
15919
6358
8967
11057
6359
8966
11058
6171
6621
7795
6172
6622
7794
6893
9198
6894
9197
6724
15276
17163
6725
15277
17164
10347
18279
10348
18278
12039
15212
12040
15211
6178
8458
14966
6179
8457
14967
6285
6613
11135
10711
13048
10710
13047
6388
10612
14344
6387
10611
14343
6183
8659
16113
6184
8660
16112
6420
17889
12184
14626
12183
14625
8326
9674
8325
9675
6405
6617
12950
14787
14788
6829
14237
6830
14236
6189
10929
13109
6190
10930
13110
10696
10695
8258
9657
8257
9658
6216
13445
6217
13446
6977
13402
17705
6978
13403
17704
7003
9263
15465
7004
9262
15466
6238
9542
14233
6239
9543
14234
6308
6497
11384
6309
6498
11385
6269
8917
6270
8918
7095
7221
9922
7096
7220
9923
7106
18103
7107
18104
6342
9228
14985
6240
9686
14299
6241
9685
14298
6318
13625
14874
6457
8654
9226
6458
8653
9227
6648
7818
13384
6429
11975
6430
11976
6259
8360
15599
6260
8359
15600
6632
7585
8031
6716
8499
17219
6717
8500
17220
6472
10491
14548
6473
10492
14549
6370
7316
14402
6371
7315
14403
6332
6389
11191
6333
6390
11190
6854
8970
14072
6855
8971
14073
6408
8229
14618
6409
8230
14619
6652
8653
10186
6651
8654
10187
6410
7801
10790
6579
8170
14667
6580
8171
14668
6748
9658
6749
9657
9931
10041
9930
10042
6399
8487
13606
6902
7154
9059
6903
7153
9060
6415
7009
10534
6416
7010
10535
7942
9835
10006
7943
9836
10007
6306
8852
16485
6305
8853
16484
6959
7431
10783
6264
8941
15421
6265
8940
15420
6702
9318
14581
6703
9317
14580
8982
17579
18428
6353
7210
8316
6354
7209
8317
7552
15189
7553
15190
6828
8629
10892
13168
16001
13169
16000
9309
12067
9310
12066
6700
7528
17376
6707
6825
9959
6708
6826
9960
8914
12374
8913
12373
6525
12925
13583
6407
9702
9743
6897
6965
7373
6898
6966
7374
6428
11802
6504
12615
13004
6505
12614
13005
6286
6334
13378
6287
6335
13379
6442
6655
10681
6443
6656
10682
6662
7877
12866
6663
7878
12867
6797
10431
12664
8223
14037
7512
14424
7513
14425
6560
10718
12810
6561
10719
12811
6635
12706
17106
7560
7752
7979
7561
7753
7980
6362
9637
10991
6506
12787
14331
7155
11217
7156
11216
6754
8990
11448
6755
8991
11449
6722
9804
15610
6723
9805
15611
6623
7287
18393
6468
6674
7666
6469
6673
7667
6587
11999
13689
6614
16852
6615
16851
6628
7288
18394
6748
12058
6749
12059
6565
7832
12987
6566
7833
12986
6761
7529
13321
6762
7530
13322
6940
7419
10241
6941
7420
10242
6417
7360
15459
6418
7361
15460
6730
13616
7168
8801
10461
7169
8802
10462
6542
11438
15507
6543
11437
15506
6392
12702
15014
6391
12701
15015
8492
8767
18358
8493
8766
18363
6649
7517
8932
6650
7516
8931
6461
6649
7032
6460
6650
7033
6818
11379
18072
6844
10593
6845
10592
6396
15258
6395
15259
6547
8791
14740
6548
8790
14741
7070
7346
10551
7069
7345
10550
7375
8357
12104
7376
8358
12105
7775
11945
6620
8450
9521
6438
11196
12571
6439
11195
12572
6718
12012
12809
6411
6863
7001
6412
6864
7002
7189
7362
12515
7190
7363
12516
6804
8409
11269
6805
8410
11270
6844
13442
6845
13443
7173
8923
6768
8391
8669
6769
8392
8668
7891
18353
7892
18352
6462
10012
11329
6463
10013
11330
8789
6544
6904
8553
6638
11325
11658
6731
7672
14169
6526
7240
11419
6527
7241
11420
6514
10629
12385
6515
10628
12384
7012
17816
7013
17817
6455
6989
7277
6456
6990
7278
6403
9758
10627
6404
9757
10626
6926
8143
9834
6579
11792
12378
6580
11791
12377
6537
7843
12535
6740
13549
13779
6741
13548
13780
6698
7906
9715
6699
7907
9716
7006
8628
16183
8165
10274
8164
10275
12748
17925
12749
17926
7071
17538
7072
17537
9969
12632
9968
12633
6787
7347
10343
6788
7348
10342
7443
8058
7444
8057
6728
9353
13109
6729
9354
13110
9292
13045
6554
9197
15320
6555
9198
15319
8336
8438
12352
13894
12351
13893
8224
13170
6955
7687
7922
9621
17724
6882
15313
6883
15314
8952
9591
6556
10555
6557
10554
6470
6681
10876
6471
6682
10875
7998
14621
7999
14620
12982
17640
12983
17641
7040
8369
8370
7136
16316
6777
7875
10761
6776
7876
10762
6982
8627
12520
6721
7677
8601
6720
7678
8600
7060
9688
11173
7061
9687
11174
7293
9766
11265
17332
11264
17331
6924
6988
15753
6925
6987
15752
6529
6683
8625
6528
6684
8626
6667
7187
15675
6666
7188
15676
6841
8803
12705
9860
14915
9861
14916
6726
9961
13119
6727
9962
13118
6603
15387
6604
15388
6592
7681
10943
6593
7682
10942
6739
9621
18331
6806
8328
8901
6807
8329
8900
7099
8124
15065
6839
9333
15488
6840
9334
15489
7102
8129
15064
6736
10705
11932
6737
10706
11931
7912
11038
7913
11039
6951
12888
6950
12889
8867
10544
11682
7023
8915
7031
8916
9428
12741
9427
12740
7191
9603
7192
9602
6504
6950
7578
6505
6951
7579
8970
11058
8971
11057
6487
12825
6488
12824
10212
11424
10211
11425
6652
6950
11982
6651
6951
11983
8108
10166
12909
8107
10167
12910
7014
9622
11929
7015
9623
11930
6714
11622
6713
11623
7867
7947
10328
7868
7948
10327
6756
9283
11607
6757
9282
11606
6564
15900
13232
13647
13231
13646
6724
7149
16558
6725
7150
16559
6800
12230
15418
6799
12231
15419
7703
8063
8411
7704
8062
8412
7062
7160
14749
7063
7159
14748
11638
16798
11639
16797
6616
7041
11924
6540
6568
13385
6541
6569
13386
7410
8602
10481
7409
8603
10482
16085
16086
6931
10341
6945
9415
14021
6944
9414
14022
6673
9594
14973
6674
9595
14972
6739
7065
8276
6971
11516
16239
6972
11517
16240
9202
13923
9201
13922
8819
10950
17320
7202
7222
9763
7203
7223
9762
6939
10138
10237
6938
10139
10236
7514
9351
13243
7515
9352
13242
7067
9653
14685
7068
9654
14686
10825
14241
8135
10120
8136
10121
7741
9169
7740
9170
7124
16486
16707
7166
11061
14923
7167
11062
14924
7437
13087
14149
7438
13088
14148
6821
13132
13745
6822
13131
13744
9258
17268
6677
9392
12647
6678
9393
12648
6942
9304
6943
9305
7872
14600
7871
14601
7261
14561
8594
8870
16394
8595
8871
16393
7615
18185
7614
18186
6713
14788
15782
6714
14787
15781
6670
10294
6671
10295
6959
15870
16392
12557
17769
12558
17768
12200
14043
12201
14044
6618
9302
9850
6619
9303
9851
9589
15199
9590
15200
7065
8025
16456
7404
7723
10421
7305
16745
12064
15925
12065
15924
7425
7724
10380
6867
7685
6868
7686
6613
7477
17188
6675
7315
8017
6676
7316
8016
6617
7486
17183
6886
7023
13427
6899
9427
18035
6900
9428
18034
6887
7031
13430
6906
7624
13877
7014
7015
7029
11518
12432
7030
11519
12431
6664
8724
10618
6665
8723
10617
7073
8771
11077
7074
8772
11078
7066
14675
6627
11913
16140
6626
11912
16139
6711
8498
10216
6712
8497
10215
10097
13041
10098
13042
6655
7083
10508
6656
7084
10509
6993
7970
11679
6994
7969
11678
7469
8210
8654
7470
8211
8653
6867
13026
13717
6868
13025
13716
7225
12607
13346
9804
10506
9805
10507
6985
10270
6986
12074
6658
10198
13660
6659
10199
13659
6890
7042
17967
6891
7043
17968
6654
10436
17144
6653
10435
17145
18161
6974
13358
6973
13357
11074
15821
18160
6703
9596
6702
9597
6798
8205
6706
8883
6705
8882
8129
11241
6791
6865
18039
6792
6866
18040
7570
18319
7569
18318
8124
11242
6969
10621
12788
6970
10622
12789
6798
7381
8515
10610
17727
6885
7275
9833
6884
7276
9832
9952
12942
7072
9664
13511
7071
9665
13510
8343
8583
7211
9713
13658
7212
9714
13657
7583
7688
15426
7584
7689
15427
6871
10508
15610
6872
10509
15611
7226
11035
15469
7227
11034
15470
6827
9591
17604
10636
15080
6908
6907
10307
10306
10985
16702
10986
16701
15610
15611
7011
8214
8731
10153
11189
10154
11188
7403
7656
14813
7402
7657
14812
10948
17072
10949
17073
7008
8162
7007
8163
6984
14417
6983
14416
7750
10076
15938
7751
10077
15939
7936
16143
7937
16144
7135
7411
12388
10015
10014
7097
12526
7098
12525
13769
17473
13770
17474
6946
8382
17215
6947
8383
17216
11644
12806
11643
12805
7355
7356
6709
10354
13920
6710
10355
13921
7252
10820
10879
7253
10819
10880
6815
7499
8038
6814
7500
8039
6744
8223
15007
6990
9612
15885
6989
9611
15884
6763
8224
14903
6901
8463
14537
7086
11790
12278
7085
11789
12279
6863
12200
6864
12201
7090
12221
7291
9980
10763
15958
15957
6770
7028
12837
7519
8283
7520
8284
11630
13864
11631
13863
9099
9100
11570
13540
11569
13539
11220
11221
7124
8476
9270
11690
16040
11691
16041
11287
12574
7039
12119
12837
8199
8630
8200
8631
14484
15623
14485
15624
11834
11835
11457
16861
11456
16860
8119
15955
8118
15954
7105
13547
11104
11658
7087
15303
17544
7088
15304
17545
7247
11440
11573
7248
11439
11574
11455
12277
11454
12276
7034
8240
13447
7224
13266
14505
13267
14504
7533
12785
15965
7534
12786
15966
10909
14704
7028
8672
10561
7041
9073
17026
7329
10229
13470
9002
9003
7232
8765
11888
7233
8764
11889
7918
7967
8181
7919
7968
8180
6997
7353
6998
7354
9314
16064
9313
16065
7008
8381
14571
7007
8380
14572
9950
17481
17572
9033
10035
9034
10034
11359
14675
8716
9128
11236
8715
9127
11237
6791
6900
9826
6792
6899
9827
12839
16306
12838
16307
8373
12232
7200
9445
15268
7201
9446
15269
7973
17696
7974
17697
9914
12062
12664
7616
12030
7617
12031
7317
7754
9701
7051
7101
7498
7050
7100
7497
7216
7541
12474
7217
7542
12473
7386
8014
15291
7387
8015
15292
7436
7781
17340
7435
7782
17341
7520
11154
7519
11153
6848
8520
10883
6849
8521
10884
18156
18157
6852
13310
14968
6853
13311
14969
12926
15878
12927
15879
13241
14691
12463
14948
15000
14947
14999
7580
8266
10157
6984
7491
12656
6983
7492
12655
7610
8711
7611
8712
9224
9488
9225
9489
7093
11301
14921
7094
11302
14922
6812
10531
6813
10530
11279
17851
11278
17852
8419
9158
8420
9157
7137
10475
10476
7138
10474
10477
8143
8798
6961
8110
13534
6962
8109
13533
6965
16388
6966
16389
8054
8263
10659
8055
8264
10658
7325
11787
7326
11786
8663
9466
9388
13756
9847
14250
9846
14249
7185
11897
15394
7186
11898
15393
6877
8187
8742
6878
8188
8743
7799
7864
8605
7800
7863
8604
8623
8750
8624
8749
9479
12442
9480
12443
12616
14154
7129
12186
12612
7130
12185
12613
17370
17371
7056
8639
13343
7057
8638
13342
12018
12461
12019
12462
7484
12262
17191
7485
12263
17192
10487
13175
10488
13176
14642
16445
14641
16446
7254
7320
10200
7174
11165
14953
7175
11166
14954
6975
7834
11618
7411
13369
14711
7082
7147
10788
7081
7148
10789
8272
8273
8769
8908
8770
8909
16166
16167
7840
11033
7839
11032
10020
14167
10021
14168
7508
7881
13287
7509
7882
13286
7631
9092
17303
7630
9089
17304
9338
17458
9339
17459
7120
8123
11858
7562
8488
12525
7563
8489
12526
7755
7959
7756
7960
7016
17052
7017
17051
7417
8326
7418
8325
6997
8036
8891
6998
8037
8892
10106
11142
10107
11143
8126
8496
16229
7330
15319
7331
15320
7435
8268
15872
7436
8269
15873
7938
11548
7939
11549
12532
12531
13852
14123
8127
13607
8128
13608
11041
15516
8912
11240
13902
8553
8789
7069
14491
7070
14492
7608
7640
9340
7609
7641
9341
7092
7814
17439
7848
8758
15187
7849
8759
15188
7815
9335
10881
7816
9336
10882
8535
13370
8536
13371
7790
9753
7791
9752
7046
13230
14582
7047
13229
14583
7409
13157
13202
7410
13156
13201
8137
17422
8138
17421
9301
18001
7057
7456
7535
7056
7457
7536
7213
12336
7108
16454
17269
11231
14098
8183
9083
11847
8182
9084
11848
6991
11407
15569
6992
11408
15568
7483
10984
13830
6954
10970
11271
12037
15974
12036
15975
8174
12442
8175
12443
8852
13026
8853
13025
8226
9295
8225
9296
11028
18374
11029
18373
7475
10740
15555
7476
10739
15556
8000
8738
10127
8001
8739
10128
10473
14658
7432
15679
7204
8535
17001
7205
8536
17002
7597
11959
9138
8139
13661
17228
8838
15949
8839
15948
7294
8064
14527
7295
8065
14528
12381
12382
7588
7887
15523
7589
7888
15522
11011
16548
11012
16549
7736
13609
7737
13610
9304
12907
9305
12906
10200
13933
7765
8265
9787
9813
18407
9814
18408
8490
9112
14611
8491
9113
14612
13471
18131
7066
15613
13225
13226
9355
16106
9356
16107
14239
15054
14238
15053
13989
13990
8589
12097
8590
12098
10411
17192
10410
17191
7180
10304
14132
7181
10305
14133
9397
9398
7058
13479
7059
13478
7644
8282
7645
8281
8974
14283
8975
14282
7503
9058
11493
12305
15607
8332
8333
11676
15743
11677
15744
12016
16631
7422
11790
7421
11789
7427
7428
12701
13164
12702
13165
7493
12224
15983
7494
12225
15984
7654
11896
14661
7655
11895
14662
8397
10351
15849
8440
7053
7455
18008
7153
9550
17012
7154
9549
17011
8402
10360
15846
12991
10507
15309
10506
15308
8439
14338
14492
14339
14491
18303
7364
8346
9462
7365
8347
9463
7194
10759
13804
7195
10760
13803
9182
12991
8666
8667
16819
9207
13588
9208
13589
7541
10685
11515
7542
10686
11514
9903
14698
9904
14699
7478
11349
11524
7479
11350
11525
7079
14907
7080
14908
7664
8161
14023
8112
11712
7606
7973
12168
7607
7974
12167
9494
9493
7721
10868
7722
10867
7433
10329
7434
10330
9738
15024
9737
15023
7163
13615
17184
17891
17523
12898
13881
12899
13882
9728
9729
13442
13443
9359
9997
9360
9998
7625
12779
13896
7626
12780
13897
7161
15171
15672
7162
15170
15673
13275
16482
13276
16483
8980
17175
8981
17176
10987
13081
10988
13082
8154
12065
8153
12064
8185
14115
8186
14116
8140
11092
15612
10277
12661
10276
11996
12662
11434
15016
7770
11633
7771
11634
11007
13186
11008
13185
7421
7563
7422
7562
9316
15007
10684
11679
10683
11678
9315
14903
7821
9145
7820
9146
9877
14577
10948
12085
10949
12084
8030
16865
7811
13174
16466
7812
13173
16467
7602
9028
9972
7603
9029
9971
7794
9613
14921
7795
9614
14922
8155
9148
16159
8156
9149
16160
7366
7634
15726
7367
7635
15727
7585
9459
15360
11445
16724
7372
12812
13688
8189
8615
15840
8190
8614
15839
8810
7176
7512
8191
7177
7513
8192
7668
10213
16021
7669
10214
16022
8298
14111
8299
14112
7504
7792
16909
7505
7793
16908
7511
16317
16747
7510
16318
16746
7523
10587
12070
15395
9627
17045
9628
17046
7243
12566
15263
7244
12567
15264
7255
10537
11609
7256
10536
11608
7427
8698
12562
7428
8699
12561
7622
8567
13286
7623
8568
13287
7934
8843
7935
8842
9189
9428
9190
9427
8173
10094
8172
10095
9908
9909
7660
11875
7661
11876
7306
10193
13514
7307
10194
13513
8549
15283
8550
15284
11544
14720
11545
14719
8125
16076
8046
10123
11809
8045
10122
11810
9259
14030
9260
14031
13187
13188
7843
10137
12131
7502
7554
16916
7501
7555
16917
13080
15409
13360
14699
13359
14698
7444
11496
7443
11495
7714
10487
12913
7715
10488
12914
9035
14435
9036
14436
8139
9391
13071
7343
8563
9282
7344
8564
9283
10318
13508
10319
13509
9611
13425
9612
13426
7233
7232
10198
15860
10199
15859
7302
13206
14128
13786
15999
13785
15998
7899
8450
9367
7482
11605
13045
7646
8002
9992
7647
8003
9993
7443
16334
7444
16333
9404
17042
9405
17041
15331
15534
15330
15535
7249
7754
18011
7602
13954
14692
7603
13953
14693
9097
18155
9098
18154
8071
14011
8072
14012
9117
16611
7567
10847
12764
7568
10846
12763
13225
14416
13226
14417
8096
10941
16364
8097
10940
16365
11386
12272
11387
12273
9069
9406
9070
9407
7242
10174
13811
16684
12782
15760
12781
15759
10207
10260
10208
10254
7280
13633
17744
7281
13634
17745
8318
9525
12568
8319
9524
12569
8588
9588
16162
7262
10276
10303
7263
10277
10302
7378
10177
10606
7287
18173
7288
18174
8939
18384
11114
14962
11115
14961
7911
11042
7910
11043
8984
11981
8983
11980
8111
12096
7857
10569
16422
7858
10568
16423
7576
12921
7577
12922
8512
8952
9898
11097
9899
11098
7342
11689
13010
8160
8757
13189
10403
12338
13391
10404
12339
13392
12001
15942
7319
18223
7318
7528
7338
8955
9220
7337
8956
9221
7359
11074
16305
8238
10377
8239
10378
7726
11224
15858
7725
11225
15857
7932
8328
11997
7933
8329
11998
7466
10414
15816
7467
10415
15815
12633
16809
12632
16808
10615
15118
10616
15119
9661
10259
11111
7412
15534
7413
15535
7926
8981
12311
7927
8980
12310
7308
10018
13546
7309
10019
13545
7518
12870
18387
18388
7574
9784
12127
7575
9785
12128
14541
16963
9565
10301
11434
17284
12425
12426
7850
10722
11825
7851
10723
11824
8073
11091
7785
7841
15088
7786
7842
15087
9051
13567
13869
13568
13870
8201
8631
10399
8202
8630
10400
10891
15561
11112
15698
11113
15697
9806
10717
9807
10716
7612
12327
16192
7613
12326
16191
7813
8030
8280
7487
11227
16728
7488
11226
16729
8597
8596
11135
18161
8118
15954
8119
15955
8184
16238
7780
8301
12240
7779
8300
12241
7735
9900
14698
7734
9901
14699
9703
10485
9704
10486
8217
10940
14204
8218
10941
14205
7551
18130
8661
16227
8662
16228
7592
9661
11340
8086
11067
11690
8087
11068
11691
7817
9531
13816
7743
11322
11966
8114
11368
8115
11369
7385
8069
12929
7384
8070
12928
7407
15152
16631
7854
17206
8834
9889
8835
9888
8183
10743
8182
10744
7351
8284
7352
8283
8446
9319
11168
8447
9320
11167
7382
11902
7383
11901
7650
15062
7651
15063
7648
8266
7649
8265
8008
8243
8896
8009
8244
8897
15763
16263
16145
16441
16146
16442
14663
15786
14664
15787
7388
7809
7389
7810
9561
18089
9562
18090
7981
14388
15887
7982
14387
15888
7640
8777
17526
7641
8778
17525
8693
18031
10391
13861
10392
13862
12647
15835
12648
15836
8627
9468
9548
10765
13748
7675
10776
17493
7676
10775
17494
7904
11635
10644
11116
10643
11117
7990
13352
7991
13351
10513
16308
10514
16309
7683
13550
7684
13551
7564
10434
13839
8085
9124
11750
8455
8579
12104
8456
8580
12105
7446
8933
16193
7447
8934
16194
8519
9515
14157
8518
9516
14158
8337
9479
14596
8338
9480
14597
8764
9883
14550
8765
9884
14551
7940
15411
7941
15410
8944
10323
8486
8510
9409
8485
8511
9408
10954
17410
7415
12630
13203
15740
15741
12300
7914
17001
7915
17002
7687
9129
16328
8667
18285
8285
8666
18286
8915
9674
8916
9675
8557
9667
8558
9668
9690
9689
8016
14870
16446
8017
14869
16445
8957
10324
7801
8522
13460
12378
12377
7770
10170
7771
10171
8874
15454
11617
12879
8247
9460
8248
9461
7848
7849
8469
15927
8441
15926
7473
8323
13220
7474
8324
13219
8078
9538
17282
8079
9539
17283
7592
7729
13203
8887
11663
8888
11664
7885
10650
13660
7886
10649
13659
7535
9858
10344
7536
9859
10345
7596
8280
18214
8442
9290
9306
8443
9291
9307
7696
17661
8864
12919
8863
12920
8634
12538
13484
8635
12539
13485
7461
9970
15756
10763
17457
8648
10197
10299
8649
10196
10298
7495
8615
9678
7496
8614
9679
10817
12298
10818
12299
8373
8505
13699
9226
16297
9227
16298
8049
12709
14863
8050
12710
14864
8197
11913
8198
11912
14736
14911
14737
14912
18359
18380
8185
17389
8186
17390
8077
8398
9719
8076
8399
9718
9181
11985
7629
15651
9031
12032
9032
12033
18357
18381
10293
16750
10292
16751
7954
10381
11933
7955
10382
11934
14209
16900
14210
16901
14774
16514
14775
16515
9405
9407
9404
9406
7824
8277
7825
8278
7895
8246
7896
8245
7524
17237
7525
17238
7819
8148
11805
14512
11806
14513
7837
8637
9923
7838
8636
9922
9907
10828
9906
10829
8779
10914
8780
10915
17467
17468
12406
13147
12407
13146
8246
9556
8245
9557
10606
13638
13737
13738
9161
9750
14233
9162
9751
14234
7905
12038
9533
14536
9532
14535
7861
11220
17516
7862
11221
17515
10724
8302
14265
8303
14266
7600
11970
16880
7601
11971
16879
13321
13881
13322
13882
8022
8023
7576
11899
16580
7577
11900
16579
7685
16029
17363
7686
16030
17362
12331
12330
7983
11444
7925
11466
8071
9009
10020
8072
9010
10021
8700
9008
15987
8057
12803
17133
8058
12804
17134
9238
12360
9239
12359
8141
8710
8142
8709
14294
15542
14295
15541
7763
14628
16042
7764
14629
16043
8380
10802
13632
8381
10834
13631
13801
15794
13802
15795
8412
8411
11231
13120
9619
10689
13214
9620
10690
13215
8637
16131
8636
16130
10136
12959
10135
12960
7776
9798
17148
7777
9799
17149
8100
13932
11462
13087
11463
13088
16372
16371
15130
16776
15131
16775
8783
11040
7844
8366
14030
7845
8365
14031
9451
9795
9452
9796
9228
7608
8843
9413
7609
8842
9412
9151
10262
9150
10261
8168
8174
10418
8169
8175
10419
12630
7826
8355
18261
7827
8356
18262
7693
10891
16392
9292
10195
10173
15930
8363
12921
14366
8364
12922
14367
10056
15367
10057
15366
11490
11489
8135
10619
15757
8136
10620
15758
11413
18009
11412
18010
10393
10394
11671
16325
11670
16324
15272
16697
15271
16696
8820
15302
8821
15301
14063
15172
14064
15173
11105
11498
13917
11106
11497
13916
7984
9844
10501
7985
9845
10502
10206
11812
10205
11811
16881
9130
12973
9131
12974
7794
9968
15014
7795
9969
15015
10058
18046
13027
16417
12468
16700
11648
12887
13913
11649
12886
13594
8953
10365
8954
10366
8559
9041
16001
8560
9042
16000
8589
11766
16600
8590
11767
16601
15866
15867
8249
8953
11962
8250
8954
11963
7697
16199
7698
16200
8868
12961
8869
12962
8562
8783
8561
8784
9433
13053
9434
13054
8334
11562
16002
8335
11563
16003
8472
9018
8473
9017
9299
11561
9300
11560
8180
12548
16158
8181
12549
16157
7806
8898
7807
8899
8824
10549
12149
8825
10548
12150
9308
14103
8354
8893
18198
8966
12775
8967
12776
10463
13759
10464
13760
8483
9892
15653
8484
9893
15654
11772
17078
8298
9900
13038
8299
9901
13037
10349
15491
10350
15490
15707
16214
15706
16215
7951
9671
11201
7944
9278
10767
7727
17008
7728
17007
10901
13423
10900
13424
17547
17546
15889
13775
15089
13776
15090
8137
9085
17769
8138
9086
17768
7958
9279
10873
15017
15246
8960
10003
15625
8961
10002
15626
8279
10983
11160
16598
11161
16599
7871
8034
11299
7872
8035
11298
7952
10885
14056
7953
10886
14057
8516
9441
8517
9440
8391
9216
13247
8392
9217
13246
8131
11776
8132
11775
8487
10598
15082
7804
8157
9578
7805
8158
9579
8255
8427
11349
8256
8428
11350
10793
14946
10794
14945
8206
8312
17896
8207
8313
17897
8008
8598
8847
8009
8599
8846
8655
9743
13480
10221
10457
10222
10458
8165
15083
8164
15084
7857
10894
7858
10893
8423
12804
8424
12803
13206
14906
8105
11226
12660
8106
11227
12659
7746
11275
12444
7747
11274
12445
8623
10425
8624
10426
9049
14445
9050
14446
9087
9252
9088
9253
7971
13577
7972
13576
8388
11584
15398
9063
17137
9522
9563
17480
9523
9564
17479
11424
13142
11425
13141
7959
9128
13325
7960
9127
13326
9595
12334
9594
12335
9896
11624
9897
11625
17668
8716
9106
8715
9107
7758
8126
9694
9289
14002
8554
9998
12181
8555
9997
12182
7828
13389
13922
7829
13390
13923
10637
10749
10638
10750
8784
10320
8083
8947
12521
8084
8948
12522
8099
8144
13055
8098
8145
13056
9613
9614
9454
10105
10848
9453
10104
10849
8443
9021
18419
8031
10913
8163
15957
8162
15958
12706
16184
18237
11184
14409
11185
14408
13090
14522
13091
14523
8474
8550
11652
8475
8549
11653
8857
17233
8858
17234
8241
11362
18186
8242
11363
18185
8522
11866
14595
10151
14987
10150
14986
13101
17297
13102
17298
7808
10704
11862
8010
10658
18266
8011
10659
18265
8670
11508
8671
11507
8512
8116
11133
13184
8117
11134
13183
8525
16902
8526
16903
10921
11262
10920
11263
13467
15814
8604
10309
8605
10308
13695
13799
13694
13800
9636
13583
13830
15703
13353
13354
9761
11192
8464
9116
9082
13761
9759
10101
9760
10102
8320
10090
15468
8321
10091
15467
8958
12263
8959
12262
11890
17392
11891
17391
11060
12586
11059
12585
8787
10039
15779
8788
10038
15780
8153
10458
8154
10457
8512
14595
8257
8600
9179
8258
8601
9180
11447
16131
11446
16130
10304
14578
10305
14579
15588
17358
15589
17359
13283
14355
16004
14354
16005
9159
9878
10311
9160
9879
10312
11545
11544
12213
12781
12214
12782
7969
14341
17108
7970
14342
17109
10255
11698
8270
8573
14067
8271
8574
14068
10524
10525
15642
16630
15641
16629
10602
16723
10601
16722
8346
14096
8347
14097
7975
9651
15274
7976
9652
15273
14127
15997
14126
15996
7996
9566
13431
7997
9567
13432
18128
18129
8101
13299
14694
8102
13300
14695
8763
15609
8762
15608
16992
18103
16993
18104
8809
13059
15689
8808
13058
15688
8109
18122
8110
18121
8090
9831
13134
8091
9830
13133
10153
10371
10154
10372
9103
10228
9104
10227
8985
12487
16726
8986
12486
16727
8407
14872
8408
14871
8403
10456
10655
8404
10455
10654
7977
9157
7978
9158
8861
10409
11302
8862
10408
11301
9045
10675
8616
12315
17867
8617
12316
17868
8702
9191
14509
8082
9606
10850
8693
10605
13216
15091
14705
17291
14706
17292
8032
8877
12384
8033
8878
12385
10386
16084
10387
16083
9026
16639
9027
16640
11703
17315
11704
17316
8592
9033
9141
8593
9034
9142
10251
12226
10250
12227
9329
11052
13274
9330
11051
13273
13212
15398
7945
13205
14304
7946
13204
14305
9967
16653
11917
15124
11916
15123
8281
12920
16351
8282
12919
16350
8620
13412
13501
8621
13411
13502
8316
13442
8317
13443
10282
16045
10283
16046
11643
14515
11644
14514
11208
14155
11209
14156
14427
17961
14426
17962
8268
8815
8269
8816
7992
8325
12696
18343
12697
18342
10777
18366
10778
18365
8467
8908
18075
8468
8909
18076
9192
12300
9592
17625
9593
17626
12446
16276
12447
16277
8668
9801
18298
8669
9800
18299
7995
8326
14538
14539
8146
9580
12003
8147
9581
12004
9672
10974
12735
9673
10973
12736
8644
9417
9655
8645
9416
9656
12184
14532
12183
14531
10683
10684
8092
9954
8093
9953
11696
11697
8832
9029
8833
9028
9402
18400
9403
18401
10106
14391
10107
14392
16379
17440
16378
17441
10116
16611
11834
18070
11835
18071
8343
10300
10405
8322
14483
16803
8297
10188
10364
8296
10189
10363
10123
14809
10122
14808
8130
13430
8575
9875
10647
8576
9876
10648
8159
13427
8538
15733
8539
15732
8844
9837
8845
9838
15386
16117
15385
16116
9552
10639
9553
10640
8713
9855
12454
8714
9854
12453
9509
10632
12195
9510
10633
12202
13072
13073
11411
15458
11410
15457
8361
13792
17238
8362
13791
17237
15550
15580
15549
15581
14286
14287
8891
14267
17231
8892
14268
17232
8577
9162
9543
8578
9161
9542
16034
17039
16035
17040
9324
13428
14217
10610
18293
14907
16641
14908
16642
8718
9353
10367
8719
9354
10368
10771
18293
11575
13221
11576
13222
14700
18139
14701
18138
8634
9630
8635
9631
8287
12401
8288
12400
9167
9561
12653
9168
9562
12654
8083
9349
10859
8084
9350
10860
8379
10567
15514
14321
14982
14322
14981
8781
14474
15049
8782
14475
15050
12610
14091
12611
14092
8495
8725
9942
8494
8726
9943
8124
8223
18359
10332
11726
10331
11727
9994
12988
15475
16333
16334
8129
8224
18357
9421
10594
11931
9422
10595
11932
13608
13611
13607
13612
10981
11587
10982
11588
8350
9990
12088
8351
9991
12087
9821
11632
17405
10442
15811
10441
15810
14665
14666
10671
15930
8227
9087
12731
8228
9088
12732
8174
9667
8175
9668
14316
14858
14315
14857
9325
11123
13461
9326
11124
13462
8496
9701
15237
15238
14001
17770
11317
12320
11318
12693
8963
9647
10394
8962
9648
10393
11724
12651
11725
12652
8287
9913
8288
9912
8417
9017
11564
8418
9018
11565
13289
14632
13288
14633
8545
10521
8546
10520
10273
11993
15822
18162
15823
18163
8841
10700
15253
8840
10701
15254
12903
15127
12902
15126
12334
17177
12335
17178
16189
16190
8676
11266
8673
11290
9030
9551
15081
8435
12830
8436
12831
10976
17394
10975
17393
8149
8150
9877
9946
13313
8586
9538
13233
8587
9539
13234
9947
16685
10176
16263
11472
8832
13612
8833
13611
8622
11925
10048
13333
10049
13334
9935
11199
11893
9936
11200
11892
11241
11242
17563
17562
16962
9777
13928
8499
15289
8500
15290
14434
8766
9814
8767
9813
13692
14415
13693
14414
8928
12002
10724
13464
10725
13463
8785
9933
12285
8786
9932
12286
8828
8829
14191
16690
14192
16691
13208
17327
13207
17328
8652
11987
12122
14649
12671
17366
14581
14580
15408
15407
9218
12579
13983
9219
12580
13984
8399
14721
8398
14722
9622
12248
9623
12249
9237
10263
9236
10264
8762
9696
15172
8763
9695
15173
10766
10826
10768
10827
11663
11664
16665
16666
9066
16016
8753
8754
9241
9497
9240
9498
8324
12332
8323
12333
9357
17618
9358
17619
8350
9431
17568
8351
9432
17569
8698
13848
16065
8699
13847
16064
12271
16140
12270
16139
9415
14015
9414
14016
9414
14022
9415
14021
8245
8932
12400
8246
8931
12401
9030
10519
12230
16858
12231
16859
8253
10571
12368
8254
10572
12367
15892
17937
15893
17938
9496
12068
9495
12069
9717
10946
8581
11315
16129
8582
11316
16128
8677
13997
8678
13998
9067
9773
15709
9068
9774
15708
8413
9817
11979
8414
9818
11978
8529
14015
8530
14016
9501
11784
9502
11785
8259
9106
8260
9107
9141
10035
14158
9142
10034
14157
8384
9973
14564
8385
9974
14565
8803
11707
14292
8267
11322
13228
8923
12221
17889
8806
15201
8807
15202
11401
16745
10811
12722
10812
12723
8691
10737
8692
10738
9830
10481
9831
10482
10127
13720
10128
13721
8703
9681
11580
8704
9682
11581
11487
16551
11488
16552
14863
17623
14864
17624
8630
8631
11593
13494
11594
13495
8452
10935
11784
8451
10936
11785
9570
12398
9571
12399
9181
9182
10336
11388
14440
14441
12641
18172
12642
18171
9004
16598
9005
16599
8723
11471
14572
8724
11470
14571
8951
11577
15737
16482
15736
16483
12950
18160
16865
11852
11851
11405
11406
13203
13206
10917
10947
13577
13576
9419
9771
13609
9418
9772
13610
8929
12560
15499
10928
10955
8930
12563
15498
8919
12570
14439
8920
12860
14438
10942
16099
10943
16098
8749
8750
9692
17982
9691
17983
9426
16395
9425
16396
8477
11554
14668
8478
11555
14667
8692
11837
11961
8691
11836
11960
8345
8504
8344
8503
8357
9342
9392
8358
9343
9393
10067
13521
10068
13522
8664
10180
13218
8665
10181
13217
9224
9225
9602
13565
9603
13564
11673
12594
11672
12595
12250
17256
9365
9366
8746
9401
10892
11654
11655
8435
11087
18401
8436
11088
18400
9798
11793
9799
11794
13626
17977
13627
17978
12508
15598
13536
15816
13537
15815
9052
9348
14010
9270
12855
17156
8855
10038
14988
8856
10039
14989
10040
12477
14258
12478
14257
14143
14142
8387
11208
16042
8386
11209
16043
12828
12827
8898
9442
12089
8899
9443
12090
9147
11765
12068
14613
12069
14614
15416
15417
8937
15290
8938
15289
14108
16916
14107
16917
8924
10491
8925
10492
9361
10780
9362
10779
11246
12441
12593
11247
12440
12592
8581
10478
8582
8717
9322
14891
15684
9323
14892
15685
10599
9934
10346
17732
8540
13538
13846
8971
10015
13765
8970
10014
13766
9812
12055
15657
9191
10983
17159
17160
8817
17025
8818
17024
10961
15303
10962
15304
13488
18069
13489
18068
9129
11759
9118
11046
12874
9119
11047
12873
15191
15192
8707
8753
9780
8708
8754
9781
8433
10140
15695
8434
10141
15696
16543
16582
8609
8608
8415
14273
16136
8416
14274
16137
16581
16583
12526
14869
12525
14870
9741
12921
16821
9742
12922
16822
8596
8992
8597
8993
9272
15371
9273
15372
9690
9689
13674
14494
13675
14493
13908
17350
13909
17349
11895
14465
11896
14464
9912
13091
9913
13090
9053
9372
10062
9054
9373
10063
8459
15218
8460
15217
8448
8796
8449
8797
8547
10999
8548
11000
8501
11224
12595
8502
11225
12594
9132
11687
12937
9133
11688
12938
12509
18013
12510
18012
9221
9220
11391
12055
16044
9786
13638
8987
11781
8988
11788
9680
13823
9952
15110
15109
9109
9246
16270
9108
9247
16269
9209
10229
9210
12457
14223
12458
14222
9644
12346
12806
12347
12805
8926
9043
13268
8927
9044
13269
9578
15805
9579
15806
13275
14556
13276
14555
15279
17134
15280
17133
8775
9406
12657
8776
9407
12658
8886
14400
8854
9905
8751
9447
16556
8752
9448
16557
8470
16176
8471
16177
9530
14457
11540
17610
11541
17611
8508
9726
8509
9727
10024
11358
10025
11357
8583
9870
16682
17207
16683
17208
9386
9944
10151
9387
9945
10150
9372
10703
16713
9373
10702
16714
12511
12928
12512
12929
8717
14712
10103
14713
17950
11229
13611
11230
13612
8584
8585
9291
18322
9290
18324
8755
14231
8756
14232
13491
9222
10788
9223
10789
17878
17879
13420
15467
13419
15468
8827
13950
8826
13949
9863
13073
9037
9639
15969
9038
9638
15970
11650
12863
11651
12864
15494
15702
15495
15701
9417
10889
16620
9416
10890
16621
9644
14095
10770
11272
10769
11273
8728
12842
8727
12843
9317
12256
9318
12255
14886
9645
9722
15658
9646
9723
15659
16250
16399
16251
16400
10697
14399
15125
8886
11739
17013
8686
8964
8685
8965
8695
11573
12101
8694
11574
12102
10000
12584
10001
12583
12699
12700
8951
15022
17891
10026
16807
10027
16806
13768
16387
8822
10668
11671
8823
10667
11670
9205
9965
15247
9206
9966
15248
12679
14054
12678
14055
11675
16409
11674
16410
8781
8782
8670
11210
16756
8671
11211
16757
10991
11078
13457
11077
13456
10547
14235
15778
10542
14829
10543
14830
9120
13168
9121
13169
9278
9279
8964
17707
8965
17706
9369
12497
16528
9368
12498
16527
17407
18121
17406
18122
9512
12156
15282
9513
12157
15281
9767
10524
10584
9768
10525
10583
12032
12500
12033
12501
11552
12989
11553
12990
11027
16534
11026
16533
14768
15416
14769
15417
14713
14712
10405
8917
14028
8918
14029
9503
14153
9504
14152
11300
15881
12933
12934
8768
10697
10916
12323
17135
12324
17136
13813
16465
13812
16464
14286
14287
11620
17303
11621
17304
10439
10440
9582
10939
9583
10938
16757
16756
8854
9116
9269
9258
9401
9439
8657
9390
8658
9389
8614
9437
11132
8615
9438
11131
9064
13262
17287
9065
13261
17288
9820
16506
9819
16507
9200
13714
14004
9199
13715
14003
10016
15066
10017
15067
9617
10767
12408
12409
9674
10046
9675
10047
11280
11758
12045
10758
13817
8953
9095
14591
8954
9096
14592
16104
16105
11007
11008
13278
17385
13277
17384
8962
11254
12242
8963
11255
12243
9924
11398
13734
9925
11397
13735
11196
16257
11195
16258
8703
12365
16749
8704
12366
16748
12962
16023
12961
16024
9071
10734
11182
9072
10733
11183
9970
10873
11635
14095
9905
9941
13440
9532
14294
9533
14295
8884
13591
8885
13590
11276
15150
11277
15151
11928
14386
11825
13256
11824
13255
11315
11316
17582
17583
14702
14703
9882
17979
13137
16882
9272
9297
15932
9273
9298
15933
13130
16884
9074
13288
9075
13289
8773
10645
16451
8774
10646
16452
9093
12422
13161
9094
12421
13160
10223
12626
10224
12627
9283
17043
9282
17044
10203
12678
12792
10204
12679
12793
9122
11123
16633
9123
11124
16632
9609
9610
12463
12773
13190
12774
13191
9306
12234
12254
9307
12233
12253
10043
15728
10424
10607
14622
10192
11999
9026
9027
8736
14610
16457
8737
14609
16458
8806
17507
8807
17508
9187
16041
9188
16040
8822
9203
8823
9204
8786
9982
8785
9981
12387
12386
9788
8856
10296
8855
10297
8815
9376
10835
8816
9377
10836
8867
16762
18354
14039
14038
11139
14269
11138
14270
10034
13003
10035
13002
10186
13319
17213
10187
13320
17214
10379
14154
10238
10304
10432
10239
10305
10433
9139
14285
14329
9140
14284
14330
10132
13083
10131
13084
11175
16965
11176
16964
9076
11714
11756
9077
11713
11757
9482
11622
9483
11623
9153
11964
15952
9154
11965
15953
14560
15270
9083
9499
17921
9084
9500
17920
12612
12613
9778
15231
9779
15232
17623
17624
10779
14030
10780
14031
9021
16950
11364
14719
11365
14720
8835
9110
17706
8834
9111
17707
13844
13845
10520
10521
9934
10061
10786
13962
10787
13963
15092
15831
15093
15830
13296
15435
13297
15436
11436
16352
11435
16353
12687
15060
12688
15059
9285
16957
9286
16956
11357
11358
14521
14622
10903
10904
11944
12254
11943
12253
11362
18205
11363
18206
9220
11706
18371
9221
11705
18372
10041
10700
13454
10042
10701
13455
9254
13947
9255
13948
9834
11300
9971
11919
14460
9972
11918
14459
10470
13546
10469
13545
14314
9499
12831
13985
9500
12830
13986
16283
16284
14204
15363
14205
15364
9732
10714
10012
10501
10747
10013
10502
10748
8964
9296
10831
8965
9295
10830
14296
14297
13953
15513
13954
15512
11467
17904
9587
10347
9586
10348
11783
11782
15235
16322
15236
16321
17730
17731
10688
13050
10687
13049
9394
9550
10407
9395
9549
10406
9916
9915
14452
14451
9272
14193
15195
9273
14194
15196
10829
11438
10828
11437
11552
11988
11553
11989
15073
15074
9244
9940
9245
9939
9089
10217
9092
10220
10337
11578
14638
10338
11579
14639
9157
14522
18371
9158
14523
18372
16781
16782
9797
9725
9724
17509
17880
17510
17881
9652
9972
14974
9651
9971
14975
9639
12954
9638
12953
9435
16351
9436
16350
9017
10696
9018
10695
16826
13633
16703
13634
16704
13524
15824
13525
15825
10246
10530
14311
10245
10531
14312
9046
11894
9233
10922
17716
9232
10923
17717
8904
13686
8905
13687
9693
10519
14521
9211
11832
11840
9212
11833
11841
9613
9614
9442
17800
9443
17799
16961
10672
10673
9932
10065
12176
9933
10064
12175
16104
16105
11940
16161
10926
13000
15085
10927
13001
15086
9609
9862
9610
9863
16565
16564
9935
17966
9936
17965
10092
10517
11332
10093
10518
11331
12636
13501
12637
13502
9376
9818
9377
9817
13095
13096
9349
10594
17994
9350
10595
17993
14434
15501
14623
14927
14624
14928
8931
8932
11449
15415
11448
15414
9195
10513
15749
9196
10514
15750
16316
9669
13708
9670
13709
10375
11013
10376
11014
10175
14552
12674
14478
12675
14477
12948
17750
12949
17751
9965
10493
11540
9966
10494
11541
11110
16013
11109
16012
10288
10758
9709
9940
9710
9939
9676
11958
13107
9677
11957
13108
11404
18220
9132
11256
11298
9133
11257
11299
9049
13465
9050
13466
9580
13347
16174
9581
13348
16175
15777
12235
13664
15655
13663
15656
11416
18215
16476
16930
16477
16931
9291
12233
9290
12234
9210
9209
11429
11428
9482
10232
17990
9483
10233
17989
11079
11235
11882
11080
11234
11881
9730
11692
9731
11693
9099
17162
9100
17161
10681
10987
13597
10682
10988
13598
9412
9413
11351
14877
9782
13837
9783
13838
14134
17355
14135
17354
14338
16820
14339
16818
9797
10715
15358
14267
15414
14268
15415
9080
14402
9081
14403
9449
14173
15790
9450
14174
15791
9724
14329
16937
9725
14330
16938
9477
13708
16286
9478
13709
16287
9832
16427
17019
9833
16428
17018
16798
16797
9733
14705
9734
14706
10316
13327
17097
10317
13328
17098
13662
13699
9986
10508
9985
10509
11303
13113
15682
11304
13114
15683
9559
12171
17148
9560
12172
17149
9143
13936
9144
13937
9137
11173
17748
9136
11174
17749
12746
10225
12154
18193
10226
12155
18192
9097
11212
12819
9098
11213
12820
17091
17092
9915
9916
17843
16071
16931
16070
16930
13265
13264
9810
11032
9811
11033
13164
15204
13165
15203
9926
16180
17632
9927
16181
17631
12493
12976
12494
12977
11099
13814
11100
13815
10124
12554
13512
16392
9528
11670
12485
9529
11671
12484
9771
9772
9661
12630
10265
11984
10621
15799
10622
15800
13244
18417
9250
12156
12676
9251
12157
12677
10175
12000
13743
15274
13742
15273
10190
10784
14075
10191
10785
14074
11993
12052
9322
16783
9323
16784
10420
12235
15972
17278
15973
17279
11745
16973
11744
16972
11720
15171
11721
15170
11356
16268
13775
16025
13776
16026
13617
15161
13618
15162
9131
12581
13029
9130
12582
13028
9589
13679
9590
13678
9511
13441
18037
18036
15324
16886
15325
16885
11030
11031
16472
9625
10495
16346
9626
10496
16347
16453
10777
14507
10778
14508
10720
12080
10721
12081
12083
12082
13278
13277
9505
10080
15914
9506
10081
15915
9734
15137
9733
15136
9618
14541
17308
9568
9569
12774
13377
12773
13376
10527
17998
10526
17997
11095
17575
11096
17576
10044
10596
17813
10045
10597
17812
11421
10116
10265
13223
14089
13224
14090
9762
18304
9763
18305
14220
15001
14221
15002
9967
12591
10583
11426
12759
10584
11427
12758
9418
9419
9213
13280
13281
14962
14961
9380
9442
11354
9381
9443
11355
10511
11809
10510
11810
10073
14172
11557
13545
11556
13546
16490
16491
10339
15390
10340
15389
10327
12196
10328
12197
11527
14742
9632
9752
9633
9753
9735
16688
9736
16689
12022
13569
16386
15863
17210
15864
17209
9205
13177
9206
13178
12553
12957
12552
12958
16730
16731
9365
11460
12271
9366
11461
12270
9256
14371
17127
9257
14372
17128
10679
14714
10678
14715
9181
16312
9182
16313
9199
10865
14083
9200
10866
14084
9688
10510
11459
9687
10511
11458
9720
13677
14876
9721
13676
14875
9981
11483
12108
9982
11484
12109
17198
17455
17197
17456
9230
10741
12844
9229
10742
12845
9248
10168
16185
9249
10169
16186
9508
15458
9507
15457
10012
11834
10013
11835
11566
10587
12543
9746
11364
11626
9747
11365
11627
14486
16910
14487
16911
12226
12227
13461
13462
10099
14448
10100
14449
9517
18191
9518
18190
14855
14856
9715
17053
9716
17054
14303
14302
10631
12703
10630
12704
9231
17261
9346
12407
13408
9347
12406
13409
9286
9800
9285
9801
11498
12310
11497
12311
17312
17386
17311
17387
11213
11212
9910
9911
10607
9997
12953
9998
12954
12901
15149
11870
18272
11869
18271
9842
11883
15852
9843
11884
15853
9839
11520
9840
11521
9382
13195
9383
13194
11926
12352
11927
12351
9299
13807
16005
9300
13808
16004
11676
15420
11677
15421
11214
14688
11215
14687
9795
17539
9796
17540
12485
16833
12484
16832
9616
14553
9615
14554
17778
17779
12750
14414
12751
14415
15270
11193
14355
11194
14354
9474
10697
10707
14141
16879
14140
16880
10054
11081
14179
10055
11082
14180
10800
13653
14433
10801
13652
14432
9629
10570
12631
11333
15807
11325
9914
12022
16296
11582
11830
11583
11831
9740
13111
17615
14076
14235
13833
13818
9578
9607
13969
9579
9608
13970
10152
10799
13512
12009
12008
11657
14994
15502
11656
14995
15503
9671
10240
11985
9632
10150
16828
9633
10151
16829
11108
11107
11978
13675
11979
13674
14670
14669
12932
15055
10468
15914
10467
15915
9453
9454
14420
14421
11536
13616
13753
16943
13752
16942
10397
10914
16584
10398
10915
16585
9889
13848
9888
13847
9374
17154
9375
17155
9850
9851
10569
13470
10568
13471
9490
10730
13538
11587
11588
18421
10447
11305
10448
11306
11524
11933
12187
11525
11934
12188
17255
17254
9566
11414
13304
9567
11415
13305
12395
16608
12394
16609
9649
17446
9650
17447
9885
13942
16008
9770
16261
9769
16262
15004
15074
15005
15073
11109
14510
11110
14511
10323
13402
17826
10324
13403
17827
14052
17378
14053
17379
10116
12576
17736
17737
10652
15106
10651
15105
10929
10930
11462
12423
11463
12424
17224
17513
17225
17514
16799
18102
16800
18101
13807
13894
13808
13893
9584
10354
12720
9585
10355
12721
12797
12796
12574
14490
13676
17028
13677
17027
9955
11613
16502
9956
11614
16503
10698
10699
14500
17670
14501
17671
9835
9836
10532
14935
17140
10533
14936
17141
11948
17990
11949
17989
10051
10050
10401
10475
11061
10402
10474
11062
15968
18402
15967
18403
9401
15400
9886
14722
9887
14721
14617
18134
9711
9712
9908
10286
9909
10287
12743
12754
9433
10852
9434
10851
10358
14818
17227
10359
14817
17226
9556
13620
9557
13619
9437
9438
9615
15392
9616
15391
10331
12924
13029
10332
12923
13028
14389
14390
9785
9784
10712
10713
10273
13228
15102
11818
14653
11819
14654
9764
11483
14764
9765
11484
14765
13068
13264
13067
13265
10601
13918
15161
10602
13919
15162
9707
16693
9708
16692
13330
13329
9859
16532
9858
16531
17375
17374
10176
15070
9874
10286
9873
10287
9766
12350
14373
15035
15412
15036
15413
10603
12036
10604
12037
15461
16531
15462
16532
10365
14591
10366
14592
13672
13673
9524
12689
17325
9525
12690
17326
9822
11491
18339
9823
11492
18338
17217
17615
11725
18375
11724
18376
11025
11652
11024
11653
9600
10010
10657
9601
10011
10656
9776
15232
9777
15231
17923
13979
15613
9761
13978
15614
10334
12621
16369
10335
12622
16368
9552
9640
13973
9553
9641
13972
10874
15365
10155
17511
10156
17512
13665
16402
13666
16403
10241
10242
9588
10310
11937
10773
12594
13821
10774
12595
13822
10851
11735
15775
10852
11736
15776
11267
12162
11268
12161
12143
13768
9968
10710
14429
9969
10711
14428
14707
17039
14708
17040
9963
15593
9964
15592
10232
10626
10233
10627
17077
17076
12347
14515
12346
14514
14195
14196
13795
16730
13796
16731
10064
11410
10065
11411
15297
16187
15298
16188
9540
11493
10342
12417
10343
12418
10333
11667
16941
10629
14449
10628
14448
10814
17061
10813
17060
10290
11118
17614
10291
11119
17613
9693
10124
10523
11369
10522
11368
15860
15859
10084
10381
14566
10085
10382
14567
17158
17862
17157
17861
9537
14819
10110
15614
10757
10756
9826
10692
12531
9827
10691
12532
9680
10545
15944
10546
15943
14195
14196
11233
12074
10605
10625
18384
10471
10472
9706
9733
16848
9705
9734
16849
9835
11696
9836
11697
17708
9627
9628
17263
17605
10809
10810
10575
12136
15463
10576
12137
15464
10550
10551
9697
13071
16518
9815
15484
9816
15485
10445
10446
11592
17795
11591
17796
11231
12375
16241
16242
11938
12363
11939
12364
11763
14764
11764
14765
11186
11252
12240
11187
11253
12241
10153
15184
17647
10154
15183
17646
11075
11305
13597
11076
11306
13598
16554
16553
9830
10562
9831
10563
13278
14957
13277
14958
13732
14244
13733
14243
12488
10230
10231
13100
9973
18256
9974
18257
12472
12471
17165
18026
17166
18027
11146
11805
18095
11147
11806
18096
10292
17700
10293
17701
13468
13469
10577
14360
15414
10578
14361
15415
12826
14820
16696
16902
16697
16903
10557
10558
11038
11039
12732
12731
11738
13111
11689
14469
11516
15250
11517
15249
16456
10815
10816
10125
14293
17167
15299
16688
15300
16689
10084
10085
11004
15796
9802
10852
9803
10851
10465
10466
11528
12243
12688
11529
12242
12687
9841
10825
11101
10742
10741
10637
14144
10638
14145
10262
10268
12182
10261
10269
12181
14490
15426
17442
15427
17443
14303
14389
14302
14390
12321
14647
12322
14648
16381
16382
10020
14665
10021
14666
12571
12783
12572
12784
10399
10400
10148
10370
10149
10369
10031
10485
16831
10030
10486
16830
11998
14396
11997
14395
9989
10564
11128
11473
11474
13665
14548
13666
14549
13816
14111
15263
14112
15264
14741
18117
14740
18116
12332
12609
12333
12608
15700
14759
17499
14758
17500
9810
11307
14359
9811
11308
14358
12761
13992
12760
13991
11426
11427
10769
10770
10443
11252
10444
11253
11040
10505
15950
14753
17178
14752
17177
14345
16631
10542
11770
15670
10543
11771
15671
9739
14374
16685
14959
11635
13279
14130
16273
14129
16274
10228
11376
10227
11377
11020
14424
11021
14425
10751
16898
10752
16899
11102
14804
11103
14805
10054
17401
10055
17402
13020
13021
13127
16487
10757
13871
10756
13872
11699
17097
11700
17098
11883
15181
11884
15182
10367
10368
10695
12006
10696
12005
10087
13097
10086
13098
10592
15056
10593
15057
10753
11048
10011
15299
10010
15300
14109
16614
14110
16613
11765
18198
15627
17013
9977
13708
9976
13709
12941
9789
9824
16750
9790
9825
16751
9953
14215
9954
14216
9782
11310
11968
9783
11309
11967
13795
16514
13796
16515
11874
11873
10420
11392
15359
10479
11077
12817
10480
11078
12818
9943
10779
9942
10780
13552
13553
15030
13374
13373
10131
11763
10132
11764
13470
18044
13471
18045
11926
13198
11927
13197
14410
14411
13572
15884
13573
15885
11467
11629
16555
15820
17305
15819
13054
13329
13053
13330
14115
15096
14116
15097
12734
12733
11733
11734
10606
11162
10195
11985
10478
17115
10293
15299
10292
15300
10143
10447
10645
10144
10448
10646
11120
12827
17522
11121
12828
17521
17442
17443
15807
15484
15485
15604
15603
10879
16372
10880
16371
14263
14264
9991
13069
9990
13070
12904
13516
12905
13515
12193
12194
10996
16847
18358
18363
12555
13682
12556
13683
9891
9890
10361
10821
10362
10822
14326
18242
16904
18243
16905
18244
16346
17977
16347
17978
12077
12076
10008
10553
11470
10009
10552
11471
17355
17354
14816
10745
16340
10746
16341
14498
16627
14497
16626
10195
12151
14593
15658
14594
15659
10113
17837
10114
17838
10201
15798
10202
15797
10258
11651
14662
10259
11650
14661
10080
10081
10720
15790
17600
10721
15791
17601
11483
13217
11484
13218
10668
11843
12578
10667
11844
12577
15790
15791
10839
15543
10840
15544
15082
17495
17496
10973
11995
10974
11994
9948
12848
16547
9949
12849
16546
9940
10745
17235
9939
10746
17236
11048
11122
11334
11631
11860
11335
11630
11861
9909
13607
9908
13608
10236
10905
10237
10906
16163
14431
15639
14430
15640
17138
18395
17139
18396
10600
16767
11661
17081
11662
17082
9975
13451
13590
16112
13591
16113
10862
10861
10585
17629
10586
17630
13481
18196
13482
18197
10371
13049
17647
10372
13050
17646
10403
11142
10404
11143
10008
15715
10009
15716
14582
14583
10126
10556
11959
13359
17066
13360
17065
15239
10357
12915
10356
12916
12687
17892
12688
17893
11626
11627
18411
10071
10072
10321
16173
10322
16172
10143
14003
16451
10144
14004
16452
10573
12012
13092
9987
9988
10775
17153
10776
17152
16493
17871
16492
17872
10278
11952
13842
10279
11953
13843
10182
10701
10183
10700
9982
9981
13397
10416
14964
15438
10417
14963
15437
10715
14368
12605
12606
10191
16364
10190
16365
11719
13774
13722
16955
11813
15407
11814
15408
11391
15122
11104
16960
17267
12747
13840
13841
11946
13730
11947
13731
11703
13903
17168
11704
13904
17169
11335
14035
11334
14036
11893
11892
11729
11915
11728
11914
13095
13096
14401
13566
17453
17454
12314
10485
11920
10486
11921
11773
13587
15123
11774
13586
15124
14820
16615
10839
11072
10840
11073
10669
17402
10670
17401
10171
14896
10170
14897
12045
13092
17831
17832
13349
15482
13350
15483
13623
14723
12265
14810
15928
12264
14811
15929
10850
13112
14190
12210
16084
12209
16083
10520
11546
10521
11547
10934
12641
14238
10933
12642
14239
10733
13015
10734
13016
14038
14039
15527
15526
12334
12335
11395
12636
11396
12637
14284
17876
14285
17875
10784
13058
13499
10785
13059
13500
14652
14681
14651
14680
11503
12874
11504
12873
10306
10538
11309
10307
10539
11310
10178
11786
10179
11787
10989
11347
12387
10990
11348
12386
10483
10939
12976
10484
10938
12977
13570
13571
11658
15951
15745
15746
12631
17334
14396
16023
14395
16024
12401
13577
12400
13576
10875
12602
10876
12601
11005
15692
11006
15693
10284
12859
16069
10285
12858
16068
13236
13235
11319
12340
11320
12341
10119
14017
11882
12329
14645
11881
12328
14646
10772
17918
12208
12788
12207
12789
11067
11068
11150
12787
15694
13949
17773
13950
17774
11055
11295
18212
11056
11294
18213
11229
11490
11230
11489
12073
16252
10250
15737
16476
10251
15736
16477
12503
15033
12502
15034
10655
11489
12344
10654
11490
12345
10883
10884
10209
11055
12027
10210
11056
12028
10844
10845
10744
14249
10743
14250
10805
15617
16499
10806
15618
16498
12497
13785
12498
13786
10235
11711
10234
11710
10735
12765
10736
12766
10693
11977
16779
14357
15218
14356
15217
11060
15606
11059
15605
10708
11158
10709
11157
10478
17823
10188
16098
10189
16099
13365
13366
11499
13707
14067
11500
13706
14068
17221
17524
10633
10739
17552
10632
10740
17553
12283
18370
12284
18369
10951
13410
15125
10373
13037
15264
10374
13038
15263
16846
10811
12450
10812
12451
12268
12269
15287
11401
16745
12336
12389
15726
15727
10451
12040
16658
10452
12039
16659
14348
14349
10499
13475
17313
10500
13474
17314
16168
16721
16169
16720
10192
12290
14598
16544
14599
16545
15986
18218
15985
18219
10512
15271
15515
13461
13462
10675
14131
14640
10843
12193
14359
10842
12194
14358
10843
16362
10842
16363
14444
14573
14949
15450
14950
15451
11228
12991
10188
13306
14882
10189
13307
14883
10985
11776
12258
10986
11775
12257
11331
12645
13023
11332
12646
13022
12121
13685
17666
12120
13684
17667
14753
17578
14752
17577
11441
12711
11442
12712
11386
11387
10970
11003
11707
10473
10671
11577
13817
11537
15763
11618
12280
10647
17595
10648
17596
11870
12454
11869
12453
11297
13831
11296
13832
10369
11282
12958
10370
11281
12957
15893
15892
10940
10941
13689
10208
11815
10207
11816
11146
14395
11147
14396
17189
12674
15718
12675
15717
14055
14136
14054
14137
10325
17789
10326
17788
12794
12795
11550
13104
11551
13103
10623
13141
10624
13142
10383
16671
10384
16670
18347
18356
18346
18355
15728
15987
11107
15023
15134
11108
15024
15135
15731
15988
13604
14942
13605
14941
12423
16106
12424
16107
11182
12167
11183
12168
10269
10268
11773
11468
15619
11469
15620
16695
16694
11464
11713
11465
11714
10972
10971
15724
18405
15725
18406
11821
12300
16834
16835
10617
15068
15980
10618
15069
15981
14614
18262
14613
18261
10678
12832
17048
10679
12833
17047
15370
18303
18424
12558
12557
11089
15089
15764
11090
15090
15765
11112
12829
13227
14469
10975
15615
16994
10976
15616
16995
13870
14503
13869
11113
12836
15526
15527
13889
13888
12389
11129
14952
17880
11130
14951
17881
13456
13457
11537
12000
10656
14005
14770
10657
14006
14771
10421
13819
10380
13820
14568
14569
13947
17894
13948
17895
10427
15869
10428
15868
13406
16247
13407
16248
14415
16554
14414
16553
11163
11164
10625
15288
11159
11862
15731
17824
17865
17825
17866
10875
13333
10876
13334
15779
15955
15780
15954
11382
12296
11383
12297
15796
17187
10434
12821
15780
16732
15779
16733
17756
17757
10731
10900
10732
10901
14604
15803
10590
13496
10591
13497
10754
13558
17772
10755
13559
17771
11004
11128
16059
14808
14938
14809
14937
10665
14943
10664
14944
10424
12151
11352
15669
11353
15668
15083
15084
13582
18059
13581
18060
11157
11158
10481
12758
10482
12759
12229
12228
16700
17777
11185
14300
11184
14301
11280
15102
16470
16471
14273
14802
14274
14803
10674
17452
12911
12912
15455
17600
15456
17601
11019
17918
14741
14740
11797
12237
11796
12236
11781
11925
10997
13273
16137
10998
13274
16136
13398
13399
11950
13668
11951
13669
10807
15166
10808
15167
11788
11987
10661
17034
10660
17033
10559
13520
10560
13519
11441
11442
11557
11556
15045
15044
11846
14583
11845
14582
10762
14202
10761
14203
13340
15096
13341
15097
10954
17877
11285
15221
15222
13292
17116
13293
17117
11667
13811
15845
11098
12210
11097
12209
10963
11897
12003
10964
11898
12004
10950
13421
13973
16388
13972
16389
15060
15059
11015
15705
16678
11016
15704
16677
16067
16066
10472
10471
12504
16092
12505
16093
17662
17663
11122
10844
11249
10845
11248
14332
15203
14333
15204
13158
13707
13159
13706
10931
11560
16004
10932
11561
16005
11022
13536
11023
13537
15984
16549
15983
16548
11262
11523
11263
11522
10902
11321
11144
16170
16424
11145
16171
16425
14985
11807
14546
11808
14547
14195
16641
14196
16642
11515
12112
12722
11514
12113
12723
10694
18064
10865
16633
10866
16632
12007
13396
13532
13395
13531
11063
12969
13018
11064
12970
13017
13393
14319
13394
14320
10925
12585
10924
12586
10493
17866
10494
17865
13782
15894
13781
15895
12434
12435
11136
11380
14682
11137
11381
14683
11877
14261
11878
14262
10813
11613
11782
10814
11614
11783
11083
12730
11084
12729
10687
10688
11131
15156
15678
11132
15155
15677
10930
11556
10929
11557
10871
10911
10872
10912
11197
14191
11198
14192
13404
16542
13405
16541
10957
15754
10958
15755
11342
11343
10556
14745
14744
14566
16092
14567
16093
16116
16964
16117
16965
12244
16652
12245
16651
14850
14849
10920
12394
18029
10921
12395
18030
17253
17252
11119
11118
11796
14226
11797
14227
10718
12043
16102
10719
12044
16103
15018
15863
15019
15864
13431
13432
11964
12147
12169
11965
12148
12170
13816
17221
11638
11639
14982
14981
12575
14113
14909
14910
11338
12363
12713
11339
12364
12714
12448
15196
12449
15195
13503
12830
13993
12831
13994
14198
14197
10731
13209
10732
13210
10676
12477
14004
10677
12478
14003
10577
10979
10578
10980
11361
13181
11360
13182
10698
15716
10699
15715
11982
13452
11983
13453
10800
11374
15265
10801
11375
15266
16834
16835
16839
17093
12542
16986
16985
18187
13211
14691
11665
14170
11666
14171
12429
12430
11098
11816
11097
11815
11852
12721
11851
12720
15143
12667
12882
12668
12883
13042
18343
13041
18342
11228
12554
12244
14730
12245
14731
11755
13643
10877
15541
15782
10878
15542
15781
13705
15432
14729
14728
13662
16426
10821
12724
10822
12725
11755
14640
16980
18168
18428
16133
16132
11740
11741
10885
10961
17555
10886
10962
17556
12361
14159
17775
12362
14160
17776
16845
16844
10835
17368
10836
17369
17190
11188
15199
17326
11189
15200
17325
11708
11715
11709
11716
11036
11037
13465
13466
11539
11998
11538
11997
15664
17495
15665
17496
10910
13767
15564
15565
11735
13595
11736
13596
13279
13729
10931
11432
17211
10932
11433
17212
17822
11708
15639
11709
15640
11402
13914
16092
11403
13915
16093
12534
13989
12533
13990
15769
15770
11380
15557
11381
15558
16017
16018
12100
14335
12099
14334
12812
12470
12469
11422
11423
11100
12239
11099
12238
14026
14027
11180
16246
16552
11181
16245
16551
15612
18050
10639
10640
13413
13414
11412
12154
18023
11413
12155
18022
10975
17519
10976
17520
11905
11906
17593
17594
16560
16561
10918
12159
10919
12160
11558
13415
13526
11229
11230
16223
16224
14219
14218
11140
16734
11141
16735
10978
11052
13879
10977
11051
13880
12049
17639
12048
17638
11842
14606
14893
11202
11203
13082
18295
13081
18294
11271
15150
17991
15151
17992
12778
17228
10910
13950
14380
13949
14379
13697
13696
11969
15501
16161
15433
15434
16349
16348
12053
12641
12054
12642
11723
11722
10959
16239
10960
16240
15424
16198
15425
16197
11379
11526
10956
16249
12208
12207
11609
13580
11608
13579
13282
17218
15252
18094
15251
18093
11443
18028
13387
16225
13388
16226
13739
13740
11611
14654
11612
14653
11293
16939
10841
10957
13075
10958
13074
13679
13678
11962
11963
14463
15139
14462
15138
16443
14023
18290
10881
14915
15543
10882
14916
15544
11038
12365
13425
11039
12366
13426
13057
15121
12853
12854
10967
10968
11520
12312
11521
12313
11620
15244
11621
15245
12565
12564
14770
14771
14545
14544
16683
16682
14781
16241
14782
16242
11585
12439
11586
12438
11473
14829
11474
14830
11758
15061
15258
17007
15259
17008
14288
14289
15113
10832
15095
10833
15094
13585
13584
13372
10996
16075
11245
12870
12149
13758
16855
12150
13757
13887
13886
11326
13138
12325
14399
12026
14982
12025
14981
10895
10896
15265
15266
11501
12808
13651
11502
12807
13650
12073
18282
14204
14205
11572
16108
11571
16109
13406
13407
11286
14570
13344
14455
14610
13345
14456
14609
11081
12475
11082
12476
11312
11336
15363
11313
11337
15364
11234
11784
14385
11235
11785
14384
13526
17167
17690
17691
11887
12117
12221
13429
12029
13428
11756
16231
11757
16230
12678
13055
12679
13056
11382
12961
11383
12962
15193
15194
12550
12551
10864
13135
10863
13136
11659
16924
11660
16925
13122
14367
13121
14366
11827
11826
12093
12440
13884
12094
12441
13885
14476
12015
13987
12017
13988
11205
11204
10837
11108
10838
11107
13837
15771
13838
15772
11909
12142
13199
13200
14806
15920
14807
15921
13805
13806
12267
13375
12446
12447
12303
16921
12304
16922
12906
15148
12907
15147
16229
11430
16319
16593
11431
16320
16592
11428
12043
14872
11429
12044
14871
12110
13400
13561
12111
13401
13560
11597
15916
11598
15917
11779
12971
11780
12972
10887
14230
10888
14229
11123
11124
11352
15509
11353
15510
11336
13257
14647
11337
13258
14648
17116
17117
16936
13213
15814
16676
16917
16675
16916
12538
12539
15396
15397
12875
12876
12619
12620
12013
16288
12014
16289
12127
13718
12128
13719
13060
11954
11458
14197
11459
14198
11768
17810
11769
17811
11828
12768
15970
11829
12767
15969
12663
12754
17997
17998
11928
13100
11393
11823
11394
11822
12037
14825
12036
14826
11464
12449
16770
11465
12448
16771
11472
14037
12554
12066
17020
12067
17021
11341
11857
14616
14615
11443
13971
12195
13938
16711
16924
16712
16925
11960
12056
11961
12057
14050
16597
14051
16596
14719
15185
14720
15186
12202
13939
14355
14354
15054
15078
15053
15079
11080
18111
11079
18112
11351
12517
14242
15740
15741
11399
11400
11148
17558
17577
11149
17557
17578
12559
16339
12252
13960
16310
16311
11589
16667
16883
11742
12011
14213
11743
12010
14214
11092
12261
13961
12062
16401
13143
13144
13592
14586
13593
14587
17544
17545
11927
12048
11926
12049
11636
14079
14100
11637
14080
14101
11696
12168
11697
12167
12537
18362
18410
13444
11553
15242
11552
15243
12185
12186
10997
15217
10998
15218
11357
12198
11358
12199
11278
11532
11279
11533
15538
16323
17439
14815
14814
11065
11066
11418
12840
11417
12841
14561
11182
16054
18246
11183
16053
18245
11599
16206
16811
11600
16207
16810
13698
15280
15279
12709
12956
12710
12955
14120
14901
14119
14902
11271
12007
12728
12979
17194
12978
17193
13974
13975
11197
11685
14633
11198
11686
14632
12018
15983
12019
15984
11485
12114
11486
12115
15549
16403
15550
16402
12082
15941
17798
12083
15940
17797
15832
18061
11054
17467
11053
17468
13146
13787
13147
13788
14142
14651
14143
14652
13771
16032
13772
16031
12729
14189
12730
14188
14325
14324
14738
14739
13834
15139
13835
15138
11190
15749
11191
15750
15287
13877
15246
11815
12795
11816
12794
11210
11275
11832
11211
11274
11833
12392
15179
12393
15180
14801
11133
12763
16405
11134
12764
16406
14047
14048
11151
12087
11152
12088
17786
17787
18281
18280
11777
11778
13266
13267
11360
16037
11361
16036
14061
14255
14062
14256
16040
16041
11222
11631
17781
11223
11630
17780
12275
15337
18385
12104
16373
12105
16374
11356
15433
15686
15434
15687
14464
14465
12589
12590
14641
15008
14642
15009
11511
13934
15380
11512
13935
15381
13619
13986
13620
13985
12080
12410
12081
12411
12007
12821
16913
14013
14584
14014
14585
11214
11849
11215
11850
15310
15311
13667
15956
11125
14793
11126
14794
11325
12982
17387
12983
17386
14793
14794
11475
14071
12598
12625
11298
18184
11299
18183
11406
13725
11405
13726
11238
11239
14885
17533
14884
17534
14468
11748
15025
11749
15026
11201
12543
13335
16725
15783
16270
15784
16269
17086
17085
12228
12229
13491
11683
17680
11684
17681
11480
16449
11479
16450
11724
17620
11725
17621
17814
17815
11970
12340
11971
12341
13510
13511
14189
18374
14188
18373
16868
17514
17952
17513
17951
12156
12676
12157
12677
11595
11912
16441
11596
11913
16442
12421
12422
13700
15988
15461
16329
15462
16330
12280
15295
11645
16928
11646
16929
11303
14546
11304
14547
11254
14729
11255
14728
13143
13646
15897
13144
13647
15896
11311
12146
15359
12777
18409
18416
18375
18376
12132
13720
12133
13721
12222
12675
14237
12223
12674
14236
12075
13566
17605
12204
16491
12203
16490
18341
18340
15572
15573
15859
15860
15227
15228
11201
17431
12504
17211
12505
17212
16125
16124
14121
14122
12161
16810
12162
16811
12485
13237
12484
13238
11438
11908
11437
11907
11941
12147
17210
11942
12148
17209
13861
13862
11372
11373
11268
11267
14028
14029
11879
14413
11880
14412
11700
12694
13328
11699
12695
13327
14353
14352
13831
16342
13832
16343
12025
12026
13694
13695
15287
11462
11537
12034
11463
12035
17096
17095
11348
12628
11347
12629
11541
13904
11540
13903
11379
11977
15064
15065
13171
13524
13172
13525
12383
15027
12802
13717
12801
13716
11645
11674
11646
11675
11251
12001
12755
12251
14175
15247
15248
16842
16843
14995
18138
14994
18139
12291
13416
13979
12292
13417
13978
11402
12023
14566
11403
12024
14567
11534
11535
13150
17721
13151
17720
12563
16581
13621
13622
17833
18191
17834
18190
14913
16929
14914
16928
14703
14702
14056
17408
14057
17409
14527
14528
17708
12312
12765
12313
12766
12064
13887
14914
12065
13886
14913
14383
16152
14798
17604
11513
12452
11546
13931
17259
11547
13930
17260
12560
16582
11955
13067
15706
11956
13068
15707
11817
16091
13387
14925
13388
14926
11746
16343
11747
16342
17927
17171
17172
14630
14631
14220
14221
14343
15639
14344
15640
17570
17571
12555
15785
11450
15688
11451
15689
14877
16404
16708
18296
18297
12175
12294
12176
12295
12099
16566
12100
16567
14382
16201
13927
12124
12272
17448
12123
12273
17449
11974
12116
11389
12041
12381
11390
12042
12382
14781
16637
14782
16638
14193
14194
11760
13505
12173
12174
11668
11669
11417
11562
11418
11563
11719
13774
13624
18209
13380
16032
13381
16031
11559
12556
15358
12555
15175
15473
12556
15176
15474
17037
17036
16409
16410
17541
16565
16778
16564
16777
12274
11999
13170
13543
13544
11419
11420
15185
15186
11818
12276
17688
11819
12277
17689
14466
14467
11505
16506
16769
11506
16507
16768
11840
12853
11841
12854
12752
14507
12753
14508
12817
13456
12818
13457
12376
14418
16986
14066
14065
14880
14881
11519
12545
11518
12544
11477
11478
12290
12520
12348
12926
12349
12927
11795
12860
13504
12951
15244
12952
15245
13922
14024
13923
14025
13309
13727
13308
13728
12391
13783
12390
13784
15382
15219
15220
13089
14437
17759
17760
12490
12499
15058
12108
12109
17466
17465
12441
16807
12440
16806
14058
14447
13626
13627
18334
18335
13498
18050
12842
13221
12843
13222
16038
16039
14197
14198
14150
14151
15159
17887
15160
17888
12495
13105
12496
13106
13878
11744
17648
11745
17649
12102
13653
12101
13652
18089
18090
14020
12598
12829
13761
14734
13725
17520
13726
17519
14397
14398
13139
13828
13140
13829
11593
11768
17835
11594
11769
17836
12129
13964
12130
13965
12514
12568
12513
12569
12025
12026
13163
13628
13162
13629
13750
13749
12625
12836
13212
12527
14402
12528
14403
13514
13513
15950
13752
13753
11719
12158
11937
14099
17554
11633
14895
11634
14894
15486
16777
15487
16778
12930
14904
12931
14905
12099
13166
12100
13167
12203
13809
12204
13810
11811
13582
11812
13581
14939
11758
11817
16183
14866
15268
14865
15269
17312
17311
12032
17191
12033
17192
14489
15114
14488
15115
14184
17260
14185
17259
11809
17749
11810
17748
12491
12506
12492
12507
12030
12159
15116
12031
12160
15117
16574
16577
16575
16576
13480
15634
18171
18172
15047
15046
16418
16419
12138
12139
12394
12443
12395
12442
16276
16277
11628
18072
14323
17612
12889
16843
12888
16842
11548
12381
16874
11549
12382
16875
14891
16954
14892
16953
12089
14721
12090
14722
12433
12671
11654
17591
11655
17592
12203
12518
16914
12204
12519
16915
15873
15872
17090
17089
11603
11604
12756
17682
12757
17683
11791
12362
11792
12361
15255
16359
11760
15807
11903
11904
16789
16790
12880
18268
12881
18267
12950
13170
11668
15181
16025
11669
15182
16026
16726
18078
16727
18077
12076
14710
12077
14709
11967
11968
12106
14011
12107
14012
12086
12757
17364
12756
17365
17091
17092
13574
16656
13575
16657
17032
18005
14212
15356
14211
15357
15517
15518
11820
11738
15995
17336
11910
17309
11911
17310
11938
11939
13219
16145
13220
16146
15596
17214
15597
17213
12043
16303
12044
16304
13093
14754
13094
14755
12211
12963
12212
12964
15621
16894
13438
15536
13439
15537
12210
12209
11640
12195
15445
11819
12629
11818
12628
16081
16082
11864
15512
16793
11863
15513
16794
14980
15889
17057
11647
12202
15446
11823
11822
17515
17516
13873
18288
13874
18289
15187
15188
15077
18327
15398
18005
12002
14960
18225
18226
14215
15185
14216
15186
14263
14264
12252
16620
12056
15085
16267
12057
15086
16266
12347
12346
12402
12403
12261
16621
14383
17782
14382
17743
14873
14874
13550
13551
17965
17966
11687
11890
11688
11891
13085
16711
13086
16712
11751
12643
11752
12644
14178
14177
12230
17898
12231
17899
17124
13997
13998
14937
17028
14938
17027
12447
12446
13759
13760
12262
12263
12544
16300
16660
12545
16299
16661
12483
18308
14678
15052
14679
15051
12410
17243
12411
17244
11914
11915
13688
15275
13836
15430
17371
15431
17370
11918
14974
15729
11919
14975
15730
11924
16280
16974
16975
12494
13373
16536
12493
13374
16535
17613
17614
12846
14523
12847
14522
13839
15828
15829
12645
12967
12646
12968
13529
16582
12737
12738
12589
17055
12590
17056
13801
13873
13802
13874
14046
15672
14045
15673
13478
15044
13479
15045
12923
12994
12924
12995
11994
12937
11995
12938
11853
12457
13058
11854
12458
13059
12294
12320
14540
12783
14149
12784
14148
13329
13330
12319
16681
17943
15627
12686
16933
12198
14267
12199
14268
16679
17246
16680
17245
13151
13150
12760
15019
12761
15018
12459
15229
12460
15230
12719
14401
11889
15305
11888
15306
12058
13363
15031
12059
13364
15032
14131
13749
13750
12901
14165
12570
12669
13047
13739
12670
13048
13740
13084
13083
13024
13039
15569
13040
15568
12623
12624
13135
14229
13136
14230
11842
12908
14303
14302
14495
14496
11826
12315
11827
12316
14452
16253
14451
16254
13430
12577
12578
13777
13778
13427
13886
13887
16630
16629
15175
17469
15176
17470
17492
17758
12868
12869
11803
12149
15809
11804
12150
15808
12125
14831
15412
12126
14832
15413
13630
15016
12015
16714
12017
16713
12296
12297
12408
13294
12409
13295
11950
11951
12926
16179
12927
16178
16918
13034
13630
14711
16268
13528
13527
18271
18272
12367
12368
13165
14840
13164
14839
14550
15734
14551
15735
12238
12239
12177
15244
12178
15245
12215
17295
17298
12216
17296
17297
13639
13640
16668
15262
16101
15261
16100
12356
12566
12355
12567
12429
13985
12430
13986
12413
12773
12414
12774
14957
14958
13947
15628
13948
15629
12894
14282
18015
12895
14283
18014
11945
15121
12542
15700
13248
17805
18083
11964
16281
11965
16282
16825
16204
16512
16205
16513
12158
13313
15149
12251
13748
12838
13481
18018
12839
13482
18019
12177
12178
13878
15307
18415
12063
12306
12389
15546
15545
12523
16565
12524
16564
12815
15211
12816
15212
11918
14086
11919
14085
11895
11896
13051
13052
12091
15670
16898
12092
15671
16899
14001
17564
12692
12691
11914
11915
16206
16207
14573
16889
13692
13693
16821
17289
16822
17290
14377
16994
14378
16995
13105
14696
13106
14697
12431
16216
12432
16217
16260
18128
16259
18129
14010
17565
11972
14371
11973
14372
12579
15103
12580
15104
14130
16287
14129
16286
12546
14804
15229
12547
14805
15230
17377
17336
13851
12014
12135
12013
12134
17914
17915
12051
15817
12050
15818
16162
12713
12714
13099
13603
12011
17270
12010
17271
13223
13251
13224
13252
14241
12550
12707
12551
12708
16449
16695
16450
16694
13287
13286
12564
17902
12565
17903
12086
13817
14015
17044
14016
17043
12222
12587
12223
12588
14789
12943
12944
14173
14174
13283
13448
13556
13557
12250
13099
14140
14141
13554
16212
13555
16213
16719
16772
13272
17399
13271
17400
13736
15771
17690
15772
17691
16709
16710
12306
18235
12314
15409
17457
13831
17396
13832
17395
16249
16401
12691
13734
15305
12692
13735
15306
13228
15592
15593
17107
18223
13418
17170
13197
13198
13109
13463
13110
13464
13247
14615
13246
14616
12769
12770
16923
13704
13703
13580
13071
14406
13579
12224
12225
14146
14487
16841
14147
14486
16840
12754
15221
18179
15222
18180
15532
15710
15533
15711
12293
17107
14202
14203
13087
14457
13088
13823
17190
13800
13799
13132
13131
16725
12396
13148
13920
12397
13149
13921
12351
12352
13487
16416
13486
16415
13303
16436
12474
15079
12473
15078
13569
12943
12944
12545
12544
12634
12748
15828
12635
12749
15829
18317
13196
15143
14574
14575
13641
13642
12158
14071
12571
16999
17602
12572
17000
17603
18149
14939
15756
17308
16495
16494
12521
17358
17509
12522
17359
17510
17654
17655
12502
12503
16202
17173
16203
17174
15777
13982
13981
13591
13590
12248
16279
12249
16278
13115
15180
13116
15179
12596
16780
17405
13117
16581
13093
13094
12259
12260
12388
13615
16436
14306
14665
14307
14666
14218
14219
13613
17380
13614
17381
15154
15193
15153
15194
13584
16566
13585
16567
13046
13846
12591
15697
12383
12755
16738
15622
16138
14848
15586
14847
15587
13429
12673
14677
12672
14676
15168
15169
12423
12424
15004
15866
15005
15867
14509
18390
13338
15461
13339
15462
12247
12561
12246
12562
16593
17436
16592
17437
12913
14850
12914
14849
12317
13592
14041
12318
13593
14042
12576
15698
12941
13480
13002
13061
13881
13003
13062
13882
12860
13682
13314
13315
14476
12603
13628
14161
12604
13629
14162
15342
15343
17954
17953
12420
12419
12850
16118
16658
12851
16119
16659
12529
14065
14501
12530
14066
14500
12173
16840
12174
16841
12427
17317
12428
17318
16792
16791
12285
12286
12951
12952
12649
13353
14636
12650
13354
14637
12844
12845
12984
12985
14013
17555
14014
17556
12406
13704
13788
12407
13703
13787
12302
15850
17133
12301
15851
17134
14738
14739
14126
14127
14680
14681
17718
17719
13517
15504
16547
13518
15505
16546
15210
15209
13517
16460
13518
16459
17848
18114
17847
18115
16908
17003
16909
17004
12506
13122
17755
12507
13121
17754
12779
16123
16208
12780
16122
16209
14477
14478
12875
12876
14177
14178
12398
12399
17890
17979
13251
13252
13100
12623
12856
12624
12857
12444
12445
14300
14301
15060
15059
17791
17792
14052
14529
14053
14530
13135
13136
12597
12383
13718
16732
16733
15069
16589
15068
16588
12601
15721
12602
15722
12835
16464
12834
16465
13719
17248
17502
17249
17501
12488
12575
13490
14248
18003
15811
16768
15810
16769
13730
13731
14895
14894
14711
16619
14242
18321
12815
12816
14526
17816
14525
17817
12762
12415
12709
12956
12416
12710
12955
14137
17074
14136
17075
13527
13528
12715
12772
13103
12716
12771
13104
12900
14104
17383
13927
14843
17634
14844
17635
12671
17919
13436
12698
13437
14512
14513
13911
14878
13912
14879
14273
16367
14274
16366
12973
13280
12974
13281
13092
13124
16912
12464
13386
17546
12465
13385
17547
12489
13762
14245
17175
17176
12553
12552
13654
13449
13450
13214
14186
13215
14187
12686
15432
15275
13051
15315
13052
15316
14607
14931
14608
14932
16091
16939
13969
15075
13970
15076
17096
17142
17095
17143
15153
16463
15154
16462
12796
12797
14789
12865
12932
14434
13148
13723
13149
13724
14929
14930
12617
15437
17741
12618
15438
17742
12729
13953
12730
13954
16547
16874
16546
16875
14340
13008
13032
18033
13009
13033
18032
12916
13229
12915
13230
12959
14059
14470
12960
14060
14471
13587
15578
13586
15579
15587
15586
12386
12387
17463
17464
15605
15606
12370
17970
17650
12372
17969
17651
12600
17079
12599
17080
14331
13024
14605
13308
13365
17153
13309
13366
17152
12636
12637
13216
13290
16098
13291
16099
13570
13934
13571
13935
13391
14280
13392
14281
13184
13183
12955
17222
12956
17223
13875
15137
15523
13876
15136
15522
13011
13012
12597
13483
15768
12834
17575
12835
17576
12986
15924
12987
15925
15339
15470
15338
15469
13473
14150
13472
14151
13388
13387
14759
17527
14758
17528
14360
14438
14361
14439
13620
13619
12434
12435
12879
14980
15686
15687
13357
16637
17677
13358
16638
17676
13414
14543
13413
14542
13268
13269
17739
17738
12718
15757
12717
15758
14095
14490
12951
12952
12711
12833
16208
12712
12832
16209
13499
13500
12582
12923
12581
12924
12788
16588
12789
16589
17843
13291
17772
13290
17771
13501
14346
16754
13502
14347
16755
13436
16941
12605
16694
12606
16695
12503
12819
12502
12820
15567
15566
14968
15492
14969
15493
13714
13715
12580
12726
16148
12579
12727
16149
13129
13763
14093
13128
13764
14094
14576
17064
12982
18077
12983
18078
15515
14598
15833
14599
15834
16039
17252
16038
17253
17551
17550
12948
13995
12949
13996
15998
15999
13929
16889
14238
16071
14239
16070
17356
17357
14096
14097
13966
13955
17658
13956
17659
12694
13352
12695
13351
12689
17885
12690
17886
12691
13728
12692
13727
14176
14877
14778
18201
14779
18202
13689
14445
14446
14828
16778
14827
16777
14365
17816
14364
17817
14795
15051
14796
15052
18188
18189
14786
16877
14785
16876
13530
18390
16075
16846
15699
18220
13121
13122
12973
16123
17047
12974
16122
17048
14418
14900
13896
18162
13897
18163
12948
13105
12949
13106
16605
16606
12791
12790
15324
15325
13120
14098
15849
13789
13790
15846
16978
16979
15071
15072
13435
13434
13683
14450
16762
18426
14640
13346
12598
16812
16813
15230
15229
13580
13987
13579
13988
13449
13450
17029
17645
17030
17644
14946
14945
12625
13025
16782
13026
16781
15077
17554
12865
14028
14688
14029
14687
12825
12824
12608
12797
12609
12796
16450
16449
13490
13751
12657
12658
12665
15668
12666
15669
16710
16948
16709
16949
15080
17877
16299
17239
16300
17240
14013
14933
14014
14934
16447
16448
16571
16572
13718
13960
13719
13961
17584
17585
17187
13239
13240
14833
18294
14834
18295
12928
14051
16126
12929
14050
16127
12852
14104
14996
13494
14317
13495
14318
13477
13476
12649
12650
15835
15836
12969
16734
12970
16735
12711
18089
12712
18090
12861
13425
12862
13426
13599
13600
16094
16967
16095
16966
13429
14649
13428
14650
13698
15657
17935
16283
17104
16284
17105
12943
13000
12944
13001
15519
18332
15520
18333
13185
14715
13186
14714
12918
12917
13083
13183
15615
13084
13184
15616
13641
14310
14613
13642
14313
14614
12930
14990
15141
12931
14991
15140
14537
17489
17490
12698
13836
18196
18197
12904
12905
14381
13179
16952
13180
16951
15204
15203
16360
17009
16361
17010
13384
16607
18224
13162
13730
13163
13731
16571
16572
13246
17022
13247
17023
15353
17279
15352
17278
14965
17740
13382
13383
15912
15913
14746
16735
14747
16734
15693
17193
15692
17194
13643
16426
14859
14860
13452
14118
13453
14117
12937
14962
12938
14961
12967
14791
12968
14790
14113
14164
17275
17676
18189
17677
18188
14114
14166
16573
16296
16989
13053
14386
15232
13054
14040
15231
14421
14649
14420
14650
14255
14256
13693
15393
13692
15394
15335
16375
15336
16376
14407
12771
12772
13201
13202
13474
13475
13933
16049
13043
13044
12902
15570
12903
15571
13957
13958
16663
16662
13472
15441
13473
15442
16184
18215
14098
15714
16736
16737
18062
18063
14757
14756
13393
14265
13394
14266
17452
12913
13496
12914
13497
15166
18369
15167
18370
12947
15120
15128
13411
15696
18313
13412
15695
18312
13115
17864
13116
17863
15258
15259
15429
15428
13233
17345
13234
17344
15634
16497
17326
17490
17325
17489
13010
13597
14220
15576
13598
14221
15577
13964
13965
13064
13063
14972
14973
14229
14596
16718
14230
14597
16717
15897
15896
13227
16963
17832
17831
16122
16123
16394
16393
15751
15422
15423
13173
13174
13061
13062
14005
14006
15656
17341
15655
17340
15083
15504
15084
15505
16247
16294
16248
16295
13422
14345
16756
16757
13123
16707
14226
16789
14227
16790
14371
15559
14372
15560
13865
16901
13866
16900
13125
14102
13126
14103
15501
13670
16057
13671
16058
15383
15490
15384
15491
15142
13951
14408
18231
13952
14409
18232
13884
13885
13795
13796
13108
13107
14240
13302
13301
14079
17049
14080
17050
13077
13500
14222
13076
13499
14223
16646
16753
16645
16752
16775
16776
13749
16219
16517
13750
16218
16516
13013
13715
14257
13014
13714
14258
15431
15941
15430
15940
13434
13926
18232
13435
13925
18231
14167
15965
14168
15966
13454
13623
13080
13943
13944
18345
18344
15480
15481
16220
16417
13765
17557
13766
17558
14377
15339
14378
15338
16259
16260
12939
13738
12940
13737
13342
13343
13523
15121
16048
16047
15768
13093
14724
13094
14725
14278
15226
14279
15225
13238
18333
13237
18332
14419
14217
18414
13154
14754
13155
14755
14599
18113
16799
16800
16362
16363
16256
16255
14155
17642
14156
17643
13361
16294
16967
13362
16295
16966
14919
14920
14747
14746
13790
13848
13789
13847
13019
13440
14658
18000
17999
16655
17580
16654
17581
13945
15012
15403
13946
15013
15404
16158
17956
16157
17955
13604
13605
17482
18043
13777
17396
13778
17395
13891
16128
17820
13892
16129
17821
15025
18265
15026
18266
13533
14209
15208
13534
14210
15207
14512
14520
14673
14513
14519
14674
14079
14080
13321
13322
13419
18016
13420
18017
13266
14744
16529
13267
14745
16530
14387
18124
14388
18123
15288
14121
17654
14122
17655
14083
14254
14084
14253
15170
15872
15171
15873
13133
13181
13134
13182
13444
15865
17718
17814
17719
17815
14970
15594
14971
15595
14557
13437
16220
13043
13044
13779
14889
14975
13780
14890
14974
13085
15531
13086
15530
15016
17320
13648
15524
15623
13649
15525
15624
14112
14111
15898
18109
15899
18110
14305
14304
13280
13281
16578
13138
13523
16892
16893
14525
14526
13257
13258
17653
17652
13624
14419
13512
15561
14685
14686
13338
16329
13339
16330
14035
14760
16791
14036
14761
16792
13763
13764
13317
14088
13318
14087
14049
15988
15987
13317
17567
13318
17566
14075
14336
14074
14337
14085
15882
14086
15883
16461
14833
14834
18252
18253
15699
16628
15188
15187
13962
13963
14491
15797
14492
15798
16803
14520
16680
14519
16679
14862
14861
14236
14237
17217
16819
17026
14115
15562
14116
15563
15381
15380
13372
16583
13370
13925
13371
13926
16487
13483
16996
16838
16923
13464
16602
13463
14023
14154
14292
13264
14932
13265
14931
14477
15321
13958
13957
14730
14731
14478
15334
13583
13842
15107
13843
15108
13167
13166
17566
17567
13421
15982
16924
16925
13398
13399
16805
16804
13434
13564
16368
13435
13565
16369
17746
17747
13562
13563
14243
14341
14244
14342
14926
16760
14925
16761
14260
14259
13268
13269
17581
17580
14611
16739
14612
16740
13627
13626
13644
14206
13645
14207
15572
15573
15649
17825
15650
17824
14841
14842
13697
13696
13301
15755
13302
15754
16980
18422
13376
13557
13377
13556
13746
15471
15878
13747
15472
15879
13562
18130
13563
18131
14368
18067
13347
13348
13663
15178
13664
15177
16854
16853
16635
16634
17000
17764
16999
17765
13601
14452
13602
14451
14576
16839
13980
15125
16667
18329
18330
13303
14348
14349
15840
15839
14306
14307
13570
13571
15207
15208
14190
13668
13669
15329
18229
15328
18230
14858
14857
14635
15493
14634
15492
16100
16101
13793
14428
13794
14429
16940
18348
13249
13408
13250
13409
14340
18328
13535
15521
16358
15699
16950
15310
17150
15311
17151
15625
15626
13336
13515
18007
13337
13516
18006
14348
14462
14349
14463
15181
15182
15053
15197
17574
15054
15198
17573
14700
18167
14701
18166
13402
14437
18358
13403
14447
18363
13791
17721
13792
17720
17349
17350
18331
13700
14824
13927
14263
17058
17131
14264
17059
17132
17243
17244
13672
13673
16984
17551
16983
17550
13825
14783
13824
14784
17485
17497
17486
17498
14176
16962
18134
13896
16736
13897
16737
16155
16156
13932
16485
16781
16484
16782
13336
13519
13337
13520
14391
14392
13955
17973
13956
17974
13530
13852
15270
17261
14213
16840
14214
16841
14099
16780
16985
13367
13368
16385
17756
16384
17757
14124
15486
15729
14125
15487
15730
13609
16523
13610
16524
13351
13352
13844
15938
17185
13845
15939
17186
17431
18105
18106
16965
16964
16210
16211
14957
14958
14377
16994
14378
16995
17275
15978
15979
13413
13506
13414
13507
15315
15316
15405
15908
16114
15406
15909
16115
16265
16264
18182
18181
13799
16658
13800
16659
14233
16514
14234
16515
17967
17968
13395
14088
13396
14087
13615
16619
15649
15650
16615
16973
16972
16912
18349
13710
13711
13558
17362
13559
17363
14021
15134
14022
15135
13398
13723
13399
13724
15239
13672
13673
14024
16597
14025
16596
18288
18289
13648
13649
17111
17112
13971
15174
14119
14120
15050
18027
15049
18026
18347
18346
15854
15855
16377
16918
16755
16754
16645
18228
14904
14905
14172
14208
15857
15858
13980
14245
15152
14853
16314
14854
16315
17074
17075
13547
13774
14906
17084
17083
13763
17044
13764
17043
18067
13823
14734
14314
14289
14535
14288
14536
15370
18216
15723
17268
17608
17609
14017
17672
17673
13541
13542
15048
13690
14018
16675
13691
14019
16676
13637
16864
14410
14411
14499
16667
16447
16448
13622
13621
14007
14008
13940
14888
13941
14887
15163
15164
15326
15327
17256
13867
14097
13868
14096
14707
17385
14708
17384
17342
17710
17343
17709
15881
14037
13588
15490
18084
13589
15491
18085
17853
17854
14946
14945
14040
14276
13818
15081
14275
14397
14276
14398
14558
15205
14559
15206
13650
16987
13651
16988
18170
18169
16488
16489
15959
15960
16874
16875
18344
18345
14379
15435
14380
15436
13538
16089
16090
16550
17084
17083
13741
16543
14743
15721
17567
15722
17566
16990
16991
15256
15475
16718
16717
13857
16165
13858
16164
13762
14369
13929
14370
14562
14620
14563
14621
18049
14924
15444
14923
15443
14749
14748
14638
16944
14639
16945
17127
18024
17128
18025
15216
15215
17546
17547
15223
15224
16854
16853
16448
16447
17263
17143
18285
17142
18286
15657
13989
17487
13990
17488
16271
16272
13924
14247
18379
18301
18302
16356
16357
15104
15103
15992
15993
16504
16505
14201
18140
14033
14826
14034
14825
14362
16672
14363
16673
13639
16253
13640
16254
14323
14797
14091
14092
16664
18214
13655
16237
13656
16236
13905
15617
17257
15618
17258
15442
15441
15256
17944
14503
18049
17472
17471
15698
16489
15697
16488
16786
16785
14901
15169
14902
15168
14570
16252
17009
17010
17388
14498
16568
14497
16569
18065
18066
17455
17456
15946
15945
16464
16465
14165
17032
15350
17144
15351
17145
13687
14635
13686
14634
14406
15714
17367
14308
14309
16170
16171
13773
16904
16905
15918
15919
14454
14453
17628
17627
14871
14872
13992
14298
16141
13991
14299
16142
14438
14439
13797
14779
13798
14778
14011
14012
17094
13918
14352
13919
14353
16966
16967
13974
13975
17890
17711
13740
14059
14428
13739
14060
14429
14052
14053
14123
14537
13732
13733
13898
16270
13899
16269
13955
14199
15695
13956
14200
15696
15801
15802
14173
14174
13736
14374
14043
14044
14896
14897
15787
15786
13833
15360
15301
15302
17810
17811
17319
16892
16893
15995
16681
14504
16530
14505
16529
14519
17753
14520
17752
17209
17271
17210
17270
17057
15674
17069
13871
13872
14140
15580
17413
14141
15581
17414
14516
15931
15236
15235
17020
17021
17031
14104
17723
17722
14131
17388
15634
14636
15822
14637
15823
14109
16890
14110
16891
15027
16738
15764
15765
13863
13864
16381
16382
14676
15401
14677
15402
17007
17772
17008
17771
17855
17856
16289
16288
14328
14327
17361
17360
14470
16808
14471
16809
14562
17685
14563
17684
15936
15937
14118
14993
14117
14992
16373
17602
16374
17603
17842
17841
14767
17801
14766
17802
15006
14432
16438
14433
16437
17150
17306
17151
17307
14521
14290
18254
14291
18255
14321
14938
14322
14937
16211
16210
14894
15830
18101
14895
15831
18102
14647
17201
14648
17202
13910
14622
14455
15339
14456
15338
13895
14117
14118
16827
16312
17783
16313
17784
15628
15629
16153
16154
15278
14136
14185
15732
14137
14184
15733
14275
14386
14560
14604
16399
16519
14605
16400
16520
15219
16193
18179
15220
16194
18180
14898
16427
14899
16428
14341
16310
18178
14342
16311
18177
14144
14145
17781
17780
17102
17463
17103
17464
14142
17100
14143
17099
14645
14646
16942
16943
16473
16474
17292
17884
17291
17883
17986
17439
14357
16635
14356
16634
14114
15146
16455
16806
16807
15464
16508
15463
16509
13928
14032
15129
14384
17095
14385
17096
17638
17639
14606
15021
16384
16796
16385
16795
14169
16417
16472
17064
17205
14374
16669
17610
17611
14577
14980
14956
15708
17681
14955
15709
17680
13936
17873
13937
17874
14228
16555
17249
18252
17248
18253
14502
18228
13995
17356
13996
17357
17641
18137
17640
18136
17257
17258
18004
18404
13951
13952
17410
14940
14054
14184
14055
14185
15091
18247
14988
14989
15906
15907
15297
15298
14672
14920
14671
14919
14017
15651
14588
15748
14589
15747
16527
17628
16528
17627
15649
15650
17752
17753
14241
14476
14985
14855
14856
14261
14262
14524
14965
14510
14768
16012
14511
14769
16013
14768
14769
14506
14881
14880
16921
16922
14289
14574
16942
14288
14575
16943
15679
14087
17679
14088
17678
15101
18136
15100
18137
13999
14000
17076
17503
17077
17504
17750
17751
15363
15364
14007
17806
14008
17807
18143
14181
16268
15526
15527
15662
15663
14893
15021
16573
18235
17070
17872
17071
17871
14506
15989
17939
17940
14736
15445
14737
15446
14598
18132
15775
16579
15776
16580
16273
16274
15770
15769
18260
16271
16272
17946
17947
16053
16267
16054
16266
16634
16635
15082
17711
16773
16774
14933
14934
16184
17106
16015
16014
15576
17925
15577
17926
15888
17954
15887
17953
17671
17670
14750
14751
14152
14555
14153
14556
14873
15009
17722
15008
17723
18402
18403
14576
15971
14669
14943
17841
14670
14944
17842
14875
16079
16434
14876
16080
16435
18405
18406
16512
16513
17089
17260
17090
17259
14942
14941
15536
17905
15537
17906
14604
15042
16765
15043
16766
14873
14874
14539
14587
16524
14538
14586
16523
14479
16676
14480
16675
15283
15284
16191
16192
17857
17858
15455
15456
14743
14269
14890
14270
14889
16074
16073
14503
17924
16677
16678
15001
16633
15002
16632
15460
17204
15459
17203
14787
14800
15542
14788
14799
15541
16042
16043
14910
16791
14909
16792
14756
14757
16811
16810
14489
14488
18068
18069
16246
16245
16397
16629
16398
16630
14362
15630
14363
15631
14627
16618
16674
17219
17878
15409
17220
17879
14484
14485
15951
14947
15808
14948
15809
15942
14208
14886
18389
16478
17055
16479
17056
16229
17026
15075
15289
17606
15076
15290
17607
18259
18258
15008
15009
16280
16034
16035
14453
14454
15645
16754
15646
16755
16570
17274
17306
17307
15160
17973
15159
17974
16539
15948
15949
15909
16968
15908
16969
16895
16896
14659
14660
14650
14764
14765
15332
15348
15333
15349
16002
16003
15651
16932
14923
15443
14924
15444
15500
17038
17919
17434
18279
18278
18132
17247
17382
15473
15785
15358
15474
16057
16058
14730
14841
17791
14731
14842
17792
18383
18382
14833
14834
14976
16817
14977
16816
15099
15098
14319
14320
14998
14997
14424
15636
17362
14425
15635
17363
15062
15063
15346
15347
14643
15040
14644
15041
18325
18326
17475
17476
16650
16649
18353
18352
14382
16753
14383
16752
16827
14502
16550
14800
14799
14440
15178
14441
15177
16359
16358
14356
14357
14685
14686
14466
17368
14467
17369
14311
14313
16607
16212
17702
16213
17703
14618
17081
14619
17082
16215
16214
14808
14809
16455
14514
16144
14515
16143
15077
16147
14529
14762
14530
14763
16390
16391
15694
14921
15014
14922
15015
14548
14929
14549
14930
18378
18377
16888
16887
16878
14435
14436
15152
14634
15719
14635
15720
15547
15553
15548
15554
15781
15782
14430
14431
17140
17141
16180
16181
14525
17338
14526
17337
17754
17755
16912
15253
15833
15254
15834
17284
17572
14992
16948
17673
14993
16949
17672
16451
16452
14606
16220
14860
14859
17987
17988
15123
15124
15448
15449
14907
16202
16348
14908
16203
16349
15062
15063
16377
14821
15022
15742
14636
15452
15852
14637
15453
15853
16339
14561
15956
18092
18091
14653
14654
14828
15730
14827
15729
15233
15234
16685
17724
14568
14569
15276
16019
16234
15277
16020
16235
14670
15114
14669
15115
16363
16362
18391
18392
17714
17715
18322
17341
17340
14785
14867
15040
14786
14868
15041
15048
15255
15047
15046
18324
17412
17411
17435
14971
14970
17348
17347
14552
15643
15661
14692
16513
14693
16512
15644
15667
16458
16457
18159
18158
15344
15345
15796
16059
16963
16720
16721
14949
17850
14950
17849
15283
16541
15284
16542
16863
17871
16862
17872
14600
15767
17102
14601
15766
17103
16618
16960
15524
15525
15375
15376
17961
17962
14689
17629
14690
17630
14814
14815
14849
14850
17110
17269
18097
18098
15260
17870
17869
16610
17324
17323
15514
15416
15417
14780
15113
14790
15564
16407
14791
15565
16408
15742
17378
17379
14625
15737
14626
15736
15166
15691
17532
15167
15690
17531
17399
17400
15313
15314
15845
16941
15756
14558
14983
14559
14984
16057
16992
16058
16993
14630
14631
14960
15494
15495
17803
17804
14605
14742
15788
15789
14821
15144
15145
14953
17636
14954
17637
16733
16732
18149
16489
16488
14940
15880
15724
15725
15068
15069
14933
17122
14934
17123
17548
17549
14839
14898
14840
14899
15607
16052
17333
15089
15090
14822
15452
14823
15453
17057
16834
16835
14701
14700
14911
14915
16055
14912
14916
16056
15293
17907
15294
17908
15616
15615
17023
17022
16370
16518
14978
14979
15144
15145
17849
17850
16482
16483
14797
16803
16969
17343
16968
17342
14783
14784
16829
16828
14870
14869
14717
14785
14718
14786
14661
14662
16716
16715
15278
15607
16838
15046
15528
17182
15047
15529
17181
15666
15042
17783
15043
17784
15539
15540
16279
16278
15963
16175
15964
16174
14880
16388
14881
16389
14792
14715
14714
14717
14773
14718
14772
17231
17232
14955
15757
14956
15758
14704
15447
17524
14951
14952
14971
15286
14970
15285
17785
15512
15513
14822
14917
14823
14918
14812
16158
14813
16157
16038
16039
16380
15136
15137
17250
17251
14724
15373
14725
15374
14732
14733
15003
16878
18328
17125
17126
16370
17383
16494
16495
14762
16763
17009
14763
16764
17010
15130
15131
15392
16128
15391
16129
15700
15058
15454
18282
16055
16056
15804
18236
17045
17046
14767
14766
14854
14853
15813
18087
15812
18086
16378
16379
15373
15374
15368
15369
14910
16309
14909
16308
16253
16254
16037
16036
15132
15133
14991
15225
14990
15226
15031
15437
15032
15438
14887
15963
16068
14888
15964
16069
17801
17802
15821
17377
18199
18200
16050
16051
15161
15162
15399
17523
15599
15600
15140
18098
15141
18097
15871
15165
18323
16112
16113
15061
16059
14831
15035
14832
15036
17473
17474
14853
15024
14854
15023
15882
17933
15883
17934
17956
17955
16336
16335
16686
17882
14838
17652
14837
17653
14960
18038
14959
15777
14835
14836
16664
18127
17593
17594
15486
15487
15670
15671
15390
15389
15658
16521
15659
16522
17643
18276
17642
18275
17052
17051
15743
15744
15613
17129
15614
17130
14978
16656
17725
14979
16657
17726
15145
16340
15144
16341
14865
17618
17858
14866
17619
17857
16195
16196
18024
18025
15391
15392
15191
15532
15192
15533
17104
17105
18141
18142
15118
15477
15119
15476
16975
16974
15488
15928
15489
15929
15147
18105
15148
18106
15317
16345
15318
16344
16864
15595
15594
14997
14998
15503
15502
15257
17019
17018
17190
18141
18142
15399
17931
17932
17924
15396
15397
16867
16866
15890
16736
15891
16737
16408
16407
16413
16414
15087
17079
15088
17080
16170
16171
18284
18283
15049
18057
15050
18058
15048
15509
15510
16987
16988
16077
16078
17179
17180
17234
17233
15682
15683
17278
17279
17668
14999
16871
15000
16872
15856
15410
17803
15411
17804
15645
15646
15441
15442
16218
17472
16219
17471
15734
15735
15112
15356
15111
15357
15967
15968
16938
16937
15052
15051
17856
17855
15685
15684
16518
17383
15443
15444
15910
15911
15340
15341
17481
17928
16920
16919
15020
17275
15447
15568
17587
18006
15569
17586
18007
16413
17146
16414
17147
15516
15870
15952
15953
15312
17219
17220
16961
15240
15241
15142
15147
17200
18109
15148
17199
18110
17431
16299
16300
15940
17185
15941
17186
16367
16366
15801
17286
17505
15802
17285
17506
15871
16455
16573
16894
16138
16560
16561
15832
17462
15291
15465
15292
15466
18113
16725
15557
15558
17114
17939
17113
17940
15723
17268
16259
18184
16260
18183
16432
16433
16012
16013
17588
17589
16913
16936
15673
15672
17844
17845
15439
16116
15440
16117
15336
15478
15335
15479
15562
15563
16119
16919
16118
16920
15677
16148
15678
16149
16182
15578
15579
15116
17150
15117
17151
16978
17980
16979
17981
16628
18322
17106
18324
16906
17119
16907
17118
16612
16988
16987
17306
17307
16639
16640
15165
17305
15307
17284
15570
16728
15571
16729
15820
15974
15819
15975
16422
16423
15969
16814
15970
16815
16614
16613
17347
17348
17932
17931
15666
15272
17612
15395
17122
17123
16959
16958
15839
17352
15840
17351
15898
16970
17597
15899
16971
17598
17428
17427
16560
16561
18222
17911
17910
16378
16379
15508
17069
15484
15485
15655
15656
15380
15381
15199
15619
15200
15620
15457
18150
15458
18151
17917
17916
15352
15353
17833
17834
15844
17589
15843
17588
16172
16173
16120
17517
16121
17518
15566
15567
15980
16291
15981
16290
17688
17689
16142
16753
17806
16141
16752
17807
16384
17571
16385
17570
17750
17751
15351
15875
15350
15876
16047
16048
16910
17003
16911
17004
15675
16462
15676
16463
16439
16440
15792
17509
15793
17510
15865
15599
18150
15600
18151
15253
16544
15254
16545
15900
15572
15573
15528
17729
15529
17728
15866
17322
15867
17321
15746
15745
15871
16674
15382
18148
15361
16014
15362
16015
18392
18391
16826
17093
17928
18195
18194
16134
16135
17870
17869
15312
16907
16906
16772
15851
15850
15826
16832
15827
16833
15638
15680
15637
15681
16612
15749
15750
17264
17775
17265
17776
15598
16049
15785
16016
16496
16525
16526
15812
15813
15682
15683
17853
17854
16044
15387
15686
15388
15687
16360
16361
15845
17725
17726
15852
15853
16576
17286
16577
17285
15773
15774
17029
18152
16027
17092
16028
17091
16477
16476
16824
18020
16823
18021
15428
18203
15429
18204
15601
17592
15602
17591
15996
16074
15997
16073
17030
18153
18249
18248
16570
17482
15576
17714
15577
17715
15647
15759
15648
15760
17479
17901
17480
17900
15702
16481
15701
16480
15825
16090
15824
16089
16701
16702
16958
16959
15837
16060
16080
15838
16061
16079
16114
16115
16016
16855
16255
16812
16256
16813
15901
16033
15762
16567
15761
16566
17000
17483
16999
17484
17559
15932
16097
15933
16096
17746
17747
16895
17295
16896
17296
15383
15522
16688
15384
15523
16689
16075
16847
17590
16873
17883
17884
15401
15895
15402
15894
15433
15434
15945
15946
16461
16836
16837
17154
15763
16305
15439
15440
16761
17230
16760
17229
17837
18070
17838
18071
16420
16421
17955
17956
17911
17910
16858
18055
16859
18056
17020
17021
15985
17582
15986
17583
16971
17425
16970
17426
16025
16026
18112
18111
17797
17798
15538
17067
17068
17448
17449
15903
15902
17155
15786
15794
15787
15795
15529
15738
15528
15739
15822
15823
16889
16034
16035
16168
16169
15580
15581
17985
17984
15648
15647
15864
17423
15863
17424
18042
18041
18120
16027
16028
15590
17229
15591
17230
16264
17199
16265
17200
16786
17517
16785
17518
15816
15815
15719
15720
16481
16480
16053
17016
18115
16054
17017
18114
15717
16818
15718
16820
17633
17391
17392
17826
17827
15766
15948
15767
15949
17622
17732
15669
15668
17805
18362
18385
18236
15803
16150
16783
17527
16784
17528
16014
16100
16015
16101
16646
18140
15965
15966
15887
17699
15888
17698
16060
16061
17415
17416
16221
16222
17661
15794
15936
15795
15937
16159
16468
16160
16469
15922
16594
15923
16595
17414
17413
15799
15808
16017
15800
15809
16018
16187
16525
16188
16526
16978
17975
16979
17976
17670
17671
17015
17309
17014
17310
17167
16050
16051
16981
16982
17460
17461
16814
16815
16132
16317
16133
16318
15692
15693
15976
16120
17168
15977
16121
17169
15976
16176
17616
15977
16177
17617
17207
17208
15738
17179
15739
17180
15998
16528
15999
16527
15680
15681
15892
17736
15893
17737
15856
17966
17965
16009
16957
16010
16956
17272
17273
16153
16356
16154
16357
17923
16492
16493
17337
17338
16312
17783
16313
17784
17058
17059
17089
17090
16933
15688
15689
16498
17693
16499
17692
15934
17562
17675
15935
17563
17674
16029
16692
16030
16693
16699
16758
16698
16759
15847
16397
15848
16398
16321
16440
16322
16439
15719
15720
15827
15826
16238
16897
17189
16126
18018
16127
18019
15901
16453
16700
15874
16644
17138
17859
17139
17860
16578
16765
15751
16766
18067
15877
16643
16686
17622
15884
15885
17712
17713
15982
16856
16857
18166
18167
16087
18176
16088
18175
17115
17823
17320
17904
16274
16308
16273
16309
16395
16396
17488
17487
15837
18212
15838
18213
15979
16332
16982
15978
16331
16981
16339
16290
16291
16887
16888
15896
15897
16076
16625
16624
15894
15895
17035
17101
17075
17074
17081
17082
17181
17182
16000
16001
16653
16021
16022
16358
16359
16095
16164
16094
16165
16138
16070
16885
16071
16886
18065
18066
18193
18192
16356
16500
16357
16501
17243
17244
16900
16901
16540
16291
16290
16375
16376
15934
17694
15935
17695
16371
16372
16940
17633
15916
16796
15917
16795
16647
17118
16648
17119
15916
17880
15917
17881
16887
16888
16713
16714
17864
17863
16134
16135
17612
16373
17327
16374
17328
17608
17609
18207
18208
16825
16354
16468
16355
16469
16556
16557
15931
16437
16438
18022
18023
17055
17056
17449
17448
16540
16544
16545
17147
17146
15914
16533
16890
15915
16534
16891
16189
18074
16190
18073
16818
16221
17905
16222
17906
16820
16137
16136
16360
16763
16361
16764
17346
16085
16086
16066
16471
16067
16470
16607
16430
17283
16431
17282
16150
17773
17896
16335
16336
17774
17897
16063
16062
15889
16163
16686
16204
16205
16724
16955
17339
16185
17539
16186
17540
17200
17199
17986
18028
16125
16258
16124
16257
16064
16222
16065
16221
17650
17651
16087
16088
16077
16548
16078
16549
18087
18208
18086
18207
17072
17073
16314
17706
16315
17707
17894
17902
17895
17903
16867
16866
15944
17483
15943
17484
16608
16609
16305
17696
17697
17768
17769
17177
17178
16150
16250
16251
16537
16538
16249
17922
16380
16429
16281
16282
16738
17301
17302
17759
17760
16236
17224
17398
16237
17225
17397
16553
16554
16603
16604
17064
16462
16958
16463
16959
16557
16556
17610
17611
16261
16262
16588
16589
17038
17794
17793
17124
17777
16278
16682
17236
16279
16683
17235
17053
17883
17054
17884
16456
17944
18209
17943
16623
16622
16346
16347
16094
16294
18210
16095
16295
18211
16932
17032
17766
18298
17767
18299
16868
17579
16077
16078
16558
18125
16559
18126
17808
17809
16704
16703
16640
16639
16166
16167
16613
16614
16825
17101
17684
17685
17909
16118
16433
16119
16432
18277
16210
16211
16772
18364
16124
16125
17960
17959
16178
16870
16179
16869
16293
16292
16857
16856
17247
17633
17137
16233
16232
16812
17929
16813
17930
16422
16423
18240
18241
16377
16324
17828
16325
17829
16303
17490
16304
17489
17100
17099
16195
17746
16196
17747
16420
16934
16421
16935
17419
17420
16647
16648
17664
17665
16405
16406
16747
16746
17005
17006
16502
16503
16645
16646
17351
17352
16779
17339
18309
18310
16401
18088
18215
18409
17299
17300
18203
18230
18204
18229
16354
16355
16669
17846
16328
18355
18356
17506
17505
16441
16442
16283
16284
16331
16332
18146
18147
16421
16420
16498
16499
17708
17333
16208
16209
17553
17552
16990
16991
17606
17607
17991
17992
16494
16600
16495
16601
16350
16531
16351
16532
18220
18410
16641
16642
17501
17502
16860
16861
17796
17795
16396
16395
16419
17497
16418
17498
16230
16231
16814
17701
16815
17700
16944
17787
16945
17786
16591
17694
16590
17695
17693
17692
16326
16743
16327
16744
17118
17417
17119
17418
17451
17450
16496
16523
16524
16946
16947
17254
17969
17255
17970
17412
17411
18082
18081
17765
17764
16539
18319
18318
16620
16621
16411
16412
16619
17598
17597
17717
17716
16504
16505
16687
17335
17660
16409
16410
16819
16342
16343
16426
16767
17790
16677
16678
16717
16718
16662
17022
16663
17023
18317
16562
17892
16563
17893
16801
17130
17155
16802
17129
17154
17886
17885
16823
17917
16824
17916
17174
17173
17998
17997
16461
16585
16584
16569
17436
16568
17437
17898
17899
17590
18415
17862
17861
16823
17960
16824
17959
17261
16848
16849
16407
16408
16366
16367
16702
16701
16787
17277
18124
16788
17276
18123
17208
17207
16391
16574
16390
16575
17109
17108
16672
18053
16673
18054
17250
17251
16829
16828
18341
18340
17830
17690
17691
17221
17869
17870
16865
17218
18127
17492
18411
16497
16838
16649
16650
16740
16739
17264
17265
16985
16986
16424
16425
16962
17262
17394
17393
16722
17458
16723
17459
18213
18212
17162
17161
16660
16661
17413
17414
16726
16727
17035
17334
17920
18099
17921
18100
16919
16920
17146
17628
17147
17627
17184
16622
16623
16602
17376
16961
17491
17822
18280
18281
17101
16719
17110
17348
17347
17704
18251
17705
18250
16750
17977
16751
17978
16662
16663
17035
18325
18326
17353
17785
17935
17401
18294
17402
18295
16947
16946
16939
17936
16827
16914
16915
17070
17071
18379
16923
17299
17476
17300
17475
17929
17930
16997
16998
17033
17034
16627
17437
16626
17436
17511
18259
17512
18258
16770
16817
16771
16816
16902
17005
16903
17006
17442
17539
17443
17540
17011
17012
16730
16731
16804
16984
16805
16983
17127
17344
17128
17345
16864
16996
16890
16891
17336
18228
17273
17272
17904
18034
18035
17949
18048
17948
18047
16627
16626
18120
16789
16790
16938
16937
17864
17863
16894
17819
17818
17457
16748
16784
17561
16749
16783
17560
17409
17996
17408
17995
16616
16617
17778
17779
17840
17839
16848
16849
16970
16971
18378
18377
16816
17060
16817
17061
18030
18029
16684
17069
17206
17668
16747
17686
16746
17687
17267
18366
18365
18383
18382
18419
17205
17435
16851
16852
17731
17730
17616
17617
17534
17533
16670
17999
16671
18000
17041
17121
17042
17120
16997
16998
17240
17239
17950
16992
18164
16993
18165
16674
17078
18198
17809
17808
17632
17631
17753
17752
17661
17124
16897
18300
17039
17250
17040
17251
18234
18233
17005
17006
16741
17630
16742
17629
17744
17745
17425
17598
17676
17426
17597
17677
18217
17579
17599
17672
17673
17698
17699
17099
17232
17100
17231
18364
17204
17203
16981
16982
17031
17701
17700
17575
17576
17369
17900
17368
17901
16974
18021
16975
18020
17500
17499
17015
17971
17014
17972
17323
17324
18413
17378
17379
17049
17050
17388
17868
17867
17373
17372
17088
17839
17087
17840
16842
16843
17319
18187
17316
17315
16794
17501
16793
17502
17024
17025
17213
17214
17132
17131
17171
17172
17635
18098
17634
18097
16972
16973
17330
17329
16830
16831
17945
17595
17596
17157
17158
17446
17975
17447
17976
17785
16854
18044
16853
18045
18046
17909
17382
17922
18199
18200
17217
17014
17015
17067
17068
17886
17885
17360
17631
17361
17632
17222
17223
17599
16934
17423
16935
17424
17741
18055
17742
18056
18216
18237
17125
17487
17126
17488
17572
17475
17476
18002
18227
17183
18008
17110
18311
17188
18011
16930
16931
18332
18333
17246
17245
18350
17235
17236
17065
17066
17420
17419
18096
18095
17295
17296
17877
17135
17136
18351
17047
17048
17033
17620
17749
17034
17621
17748
17222
17223
18005
17943
18395
18396
17263
17247
17364
17365
18199
18200
18017
18016
18419
17002
17614
17001
17613
17391
17851
17392
17852
17319
17686
17687
17156
18241
18240
17254
17349
17763
17255
17350
17762
18083
17331
17332
18088
17461
17460
18061
17548
17549
17537
17538
17045
17046
17491
17716
17847
17717
17848
17051
17052
17430
17429
17097
17098
18133
18135
17170
17584
17585
18425
18304
18305
17495
17496
17291
17292
17455
17456
17372
17373
17465
17861
17912
17466
17862
17913
18315
18316
17941
17942
17257
17258
18178
18177
17404
17403
17267
17234
17233
17304
17303
17375
18309
17374
18310
17113
17664
17114
17665
17353
17308
17735
17287
17288
17507
17508
17366
17174
17173
17144
17450
17145
17451
18313
18312
17823
17332
17331
17375
18291
17374
18292
18107
18108
17680
17681
17523
17524
17198
17197
17907
17908
17184
18254
18255
17317
17318
17821
17820
17301
17302
17493
17494
17256
17912
17913
17469
17564
17470
17565
17384
17385
17419
18070
17420
18071
17301
17529
17302
17530
17477
17478
18242
18225
18226
17311
17312
17845
17844
17358
17359
18153
18014
18015
17334
18152
18247
18291
18292
17352
17641
17712
17351
17640
17713
17446
17980
17447
17981
17329
17330
18308
17377
17356
17357
17429
17987
17430
17988
17269
17951
17952
17531
17709
17532
17710
17262
18248
18249
17400
17399
17497
17498
18107
18179
18108
18180
17297
17298
17276
17277
17755
17754
17669
18284
18283
18083
18168
18386
17411
17412
18221
18385
18032
18033
17427
17658
18337
17428
17659
18336
17444
17445
17522
17521
17560
17561
17595
17818
17596
17819
17665
17793
18218
17664
17794
18219
18014
18015
17604
18079
18080
17424
17860
17423
17859
17477
17478
17529
17530
17525
17948
17526
17949
18248
18249
17602
17603
17354
17355
18351
17346
17740
17646
17647
18242
17433
17432
18024
18025
18277
18418
18054
18053
17683
17682
18290
17790
17890
18154
18155
18263
18264
17889
17397
17857
17398
17858
18348
18078
18077
17544
17555
17545
17556
17519
17520
17780
17781
17619
17618
17444
17921
17445
17920
18038
17656
18273
17657
18274
17625
17626
18132
17591
17812
17592
17813
17616
18051
17617
18052
17542
17573
17543
17574
18189
18188
17767
17766
18124
18123
17531
18240
17532
18241
17482
18389
18354
17660
17770
18143
17578
18269
17577
18270
17703
17702
17678
17679
17669
17636
17963
17637
17964
17515
17516
17589
17588
17732
18001
17560
17561
17829
17828
17513
17514
18042
18041
17692
17693
18162
18163
17517
17518
18079
18080
17758
17764
17765
17741
17941
17742
17942
17727
18420
18085
18084
17527
17528
17702
17796
17703
17795
18233
18234
17623
17624
17728
17729
17568
17569
17893
17892
18057
18058
17876
17875
17644
18173
18360
17645
18174
18361
18169
18170
18168
18321
17562
17656
17563
17657
17725
17726
17999
18000
17903
17902
18327
17723
17722
18320
18427
17733
17734
18233
18234
17756
17757
18273
18274
18305
18304
18012
18013
17688
17689
18105
18109
18106
18110
18046
17818
17819
17669
17654
17655
17735
17878
17879
17867
17868
17727
18376
18375
17882
18144
18145
17931
17932
18181
18182
17841
17842
18250
18251
18117
18116
17720
18054
17721
18053
17873
17874
18407
18408
17789
17788
17973
17974
18399
17814
17946
17815
17947
17775
18201
17776
18202
17788
17958
17789
17957
17952
17951
17786
17787
17801
17802
17888
17887
17957
17958
18009
18010
17954
17953
17827
17826
18275
18276
17950
18137
18136
17925
17926
17946
17947
17944
18329
18330
17773
17774
18004
18314
18003
18349
18031
17937
17938
17833
18264
17834
18263
17770
18221
18410
17812
17813
17761
18007
18006
17928
18418
17873
17970
17874
17969
17887
17888
18028
17894
17895
18148
18409
17979
17808
17809
18019
18018
18155
18154
17989
17990
17962
17961
18386
18254
18255
17835
17836
18297
18296
17891
18091
18092
18010
18009
18043
18134
17875
17876
17853
17854
18176
18175
17939
17940
18031
17849
17850
17927
18327
18271
18272
18262
18261
17984
17985
18395
18396
17982
17983
18001
17898
17899
17972
17971
18284
18283
18201
18202
18415
18194
18195
18022
18023
17994
18093
17993
18094
17959
17960
17936
18425
18064
18260
18049
18072
18319
18318
18030
18029
18412
18217
18048
18047
18055
18056
18328
18413
18094
18093
18059
18060
18243
18306
18244
18307
18084
18085
18079
18080
17980
17981
18091
18092
18016
18017
18002
18270
18269
18107
18108
18047
18048
18059
18118
18060
18119
18041
18042
18160
18161
18336
18337
18196
18197
18057
18058
18253
18252
18156
18157
18099
18164
18100
18165
18187
18075
18238
18076
18239
18389
18130
18131
18260
18125
18146
18126
18147
18217
18114
18246
18115
18245
18348
18229
18230
18275
18276
18121
18274
18122
18273
18146
18147
18211
18346
18210
18347
18171
18172
18317
18170
18169
18226
18225
18164
18165
18158
18159
18222
18206
18205
18144
18302
18145
18301
18140
18238
18239
18214
18183
18184
18361
18367
18360
18368
18166
18167
18194
18195
18314
18256
18257
18416
18323
18265
18266
18367
18368
18238
18239
18268
18267
18334
18335
18369
18370
18278
18279
18315
18316
18207
18208
18263
18264
18245
18246
18267
18268
18334
18335
18293
18356
18355
18224
18312
18313
18362
18287
18290
18320
18303
18424
18340
18341
18349
18390
18416
18315
18316
18300
18407
18408
18306
18307
18330
18329
18373
18374
18300
18352
18353
18287
18297
18296
18323
18325
18326
18309
18310
18336
18337
18338
18339
18339
18338
18354
18351
18364
18404
18414
18386
18384
18344
18345
18379
18399
18393
18394
18387
18388
18391
18392
18380
18381
18400
18401
18402
18403
18397
18398
18405
18406
18398
18397
18398
18397
18404
18412
18420
18417
18421
18426
18420
18427
18428
18424
18427
)
// ************************************************************************* //
| [
"sunnyerteit@gmail.com"
] | sunnyerteit@gmail.com | |
7bf77a47b9d32ad30a104ce2b9db080c32a44976 | ca6bd610702aaee6c508d3de9151c097728bb3ce | /Libraries/include/ATRAP_Trap_Quantities/Template_Impl/Interpolators.hpp | fd1ea6a0fb23cfd0d1cee600616ed6f347cd0cbe | [] | no_license | n09jones/Hbar | ca199b7f7e8b28bd71c467fc8a94d7318f9e2120 | 97af1af9c41e38a78a3c219cd56652339670628b | refs/heads/master | 2020-06-09T05:13:54.664816 | 2019-11-01T08:43:41 | 2019-11-01T08:43:41 | 193,377,143 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,941 | hpp | #ifndef INTERPOLATORS_HPP
#define INTERPOLATORS_HPP
#include <future>
/* interpolator_in_params class */
template <ig_nms::interp_type IT>
boost::filesystem::path interp_nms::interpolator_in_params<IT>::coord_grid_src()
{
return (interp_quant_src_dirs.begin()->second / global_nms::default_opts_fn);
}
template <ig_nms::interp_type IT>
std::string interp_nms::interpolator_in_params<IT>::header()
{
std::map<ig_nms::interp_type, std::string> it_to_str {{ig_nms::interp_type::zeroth, "ZERO-ORDER"}, {ig_nms::interp_type::lin, "LINEARLY"}, {ig_nms::interp_type::quad, "QUADRATICALLY"}, {ig_nms::interp_type::trilin, "TRILINEARLY"}};
return (it_to_str.at(IT) + std::string{" INTERPOLATED QUANTITY SOURCES"});
}
template <ig_nms::interp_type IT>
std::vector<pid_nms::param_info> interp_nms::interpolator_in_params<IT>::get_param_info()
{
std::vector<std::pair<std::string, ig_nms::interp_quant>> str_to_interp_quant {{"BdB", ig_nms::interp_quant::BdB}, {"B", ig_nms::interp_quant::B}, {"Bnorm", ig_nms::interp_quant::Bnorm}, {"acc_1Sc", ig_nms::interp_quant::acc_1Sc}, {"acc_1Sd", ig_nms::interp_quant::acc_1Sd}, {"acc_2Sc", ig_nms::interp_quant::acc_2Sc}, {"acc_2Sd", ig_nms::interp_quant::acc_2Sd}};
std::vector<pid_nms::param_info> param_info_vec;
for(size_t idx = 0; idx < str_to_interp_quant.size(); ++idx)
{
param_info_vec.push_back
({
std::string{"Interpolation Source Directory "} + str_to_interp_quant[idx].first,
((!idx) ? "All directory paths are relative to \"large_storage_dir\" in Global_Info.h. Exclude directories for unused quantities." : ""),
gqt_nms::fnc_false,
[str_to_interp_quant, idx, this](std::string str){if("" != str){(this->interp_quant_src_dirs)[str_to_interp_quant[idx].second] = (global_nms::large_storage_dir / boost::filesystem::path{str});}}
});
}
return param_info_vec;
}
template <ig_nms::interp_type IT>
void interp_nms::interpolator_in_params<IT>::post_read_ops(boost::program_options::variables_map)
{
grads = false;
std::vector<std::string> dummy;
ig_nms::ig_in_params tmp_in_params;
gqt_nms::fill_params(coord_grid_src(), tmp_in_params, dummy);
it = tmp_in_params.it;
if(IT != it) {throw interp_exc{"Improper interpolation type loaded"};}
}
/* sub_interp_data function */
template <ig_nms::interp_quant IQ, ig_nms::interp_type IT>
void interp_nms::sub_interp_data<IQ, IT>::import_data(const interpolator_in_params<IT>& iip, const cg_nms::cart_coord_grid& cg)
{
if(!iip.interp_quant_src_dirs.count(IQ)) {return;}
grid_idx_loc = cg.grid_size();
std::cout << "starting " << static_cast<int>(IQ) << std::endl;
ig.fill_contents(iip.interp_quant_src_dirs.at(IQ) / global_nms::default_opts_fn);
std::cout << "ending " << static_cast<int>(IQ) << std::endl;
if((iip.it != IT) || (iip.it != ig.in_params.it) || (cg != ig.coord_grid)) {
throw interp_exc{"Interpolation types must match"};
}
}
/* interp_data */
template <ig_nms::interp_type IT>
void interp_nms::interp_data<IT>::import_data(const interp_nms::interpolator_in_params<IT>& iip, const cg_nms::cart_coord_grid& cg)
{
std::vector<std::future<void>> futures;
futures.push_back(std::async(&interp_data<IT>::template sub_interp_data<ig_nms::interp_quant::BdB, IT>::import_data, this, iip, cg));
futures.push_back(std::async(&interp_data<IT>::template sub_interp_data<ig_nms::interp_quant::B, IT>::import_data, this, iip, cg));
futures.push_back(std::async(&interp_data<IT>::template sub_interp_data<ig_nms::interp_quant::Bnorm, IT>::import_data, this, iip, cg));
futures.push_back(std::async(&interp_data<IT>::template sub_interp_data<ig_nms::interp_quant::acc_1Sc, IT>::import_data, this, iip, cg));
futures.push_back(std::async(&interp_data<IT>::template sub_interp_data<ig_nms::interp_quant::acc_1Sd, IT>::import_data, this, iip, cg));
futures.push_back(std::async(&interp_data<IT>::template sub_interp_data<ig_nms::interp_quant::acc_2Sc, IT>::import_data, this, iip, cg));
futures.push_back(std::async(&interp_data<IT>::template sub_interp_data<ig_nms::interp_quant::acc_2Sd, IT>::import_data, this, iip, cg));
for(auto& e : futures) {e.get();}
}
/* interpolator class */
template <ig_nms::interp_type IT>
interp_nms::interpolator<IT>::interpolator(const boost::filesystem::path& opts_fn, size_t tot_parts, size_t part_idx)
{
fill_contents(opts_fn, tot_parts, part_idx);
}
template <ig_nms::interp_type IT>
void interp_nms::interpolator<IT>::fill_contents(const boost::filesystem::path& opts_fn, size_t tot_parts, size_t part_idx)
{
this->fill_in_params(opts_fn);
this->fill_coord_grid(opts_fn);
this->fill_out_params(opts_fn);
(this->data).import_data(this->in_params, this->coord_grid);
this->init_grid_position(this->coord_grid);
}
#endif /* INTERPOLATORS_HPP */
| [
"njones@boslogin03.rc.fas.harvard.edu"
] | njones@boslogin03.rc.fas.harvard.edu |
ca8f75178860ebcbbf5de40109b037bfe5007854 | 94c3702fdac1e5138cc6bbaf5d966a3daabb0823 | /Fibonacci Series (DP).cpp | ed5666cc474a29f505529c6cafbe8356cf965cfd | [] | no_license | arijitroy003/An-Algorithm-A-Day | 675933d1516c530a0fff31ef40a748054b547a0f | bf2757c86724acafc2c18dc7b582230ef7f6fb9e | refs/heads/master | 2020-03-31T14:04:50.703445 | 2018-05-14T15:13:03 | 2018-05-14T15:13:03 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 380 | cpp | /*input
10
*/
/*~ @author = dwij28 (Abhinav Jha) ~*/
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
int fib[51];
int pre() {
fib[1] = 0;
fib[2] = 1;
for (int i = 3; i <= 40; i++)
fib[i] = fib[i-1] + fib[i-2];
}
int main() {
pre();
int n;
scanf("%d", &n);
printf("fib(%d) = %d\n", n, fib[n]);
return 0;
} | [
"noreply@github.com"
] | arijitroy003.noreply@github.com |
bb5e842cf254f10af52f2d3d9fef33b9667ef7e8 | 7de4f4f6f121985fe1fba3d19087ee8dfa7c396b | /Src/Entity/svgnodeelement.cpp | 157ceb2b485cf5e1f5522d337e8ce2b58c98eec4 | [] | no_license | leiyongmmc/ElectricStudio1.0 | d48caea99ab251bfe9ec4cbc3fd420040f58a8d5 | 193bb701321513874ba5fa1ba641a616dbc9bd98 | refs/heads/master | 2020-05-20T14:06:24.923078 | 2014-08-05T22:45:46 | 2014-08-05T22:45:46 | 22,645,919 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,002 | cpp | #include "svgnodeelement.h"
#include "colortransformer.h"
#include "util.h"
SvgNodeElement::SvgNodeElement(SvgNode *parent)
:SvgNode(parent)
{
}
void SvgNodeElement::paint(QPainter *painter,
const QStyleOptionGraphicsItem *option,
QWidget *widget){
// Q_UNUSED(option);
// Q_UNUSED(widget);
SvgNode::paint(painter,option,widget);
QPen pen;
pen.setWidth(m_strokeWidth);
pen.setColor(m_stroke);
painter->setPen(pen);
QPointF center;
QList<QPointF> list = this->alignPoints(center);
QPointF offset = fixedOriginPoint() - m_frame.topLeft() - QPointF(m_strokeWidth / 2.f, m_strokeWidth / 2.f);
for each ( QPointF p in list)
{
p = Util::rotateWithCenter(p, center, -this->m_rotationAngle);
p = this->transform().inverted().map(p);
painter->drawEllipse(p, 2, 2);
}
center = this->transform().inverted().map(center);
painter->drawEllipse(center, 2, 2);
//painter->setBrush(m_fill);
// painter->rotate(m_rotationAngle);
}
| [
"leiyongmmc@163.com"
] | leiyongmmc@163.com |
56b587841eda1c26dd67ff996d2abd4717b5ce5e | f8c7ce738bd358054703f26c89308758caf0df50 | /OtherTopics/03TypeConversions/explicit.cpp | fdce50c7c700ea778b9159422a774e119a865de4 | [] | no_license | kdyakova/OOP_computer_labs_14-15 | 99fa93680547deac864df65d61c4ece22bf10e19 | 913aa73b543e9a82b0ac2d61df2b499b700b1350 | refs/heads/master | 2021-05-29T02:13:38.733858 | 2015-05-29T11:44:19 | 2015-05-29T11:44:19 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,652 | cpp | /*
II. Type casting (explicit conversions)
C++ is a strong-typed language. Many conversions, specially those
that imply a different interpretation of the value, require
an explicit conversion, known in C++ as type-casting.
There exist two main syntaxes for generic type-casting:
functional and c-like:
double x = 10.3;
int y;
y = int (x); // functional notation
y = (int) x; // c-like cast notation
These generic type-castings are enough for most conversions
with fundamental data types.
However, these operators can be applied indiscriminately on
classes and pointers to classes, which can lead to code that
-while being syntactically correct- can cause runtime errors.
For example, see below.
Unrestricted explicit type-casting allows to convert any pointer
into any other pointer type, independently of the types they point to.
The subsequent call to member result will produce either a run-time error
or some other unexpected results.
In order to control these types of conversions between classes,
we have four specific casting operators:
- dynamic_cast
- reinterpret_cast
- static_cast
- const_cast.
Their format is to follow the new type enclosed between angle-brackets (<>)
and immediately after, the expression to be converted between parentheses.
dynamic_cast <new_type> (expression)
reinterpret_cast <new_type> (expression)
static_cast <new_type> (expression)
const_cast <new_type> (expression)
The traditional type-casting equivalents to these expressions would be:
(new_type) expression
new_type (expression)
Each one of these have its own special characteristics.
See more in the different files.
*/
#include <iostream>
using namespace std;
class Dummy
{
double i, j;
};
class Addition
{
int x, y;
public:
Addition(int a, int b) : x(a), y(b) {};
int result()
{
return x + y;
}
};
/*
int main()
{
double x = 10.345;
int a, b;
a = int (x); // functional notation
b = (int) x; // c-like cast notation
cout<<"x: "<<x<<"; int (x): "<<a<<"; (int) x: "<<b<<endl;
Dummy d;
Addition * ptr_add;
//A pointer to Addition is assigned a reference to an object
//of another unrelated type using explicit type-casting
ptr_add = (Addition*) &d;
// not 0 if you comment the part with int and double ?
cout << ptr_add->result();
return 0;
}
*/
| [
"loloto.loloto@gmail.com"
] | loloto.loloto@gmail.com |
80b10f2d7dfa748cf7084fc5600612f03ec5e5bc | 57b8e526423469aa04449163f14e239f9529f455 | /hakase/loader16.cc | c6df6b04b4d737422616b2bc7bdfa33ee5d29331 | [] | no_license | mu-mu-mu/Toshokan | 2ca6760190580f8dac94e4dbe87ec1a9ed603670 | 4a17b43373f1a61f3f9b779cf7d43f04f544391b | refs/heads/master | 2020-12-20T15:09:11.786202 | 2019-08-13T02:47:16 | 2019-08-13T02:47:16 | 236,118,361 | 0 | 0 | null | 2020-01-25T02:57:20 | 2020-01-25T02:57:20 | null | UTF-8 | C++ | false | false | 1,179 | cc | #include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <sys/mman.h>
#include <toshokan/hakase/loader16.h>
#include <toshokan/memory.h>
#include <unistd.h>
int Loader16::Init(uint32_t entry) {
extern uint8_t _binary_hakase_friend16_bin_start[];
extern uint8_t _binary_hakase_friend16_bin_size[];
const size_t binary_hakase_friend16_bin_size =
reinterpret_cast<size_t>(_binary_hakase_friend16_bin_size);
if (binary_hakase_friend16_bin_size > PAGE_SIZE) {
// friend code is so huge
return -1;
}
int bootmem_fd = open("/dev/friend_bootmem" TRAMPOLINE_ADDR_STR, O_RDWR);
if (bootmem_fd < 0) {
perror("Open call failed");
return -1;
}
char *bootmem = static_cast<char *>(
mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, bootmem_fd, 0));
if (bootmem == MAP_FAILED) {
perror("mmap operation failed...");
return -1;
}
close(bootmem_fd);
// copy friend binary to friend region + 8 byte
memcpy(bootmem, _binary_hakase_friend16_bin_start,
binary_hakase_friend16_bin_size);
reinterpret_cast<uint32_t *>(bootmem)[1] = entry;
munmap(bootmem, PAGE_SIZE);
return 0;
}
| [
"sap.pcmail@gmail.com"
] | sap.pcmail@gmail.com |
96ea51440c5b45eeb9df98bd4e122b045a4875d1 | b42b2910678d815e9b407c4ee15374a70fb3756f | /Framework/Components/Objects/ObjHandle.h | b54570eb0e8d2156cdbb734d6dbb97f50d33a29e | [] | no_license | lerbysha/vkr | 98364705da950b320f11ecac1050382f757344a9 | b00cb82d9abf08d3d0e230222e6deb555be00881 | refs/heads/main | 2023-05-27T09:32:20.451724 | 2021-06-11T09:09:52 | 2021-06-11T09:09:52 | 375,966,988 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,804 | h | #pragma once
#include <UnigineWorld.h>
#include <UnigineSounds.h>
#include "../VRInteractable.h"
class ObjHandle : public VRInteractable
{
public:
COMPONENT(ObjHandle, VRInteractable);
COMPONENT_INIT(init);
COMPONENT_UPDATE(update);
// property
PROP_NAME("handle");
PROP_AUTOSAVE(0);
// parameters
PROP_PARAM(File, sound_start);
PROP_PARAM(File, sound_loop);
PROP_PARAM(File, sound_stop);
PROP_PARAM(Float, sound_min_dist, 0.2f);
PROP_PARAM(Float, sound_max_dist, 1000.0f);
PROP_PARAM(Toggle, change_pos, 1);
PROP_PARAM(Toggle, change_rot, 1);
PROP_PARAM(Vec3, handle_min_pos, Unigine::Math::vec3(0, 0, 0));
PROP_PARAM(Vec3, handle_max_pos, Unigine::Math::vec3(0, 0, 0));
PROP_PARAM(Vec3, handle_min_rot, Unigine::Math::vec3(-180, -180, -180));
PROP_PARAM(Vec3, handle_max_rot, Unigine::Math::vec3(180, 180, 180));
// interact methods
void grabIt(VRPlayer* player, int hand_num) override;
void holdIt(VRPlayer* player, int hand_num) override;
void throwIt(VRPlayer* player, int hand_num) override;
protected:
void init();
void update();
private:
Unigine::ObjectPtr obj;
Unigine::BodyRigidPtr body;
Unigine::SoundSourcePtr sound;
float slide_sound_timer = 0;
int border_reached = 0;
Unigine::Math::vec3 last_cangles;
Unigine::Math::Vec3 last_handle_pos;
Unigine::Math::Vec3 grab_hand_pos; // position of the hand when it grab that object
Unigine::Math::Vec3 grab_obj_pos; // position of the object when it was grabbed
Unigine::Math::quat grab_rotate; //rotation of the node when it was grabbed
Unigine::Math::Scalar length_hand_pc;
int is_grabbed;
Unigine::Math::vec3 speed; // current moving speed of the handle
Unigine::WorldIntersectionPtr intersection = Unigine::WorldIntersection::create();
}; | [
"aegaisin@gmail.com"
] | aegaisin@gmail.com |
4c74ccfdb9ced3258f9a6d454d3ffbadefed7a0a | 7b6c1d7e3236d044070b4799131d2ee10238c15b | /OpenGL/Cherno OpenGl/OpenGL/OpenGL/src/Application.cpp | f203362f5a4b0f930f918bdfb20bd6f9d2bd0d82 | [] | no_license | harshit2608/Graphics-Work | 34d0f1354d059d079671b7bf999d27e94438727e | 36ab9465d8cb74810d4abf61871277a3d8dd1646 | refs/heads/master | 2022-09-02T00:23:44.911142 | 2020-05-31T19:30:53 | 2020-05-31T19:30:53 | 208,891,875 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,366 | cpp | #include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include "Renderer.h"
#include "VertexBuffer.h"
#include "VertexBufferLayout.h"
#include "IndexBuffer.h"
#include "VertexArray.h"
#include "Shader.h"
int main(void)
{
GLFWwindow* window;
/* Initialize the library */
if (!glfwInit())
return -1;
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
/* Create a windowed mode window and its OpenGL context */
window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
if (!window)
{
glfwTerminate();
return -1;
}
/* Make the window's context current */
glfwMakeContextCurrent(window);
glfwSwapInterval(1);
if (glewInit() != GLEW_OK)
std::cout << "Error!" << std::endl;
std::cout << glGetString(GL_VERSION) << std::endl;
{
float positions[] =
{
-0.5f, -0.5f,
0.5f, -0.5f,
0.5f, 0.5f,
-0.5f, 0.5f
};
unsigned int indices[] =
{
0, 1, 2,
2, 3, 0
};
VertexArray va;
VertexBuffer vb(positions, 4 * 2 * sizeof(float));
VertexBufferLayout layout;
layout.Push<float>(2);
va.AddBuffer(vb, layout);
GLCall(glEnableVertexAttribArray(0));
GLCall(glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 2, (const void*)0));
IndexBuffer ib(indices, 6);
Shader shader("res/shaders/Basic.shader");
shader.Bind();
//std::cout << "VERTEX" << std::endl;
//std::cout << source.VertexSource << std::endl;
//std::cout << "FRAGMENT" << std::endl;
//std::cout << source.FragmentSource << std::endl
shader.SetUniform4f("u_Color", 0.2f, 0.3f, 0.8f, 1.0f);
va.Unbind();
vb.Unbind();
ib.Unbind();
shader.Unbind();
Renderer renderer;
float r = 0.0f;
float increment = 0.05f;
/* Loop until the user closes the window */
while (!glfwWindowShouldClose(window))
{
/* Render here */
renderer.Clear();
shader.Bind();
shader.SetUniform4f("u_Color", r, 0.3f, 0.8f, 1.0f);
renderer.Draw(va, ib, shader);
if (r > 1.0f)
increment = -0.05f;
else if (r < 0.0f)
increment = 0.05f;
r += increment;
/* Swap front and back buffers */
glfwSwapBuffers(window);
/* Poll for and process events */
glfwPollEvents();
}
}
glfwTerminate();
return 0;
} | [
"harshitrock111@gmail.com"
] | harshitrock111@gmail.com |
0606b5e8ccb35389a3d1b0e0cc2e5098fa8004d9 | a92b18defb50c5d1118a11bc364f17b148312028 | /src/prod/src/Management/FileStoreService/uploadsessionmap.h | c9e9dfee513619f623beaaf2bec649a696cf6881 | [
"MIT"
] | permissive | KDSBest/service-fabric | 34694e150fde662286e25f048fb763c97606382e | fe61c45b15a30fb089ad891c68c893b3a976e404 | refs/heads/master | 2023-01-28T23:19:25.040275 | 2020-11-30T11:11:58 | 2020-11-30T11:11:58 | 301,365,601 | 1 | 0 | MIT | 2020-11-30T11:11:59 | 2020-10-05T10:05:53 | null | UTF-8 | C++ | false | false | 2,657 | h | // ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
// ------------------------------------------------------------
#pragma once
namespace Management
{
namespace FileStoreService
{
class UploadSessionMap
: public Store::ReplicaActivityTraceComponent<Common::TraceTaskCodes::FileStoreService>
{
DENY_COPY(UploadSessionMap)
public:
UploadSessionMap(
__in RequestManager & requestManager,
Common::ComponentRootSPtr const & root);
~UploadSessionMap();
Common::ErrorCode GetUploadSessionMapEntry(
std::wstring const & storeRelativePath,
__out std::vector<Management::FileStoreService::UploadSessionMetadataSPtr> & sessions);
Common::ErrorCode GetUploadSessionMapEntry(
Common::Guid const & sessionId,
__out Management::FileStoreService::UploadSessionMetadataSPtr & session);
Common::ErrorCode DeleteUploadSessionMapEntry(
Common::Guid const & sessionId,
__out std::vector<std::wstring> & stagingLocation);
Common::ErrorCode CreateUploadSessionMapEntry(
std::wstring const & storeRelativePath,
Common::Guid const & sessionId,
uint64 fileSize);
Common::ErrorCode UpdateUploadSessionMapEntry(
Common::Guid const & sessionId,
uint64 startPosition,
uint64 endPosition,
std::wstring const & stagingLocation);
bool IsEmpty() const
{
Common::AcquireReadLock grab(this->lock_);
return this->map_.empty();
}
std::size_t GetCount() const
{
Common::AcquireReadLock grab(this->lock_);
return this->map_.size();
}
private:
std::vector<std::wstring> && ProcessCleanupPeriodicTask();
void ScheduleProcessCleanupPeriodicTask(Common::TimeSpan const delay);
void ProcessDeleteChunksTask(std::vector<std::wstring> && chunkStagingLocations);
Common::ComponentRootSPtr root_;
Management::FileStoreService::UploadSessionMetadataMap map_;
mutable Common::RwLock lock_;
Common::TimerSPtr processPendingCleanupTimer_;
std::vector<std::wstring> toDeleteChunks_;
};
}
}
| [
"noreply-sfteam@microsoft.com"
] | noreply-sfteam@microsoft.com |
80c04fdad1d8d0e0626497c2d51ac07adde7aaad | af3d0cafc723f3816c797f0b908fc5ef9c948300 | /test/common/GetIPaddress.cxx | 29a5240d1ca1157c831a35ef3d442106a15bb332 | [] | no_license | mommsen/evb | ff1865488b580ba0219200d881ce4c7a5f45f6a8 | 15803ee11d08091ba5d806dac45e32225f0ffcd7 | refs/heads/master | 2021-01-23T18:31:55.490678 | 2018-12-17T15:16:39 | 2018-12-17T15:16:39 | 9,771,450 | 0 | 0 | null | 2018-07-06T07:53:56 | 2013-04-30T13:20:53 | C++ | UTF-8 | C++ | false | false | 398 | cxx | #include <iostream>
#include "evb/Constants.h"
int main( int argc, const char* argv[] )
{
if (argc == 1)
return -1;
try
{
std::cout << evb::resolveIPaddress(argv[1]) << std::endl;
}
catch(const char* msg) {
std::cerr << msg << std::endl;
}
}
/// emacs configuration
/// Local Variables: -
/// mode: c++ -
/// c-basic-offset: 2 -
/// indent-tabs-mode: nil -
/// End: -
| [
"remigius.mommsen@cern.ch"
] | remigius.mommsen@cern.ch |
095154c31c39f1710d752f8f006ae5d36aaadf06 | 6ced41da926682548df646099662e79d7a6022c5 | /aws-cpp-sdk-fis/include/aws/fis/model/UpdateExperimentTemplateLogConfigurationInput.h | 2dabe0c112432142a88550339323451313e5f311 | [
"Apache-2.0",
"MIT",
"JSON"
] | permissive | irods/aws-sdk-cpp | 139104843de529f615defa4f6b8e20bc95a6be05 | 2c7fb1a048c96713a28b730e1f48096bd231e932 | refs/heads/main | 2023-07-25T12:12:04.363757 | 2022-08-26T15:33:31 | 2022-08-26T15:33:31 | 141,315,346 | 0 | 1 | Apache-2.0 | 2022-08-26T17:45:09 | 2018-07-17T16:24:06 | C++ | UTF-8 | C++ | false | false | 5,252 | h | /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/fis/FIS_EXPORTS.h>
#include <aws/fis/model/ExperimentTemplateCloudWatchLogsLogConfigurationInput.h>
#include <aws/fis/model/ExperimentTemplateS3LogConfigurationInput.h>
#include <utility>
namespace Aws
{
namespace Utils
{
namespace Json
{
class JsonValue;
class JsonView;
} // namespace Json
} // namespace Utils
namespace FIS
{
namespace Model
{
/**
* <p>Specifies the configuration for experiment logging.</p><p><h3>See Also:</h3>
* <a
* href="http://docs.aws.amazon.com/goto/WebAPI/fis-2020-12-01/UpdateExperimentTemplateLogConfigurationInput">AWS
* API Reference</a></p>
*/
class AWS_FIS_API UpdateExperimentTemplateLogConfigurationInput
{
public:
UpdateExperimentTemplateLogConfigurationInput();
UpdateExperimentTemplateLogConfigurationInput(Aws::Utils::Json::JsonView jsonValue);
UpdateExperimentTemplateLogConfigurationInput& operator=(Aws::Utils::Json::JsonView jsonValue);
Aws::Utils::Json::JsonValue Jsonize() const;
/**
* <p>The configuration for experiment logging to Amazon CloudWatch Logs.</p>
*/
inline const ExperimentTemplateCloudWatchLogsLogConfigurationInput& GetCloudWatchLogsConfiguration() const{ return m_cloudWatchLogsConfiguration; }
/**
* <p>The configuration for experiment logging to Amazon CloudWatch Logs.</p>
*/
inline bool CloudWatchLogsConfigurationHasBeenSet() const { return m_cloudWatchLogsConfigurationHasBeenSet; }
/**
* <p>The configuration for experiment logging to Amazon CloudWatch Logs.</p>
*/
inline void SetCloudWatchLogsConfiguration(const ExperimentTemplateCloudWatchLogsLogConfigurationInput& value) { m_cloudWatchLogsConfigurationHasBeenSet = true; m_cloudWatchLogsConfiguration = value; }
/**
* <p>The configuration for experiment logging to Amazon CloudWatch Logs.</p>
*/
inline void SetCloudWatchLogsConfiguration(ExperimentTemplateCloudWatchLogsLogConfigurationInput&& value) { m_cloudWatchLogsConfigurationHasBeenSet = true; m_cloudWatchLogsConfiguration = std::move(value); }
/**
* <p>The configuration for experiment logging to Amazon CloudWatch Logs.</p>
*/
inline UpdateExperimentTemplateLogConfigurationInput& WithCloudWatchLogsConfiguration(const ExperimentTemplateCloudWatchLogsLogConfigurationInput& value) { SetCloudWatchLogsConfiguration(value); return *this;}
/**
* <p>The configuration for experiment logging to Amazon CloudWatch Logs.</p>
*/
inline UpdateExperimentTemplateLogConfigurationInput& WithCloudWatchLogsConfiguration(ExperimentTemplateCloudWatchLogsLogConfigurationInput&& value) { SetCloudWatchLogsConfiguration(std::move(value)); return *this;}
/**
* <p>The configuration for experiment logging to Amazon S3.</p>
*/
inline const ExperimentTemplateS3LogConfigurationInput& GetS3Configuration() const{ return m_s3Configuration; }
/**
* <p>The configuration for experiment logging to Amazon S3.</p>
*/
inline bool S3ConfigurationHasBeenSet() const { return m_s3ConfigurationHasBeenSet; }
/**
* <p>The configuration for experiment logging to Amazon S3.</p>
*/
inline void SetS3Configuration(const ExperimentTemplateS3LogConfigurationInput& value) { m_s3ConfigurationHasBeenSet = true; m_s3Configuration = value; }
/**
* <p>The configuration for experiment logging to Amazon S3.</p>
*/
inline void SetS3Configuration(ExperimentTemplateS3LogConfigurationInput&& value) { m_s3ConfigurationHasBeenSet = true; m_s3Configuration = std::move(value); }
/**
* <p>The configuration for experiment logging to Amazon S3.</p>
*/
inline UpdateExperimentTemplateLogConfigurationInput& WithS3Configuration(const ExperimentTemplateS3LogConfigurationInput& value) { SetS3Configuration(value); return *this;}
/**
* <p>The configuration for experiment logging to Amazon S3.</p>
*/
inline UpdateExperimentTemplateLogConfigurationInput& WithS3Configuration(ExperimentTemplateS3LogConfigurationInput&& value) { SetS3Configuration(std::move(value)); return *this;}
/**
* <p>The schema version.</p>
*/
inline int GetLogSchemaVersion() const{ return m_logSchemaVersion; }
/**
* <p>The schema version.</p>
*/
inline bool LogSchemaVersionHasBeenSet() const { return m_logSchemaVersionHasBeenSet; }
/**
* <p>The schema version.</p>
*/
inline void SetLogSchemaVersion(int value) { m_logSchemaVersionHasBeenSet = true; m_logSchemaVersion = value; }
/**
* <p>The schema version.</p>
*/
inline UpdateExperimentTemplateLogConfigurationInput& WithLogSchemaVersion(int value) { SetLogSchemaVersion(value); return *this;}
private:
ExperimentTemplateCloudWatchLogsLogConfigurationInput m_cloudWatchLogsConfiguration;
bool m_cloudWatchLogsConfigurationHasBeenSet;
ExperimentTemplateS3LogConfigurationInput m_s3Configuration;
bool m_s3ConfigurationHasBeenSet;
int m_logSchemaVersion;
bool m_logSchemaVersionHasBeenSet;
};
} // namespace Model
} // namespace FIS
} // namespace Aws
| [
"aws-sdk-cpp-automation@github.com"
] | aws-sdk-cpp-automation@github.com |
01ff78a544dee7cf03fee5e359dcc25df7289ab9 | 49dffd81feac36cfc1fb51da9a0bb2ea80758962 | /test/Words.Native.Test/HashtableTest.cpp | 12325ab072f79b7f8f71b95fa22a45628463e0f2 | [] | no_license | brian-dot-net/games | ae1bd93be823b46d04fadb4040f95b1c4cca39ad | 7554ce73b5d10ada8556063fc55985cf225b3c3f | refs/heads/master | 2023-01-16T04:19:42.276462 | 2022-12-30T00:11:56 | 2022-12-30T00:11:56 | 178,517,316 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,404 | cpp | #include <gtest/gtest.h>
#include "Hashtable.h"
#include <string>
#include <sstream>
using namespace std;
struct MyKey
{
int value_;
bool operator==(const MyKey& other) const
{
return value_ == other.value_;
}
};
namespace std
{
template<> struct hash<MyKey>
{
size_t operator()(const MyKey& k) const noexcept
{
return k.value_;
}
};
}
namespace Words
{
void TestIncreasingTableSizeKeyNotFound(Hashtable<MyKey, int>& table)
{
for (int i = 0; i < 1000; ++i)
{
bool inserted = table.insert({ i }, i + 1);
ASSERT_TRUE(inserted);
int v;
bool found = table.get({ i + 1 }, v);
ASSERT_FALSE(found);
}
}
TEST(HashtableTest, EmptyTableFindsNothing)
{
Hashtable<string, int> table;
int v;
bool found = table.get("not-here", v);
ASSERT_FALSE(found);
}
TEST(HashtableTest, OneEntryTableKeyNotFound)
{
Hashtable<string, int> table;
table.insert("here", 11);
int v;
bool found = table.get("not-here", v);
ASSERT_FALSE(found);
}
TEST(HashtableTest, OneEntryTableKeyFound)
{
Hashtable<string, int> table;
table.insert("here", 11);
int v = 0;
bool found = table.get("here", v);
ASSERT_TRUE(found);
ASSERT_EQ(11, v);
}
TEST(HashtableTest, OneEntryTableKeyReplaced)
{
Hashtable<string, int> table;
bool first = table.insert("overwrite", 10);
bool second = table.insert("overwrite", 100);
int v = 0;
bool found = table.get("overwrite", v);
ASSERT_TRUE(first);
ASSERT_FALSE(second);
ASSERT_TRUE(found);
ASSERT_EQ(100, v);
}
TEST(HashtableTest, InsertAndReplaceManyEntriesResize)
{
const int Size = 1000;
Hashtable<string, int> table;
for (int i = 1; i <= Size; ++i)
{
stringstream s;
s << "k" << i;
string key(s.str());
bool inserted = table.insert(key, i);
ASSERT_TRUE(inserted);
}
for (int i = 1; i <= Size; ++i)
{
stringstream s;
s << "k" << i;
string key(s.str());
int v = 0;
bool found = table.get(key, v);
ASSERT_TRUE(found);
ASSERT_EQ(i, v);
}
for (int i = 1; i <= Size; ++i)
{
stringstream s;
s << "k" << i;
string key(s.str());
int prev = 0;
bool inserted = table.insert(key, i * 2, &prev);
ASSERT_FALSE(inserted);
ASSERT_EQ(i, prev);
}
for (int i = 1; i <= Size; ++i)
{
stringstream s;
s << "k" << i;
string key(s.str());
int v = 0;
bool found = table.get(key, v);
ASSERT_TRUE(found);
ASSERT_EQ(i * 2, v);
}
}
TEST(HashtableTest, IncreasingTableSizeKeyNotFound)
{
Hashtable<MyKey, int> table;
TestIncreasingTableSizeKeyNotFound(table);
}
TEST(HashtableTest, IncreasingTableSizeKeyNotFoundLowerLoadFactor)
{
Hashtable<MyKey, int> table(0.25f);
TestIncreasingTableSizeKeyNotFound(table);
}
}
| [
"bobbymcr@gmail.com"
] | bobbymcr@gmail.com |
b7b55f74181d43f884c3816580013ab5ba047540 | 99a8814929551884efaf323025df2a5c698dd16c | /cumledeki keilme sayısını bulan program.cpp | 73c51c004cb08934e0ea46bfd3e7fb5978507ef5 | [] | no_license | sakgun165/C-ProgramlamaDiliDers | 98eb6b00b29673c6212b5406c49d5f02dab26e05 | 45b9ab04fd87cdbf63e47dc16af9867eff3e1a18 | refs/heads/master | 2020-04-26T09:05:38.942170 | 2019-03-02T12:15:22 | 2019-03-02T12:15:22 | 173,443,808 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 309 | cpp | #include <stdio.h>
#include <string.h>
main()
{
char cumle[BUFSIZ];
printf("Bir cumle giriniz ve cumlenizin sonuna bir bosluk koyunuz: ");
gets(cumle);
int sayac=0;
for(int i = 0;i<strlen(cumle);i++)
{
if(cumle[i]==' ')
{
cumle[i+1];
sayac++;
}
}
printf("Cumle %d kelimeden olusuyor",sayac);
return 0;
}
| [
"32776568+sakgun165@users.noreply.github.com"
] | 32776568+sakgun165@users.noreply.github.com |
57a82166def7a6e7df57722a96a3b047d9597d59 | 5bf08f00742cde2babca54d3245fae6c1c8979fc | /src/core/example.cc | 40be665cb7f8455bca200d19c01e9e7c69cdb097 | [
"MIT"
] | permissive | irobayna/ccspec | c4ec13cad8ba1280b7b297fa1c8f48e7dca18d7f | 865fea183b2b1e4266a4b500fcf2a24d920e8eda | refs/heads/master | 2021-01-18T10:41:09.689034 | 2015-03-05T18:57:48 | 2015-03-05T18:57:48 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,585 | cc | #include <ccspec/core/example.h>
#include <ccspec/core/example_group.h>
namespace ccspec {
namespace core {
using std::exception_ptr;
using std::function;
using std::list;
using std::string;
// Public methods.
// This function enables chaining of around hooks. Callers call this function
// inside each around hook (lambda function), then this function calls the next
// around hook in the chain.
//
// Since this function is nullary, in order to remember the state of which
// around hook to execute next, the around hooks need to be stored in a member
// variable `around_hooks_`. This also implies that `around_hooks_` must be
// mutated in this function in order to transition to the next state.
void Example::run() const {
if (reporter_ == nullptr ||
before_each_hooks_ == nullptr ||
after_each_hooks_ == nullptr ||
execution_result_ == nullptr) {
// The required pointers should have been initialized by the overloaded
// run function before this function is called.
return;
}
if (around_hooks_.empty()) {
ExampleGroup::catchException(
[this] {
for (auto hook : *before_each_hooks_)
hook();
spec_();
},
// Save errors in before hook and example.
[&](exception_ptr e) { execution_result_->set_exception(e); }
);
// Continue running after each hooks regardless of execution result.
ExampleGroup::catchException(
[this] {
for (auto hook : *after_each_hooks_)
hook();
},
[&](exception_ptr e) {
if (execution_result_->exception()) {
// An error happened in a before hook or an example but
// another is happening here in an after hook, report
// separately.
reporter_->afterEachHookFailed(e);
} else {
execution_result_->set_exception(e);
}
}
);
} else {
AroundHook around_hook = around_hooks_.front();
around_hooks_.pop_front();
around_hook(*this);
}
}
// Errors in around hooks are handled here so that only one error is caught
// in a chain of around hooks.
void Example::run(Reporter& reporter,
const list<BeforeHook>& before_each_hooks,
const list<AfterHook>& after_each_hooks,
list<AroundHook> around_hooks) const {
reporter_ = &reporter;
before_each_hooks_ = &before_each_hooks;
after_each_hooks_ = &after_each_hooks;
around_hooks_ = around_hooks;
ExecutionResult execution_result;
execution_result_ = &execution_result;
ExampleGroup::catchException(
[this] { run(); },
[&](exception_ptr e) {
if (execution_result.exception()) {
// An error happened in a before hook, an example or an
// after hook but another is happening here in an around
// hook, report separately.
reporter.aroundHookFailed(e);
} else {
execution_result.set_exception(e);
}
}
);
finish(execution_result);
reporter_ = nullptr;
before_each_hooks_ = nullptr;
after_each_hooks_ = nullptr;
around_hooks_.clear();
execution_result_ = nullptr;
}
void Example::failWithException(Reporter& reporter, exception_ptr e) const {
ExecutionResult execution_result;
execution_result.set_exception(e);
reporter.exampleFailed(desc_, execution_result);
}
// Private methods.
Example::Example(string desc, function<void ()> spec)
: desc_(desc),
spec_(spec),
reporter_(nullptr),
before_each_hooks_(nullptr),
after_each_hooks_(nullptr),
execution_result_(nullptr) {}
void Example::finish(const ExecutionResult& execution_result) const {
if (execution_result.exception())
reporter_->exampleFailed(desc_, execution_result);
else
reporter_->examplePassed(desc_, execution_result);
}
// Friend functions.
Example it(string desc, function<void ()> spec) {
Example example = Example(desc, spec);
ExampleGroup* parent_group = groups_being_defined.top();
parent_group->addExample(example);
return example;
}
Example example(string desc, function<void ()> spec) {
return it(desc, spec);
}
Example specify(string desc, function<void ()> spec) {
return it(desc, spec);
}
} // namespace core
} // namespace ccspec
| [
"me@zhang.su"
] | me@zhang.su |
3cca74d541fd9a18980c6cda58d0e401e5eda0b3 | 4dc9caed5cb3f4639587d3d596a82cd748254045 | /lib/Runtime/Base/ThreadBoundThreadContextManager.cpp | d5e1466264dad95e1093f2fc94d298536182c039 | [
"MIT"
] | permissive | jkrems/ChakraCore | 2e68c27a8a278c36bfa144f77dbd79398279c52b | 59b31e5821b7b8df3ed1f5021ed971da82cde9e1 | refs/heads/master | 2021-01-18T04:42:10.298111 | 2016-01-22T23:45:30 | 2016-01-22T23:45:30 | 50,215,307 | 2 | 0 | null | 2016-01-23T00:06:01 | 2016-01-23T00:06:00 | null | UTF-8 | C++ | false | false | 8,034 | cpp | //-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
#include "RuntimeBasePch.h"
#include "Base\ThreadContextTLSEntry.h"
#include "Base\ThreadBoundThreadContextManager.h"
ThreadBoundThreadContextManager::EntryList ThreadBoundThreadContextManager::entries(&HeapAllocator::Instance);
JsUtil::BackgroundJobProcessor * ThreadBoundThreadContextManager::s_sharedJobProcessor = NULL;
CriticalSection ThreadBoundThreadContextManager::s_sharedJobProcessorCreationLock;
uint ThreadBoundThreadContextManager::s_maxNumberActiveThreadContexts = 0;
ThreadContext * ThreadBoundThreadContextManager::EnsureContextForCurrentThread()
{
AutoCriticalSection lock(ThreadContext::GetCriticalSection());
ThreadContextTLSEntry * entry = ThreadContextTLSEntry::GetEntryForCurrentThread();
if (entry == NULL)
{
ThreadContextTLSEntry::CreateEntryForCurrentThread();
entry = ThreadContextTLSEntry::GetEntryForCurrentThread();
entries.Prepend(entry);
}
ThreadContext * threadContext = entry->GetThreadContext();
// An existing TLS entry may have a null ThreadContext
// DllCanUnload may have cleaned out all the TLS entry when the module lock count is 0,
// but the library didn't get unloaded because someone is holding onto ref count via LoadLibrary.
// Just reinitialize the thread context.
if (threadContext == nullptr)
{
threadContext = HeapNew(ThreadContext);
threadContext->SetIsThreadBound();
if (!ThreadContextTLSEntry::TrySetThreadContext(threadContext))
{
HeapDelete(threadContext);
return NULL;
}
}
Assert(threadContext != NULL);
s_maxNumberActiveThreadContexts = max(s_maxNumberActiveThreadContexts, GetActiveThreadContextCount());
return threadContext;
}
void ThreadBoundThreadContextManager::DestroyContextAndEntryForCurrentThread()
{
AutoCriticalSection lock(ThreadContext::GetCriticalSection());
ThreadContextTLSEntry * entry = ThreadContextTLSEntry::GetEntryForCurrentThread();
if (entry == NULL)
{
return;
}
ThreadContext * threadContext = static_cast<ThreadContext *>(entry->GetThreadContext());
entries.Remove(entry);
if (threadContext != NULL && threadContext->GetIsThreadBound())
{
ShutdownThreadContext(threadContext);
}
ThreadContextTLSEntry::CleanupThread();
}
void ThreadBoundThreadContextManager::DestroyAllContexts()
{
JsUtil::BackgroundJobProcessor * jobProcessor = NULL;
{
AutoCriticalSection lock(ThreadContext::GetCriticalSection());
ThreadContextTLSEntry * currentEntry = ThreadContextTLSEntry::GetEntryForCurrentThread();
if (currentEntry == NULL)
{
// We need a current thread entry so that we can use it to release any thread contexts
// we find below.
try
{
AUTO_NESTED_HANDLED_EXCEPTION_TYPE(ExceptionType_OutOfMemory);
currentEntry = ThreadContextTLSEntry::CreateEntryForCurrentThread();
entries.Prepend(currentEntry);
}
catch (Js::OutOfMemoryException)
{
return;
}
}
else
{
// We need to clear out the current thread entry so that we can use it to release any
// thread contexts we find below.
ThreadContext * threadContext = static_cast<ThreadContext *>(currentEntry->GetThreadContext());
if (threadContext != NULL)
{
if (threadContext->GetIsThreadBound())
{
ShutdownThreadContext(threadContext);
ThreadContextTLSEntry::ClearThreadContext(currentEntry, false);
}
else
{
ThreadContextTLSEntry::ClearThreadContext(currentEntry, true);
}
}
}
EntryList::Iterator iter(&entries);
while (iter.Next())
{
ThreadContextTLSEntry * entry = iter.Data();
ThreadContext * threadContext = static_cast<ThreadContext *>(entry->GetThreadContext());
if (threadContext != nullptr)
{
// Found a thread context. Remove it from the containing entry.
ThreadContextTLSEntry::ClearThreadContext(entry, true);
// Now set it to our thread's entry.
ThreadContextTLSEntry::SetThreadContext(currentEntry, threadContext);
// Clear it out.
ShutdownThreadContext(threadContext);
// Now clear it out of our entry.
ThreadContextTLSEntry::ClearThreadContext(currentEntry, false);
}
}
// We can only clean up our own TLS entry, so we're going to go ahead and do that here.
entries.Remove(currentEntry);
ThreadContextTLSEntry::CleanupThread();
if (s_sharedJobProcessor != NULL)
{
jobProcessor = s_sharedJobProcessor;
s_sharedJobProcessor = NULL;
jobProcessor->Close();
}
}
if (jobProcessor != NULL)
{
HeapDelete(jobProcessor);
}
}
void ThreadBoundThreadContextManager::DestroyAllContextsAndEntries()
{
AutoCriticalSection lock(ThreadContext::GetCriticalSection());
while (!entries.Empty())
{
ThreadContextTLSEntry * entry = entries.Head();
ThreadContext * threadContext = static_cast<ThreadContext *>(entry->GetThreadContext());
entries.RemoveHead();
if (threadContext != nullptr)
{
#if DBG
PageAllocator* pageAllocator = threadContext->GetPageAllocator();
if (pageAllocator)
{
pageAllocator->SetConcurrentThreadId(::GetCurrentThreadId());
}
#endif
threadContext->ShutdownThreads();
HeapDelete(threadContext);
}
ThreadContextTLSEntry::Delete(entry);
}
if (s_sharedJobProcessor != NULL)
{
s_sharedJobProcessor->Close();
HeapDelete(s_sharedJobProcessor);
s_sharedJobProcessor = NULL;
}
}
JsUtil::JobProcessor * ThreadBoundThreadContextManager::GetSharedJobProcessor()
{
if (s_sharedJobProcessor == NULL)
{
// Don't use ThreadContext::GetCriticalSection() because it's also locked during thread detach while the loader lock is
// held, and that may prevent the background job processor's thread from being started due to contention on the loader
// lock, leading to a deadlock
AutoCriticalSection lock(&s_sharedJobProcessorCreationLock);
if (s_sharedJobProcessor == NULL)
{
// We don't need to have allocation policy manager for web worker.
s_sharedJobProcessor = HeapNew(JsUtil::BackgroundJobProcessor, NULL, NULL, false /*disableParallelThreads*/);
}
}
return s_sharedJobProcessor;
}
void RentalThreadContextManager::DestroyThreadContext(ThreadContext* threadContext)
{
ShutdownThreadContext(threadContext);
}
void ThreadContextManagerBase::ShutdownThreadContext(ThreadContext* threadContext)
{
#if DBG
PageAllocator* pageAllocator = threadContext->GetPageAllocator();
if (pageAllocator)
{
pageAllocator->SetConcurrentThreadId(::GetCurrentThreadId());
}
#endif
threadContext->ShutdownThreads();
HeapDelete(threadContext);
}
uint ThreadBoundThreadContextManager::GetActiveThreadContextCount()
{
return entries.Count();
}
void ThreadBoundThreadContextManager::ResetMaxNumberActiveThreadContexts()
{
s_maxNumberActiveThreadContexts = GetActiveThreadContextCount();
}
| [
"chakrabot@users.noreply.github.com"
] | chakrabot@users.noreply.github.com |
e0ff16b7842312c50fd0c9d2a3721caab84c93f5 | fbbb5814e57c9741766ca387af6a95d76f8ea527 | /src/systems/camera-system.cpp | e6b4e6afdf896e23dbf023bf0f6c860a0c0fb80b | [
"MIT"
] | permissive | guillaume-haerinck/opengl-playground | 0dba67abe4fd33131f6d756ce897e16da0c0f705 | 06d06d1429712756a4b215b9ce62ea72c8afe54d | refs/heads/master | 2020-07-29T08:14:01.768502 | 2019-12-27T23:14:49 | 2019-12-27T23:14:49 | 209,726,032 | 5 | 2 | MIT | 2019-11-14T12:26:41 | 2019-09-20T06:57:58 | JavaScript | UTF-8 | C++ | false | false | 2,312 | cpp | #include "camera-system.h"
#include <glm/glm.hpp>
#include <glm/gtc/constants.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include "scomponents/io/inputs.h"
#include "scomponents/graphics/camera.h"
CameraSystem::CameraSystem(Context& context) : m_ctx(context)
{
}
CameraSystem::~CameraSystem()
{
}
void CameraSystem::update() {
// Get singleton components
scomp::Inputs& inputs = m_ctx.inputs;
scomp::Camera& camera = m_ctx.camera;
// ArcBall rotation
if (inputs.actionState.at(scomp::InputAction::CAM_ORBIT)) {
camera.theta -= inputs.delta.x * 0.01f;
camera.phi += inputs.delta.y * 0.01f;
// Keep phi within -2PI to +2PI for easy 'up' comparison
if (camera.phi > glm::two_pi<float>()) {
camera.phi -= glm::two_pi<float>();
} else if (camera.phi < -glm::two_pi<float>()) {
camera.phi += glm::two_pi<float>();
}
// If phi is between 0 to PI or -PI to -2PI, make 'up' be positive Y, other wise make it negative Y
if ((camera.phi > 0 && camera.phi < glm::pi<float>()) || (camera.phi < -glm::pi<float>() && camera.phi > -glm::two_pi<float>())) {
camera.up = 1.0f;
} else {
camera.up = -1.0f;
}
camera.hasToBeUpdated = true;
}
// Move along vertical plane
if (inputs.actionState.at(scomp::InputAction::CAM_PAN)) {
camera.hasToBeUpdated = true;
}
// Change arcball radius
if (inputs.actionState.at(scomp::InputAction::CAM_DOLLY)) {
if (inputs.wheelDelta > 0 && camera.radius >= 2) {
camera.radius -= 1;
} else if (inputs.wheelDelta < 0) {
camera.radius += 1;
}
camera.hasToBeUpdated = true;
}
// Reset zoom and position
if (inputs.actionState.at(scomp::InputAction::CAM_RESET)) {
camera.phi = 0;
camera.theta = 0;
camera.radius = 10;
camera.up = 1;
camera.target = glm::vec3(0, 0, 0);
camera.hasToBeUpdated = true;
}
// Update camera position
if (camera.hasToBeUpdated == true) {
camera.position.x = camera.radius * sinf(camera.phi) * sinf(camera.theta);
camera.position.y = camera.radius * cosf(camera.phi);
camera.position.z = camera.radius * sinf(camera.phi) * cosf(camera.theta);
glm::vec3 eye = camera.position;
glm::vec3 target = camera.target;
glm::vec3 up = glm::vec3(0, camera.up, 0);
camera.view = glm::lookAtLH(eye, target, up);
camera.hasToBeUpdated = false;
}
}
| [
"guillaume.haerinck@outlook.com"
] | guillaume.haerinck@outlook.com |
2524f451dcca93142a4a4aabb3272ceed10fd0ae | 46f00b926b9bf17cc43d3ee0b8eccee52b089100 | /Animales/animal.h | 788a000501e9a55eecd9b68fb134dad3d2be453e | [] | no_license | manuel-fidalgo/Arquitectura-Computadores-Ejemplos | 902d47698a1c2f31ff9920cb09077d0ae816e502 | 21b6fdc4c61d882d2927dfcfc2648ae81a923454 | refs/heads/master | 2021-01-16T17:53:20.324978 | 2016-03-05T11:50:42 | 2016-03-05T11:50:42 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,080 | h | #ifndef ANIMAL_H
#define ANIMAL_H
#include <iostream>
#include <vector>
using namespace std;
// Clasificación según su alimentación.
enum clasificacion {
CARNIVORO,
HERBIVORO,
OMNIVORO
};
// Array de string
static string textoClasificacion[] = { "Carnívoro", "Herbívoro", "Omnívoro" };
// Definición de la clase Animal
class Animal
{
public:
// Constructor de la clase
Animal();
// Constructor sobrecargado
Animal(string suNombre, int numPatas);
// Destructor de la clase
~Animal(void);
// Relaciona el valor enumerado con el texto equivalente (string)
string escribeClasificacion(clasificacion suClasificacion);
//
// "Getters" & "Setters" (Devuelven & Establecen valores a los atributos)
//
int getPatas();
void setPatas(int value);
string getNombre();
void setNombre(string value);
clasificacion getAlimentacion();
void setAlimentacion(clasificacion value);
// Ojo, que estos dos son algo diferentes ... trabajan con una lista
int getRacionesRecibidas(int vez);
void setRacionesRecibidas(int racion);
/*
* Métodos de la clase
*
* Si quisiéramos OBLIGAR a utilizar el método de las clases derivadas,
* en la definición de este método añadimos la palabra "virtual" delante:
*
* virtual void EmiteSonido();
*
*/
// Método de la clase base con funcionalidad
void EmiteSonido();
// Método de la clase definido como virtual => Obliga a usar el equivalente en las clases derivadas.
//virtual void EmiteSonido();
// Métodos sobrecargados
// desayuno, comida y cena son valores enteros que representan las raciones que le damos al animal
void DarDeComer(int desayuno);
void DarDeComer(int desayuno, int comida);
void DarDeComer(int desayuno, int comida, int cena);
// Método para obtener las raciones de comida totales ...
int CalcularRaciones();
private:
int patas;
string nombre;
clasificacion alimentacion;
vector<int> raciones;
};
#endif // ANIMAL_H
| [
"m.fidalgo.fierro@gmail.com"
] | m.fidalgo.fierro@gmail.com |
1e90173095ee719863a1e4766dda7aa6affac58d | 6cac49ef1a26f5c6632b824a5789a6531aa7f099 | /libraries/blockchain/slate_operations.cpp | 5957579933be08ffb995ee75befe5312c15da7ed | [
"Unlicense",
"LicenseRef-scancode-public-domain"
] | permissive | RemitaBit/Remitabit2 | a5fef496fb9a7e50a76416cae11c1e72d8c8cb2b | 101e30c4e5f617af97144e4a11c2ae8303642373 | refs/heads/master | 2021-01-15T20:23:12.812505 | 2015-02-25T13:18:02 | 2015-02-25T13:18:02 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,260 | cpp | #include <bts/blockchain/exceptions.hpp>
#include <bts/blockchain/pending_chain_state.hpp>
#include <bts/blockchain/slate_operations.hpp>
#include <bts/blockchain/fork_blocks.hpp>
namespace bts { namespace blockchain {
void define_slate_operation::evaluate( transaction_evaluation_state& eval_state )const
{ try {
FC_ASSERT( !slate.empty() );
if( this->slate.size() > BTS_BLOCKCHAIN_MAX_SLATE_SIZE )
FC_CAPTURE_AND_THROW( too_may_delegates_in_slate, (slate.size()) );
slate_record record;
for( const signed_int id : this->slate )
{
#ifndef WIN32
#warning [SOFTFORK] Remove this check after BTS_V0_6_2_FORK_BLOCK_NUM has passed
#endif
if( eval_state._current_state->get_head_block_num() < BTS_V0_6_2_FORK_BLOCK_NUM )
{
const oaccount_record delegate_record = eval_state._current_state->get_account_record( id );
FC_ASSERT( delegate_record.valid() && delegate_record->is_delegate() );
}
if( id >= 0 )
{
const oaccount_record delegate_record = eval_state._current_state->get_account_record( id );
FC_ASSERT( delegate_record.valid() && delegate_record->is_delegate() );
}
record.slate.insert( id );
}
if( eval_state._current_state->get_head_block_num() < BTS_V0_6_3_FORK_BLOCK_NUM )
{
const slate_id_type slate_id = slate_record::id_v1( this->slate );
const oslate_record current_slate = eval_state._current_state->get_slate_record( slate_id );
if( !current_slate.valid() )
{
if( record.slate.size() < this->slate.size() )
record.duplicate_slate = this->slate;
eval_state._current_state->store( slate_id, record );
record.duplicate_slate.clear();
}
}
const slate_id_type slate_id = record.id();
const oslate_record current_slate = eval_state._current_state->get_slate_record( slate_id );
if( current_slate.valid() )
{
FC_ASSERT( current_slate->slate == record.slate, "Slate ID collision!", ("current_slate",*current_slate)("new_slate",record) );
return;
}
eval_state._current_state->store_slate_record( record );
} FC_CAPTURE_AND_RETHROW( (*this) ) }
} } // bts::blockchain
| [
"vikram@bitshares.org"
] | vikram@bitshares.org |
66c9b19a706a87536143650f3b0a107a5a57dc69 | de2386b208450af193375a8314942e6eff696fe7 | /src/parser/main.cpp | 16ca29076c3b5e5c2c55862c8a34cba1fb6273cf | [
"MIT"
] | permissive | snailbaron/nyaason | b37755b7ef7c1735713bf8f926091c7c805164ab | de8b7c8ab5842da72b839122aec55d8ac2b37344 | refs/heads/master | 2020-09-14T07:07:35.143505 | 2017-07-06T21:44:46 | 2017-07-06T21:44:46 | 94,469,470 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 225 | cpp | #include "nyaason.hpp"
#include <exception>
#include <iostream>
int main()
{
try {
auto nyaa = nyaa::parse("test.nyaa");
} catch (std::exception& e) {
std::cerr << e.what();
return 1;
}
} | [
"murbidodrus@gmail.com"
] | murbidodrus@gmail.com |
4ad235da4b955ea8743805090a18fd5d9c653de6 | ede24ca21c91785106b90623ef2fd600dbb2a5d2 | /AABB.h | 82e16bbde4082d5466671d0aaf74925087bfaed2 | [
"Apache-2.0"
] | permissive | simoncblyth/CSG | c15a6b42ab7552b8b5eb6a8d870a8cee7c048123 | 9022100123cbc982b741a9e9ae9a544956818770 | refs/heads/main | 2023-07-08T13:39:49.643030 | 2021-08-19T19:12:23 | 2021-08-19T19:12:23 | 362,127,884 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,842 | h | #pragma once
#if defined(__CUDACC__) || defined(__CUDABE__)
#else
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#endif
#define AABB_METHOD inline
struct AABB
{
float3 mn ;
float3 mx ;
static AABB Make(const float* v );
const float* data() const ;
float3 center() const ;
float extent() const ;
float4 center_extent() const ;
void center_extent(float4& ce) const ;
bool empty() const ;
void include_point(const float* point);
void include_point(const float3& p);
void include_aabb( const float* aabb);
#if defined(__CUDACC__) || defined(__CUDABE__)
#else
std::string desc() const ;
static std::string Desc(const float* data);
static void cube_corners(std::vector<float3>& corners, const float4& ce );
#endif
};
AABB_METHOD AABB AABB::Make( const float* v )
{
AABB bb = {} ;
bb.mn.x = *(v+0);
bb.mn.y = *(v+1);
bb.mn.z = *(v+2);
bb.mx.x = *(v+3);
bb.mx.y = *(v+4);
bb.mx.z = *(v+5);
return bb ;
}
AABB_METHOD const float* AABB::data() const
{
return (const float*)&mn ; // hmm assumes compiler adds no padding between mn and mx
}
AABB_METHOD float3 AABB::center() const
{
return ( mx + mn )/2.f ;
}
AABB_METHOD float AABB::extent() const
{
float3 d = mx - mn ;
return fmaxf(fmaxf(d.x, d.y), d.z) /2.f ;
}
AABB_METHOD float4 AABB::center_extent() const
{
return make_float4( center(), extent() );
}
AABB_METHOD void AABB::center_extent(float4& ce) const
{
float3 c = center();
ce.x = c.x ;
ce.y = c.y ;
ce.z = c.z ;
ce.w = extent() ;
}
AABB_METHOD bool AABB::empty() const
{
return mn.x == 0.f && mn.y == 0.f && mn.z == 0.f && mx.x == 0.f && mx.y == 0.f && mx.z == 0.f ;
}
/*
AABB::include_point
--------------------
+- - - - -* <--- included point pushing out the max, leaves min unchanged
. |
+-------+ .
| | |
| | .
| | |
+-------+- +
+-------+
| * | <-- interior point doesnt change min/max
| |
| |
+-------+
+-------+-->--+
| | |
| | * <--- side point pushes out max, leaves min unchanged
| | |
+-------+-----+
*/
AABB_METHOD void AABB::include_point(const float* point)
{
const float3 p = make_float3( *(point+0), *(point+1), *(point+2) );
include_point(p);
}
AABB_METHOD void AABB::include_point(const float3& p)
{
if(empty())
{
mn = p ;
mx = p ;
}
else
{
mn = fminf( mn, p );
mx = fmaxf( mx, p );
}
}
AABB_METHOD void AABB::include_aabb(const float* aabb)
{
const float3 other_mn = make_float3( *(aabb+0), *(aabb+1), *(aabb+2) );
const float3 other_mx = make_float3( *(aabb+3), *(aabb+4), *(aabb+5) );
if(empty())
{
mn = other_mn ;
mx = other_mx ;
}
else
{
mn = fminf( mn, other_mn );
mx = fmaxf( mx, other_mx );
}
}
#if defined(__CUDACC__) || defined(__CUDABE__)
#else
inline std::ostream& operator<<(std::ostream& os, const AABB& bb)
{
os
<< " [ "
<< bb.mn
<< " : "
<< bb.mx
<< " | "
<< ( bb.mx - bb.mn )
<< " ] "
;
return os;
}
/**
ZYX
0:000
1:001 +X
2:010 +Y
3:011
4:100 +Z
5:101
6:110
7:111
110----------111
| |
| |
+Z 100----------101 |
| | | |
| | | |
| 010---|------011 +Y
| |
| |
-Z 000----------001 -Y
-X +X
**/
AABB_METHOD void AABB::cube_corners(std::vector<float3>& corners, const float4& ce )
{
for(int c=0 ; c < 8 ; c++) // loop around the corners
{
float3 a = make_float3(
ce.x + ( c & 1 ? ce.w : -ce.w ),
ce.y + ( c & 2 ? ce.w : -ce.w ),
ce.z + ( c & 4 ? ce.w : -ce.w )
) ;
corners.push_back(a) ;
}
}
AABB_METHOD std::string AABB::desc() const
{
std::stringstream ss ;
ss
<< " mn " << mn
<< " mx " << mx
;
std::string s = ss.str();
return s ;
}
AABB_METHOD std::string AABB::Desc(const float* data)
{
std::stringstream ss ;
for(int j=0 ; j < 6 ; j++) ss << std::fixed << std::setw(10) << std::setprecision(2) << *(data + j) << " " ;
std::string s = ss.str();
return s ;
}
#endif
| [
"simoncblyth@gmail.com"
] | simoncblyth@gmail.com |
9ab32d74c0ffa2b063014dd4ec7da97c80a3dafc | 38c10c01007624cd2056884f25e0d6ab85442194 | /third_party/webrtc/modules/pacing/bitrate_prober.h | b3f52afeb6ed4ed5d5bd983424c1bc3216794bca | [
"BSD-3-Clause",
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-google-patent-license-webrtc",
"BSL-1.0",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown",
"MS-LPL",
"LicenseRef-scancode-takuy... | permissive | zenoalbisser/chromium | 6ecf37b6c030c84f1b26282bc4ef95769c62a9b2 | e71f21b9b4b9b839f5093301974a45545dad2691 | refs/heads/master | 2022-12-25T14:23:18.568575 | 2016-07-14T21:49:52 | 2016-07-23T08:02:51 | 63,980,627 | 0 | 2 | BSD-3-Clause | 2022-12-12T12:43:41 | 2016-07-22T20:14:04 | null | UTF-8 | C++ | false | false | 2,045 | h | /*
* Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_MODULES_PACING_BITRATE_PROBER_H_
#define WEBRTC_MODULES_PACING_BITRATE_PROBER_H_
#include <cstddef>
#include <list>
#include "webrtc/typedefs.h"
namespace webrtc {
// Note that this class isn't thread-safe by itself and therefore relies
// on being protected by the caller.
class BitrateProber {
public:
BitrateProber();
void SetEnabled(bool enable);
// Returns true if the prober is in a probing session, i.e., it currently
// wants packets to be sent out according to the time returned by
// TimeUntilNextProbe().
bool IsProbing() const;
// Initializes a new probing session if the prober is allowed to probe.
void MaybeInitializeProbe(int bitrate_bps);
// Returns the number of milliseconds until the next packet should be sent to
// get accurate probing.
int TimeUntilNextProbe(int64_t now_ms);
// Returns the number of bytes that the prober recommends for the next probe
// packet.
size_t RecommendedPacketSize() const;
// Called to report to the prober that a packet has been sent, which helps the
// prober know when to move to the next packet in a probe.
void PacketSent(int64_t now_ms, size_t packet_size);
private:
enum ProbingState { kDisabled, kAllowedToProbe, kProbing, kWait };
ProbingState probing_state_;
// Probe bitrate per packet. These are used to compute the delta relative to
// the previous probe packet based on the size and time when that packet was
// sent.
std::list<int> probe_bitrates_;
size_t packet_size_last_send_;
int64_t time_last_send_ms_;
};
} // namespace webrtc
#endif // WEBRTC_MODULES_PACING_BITRATE_PROBER_H_
| [
"zeno.albisser@hemispherian.com"
] | zeno.albisser@hemispherian.com |
2c7963c16c24179e6dd33465ac5f7dc418f60d86 | 47d056bb7aef6607231f90aa26ecbdc531b4372c | /Utils.cpp | b29afe178779c9d09b8f70465cbd71d4cf127f98 | [] | no_license | aasantos/SVModels | 7cdf030da1a83beb2a526bffb8c994d0f5754438 | 1f5c2a8b8c527b14a9ee26e71c81c12ea232979b | refs/heads/master | 2020-09-04T10:01:36.210117 | 2019-12-24T10:52:59 | 2019-12-24T10:52:59 | 219,707,149 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,469 | cpp | //
// Utils.cpp
// October2019
//
// Created by António Alberto Santos on 15/10/2019.
// Copyright © 2019 Antonio Santos. All rights reserved.
//
#include "Utils.hpp"
float* readArrayFloat(const char* file,int *n)
{
FILE *fp;
fp = fopen(file, "r");
char buff[64];
int nrow = -1;
while (!feof(fp)) {
fscanf(fp, "%s",buff);
nrow++;
}
*n = nrow;
rewind(fp);
float *result = (float*)malloc(nrow*sizeof(float));
for(int i=0;i<nrow;i++){
fscanf(fp, "%s",buff);
result[i] = atof(buff);
}
fclose(fp);
return result;
}
double* readArrayDouble(const char* file,int *n)
{
FILE *fp;
fp = fopen(file, "r");
char buff[64];
int nrow = -1;
while (!feof(fp)) {
fscanf(fp, "%s",buff);
nrow++;
}
*n = nrow;
rewind(fp);
double *result = (double*)malloc(nrow*sizeof(double));
for(int i=0;i<nrow;i++){
fscanf(fp, "%s",buff);
result[i] = atof(buff);
}
fclose(fp);
return result;
}
void writeArrayDouble(double *x,const char* file,int n)
{
FILE *fp;
fp = fopen(file, "wa");
for(int i=0;i<n;i++) fprintf(fp,"%.6f\n",x[i]);
fclose(fp);
}
double digamma(double x)
{
double r, f, t;
r = 0;
while (x<=5)
{ r -= 1/x;
x += 1;
}
f = 1/(x*x);
t = f*(-1/12.0 + f*(1/120.0 +
f*(-1/252.0 + f*(1/240.0 + f*(-1/132.0
+ f*(691/32760.0 + f*(-1/12.0 + f*3617/8160.0)))))));
return r + log(x) - 0.5/x + t;
}
double trigamma(double x)
{
double h = 0.000001;
double f1 = digamma(x + h);
double f0 = digamma(x - h);
return (f1 - f0)/(2.0*h);
}
double norm(double x[2])
{
return sqrt(x[0]*x[0] + x[1]*x[1]);
}
/*
double digamma(double x)
{
double xx = x;
if(xx < 0.000001) xx = 0.000001;
return gsl_sf_psi(xx);
}
double trigamma(double x)
{
double xx = x;
if(xx < 0.000001) xx = 0.000001;
return gsl_sf_psi_1(xx);
}
*/
double logpdfbivariatenormal(double x[2],double mm[2],double vcv[4])
{
double rho = vcv[1]/sqrt(vcv[0]*vcv[3]);
double mu1 = mm[0];
double mu2 = mm[1];
double s1sq = vcv[0];
double s2sq = vcv[3];
double err1 = x[0] - mu1;
double err2 = x[1] - mu2;
double zz = err1*err1/s1sq + err2*err2/s2sq -
2.0*rho*err1*err2/sqrt(s1sq*s2sq);
return -1.0*log(2.0*3.1415926535897932385*sqrt(s1sq)*sqrt(s1sq)*sqrt(1.0 - rho*rho))
- 0.5*zz/(1.0 - rho*rho);
}
| [
"noreply@github.com"
] | aasantos.noreply@github.com |
506f16b3640eda4e2ca637d51c7a033eda7a05b0 | 06b377f9999e7c2664fdbad673e2cf432193eb00 | /Level.h | 22c2764fba077b075f7ced0c920e71f27c6d76c3 | [] | no_license | igor-grubic/UltrasonicShuttle | b84e5612fb84da79092b93a5ba686edeef3aea62 | f942c8377e5077bf40e3227f1bf71c8e3ce8e79d | refs/heads/master | 2021-05-27T18:12:04.829344 | 2014-09-28T23:53:52 | 2014-09-28T23:53:52 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 828 | h | #ifndef __LEVEL_H__
#define __LEVEL_H__
#include "common.h"
#define LVL_ENEMY 'E'
#define LVL_BOSS 'B'
#define LVL_BEGIN 'S'
#define LVL_END 'F'
using namespace std;
struct Command {
long timer;
char cmd;
int p1;
int p2;
int p3;
int p4;
int p5;
int p6;
int p7;
int p8;
int p9;
int p10;
};
class Level {
public:
Level();
~Level();
void loadLevel(int level);
void addEnemyToQueue(int timer, int image, int posX, int posY, int shotDelay, int damage, int armor, int beam, int flightType, int speedX, int speedY);
bool isNextEvent();
Command* nextEvent();
int level;
int levelY;
int levelScrollSpeed;
int backgroundImage;
int backgroundScrollSpeed;
long levelStartTime;
vector<Command*> lvl_cmds;
};
#endif
| [
"igor@xtra.it"
] | igor@xtra.it |
415cde242b9f5b554ff689ed0cc1767787ea32c7 | d1a08b64e8ed05db7a320a223db5c664637a3e00 | /linked_list_functions.h | e75fef9c4e483ae08e1d0df3a577d4eef8b32f1c | [] | no_license | DPJDevelops/project2cs8 | 075e465ca69d9853ef8d6d71b529e2577e84d9c1 | c4f01dc4a3a926aa5531879c89f48be4fcc039c4 | refs/heads/main | 2023-06-23T11:29:52.810241 | 2021-05-27T03:24:28 | 2021-05-27T03:24:28 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,284 | h | #ifndef LINKED_LIST_FUNCTIONS_H
#define LINKED_LIST_FUNCTIONS_H
#include <iostream>
#include <cassert>
using namespace std;
template <typename ITEM_TYPE>
struct node
{
public:
node(){
next = NULL;
_item = ITEM_TYPE();
}
node(ITEM_TYPE item){
next = NULL;
_item = item;
}
ITEM_TYPE _item; //ATT - item in list
node<ITEM_TYPE>* next; //ATT - next item in list
};
template <typename ITEM_TYPE>
node<ITEM_TYPE>* SearchList(node<ITEM_TYPE>* head, //IN - list head
ITEM_TYPE key); //IN - val to search for
template <typename ITEM_TYPE>
node<ITEM_TYPE>* _PreviousNode(node<ITEM_TYPE>* head, //IN - list head
node<ITEM_TYPE>* prevToThis); //IN - prev pointer
template <typename ITEM_TYPE>
node<ITEM_TYPE>* _InsertHead(node<ITEM_TYPE> *&head, //IN - list head
ITEM_TYPE insertThis); //IN - val to insert
template <typename ITEM_TYPE>
node<ITEM_TYPE>* _InsertAfter(
node<ITEM_TYPE> *afterThis, //IN - node ptr
ITEM_TYPE insertThis); //IN - val to ins
template <typename ITEM_TYPE>
node<ITEM_TYPE>* _InsertBefore(node<ITEM_TYPE>*& head, //IN - list head
node<ITEM_TYPE>* beforeThis, //IN - ins before
ITEM_TYPE insertThis); //IN - val to ins
template <typename ITEM_TYPE>
ITEM_TYPE _DeleteNode(node<ITEM_TYPE>*&head, //IN - list head
node<ITEM_TYPE>* deleteThis); //IN - ptr to del
template <typename ITEM_TYPE>
node<ITEM_TYPE>* _CopyList(node<ITEM_TYPE>* head); //IN - list head
template <typename ITEM_TYPE>
void _ClearList(node<ITEM_TYPE>*& head); //IN - list head
template <typename ITEM_TYPE>
ITEM_TYPE& At(node<ITEM_TYPE>* head, //IN - list head
int pos); //IN - position to ret val
template <typename ITEM_TYPE>
node<ITEM_TYPE>* _InsertSorted(node<ITEM_TYPE>* &head, //IN - list head
ITEM_TYPE item, //IN - val to ins
bool ascending=true); //IN - how to sort
template <typename ITEM_TYPE>
node<ITEM_TYPE>* InsertSorted_and_add(
node<ITEM_TYPE>* &head,//IN - list head
ITEM_TYPE item, //IN - val to ins
bool ascending=true); //IN - how to sort
template <typename ITEM_TYPE>
node<ITEM_TYPE>* WhereThisGoes(node<ITEM_TYPE>* head, //IN - list head
ITEM_TYPE item, //IN - val to ins
bool unique, //IN - if unique
bool ascending=true); //IN - how to sort
template <typename ITEM_TYPE>
node<ITEM_TYPE>* LastNode(node<ITEM_TYPE>* head); //IN - list head
template <typename ITEM_TYPE>
node<ITEM_TYPE>* SearchList(node<ITEM_TYPE>* head, //IN - list head
ITEM_TYPE key){ //IN - val to search for
assert(head != NULL);
node<ITEM_TYPE> * walker = head; //CALC - temp pointer
if (head->_item == key)
return head;
// loop through the entire list
while (walker != NULL){
if (key == walker->_item)
return walker;
walker = walker->next;
}
return NULL;
}
template <typename ITEM_TYPE>
node<ITEM_TYPE>* _InsertHead(node<ITEM_TYPE> *&head, //IN - list head
ITEM_TYPE insertThis){ //IN - val to insert
node<ITEM_TYPE>* temp = new node<ITEM_TYPE>(insertThis);//CALC - new node
temp->next = head;
head= temp;
return head;
}
template <typename ITEM_TYPE>
node<ITEM_TYPE>* _InsertAfter( node<ITEM_TYPE> *afterThis, //IN - ptr
ITEM_TYPE insertThis){ //IN - ins after ptr
// calls insert head and use afterthis-> next as the head
return _InsertHead(afterThis->next, insertThis);
}
template <typename ITEM_TYPE>
node<ITEM_TYPE>* _InsertBefore(node<ITEM_TYPE>*& head, //IN - list head
node<ITEM_TYPE>* beforeThis, //IN - ptr
ITEM_TYPE insertThis){ //IN - ins be4 ptr
node<ITEM_TYPE> *prev = _PreviousNode(head, beforeThis);
if (prev == nullptr){
return _InsertHead(head, insertThis);
}
return _InsertHead(prev->next, insertThis);
}
template <typename ITEM_TYPE>
node<ITEM_TYPE>* _PreviousNode(node<ITEM_TYPE>* head, // IN - list head
node<ITEM_TYPE>* prevToThis){ // IN - ptr
// use a walker to compare if the node that the current node is pointing to
// is equal to prevToThis. walker stops at that point and return that point
node<ITEM_TYPE> *walker = head; // CALC - to traverse
assert(walker != NULL);
while (walker!= NULL){
if (head == prevToThis){
return NULL;
}
if (walker ->next == prevToThis){
return walker;
}
walker = walker ->next;
}
assert(walker != NULL);
return NULL;
}
template <typename ITEM_TYPE>
ITEM_TYPE _DeleteNode(node<ITEM_TYPE>*&head, // IN - list head
node<ITEM_TYPE>* deleteThis){ // IN - ptr to delete
//first find the previous node to the node that will be deleted, make that
// node point to the next node of the deleting node, delete the node.
assert(head != NULL);
assert(deleteThis!=NULL);
ITEM_TYPE temp = deleteThis->_item; // CALC - object deleted
node <ITEM_TYPE> *prev
= _PreviousNode(head,deleteThis); // CALC - left shift
if (prev == nullptr){
head= deleteThis->next;
delete deleteThis;
return temp;
}
prev->next = deleteThis->next;
delete deleteThis;
return temp;
}
template <typename ITEM_TYPE>
node<ITEM_TYPE>* _CopyList(node<ITEM_TYPE>* head){ // IN - list head
// set a walker walking through the old list, set a walker to the new list,
// walker through each element in the old list and append it to the new list
node<ITEM_TYPE> *result = NULL; // CALC - result pointer
node<ITEM_TYPE> *result_walker; // IN - to traverse
node<ITEM_TYPE> *walker = head; // IN - ptr to head
while (walker != NULL){
if (result == NULL){
result_walker = _InsertHead(result, walker->_item);
}else{
result_walker = _InsertAfter(result_walker, walker->_item);
}
walker = walker->next;
}
return result;
}
template <typename ITEM_TYPE>
void _ClearList(node<ITEM_TYPE>*& head){ // IN - list head
// call the function to delete a single node, while list is not empty, keep
// deleting the head node, at the end, set head to node pointer
while (head != NULL){
_DeleteNode(head,head);
}
head = NULL;
}
template <typename ITEM_TYPE>
ITEM_TYPE& At(node<ITEM_TYPE>* head, // IN - list head
int pos){ // IN - list position
// use a counter to counter to the particular position
int counter = 0;
node <ITEM_TYPE> * w=head; // CALC - to traverse
while (w != NULL && counter != pos){
w = w->next;
counter++;
}
return w->_item;
}
template <typename ITEM_TYPE>
node<ITEM_TYPE>* InsertSorted_and_add(node<ITEM_TYPE>* &head, // IN - list head
ITEM_TYPE item, // IN - val ins
bool ascending){ // IN - sort type
node<ITEM_TYPE>*ptr
= WhereThisGoes(head,item,true,ascending); // CALC - helper
if (ptr == nullptr || head == NULL){
return _InsertHead(head,item);
}
if (ptr->_item == item){
ptr->_item = ptr->_item + item;
return ptr;
}
return _InsertAfter(ptr, item);
}
template <typename ITEM_TYPE>
node<ITEM_TYPE>* _InsertSorted(node<ITEM_TYPE>* &head, // IN - list head
ITEM_TYPE target, // IN - val to ins
bool ascending){ // IN - sort type
node<ITEM_TYPE>* ptr
=WhereThisGoes(head,target,false,ascending); //CALC - helper
if (ptr == NULL || head == NULL){
return _InsertHead(head,target);
}
return _InsertAfter(ptr, target);
}
template <typename ITEM_TYPE>
node<ITEM_TYPE>* WhereThisGoes(node<ITEM_TYPE>* head, // IN - list head
ITEM_TYPE item, // IN - val to ins
bool unique, // IN - if unique
bool ascending){ // IN - sort type
node<ITEM_TYPE>* w = head; // CALC - head traverse
node<ITEM_TYPE> * nextItem = head ->next; // CALC - check ahead
if (ascending == true){
if (item > LastNode(head)->_item){
return LastNode(head);
}
if (item == head->_item && unique == true){
return head;
}
if (item < head->_item){
return nullptr;
}
while (item > nextItem->_item && w != NULL){
nextItem = nextItem->next;
w = w->next;
}
}
if (ascending == false) {
if (item < LastNode(head)->_item){
return LastNode(head);
}
if (item == head->_item && unique == true){
return head;
}
if (item > head->_item){
return nullptr;
}
while (item <= nextItem->_item && w != NULL){
nextItem = nextItem->next;
w = w->next;
}
}
return w;
}
template <typename ITEM_TYPE>
node<ITEM_TYPE>* LastNode(node<ITEM_TYPE>* head){ // IN - list head
node<ITEM_TYPE>* w = head; // IN - to traverse
if (head == NULL){
return head;
}
while (w->next != NULL){
w = w->next;
}
return w;
}
#endif // LINKED_LIST_FUNCTIONS_H
| [
"noreply@github.com"
] | DPJDevelops.noreply@github.com |
d3fc3e725af1ea2e6fac572dbf610781dfd522fe | 119d21268419c53b3f7c1090b430fa7e6a568a82 | /modules/common/monitor_log/monitor_log_buffer.cc | e202efff797c05e90824dd985c56fb0cae166547 | [] | no_license | GoeSysWare/AiwSys | 4444af0e56cc340fdf6343a9765cdfacef2181c9 | 422c334eee782013d381972bd2e84afdf4f6b696 | refs/heads/master | 2022-06-13T22:28:02.464951 | 2020-06-23T02:29:55 | 2020-06-23T02:29:55 | 203,970,151 | 3 | 2 | null | 2022-06-02T21:45:55 | 2019-08-23T09:42:43 | C++ | UTF-8 | C++ | false | false | 1,674 | cc | /******************************************************************************
* Copyright 2017 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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 "modules/common/monitor_log/monitor_log_buffer.h"
#include "cyber/common/log.h"
#include "modules/common/monitor_log/monitor_logger.h"
namespace apollo {
namespace common {
namespace monitor {
MonitorLogBuffer::MonitorLogBuffer(
const MonitorMessageItem::MessageSource &source)
: source_(source) {}
void MonitorLogBuffer::Publish() {
if (!monitor_msg_items_.empty()) {
logger_->Publish(source_, monitor_msg_items_);
monitor_msg_items_.clear();
level_ = MonitorMessageItem::INFO;
}
}
MonitorLogBuffer::~MonitorLogBuffer() { Publish(); }
void MonitorLogBuffer::AddMonitorMsgItem(
const MonitorMessageItem::LogLevel log_level, const std::string &msg) {
level_ = log_level;
monitor_msg_items_.push_back(std::make_pair(log_level, msg));
}
} // namespace monitor
} // namespace common
} // namespace apollo
| [
"guooujie@163.com"
] | guooujie@163.com |
09aa9a26e50353fe09b7c6903c344bdbcfd09be7 | 63f9ff0a595b6592f3adc19016b74172740addcb | /src/examples/cpp/info_reg.cpp | 27ee3fba0ace5a4127f2585461559eb547e09ddd | [
"Apache-2.0"
] | permissive | Ahmadmansoor/Triton | 1b7a68581ed9dc96b0409ee30e5ec204804dd03e | e1a8538ee1512999589f58c0272f0ee33f33c377 | refs/heads/master | 2020-06-27T15:27:02.325454 | 2019-08-01T06:01:50 | 2019-08-01T06:01:50 | 199,987,034 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,291 | cpp | /*
** Output:
**
** $ ./info_reg.bin
** Name : ah
** Size byte : 1
** Size bit : 8
** Highed bit : 15
** Lower bit : 8
** Parent : rax
** operator<< : ah:8 bitsvector[15..8]
*/
#include <iostream>
#include <triton/x86Specifications.hpp>
#include <triton/api.hpp>
using namespace triton;
using namespace triton::arch;
using namespace triton::arch::x86;
int main(int ac, const char **av) {
triton::API api;
/* Set the arch */
api.setArchitecture(ARCH_X86_64);
std::cout << "Name : " << api.getRegister(ID_REG_X86_AH).getName() << std::endl;
std::cout << "Size byte : " << api.getRegister(ID_REG_X86_AH).getSize() << std::endl;
std::cout << "Size bit : " << api.getRegister(ID_REG_X86_AH).getBitSize() << std::endl;
std::cout << "Higher bit : " << api.getRegister(ID_REG_X86_AH).getHigh() << std::endl;
std::cout << "Lower bit : " << api.getRegister(ID_REG_X86_AH).getLow() << std::endl;
std::cout << "Parent : " << api.getParentRegister(ID_REG_X86_AH).getName() << std::endl;
std::cout << "operator<< : " << api.getRegister(ID_REG_X86_AH) << std::endl;
std::cout << "----------------------------" << std::endl;
for(const auto& kv: api.getAllRegisters())
std::cout << kv.second << std::endl;
return 0;
}
| [
"safi43@yahoo.com"
] | safi43@yahoo.com |
08534750b2a8640fee556875eb3737a87e735f49 | 0eff74b05b60098333ad66cf801bdd93becc9ea4 | /second/download/httpd/gumtree/httpd_repos_function_3356_httpd-2.2.14.cpp | 491a56cb13bb836837f595a63bc06ca21f31af4e | [] | no_license | niuxu18/logTracker-old | 97543445ea7e414ed40bdc681239365d33418975 | f2b060f13a0295387fe02187543db124916eb446 | refs/heads/master | 2021-09-13T21:39:37.686481 | 2017-12-11T03:36:34 | 2017-12-11T03:36:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,258 | cpp | int main(int argc, const char *const argv[]) {
int i;
int rv;
int list_provided = 0;
abts_suite *suite = NULL;
initialize();
quiet = !isatty(STDOUT_FILENO);
for (i = 1; i < argc; i++) {
if (!strcmp(argv[i], "-v")) {
verbose = 1;
continue;
}
if (!strcmp(argv[i], "-x")) {
exclude = 1;
continue;
}
if (!strcmp(argv[i], "-l")) {
list_tests = 1;
continue;
}
if (!strcmp(argv[i], "-q")) {
quiet = 1;
continue;
}
if (argv[i][0] == '-') {
fprintf(stderr, "Invalid option: `%s'\n", argv[i]);
exit(1);
}
list_provided = 1;
}
if (list_provided) {
/* Waste a little space here, because it is easier than counting the
* number of tests listed. Besides it is at most three char *.
*/
testlist = calloc(argc + 1, sizeof(char *));
for (i = 1; i < argc; i++) {
testlist[i - 1] = argv[i];
}
}
for (i = 0; i < (sizeof(alltests) / sizeof(struct testlist *)); i++) {
suite = alltests[i].func(suite);
}
rv = report(suite);
return rv;
} | [
"993273596@qq.com"
] | 993273596@qq.com |
8ac306519537f5ed6e230e02f9d9ab80b7353d6b | 670200db52a9b659d777cb7636edd623c41fef78 | /source/soundstreams/DesktopSoundStream.h | 422a631c6c9c61ce2f06e5943c480ab23e3a0b24 | [] | no_license | Skipper89rus/EarsExApp_WinQt | 84f1e25848fe105451eb63927c8b98c8b00ceaf2 | caa038af6aab203b4693da1ee3c803281055a295 | refs/heads/master | 2021-01-10T15:42:10.374991 | 2016-09-15T17:30:30 | 2016-09-15T17:30:54 | 49,210,673 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,423 | h | #ifndef DESKTOPSOUNDSTREAM_H
#define DESKTOPSOUNDSTREAM_H
#include <QObject>
#include <QDebug>
#include <QAudioOutput>
#include <QAudioInput>
#include <QIODevice>
#include "ISoundStream.h"
#include "Common/SoundSampleBuffer.h"
#include "SoundStreamProcessors/SoundStreamProcessorsManager.h"
#include "SoundStreamProcessors/DesktopSoundStreamProcessors/DesktopSoundStreamProcessorTest.h"
namespace EarsExApp
{
class DesktopSoundStream : public QObject, public ISoundStream
{
Q_OBJECT
public:
DesktopSoundStream(QObject* pParent = nullptr);
~DesktopSoundStream(){}
// ISoundStream
virtual void Start();
virtual void Stop();
virtual bool IsStarted() const;
virtual unsigned int GetAvailableProcessors(ISoundStreamProcessor** ppProcessors);
signals:
void readyProcess();
void readyPlay();
private slots:
void readNextSample();
void processNextSample();
void playNextSample();
private:
void prepareAudioFormat(QAudioFormat& format) const;
void prepareAudioIO();
void prepareProcessors();
private:
SoundSampleBuffer _buffer;
QAudioInput* _pAudioInput;
QAudioOutput* _pAudioOutput;
QIODevice* _pInputDevice;
QIODevice* _pOutputDevice;
SoundStreamProcessorsManager _processorsManager;
DesktopSoundStreamProcessorTest* _pDesktopProcessorTest;
bool _isStarted;
};
} // namespace EarsExApp
#endif // DESKTOPSOUNDSTREAM_H
| [
"vasilikhinnikita@gmail.com"
] | vasilikhinnikita@gmail.com |
adc7543541641b5ac92213cef090cd0dbdfb053a | 3172533b0bff8474d1598f455fabca31cbd49bd4 | /thor/thor.ino | af0ab790bbbefc6e498df9359140e80f4beaac55 | [] | no_license | ranjithreynold75/smartlife_embedded | 3ac3e415d236b30a6a1b7865ef1654860032b4f7 | bad30b04974f478c2a5141bd1347cf599b07ea07 | refs/heads/master | 2021-01-01T19:58:03.879648 | 2017-07-29T12:48:04 | 2017-07-29T12:48:04 | 98,731,911 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,191 | ino | #include <Nextion.h>
#include<EEPROM.h>
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include<SoftwareSerial.h>
const char* ssid = "was";
const char* password = "1234qwerty";
const char* mqtt_server = "192.168.43.63";
SoftwareSerial serial(D6, D5); //(rx,tx)
WiFiClient espClient;
PubSubClient client(espClient);
long lastMsg = 0;
char msg[50];
int value = 0;
int gled1=D0;
int vibe=D7;
Nextion nex(serial,9600);
void setup() {
Serial.begin(115200);
pinMode(gled1,OUTPUT);
pinMode(vibe,OUTPUT);
//pinMode(but,INPUT_PULLUP);
//digitalWrite(but,HIGH);
// nex.sendCommand("sleep=0");
nex.sendCommand("page start");
EEPROM.begin(512);
setup_wifi();
client.setServer(mqtt_server, 1883);
client.setCallback(callback);
reconnect();
//autho();
}
void autho()
{
String tempo="";
if(((char)EEPROM.read(1))=='s')
{
Serial.println("sss");
for(int i=0;i<EEPROM.read(2);i++)
{
tempo+=(char)EEPROM.read(i+3);
}
Serial.println(tempo);
if(tempo=="1234")
{
nex.sendCommand("page mainpage");
Serial.println("sent");
}
}
else if(((char)EEPROM.read(1))=='n' ||EEPROM.read(1)==0)
{
Serial.println("NNN");
nex.sendCommand("page Login");
}
}
void setup_wifi() {
delay(10);
// We start by connecting to a WiFi network
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
nex.setComponentText("t0","Connecting to wifi");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
//nex.setComponentText("t1",".");
}
Serial.println("");
nex.setComponentText("t0","Connected!!");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
//nex.setComponentText("t1",String(WiFi.localIP()));
}
void reconnect() {
// Loop until we're reconnected
while (!client.connected()) {
Serial.print("Attempting MQTT connection...");
nex.setComponentText("t0","connecting to cordinator");
// Attempt to connect
if (client.connect("thor")) {
viber();
Serial.println("connected");
autho();
// Once connected, publish an announcement...
client.publish("thor/8754623583/status", "Thor active");
// client.publish("doorlock/fire_fighter/help", "Don't worry openning the door");
// ... and resubscribe
client.subscribe("fire_fighter/kitchen/status");
client.subscribe("house_hold/living/status");
client.subscribe("doorlock/front/status");
client.subscribe("co/msg");
// client.subscribe("fire_fighter/doorlock/help");
//client.subscribe("house_hold/doorlock/help");
}
else {
Serial.print("failed, rc=");
Serial.print(client.state());
nex.sendCommand("page start");
nex.setComponentText("t0","Connecting to coordinator");
Serial.println(" try again in 5 seconds");
// Wait 5 seconds before retrying
delay(5000);
}
}
}
void callback(char* topic, byte* payload, unsigned int length) {
Serial.print("Message arrived [");
Serial.print(topic);
Serial.print("] ");
String msg;
for (int i = 0; i < length; i++) {
msg+=(char)payload[i];
}
if(msg=="fire detected")
{
msg="";
viber();
nex.setComponentText("g0","Fire detected: kitchen");
//client.publish("doorlock/fire_fighter/help","dont worry i will open the door :)");
//delay(5000);
}
else if(msg=="Security breach")
{
nex.setComponentText("g0","Security breach->911 Emergency");
viber();
}
Serial.println();
}
void blinks()
{
digitalWrite(gled1,HIGH);
//digitalWrite(gled2,HIGH);
delay(500);
digitalWrite(gled1,LOW);
//digitalWrite(gled2,LOW);
}
void viber()
{
digitalWrite(vibe,HIGH);
//digitalWrite(gled2,HIGH);
delay(1000);
digitalWrite(vibe,LOW);
//digitalWrite(gled2,LOW);
}
String message1="";
int once1=0;
void loop() {
//serial.println(digitalRead(but));
/*if(digitalRead(but)==0 && once1==0)
{
once1=1;
Serial.println(digitalRead(but));
nex.sendCommand("sleep=1");
}
else if(digitalRead(but)==1 && once1==1)
{
once1=0;
Serial.println(digitalRead(but));
nex.sendCommand("sleep=0");
}
*/
if (!client.connected()) {
reconnect();
}
client.loop();
long now = millis();
if (now - lastMsg > 5000)
{
lastMsg = now;
blinks();
}
message1=nex.listen();
if(message1!="")
{
Serial.print(message1);
if(message1=="1234")
{
nex.sendCommand("page mainpage");
EEPROM.write(1,'s');
EEPROM.write(2,message1.length());
Serial.print("length:");
Serial.println(message1.length());
for(int i=0;i<message1.length();i++)
{
EEPROM.write(i+3,message1[i]);
}
Serial.println("done");
EEPROM.commit();
}
else if(message1=="logout")
{
EEPROM.write(1,'n');
EEPROM.write(2,0);
Serial.print("length:");
Serial.println(message1.length());
for(int i=0;i<message1.length();i++)
{
EEPROM.write(i+3,0);
}
EEPROM.commit();
nex.sendCommand("page Login");
}
else if(message1=="door open")
{
client.publish("thor/8754623583/msg","door open");
}
else if(message1=="70 a")
{
client.publish("thor/8754623583/msg","panic");
}
else
{
nex.setComponentText("t1","Invalid Pin");
}
}
}
| [
"ranjith reynold"
] | ranjith reynold |
ebb01f155b42cbe95557693dc3ee1f7792b60504 | c76e86083eb3cbe3d71c73d60728d5c4951813c4 | /libs/src/svkEPSIPhaseCorrect.h | e95a59a9d37636c14e11eb0d4494afbb9053ff30 | [] | no_license | CSwish/sivic | f9deb093131bc5cb930b2006994110ed72687831 | e2bd908ae94300d49330b197c3cd5797063f8cf7 | refs/heads/master | 2021-01-13T17:08:32.211191 | 2016-03-17T21:02:46 | 2016-03-17T21:02:46 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,516 | h | /*
* Copyright © 2009-2014 The Regents of the University of California.
* All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* • Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* • Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* • None of the names of any campus of the University of California, the name
* "The Regents of the University of California," or the names of any of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*/
/*
* $URL$
* $Rev$
* $Author$
* $Date$
*
* Authors:
*
*
*/
#ifndef SVK_EPSI_PHASE_CORRECT_H
#define SVK_EPSI_PHASE_CORRECT_H
#include <vtkObject.h>
#include <vtkObjectFactory.h>
#include <svkMrsImageFFT.h>
#include <svkImageInPlaceFilter.h>
namespace svk {
using namespace std;
/*!
* This class corrects for the time shift of spectra in the
* EPSI direction that results from the EPSI sampling trajectory.
* For each TR, the spectra from neighboring K space values along
* the EPSI k-space axis are displaced in time relative to one
* another by Dt (time between EPSI samples). This time-domain
* shift is corrected here via the Fourier shift theorem, by applying
* a linear phase shift to the spectra in the frequency domain,
* where the magnitude of the phase shift is a linear functino of the
* distance of the spectrum from the origin of k-space (in EPSI
* direction). Spectra are then inverse FT'd back to the time domain
* resulting in a rectilinear spectral/spatial data set (see Figure 3
* and equation 3 in the following reference).
*
* References:
* Charles H. Cunningham, Daniel B. Vigneron, Albert P. Chen, Duan Xu,
* Sarah J. Nelson, Ralph E. Hurd, Douglas A. Kelley, John M. Pauly:
* "Design of Flyback Echo-Planar Readout Gradients for Magnetic
* Resonance Spectroscopic Imaging", Magnetic Resonance in Medicine
* 54:1286-1289 (2005).
*
*/
class svkEPSIPhaseCorrect : public svkImageInPlaceFilter
{
public:
static svkEPSIPhaseCorrect* New();
vtkTypeRevisionMacro( svkEPSIPhaseCorrect, svkImageInPlaceFilter);
void SetNumEPSIkRead( int numKspaceSamples );
void SetEPSIAxis( int epsiAxis );
void SetEPSIOrigin( float epsiOrigin );
float GetEPSIOrigin();
protected:
svkEPSIPhaseCorrect();
~svkEPSIPhaseCorrect();
virtual int FillInputPortInformation(int port, vtkInformation* info);
// Methods:
virtual int RequestData(
vtkInformation* request,
vtkInformationVector** inputVector,
vtkInformationVector* outputVector
);
private:
void CreateEPSIPhaseCorrectionFactors( vtkImageComplex** phaseArray, int numSpecPts );
int SpectralFFT( svkMrsImageFFT::FFTMode direction );
int numEPSIkRead;
int epsiAxis;
float epsiOrigin;
double* epsiSpatialPhaseCorrection;
svkImageData* tmpData;
};
} //svk
#endif //SVK_EPSI_PHASE_CORRECT_H
| [
"jccrane@users.sourceforge.net"
] | jccrane@users.sourceforge.net |
890f0939a6b97ec45a07ec30cb8703aaaad9f01c | 068d049a187f86b60b55b6e8ac6f3e6a1f7b92fc | /partB/closed_event.cpp | 5bcebe68b5e37c3c52250b21793c706dde28df04 | [] | no_license | Khaled77ue/event_schedule | bfa1e99feb6938e0232b5af90e0babcebc9cceb8 | f384455c9803590fab0c09bd587e93aa3966b542 | refs/heads/main | 2023-07-14T00:49:58.096643 | 2021-08-19T15:59:08 | 2021-08-19T15:59:08 | 397,998,243 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 443 | cpp | #include "closed_event.h"
#include <utility>
using mtm::InvalidStudent;
mtm::ClosedEvent::ClosedEvent( DateWrap const & dateWrap, std::string name):BaseEvent(dateWrap,std::move(name)) {
this->is_it_open= false;
}
void mtm::ClosedEvent::addInvitee(int invitee) {
if(invitee>20000||invitee<=0)
throw InvalidStudent();
if(invitees.find(invitee))throw AlreadyInvited();
invitees.addStudent(invitee);
}
| [
"noreply@github.com"
] | Khaled77ue.noreply@github.com |
d8c52c4504d00a46dd23924f367da05849d02c97 | 5a8abcb19399585034ffbbd6bf3337c60dd1dc1f | /AGS_GUI-build-desktop/ui_passworddialog.h | 24188189897797a2dcbfdc1757f276fe1c81ab89 | [] | no_license | dpasillas/Club-Sign-In-System-GUI--CSIS- | 8edc374fd4a59b0a3bb10aaa67a679fab2ed2ba8 | 61b751a26a0e61910dc219b7bfb330523358c3d3 | refs/heads/master | 2021-01-10T21:37:26.547068 | 2012-03-22T21:04:17 | 2012-03-22T21:04:17 | 3,465,391 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,946 | h | /********************************************************************************
** Form generated from reading UI file 'passworddialog.ui'
**
** Created: Sat Mar 3 19:21:57 2012
** by: Qt User Interface Compiler version 4.7.3
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef UI_PASSWORDDIALOG_H
#define UI_PASSWORDDIALOG_H
#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QDialog>
#include <QtGui/QDialogButtonBox>
#include <QtGui/QFrame>
#include <QtGui/QGridLayout>
#include <QtGui/QGroupBox>
#include <QtGui/QHBoxLayout>
#include <QtGui/QHeaderView>
#include <QtGui/QLabel>
#include <QtGui/QLineEdit>
#include <QtGui/QPushButton>
#include <QtGui/QSpacerItem>
#include <QtGui/QVBoxLayout>
#include <QtGui/QWidget>
QT_BEGIN_NAMESPACE
class Ui_PasswordDialog
{
public:
QVBoxLayout *verticalLayout;
QGridLayout *gridLayout;
QSpacerItem *verticalSpacer;
QSpacerItem *verticalSpacer_2;
QGroupBox *groupBox;
QGridLayout *gridLayout_2;
QPushButton *validate_button;
QLabel *label;
QLineEdit *username_line;
QLabel *label_2;
QLineEdit *password_line;
QWidget *widget;
QHBoxLayout *horizontalLayout;
QFrame *line;
QLabel *label_3;
QLineEdit *nu_line;
QLabel *label_4;
QLineEdit *np_line;
QLabel *label_5;
QLineEdit *validate_np_line;
QDialogButtonBox *buttonBox;
void setupUi(QDialog *PasswordDialog)
{
if (PasswordDialog->objectName().isEmpty())
PasswordDialog->setObjectName(QString::fromUtf8("PasswordDialog"));
PasswordDialog->resize(400, 300);
verticalLayout = new QVBoxLayout(PasswordDialog);
verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
gridLayout = new QGridLayout();
gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
gridLayout->setVerticalSpacing(0);
verticalSpacer = new QSpacerItem(20, 0, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
gridLayout->addItem(verticalSpacer, 0, 0, 1, 1);
verticalSpacer_2 = new QSpacerItem(20, 0, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
gridLayout->addItem(verticalSpacer_2, 2, 0, 1, 1);
groupBox = new QGroupBox(PasswordDialog);
groupBox->setObjectName(QString::fromUtf8("groupBox"));
gridLayout_2 = new QGridLayout(groupBox);
gridLayout_2->setObjectName(QString::fromUtf8("gridLayout_2"));
validate_button = new QPushButton(groupBox);
validate_button->setObjectName(QString::fromUtf8("validate_button"));
gridLayout_2->addWidget(validate_button, 2, 2, 1, 1);
label = new QLabel(groupBox);
label->setObjectName(QString::fromUtf8("label"));
gridLayout_2->addWidget(label, 0, 0, 1, 1);
username_line = new QLineEdit(groupBox);
username_line->setObjectName(QString::fromUtf8("username_line"));
gridLayout_2->addWidget(username_line, 0, 1, 1, 2);
label_2 = new QLabel(groupBox);
label_2->setObjectName(QString::fromUtf8("label_2"));
gridLayout_2->addWidget(label_2, 1, 0, 1, 1);
password_line = new QLineEdit(groupBox);
password_line->setObjectName(QString::fromUtf8("password_line"));
gridLayout_2->addWidget(password_line, 1, 1, 1, 2);
widget = new QWidget(groupBox);
widget->setObjectName(QString::fromUtf8("widget"));
horizontalLayout = new QHBoxLayout(widget);
horizontalLayout->setSpacing(0);
horizontalLayout->setContentsMargins(0, 0, 0, 0);
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
line = new QFrame(widget);
line->setObjectName(QString::fromUtf8("line"));
line->setFrameShape(QFrame::HLine);
line->setFrameShadow(QFrame::Sunken);
horizontalLayout->addWidget(line);
gridLayout_2->addWidget(widget, 3, 0, 2, 3);
label_3 = new QLabel(groupBox);
label_3->setObjectName(QString::fromUtf8("label_3"));
gridLayout_2->addWidget(label_3, 5, 0, 1, 1);
nu_line = new QLineEdit(groupBox);
nu_line->setObjectName(QString::fromUtf8("nu_line"));
gridLayout_2->addWidget(nu_line, 5, 1, 1, 2);
label_4 = new QLabel(groupBox);
label_4->setObjectName(QString::fromUtf8("label_4"));
gridLayout_2->addWidget(label_4, 6, 0, 1, 1);
np_line = new QLineEdit(groupBox);
np_line->setObjectName(QString::fromUtf8("np_line"));
gridLayout_2->addWidget(np_line, 6, 1, 1, 2);
label_5 = new QLabel(groupBox);
label_5->setObjectName(QString::fromUtf8("label_5"));
gridLayout_2->addWidget(label_5, 7, 0, 1, 1);
validate_np_line = new QLineEdit(groupBox);
validate_np_line->setObjectName(QString::fromUtf8("validate_np_line"));
gridLayout_2->addWidget(validate_np_line, 7, 1, 1, 2);
gridLayout->addWidget(groupBox, 1, 0, 1, 1);
verticalLayout->addLayout(gridLayout);
buttonBox = new QDialogButtonBox(PasswordDialog);
buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
buttonBox->setOrientation(Qt::Horizontal);
buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
verticalLayout->addWidget(buttonBox);
#ifndef QT_NO_SHORTCUT
label->setBuddy(username_line);
label_2->setBuddy(password_line);
label_3->setBuddy(nu_line);
label_4->setBuddy(np_line);
label_5->setBuddy(validate_np_line);
#endif // QT_NO_SHORTCUT
retranslateUi(PasswordDialog);
QObject::connect(buttonBox, SIGNAL(accepted()), PasswordDialog, SLOT(accept()));
QObject::connect(buttonBox, SIGNAL(rejected()), PasswordDialog, SLOT(reject()));
QMetaObject::connectSlotsByName(PasswordDialog);
} // setupUi
void retranslateUi(QDialog *PasswordDialog)
{
PasswordDialog->setWindowTitle(QApplication::translate("PasswordDialog", "Dialog", 0, QApplication::UnicodeUTF8));
groupBox->setTitle(QApplication::translate("PasswordDialog", "Update Username/Password", 0, QApplication::UnicodeUTF8));
validate_button->setText(QApplication::translate("PasswordDialog", "Validate", 0, QApplication::UnicodeUTF8));
label->setText(QApplication::translate("PasswordDialog", "Username", 0, QApplication::UnicodeUTF8));
label_2->setText(QApplication::translate("PasswordDialog", "Password", 0, QApplication::UnicodeUTF8));
label_3->setText(QApplication::translate("PasswordDialog", "New Username", 0, QApplication::UnicodeUTF8));
#ifndef QT_NO_TOOLTIP
nu_line->setToolTip(QApplication::translate("PasswordDialog", "Leave blank to keep the same Username", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_TOOLTIP
label_4->setText(QApplication::translate("PasswordDialog", "New Password", 0, QApplication::UnicodeUTF8));
#ifndef QT_NO_TOOLTIP
np_line->setToolTip(QApplication::translate("PasswordDialog", "Leave this and the next line blank to keep the same password", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_TOOLTIP
label_5->setText(QApplication::translate("PasswordDialog", "Verify New Password", 0, QApplication::UnicodeUTF8));
#ifndef QT_NO_TOOLTIP
validate_np_line->setToolTip(QApplication::translate("PasswordDialog", "Leave this and the previous line blank to keep the same password", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_WHATSTHIS
validate_np_line->setWhatsThis(QString());
#endif // QT_NO_WHATSTHIS
} // retranslateUi
};
namespace Ui {
class PasswordDialog: public Ui_PasswordDialog {};
} // namespace Ui
QT_END_NAMESPACE
#endif // UI_PASSWORDDIALOG_H
| [
"cs.daniel.pasillas@gmail.com"
] | cs.daniel.pasillas@gmail.com |
8ed74d2741427c7a76f1c3101f97f5fe787b133d | a01cddcbaca0bf213f70f0b0402b7f5eb3e751e1 | /thirdparty/Ipopt/include/coin/IpLapack.hpp | ac40ccaeca8e535a32cfac4111eabdc26fee7bdc | [
"BSD-3-Clause"
] | permissive | coin-or/Gravity | fc36c90a5ed0e370396a9ed1601af496c20f9a08 | eddd6c293c930104e6b9bab9699aee9c94f8857d | refs/heads/master | 2023-09-01T18:59:23.111469 | 2023-04-06T19:00:31 | 2023-04-06T19:00:31 | 71,549,484 | 142 | 29 | BSD-3-Clause | 2023-08-21T16:58:30 | 2016-10-21T09:11:37 | C++ | UTF-8 | C++ | false | false | 2,105 | hpp | // Copyright (C) 2005, 2009 International Business Machines and others.
// All Rights Reserved.
// This code is published under the Eclipse Public License.
//
// $Id$
//
// Authors: Andreas Waechter IBM 2005-12-25
#ifndef __IPLAPACK_HPP__
#define __IPLAPACK_HPP__
#include "IpUtils.hpp"
#include "IpException.hpp"
namespace Ipopt
{
DECLARE_STD_EXCEPTION(LAPACK_NOT_INCLUDED);
/** Wrapper for LAPACK subroutine DPOTRS. Solving a linear system
* given a Cholesky factorization. We assume that the Cholesky
* factor is lower traiangular. */
void IpLapackDpotrs(Index ndim, Index nrhs, const Number *a, Index lda,
Number *b, Index ldb);
/** Wrapper for LAPACK subroutine DPOTRF. Compute Cholesky
* factorization (lower triangular factor). info is the return
* value from the LAPACK routine. */
void IpLapackDpotrf(Index ndim, Number *a, Index lda, Index& info);
/** Wrapper for LAPACK subroutine DSYEV. Compute the Eigenvalue
* decomposition for a given matrix. If compute_eigenvectors is
* true, a will contain the eigenvectors in its columns on
* return. */
void IpLapackDsyev(bool compute_eigenvectors, Index ndim, Number *a,
Index lda, Number *w, Index& info);
/** Wrapper for LAPACK subroutine DGETRF. Compute LU factorization.
* info is the return value from the LAPACK routine. */
void IpLapackDgetrf(Index ndim, Number *a, Index* pivot, Index lda,
Index& info);
/** Wrapper for LAPACK subroutine DGETRS. Solving a linear system
* given a LU factorization. */
void IpLapackDgetrs(Index ndim, Index nrhs, const Number *a, Index lda,
Index* ipiv, Number *b, Index ldb);
/** Wrapper for LAPACK subroutine DPPSV. Solves a symmetric positive
* definite linear system in packed storage format (upper triangular).
* info is the return value from the LAPACK routine. */
void IpLapackDppsv(Index ndim, Index nrhs, const Number *a,
Number *b, Index ldb, Index& info);
} // namespace Ipopt
#endif
| [
"hlh@lanl.gov"
] | hlh@lanl.gov |
47b9a0c8b38a5423e1f6a06dfc7b192c79a8f27d | 09399557a4f051e170c185094075dd1389cf16b0 | /InvaderV4.7/export/windows/cpp/obj/src/openfl/display3D/textures/TextureBase.cpp | 574b0b07612858f7e5370b41d8d9321163853193 | [] | no_license | XweetyK/Space-Invaders | b737ea731a0356fed61cb8d1ce0ab490cfca4415 | a7e14890a1799e1cb4db9458b7d1be5dafe20df9 | refs/heads/master | 2021-01-21T05:10:05.906530 | 2017-10-04T18:46:17 | 2017-10-04T18:46:17 | 101,913,055 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | true | 9,155 | cpp | // Generated by Haxe 3.4.2 (git build master @ 890f8c7)
#include <hxcpp.h>
#ifndef INCLUDED_openfl__legacy_events_EventDispatcher
#include <openfl/_legacy/events/EventDispatcher.h>
#endif
#ifndef INCLUDED_openfl__legacy_events_IEventDispatcher
#include <openfl/_legacy/events/IEventDispatcher.h>
#endif
#ifndef INCLUDED_openfl__legacy_gl_GLFramebuffer
#include <openfl/_legacy/gl/GLFramebuffer.h>
#endif
#ifndef INCLUDED_openfl__legacy_gl_GLObject
#include <openfl/_legacy/gl/GLObject.h>
#endif
#ifndef INCLUDED_openfl__legacy_gl_GLTexture
#include <openfl/_legacy/gl/GLTexture.h>
#endif
#ifndef INCLUDED_openfl_display3D_Context3D
#include <openfl/display3D/Context3D.h>
#endif
#ifndef INCLUDED_openfl_display3D_textures_TextureBase
#include <openfl/display3D/textures/TextureBase.h>
#endif
HX_DEFINE_STACK_FRAME(_hx_pos_6659164148434b5e_19_new,"openfl.display3D.textures.TextureBase","new",0x670078a1,"openfl.display3D.textures.TextureBase.new","openfl/display3D/textures/TextureBase.hx",19,0x7b0f92ae)
HX_LOCAL_STACK_FRAME(_hx_pos_6659164148434b5e_33_dispose,"openfl.display3D.textures.TextureBase","dispose",0xa678dd60,"openfl.display3D.textures.TextureBase.dispose","openfl/display3D/textures/TextureBase.hx",33,0x7b0f92ae)
namespace openfl{
namespace display3D{
namespace textures{
void TextureBase_obj::__construct( ::openfl::display3D::Context3D context, ::openfl::_legacy::gl::GLTexture glTexture,hx::Null< int > __o_width,hx::Null< int > __o_height){
int width = __o_width.Default(0);
int height = __o_height.Default(0);
HX_STACKFRAME(&_hx_pos_6659164148434b5e_19_new)
HXLINE( 21) super::__construct(null());
HXLINE( 23) this->context = context;
HXLINE( 24) this->width = width;
HXLINE( 25) this->height = height;
HXLINE( 26) this->glTexture = glTexture;
}
Dynamic TextureBase_obj::__CreateEmpty() { return new TextureBase_obj; }
void *TextureBase_obj::_hx_vtable = 0;
Dynamic TextureBase_obj::__Create(hx::DynamicArray inArgs)
{
hx::ObjectPtr< TextureBase_obj > _hx_result = new TextureBase_obj();
_hx_result->__construct(inArgs[0],inArgs[1],inArgs[2],inArgs[3]);
return _hx_result;
}
bool TextureBase_obj::_hx_isInstanceOf(int inClassId) {
if (inClassId<=(int)0x19affbf1) {
return inClassId==(int)0x00000001 || inClassId==(int)0x19affbf1;
} else {
return inClassId==(int)0x25b00754;
}
}
void TextureBase_obj::dispose(){
HX_STACKFRAME(&_hx_pos_6659164148434b5e_33_dispose)
HXDLIN( 33) this->context->_hx___deleteTexture(hx::ObjectPtr<OBJ_>(this));
}
HX_DEFINE_DYNAMIC_FUNC0(TextureBase_obj,dispose,(void))
hx::ObjectPtr< TextureBase_obj > TextureBase_obj::__new( ::openfl::display3D::Context3D context, ::openfl::_legacy::gl::GLTexture glTexture,hx::Null< int > __o_width,hx::Null< int > __o_height) {
hx::ObjectPtr< TextureBase_obj > __this = new TextureBase_obj();
__this->__construct(context,glTexture,__o_width,__o_height);
return __this;
}
hx::ObjectPtr< TextureBase_obj > TextureBase_obj::__alloc(hx::Ctx *_hx_ctx, ::openfl::display3D::Context3D context, ::openfl::_legacy::gl::GLTexture glTexture,hx::Null< int > __o_width,hx::Null< int > __o_height) {
TextureBase_obj *__this = (TextureBase_obj*)(hx::Ctx::alloc(_hx_ctx, sizeof(TextureBase_obj), true, "openfl.display3D.textures.TextureBase"));
*(void **)__this = TextureBase_obj::_hx_vtable;
__this->__construct(context,glTexture,__o_width,__o_height);
return __this;
}
TextureBase_obj::TextureBase_obj()
{
}
void TextureBase_obj::__Mark(HX_MARK_PARAMS)
{
HX_MARK_BEGIN_CLASS(TextureBase);
HX_MARK_MEMBER_NAME(context,"context");
HX_MARK_MEMBER_NAME(height,"height");
HX_MARK_MEMBER_NAME(frameBuffer,"frameBuffer");
HX_MARK_MEMBER_NAME(glTexture,"glTexture");
HX_MARK_MEMBER_NAME(width,"width");
::openfl::_legacy::events::EventDispatcher_obj::__Mark(HX_MARK_ARG);
HX_MARK_END_CLASS();
}
void TextureBase_obj::__Visit(HX_VISIT_PARAMS)
{
HX_VISIT_MEMBER_NAME(context,"context");
HX_VISIT_MEMBER_NAME(height,"height");
HX_VISIT_MEMBER_NAME(frameBuffer,"frameBuffer");
HX_VISIT_MEMBER_NAME(glTexture,"glTexture");
HX_VISIT_MEMBER_NAME(width,"width");
::openfl::_legacy::events::EventDispatcher_obj::__Visit(HX_VISIT_ARG);
}
hx::Val TextureBase_obj::__Field(const ::String &inName,hx::PropertyAccess inCallProp)
{
switch(inName.length) {
case 5:
if (HX_FIELD_EQ(inName,"width") ) { return hx::Val( width ); }
break;
case 6:
if (HX_FIELD_EQ(inName,"height") ) { return hx::Val( height ); }
break;
case 7:
if (HX_FIELD_EQ(inName,"context") ) { return hx::Val( context ); }
if (HX_FIELD_EQ(inName,"dispose") ) { return hx::Val( dispose_dyn() ); }
break;
case 9:
if (HX_FIELD_EQ(inName,"glTexture") ) { return hx::Val( glTexture ); }
break;
case 11:
if (HX_FIELD_EQ(inName,"frameBuffer") ) { return hx::Val( frameBuffer ); }
}
return super::__Field(inName,inCallProp);
}
hx::Val TextureBase_obj::__SetField(const ::String &inName,const hx::Val &inValue,hx::PropertyAccess inCallProp)
{
switch(inName.length) {
case 5:
if (HX_FIELD_EQ(inName,"width") ) { width=inValue.Cast< int >(); return inValue; }
break;
case 6:
if (HX_FIELD_EQ(inName,"height") ) { height=inValue.Cast< int >(); return inValue; }
break;
case 7:
if (HX_FIELD_EQ(inName,"context") ) { context=inValue.Cast< ::openfl::display3D::Context3D >(); return inValue; }
break;
case 9:
if (HX_FIELD_EQ(inName,"glTexture") ) { glTexture=inValue.Cast< ::openfl::_legacy::gl::GLTexture >(); return inValue; }
break;
case 11:
if (HX_FIELD_EQ(inName,"frameBuffer") ) { frameBuffer=inValue.Cast< ::openfl::_legacy::gl::GLFramebuffer >(); return inValue; }
}
return super::__SetField(inName,inValue,inCallProp);
}
void TextureBase_obj::__GetFields(Array< ::String> &outFields)
{
outFields->push(HX_HCSTRING("context","\xef","\x95","\x77","\x19"));
outFields->push(HX_HCSTRING("height","\xe7","\x07","\x4c","\x02"));
outFields->push(HX_HCSTRING("frameBuffer","\x0d","\x89","\xdc","\xae"));
outFields->push(HX_HCSTRING("glTexture","\x36","\x55","\x9b","\x6c"));
outFields->push(HX_HCSTRING("width","\x06","\xb6","\x62","\xca"));
super::__GetFields(outFields);
};
#if HXCPP_SCRIPTABLE
static hx::StorageInfo TextureBase_obj_sMemberStorageInfo[] = {
{hx::fsObject /*::openfl::display3D::Context3D*/ ,(int)offsetof(TextureBase_obj,context),HX_HCSTRING("context","\xef","\x95","\x77","\x19")},
{hx::fsInt,(int)offsetof(TextureBase_obj,height),HX_HCSTRING("height","\xe7","\x07","\x4c","\x02")},
{hx::fsObject /*::openfl::_legacy::gl::GLFramebuffer*/ ,(int)offsetof(TextureBase_obj,frameBuffer),HX_HCSTRING("frameBuffer","\x0d","\x89","\xdc","\xae")},
{hx::fsObject /*::openfl::_legacy::gl::GLTexture*/ ,(int)offsetof(TextureBase_obj,glTexture),HX_HCSTRING("glTexture","\x36","\x55","\x9b","\x6c")},
{hx::fsInt,(int)offsetof(TextureBase_obj,width),HX_HCSTRING("width","\x06","\xb6","\x62","\xca")},
{ hx::fsUnknown, 0, null()}
};
static hx::StaticInfo *TextureBase_obj_sStaticStorageInfo = 0;
#endif
static ::String TextureBase_obj_sMemberFields[] = {
HX_HCSTRING("context","\xef","\x95","\x77","\x19"),
HX_HCSTRING("height","\xe7","\x07","\x4c","\x02"),
HX_HCSTRING("frameBuffer","\x0d","\x89","\xdc","\xae"),
HX_HCSTRING("glTexture","\x36","\x55","\x9b","\x6c"),
HX_HCSTRING("width","\x06","\xb6","\x62","\xca"),
HX_HCSTRING("dispose","\x9f","\x80","\x4c","\xbb"),
::String(null()) };
static void TextureBase_obj_sMarkStatics(HX_MARK_PARAMS) {
HX_MARK_MEMBER_NAME(TextureBase_obj::__mClass,"__mClass");
};
#ifdef HXCPP_VISIT_ALLOCS
static void TextureBase_obj_sVisitStatics(HX_VISIT_PARAMS) {
HX_VISIT_MEMBER_NAME(TextureBase_obj::__mClass,"__mClass");
};
#endif
hx::Class TextureBase_obj::__mClass;
void TextureBase_obj::__register()
{
hx::Object *dummy = new TextureBase_obj;
TextureBase_obj::_hx_vtable = *(void **)dummy;
hx::Static(__mClass) = new hx::Class_obj();
__mClass->mName = HX_HCSTRING("openfl.display3D.textures.TextureBase","\x2f","\x94","\x15","\xbc");
__mClass->mSuper = &super::__SGetClass();
__mClass->mConstructEmpty = &__CreateEmpty;
__mClass->mConstructArgs = &__Create;
__mClass->mGetStaticField = &hx::Class_obj::GetNoStaticField;
__mClass->mSetStaticField = &hx::Class_obj::SetNoStaticField;
__mClass->mMarkFunc = TextureBase_obj_sMarkStatics;
__mClass->mStatics = hx::Class_obj::dupFunctions(0 /* sStaticFields */);
__mClass->mMembers = hx::Class_obj::dupFunctions(TextureBase_obj_sMemberFields);
__mClass->mCanCast = hx::TCanCast< TextureBase_obj >;
#ifdef HXCPP_VISIT_ALLOCS
__mClass->mVisitFunc = TextureBase_obj_sVisitStatics;
#endif
#ifdef HXCPP_SCRIPTABLE
__mClass->mMemberStorageInfo = TextureBase_obj_sMemberStorageInfo;
#endif
#ifdef HXCPP_SCRIPTABLE
__mClass->mStaticStorageInfo = TextureBase_obj_sStaticStorageInfo;
#endif
hx::_hx_RegisterClass(__mClass->mName, __mClass);
}
} // end namespace openfl
} // end namespace display3D
} // end namespace textures
| [
"xweetyk@gmail.com"
] | xweetyk@gmail.com |
20e20208c872f55ed2b1096622e2555b1527aea1 | 3daaefb69e57941b3dee2a616f62121a3939455a | /mgllib/src/input/MglDirectInputDeviceBase.h | 1508d290343a26967bdc4fc6aa70d7ff0c15ede3 | [] | no_license | myun2ext/open-mgl-legacy | 21ccadab8b1569af8fc7e58cf494aaaceee32f1e | 8faf07bad37a742f7174b454700066d53a384eae | refs/heads/master | 2016-09-06T11:41:14.108963 | 2009-12-28T12:06:58 | 2009-12-28T12:06:58 | null | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 1,645 | h | //////////////////////////////////////////////////////////
//
// MglDirectInputDeviceBase - マウス入力クラス
//
// 2008/09/29 古いバッファ記憶対応
//////////////////////////////////////////////////////////
#ifndef __MglDirectInputDeviceBase_H__
#define __MglDirectInputDeviceBase_H__
#include "MglDirectInputBase.h"
// クラス宣言
class DLL_EXP CMglDirectInputDeviceBase : public CMglDirectInputBase, public CMyuReleaseBase
{
protected:
_MGL_IDirectInputDevice *m_pDevice;
//BYTE m_stateBuf[STATEBUF_SIZE];
BYTE *m_pStateBuf;
BYTE *m_pStateBuf2; // 2008/09/29 古いバッファ記憶対応
int m_nStateBufSize;
HWND m_hWnd;
void Acquire();
void Unacquire();
virtual void InitCheck()
{
if ( m_pDevice == NULL )
MyuThrow(20, "CMglDirectInputDeviceBase: Init()を呼び出してください。");
}
int GetStateChanged(int nIndex); // 0:変化なし 正の値:押された 負の値:離された
void SwapStateBuf(){
BYTE* pSwapWork = m_pStateBuf;
m_pStateBuf = m_pStateBuf2;
m_pStateBuf2 = pSwapWork;
}
public:
// コンストラクタ・デストラクタ
CMglDirectInputDeviceBase();
virtual ~CMglDirectInputDeviceBase();
// 初期化と開放
void Init( REFGUID rguid, LPCDIDATAFORMAT dataFormat, int nStateBufSize,
HWND hWnd=NULL, DWORD dwCooperativeFlag=DISCL_NONEXCLUSIVE|DISCL_FOREGROUND );
void Release();
BYTE* UpdateStateBuf();
BYTE* GetStateBuf(){ return m_pStateBuf; }
BYTE* GetOldStateBuf(){ return m_pStateBuf2; }
//BYTE* GetStateBuf(){ return UpdateStateBuf(); }
};
#endif//__MglDirectInputDeviceBase_H__ | [
"myun2@6d62ff88-fa28-0410-b5a4-834eb811a934"
] | myun2@6d62ff88-fa28-0410-b5a4-834eb811a934 |
0962b111422a629aa1d5ea03b1d2948790991d47 | 784e683fe0239f991228e0d7632ace5cc2f55ad8 | /src/global/gui/src/MGUIAssistant.cxx | a397ad7f8ecae52eea42fad459341aae3726bf4a | [] | no_license | rheask8246/megalib | 5751ee8e5b00bc6c9a0cacea2c1d82a600f08336 | a681302a429aa4a9cb1201c00db1d964fb92a056 | refs/heads/master | 2021-07-23T14:13:32.687763 | 2019-01-11T05:41:49 | 2019-01-11T05:41:49 | 239,953,431 | 0 | 0 | null | 2020-02-12T07:39:40 | 2020-02-12T07:39:39 | null | UTF-8 | C++ | false | false | 11,261 | cxx | /*
* MGUIAssistant.cxx
*
*
* Copyright (C) by Andreas Zoglauer.
* All rights reserved.
*
*
* This code implementation is the intellectual property of
* Andreas Zoglauer.
*
* By copying, distributing or modifying the Program (or any work
* based on the Program) you indicate your acceptance of this statement,
* and all its terms.
*
*/
////////////////////////////////////////////////////////////////////////////////
//
// MGUIAssistant
//
//
// This is the base class for most of the other Dialogs.
// It provides some methods all other dialogs need
//
// Important info:
// Always call a derived class via
// MDerived *d = new MDerived(...)
// and never use MDerived d(..) because it will simply always and ever crash.
//
////////////////////////////////////////////////////////////////////////////////
// Include the header:
#include "MGUIAssistant.h"
// Standard libs:
#include <stdlib.h>
#include <ctype.h>
// ROOT libs:
#include "TGLabel.h"
#include "TSystem.h"
// MEGAlib libs:
#include "MStreams.h"
#include "MString.h"
#include "MFile.h"
////////////////////////////////////////////////////////////////////////////////
//#ifdef ___CINT___
//ClassImp(MGUIAssistant)
//#endif
////////////////////////////////////////////////////////////////////////////////
MGUIAssistant::MGUIAssistant()
: TGTransientFrame(gClient->GetRoot(), gClient->GetRoot(), 480, 360)
{
// standard constructor
m_ParentWindow = (TGFrame *) gClient->GetRoot();
}
////////////////////////////////////////////////////////////////////////////////
MGUIAssistant::MGUIAssistant(const TGWindow *p, const TGWindow *main, unsigned int Type, unsigned int w,
unsigned int h, unsigned int options)
: TGTransientFrame(p, main, w, h, options)
{
m_ParentWindow = (TGFrame *) main;
m_Type = Type;
MString Path(g_MEGAlibPath + "/resource/icons/global/Icon.xpm");
MFile::ExpandFileName(Path);
SetIconPixmap(Path);
m_SubTitleLabel = 0;
m_SubTitleFirstLayout = 0;
m_SubTitleMiddleLayout = 0;
m_SubTitleLastLayout = 0;
m_SubTitleOnlyLayout = 0;
m_ButtonsAdded = false;
m_SubTitleAdded = false;
m_LabelFrame = 0;
m_LabelFrameLayout = 0;
m_ButtonFrame = 0;
m_ButtonFrameLayout = 0;
m_BackText = "<< Back <<";
m_BackButton = 0;
m_BackButtonLayout = 0;
m_CancelText = "Cancel";
m_CancelButton = 0;
m_CancelButtonLayout = 0;
m_NextText = ">> Next >>";
m_NextButton = 0;
m_NextButtonLayout = 0;
m_ButtonFrame = 0;
m_ButtonFrameLayout = 0;
}
////////////////////////////////////////////////////////////////////////////////
MGUIAssistant::~MGUIAssistant()
{
m_ParentWindow = 0;
//if (m_SubTitleAdded == true) {
delete m_SubTitleLabel;
delete m_SubTitleFirstLayout;
delete m_SubTitleMiddleLayout;
delete m_SubTitleLastLayout;
delete m_SubTitleOnlyLayout;
delete m_LabelFrame;
delete m_LabelFrameLayout;
//}
delete m_BackButton;
delete m_BackButtonLayout;
delete m_CancelButton;
delete m_CancelButtonLayout;
delete m_NextButton;
delete m_NextButtonLayout;
delete m_ButtonFrame;
delete m_ButtonFrameLayout;
}
////////////////////////////////////////////////////////////////////////////////
void MGUIAssistant::CloseWindow()
{
// When the x is pressed, this function is called.
DeleteWindow();
}
////////////////////////////////////////////////////////////////////////////////
void MGUIAssistant::PositionWindow(int Width, int Height, bool AllowResize)
{
// This method positions the dialog window in the center of its parent window,
// but (if possible) the whole window is shown on the screen.
// First we compute the above-mentioned x and y coordinates ...
int x = 0, y = 0;
Window_t WindowDummy;
gVirtualX->TranslateCoordinates(m_ParentWindow->GetId(),
GetParent()->GetId(),
(m_ParentWindow->GetWidth() - Width) >> 1,
(m_ParentWindow->GetHeight() - Height) >> 1,
x,
y,
WindowDummy);
// ... get the width and height of the display ...
int xDisplay, yDisplay;
unsigned int wDisplay, hDisplay;
gVirtualX->GetGeometry(-1, xDisplay, yDisplay, wDisplay, hDisplay);
// ... make sure that the whole dialog window is shown on the screen ...
if (Width > (int) wDisplay) Width = wDisplay - 50;
if (Height > (int) hDisplay) Height = hDisplay - 50;
if (x + Width > (int) wDisplay)
x = wDisplay - Width - 8;
if (y + Height > (int) hDisplay)
y = hDisplay - Height - 28;
if (x < 0)
x = 0;
if (y < 0)
y = 0;
// ... and bring the dialog to the calculated position.
MoveResize(x, y, Width, Height);
if (AllowResize == true) {
TGDimension size = GetSize();
SetWMSize(size.fWidth, size.fHeight);
SetWMSizeHints(size.fWidth, size.fHeight, size.fWidth, size.fHeight, 0, 0);
}
return;
}
////////////////////////////////////////////////////////////////////////////////
void MGUIAssistant::Header(MString SubTitle)
{
// Add a label to the top of the window:
if (m_SubTitleAdded == false) {
m_LabelFrame = new TGVerticalFrame(this, 100, 10, kRaisedFrame);
m_LabelFrameLayout =
new TGLayoutHints(kLHintsExpandX, 10, 10, 10, 30);
AddFrame(m_LabelFrame, m_LabelFrameLayout);
m_SubTitleLabel = new TObjArray();
m_SubTitleFirstLayout =
new TGLayoutHints(kLHintsCenterX | kLHintsExpandX | kLHintsTop, 20, 20, 5, 1);
m_SubTitleMiddleLayout =
new TGLayoutHints(kLHintsCenterX | kLHintsExpandX | kLHintsTop, 20, 20, 1, 1);
m_SubTitleLastLayout =
new TGLayoutHints(kLHintsCenterX | kLHintsExpandX | kLHintsTop, 20, 20, 1, 5);
m_SubTitleOnlyLayout =
new TGLayoutHints(kLHintsCenterX | kLHintsExpandX | kLHintsTop, 20, 20, 5, 5);
bool First = true;
int LabelIndex = 0;
MString SubString;
// (start a new line for each '\n')
while (SubTitle.Contains('\n') == true) {
SubString = SubTitle;
SubString = SubString.Remove(SubString.First('\n'), SubString.Length() - SubString.First('\n'));
m_SubTitleLabel->AddAt(new TGLabel(m_LabelFrame,
new TGString(SubString)), LabelIndex++);
if (First == true) {
m_LabelFrame->AddFrame((TGLabel *) m_SubTitleLabel->At(LabelIndex-1),
m_SubTitleFirstLayout);
First = false;
} else {
m_LabelFrame->AddFrame((TGLabel *) m_SubTitleLabel->At(LabelIndex-1),
m_SubTitleMiddleLayout);
}
SubTitle.Replace(0, SubTitle.First('\n')+1, "");
}
m_SubTitleLabel->AddAt(new TGLabel(m_LabelFrame,
new TGString(SubTitle)), LabelIndex++);
if (First == true) {
m_LabelFrame->AddFrame((TGLabel *) m_SubTitleLabel->At(LabelIndex-1),
m_SubTitleOnlyLayout);
} else {
m_LabelFrame->AddFrame((TGLabel *) m_SubTitleLabel->At(LabelIndex-1),
m_SubTitleLastLayout);
}
} else {
Error("void MGUIAssistant::AddSubTitle(MString SubTitle)",
"SubTitle has already been added!");
}
m_SubTitleAdded = true;
return;
}
////////////////////////////////////////////////////////////////////////////////
void SetFooterText(MString Back, MString Next, MString Cancel);
////////////////////////////////////////////////////////////////////////////////
void MGUIAssistant::Footer()
{
// Add the Ok- and Cancel-Buttons
if (m_ButtonsAdded == false) {
m_ButtonFrame = new TGHorizontalFrame(this, 150, 25);
m_ButtonFrameLayout =
new TGLayoutHints(kLHintsBottom | kLHintsExpandX | kLHintsCenterX,
5, 5, 30, 10);
AddFrame(m_ButtonFrame, m_ButtonFrameLayout);
m_BackButton = new TGTextButton(m_ButtonFrame, m_BackText, c_Back);
if (m_Type == c_First) {
m_BackButton->SetState(kButtonDisabled);
//m_BackButton->SetText("");
//m_BackButton->ChangeOptions(0);
}
m_BackButton->Associate(this);
m_BackButtonLayout =
new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 5, 15, 0, 0);
m_ButtonFrame->AddFrame(m_BackButton, m_BackButtonLayout);
m_CancelButton = new TGTextButton(m_ButtonFrame, m_CancelText, c_Cancel);
m_CancelButton->Associate(this);
m_CancelButtonLayout =
new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 15, 15, 0, 0);
m_ButtonFrame->AddFrame(m_CancelButton, m_CancelButtonLayout);
if (m_Type == c_Last) {
m_NextText = "Finish";
}
m_NextButton = new TGTextButton(m_ButtonFrame, m_NextText, c_Next);
m_NextButton->Associate(this);
m_NextButtonLayout =
new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 15, 5, 0, 0);
m_ButtonFrame->AddFrame(m_NextButton, m_NextButtonLayout);
}
PositionWindow(GetDefaultWidth(), GetDefaultHeight());
// and bring it to the screen.
MapSubwindows();
MapWindow();
Layout();
return;
}
////////////////////////////////////////////////////////////////////////////////
bool MGUIAssistant::ProcessMessage(long Message, long Parameter1,
long Parameter2)
{
// Process the messages for this application
switch (GET_MSG(Message)) {
case kC_COMMAND:
switch (GET_SUBMSG(Message)) {
case kCM_BUTTON:
switch (Parameter1) {
case c_Back:
OnBack();
break;
case c_Next:
OnNext();
break;
case c_Cancel:
OnCancel();
break;
default:
break;
}
break;
default:
break;
}
break;
default:
break;
}
return true;
}
////////////////////////////////////////////////////////////////////////////////
void MGUIAssistant::OnBack()
{
// The back button has been pressed
return;
}
////////////////////////////////////////////////////////////////////////////////
void MGUIAssistant::OnNext()
{
// The next button has been pressed
return;
}
////////////////////////////////////////////////////////////////////////////////
void MGUIAssistant::OnCancel()
{
// The cancel button has been pressed
m_ParentWindow->MapWindow();
CloseWindow();
}
////////////////////////////////////////////////////////////////////////////////
void MGUIAssistant::SetTextBack(MString String)
{
m_BackText = String;
if (m_BackButton != 0) {
m_BackButton->SetText(m_BackText.Data());
m_BackButton->Layout();
}
}
////////////////////////////////////////////////////////////////////////////////
void MGUIAssistant::SetTextNext(MString String)
{
m_NextText = String;
if (m_NextButton != 0) {
m_NextButton->SetText(m_NextText.Data());
m_NextButton->Layout();
}
}
////////////////////////////////////////////////////////////////////////////////
void MGUIAssistant::SetTextCancel(MString String)
{
m_CancelText = String;
if (m_CancelButton != 0) {
m_CancelButton->SetText(m_CancelText.Data());
m_CancelButton->Layout();
}
}
// MGUIAssistant: the end...
////////////////////////////////////////////////////////////////////////////////
| [
"andreas@megalibtoolkit.com"
] | andreas@megalibtoolkit.com |
173acba51c920259aed967febdbe859829bff6d9 | 05cf250793d00cdd7fc7c03cd60a2a705865eab9 | /afrodita-firefox/src/main/include-deps/gcc/nsIPrefBranch.h | e285c3232a95020b62b74ff37cf593add3769462 | [] | no_license | SoffidIAM/esso | 53dcfcbf22b02f0b2fdc1314eb55749c5d1ca158 | 8b3e04e596a549b9b8ecab186f16680298afd1dc | refs/heads/master | 2022-07-25T06:59:29.348943 | 2022-07-07T13:10:37 | 2022-07-07T13:10:37 | 19,988,314 | 9 | 5 | null | 2020-10-12T23:51:27 | 2014-05-20T16:25:21 | C++ | UTF-8 | C++ | false | false | 23,984 | h | /*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/dev/mozilla/mozilla/modules/libpref/public/nsIPrefBranch.idl
*/
#ifndef __gen_nsIPrefBranch_h__
#define __gen_nsIPrefBranch_h__
#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIPrefBranch */
#define NS_IPREFBRANCH_IID_STR "56c35506-f14b-11d3-99d3-ddbfac2ccf65"
#define NS_IPREFBRANCH_IID \
{0x56c35506, 0xf14b, 0x11d3, \
{ 0x99, 0xd3, 0xdd, 0xbf, 0xac, 0x2c, 0xcf, 0x65 }}
/**
* The nsIPrefBranch interface is used to manipulate the preferences data. This
* object may be obtained from the preferences service (nsIPrefService) and
* used to get and set default and/or user preferences across the application.
*
* This object is created with a "root" value which describes the base point in
* the preferences "tree" from which this "branch" stems. Preferences are
* accessed off of this root by using just the final portion of the preference.
* For example, if this object is created with the root "browser.startup.",
* the preferences "browser.startup.page", "browser.startup.homepage",
* and "browser.startup.homepage_override" can be accessed by simply passing
* "page", "homepage", or "homepage_override" to the various Get/Set methods.
*
* @see nsIPrefService
*
* @status FROZEN
*/
class NS_NO_VTABLE nsIPrefBranch : public nsISupports {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IPREFBRANCH_IID)
/**
* Values describing the basic preference types.
*
* @see getPrefType
*/
enum { PREF_INVALID = 0 };
enum { PREF_STRING = 32 };
enum { PREF_INT = 64 };
enum { PREF_BOOL = 128 };
/**
* Called to get the root on which this branch is based, such as
* "browser.startup."
*/
/* readonly attribute string root; */
NS_IMETHOD GetRoot(char * *aRoot) = 0;
/**
* Called to determine the type of a specific preference.
*
* @param aPrefName The preference to get the type of.
*
* @return long A value representing the type of the preference. This
* value will be PREF_STRING, PREF_INT, or PREF_BOOL.
*/
/* long getPrefType (in string aPrefName); */
NS_IMETHOD GetPrefType(const char *aPrefName, PRInt32 *_retval) = 0;
/**
* Called to get the state of an individual boolean preference.
*
* @param aPrefName The boolean preference to get the state of.
*
* @return boolean The value of the requested boolean preference.
*
* @see setBoolPref
*/
/* boolean getBoolPref (in string aPrefName); */
NS_IMETHOD GetBoolPref(const char *aPrefName, PRBool *_retval) = 0;
/**
* Called to set the state of an individual boolean preference.
*
* @param aPrefName The boolean preference to set the state of.
* @param aValue The boolean value to set the preference to.
*
* @return NS_OK The value was successfully set.
* @return Other The value was not set or is the wrong type.
*
* @see getBoolPref
*/
/* void setBoolPref (in string aPrefName, in long aValue); */
NS_IMETHOD SetBoolPref(const char *aPrefName, PRInt32 aValue) = 0;
/**
* Called to get the state of an individual string preference.
*
* @param aPrefName The string preference to retrieve.
*
* @return string The value of the requested string preference.
*
* @see setCharPref
*/
/* string getCharPref (in string aPrefName); */
NS_IMETHOD GetCharPref(const char *aPrefName, char **_retval) = 0;
/**
* Called to set the state of an individual string preference.
*
* @param aPrefName The string preference to set.
* @param aValue The string value to set the preference to.
*
* @return NS_OK The value was successfully set.
* @return Other The value was not set or is the wrong type.
*
* @see getCharPref
*/
/* void setCharPref (in string aPrefName, in string aValue); */
NS_IMETHOD SetCharPref(const char *aPrefName, const char *aValue) = 0;
/**
* Called to get the state of an individual integer preference.
*
* @param aPrefName The integer preference to get the value of.
*
* @return long The value of the requested integer preference.
*
* @see setIntPref
*/
/* long getIntPref (in string aPrefName); */
NS_IMETHOD GetIntPref(const char *aPrefName, PRInt32 *_retval) = 0;
/**
* Called to set the state of an individual integer preference.
*
* @param aPrefName The integer preference to set the value of.
* @param aValue The integer value to set the preference to.
*
* @return NS_OK The value was successfully set.
* @return Other The value was not set or is the wrong type.
*
* @see getIntPref
*/
/* void setIntPref (in string aPrefName, in long aValue); */
NS_IMETHOD SetIntPref(const char *aPrefName, PRInt32 aValue) = 0;
/**
* Called to get the state of an individual complex preference. A complex
* preference is a preference which represents an XPCOM object that can not
* be easily represented using a standard boolean, integer or string value.
*
* @param aPrefName The complex preference to get the value of.
* @param aType The XPCOM interface that this complex preference
* represents. Interfaces currently supported are:
* - nsILocalFile
* - nsISupportsString (UniChar)
* - nsIPrefLocalizedString (Localized UniChar)
* - nsIFileSpec (deprecated - to be removed eventually)
* @param aValue The XPCOM object into which to the complex preference
* value should be retrieved.
*
* @return NS_OK The value was successfully retrieved.
* @return Other The value does not exist or is the wrong type.
*
* @see setComplexValue
*/
/* void getComplexValue (in string aPrefName, in nsIIDRef aType, [iid_is (aType), retval] out nsQIResult aValue); */
NS_IMETHOD GetComplexValue(const char *aPrefName, const nsIID & aType, void * *aValue) = 0;
/**
* Called to set the state of an individual complex preference. A complex
* preference is a preference which represents an XPCOM object that can not
* be easily represented using a standard boolean, integer or string value.
*
* @param aPrefName The complex preference to set the value of.
* @param aType The XPCOM interface that this complex preference
* represents. Interfaces currently supported are:
* - nsILocalFile
* - nsISupportsString (UniChar)
* - nsIPrefLocalizedString (Localized UniChar)
* - nsIFileSpec (deprecated - to be removed eventually)
* @param aValue The XPCOM object from which to set the complex preference
* value.
*
* @return NS_OK The value was successfully set.
* @return Other The value was not set or is the wrong type.
*
* @see getComplexValue
*/
/* void setComplexValue (in string aPrefName, in nsIIDRef aType, in nsISupports aValue); */
NS_IMETHOD SetComplexValue(const char *aPrefName, const nsIID & aType, nsISupports *aValue) = 0;
/**
* Called to clear a user set value from a specific preference. This will, in
* effect, reset the value to the default value. If no default value exists
* the preference will cease to exist.
*
* @param aPrefName The preference to be cleared.
*
* @note
* This method does nothing if this object is a default branch.
*
* @return NS_OK The user preference was successfully cleared.
* @return Other The preference does not exist or have a user set value.
*/
/* void clearUserPref (in string aPrefName); */
NS_IMETHOD ClearUserPref(const char *aPrefName) = 0;
/**
* Called to lock a specific preference. Locking a preference will cause the
* preference service to always return the default value regardless of
* whether there is a user set value or not.
*
* @param aPrefName The preference to be locked.
*
* @note
* This method can be called on either a default or user branch but, in
* effect, always operates on the default branch.
*
* @return NS_OK The preference was successfully locked.
* @return Other The preference does not exist or an error occurred.
*
* @see unlockPref
*/
/* void lockPref (in string aPrefName); */
NS_IMETHOD LockPref(const char *aPrefName) = 0;
/**
* Called to check if a specific preference has a user value associated to
* it.
*
* @param aPrefName The preference to be tested.
*
* @note
* This method can be called on either a default or user branch but, in
* effect, always operates on the user branch.
*
* @note
* If a preference was manually set to a value that equals the default value,
* then the preference no longer has a user set value, i.e. it is
* considered reset to its default value.
* In particular, this method will return false for such a preference and
* the preference will not be saved to a file by nsIPrefService.savePrefFile.
*
* @return boolean true The preference has a user set value.
* false The preference only has a default value.
*/
/* boolean prefHasUserValue (in string aPrefName); */
NS_IMETHOD PrefHasUserValue(const char *aPrefName, PRBool *_retval) = 0;
/**
* Called to check if a specific preference is locked. If a preference is
* locked calling its Get method will always return the default value.
*
* @param aPrefName The preference to be tested.
*
* @note
* This method can be called on either a default or user branch but, in
* effect, always operates on the default branch.
*
* @return boolean true The preference is locked.
* false The preference is not locked.
*
* @see lockPref
* @see unlockPref
*/
/* boolean prefIsLocked (in string aPrefName); */
NS_IMETHOD PrefIsLocked(const char *aPrefName, PRBool *_retval) = 0;
/**
* Called to unlock a specific preference. Unlocking a previously locked
* preference allows the preference service to once again return the user set
* value of the preference.
*
* @param aPrefName The preference to be unlocked.
*
* @note
* This method can be called on either a default or user branch but, in
* effect, always operates on the default branch.
*
* @return NS_OK The preference was successfully unlocked.
* @return Other The preference does not exist or an error occurred.
*
* @see lockPref
*/
/* void unlockPref (in string aPrefName); */
NS_IMETHOD UnlockPref(const char *aPrefName) = 0;
/**
* Called to remove all of the preferences referenced by this branch.
*
* @param aStartingAt The point on the branch at which to start the deleting
* preferences. Pass in "" to remove all preferences
* referenced by this branch.
*
* @note
* This method can be called on either a default or user branch but, in
* effect, always operates on both.
*
* @return NS_OK The preference(s) were successfully removed.
* @return Other The preference(s) do not exist or an error occurred.
*/
/* void deleteBranch (in string aStartingAt); */
NS_IMETHOD DeleteBranch(const char *aStartingAt) = 0;
/**
* Returns an array of strings representing the child preferences of the
* root of this branch.
*
* @param aStartingAt The point on the branch at which to start enumerating
* the child preferences. Pass in "" to enumerate all
* preferences referenced by this branch.
* @param aCount Receives the number of elements in the array.
* @param aChildArray Receives the array of child preferences.
*
* @note
* This method can be called on either a default or user branch but, in
* effect, always operates on both.
*
* @return NS_OK The preference list was successfully retrieved.
* @return Other The preference(s) do not exist or an error occurred.
*/
/* void getChildList (in string aStartingAt, out unsigned long aCount, [array, size_is (aCount), retval] out string aChildArray); */
NS_IMETHOD GetChildList(const char *aStartingAt, PRUint32 *aCount, char ***aChildArray) = 0;
/**
* Called to reset all of the preferences referenced by this branch to their
* default values.
*
* @param aStartingAt The point on the branch at which to start the resetting
* preferences to their default values. Pass in "" to
* reset all preferences referenced by this branch.
*
* @note
* This method can be called on either a default or user branch but, in
* effect, always operates on the user branch.
*
* @return NS_OK The preference(s) were successfully reset.
* @return Other The preference(s) do not exist or an error occurred.
*/
/* void resetBranch (in string aStartingAt); */
NS_IMETHOD ResetBranch(const char *aStartingAt) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIPrefBranch, NS_IPREFBRANCH_IID)
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIPREFBRANCH \
NS_IMETHOD GetRoot(char * *aRoot); \
NS_IMETHOD GetPrefType(const char *aPrefName, PRInt32 *_retval); \
NS_IMETHOD GetBoolPref(const char *aPrefName, PRBool *_retval); \
NS_IMETHOD SetBoolPref(const char *aPrefName, PRInt32 aValue); \
NS_IMETHOD GetCharPref(const char *aPrefName, char **_retval); \
NS_IMETHOD SetCharPref(const char *aPrefName, const char *aValue); \
NS_IMETHOD GetIntPref(const char *aPrefName, PRInt32 *_retval); \
NS_IMETHOD SetIntPref(const char *aPrefName, PRInt32 aValue); \
NS_IMETHOD GetComplexValue(const char *aPrefName, const nsIID & aType, void * *aValue); \
NS_IMETHOD SetComplexValue(const char *aPrefName, const nsIID & aType, nsISupports *aValue); \
NS_IMETHOD ClearUserPref(const char *aPrefName); \
NS_IMETHOD LockPref(const char *aPrefName); \
NS_IMETHOD PrefHasUserValue(const char *aPrefName, PRBool *_retval); \
NS_IMETHOD PrefIsLocked(const char *aPrefName, PRBool *_retval); \
NS_IMETHOD UnlockPref(const char *aPrefName); \
NS_IMETHOD DeleteBranch(const char *aStartingAt); \
NS_IMETHOD GetChildList(const char *aStartingAt, PRUint32 *aCount, char ***aChildArray); \
NS_IMETHOD ResetBranch(const char *aStartingAt);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIPREFBRANCH(_to) \
NS_IMETHOD GetRoot(char * *aRoot) { return _to GetRoot(aRoot); } \
NS_IMETHOD GetPrefType(const char *aPrefName, PRInt32 *_retval) { return _to GetPrefType(aPrefName, _retval); } \
NS_IMETHOD GetBoolPref(const char *aPrefName, PRBool *_retval) { return _to GetBoolPref(aPrefName, _retval); } \
NS_IMETHOD SetBoolPref(const char *aPrefName, PRInt32 aValue) { return _to SetBoolPref(aPrefName, aValue); } \
NS_IMETHOD GetCharPref(const char *aPrefName, char **_retval) { return _to GetCharPref(aPrefName, _retval); } \
NS_IMETHOD SetCharPref(const char *aPrefName, const char *aValue) { return _to SetCharPref(aPrefName, aValue); } \
NS_IMETHOD GetIntPref(const char *aPrefName, PRInt32 *_retval) { return _to GetIntPref(aPrefName, _retval); } \
NS_IMETHOD SetIntPref(const char *aPrefName, PRInt32 aValue) { return _to SetIntPref(aPrefName, aValue); } \
NS_IMETHOD GetComplexValue(const char *aPrefName, const nsIID & aType, void * *aValue) { return _to GetComplexValue(aPrefName, aType, aValue); } \
NS_IMETHOD SetComplexValue(const char *aPrefName, const nsIID & aType, nsISupports *aValue) { return _to SetComplexValue(aPrefName, aType, aValue); } \
NS_IMETHOD ClearUserPref(const char *aPrefName) { return _to ClearUserPref(aPrefName); } \
NS_IMETHOD LockPref(const char *aPrefName) { return _to LockPref(aPrefName); } \
NS_IMETHOD PrefHasUserValue(const char *aPrefName, PRBool *_retval) { return _to PrefHasUserValue(aPrefName, _retval); } \
NS_IMETHOD PrefIsLocked(const char *aPrefName, PRBool *_retval) { return _to PrefIsLocked(aPrefName, _retval); } \
NS_IMETHOD UnlockPref(const char *aPrefName) { return _to UnlockPref(aPrefName); } \
NS_IMETHOD DeleteBranch(const char *aStartingAt) { return _to DeleteBranch(aStartingAt); } \
NS_IMETHOD GetChildList(const char *aStartingAt, PRUint32 *aCount, char ***aChildArray) { return _to GetChildList(aStartingAt, aCount, aChildArray); } \
NS_IMETHOD ResetBranch(const char *aStartingAt) { return _to ResetBranch(aStartingAt); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIPREFBRANCH(_to) \
NS_IMETHOD GetRoot(char * *aRoot) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetRoot(aRoot); } \
NS_IMETHOD GetPrefType(const char *aPrefName, PRInt32 *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetPrefType(aPrefName, _retval); } \
NS_IMETHOD GetBoolPref(const char *aPrefName, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetBoolPref(aPrefName, _retval); } \
NS_IMETHOD SetBoolPref(const char *aPrefName, PRInt32 aValue) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetBoolPref(aPrefName, aValue); } \
NS_IMETHOD GetCharPref(const char *aPrefName, char **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCharPref(aPrefName, _retval); } \
NS_IMETHOD SetCharPref(const char *aPrefName, const char *aValue) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetCharPref(aPrefName, aValue); } \
NS_IMETHOD GetIntPref(const char *aPrefName, PRInt32 *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetIntPref(aPrefName, _retval); } \
NS_IMETHOD SetIntPref(const char *aPrefName, PRInt32 aValue) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetIntPref(aPrefName, aValue); } \
NS_IMETHOD GetComplexValue(const char *aPrefName, const nsIID & aType, void * *aValue) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetComplexValue(aPrefName, aType, aValue); } \
NS_IMETHOD SetComplexValue(const char *aPrefName, const nsIID & aType, nsISupports *aValue) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetComplexValue(aPrefName, aType, aValue); } \
NS_IMETHOD ClearUserPref(const char *aPrefName) { return !_to ? NS_ERROR_NULL_POINTER : _to->ClearUserPref(aPrefName); } \
NS_IMETHOD LockPref(const char *aPrefName) { return !_to ? NS_ERROR_NULL_POINTER : _to->LockPref(aPrefName); } \
NS_IMETHOD PrefHasUserValue(const char *aPrefName, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->PrefHasUserValue(aPrefName, _retval); } \
NS_IMETHOD PrefIsLocked(const char *aPrefName, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->PrefIsLocked(aPrefName, _retval); } \
NS_IMETHOD UnlockPref(const char *aPrefName) { return !_to ? NS_ERROR_NULL_POINTER : _to->UnlockPref(aPrefName); } \
NS_IMETHOD DeleteBranch(const char *aStartingAt) { return !_to ? NS_ERROR_NULL_POINTER : _to->DeleteBranch(aStartingAt); } \
NS_IMETHOD GetChildList(const char *aStartingAt, PRUint32 *aCount, char ***aChildArray) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetChildList(aStartingAt, aCount, aChildArray); } \
NS_IMETHOD ResetBranch(const char *aStartingAt) { return !_to ? NS_ERROR_NULL_POINTER : _to->ResetBranch(aStartingAt); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsPrefBranch : public nsIPrefBranch
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIPREFBRANCH
nsPrefBranch();
private:
~nsPrefBranch();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsPrefBranch, nsIPrefBranch)
nsPrefBranch::nsPrefBranch()
{
/* member initializers and constructor code */
}
nsPrefBranch::~nsPrefBranch()
{
/* destructor code */
}
/* readonly attribute string root; */
NS_IMETHODIMP nsPrefBranch::GetRoot(char * *aRoot)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* long getPrefType (in string aPrefName); */
NS_IMETHODIMP nsPrefBranch::GetPrefType(const char *aPrefName, PRInt32 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* boolean getBoolPref (in string aPrefName); */
NS_IMETHODIMP nsPrefBranch::GetBoolPref(const char *aPrefName, PRBool *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void setBoolPref (in string aPrefName, in long aValue); */
NS_IMETHODIMP nsPrefBranch::SetBoolPref(const char *aPrefName, PRInt32 aValue)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* string getCharPref (in string aPrefName); */
NS_IMETHODIMP nsPrefBranch::GetCharPref(const char *aPrefName, char **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void setCharPref (in string aPrefName, in string aValue); */
NS_IMETHODIMP nsPrefBranch::SetCharPref(const char *aPrefName, const char *aValue)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* long getIntPref (in string aPrefName); */
NS_IMETHODIMP nsPrefBranch::GetIntPref(const char *aPrefName, PRInt32 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void setIntPref (in string aPrefName, in long aValue); */
NS_IMETHODIMP nsPrefBranch::SetIntPref(const char *aPrefName, PRInt32 aValue)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void getComplexValue (in string aPrefName, in nsIIDRef aType, [iid_is (aType), retval] out nsQIResult aValue); */
NS_IMETHODIMP nsPrefBranch::GetComplexValue(const char *aPrefName, const nsIID & aType, void * *aValue)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void setComplexValue (in string aPrefName, in nsIIDRef aType, in nsISupports aValue); */
NS_IMETHODIMP nsPrefBranch::SetComplexValue(const char *aPrefName, const nsIID & aType, nsISupports *aValue)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void clearUserPref (in string aPrefName); */
NS_IMETHODIMP nsPrefBranch::ClearUserPref(const char *aPrefName)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void lockPref (in string aPrefName); */
NS_IMETHODIMP nsPrefBranch::LockPref(const char *aPrefName)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* boolean prefHasUserValue (in string aPrefName); */
NS_IMETHODIMP nsPrefBranch::PrefHasUserValue(const char *aPrefName, PRBool *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* boolean prefIsLocked (in string aPrefName); */
NS_IMETHODIMP nsPrefBranch::PrefIsLocked(const char *aPrefName, PRBool *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void unlockPref (in string aPrefName); */
NS_IMETHODIMP nsPrefBranch::UnlockPref(const char *aPrefName)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void deleteBranch (in string aStartingAt); */
NS_IMETHODIMP nsPrefBranch::DeleteBranch(const char *aStartingAt)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void getChildList (in string aStartingAt, out unsigned long aCount, [array, size_is (aCount), retval] out string aChildArray); */
NS_IMETHODIMP nsPrefBranch::GetChildList(const char *aStartingAt, PRUint32 *aCount, char ***aChildArray)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void resetBranch (in string aStartingAt); */
NS_IMETHODIMP nsPrefBranch::ResetBranch(const char *aStartingAt)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#define NS_PREFBRANCH_CONTRACTID "@mozilla.org/preferencesbranch;1"
#define NS_PREFBRANCH_CLASSNAME "Preferences Branch"
#endif /* __gen_nsIPrefBranch_h__ */
| [
"open@forge.brujula.es"
] | open@forge.brujula.es |
d4acbb085028969c08ce03192ddda2e1d2e8a1b8 | 7738fbcbbe9a0619a9c370e5c0d0097825f98302 | /ACMAMR15_B.cpp | b680b2966c9fbad9592296a8c36657947d348a22 | [] | no_license | MSharique/competitive_codes | 73e12dc5270c4ee73697f35f9caff9909ec2c4e0 | da3b39a9f7422fb8f6ea6ceb853bab3db5a98fa7 | refs/heads/master | 2021-09-27T09:35:33.306918 | 2018-11-07T15:11:24 | 2018-11-07T15:11:24 | 72,004,513 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 436 | cpp | #include<bits/stdc++.h>
using namespace std;
int arr[1000003];
int main()
{
int t,n,k;
cin>>t;
while(t--)
{
cin>>n;
for(int i=0;i<n;i++)cin>>arr[i];
int len = 1 << n;
for(int i=0;i<len;i++)
{
int pos = n-1;
int bits = i;
cout<<"{ ";
while(bits >0)
{
if((bits & 1) == 1)cout<<arr[pos]<<" , ";
bits = bits>>1;
pos--;
}
cout<<"} \n";
}
}
return 0;
}
| [
"sharique2523@gmail.com"
] | sharique2523@gmail.com |
f452c170a5594cd6a4b8aaac6c4bb3f38e7b4dce | 877fff5bb313ccd23d1d01bf23b1e1f2b13bb85a | /app/src/main/cpp/dir521/dir522/dir572/dir2774/dir2803/file2834.cpp | fae0a2d690d98f1ed77dbc94b779cc6648dd694f | [] | no_license | tgeng/HugeProject | 829c3bdfb7cbaf57727c41263212d4a67e3eb93d | 4488d3b765e8827636ce5e878baacdf388710ef2 | refs/heads/master | 2022-08-21T16:58:54.161627 | 2020-05-28T01:54:03 | 2020-05-28T01:54:03 | 267,468,475 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 111 | cpp | #ifndef file2834
#error "macro file2834 must be defined"
#endif
static const char* file2834String = "file2834"; | [
"tgeng@google.com"
] | tgeng@google.com |
0c212f1d989b5c5a05490e91ec8075d49f1646c8 | aeae9a59fb57b672429c75693140ac9afb3e500e | /Gruppuppgift3/Pyramid.h | 0fc25b3da2110b16576db844f5ccf668974cdfa7 | [] | no_license | GameProject/Tower | 8d31a1cb70c76f461222a07abfb67cb03d806da8 | 91501df975f3d3dd1dd252ed78b6206f8fff5e24 | refs/heads/master | 2021-01-21T02:30:54.781582 | 2011-05-11T02:00:23 | 2011-05-11T02:00:23 | 1,728,394 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 532 | h | #ifndef PYRAMID_H
#define PYRAMID_H
#include <d3dx10.h>
#include <vector>
#include "Vertex.h"
class Pyramid
{
private:
D3DXMATRIX mWorld;
D3DXVECTOR3 pos;
ID3D10Device* d3dDevice;
ID3D10Buffer* vertexBuffer;
ID3D10Buffer* indexBuffer;
DWORD nrOfVertices;
std::vector<Vertex> v;
public:
Pyramid();
~Pyramid();
void init(ID3D10Device *device, D3DXVECTOR3 size, D3DXVECTOR3 pos);
void move(D3DXVECTOR3 newPos);
void Draw();
D3DXMATRIX& getWorld();
int GetVertexCount();
std::vector<Vertex> CopyVertexArray();
};
#endif | [
"ning09@.students.ad.bth.se"
] | ning09@.students.ad.bth.se |
f11bc13d424a9759e7ffc98aae4a70eddd98a40d | cf8ddfc720bf6451c4ef4fa01684327431db1919 | /SDK/ARKSurvivalEvolved_OptionsMenu_classes.hpp | 72926078277a533dff3320c36d35678ef476151f | [
"MIT"
] | permissive | git-Charlie/ARK-SDK | 75337684b11e7b9f668da1f15e8054052a3b600f | c38ca9925309516b2093ad8c3a70ed9489e1d573 | refs/heads/master | 2023-06-20T06:30:33.550123 | 2021-07-11T13:41:45 | 2021-07-11T13:41:45 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 48,172 | hpp | #pragma once
// ARKSurvivalEvolved (329.9) SDK
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
#include "ARKSurvivalEvolved_OptionsMenu_structs.hpp"
namespace sdk
{
//---------------------------------------------------------------------------
//Classes
//---------------------------------------------------------------------------
// WidgetBlueprintGeneratedClass OptionsMenu.OptionsMenu_C
// 0x07AE (0x1106 - 0x0958)
class UOptionsMenu_C : public UUI_OptionsMenu
{
public:
class UWidgetAnimation* FadeIn; // 0x0958(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UWidgetAnimation* FadeOut; // 0x0960(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UWidgetAnimation* Close; // 0x0968(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UWidgetAnimation* Open; // 0x0970(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* AccessInventory; // 0x0978(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCustomButtonWidget* AdvancedSettingsMenuButton; // 0x0980(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* AllowAnimationStaggeringCheckbox; // 0x0988(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* AllowCrosshairCheckbox; // 0x0990(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* AllowEnhancedDistanceDetailModeCheckbox; // 0x0998(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* AllowHitMarkersCheckbox; // 0x09A0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* AltFire; // 0x09A8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class USlider* AmbientSoundVolumeSlider; // 0x09B0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UComboBoxString* AntiAliasingComboBox; // 0x09B8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCustomButtonWidget* ApplyButton; // 0x09C0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class USlider* AudioVolumeSlider; // 0x09C8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* BrakeDino; // 0x09D0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* CallAggressive; // 0x09D8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* CallAttackTarget; // 0x09E0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* CallFollow; // 0x09E8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* CallFollowDistanceCycleOne; // 0x09F0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* CallFollowOne; // 0x09F8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* CallLandOne; // 0x0A00(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* CallMoveTo; // 0x0A08(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* CallNeutral; // 0x0A10(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* CallPassive; // 0x0A18(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* CallSetAggressive; // 0x0A20(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* CallStay; // 0x0A28(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* CallStayOne; // 0x0A30(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* CameraBobCheckbox; // 0x0A38(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class USlider* CameraShakeScaleSlider; // 0x0A40(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCustomButtonWidget* CancelButton; // 0x0A48(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* CancelOrder; // 0x0A50(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* CenterPlayer; // 0x0A58(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* CenterSelection; // 0x0A60(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* CharacterActionWheel; // 0x0A68(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class USlider* CharacterSlider; // 0x0A70(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* ChatBubblesCheckbox; // 0x0A78(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* ChatShowSteamNameCheckbox; // 0x0A80(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* ChatShowTribeNameCheckbox; // 0x0A88(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UComboBoxString* ClientNetSpeedComboBox; // 0x0A90(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UButton* CloseGamepadControlsButton; // 0x0A98(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* ColorizedItemNamesCheckbox; // 0x0AA0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UImage* CreatureBottomBorder; // 0x0AA8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UImage* CreatureTopBorder; // 0x0AB0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* Crouch; // 0x0AB8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* DefaultCharacterItemsCheckbox; // 0x0AC0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* DisableBloomCheckbox; // 0x0AC8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* DisableLightShaftsCheckbox; // 0x0AD0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* DisableMenuMusicCheckbox; // 0x0AD8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* DisableMenuTransitionsCheckbox; // 0x0AE0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* DisableSubtitlesCheckbox; // 0x0AE8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* DisableTorporEffectCheckbox; // 0x0AF0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* DisableTPVCameraInterpolationCheckbox; // 0x0AF8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* DistanceFieldShadowingCheckbox; // 0x0B00(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* Drag; // 0x0B08(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* DropItem; // 0x0B10(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* DynamicTessCheckbox; // 0x0B18(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* EmoteKey1; // 0x0B20(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* EmoteKey2; // 0x0B28(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* EnableBloodEffectsCheckbox; // 0x0B30(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* EnableColorGradingCheckbox; // 0x0B38(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCustomButtonWidget* EnableHMDButton; // 0x0B40(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* ExtraLevelStreamingDistanceCheckbox; // 0x0B48(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* FilmGrainCheckbox; // 0x0B50(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* Fire; // 0x0B58(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* FirstPersonRidingCheckbox; // 0x0B60(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* FloatingNamesCheckbox; // 0x0B68(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* ForceCraftButton; // 0x0B70(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* ForceTPVCameraOffsetCheckbox; // 0x0B78(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class USlider* FOVSlider; // 0x0B80(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UImage* FrontOverlayAdditive; // 0x0B88(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UButton* GamepadControlsButton; // 0x0B90(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UImage* GamepadIcon_NextMenu; // 0x0B98(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UImage* GamepadIcon_PrevMenu; // 0x0BA0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UImage* GamepadImage; // 0x0BA8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCustomButtonWidget* GamepadMenuButton; // 0x0BB0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UEditableTextBox* Gamma1Editbox; // 0x0BB8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UEditableTextBox* Gamma2Editbox; // 0x0BC0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* GiveDefaultWeapon; // 0x0BC8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UComboBoxString* GraphicsQualityComboBox; // 0x0BD0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UBorder* GraphicsQualityHelpTooltip; // 0x0BD8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class USlider* GroundClutterDensitySlider; // 0x0BE0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class USlider* GroundClutterDistanceSlider; // 0x0BE8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* GroupAddOrRemoveTame; // 0x0BF0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UEditableTextBox* HeightTextBox; // 0x0BF8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* HideFloatingPlayerNamesCheckbox; // 0x0C00(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* HideGamepadItemSelectionModifierCheckbox; // 0x0C08(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* HideServerInfoCheckbox; // 0x0C10(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* HighQualityAnisotropicFilteringCheckbox; // 0x0C18(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* HighQualityLODsCheckbox; // 0x0C20(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* HighQualityMaterialsCheckbox; // 0x0C28(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* HighQualitySurfacesCheckbox; // 0x0C30(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* HighQualityVFXCheckbox; // 0x0C38(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UImage* Image_12; // 0x0C40(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UImage* Image_152; // 0x0C48(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UImage* Image_1545; // 0x0C50(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UImage* Image_1546; // 0x0C58(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UImage* Image_1586; // 0x0C60(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UImage* Image_2016; // 0x0C68(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UImage* Image_242; // 0x0C70(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UImage* Image_243; // 0x0C78(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UImage* Image_257; // 0x0C80(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UImage* Image_266; // 0x0C88(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UImage* Image_270; // 0x0C90(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UImage* Image_321; // 0x0C98(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UImage* Image_419; // 0x0CA0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UImage* Image_537; // 0x0CA8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UImage* Image_538; // 0x0CB0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UImage* Image_55; // 0x0CB8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UImage* Image_56; // 0x0CC0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UImage* Image_59; // 0x0CC8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UImage* Image_610; // 0x0CD0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UImage* Image_64; // 0x0CD8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UImage* Image_66; // 0x0CE0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UImage* Image_67; // 0x0CE8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UImage* Image_9; // 0x0CF0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UImage* Image_93; // 0x0CF8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UImage* Image_922; // 0x0D00(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UImage* Image_923; // 0x0D08(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UImage* Image_963; // 0x0D10(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* InventoryAccessSoundCheckbox; // 0x0D18(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* InvertMouse; // 0x0D20(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* IssueOrder; // 0x0D28(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* JoinNotificationsCheckbox; // 0x0D30(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* Jump; // 0x0D38(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCustomButtonWidget* KeyBindingsMenuButton; // 0x0D40(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class USlider* LODScalarSlider; // 0x0D48(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* LookDown; // 0x0D50(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class USlider* LookLeftRightSensitivitySlider; // 0x0D58(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* LookUp; // 0x0D60(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class USlider* LookUpDownSensitivitySlider; // 0x0D68(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* LowQualityAnimationsCheckbox; // 0x0D70(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* MeleeCameraSwingAnimsCheckbox; // 0x0D78(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* MotionBlurCheckbox; // 0x0D80(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* MoveBackward; // 0x0D88(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* MoveForward; // 0x0D90(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class USlider* MusicSlider; // 0x0D98(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* NoTooltipDelayCheckbox; // 0x0DA0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* OpenMapMarkers; // 0x0DA8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCustomButtonWidget* OptionsMenuButton; // 0x0DB0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* OrbitCam; // 0x0DB8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* OrbitCamToggle; // 0x0DC0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* PlayActionWheelClickSoundCheckbox; // 0x0DC8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* Poop; // 0x0DD0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UComboBoxString* PostProcessingComboBox; // 0x0DD8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* Prone; // 0x0DE0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* PushToTalk; // 0x0DE8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* QuickToggleItemNamesCheckbox; // 0x0DF0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* Reload; // 0x0DF8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCustomButtonWidget* RepositionHMDViewButton; // 0x0E00(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCustomButtonWidget* ResetButton; // 0x0E08(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCustomButtonWidget* ResetIntroCinematicsButton; // 0x0E10(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UButton* ResetTutorials; // 0x0E18(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class USlider* ResolutionScaleSlider; // 0x0E20(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UComboBoxString* ResolutionsComboBox; // 0x0E28(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCustomButtonWidget* RTSMenuButton; // 0x0E30(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* Run; // 0x0E38(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* RunToggle; // 0x0E40(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCustomButtonWidget* SaveButton; // 0x0E48(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class USlider* ScaleSlider; // 0x0E50(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* SelectUnit; // 0x0E58(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* SetGamma1; // 0x0E60(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* SetGamma2; // 0x0E68(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class USlider* SFXSlider; // 0x0E70(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UComboBoxString* ShadowsComboBox; // 0x0E78(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* ShowChatCheckbox; // 0x0E80(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* ShowExtendedInfo; // 0x0E88(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* ShowLocalChat; // 0x0E90(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* ShowMyCraftables; // 0x0E98(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* ShowMyInventory; // 0x0EA0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* ShowTribeChat; // 0x0EA8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* ShowTribeManager; // 0x0EB0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* SimpleDistanceMovementCheckbox; // 0x0EB8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* SSAOCheckbox; // 0x0EC0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* StatusNotificationMessagesCheckbox; // 0x0EC8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* StrafeLeft; // 0x0ED0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* StrafeRight; // 0x0ED8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UWidgetSwitcher* SubMenuSwitcher; // 0x0EE0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* Targeting; // 0x0EE8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* TemperatureFCheckbox; // 0x0EF0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UComboBoxString* TerrainShadowComboBox; // 0x0EF8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UComboBoxString* TexturesComboBox; // 0x0F00(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* ToggleAutoChat; // 0x0F08(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* ToggleConsole; // 0x0F10(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* ToggleExtendedHUDInfoCheckbox; // 0x0F18(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* ToggleHUDHidden; // 0x0F20(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* ToggleMap; // 0x0F28(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* ToggleRTS; // 0x0F30(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* ToggleToTalkCheckBox; // 0x0F38(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class USlider* TrueSkyQualitySlider; // 0x0F40(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* TurnLeft; // 0x0F48(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* TurnRight; // 0x0F50(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class USlider* UIQuickbarScalingSlider; // 0x0F58(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* Use; // 0x0F60(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* UseDFAOCheckbox; // 0x0F68(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* UseItem1; // 0x0F70(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* UseItem10; // 0x0F78(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* UseItem2; // 0x0F80(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* UseItem3; // 0x0F88(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* UseItem4; // 0x0F90(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* UseItem5; // 0x0F98(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* UseItem6; // 0x0FA0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* UseItem7; // 0x0FA8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* UseItem8; // 0x0FB0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* UseItem9; // 0x0FB8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UCheckBox* UseLowQualityFarLevelStreamingCheckbox; // 0x0FC0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UComboBoxString* ViewDistanceComboBox; // 0x0FC8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class USlider* VoiceSlider; // 0x0FD0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* WeaponAccessory; // 0x0FD8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* Whisper; // 0x0FE0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UEditableTextBox* WidthTextBox; // 0x0FE8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UComboBoxString* WindowModeComboBox; // 0x0FF0(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UComboBoxString* WorldTileBufferComboBox; // 0x0FF8(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* Yell; // 0x1000(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* ZoomIn; // 0x1008(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
class UKeyInputWidget* ZoomOut; // 0x1010(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData)
bool GraphicsToolTipIsVisible; // 0x1018(0x0001) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
unsigned char UnknownData00[0x3]; // 0x1019(0x0003) MISSED OFFSET
struct FGeometry K2Node_Event_MyGeometry; // 0x101C(0x0034) (Transient, DuplicateTransient, IsPlainOldData)
float K2Node_Event_InDeltaTime; // 0x1050(0x0004) (ZeroConstructor, Transient, DuplicateTransient, IsPlainOldData)
unsigned char UnknownData01[0x4]; // 0x1054(0x0004) MISSED OFFSET
class FString K2Node_ComponentBoundEvent_SelectedItem5; // 0x1058(0x0010) (ZeroConstructor, Transient, DuplicateTransient)
TEnumAsByte<ESelectInfo> K2Node_ComponentBoundEvent_SelectionType5; // 0x1068(0x0001) (ZeroConstructor, Transient, DuplicateTransient, IsPlainOldData)
unsigned char UnknownData02[0x7]; // 0x1069(0x0007) MISSED OFFSET
class FString K2Node_ComponentBoundEvent_SelectedItem4; // 0x1070(0x0010) (ZeroConstructor, Transient, DuplicateTransient)
TEnumAsByte<ESelectInfo> K2Node_ComponentBoundEvent_SelectionType4; // 0x1080(0x0001) (ZeroConstructor, Transient, DuplicateTransient, IsPlainOldData)
unsigned char UnknownData03[0x7]; // 0x1081(0x0007) MISSED OFFSET
class FString K2Node_ComponentBoundEvent_SelectedItem3; // 0x1088(0x0010) (ZeroConstructor, Transient, DuplicateTransient)
TEnumAsByte<ESelectInfo> K2Node_ComponentBoundEvent_SelectionType3; // 0x1098(0x0001) (ZeroConstructor, Transient, DuplicateTransient, IsPlainOldData)
unsigned char UnknownData04[0x7]; // 0x1099(0x0007) MISSED OFFSET
class FString K2Node_ComponentBoundEvent_SelectedItem2; // 0x10A0(0x0010) (ZeroConstructor, Transient, DuplicateTransient)
TEnumAsByte<ESelectInfo> K2Node_ComponentBoundEvent_SelectionType2; // 0x10B0(0x0001) (ZeroConstructor, Transient, DuplicateTransient, IsPlainOldData)
unsigned char UnknownData05[0x7]; // 0x10B1(0x0007) MISSED OFFSET
class FString K2Node_ComponentBoundEvent_SelectedItem; // 0x10B8(0x0010) (ZeroConstructor, Transient, DuplicateTransient)
TEnumAsByte<ESelectInfo> K2Node_ComponentBoundEvent_SelectionType; // 0x10C8(0x0001) (ZeroConstructor, Transient, DuplicateTransient, IsPlainOldData)
unsigned char UnknownData06[0x7]; // 0x10C9(0x0007) MISSED OFFSET
class FString K2Node_ComponentBoundEvent_SelectedItem6; // 0x10D0(0x0010) (ZeroConstructor, Transient, DuplicateTransient)
TEnumAsByte<ESelectInfo> K2Node_ComponentBoundEvent_SelectionType6; // 0x10E0(0x0001) (ZeroConstructor, Transient, DuplicateTransient, IsPlainOldData)
unsigned char UnknownData07[0x3]; // 0x10E1(0x0003) MISSED OFFSET
float K2Node_ComponentBoundEvent_Value2; // 0x10E4(0x0004) (ZeroConstructor, Transient, DuplicateTransient, IsPlainOldData)
float K2Node_ComponentBoundEvent_Value; // 0x10E8(0x0004) (ZeroConstructor, Transient, DuplicateTransient, IsPlainOldData)
bool K2Node_ComponentBoundEvent_bIsChecked4; // 0x10EC(0x0001) (ZeroConstructor, Transient, DuplicateTransient, IsPlainOldData)
bool K2Node_ComponentBoundEvent_bIsChecked3; // 0x10ED(0x0001) (ZeroConstructor, Transient, DuplicateTransient, IsPlainOldData)
bool K2Node_ComponentBoundEvent_bIsChecked2; // 0x10EE(0x0001) (ZeroConstructor, Transient, DuplicateTransient, IsPlainOldData)
bool K2Node_ComponentBoundEvent_bIsChecked; // 0x10EF(0x0001) (ZeroConstructor, Transient, DuplicateTransient, IsPlainOldData)
class FString K2Node_ComponentBoundEvent_SelectedItem7; // 0x10F0(0x0010) (ZeroConstructor, Transient, DuplicateTransient)
TEnumAsByte<ESelectInfo> K2Node_ComponentBoundEvent_SelectionType7; // 0x1100(0x0001) (ZeroConstructor, Transient, DuplicateTransient, IsPlainOldData)
bool CallFunc_Not_PreBool_ReturnValue; // 0x1101(0x0001) (ZeroConstructor, Transient, DuplicateTransient, IsPlainOldData)
bool CallFunc_IsHovered_ReturnValue; // 0x1102(0x0001) (ZeroConstructor, Transient, DuplicateTransient, IsPlainOldData)
bool CallFunc_BooleanAND_ReturnValue; // 0x1103(0x0001) (ZeroConstructor, Transient, DuplicateTransient, IsPlainOldData)
bool CallFunc_Not_PreBool_ReturnValue2; // 0x1104(0x0001) (ZeroConstructor, Transient, DuplicateTransient, IsPlainOldData)
bool CallFunc_BooleanAND_ReturnValue2; // 0x1105(0x0001) (ZeroConstructor, Transient, DuplicateTransient, IsPlainOldData)
static UClass* StaticClass()
{
static auto ptr = UObject::FindClass("WidgetBlueprintGeneratedClass OptionsMenu.OptionsMenu_C");
return ptr;
}
void BndEvt__GraphicsQualityComboBox_K2Node_ComponentBoundEvent_11_OnSelectionChangedEvent__DelegateSignature(const class FString& SelectedItem, TEnumAsByte<ESelectInfo> SelectionType);
void BndEvt__ViewDistanceComboBox_K2Node_ComponentBoundEvent_7_OnSelectionChangedEvent__DelegateSignature(const class FString& SelectedItem, TEnumAsByte<ESelectInfo> SelectionType);
void BndEvt__AntiAliasingComboBox_K2Node_ComponentBoundEvent_13_OnSelectionChangedEvent__DelegateSignature(const class FString& SelectedItem, TEnumAsByte<ESelectInfo> SelectionType);
void BndEvt__PostProcessingComboBox_K2Node_ComponentBoundEvent_20_OnSelectionChangedEvent__DelegateSignature(const class FString& SelectedItem, TEnumAsByte<ESelectInfo> SelectionType);
void BndEvt__ShadowsComboBox_K2Node_ComponentBoundEvent_28_OnSelectionChangedEvent__DelegateSignature(const class FString& SelectedItem, TEnumAsByte<ESelectInfo> SelectionType);
void BndEvt__TerrainShadowComboBox_K2Node_ComponentBoundEvent_37_OnSelectionChangedEvent__DelegateSignature(const class FString& SelectedItem, TEnumAsByte<ESelectInfo> SelectionType);
void BndEvt__TexturesComboBox_K2Node_ComponentBoundEvent_47_OnSelectionChangedEvent__DelegateSignature(const class FString& SelectedItem, TEnumAsByte<ESelectInfo> SelectionType);
void BndEvt__TrueSkyQualitySlider_K2Node_ComponentBoundEvent_67_OnFloatValueChangedEvent__DelegateSignature(float Value);
void BndEvt__GroundClutterDensitySlider_K2Node_ComponentBoundEvent_81_OnFloatValueChangedEvent__DelegateSignature(float Value);
void BndEvt__MotionBlurCheckbox_K2Node_ComponentBoundEvent_181_OnCheckBoxComponentStateChanged__DelegateSignature(bool bIsChecked);
void BndEvt__FilmGrainCheckbox_K2Node_ComponentBoundEvent_193_OnCheckBoxComponentStateChanged__DelegateSignature(bool bIsChecked);
void BndEvt__UseDFAOCheckbox_K2Node_ComponentBoundEvent_206_OnCheckBoxComponentStateChanged__DelegateSignature(bool bIsChecked);
void BndEvt__SSAOCheckbox_K2Node_ComponentBoundEvent_220_OnCheckBoxComponentStateChanged__DelegateSignature(bool bIsChecked);
void OptionsGraphTick(struct FGeometry* MyGeometry, float* InDeltaTime);
void ExecuteUbergraph_OptionsMenu(int EntryPoint);
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| [
"sergey.2bite@gmail.com"
] | sergey.2bite@gmail.com |
62211b22ac4cc82b9240af11212cee2523575ca9 | 2ce74641bdcb82c8d5183915b3830e296efe7ef5 | /백준 13913/백준 13913/소스.cpp | cbaf94da9b10c027fe69354c75e8d711e7e2f813 | [] | no_license | jhhan00/Baekjoon-Online-Judge-2019 | c4c5c33ddb85ed7b5b53dd237067b1b81247382f | 84b3aeae71b2a8c549aae6e574847edb55868cd1 | refs/heads/main | 2023-03-20T12:23:39.296658 | 2021-03-04T14:49:01 | 2021-03-04T14:49:01 | 344,501,183 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 891 | cpp | #pragma warning(disable : 4996)
#include <iostream>
#include <queue>
#define MAX 100001
using namespace std;
int visit[MAX];
int from[MAX];
int find(int a, int b)
{
queue<int> qq;
qq.push(a);
while (!qq.empty()) {
int c = qq.front();
qq.pop();
if (c == b)
return visit[c];
if (c - 1 >= 0 && visit[c - 1] == 0 && from[c-1] != -1) {
visit[c - 1] = visit[c] + 1;
from[c - 1] = c;
qq.push(c - 1);
}
if (c + 1 < MAX && visit[c + 1] == 0 && from[c+1] != -1) {
visit[c + 1] = visit[c] + 1;
from[c + 1] = c;
qq.push(c + 1);
}
if (c * 2 < MAX && visit[c * 2] == 0 && from[c*2] != -1) {
visit[c * 2] = visit[c] + 1;
from[c * 2] = c;
qq.push(c * 2);
}
}
}
void print(int z)
{
if (from[z] != -1)
print(from[z]);
cout << z << " ";
}
int main()
{
int n, k;
cin >> n >> k;
visit[n] = 0;
from[n] = -1;
cout << find(n, k) << "\n";
print(k);
} | [
"48585234+jhhan00@users.noreply.github.com"
] | 48585234+jhhan00@users.noreply.github.com |
d15f53611f7494ac622294df76db2e3fd2e1b300 | cb3a0163737aa9740429c3eda4c062fc9a8e058e | /Aufgabenblock_3/FzgFahren.cpp | bc8c981f9536e0f9777c81ff75d4bcb5efb1975f | [
"MIT"
] | permissive | marvinklimke/rwth-prit2 | 70648652313f32a97fca7c5de571d7226ed75141 | 360b89f984337e13788d22d5dc1b4b5e60a9d6b0 | refs/heads/master | 2020-03-08T15:30:33.285449 | 2018-07-21T19:43:50 | 2018-07-21T19:43:50 | 128,213,693 | 1 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 998 | cpp | // file: FzgFahren.cpp
// author: Marvin Klimke
// date: 09.09.2016
#include "FzgFahren.h"
#include "Fahrzeug.h"
#include "Streckenende.h"
FzgFahren::FzgFahren(Weg* pWeg)
: FzgVerhalten(pWeg)
{
}
FzgFahren::~FzgFahren()
{
}
double FzgFahren::dStrecke(Fahrzeug* pFahrzeug, double dZeit) const
{
// Strecke die das Fahrzeug mit normaler Geschwindigkeit zur�cklegen w�rde
double dStrecke = pFahrzeug->dGeschwindigkeit() * dZeit;
if (bEqual(pFahrzeug->getAbschnittStrecke(), p_pWeg->getLaenge()))
{
throw Streckenende(pFahrzeug, p_pWeg); // Streckenende erreicht
}
else if (pFahrzeug->getAbschnittStrecke() + dStrecke > p_pWeg->getVirtuelleSchranke() - 1e-6)
{
dStrecke = p_pWeg->getVirtuelleSchranke() - pFahrzeug->getAbschnittStrecke(); // Fahrzeug darf nicht �berholt werden oder Wegenede nicht �berfahren werden
}
else
{
p_pWeg->setVirtuelleSchranke(pFahrzeug->getAbschnittStrecke() + dStrecke); // Fahre normale Strecke und setze die Schranke
}
return dStrecke;
} | [
"marvin.klimke@rwth-aachen.de"
] | marvin.klimke@rwth-aachen.de |
8b8912a37614edf4ce14e71433be04eccb86d2fd | a46c124bff905e12d713c2a5120e8cf0e7cde439 | /app/src/main/cpp/engine/lualib_bit.cpp | 5b644fa2e17f1137c6cbfef3f64c7d0e2f532dad | [] | no_license | hviden/asf | 254564a668f1178ae053eff5b8de5816da422d55 | 4c9ae01715a001fc4601b547f112b7f969980446 | refs/heads/main | 2023-01-11T18:28:36.705809 | 2020-11-18T13:28:16 | 2020-11-18T13:28:16 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,106 | cpp | #include "luastub.h"
#include <stdint.h>
#include <math.h>
#include <stdlib.h>
/* FIXME: Assume size_t is an unsigned lua_Integer */
typedef size_t lua_UInteger;
#define LUA_UINTEGER_MAX SIZE_MAX
/* Define TOBIT to get a bit value */
#define TOBIT(L, n) \
(lua_UInteger)(luaL_checkinteger((L), (n)))
/* Operations
The macros MONADIC and VARIADIC only deal with bitwise operations.
LOGICAL_SHIFT truncates its left-hand operand before shifting so
that any extra bits at the most-significant end are not shifted
into the result.
ARITHMETIC_SHIFT does not truncate its left-hand operand, so that
the sign bits are not removed and right shift work properly.
*/
#define MONADIC(name, op) \
static int bit_ ## name(lua_State *L) { \
lua_pushnumber(L, op TOBIT(L, 1)); \
return 1; \
}
#define VARIADIC(name, op) \
static int bit_ ## name(lua_State *L) { \
int n = lua_gettop(L), i; \
lua_UInteger w = TOBIT(L, 1); \
for (i = 2; i <= n; i++) \
w op TOBIT(L, i); \
lua_pushnumber(L, w); \
return 1; \
}
#define LOGICAL_SHIFT(name, op) \
static int bit_ ## name(lua_State *L) { \
lua_pushnumber(L, (lua_UInteger)TOBIT(L, 1) op \
(unsigned)luaL_checknumber(L, 2)); \
return 1; \
}
#define ARITHMETIC_SHIFT(name, op) \
static int bit_ ## name(lua_State *L) { \
lua_pushinteger(L, (lua_Integer)TOBIT(L, 1) op \
(unsigned)luaL_checknumber(L, 2)); \
return 1; \
}
MONADIC(bnot, ~)
VARIADIC(band, &=)
VARIADIC(bor, |=)
VARIADIC(bxor, ^=)
LOGICAL_SHIFT(lshift, <<)
LOGICAL_SHIFT(rshift, >>)
ARITHMETIC_SHIFT(alshift, <<)
ARITHMETIC_SHIFT(arshift, >>)
// Lua: res = bit( position )
static int bit_bit( lua_State* L )
{
lua_pushnumber( L, ( lua_UInteger )( 1 << luaL_checkinteger( L, 1 ) ) );
return 1;
}
// Lua: res = isset( value, position )
static int bit_isset( lua_State* L )
{
lua_UInteger val = ( lua_UInteger )luaL_checkinteger( L, 1 );
unsigned pos = ( unsigned )luaL_checkinteger( L, 2 );
lua_pushboolean( L, val & ( 1 << pos ) ? 1 : 0 );
return 1;
}
// Lua: res = isclear( value, position )
static int bit_isclear( lua_State* L )
{
lua_UInteger val = ( lua_UInteger )luaL_checkinteger( L, 1 );
unsigned pos = ( unsigned )luaL_checkinteger( L, 2 );
lua_pushboolean( L, val & ( 1 << pos ) ? 0 : 1 );
return 1;
}
// Lua: res = set( value, pos1, pos2, ... )
static int bit_set( lua_State* L )
{
lua_UInteger val = ( lua_UInteger )luaL_checkinteger( L, 1 );
unsigned total = lua_gettop( L ), i;
for( i = 2; i <= total; i ++ )
val |= 1 << ( unsigned )luaL_checkinteger( L, i );
lua_pushnumber( L, val );
return 1;
}
// Lua: res = clear( value, pos1, pos2, ... )
static int bit_clear( lua_State* L )
{
lua_UInteger val = ( lua_UInteger )luaL_checkinteger( L, 1 );
unsigned total = lua_gettop( L ), i;
for( i = 2; i <= total; i ++ )
val &= ~( 1 << ( unsigned )luaL_checkinteger( L, i ) );
lua_pushnumber( L, val );
return 1;
}
int luaopen_bit(lua_State *L)
{
luaL_Reg thislib[] = {
{"bnot", bit_bnot},
{"band", bit_band},
{"bor", bit_bor},
{"bxor", bit_bxor},
{"lshift", bit_lshift},
{"rshift", bit_rshift},
{"alshift", bit_alshift},
{"arshift", bit_arshift},
{"bit", bit_bit},
{"set", bit_set},
{"clear", bit_clear},
{"isset", bit_isset},
{"isclear", bit_isclear},
{NULL, NULL}
};
luaL_register(L, "bit", thislib);
return 1;
}
| [
"yusjck@gmail.com"
] | yusjck@gmail.com |
b2794a5b3f3a25e30d9835d3dd5cf918d35076af | 88eb1422ff4f56bd30be327a37fc83d97f167af7 | /BabyMaker/BabyMaker/opencv2.framework/Versions/A/Headers/stitching/detail/blenders.hpp | 49981081b9df1188ab8d837e8b68c17f74d1ee0f | [] | no_license | templeblock/BabyMaker_app | 3e14a368ba6674fa0211768f153b5968e16e3b91 | 034f30d041d1954e348c4e7758f44540fd2ef580 | refs/heads/master | 2020-04-05T00:30:55.004859 | 2016-04-13T14:36:19 | 2016-04-13T14:36:19 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,977 | hpp | /*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#ifndef __OPENCV_STITCHING_BLENDERS_HPP__
#define __OPENCV_STITCHING_BLENDERS_HPP__
#include "opencv2/core/core.hpp"
namespace cv {
namespace detail {
// Simple blender which puts one image over another
class CV_EXPORTS Blender
{
public:
virtual ~Blender() {}
//enum { NO, FEATHER, MULTI_BAND };
static Ptr<Blender> createDefault(int type, bool try_gpu = false);
void prepare(const std::vector<Point> &corners, const std::vector<Size> &sizes);
virtual void prepare(Rect dst_roi);
virtual void feed(const Mat &img, const Mat &mask, Point tl);
virtual void blend(Mat &dst, Mat &dst_mask);
protected:
Mat dst_, dst_mask_;
Rect dst_roi_;
};
class CV_EXPORTS FeatherBlender : public Blender
{
public:
FeatherBlender(float sharpness = 0.02f);
float sharpness() const { return sharpness_; }
void setSharpness(float val) { sharpness_ = val; }
void prepare(Rect dst_roi);
void feed(const Mat &img, const Mat &mask, Point tl);
void blend(Mat &dst, Mat &dst_mask);
// Creates weight maps for fixed set of source images by their masks and top-left corners.
// Final image can be obtained by simple weighting of the source images.
Rect createWeightMaps(const std::vector<Mat> &masks, const std::vector<Point> &corners,
std::vector<Mat> &weight_maps);
private:
float sharpness_;
Mat weight_map_;
Mat dst_weight_map_;
};
inline FeatherBlender::FeatherBlender(float _sharpness) { setSharpness(_sharpness); }
class CV_EXPORTS MultiBandBlender : public Blender
{
public:
MultiBandBlender(int try_gpu = false, int num_bands = 5, int weight_type = CV_32F);
int numBands() const { return actual_num_bands_; }
void setNumBands(int val) { actual_num_bands_ = val; }
void prepare(Rect dst_roi);
void feed(const Mat &img, const Mat &mask, Point tl);
void blend(Mat &dst, Mat &dst_mask);
private:
int actual_num_bands_, num_bands_;
std::vector<Mat> dst_pyr_laplace_;
std::vector<Mat> dst_band_weights_;
Rect dst_roi_final_;
bool can_use_gpu_;
int weight_type_; //CV_32F or CV_16S
};
//////////////////////////////////////////////////////////////////////////////
// Auxiliary functions
void CV_EXPORTS normalizeUsingWeightMap(const Mat& weight, Mat& src);
void CV_EXPORTS createWeightMap(const Mat& mask, float sharpness, Mat& weight);
void CV_EXPORTS createLaplacePyr(const Mat &img, int num_levels, std::vector<Mat>& pyr);
void CV_EXPORTS createLaplacePyrGpu(const Mat &img, int num_levels, std::vector<Mat>& pyr);
// Restores source image
void CV_EXPORTS restoreImageFromLaplacePyr(std::vector<Mat>& pyr);
void CV_EXPORTS restoreImageFromLaplacePyrGpu(std::vector<Mat>& pyr);
} // namespace detail
} // namespace cv
#endif // __OPENCV_STITCHING_BLENDERS_HPP__
| [
"Gritsenko1987514@hotmail.com"
] | Gritsenko1987514@hotmail.com |
0075cbd58358c34dbf6d59875b356e3140bc611d | e20b0cb6fc031724dc364f1f6348bf18b91e208b | /SDL/TextBox.cpp | e6fdbd1e0d8d0606f1b89379e553cf0718c3e8e8 | [] | no_license | Gouet/plazza | 768c46721df0aafca3d942d6ce50789aea374744 | 85775f66a99365568945c1896180d3f5bd74e9f6 | refs/heads/master | 2021-01-16T21:18:19.287979 | 2016-09-19T14:57:04 | 2016-09-19T14:57:04 | 68,616,269 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,890 | cpp | //
// Created by veyrie_f on 4/19/16.
//
#include "TextBox.hpp"
TextBox::TextBox(WindowManagerSDL &win) :
UIComponent(win, Vector2<double>(0, 0), Vector2<double>(0, 0))
{
}
TextBox::TextBox(WindowManagerSDL &win, std::string const &text, std::string const& font, int fontSize, Vector2<double> pos, Vector2<double> size, SDL_Color color) :
UIComponent(win, pos, size),
m_text(text),
m_fontName(font),
m_fontSize(fontSize),
m_color(color),
m_originalColor(color)
{
// in this particular case the size is the word length by its font size
m_size.y = fontSize;
m_size.x = (fontSize / 2.3) * text.size();
}
TextBox::~TextBox()
{
TTF_CloseFont(m_font);
}
void TextBox::Draw()
{
SDL_Rect rect;
SDL_Surface *text;
rect.x = m_pos.x;
rect.y = m_pos.y;
if (m_font == nullptr)
{
m_font = TTF_OpenFont(m_fontName.c_str(), m_fontSize);
}
if (m_font == nullptr)
{
throw WindowManagerSDL::SdlException("Failed to open font " + m_fontName);
}
text = TTF_RenderText_Blended(m_font, m_text.c_str(), m_color);
SDL_BlitSurface(text, NULL, m_window.GetSurface(), &rect);
free(text);
}
void TextBox::OnMouseButtonUp(SDL_MouseMotionEvent mouse)
{
if (IsHovered(mouse))
{
ExecuteCallbacks();
}
}
void TextBox::OnHover(SDL_MouseMotionEvent mouse)
{
if (IsHovered(mouse))
{
m_color.r = m_originalColor.r / 2.0;
m_color.g = m_originalColor.g / 2.0;
m_color.b = m_originalColor.b / 2.0;
}
else
{
m_color = m_originalColor;
}
}
void TextBox::OnMouseButtonDown(SDL_MouseMotionEvent)
{
}
void TextBox::SetText(std::string const &text)
{
m_text = text;
}
std::string const &TextBox::GetText() const
{
return m_text;
}
void TextBox::SetColor(SDL_Color color)
{
m_color = color;
}
| [
"Victor@MacBook-Pro-de-Victor-2.local"
] | Victor@MacBook-Pro-de-Victor-2.local |
8e8c4679fa4f8fe4d70e266d7918cf86e8703c2f | 54f352a242a8ad6ff5516703e91da61e08d9a9e6 | /Source Codes/AtCoder/abc103/C/4814128.cpp | c5ae9db1ee4cc6f2b7b3cfe77f3f96f23e4abe81 | [] | no_license | Kawser-nerd/CLCDSA | 5cbd8a4c3f65173e4e8e0d7ed845574c4770c3eb | aee32551795763b54acb26856ab239370cac4e75 | refs/heads/master | 2022-02-09T11:08:56.588303 | 2022-01-26T18:53:40 | 2022-01-26T18:53:40 | 211,783,197 | 23 | 9 | null | null | null | null | UTF-8 | C++ | false | false | 2,163 | cpp | // https://atcoder.jp/contests/abc118/tasks/abc118_c
// http://ctylim.hatenablog.com/entry/2015/08/30/191553
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <cstdio>
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())
#define RSORT(c) sort((c).rbegin(), (c).rend())
#define MAXINDEX(c) distance((c).begin(), max_element((c).begin(), (c).end()))
#define MININDEX(c) distance((c).begin(), min_element((c).begin(), (c).end()))
#define DEBUG(x) std::cerr << #x << " = " << (x) << " (" << __FILE__ << "::" << __LINE__ << ")" << std::endl;
#define ERROR(s) std::cerr << "Error::" << __FILE__ << "::" << __LINE__ << "::" << __FUNCTION__ << "::" << (s) << std::endl;
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define repd(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)
typedef long long ll;
int inputValue()
{
int a;
// std::cin >> a;
scanf("%d", &a);
return a;
}
void inputArray(int *p, int a)
{
rep(i, a)
{
// std::cin >> p[i];
scanf("%d",p+i);
}
}
void inputVector(std::vector<int> *p, int a)
{
rep(i, a)
{
int input;
// std::cin >> input;
scanf("%d", &input);
p->push_back(input);
}
}
template <typename T>
void output(T a, int precision)
{
if (precision > 0)
{
std::cout << std::setprecision(precision) << a << "\n";
}
else
{
std::cout << a << "\n";
}
}
using namespace std;
int gcd(int a, int b)
{
while (1)
{
if (a < b)
swap(a, b);
if (!b)
break;
a %= b;
}
return a;
}
int main(int argc, char **argv)
{
int N = inputValue();
vector<int> v;
inputVector(&v, N);
int sum = 0;
EACH(k, v)
{
sum += (*k-1);
}
cout << sum << endl;
return 0;
}
// | [
"kwnafi@yahoo.com"
] | kwnafi@yahoo.com |
19e431cf25de9b5cae54f62629cfae660809a0c6 | 4a28104787a4ce3bf362fda9182e4f1fe6276c30 | /implementations/summeup.cpp | e1aed4e4de87d69cfc9ffe7f4644d2130a7f7f7b | [] | no_license | Ason4901/geeksforgeeks | d0538a22db00c86e97ec8b9f6c548ebd1ecef8ce | 777aa4c0752bb0a9b942922e1ad99095a161cc6b | refs/heads/master | 2023-02-24T07:51:15.469015 | 2021-01-30T15:36:20 | 2021-01-30T15:36:20 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 298 | cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(int argc, char const *argv[])
{
ll t;
cin >> t;
while (t--)
{
ll n;
cin >> n;
ll sum = 0;
while (n != 0)
{
sum = sum + n % 10;
n = n / 10;
}
cout << sum;
}
return 0;
}
| [
"51023991+abhinavprkash@users.noreply.github.com"
] | 51023991+abhinavprkash@users.noreply.github.com |
55d8dc06deed10b30accac33b20ae740f6ea5193 | a8bb9df3dd47350be0e82c6ec76fb1c19c86f323 | /vhls/src/tenos/io_backdoor.h | dcc88043be61ce242b40ec6bd228f4123c19c7d4 | [] | no_license | Appledee/fpga-matrix-mult | f4a42e1b54d33ce694a3cc79ab8b4f3cdbf1f67f | a28dc234c89db3912eb3d9c75904ea7a9592bfac | refs/heads/master | 2023-03-18T19:14:10.850434 | 2017-04-24T17:05:23 | 2017-04-24T17:06:08 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 716 | h | // Copyright (C) 2016 XPARCH, Ltd. <info@xparch.com>
#ifndef IO_BACKDOOR_H
#define IO_BACKDOOR_H
#include "tenos.h"
#include "socdam_bdoor_mapping.h"
/* FIXME: Maximum 256 can be open at any time */
#define MAX_FILES 256
class io_backdoor_setup {
public:
io_backdoor_setup(const char* image, u8_t psize, char e);
/* opens file */
int open(const char* name, const char* mode);
/* fills buffer */
int fill(int fid, char* buf, int max);
/* close */
int close(int handle);
/* flush */
int flush(int fid, char* buf);
private:
const char* image_name;
u8_t pointer_size;
int open_files;
int curr_idx;
FILE* files[MAX_FILES];
};
extern class io_backdoor_setup *io_backdoor_su;
#endif
| [
"cjw218@cl.cam.ac.uk"
] | cjw218@cl.cam.ac.uk |
a48ba363d5bef39201cc55ae60508349fdff9653 | b1a6d48e2f6444493f695739c842c5fd5a7ebe49 | /src/ListaCircular.cpp | 28e85e9eb7f21b391600acbf15aa4099ba8dcb20 | [] | no_license | DanielSaturnino/ListaCircular | 03b03077f53af17d0c0538a3436548edb18aa4c1 | 53e0005856eda4ec0f45cca81dec1c3a8c1fbda3 | refs/heads/master | 2020-04-09T08:34:49.670625 | 2016-09-12T02:07:32 | 2016-09-12T02:07:32 | 68,176,001 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,445 | cpp | /**
Daniel Manzano Saturnino
*/
#include "ListaCircular.h"
/*
Constructor:
@Parametros: void
@Result: void
Crea un nodo de con H y T apuntando a NULL
*/
ListaCircular::ListaCircular()
{
this->H=NULL;
this->T=NULL;
}
/*
Constructor
@Parametros:int Dato
@Result: void
Crea un nodo que apunta a H y T apunta a H
*/
ListaCircular::ListaCircular(int Dato)
{
Nodo * aux= new Nodo(Dato);
this->H=aux;
this->T->setSig(this->H);
}
/*
Lista Vacia
@Parametros: void
@Result: bool True o False
Comprueba si la lista esta vacia revisando los apuntadores
de H y T si apuntan a NULL devuelve un true de lo contrario
un false
*/
bool ListaCircular::ListaVacia()
{
if (this->H == NULL && this->T == NULL)
return true;
return false;
}
/*
AddInicio
@Parametros: int Dato
@Result: Void
Este metodo crea un nodo auxiliar que apunta a H
llama al metodo lista vacia si se encuentra vacia
agrega el elemento y asigna a T el nodo creado este a su vez
apunta a H
de lo contrario H se le asigna el nuevo nodo
*/
void ListaCircular::AddInicio(int Dato)
{
Nodo* aux = new Nodo(Dato,this->H);
if (ListaVacia())
{
this->T= aux;
T->setSig(this->H);
}
this->H= aux;
}
/*
AddFinal
@Parametros: int Dato
@Result: void
Crea un nuevo nodo con dato nuevo, verifica si
la lista esta vacia si si lo esta a H y T se le asigna
el nuevo nodo, de lo contrario a T apunta a l nuevo nodo
y a T se le asigna el nodo que se ha creado y hace que apunte
a H
*/
void ListaCircular::AddFinal(int Dato)
{
Nodo* aux=new Nodo (Dato);
if(ListaVacia())
{
this->H= aux;
this->T= aux;
T->setSig(this->H);
}else{
this->T->setSig(aux);
this->T= aux;
T->setSig(this->H);
}
}
/*
AddRef
@Parametros: int Dato, int Ref
@Result: void
Verifica si la lista esta vacia llamando al metodo lista Vacia
si esto se cumple crea un dato con un dato a H se le asigna
el nodo creado y finalmente T es igual a H e imprime una leyenda
de lo contrario crea un nodo que apunta a H recorre la lista
hasta que el nodo tenga el valor de la referencia y apunte
a un valor diferente de T si se cumple lo anterior apuntara
al siguiente valor hasta que llegue al elemento de referencia
una vez llegado verifica si el nodo no apunta a null
si esto se cumple crea un nodo con el valor de dato y
que apunta al siguiente del nodo que se creo y que
apuntaba a H y finalmente a el primer nodo creado
se le asigna la referencia a la que apuntaba el segundo
nodo creado
si esto no se cumple arroja una leyenda
*/
void ListaCircular::AddRef(int Dato,int Ref)
{
if(ListaVacia())
{
Nodo* aux=new Nodo(Dato);
this->H=aux;
this->T=this->H;
std::cout<<"No se encontro la referencia por que la lista esta vacia"<<std::endl;
return;
}
Nodo*aux=this->H;
while(aux->getDato()!=Ref && aux!=NULL)
{
aux=aux->getSig();
}
if(aux!=NULL)
{
Nodo* aux2=new Nodo(Dato,aux->getSig());
aux->setSig(aux2);
}else
{
std::cout<<"NO EXISTE LA REFERENCIA EN LA LISTA"<<std::endl;
}
}
/*
Remove Lista
@Parametros: void
@Result: int Dato
verifica que la lista este vacia con el metodo lista Vacia
Si se cumple arroja una leyenda y regresamos un cero
si no creamos una variablede tipo entero y le asignamos
el valor de H despues H ahora apuntara al siguiente de H
y preguntamos si H apunta NULL
si apunta a NULL si apunta entonces T tambien apuntara a NULL
si no solo retorna un dato
*/
int ListaCircular::RemoveInicio()
{
if(ListaVacia())
{
std::cout<<"LA LISTA ESTA VACIA"<<std::endl;
return 0;
}else
{
int Dato=H->getDato();
this->H=H->getSig();
if(this->H==NULL)
this->T=NULL;
return Dato;
}
}
/*
RemoveFinal
@Parametros: void
@Result: int Dato
Verifica si la lista esta vacia con el metodo Lista Vacia
si esta vacia da una leyenda y retorna un cero
si no crea un dato se le asigna el dato de T
y pregunta si H es diferente de T si esto es correcto
crea un nodo que apunta a H recorre la lista con un
while hasta que apunte a T cuando llegue sale y a T se
le asigna el nuevo nodo que apunta a H y el nodo nuevo es T
ahora el T anterior apunta a un NULL,
si no se cumplio lo anterior H y T apuntan a NuLL
al final regresa un dato
*/
int ListaCircular::RemoveFinal()
{
if(ListaVacia())
{
std::cout<<"LA LISTA ESTA VACIA"<<std::endl;
return 0;
}
int Dato=T->getDato();
if(this->H!=this->T)
{
Nodo* aux=this->H;
while(aux->getSig()!=this->T)
{
aux=aux->getSig();
}
aux->setSig(this->H);
this->T=aux;
this->T->setSig(NULL);
}else
{
this->H=NULL;
this->T=NULL;
}
return Dato;
}
/*
RemoveRef
@Parametros:int Ref
@Result: int Dato
Verifica si la lista esta vacia con el metodo Lista Vacia
si esta vacia retorna UN NuLL si no va crear dos nodos el primero
se recorrera desde H hasta el dato dado por el usuario
el segundo desde H hasta uno antes del primer nodo creado
y preguntamos si el primer nodo
creado no apunta NULL si se cumple al segundo creado se le
asigna el siguiente del primer nodo perdiendo la referencia del
primer nodo si apunta a NULL arroja una leyenda de que no se
encontro nada
retorna un Dato
*/
int ListaCircular::RemoveRef(int Ref)
{
if(ListaVacia())
{
std::cout<<"LA LISTA ESTA VACIA"<<std::endl;
return 0;
}else
{
Nodo*aux=this->H;
while(aux->getDato()!=Ref && aux!=this->T)
{
aux=aux->getSig();
}
Nodo* aux2=this->H;
while(aux2->getSig()!=aux)
{
aux2=aux2->getSig();
}
if(aux!=NULL)
{
aux2->setSig(aux->getSig());
}else
{
std::cout<<"NO EXISTE LA REFERENCIA EN LA LISTA"<<std::endl;
}
return Ref;
}
}
/*
Lista Vacia
@Parametros: void
@Result: int Dato
Verifica si la liasta esta vacia con el metodo Lista vacia
si lo esta envia una leyenda y retorna un cero si
no a H y T los apunta a NULL e imprime una leyenda
retorna un cero
*/
int ListaCircular::VaciarLista()
{
if (ListaVacia())
{
std::cout<<"La lista esta vacia"<<std::endl;
return 0;
}else{
this->H=NULL;
this->T=NULL;
std::cout<<"He vasiado la lista"<<std::endl;
}
return 0;
}
/*
Buscar elemento
@paramametros: int Ref
@Result: Nodo*
Verifica con el metodo lista vacia si la lista esta vacia
si esta arroja una leyenda y devuelve un NULL
de lo contrario crea un nodo y lo recorre hasta encontrar
el dato y pregunta si el dato es igual al dato que esta en ese
nodo entonces imprime una leyenda y el valor del nodo
si no devuelve una leyenda en ambos casos regresa el nodo
creado
*/
Nodo* ListaCircular::BuscarElemento(int Dato)
{
if (ListaVacia())
{
std::cout<<"NO SE ENCOTRO ELEMENTOS PORQUE LA LISTA ESTA VACIA"<<std::endl;
return NULL;
}else
{
Nodo* aux=this->H;
while(aux->getDato()!=Dato && aux!=this->T)
{
aux=aux->getSig();
}
if(aux->getDato()==Dato)
{
std::cout<<"ELEMENTO ENCONTRADO:"<<std::endl;
std::cout<<aux->getDato()<<std::endl;
return aux;
}
std::cout<<"NO se encontro el elemento"<<std::endl;
}
}
/*
Show
@parametros: void
@Result: void
Crea un nodo auxiliar que apunta a H
y este nodo recorre la lista hasta llegar a T
caba vez que cambia imprime el dato donde se encuentra
*/
void ListaCircular::Show()
{
Nodo* aux = this->H;
while(aux!=T)
{
std::cout<<aux->getDato()<<std::endl;
aux=aux->getSig();
}
std::cout<<T->getDato()<<std::endl;
} | [
"sktosaturmx@live.com.mx"
] | sktosaturmx@live.com.mx |
616f94a1e07924a650257fdc40f5926c25cad923 | e68c1f9134b44ddea144f7efa7523076f3f12d3a | /FinalCode/Monk_Male_DW_SF_DebilitatingBlows_03_2.h | 5b63030a18c15861073ba59b15385ef15566354a | [] | no_license | iso5930/Direct-3D-Team-Portfolio | 4ac710ede0c9176702595cba5579af42887611cf | 84e64eb4e91c7e5b4aed77212cd08cfee038fcd3 | refs/heads/master | 2021-08-23T08:15:00.128591 | 2017-12-04T06:14:39 | 2017-12-04T06:14:39 | 112,998,717 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 304 | h | #pragma once
#include "playerstate.h"
class CMonk_Male_DW_SF_DebilitatingBlows_03_2 : public CPlayerState
{
public:
virtual void Initialize();
virtual CPlayerState* Action();
public:
explicit CMonk_Male_DW_SF_DebilitatingBlows_03_2(void);
virtual ~CMonk_Male_DW_SF_DebilitatingBlows_03_2(void);
};
| [
"iso5930@naver.com"
] | iso5930@naver.com |
0611b5dc79ef941223560c2b0c0264b6c2330ad6 | d01b295c6776fe7646799eed2963abee8dd4cda4 | /experimental/gdal-3.0.1_extended/frmts/pdf/pdfcreatefromcomposition.cpp | 73c8aa7ad785690932a930c77169f4827d2e3cd1 | [
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"LicenseRef-scancode-warranty-disclaimer",
"MIT",
"SunPro",
"LicenseRef-scancode-info-zip-2005-02",
"BSD-3-Clause"
] | permissive | DevotionZhu/SUMOLibraries | 1a56c224fdb0dceba8e7e8ae6afcea65b20e7553 | 0c8ca7149cd2b9194a9db0f595e471b8ce3b2189 | refs/heads/master | 2022-07-16T19:22:31.480232 | 2020-05-19T08:05:56 | 2020-05-19T08:07:01 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 92,710 | cpp | /******************************************************************************
* $Id: pdfcreatefromcomposition.cpp 5a04126b888092d810db40222dce30479b5ff901 2019-04-09 18:05:52 +0200 Even Rouault $
*
* Project: PDF driver
* Purpose: GDALDataset driver for PDF dataset.
* Author: Even Rouault, <even dot rouault at spatialys dot com>
*
******************************************************************************
* Copyright (c) 2019, Even Rouault <even dot rouault at spatialys dot com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
****************************************************************************/
#include "gdal_pdf.h"
#include "pdfcreatecopy.h"
#include <cmath>
#include <cstdlib>
#include "pdfcreatefromcomposition.h"
#include "cpl_conv.h"
#include "cpl_minixml.h"
#include "cpl_vsi_virtual.h"
#include "ogr_geometry.h"
/************************************************************************/
/* GDALPDFComposerWriter() */
/************************************************************************/
GDALPDFComposerWriter::GDALPDFComposerWriter(VSILFILE* fp):
GDALPDFBaseWriter(fp)
{
StartNewDoc();
}
/************************************************************************/
/* ~GDALPDFComposerWriter() */
/************************************************************************/
GDALPDFComposerWriter::~GDALPDFComposerWriter()
{
Close();
}
/************************************************************************/
/* Close() */
/************************************************************************/
void GDALPDFComposerWriter::Close()
{
if (m_fp)
{
CPLAssert(!m_bInWriteObj);
if (m_nPageResourceId.toBool())
{
WritePages();
WriteXRefTableAndTrailer(false, 0);
}
}
GDALPDFBaseWriter::Close();
}
/************************************************************************/
/* CreateOCGOrder() */
/************************************************************************/
GDALPDFArrayRW* GDALPDFComposerWriter::CreateOCGOrder(const TreeOfOCG* parent)
{
auto poArrayOrder = new GDALPDFArrayRW();
for( const auto& child: parent->m_children )
{
poArrayOrder->Add(child->m_nNum, 0);
if( !child->m_children.empty() )
{
poArrayOrder->Add(CreateOCGOrder(child.get()));
}
}
return poArrayOrder;
}
/************************************************************************/
/* CollectOffOCG() */
/************************************************************************/
void GDALPDFComposerWriter::CollectOffOCG(std::vector<GDALPDFObjectNum>& ar,
const TreeOfOCG* parent)
{
if( !parent->m_bInitiallyVisible )
ar.push_back(parent->m_nNum);
for( const auto& child: parent->m_children )
{
CollectOffOCG(ar, child.get());
}
}
/************************************************************************/
/* WritePages() */
/************************************************************************/
void GDALPDFComposerWriter::WritePages()
{
StartObj(m_nPageResourceId);
{
GDALPDFDictionaryRW oDict;
GDALPDFArrayRW* poKids = new GDALPDFArrayRW();
oDict.Add("Type", GDALPDFObjectRW::CreateName("Pages"))
.Add("Count", (int)m_asPageId.size())
.Add("Kids", poKids);
for(size_t i=0;i<m_asPageId.size();i++)
poKids->Add(m_asPageId[i], 0);
VSIFPrintfL(m_fp, "%s\n", oDict.Serialize().c_str());
}
EndObj();
if (m_nStructTreeRootId.toBool())
{
auto nParentTreeId = AllocNewObject();
StartObj(nParentTreeId);
VSIFPrintfL(m_fp, "<< /Nums [ ");
for( size_t i = 0; i < m_anParentElements.size(); i++ )
{
VSIFPrintfL(m_fp, "%d %d 0 R ",
static_cast<int>(i),
m_anParentElements[i].toInt());
}
VSIFPrintfL(m_fp, " ] >> \n");
EndObj();
StartObj(m_nStructTreeRootId);
VSIFPrintfL(m_fp,
"<< "
"/Type /StructTreeRoot "
"/ParentTree %d 0 R "
"/K [ ", nParentTreeId.toInt());
for( const auto& num: m_anFeatureLayerId )
{
VSIFPrintfL(m_fp, "%d 0 R ", num.toInt());
}
VSIFPrintfL(m_fp,"] >>\n");
EndObj();
}
StartObj(m_nCatalogId);
{
GDALPDFDictionaryRW oDict;
oDict.Add("Type", GDALPDFObjectRW::CreateName("Catalog"))
.Add("Pages", m_nPageResourceId, 0);
if (m_nOutlinesId.toBool())
oDict.Add("Outlines", m_nOutlinesId, 0);
if (m_nXMPId.toBool())
oDict.Add("Metadata", m_nXMPId, 0);
if (!m_asOCGs.empty() )
{
GDALPDFDictionaryRW* poDictOCProperties = new GDALPDFDictionaryRW();
oDict.Add("OCProperties", poDictOCProperties);
GDALPDFDictionaryRW* poDictD = new GDALPDFDictionaryRW();
poDictOCProperties->Add("D", poDictD);
if( m_bDisplayLayersOnlyOnVisiblePages )
{
poDictD->Add("ListMode",
GDALPDFObjectRW::CreateName("VisiblePages"));
}
/* Build "Order" array of D dict */
GDALPDFArrayRW* poArrayOrder = CreateOCGOrder(&m_oTreeOfOGC);
poDictD->Add("Order", poArrayOrder);
/* Build "OFF" array of D dict */
std::vector<GDALPDFObjectNum> offOCGs;
CollectOffOCG(offOCGs, &m_oTreeOfOGC);
if( !offOCGs.empty() )
{
GDALPDFArrayRW* poArrayOFF = new GDALPDFArrayRW();
for( const auto& num: offOCGs )
{
poArrayOFF->Add(num, 0);
}
poDictD->Add("OFF", poArrayOFF);
}
/* Build "RBGroups" array of D dict */
if( !m_oMapExclusiveOCGIdToOCGs.empty() )
{
GDALPDFArrayRW* poArrayRBGroups = new GDALPDFArrayRW();
for( const auto& group: m_oMapExclusiveOCGIdToOCGs )
{
GDALPDFArrayRW* poGroup = new GDALPDFArrayRW();
for( const auto& num: group.second )
{
poGroup->Add(num, 0);
}
poArrayRBGroups->Add(poGroup);
}
poDictD->Add("RBGroups", poArrayRBGroups);
}
GDALPDFArrayRW* poArrayOGCs = new GDALPDFArrayRW();
for(const auto& ocg: m_asOCGs )
poArrayOGCs->Add(ocg.nId, 0);
poDictOCProperties->Add("OCGs", poArrayOGCs);
}
if (m_nStructTreeRootId.toBool())
{
GDALPDFDictionaryRW* poDictMarkInfo = new GDALPDFDictionaryRW();
oDict.Add("MarkInfo", poDictMarkInfo);
poDictMarkInfo->Add("UserProperties", GDALPDFObjectRW::CreateBool(TRUE));
oDict.Add("StructTreeRoot", m_nStructTreeRootId, 0);
}
if (m_nNamesId.toBool())
oDict.Add("Names", m_nNamesId, 0);
VSIFPrintfL(m_fp, "%s\n", oDict.Serialize().c_str());
}
EndObj();
}
/************************************************************************/
/* CreateLayerTree() */
/************************************************************************/
bool GDALPDFComposerWriter::CreateLayerTree(const CPLXMLNode* psNode,
const GDALPDFObjectNum& nParentId,
TreeOfOCG* parent)
{
for(const auto* psIter = psNode->psChild; psIter; psIter = psIter->psNext)
{
if( psIter->eType == CXT_Element &&
strcmp(psIter->pszValue, "Layer") == 0 )
{
const char* pszId = CPLGetXMLValue(psIter, "id", nullptr);
if( !pszId )
{
CPLError(CE_Failure, CPLE_AppDefined,
"Missing id attribute in Layer");
return false;
}
const char* pszName = CPLGetXMLValue(psIter, "name", nullptr);
if( !pszName )
{
CPLError(CE_Failure, CPLE_AppDefined,
"Missing name attribute in Layer");
return false;
}
if( m_oMapLayerIdToOCG.find(pszId) != m_oMapLayerIdToOCG.end() )
{
CPLError(CE_Failure, CPLE_AppDefined,
"Layer.id = %s is not unique", pszId);
return false;
}
const bool bInitiallyVisible = CPLTestBool(
CPLGetXMLValue(psIter, "initiallyVisible", "true"));
const char* pszMutuallyExclusiveGroupId = CPLGetXMLValue(psIter,
"mutuallyExclusiveGroupId", nullptr);
auto nThisObjId = WriteOCG( pszName, nParentId );
m_oMapLayerIdToOCG[pszId] = nThisObjId;
std::unique_ptr<TreeOfOCG> newTreeOfOCG(new TreeOfOCG());
newTreeOfOCG->m_nNum = nThisObjId;
newTreeOfOCG->m_bInitiallyVisible = bInitiallyVisible;
parent->m_children.emplace_back(std::move(newTreeOfOCG));
if( pszMutuallyExclusiveGroupId )
{
m_oMapExclusiveOCGIdToOCGs[pszMutuallyExclusiveGroupId].
push_back(nThisObjId);
}
if( !CreateLayerTree(psIter, nThisObjId,
parent->m_children.back().get()) )
{
return false;
}
}
}
return true;
}
/************************************************************************/
/* ParseActions() */
/************************************************************************/
bool GDALPDFComposerWriter::ParseActions(const CPLXMLNode* psNode,
std::vector<std::unique_ptr<Action>>& actions)
{
std::set<GDALPDFObjectNum> anONLayers{};
std::set<GDALPDFObjectNum> anOFFLayers{};
for(const auto* psIter = psNode->psChild; psIter; psIter = psIter->psNext)
{
if( psIter->eType == CXT_Element &&
strcmp(psIter->pszValue, "GotoPageAction") == 0 )
{
std::unique_ptr<GotoPageAction> poAction(new GotoPageAction());
const char* pszPageId = CPLGetXMLValue(psIter, "pageId", nullptr);
if( !pszPageId )
{
CPLError(CE_Failure, CPLE_AppDefined,
"Missing pageId attribute in GotoPageAction");
return false;
}
auto oIter = m_oMapPageIdToObjectNum.find(pszPageId);
if( oIter == m_oMapPageIdToObjectNum.end() )
{
CPLError(CE_Failure, CPLE_AppDefined,
"GotoPageAction.pageId = %s not pointing to a Page.id",
pszPageId);
return false;
}
poAction->m_nPageDestId = oIter->second;
poAction->m_dfX1 = CPLAtof(CPLGetXMLValue(psIter, "x1", "0"));
poAction->m_dfX2 = CPLAtof(CPLGetXMLValue(psIter, "y1", "0"));
poAction->m_dfY1 = CPLAtof(CPLGetXMLValue(psIter, "x2", "0"));
poAction->m_dfY2 = CPLAtof(CPLGetXMLValue(psIter, "y2", "0"));
actions.push_back(std::move(poAction));
}
else if( psIter->eType == CXT_Element &&
strcmp(psIter->pszValue, "SetAllLayersStateAction") == 0 )
{
if( CPLTestBool(CPLGetXMLValue(psIter, "visible", "true")) )
{
for( const auto& ocg: m_asOCGs )
{
anOFFLayers.erase(ocg.nId);
anONLayers.insert(ocg.nId);
}
}
else
{
for( const auto& ocg: m_asOCGs )
{
anONLayers.erase(ocg.nId);
anOFFLayers.insert(ocg.nId);
}
}
}
else if( psIter->eType == CXT_Element &&
strcmp(psIter->pszValue, "SetLayerStateAction") == 0 )
{
const char* pszLayerId = CPLGetXMLValue(psIter, "layerId", nullptr);
if( !pszLayerId )
{
CPLError(CE_Failure, CPLE_AppDefined,
"Missing layerId");
return false;
}
auto oIter = m_oMapLayerIdToOCG.find(pszLayerId);
if( oIter == m_oMapLayerIdToOCG.end() )
{
CPLError(CE_Failure, CPLE_AppDefined,
"Referencing layer of unknown id: %s", pszLayerId);
return false;
}
const auto& ocg = oIter->second;
if( CPLTestBool(CPLGetXMLValue(psIter, "visible", "true")) )
{
anOFFLayers.erase(ocg);
anONLayers.insert(ocg);
}
else
{
anONLayers.erase(ocg);
anOFFLayers.insert(ocg);
}
}
else if( psIter->eType == CXT_Element &&
strcmp(psIter->pszValue, "JavascriptAction") == 0 )
{
std::unique_ptr<JavascriptAction> poAction(new JavascriptAction());
poAction->m_osScript = CPLGetXMLValue(psIter, nullptr, "");
actions.push_back(std::move(poAction));
}
}
if( !anONLayers.empty() || !anOFFLayers.empty() )
{
std::unique_ptr<SetLayerStateAction> poAction(new SetLayerStateAction());
poAction->m_anONLayers = std::move(anONLayers);
poAction->m_anOFFLayers = std::move(anOFFLayers);
actions.push_back(std::move(poAction));
}
return true;
}
/************************************************************************/
/* CreateOutlineFirstPass() */
/************************************************************************/
bool GDALPDFComposerWriter::CreateOutlineFirstPass(const CPLXMLNode* psNode,
OutlineItem* poParentItem)
{
for(const auto* psIter = psNode->psChild; psIter; psIter = psIter->psNext)
{
if( psIter->eType == CXT_Element &&
strcmp(psIter->pszValue, "OutlineItem") == 0 )
{
std::unique_ptr<OutlineItem> newItem(new OutlineItem());
const char* pszName = CPLGetXMLValue(psIter, "name", nullptr);
if( !pszName )
{
CPLError(CE_Failure, CPLE_AppDefined,
"Missing name attribute in OutlineItem");
return false;
}
newItem->m_osName = pszName;
newItem->m_bOpen =
CPLTestBool(CPLGetXMLValue(psIter, "open", "true"));
if( CPLTestBool(CPLGetXMLValue(psIter, "italic", "false")) )
newItem->m_nFlags |= 1 << 0;
if( CPLTestBool(CPLGetXMLValue(psIter, "bold", "false")) )
newItem->m_nFlags |= 1 << 1;
const auto poActions = CPLGetXMLNode(psIter, "Actions");
if( poActions )
{
if( !ParseActions(poActions, newItem->m_aoActions) )
return false;
}
newItem->m_nObjId = AllocNewObject();
if( !CreateOutlineFirstPass(psIter, newItem.get()) )
{
return false;
}
poParentItem->m_nKidsRecCount += 1 + newItem->m_nKidsRecCount;
poParentItem->m_aoKids.push_back(std::move(newItem));
}
}
return true;
}
/************************************************************************/
/* SerializeActions() */
/************************************************************************/
GDALPDFDictionaryRW* GDALPDFComposerWriter::SerializeActions(
GDALPDFDictionaryRW* poDictForDest,
const std::vector<std::unique_ptr<Action>>& actions)
{
GDALPDFDictionaryRW* poRetAction = nullptr;
GDALPDFDictionaryRW* poLastActionDict = nullptr;
for( const auto& poAction: actions )
{
GDALPDFDictionaryRW* poActionDict = nullptr;
auto poGotoPageAction = dynamic_cast<GotoPageAction*>(poAction.get());
if( poGotoPageAction )
{
GDALPDFArrayRW* poDest = new GDALPDFArrayRW;
poDest->Add(poGotoPageAction->m_nPageDestId, 0);
if( poGotoPageAction->m_dfX1 == 0.0 &&
poGotoPageAction->m_dfX2 == 0.0 &&
poGotoPageAction->m_dfY1 == 0.0 &&
poGotoPageAction->m_dfY2 == 0.0 )
{
poDest->Add(GDALPDFObjectRW::CreateName("XYZ"))
.Add(GDALPDFObjectRW::CreateNull())
.Add(GDALPDFObjectRW::CreateNull())
.Add(GDALPDFObjectRW::CreateNull());
}
else
{
poDest->Add(GDALPDFObjectRW::CreateName("FitR"))
.Add(poGotoPageAction->m_dfX1)
.Add(poGotoPageAction->m_dfY1)
.Add(poGotoPageAction->m_dfX2)
.Add(poGotoPageAction->m_dfY2);
}
if( poDictForDest && actions.size() == 1 )
{
poDictForDest->Add("Dest", poDest);
}
else
{
poActionDict = new GDALPDFDictionaryRW();
poActionDict->Add("Type", GDALPDFObjectRW::CreateName("Action"));
poActionDict->Add("S", GDALPDFObjectRW::CreateName("GoTo"));
poActionDict->Add("D", poDest);
}
}
auto setLayerStateAction = dynamic_cast<SetLayerStateAction*>(poAction.get());
if( setLayerStateAction )
{
poActionDict = new GDALPDFDictionaryRW();
poActionDict->Add("Type", GDALPDFObjectRW::CreateName("Action"));
poActionDict->Add("S", GDALPDFObjectRW::CreateName("SetOCGState"));
auto poStateArray = new GDALPDFArrayRW();
if( !setLayerStateAction->m_anOFFLayers.empty() )
{
poStateArray->Add(GDALPDFObjectRW::CreateName("OFF"));
for( const auto& ocg: setLayerStateAction->m_anOFFLayers )
poStateArray->Add(ocg, 0);
}
if( !setLayerStateAction->m_anONLayers.empty() )
{
poStateArray->Add(GDALPDFObjectRW::CreateName("ON"));
for( const auto& ocg: setLayerStateAction->m_anONLayers )
poStateArray->Add(ocg, 0);
}
poActionDict->Add("State", poStateArray);
}
auto javascriptAction = dynamic_cast<JavascriptAction*>(poAction.get());
if( javascriptAction )
{
poActionDict = new GDALPDFDictionaryRW();
poActionDict->Add("Type", GDALPDFObjectRW::CreateName("Action"));
poActionDict->Add("S", GDALPDFObjectRW::CreateName("JavaScript"));
poActionDict->Add("JS", javascriptAction->m_osScript);
}
if( poActionDict )
{
if( poLastActionDict == nullptr )
{
poRetAction = poActionDict;
}
else
{
poLastActionDict->Add("Next", poActionDict);
}
poLastActionDict = poActionDict;
}
}
return poRetAction;
}
/************************************************************************/
/* SerializeOutlineKids() */
/************************************************************************/
bool GDALPDFComposerWriter::SerializeOutlineKids(const OutlineItem* poParentItem)
{
for( size_t i = 0; i < poParentItem->m_aoKids.size(); i++ )
{
const auto& poItem = poParentItem->m_aoKids[i];
StartObj(poItem->m_nObjId);
GDALPDFDictionaryRW oDict;
oDict.Add("Title", poItem->m_osName);
auto poActionDict = SerializeActions(&oDict, poItem->m_aoActions);
if( poActionDict )
{
oDict.Add("A", poActionDict);
}
if( i > 0 )
{
oDict.Add("Prev", poParentItem->m_aoKids[i-1]->m_nObjId, 0);
}
if( i + 1 < poParentItem->m_aoKids.size() )
{
oDict.Add("Next", poParentItem->m_aoKids[i+1]->m_nObjId, 0);
}
if( poItem->m_nFlags )
oDict.Add("F", poItem->m_nFlags);
oDict.Add("Parent", poParentItem->m_nObjId, 0);
if( !poItem->m_aoKids.empty() )
{
oDict.Add("First", poItem->m_aoKids.front()->m_nObjId, 0);
oDict.Add("Last", poItem->m_aoKids.back()->m_nObjId, 0);
oDict.Add("Count", poItem->m_bOpen ?
poItem->m_nKidsRecCount : -poItem->m_nKidsRecCount);
}
VSIFPrintfL(m_fp, "%s\n", oDict.Serialize().c_str());
EndObj();
SerializeOutlineKids(poItem.get());
}
return true;
}
/************************************************************************/
/* CreateOutline() */
/************************************************************************/
bool GDALPDFComposerWriter::CreateOutline(const CPLXMLNode* psNode)
{
OutlineItem oRootOutlineItem;
if( !CreateOutlineFirstPass(psNode, &oRootOutlineItem) )
return false;
if( oRootOutlineItem.m_aoKids.empty() )
return true;
m_nOutlinesId = AllocNewObject();
StartObj(m_nOutlinesId);
GDALPDFDictionaryRW oDict;
oDict.Add("Type", GDALPDFObjectRW::CreateName("Outlines"))
.Add("First", oRootOutlineItem.m_aoKids.front()->m_nObjId, 0)
.Add("Last", oRootOutlineItem.m_aoKids.back()->m_nObjId, 0)
.Add("Count", oRootOutlineItem.m_nKidsRecCount);
VSIFPrintfL(m_fp, "%s\n", oDict.Serialize().c_str());
EndObj();
oRootOutlineItem.m_nObjId = m_nOutlinesId;
return SerializeOutlineKids(&oRootOutlineItem);
}
/************************************************************************/
/* GenerateGeoreferencing() */
/************************************************************************/
bool GDALPDFComposerWriter::GenerateGeoreferencing(const CPLXMLNode* psGeoreferencing,
double dfWidthInUserUnit,
double dfHeightInUserUnit,
GDALPDFObjectNum& nViewportId,
GDALPDFObjectNum& nLGIDictId,
Georeferencing& georeferencing)
{
double bboxX1 = 0;
double bboxY1 = 0;
double bboxX2 = dfWidthInUserUnit;
double bboxY2 = dfHeightInUserUnit;
const auto psBoundingBox = CPLGetXMLNode(psGeoreferencing, "BoundingBox");
if( psBoundingBox )
{
bboxX1 = CPLAtof(
CPLGetXMLValue(psBoundingBox, "x1", CPLSPrintf("%.18g", bboxX1)));
bboxY1 = CPLAtof(
CPLGetXMLValue(psBoundingBox, "y1", CPLSPrintf("%.18g", bboxY1)));
bboxX2 = CPLAtof(
CPLGetXMLValue(psBoundingBox, "x2", CPLSPrintf("%.18g", bboxX2)));
bboxY2 = CPLAtof(
CPLGetXMLValue(psBoundingBox, "y2", CPLSPrintf("%.18g", bboxY2)));
if( bboxX2 <= bboxX1 || bboxY2 <= bboxY1 )
{
CPLError(CE_Failure, CPLE_AppDefined, "Invalid BoundingBox");
return false;
}
}
std::vector<GDAL_GCP> aGCPs;
for(const auto* psIter = psGeoreferencing->psChild;
psIter; psIter = psIter->psNext)
{
if( psIter->eType == CXT_Element &&
strcmp(psIter->pszValue, "ControlPoint") == 0 )
{
const char* pszx = CPLGetXMLValue(psIter, "x", nullptr);
const char* pszy = CPLGetXMLValue(psIter, "y", nullptr);
const char* pszX = CPLGetXMLValue(psIter, "GeoX", nullptr);
const char* pszY = CPLGetXMLValue(psIter, "GeoY", nullptr);
if( !pszx || !pszy || !pszX || !pszY )
{
CPLError(CE_Failure, CPLE_NotSupported,
"At least one of x, y, GeoX or GeoY attribute "
"missing on ControlPoint");
return false;
}
GDAL_GCP gcp;
gcp.pszId = nullptr;
gcp.pszInfo = nullptr;
gcp.dfGCPPixel = CPLAtof(pszx);
gcp.dfGCPLine = CPLAtof(pszy);
gcp.dfGCPX = CPLAtof(pszX);
gcp.dfGCPY = CPLAtof(pszY);
gcp.dfGCPZ = 0;
aGCPs.emplace_back(std::move(gcp));
}
}
if( aGCPs.size() < 4 )
{
CPLError(CE_Failure, CPLE_NotSupported,
"At least 4 ControlPoint are required");
return false;
}
const char* pszBoundingPolygon =
CPLGetXMLValue(psGeoreferencing, "BoundingPolygon", nullptr);
std::vector<xyPair> aBoundingPolygon;
if( pszBoundingPolygon )
{
OGRGeometry* poGeom = nullptr;
OGRGeometryFactory::createFromWkt(pszBoundingPolygon, nullptr, &poGeom);
if( poGeom && poGeom->getGeometryType() == wkbPolygon )
{
auto poPoly = poGeom->toPolygon();
auto poRing = poPoly->getExteriorRing();
if( poRing )
{
if( psBoundingBox == nullptr )
{
OGREnvelope sEnvelope;
poRing->getEnvelope(&sEnvelope);
bboxX1 = sEnvelope.MinX;
bboxY1 = sEnvelope.MinY;
bboxX2 = sEnvelope.MaxX;
bboxY2 = sEnvelope.MaxY;
}
for( int i = 0; i < poRing->getNumPoints(); i++ )
{
aBoundingPolygon.emplace_back(
xyPair(poRing->getX(i), poRing->getY(i)));
}
}
}
delete poGeom;
}
const auto pszSRS = CPLGetXMLValue(psGeoreferencing, "SRS", nullptr);
if( !pszSRS )
{
CPLError(CE_Failure, CPLE_NotSupported,
"Missing SRS");
return false;
}
std::unique_ptr<OGRSpatialReference> poSRS(new OGRSpatialReference());
if( poSRS->SetFromUserInput(pszSRS) != OGRERR_NONE )
{
return false;
}
poSRS->SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER);
if( CPLTestBool(CPLGetXMLValue(psGeoreferencing, "ISO32000ExtensionFormat", "true")) )
{
nViewportId = GenerateISO32000_Georeferencing(
OGRSpatialReference::ToHandle(poSRS.get()),
bboxX1, bboxY1, bboxX2, bboxY2, aGCPs, aBoundingPolygon);
if( !nViewportId.toBool() )
{
return false;
}
}
if( CPLTestBool(CPLGetXMLValue(psGeoreferencing, "OGCBestPracticeFormat", "false")) )
{
nLGIDictId = GenerateOGC_BP_Georeferencing(
OGRSpatialReference::ToHandle(poSRS.get()),
bboxX1, bboxY1, bboxX2, bboxY2, aGCPs, aBoundingPolygon);
if( !nLGIDictId.toBool() )
{
return false;
}
}
const char* pszId = CPLGetXMLValue(psGeoreferencing, "id", nullptr);
if( pszId )
{
if (!GDALGCPsToGeoTransform( static_cast<int>(aGCPs.size()),
aGCPs.data(),
georeferencing.m_adfGT, TRUE))
{
CPLError(CE_Failure, CPLE_AppDefined,
"Could not compute geotransform with approximate match.");
return false;
}
if( std::fabs(georeferencing.m_adfGT[2]) < 1e-5 *
std::fabs(georeferencing.m_adfGT[1]) &&
std::fabs(georeferencing.m_adfGT[4]) < 1e-5 *
std::fabs(georeferencing.m_adfGT[5]) )
{
georeferencing.m_adfGT[2] = 0;
georeferencing.m_adfGT[4] = 0;
}
if( georeferencing.m_adfGT[2] != 0 ||
georeferencing.m_adfGT[4] != 0 ||
georeferencing.m_adfGT[5] < 0 )
{
CPLError(CE_Failure, CPLE_AppDefined,
"Geotransform should define a north-up non rotated area.");
return false;
}
georeferencing.m_osID = pszId;
georeferencing.m_oSRS = *(poSRS.get());
georeferencing.m_bboxX1 = bboxX1;
georeferencing.m_bboxY1 = bboxY1;
georeferencing.m_bboxX2 = bboxX2;
georeferencing.m_bboxY2 = bboxY2;
}
return true;
}
/************************************************************************/
/* GenerateISO32000_Georeferencing() */
/************************************************************************/
GDALPDFObjectNum GDALPDFComposerWriter::GenerateISO32000_Georeferencing(
OGRSpatialReferenceH hSRS,
double bboxX1, double bboxY1, double bboxX2, double bboxY2,
const std::vector<GDAL_GCP>& aGCPs,
const std::vector<xyPair>& aBoundingPolygon)
{
OGRSpatialReferenceH hSRSGeog = OSRCloneGeogCS(hSRS);
if( hSRSGeog == nullptr )
{
return GDALPDFObjectNum();
}
OSRSetAxisMappingStrategy(hSRSGeog, OAMS_TRADITIONAL_GIS_ORDER);
OGRCoordinateTransformationH hCT = OCTNewCoordinateTransformation( hSRS, hSRSGeog);
if( hCT == nullptr )
{
OSRDestroySpatialReference(hSRSGeog);
return GDALPDFObjectNum();
}
std::vector<GDAL_GCP> aGCPReprojected;
bool bSuccess = true;
for( const auto& gcp: aGCPs )
{
double X = gcp.dfGCPX;
double Y = gcp.dfGCPY;
bSuccess &= OCTTransform( hCT, 1,&X, &Y, nullptr ) == 1;
GDAL_GCP newGCP;
newGCP.pszId = nullptr;
newGCP.pszInfo = nullptr;
newGCP.dfGCPPixel = gcp.dfGCPPixel;
newGCP.dfGCPLine = gcp.dfGCPLine;
newGCP.dfGCPX = X;
newGCP.dfGCPY = Y;
newGCP.dfGCPZ = 0;
aGCPReprojected.emplace_back(std::move(newGCP));
}
if( !bSuccess )
{
OSRDestroySpatialReference(hSRSGeog);
OCTDestroyCoordinateTransformation(hCT);
return GDALPDFObjectNum();
}
const char * pszAuthorityCode = OSRGetAuthorityCode( hSRS, nullptr );
const char * pszAuthorityName = OSRGetAuthorityName( hSRS, nullptr );
int nEPSGCode = 0;
if( pszAuthorityName != nullptr && EQUAL(pszAuthorityName, "EPSG") &&
pszAuthorityCode != nullptr )
nEPSGCode = atoi(pszAuthorityCode);
int bIsGeographic = OSRIsGeographic(hSRS);
char* pszESRIWKT = nullptr;
const char* apszOptions[] = { "FORMAT=WKT1_ESRI", nullptr };
OSRExportToWktEx(hSRS, &pszESRIWKT, apszOptions);
OSRDestroySpatialReference(hSRSGeog);
OCTDestroyCoordinateTransformation(hCT);
auto nViewportId = AllocNewObject();
auto nMeasureId = AllocNewObject();
auto nGCSId = AllocNewObject();
StartObj(nViewportId);
GDALPDFDictionaryRW oViewPortDict;
oViewPortDict.Add("Type", GDALPDFObjectRW::CreateName("Viewport"))
.Add("Name", "Layer")
.Add("BBox", &((new GDALPDFArrayRW())
->Add(bboxX1).Add(bboxY1)
.Add(bboxX2).Add(bboxY2)))
.Add("Measure", nMeasureId, 0);
VSIFPrintfL(m_fp, "%s\n", oViewPortDict.Serialize().c_str());
EndObj();
GDALPDFArrayRW* poGPTS = new GDALPDFArrayRW();
GDALPDFArrayRW* poLPTS = new GDALPDFArrayRW();
const int nPrecision =
atoi(CPLGetConfigOption("PDF_COORD_DOUBLE_PRECISION", "16"));
for( const auto& gcp: aGCPReprojected )
{
poGPTS->AddWithPrecision(gcp.dfGCPY, nPrecision).
AddWithPrecision(gcp.dfGCPX, nPrecision); // Lat, long order
poLPTS->AddWithPrecision((gcp.dfGCPPixel - bboxX1) / (bboxX2 - bboxX1), nPrecision).
AddWithPrecision((gcp.dfGCPLine - bboxY1) / (bboxY2 - bboxY1), nPrecision);
}
StartObj(nMeasureId);
GDALPDFDictionaryRW oMeasureDict;
oMeasureDict .Add("Type", GDALPDFObjectRW::CreateName("Measure"))
.Add("Subtype", GDALPDFObjectRW::CreateName("GEO"))
.Add("GPTS", poGPTS)
.Add("LPTS", poLPTS)
.Add("GCS", nGCSId, 0);
if( !aBoundingPolygon.empty() )
{
GDALPDFArrayRW* poBounds = new GDALPDFArrayRW();
for( const auto& xy: aBoundingPolygon )
{
poBounds->Add((xy.x - bboxX1) / (bboxX2 - bboxX1)).
Add((xy.y - bboxY1) / (bboxY2 - bboxY1));
}
oMeasureDict.Add("Bounds", poBounds);
}
VSIFPrintfL(m_fp, "%s\n", oMeasureDict.Serialize().c_str());
EndObj();
StartObj(nGCSId);
GDALPDFDictionaryRW oGCSDict;
oGCSDict.Add("Type", GDALPDFObjectRW::CreateName(bIsGeographic ? "GEOGCS" : "PROJCS"))
.Add("WKT", pszESRIWKT);
if (nEPSGCode)
oGCSDict.Add("EPSG", nEPSGCode);
VSIFPrintfL(m_fp, "%s\n", oGCSDict.Serialize().c_str());
EndObj();
CPLFree(pszESRIWKT);
return nViewportId;
}
/************************************************************************/
/* GenerateOGC_BP_Georeferencing() */
/************************************************************************/
GDALPDFObjectNum GDALPDFComposerWriter::GenerateOGC_BP_Georeferencing(
OGRSpatialReferenceH hSRS,
double bboxX1, double bboxY1, double bboxX2, double bboxY2,
const std::vector<GDAL_GCP>& aGCPs,
const std::vector<xyPair>& aBoundingPolygon)
{
const OGRSpatialReference* poSRS = OGRSpatialReference::FromHandle(hSRS);
GDALPDFDictionaryRW* poProjectionDict = GDALPDFBuildOGC_BP_Projection(poSRS);
if (poProjectionDict == nullptr)
{
OSRDestroySpatialReference(hSRS);
return GDALPDFObjectNum();
}
GDALPDFArrayRW* poNeatLineArray = new GDALPDFArrayRW();
if( !aBoundingPolygon.empty() )
{
for( const auto& xy: aBoundingPolygon )
{
poNeatLineArray->Add(xy.x).Add(xy.y);
}
}
else
{
poNeatLineArray->Add(bboxX1).Add(bboxY1).
Add(bboxX2).Add(bboxY2);
}
GDALPDFArrayRW* poRegistration = new GDALPDFArrayRW();
for( const auto& gcp: aGCPs )
{
GDALPDFArrayRW* poGCP = new GDALPDFArrayRW();
poGCP->Add(gcp.dfGCPPixel, TRUE).Add(gcp.dfGCPLine, TRUE).
Add(gcp.dfGCPX, TRUE).Add(gcp.dfGCPY, TRUE);
poRegistration->Add(poGCP);
}
auto nLGIDictId = AllocNewObject();
StartObj(nLGIDictId);
GDALPDFDictionaryRW oLGIDict;
oLGIDict.Add("Type", GDALPDFObjectRW::CreateName("LGIDict"))
.Add("Version", "2.1")
.Add("Neatline", poNeatLineArray);
oLGIDict.Add("Registration", poRegistration);
/* GDAL extension */
if( CPLTestBool( CPLGetConfigOption("GDAL_PDF_OGC_BP_WRITE_WKT", "TRUE") ) )
{
char* pszWKT = nullptr;
OSRExportToWkt(hSRS, &pszWKT);
if( pszWKT )
poProjectionDict->Add("WKT", pszWKT);
CPLFree(pszWKT);
}
oLGIDict.Add("Projection", poProjectionDict);
VSIFPrintfL(m_fp, "%s\n", oLGIDict.Serialize().c_str());
EndObj();
return nLGIDictId;
}
/************************************************************************/
/* GeneratePage() */
/************************************************************************/
bool GDALPDFComposerWriter::GeneratePage(const CPLXMLNode* psPage)
{
double dfWidthInUserUnit = CPLAtof(CPLGetXMLValue(psPage, "Width", "-1"));
double dfHeightInUserUnit = CPLAtof(CPLGetXMLValue(psPage, "Height", "-1"));
if( dfWidthInUserUnit <= 0 || dfWidthInUserUnit >= MAXIMUM_SIZE_IN_UNITS ||
dfHeightInUserUnit <= 0 || dfHeightInUserUnit >= MAXIMUM_SIZE_IN_UNITS )
{
CPLError(CE_Failure, CPLE_AppDefined,
"Missing or invalid Width and/or Height");
return false;
}
double dfUserUnit = CPLAtof(CPLGetXMLValue(psPage, "DPI",
CPLSPrintf("%f", DEFAULT_DPI))) * USER_UNIT_IN_INCH;
std::vector<GDALPDFObjectNum> anViewportIds;
std::vector<GDALPDFObjectNum> anLGIDictIds;
PageContext oPageContext;
for(const auto* psIter = psPage->psChild; psIter; psIter = psIter->psNext)
{
if( psIter->eType == CXT_Element &&
strcmp(psIter->pszValue, "Georeferencing") == 0 )
{
GDALPDFObjectNum nViewportId;
GDALPDFObjectNum nLGIDictId;
Georeferencing georeferencing;
if( !GenerateGeoreferencing(psIter,
dfWidthInUserUnit, dfHeightInUserUnit,
nViewportId, nLGIDictId,
georeferencing) )
{
return false;
}
if( nViewportId.toBool() )
anViewportIds.emplace_back(nViewportId);
if( nLGIDictId.toBool() )
anLGIDictIds.emplace_back(nLGIDictId);
if( !georeferencing.m_osID.empty() )
{
oPageContext.m_oMapGeoreferencedId[georeferencing.m_osID] =
georeferencing;
}
}
}
auto nPageId = AllocNewObject();
m_asPageId.push_back(nPageId);
const char* pszId = CPLGetXMLValue(psPage, "id", nullptr);
if( pszId )
{
if( m_oMapPageIdToObjectNum.find(pszId) != m_oMapPageIdToObjectNum.end() )
{
CPLError(CE_Failure, CPLE_AppDefined,
"Duplicated page id %s", pszId);
return false;
}
m_oMapPageIdToObjectNum[pszId] = nPageId;
}
const auto psContent = CPLGetXMLNode(psPage, "Content");
if( !psContent )
{
CPLError(CE_Failure, CPLE_AppDefined, "Missing Content");
return false;
}
const bool bDeflateStreamCompression = EQUAL(
CPLGetXMLValue(psContent, "streamCompression", "DEFLATE"), "DEFLATE");
oPageContext.m_dfWidthInUserUnit = dfWidthInUserUnit;
oPageContext.m_dfHeightInUserUnit = dfHeightInUserUnit;
oPageContext.m_eStreamCompressMethod =
bDeflateStreamCompression ? COMPRESS_DEFLATE : COMPRESS_NONE;
if( !ExploreContent(psContent, oPageContext) )
return false;
int nStructParentsIdx = -1;
if( !oPageContext.m_anFeatureUserProperties.empty() )
{
nStructParentsIdx = static_cast<int>(m_anParentElements.size());
auto nParentsElements = AllocNewObject();
m_anParentElements.push_back(nParentsElements);
{
StartObj(nParentsElements);
VSIFPrintfL(m_fp, "[ ");
for( const auto& num: oPageContext.m_anFeatureUserProperties )
VSIFPrintfL(m_fp, "%d 0 R ", num.toInt());
VSIFPrintfL(m_fp, " ]\n");
EndObj();
}
}
GDALPDFObjectNum nAnnotsId;
if( !oPageContext.m_anAnnotationsId.empty() )
{
/* -------------------------------------------------------------- */
/* Write annotation arrays. */
/* -------------------------------------------------------------- */
nAnnotsId = AllocNewObject();
StartObj(nAnnotsId);
{
GDALPDFArrayRW oArray;
for(size_t i = 0; i < oPageContext.m_anAnnotationsId.size(); i++)
{
oArray.Add(oPageContext.m_anAnnotationsId[i], 0);
}
VSIFPrintfL(m_fp, "%s\n", oArray.Serialize().c_str());
}
EndObj();
}
auto nContentId = AllocNewObject();
auto nResourcesId = AllocNewObject();
StartObj(nPageId);
GDALPDFDictionaryRW oDictPage;
oDictPage.Add("Type", GDALPDFObjectRW::CreateName("Page"))
.Add("Parent", m_nPageResourceId, 0)
.Add("MediaBox", &((new GDALPDFArrayRW())
->Add(0).Add(0).
Add(dfWidthInUserUnit).
Add(dfHeightInUserUnit)))
.Add("UserUnit", dfUserUnit)
.Add("Contents", nContentId, 0)
.Add("Resources", nResourcesId, 0);
if( nAnnotsId.toBool() )
oDictPage.Add("Annots", nAnnotsId, 0);
oDictPage.Add("Group",
&((new GDALPDFDictionaryRW())
->Add("Type", GDALPDFObjectRW::CreateName("Group"))
.Add("S", GDALPDFObjectRW::CreateName("Transparency"))
.Add("CS", GDALPDFObjectRW::CreateName("DeviceRGB"))));
if (!anViewportIds.empty())
{
auto poViewports = new GDALPDFArrayRW();
for( const auto& id: anViewportIds )
poViewports->Add(id, 0);
oDictPage.Add("VP", poViewports);
}
if (anLGIDictIds.size() == 1 )
{
oDictPage.Add("LGIDict", anLGIDictIds[0], 0);
}
else if (!anLGIDictIds.empty())
{
auto poLGIDict = new GDALPDFArrayRW();
for( const auto& id: anLGIDictIds )
poLGIDict->Add(id, 0);
oDictPage.Add("LGIDict", poLGIDict);
}
if( nStructParentsIdx >= 0 )
{
oDictPage.Add("StructParents", nStructParentsIdx);
}
VSIFPrintfL(m_fp, "%s\n", oDictPage.Serialize().c_str());
EndObj();
/* -------------------------------------------------------------- */
/* Write content dictionary */
/* -------------------------------------------------------------- */
{
GDALPDFDictionaryRW oDict;
StartObjWithStream(nContentId, oDict, bDeflateStreamCompression);
VSIFPrintfL(m_fp, "%s", oPageContext.m_osDrawingStream.c_str());
EndObjWithStream();
}
/* -------------------------------------------------------------- */
/* Write page resource dictionary. */
/* -------------------------------------------------------------- */
StartObj(nResourcesId);
{
GDALPDFDictionaryRW oDict;
if( !oPageContext.m_oXObjects.empty() )
{
GDALPDFDictionaryRW* poDict = new GDALPDFDictionaryRW();
for( const auto&kv: oPageContext.m_oXObjects )
{
poDict->Add(kv.first, kv.second, 0);
}
oDict.Add("XObject", poDict);
}
if( !oPageContext.m_oProperties.empty() )
{
GDALPDFDictionaryRW* poDict = new GDALPDFDictionaryRW();
for( const auto&kv: oPageContext.m_oProperties )
{
poDict->Add(kv.first, kv.second, 0);
}
oDict.Add("Properties", poDict);
}
if( !oPageContext.m_oExtGState.empty() )
{
GDALPDFDictionaryRW* poDict = new GDALPDFDictionaryRW();
for( const auto&kv: oPageContext.m_oExtGState )
{
poDict->Add(kv.first, kv.second, 0);
}
oDict.Add("ExtGState", poDict);
}
VSIFPrintfL(m_fp, "%s\n", oDict.Serialize().c_str());
}
EndObj();
return true;
}
/************************************************************************/
/* ExploreContent() */
/************************************************************************/
bool GDALPDFComposerWriter::ExploreContent(const CPLXMLNode* psNode,
PageContext& oPageContext)
{
for(const auto* psIter = psNode->psChild; psIter; psIter = psIter->psNext)
{
if( psIter->eType == CXT_Element &&
strcmp(psIter->pszValue, "IfLayerOn") == 0 )
{
const char* pszLayerId = CPLGetXMLValue(psIter, "layerId", nullptr);
if( !pszLayerId )
{
CPLError(CE_Failure, CPLE_AppDefined,
"Missing layerId");
return false;
}
auto oIter = m_oMapLayerIdToOCG.find(pszLayerId);
if( oIter == m_oMapLayerIdToOCG.end() )
{
CPLError(CE_Failure, CPLE_AppDefined,
"Referencing layer of unknown id: %s", pszLayerId);
return false;
}
oPageContext.m_oProperties[
CPLOPrintf("Lyr%d", oIter->second.toInt())] = oIter->second;
oPageContext.m_osDrawingStream +=
CPLOPrintf("/OC /Lyr%d BDC\n", oIter->second.toInt());
if( !ExploreContent(psIter, oPageContext) )
return false;
oPageContext.m_osDrawingStream += "EMC\n";
}
else if( psIter->eType == CXT_Element &&
strcmp(psIter->pszValue, "Raster") == 0 )
{
if( !WriteRaster(psIter, oPageContext) )
return false;
}
else if( psIter->eType == CXT_Element &&
strcmp(psIter->pszValue, "Vector") == 0 )
{
if( !WriteVector(psIter, oPageContext) )
return false;
}
else if( psIter->eType == CXT_Element &&
strcmp(psIter->pszValue, "VectorLabel") == 0 )
{
if( !WriteVectorLabel(psIter, oPageContext) )
return false;
}
else if( psIter->eType == CXT_Element &&
strcmp(psIter->pszValue, "PDF") == 0 )
{
#ifdef HAVE_PDF_READ_SUPPORT
if( !WritePDF(psIter, oPageContext) )
return false;
#else
CPLError(CE_Failure, CPLE_NotSupported,
"PDF node not supported due to PDF read support in this GDAL build");
return false;
#endif
}
}
return true;
}
/************************************************************************/
/* StartBlending() */
/************************************************************************/
void GDALPDFComposerWriter::StartBlending(const CPLXMLNode* psNode,
PageContext& oPageContext,
double& dfOpacity)
{
dfOpacity = 1;
const auto psBlending = CPLGetXMLNode(psNode, "Blending");
if( psBlending )
{
auto nExtGState = AllocNewObject();
StartObj(nExtGState);
{
GDALPDFDictionaryRW gs;
gs.Add("Type", GDALPDFObjectRW::CreateName("ExtGState"));
dfOpacity = CPLAtof(CPLGetXMLValue(
psBlending, "opacity", "1"));
gs.Add("ca", dfOpacity);
gs.Add("BM", GDALPDFObjectRW::CreateName(
CPLGetXMLValue(psBlending, "function", "Normal")));
VSIFPrintfL(m_fp, "%s\n", gs.Serialize().c_str());
}
EndObj();
oPageContext.m_oExtGState[
CPLOPrintf("GS%d", nExtGState.toInt())] = nExtGState;
oPageContext.m_osDrawingStream += "q\n";
oPageContext.m_osDrawingStream +=
CPLOPrintf("/GS%d gs\n", nExtGState.toInt());
}
}
/************************************************************************/
/* EndBlending() */
/************************************************************************/
void GDALPDFComposerWriter::EndBlending(const CPLXMLNode* psNode,
PageContext& oPageContext)
{
const auto psBlending = CPLGetXMLNode(psNode, "Blending");
if( psBlending )
{
oPageContext.m_osDrawingStream += "Q\n";
}
}
/************************************************************************/
/* WriteRaster() */
/************************************************************************/
bool GDALPDFComposerWriter::WriteRaster(const CPLXMLNode* psNode,
PageContext& oPageContext)
{
const char* pszDataset = CPLGetXMLValue(psNode, "dataset", nullptr);
if( !pszDataset )
{
CPLError(CE_Failure, CPLE_AppDefined,
"Missing dataset");
return false;
}
double dfX1 = CPLAtof(CPLGetXMLValue(psNode, "x1", "0"));
double dfY1 = CPLAtof(CPLGetXMLValue(psNode, "y1", "0"));
double dfX2 = CPLAtof(CPLGetXMLValue(psNode, "x2",
CPLSPrintf("%.18g", oPageContext.m_dfWidthInUserUnit)));
double dfY2 = CPLAtof(CPLGetXMLValue(psNode, "y2",
CPLSPrintf("%.18g", oPageContext.m_dfHeightInUserUnit)));
if( dfX2 <= dfX1 || dfY2 <= dfY1 )
{
CPLError(CE_Failure, CPLE_AppDefined, "Invalid x1,y1,x2,y2");
return false;
}
GDALDatasetUniquePtr poDS(GDALDataset::Open(
pszDataset, GDAL_OF_RASTER | GDAL_OF_VERBOSE_ERROR,
nullptr, nullptr, nullptr));
if( !poDS )
return false;
const int nWidth = poDS->GetRasterXSize();
const int nHeight = poDS->GetRasterYSize();
const int nBlockXSize = std::max(16,
atoi(CPLGetXMLValue(psNode, "tileSize", "256")));
const int nBlockYSize = nBlockXSize;
const char* pszCompressMethod = CPLGetXMLValue(
psNode, "Compression.method", "DEFLATE");
PDFCompressMethod eCompressMethod = COMPRESS_DEFLATE;
if( EQUAL(pszCompressMethod, "JPEG") )
eCompressMethod = COMPRESS_JPEG;
else if( EQUAL(pszCompressMethod, "JPEG2000") )
eCompressMethod = COMPRESS_JPEG2000;
const int nPredictor = CPLTestBool(CPLGetXMLValue(
psNode, "Compression.predictor", "false")) ? 2 : 0;
const int nJPEGQuality = atoi(
CPLGetXMLValue(psNode, "Compression.quality", "-1"));
const char* pszJPEG2000_DRIVER = m_osJPEG2000Driver.empty() ?
nullptr : m_osJPEG2000Driver.c_str();;
const char* pszGeoreferencingId =
CPLGetXMLValue(psNode, "georeferencingId", nullptr);
double dfClippingMinX = 0;
double dfClippingMinY = 0;
double dfClippingMaxX = 0;
double dfClippingMaxY = 0;
bool bClip = false;
double adfRasterGT[6] = {0,1,0,0,0,1};
double adfInvGeoreferencingGT[6]; // from georeferenced to PDF coordinates
if( pszGeoreferencingId )
{
auto iter = oPageContext.m_oMapGeoreferencedId.find(pszGeoreferencingId);
if( iter == oPageContext.m_oMapGeoreferencedId.end() )
{
CPLError(CE_Failure, CPLE_AppDefined,
"Cannot find georeferencing of id %s",
pszGeoreferencingId);
return false;
}
auto& georeferencing = iter->second;
dfX1 = georeferencing.m_bboxX1;
dfY1 = georeferencing.m_bboxY1;
dfX2 = georeferencing.m_bboxX2;
dfY2 = georeferencing.m_bboxY2;
bClip = true;
dfClippingMinX = APPLY_GT_X(georeferencing.m_adfGT, dfX1, dfY1);
dfClippingMinY = APPLY_GT_Y(georeferencing.m_adfGT, dfX1, dfY1);
dfClippingMaxX = APPLY_GT_X(georeferencing.m_adfGT, dfX2, dfY2);
dfClippingMaxY = APPLY_GT_Y(georeferencing.m_adfGT, dfX2, dfY2);
if( poDS->GetGeoTransform(adfRasterGT) != CE_None ||
adfRasterGT[2] != 0 || adfRasterGT[4] != 0 ||
adfRasterGT[5] > 0 )
{
CPLError(CE_Failure, CPLE_AppDefined,
"Raster has no geotransform or a rotated geotransform");
return false;
}
auto poSRS = poDS->GetSpatialRef();
if( !poSRS || !poSRS->IsSame(&georeferencing.m_oSRS) )
{
CPLError(CE_Failure, CPLE_AppDefined,
"Raster has no projection, or different from the one "
"of the georeferencing area");
return false;
}
CPL_IGNORE_RET_VAL(
GDALInvGeoTransform(georeferencing.m_adfGT,
adfInvGeoreferencingGT));
}
const double dfRasterMinX = adfRasterGT[0];
const double dfRasterMaxY = adfRasterGT[3];
/* Does the source image has a color table ? */
const auto nColorTableId = WriteColorTable(poDS.get());
double dfIgnoredOpacity;
StartBlending(psNode, oPageContext, dfIgnoredOpacity);
CPLString osGroupStream;
std::vector<GDALPDFObjectNum> anImageIds;
const int nXBlocks = (nWidth + nBlockXSize - 1) / nBlockXSize;
const int nYBlocks = (nHeight + nBlockYSize - 1) / nBlockYSize;
int nBlockXOff, nBlockYOff;
for(nBlockYOff = 0; nBlockYOff < nYBlocks; nBlockYOff ++)
{
for(nBlockXOff = 0; nBlockXOff < nXBlocks; nBlockXOff ++)
{
int nReqWidth =
std::min(nBlockXSize, nWidth - nBlockXOff * nBlockXSize);
int nReqHeight =
std::min(nBlockYSize, nHeight - nBlockYOff * nBlockYSize);
int nX = nBlockXOff * nBlockXSize;
int nY = nBlockYOff * nBlockYSize;
double dfXPDFOff = nX * (dfX2 - dfX1) / nWidth + dfX1;
double dfYPDFOff = (nHeight - nY - nReqHeight) * (dfY2 - dfY1) / nHeight + dfY1;
double dfXPDFSize = nReqWidth * (dfX2 - dfX1) / nWidth;
double dfYPDFSize = nReqHeight * (dfY2 - dfY1) / nHeight;
if( bClip )
{
/* Compute extent of block to write */
double dfBlockMinX = adfRasterGT[0] + nX * adfRasterGT[1];
double dfBlockMaxX = adfRasterGT[0] + (nX + nReqWidth) * adfRasterGT[1];
double dfBlockMinY = adfRasterGT[3] + (nY + nReqHeight) * adfRasterGT[5];
double dfBlockMaxY = adfRasterGT[3] + nY * adfRasterGT[5];
// Clip the extent of the block with the extent of the main raster.
const double dfIntersectMinX =
std::max(dfBlockMinX, dfClippingMinX);
const double dfIntersectMinY =
std::max(dfBlockMinY, dfClippingMinY);
const double dfIntersectMaxX =
std::min(dfBlockMaxX, dfClippingMaxX);
const double dfIntersectMaxY =
std::min(dfBlockMaxY, dfClippingMaxY);
bool bOK = false;
if( dfIntersectMinX < dfIntersectMaxX &&
dfIntersectMinY < dfIntersectMaxY )
{
/* Re-compute (x,y,width,height) subwindow of current raster from */
/* the extent of the clipped block */
nX = (int)((dfIntersectMinX - dfRasterMinX) / adfRasterGT[1] + 0.5);
nY = (int)((dfRasterMaxY - dfIntersectMaxY) / (-adfRasterGT[5]) + 0.5);
nReqWidth = (int)((dfIntersectMaxX - dfRasterMinX) / adfRasterGT[1] + 0.5) - nX;
nReqHeight = (int)((dfRasterMaxY - dfIntersectMinY) / (-adfRasterGT[5]) + 0.5) - nY;
if( nReqWidth > 0 && nReqHeight > 0)
{
dfBlockMinX = adfRasterGT[0] + nX * adfRasterGT[1];
dfBlockMaxX = adfRasterGT[0] + (nX + nReqWidth) * adfRasterGT[1];
dfBlockMinY = adfRasterGT[3] + (nY + nReqHeight) * adfRasterGT[5];
dfBlockMaxY = adfRasterGT[3] + nY * adfRasterGT[5];
double dfPDFX1 = APPLY_GT_X(adfInvGeoreferencingGT, dfBlockMinX, dfBlockMinY);
double dfPDFY1 = APPLY_GT_Y(adfInvGeoreferencingGT, dfBlockMinX, dfBlockMinY);
double dfPDFX2 = APPLY_GT_X(adfInvGeoreferencingGT, dfBlockMaxX, dfBlockMaxY);
double dfPDFY2 = APPLY_GT_Y(adfInvGeoreferencingGT, dfBlockMaxX, dfBlockMaxY);
dfXPDFOff = dfPDFX1;
dfYPDFOff = dfPDFY1;
dfXPDFSize = dfPDFX2 - dfPDFX1;
dfYPDFSize = dfPDFY2 - dfPDFY1;
bOK = true;
}
}
if( !bOK )
{
continue;
}
}
const auto nImageId = WriteBlock(poDS.get(),
nX,
nY,
nReqWidth, nReqHeight,
nColorTableId,
eCompressMethod,
nPredictor,
nJPEGQuality,
pszJPEG2000_DRIVER,
nullptr,
nullptr);
if (!nImageId.toBool())
return false;
anImageIds.push_back(nImageId);
osGroupStream += "q\n";
GDALPDFObjectRW* poXSize = GDALPDFObjectRW::CreateReal(dfXPDFSize);
GDALPDFObjectRW* poYSize = GDALPDFObjectRW::CreateReal(dfYPDFSize);
GDALPDFObjectRW* poXOff = GDALPDFObjectRW::CreateReal(dfXPDFOff);
GDALPDFObjectRW* poYOff = GDALPDFObjectRW::CreateReal(dfYPDFOff);
osGroupStream += CPLOPrintf("%s 0 0 %s %s %s cm\n",
poXSize->Serialize().c_str(),
poYSize->Serialize().c_str(),
poXOff->Serialize().c_str(),
poYOff->Serialize().c_str());
delete poXSize;
delete poYSize;
delete poXOff;
delete poYOff;
osGroupStream += CPLOPrintf("/Image%d Do\n", nImageId.toInt());
osGroupStream += "Q\n";
}
}
if( anImageIds.size() <= 1 ||
CPLGetXMLNode(psNode, "Blending") == nullptr )
{
for( const auto& nImageId: anImageIds )
{
oPageContext.m_oXObjects[
CPLOPrintf("Image%d", nImageId.toInt())] = nImageId;
}
oPageContext.m_osDrawingStream += osGroupStream;
}
else
{
// In case several tiles are drawn with blending, use a transparency
// group to avoid edge effects.
auto nGroupId = AllocNewObject();
GDALPDFDictionaryRW oDictGroup;
GDALPDFDictionaryRW* poGroup = new GDALPDFDictionaryRW();
poGroup->Add("Type", GDALPDFObjectRW::CreateName("Group"))
.Add("S",GDALPDFObjectRW::CreateName("Transparency"));
GDALPDFDictionaryRW* poXObjects = new GDALPDFDictionaryRW();
for( const auto& nImageId: anImageIds )
{
poXObjects->Add(CPLOPrintf("Image%d", nImageId.toInt()), nImageId, 0);
}
GDALPDFDictionaryRW* poResources = new GDALPDFDictionaryRW();
poResources->Add("XObject", poXObjects);
oDictGroup.Add("Type", GDALPDFObjectRW::CreateName("XObject"))
.Add("BBox", &((new GDALPDFArrayRW())
->Add(0).Add(0)).
Add(oPageContext.m_dfWidthInUserUnit).
Add(oPageContext.m_dfHeightInUserUnit))
.Add("Subtype", GDALPDFObjectRW::CreateName("Form"))
.Add("Group", poGroup)
.Add("Resources", poResources);
StartObjWithStream(nGroupId, oDictGroup,
oPageContext.m_eStreamCompressMethod != COMPRESS_NONE);
VSIFPrintfL(m_fp, "%s", osGroupStream.c_str());
EndObjWithStream();
oPageContext.m_oXObjects[
CPLOPrintf("Group%d", nGroupId.toInt())] = nGroupId;
oPageContext.m_osDrawingStream +=
CPLOPrintf("/Group%d Do\n", nGroupId.toInt());
}
EndBlending(psNode, oPageContext);
return true;
}
/************************************************************************/
/* SetupVectorGeoreferencing() */
/************************************************************************/
bool GDALPDFComposerWriter::SetupVectorGeoreferencing(
const char* pszGeoreferencingId,
OGRLayer* poLayer,
const PageContext& oPageContext,
double& dfClippingMinX,
double& dfClippingMinY,
double& dfClippingMaxX,
double& dfClippingMaxY,
double adfMatrix[4],
std::unique_ptr<OGRCoordinateTransformation>& poCT)
{
CPLAssert( pszGeoreferencingId );
auto iter = oPageContext.m_oMapGeoreferencedId.find(pszGeoreferencingId);
if( iter == oPageContext.m_oMapGeoreferencedId.end() )
{
CPLError(CE_Failure, CPLE_AppDefined,
"Cannot find georeferencing of id %s",
pszGeoreferencingId);
return false;
}
auto& georeferencing = iter->second;
const double dfX1 = georeferencing.m_bboxX1;
const double dfY1 = georeferencing.m_bboxY1;
const double dfX2 = georeferencing.m_bboxX2;
const double dfY2 = georeferencing.m_bboxY2;
dfClippingMinX = APPLY_GT_X(georeferencing.m_adfGT, dfX1, dfY1);
dfClippingMinY = APPLY_GT_Y(georeferencing.m_adfGT, dfX1, dfY1);
dfClippingMaxX = APPLY_GT_X(georeferencing.m_adfGT, dfX2, dfY2);
dfClippingMaxY = APPLY_GT_Y(georeferencing.m_adfGT, dfX2, dfY2);
auto poSRS = poLayer->GetSpatialRef();
if( !poSRS )
{
CPLError(CE_Failure, CPLE_AppDefined, "Layer has no SRS");
return false;
}
if( !poSRS->IsSame(&georeferencing.m_oSRS) )
{
poCT.reset(
OGRCreateCoordinateTransformation(poSRS, &georeferencing.m_oSRS));
}
if( !poCT )
{
poLayer->SetSpatialFilterRect(dfClippingMinX, dfClippingMinY,
dfClippingMaxX, dfClippingMaxY);
}
double adfInvGeoreferencingGT[6]; // from georeferenced to PDF coordinates
CPL_IGNORE_RET_VAL(
GDALInvGeoTransform(const_cast<double*>(georeferencing.m_adfGT),
adfInvGeoreferencingGT));
adfMatrix[0] = adfInvGeoreferencingGT[0];
adfMatrix[1] = adfInvGeoreferencingGT[1];
adfMatrix[2] = adfInvGeoreferencingGT[3];
adfMatrix[3] = adfInvGeoreferencingGT[5];
return true;
}
/************************************************************************/
/* WriteVector() */
/************************************************************************/
bool GDALPDFComposerWriter::WriteVector(const CPLXMLNode* psNode,
PageContext& oPageContext)
{
const char* pszDataset = CPLGetXMLValue(psNode, "dataset", nullptr);
if( !pszDataset )
{
CPLError(CE_Failure, CPLE_AppDefined,
"Missing dataset");
return false;
}
const char* pszLayer = CPLGetXMLValue(psNode, "layer", nullptr);
if( !pszLayer )
{
CPLError(CE_Failure, CPLE_AppDefined,
"Missing layer");
return false;
}
GDALDatasetUniquePtr poDS(GDALDataset::Open(
pszDataset, GDAL_OF_VECTOR | GDAL_OF_VERBOSE_ERROR,
nullptr, nullptr, nullptr));
if( !poDS )
return false;
OGRLayer* poLayer = poDS->GetLayerByName(pszLayer);
if( !poLayer )
{
CPLError(CE_Failure, CPLE_AppDefined,
"Cannt find layer %s", pszLayer);
return false;
}
const bool bVisible =
CPLTestBool(CPLGetXMLValue(psNode, "visible", "true"));
const auto psLogicalStructure =
CPLGetXMLNode(psNode, "LogicalStructure");
const char* pszOGRDisplayField = nullptr;
std::vector<CPLString> aosIncludedFields;
const bool bLogicalStructure = psLogicalStructure != nullptr;
if( psLogicalStructure )
{
pszOGRDisplayField = CPLGetXMLValue(psLogicalStructure,
"fieldToDisplay", nullptr);
if( CPLGetXMLNode(psLogicalStructure, "ExcludeAllFields") != nullptr ||
CPLGetXMLNode(psLogicalStructure, "IncludeField") != nullptr )
{
for(const auto* psIter = psLogicalStructure->psChild;
psIter; psIter = psIter->psNext)
{
if( psIter->eType == CXT_Element &&
strcmp(psIter->pszValue, "IncludeField") == 0 )
{
aosIncludedFields.push_back(CPLGetXMLValue(psIter, nullptr, ""));
}
}
}
else
{
std::set<CPLString> oSetExcludedFields;
for(const auto* psIter = psLogicalStructure->psChild;
psIter; psIter = psIter->psNext)
{
if( psIter->eType == CXT_Element &&
strcmp(psIter->pszValue, "ExcludeField") == 0 )
{
oSetExcludedFields.insert(CPLGetXMLValue(psIter, nullptr, ""));
}
}
const auto poLayerDefn = poLayer->GetLayerDefn();
for( int i = 0; i < poLayerDefn->GetFieldCount(); i++ )
{
const auto poFieldDefn = poLayerDefn->GetFieldDefn(i);
const char* pszName = poFieldDefn->GetNameRef();
if( oSetExcludedFields.find(pszName) == oSetExcludedFields.end() )
{
aosIncludedFields.push_back(pszName);
}
}
}
}
const char* pszStyleString = CPLGetXMLValue(psNode,
"ogrStyleString", nullptr);
const char* pszOGRLinkField = CPLGetXMLValue(psNode,
"linkAttribute", nullptr);
const char* pszGeoreferencingId =
CPLGetXMLValue(psNode, "georeferencingId", nullptr);
std::unique_ptr<OGRCoordinateTransformation> poCT;
double dfClippingMinX = 0;
double dfClippingMinY = 0;
double dfClippingMaxX = 0;
double dfClippingMaxY = 0;
double adfMatrix[4] = { 0, 1, 0, 1 };
if( pszGeoreferencingId &&
!SetupVectorGeoreferencing(pszGeoreferencingId,
poLayer, oPageContext,
dfClippingMinX, dfClippingMaxX,
dfClippingMinY, dfClippingMaxY,
adfMatrix, poCT) )
{
return false;
}
double dfOpacityFactor = 1.0;
if( !bVisible )
{
if( oPageContext.m_oExtGState.find("GSinvisible") ==
oPageContext.m_oExtGState.end() )
{
auto nExtGState = AllocNewObject();
StartObj(nExtGState);
{
GDALPDFDictionaryRW gs;
gs.Add("Type", GDALPDFObjectRW::CreateName("ExtGState"));
gs.Add("ca", 0);
gs.Add("CA", 0);
VSIFPrintfL(m_fp, "%s\n", gs.Serialize().c_str());
}
EndObj();
oPageContext.m_oExtGState["GSinvisible"] = nExtGState;
}
oPageContext.m_osDrawingStream += "q\n";
oPageContext.m_osDrawingStream += "/GSinvisible gs\n";
oPageContext.m_osDrawingStream += "0 w\n";
dfOpacityFactor = 0;
}
else
{
StartBlending(psNode, oPageContext, dfOpacityFactor);
}
if (!m_nStructTreeRootId.toBool())
m_nStructTreeRootId = AllocNewObject();
GDALPDFObjectNum nFeatureLayerId;
if( bLogicalStructure )
{
nFeatureLayerId = AllocNewObject();
m_anFeatureLayerId.push_back(nFeatureLayerId);
}
std::vector<GDALPDFObjectNum> anFeatureUserProperties;
for( auto&& poFeature: poLayer )
{
auto hFeat = OGRFeature::ToHandle(poFeature.get());
auto hGeom = OGR_F_GetGeometryRef(hFeat);
if( !hGeom || OGR_G_IsEmpty(hGeom) )
continue;
if( poCT )
{
if( OGRGeometry::FromHandle(hGeom)->transform(poCT.get()) != OGRERR_NONE )
continue;
OGREnvelope sEnvelope;
OGR_G_GetEnvelope(hGeom, &sEnvelope);
if( sEnvelope.MinX > dfClippingMaxX ||
sEnvelope.MaxX < dfClippingMinX ||
sEnvelope.MinY > dfClippingMaxY ||
sEnvelope.MaxY < dfClippingMinY )
{
continue;
}
}
if( bLogicalStructure )
{
CPLString osOutFeatureName;
anFeatureUserProperties.push_back(
WriteAttributes(
hFeat,
aosIncludedFields,
pszOGRDisplayField,
oPageContext.m_nMCID,
nFeatureLayerId,
m_asPageId.back(),
osOutFeatureName));
}
ObjectStyle os;
GetObjectStyle(pszStyleString, hFeat, adfMatrix,
m_oMapSymbolFilenameToDesc, os);
os.nPenA = static_cast<int>(std::round(os.nPenA * dfOpacityFactor));
os.nBrushA = static_cast<int>(std::round(os.nBrushA * dfOpacityFactor));
const double dfRadius = os.dfSymbolSize;
if( os.nImageSymbolId.toBool() )
{
oPageContext.m_oXObjects[
CPLOPrintf("SymImage%d", os.nImageSymbolId.toInt())] = os.nImageSymbolId;
}
if( pszOGRLinkField )
{
OGREnvelope sEnvelope;
OGR_G_GetEnvelope(hGeom, &sEnvelope);
int bboxXMin, bboxYMin, bboxXMax, bboxYMax;
ComputeIntBBox(hGeom, sEnvelope, adfMatrix, os, dfRadius,
bboxXMin, bboxYMin, bboxXMax, bboxYMax);
auto nLinkId = WriteLink(hFeat, pszOGRLinkField, adfMatrix,
bboxXMin, bboxYMin, bboxXMax, bboxYMax);
if( nLinkId.toBool() )
oPageContext.m_anAnnotationsId.push_back(nLinkId);
}
if( bLogicalStructure )
{
oPageContext.m_osDrawingStream +=
CPLOPrintf("/feature <</MCID %d>> BDC\n", oPageContext.m_nMCID);
}
if( bVisible || bLogicalStructure )
{
oPageContext.m_osDrawingStream += "q\n";
if (bVisible && (os.nPenA != 255 || os.nBrushA != 255))
{
CPLString osGSName;
osGSName.Printf("GS_CA_%d_ca_%d", os.nPenA, os.nBrushA);
if( oPageContext.m_oExtGState.find(osGSName) ==
oPageContext.m_oExtGState.end() )
{
auto nExtGState = AllocNewObject();
StartObj(nExtGState);
{
GDALPDFDictionaryRW gs;
gs.Add("Type", GDALPDFObjectRW::CreateName("ExtGState"));
if (os.nPenA != 255)
gs.Add("CA", (os.nPenA == 127 || os.nPenA == 128) ? 0.5 : os.nPenA / 255.0);
if (os.nBrushA != 255)
gs.Add("ca", (os.nBrushA == 127 || os.nBrushA == 128) ? 0.5 : os.nBrushA / 255.0 );
VSIFPrintfL(m_fp, "%s\n", gs.Serialize().c_str());
}
EndObj();
oPageContext.m_oExtGState[osGSName] = nExtGState;
}
oPageContext.m_osDrawingStream += "/" + osGSName +" gs\n";
}
oPageContext.m_osDrawingStream +=
GenerateDrawingStream(hGeom, adfMatrix, os, dfRadius);
oPageContext.m_osDrawingStream += "Q\n";
}
if( bLogicalStructure )
{
oPageContext.m_osDrawingStream += "EMC\n";
oPageContext.m_nMCID ++;
}
}
if( bLogicalStructure )
{
for( const auto& num: anFeatureUserProperties )
{
oPageContext.m_anFeatureUserProperties.push_back(num);
}
{
StartObj(nFeatureLayerId);
GDALPDFDictionaryRW oDict;
GDALPDFDictionaryRW* poDictA = new GDALPDFDictionaryRW();
oDict.Add("A", poDictA);
poDictA->Add("O", GDALPDFObjectRW::CreateName("UserProperties"));
GDALPDFArrayRW* poArrayK = new GDALPDFArrayRW();
for( const auto& num: anFeatureUserProperties )
poArrayK->Add(num, 0);
oDict.Add("K", poArrayK);
oDict.Add("P", m_nStructTreeRootId, 0);
oDict.Add("S", GDALPDFObjectRW::CreateName("Layer"));
const char* pszOGRDisplayName =
CPLGetXMLValue(psLogicalStructure, "displayLayerName", poLayer->GetName());
oDict.Add("T", pszOGRDisplayName);
VSIFPrintfL(m_fp, "%s\n", oDict.Serialize().c_str());
EndObj();
}
}
if( !bVisible )
{
oPageContext.m_osDrawingStream += "Q\n";
}
else
{
EndBlending(psNode, oPageContext);
}
return true;
}
/************************************************************************/
/* WriteVectorLabel() */
/************************************************************************/
bool GDALPDFComposerWriter::WriteVectorLabel(const CPLXMLNode* psNode,
PageContext& oPageContext)
{
const char* pszDataset = CPLGetXMLValue(psNode, "dataset", nullptr);
if( !pszDataset )
{
CPLError(CE_Failure, CPLE_AppDefined,
"Missing dataset");
return false;
}
const char* pszLayer = CPLGetXMLValue(psNode, "layer", nullptr);
if( !pszLayer )
{
CPLError(CE_Failure, CPLE_AppDefined,
"Missing layer");
return false;
}
GDALDatasetUniquePtr poDS(GDALDataset::Open(
pszDataset, GDAL_OF_VECTOR | GDAL_OF_VERBOSE_ERROR,
nullptr, nullptr, nullptr));
if( !poDS )
return false;
OGRLayer* poLayer = poDS->GetLayerByName(pszLayer);
if( !poLayer )
{
CPLError(CE_Failure, CPLE_AppDefined,
"Cannt find layer %s", pszLayer);
return false;
}
const char* pszStyleString = CPLGetXMLValue(psNode,
"ogrStyleString", nullptr);
double dfOpacityFactor = 1.0;
StartBlending(psNode, oPageContext, dfOpacityFactor);
const char* pszGeoreferencingId =
CPLGetXMLValue(psNode, "georeferencingId", nullptr);
std::unique_ptr<OGRCoordinateTransformation> poCT;
double dfClippingMinX = 0;
double dfClippingMinY = 0;
double dfClippingMaxX = 0;
double dfClippingMaxY = 0;
double adfMatrix[4] = { 0, 1, 0, 1 };
if( pszGeoreferencingId &&
!SetupVectorGeoreferencing(pszGeoreferencingId,
poLayer, oPageContext,
dfClippingMinX, dfClippingMaxX,
dfClippingMinY, dfClippingMaxY,
adfMatrix, poCT) )
{
return false;
}
for( auto&& poFeature: poLayer )
{
auto hFeat = OGRFeature::ToHandle(poFeature.get());
auto hGeom = OGR_F_GetGeometryRef(hFeat);
if( !hGeom || OGR_G_IsEmpty(hGeom) )
continue;
if( poCT )
{
if( OGRGeometry::FromHandle(hGeom)->transform(poCT.get()) != OGRERR_NONE )
continue;
OGREnvelope sEnvelope;
OGR_G_GetEnvelope(hGeom, &sEnvelope);
if( sEnvelope.MinX > dfClippingMaxX ||
sEnvelope.MaxX < dfClippingMinX ||
sEnvelope.MinY > dfClippingMaxY ||
sEnvelope.MaxY < dfClippingMinY )
{
continue;
}
}
ObjectStyle os;
GetObjectStyle(pszStyleString, hFeat, adfMatrix,
m_oMapSymbolFilenameToDesc, os);
os.nPenA = static_cast<int>(std::round(os.nPenA * dfOpacityFactor));
os.nBrushA = static_cast<int>(std::round(os.nBrushA * dfOpacityFactor));
if (!os.osLabelText.empty() &&
wkbFlatten(OGR_G_GetGeometryType(hGeom)) == wkbPoint)
{
auto nObjectId = WriteLabel(hGeom, adfMatrix, os,
oPageContext.m_eStreamCompressMethod,
0,0,
oPageContext.m_dfWidthInUserUnit,
oPageContext.m_dfHeightInUserUnit);
oPageContext.m_osDrawingStream +=
CPLOPrintf("/Label%d Do\n", nObjectId.toInt());
oPageContext.m_oXObjects[
CPLOPrintf("Label%d", nObjectId.toInt())] = nObjectId;
}
}
EndBlending(psNode, oPageContext);
return true;
}
#ifdef HAVE_PDF_READ_SUPPORT
/************************************************************************/
/* EmitNewObject() */
/************************************************************************/
GDALPDFObjectNum GDALPDFComposerWriter::EmitNewObject(GDALPDFObject* poObj,
RemapType& oRemapObjectRefs)
{
auto nId = AllocNewObject();
const auto nRefNum = poObj->GetRefNum();
if( nRefNum.toBool() )
{
int nRefGen = poObj->GetRefGen();
std::pair<int, int> oKey(nRefNum.toInt(), nRefGen);
oRemapObjectRefs[oKey] = nId;
}
CPLString osStr;
if( !SerializeAndRenumberIgnoreRef(osStr, poObj, oRemapObjectRefs) )
return GDALPDFObjectNum();
StartObj(nId);
VSIFWriteL(osStr.data(), 1, osStr.size(), m_fp);
VSIFPrintfL(m_fp, "\n");
EndObj();
return nId;
}
/************************************************************************/
/* SerializeAndRenumber() */
/************************************************************************/
bool GDALPDFComposerWriter::SerializeAndRenumber(CPLString& osStr,
GDALPDFObject* poObj,
RemapType& oRemapObjectRefs)
{
auto nRefNum = poObj->GetRefNum();
if( nRefNum.toBool() )
{
int nRefGen = poObj->GetRefGen();
std::pair<int, int> oKey(nRefNum.toInt(), nRefGen);
auto oIter = oRemapObjectRefs.find(oKey);
if( oIter != oRemapObjectRefs.end() )
{
osStr.append(CPLSPrintf("%d 0 R", oIter->second.toInt()));
return true;
}
else
{
auto nId = EmitNewObject(poObj, oRemapObjectRefs);
osStr.append(CPLSPrintf("%d 0 R", nId.toInt()));
return nId.toBool();
}
}
else
{
return SerializeAndRenumberIgnoreRef(osStr, poObj, oRemapObjectRefs);
}
}
/************************************************************************/
/* SerializeAndRenumberIgnoreRef() */
/************************************************************************/
bool GDALPDFComposerWriter::SerializeAndRenumberIgnoreRef(CPLString& osStr,
GDALPDFObject* poObj,
RemapType& oRemapObjectRefs)
{
switch(poObj->GetType())
{
case PDFObjectType_Array:
{
auto poArray = poObj->GetArray();
int nLength = poArray->GetLength();
osStr.append("[ ");
for(int i=0;i<nLength;i++)
{
if( !SerializeAndRenumber(osStr, poArray->Get(i), oRemapObjectRefs) )
return false;
osStr.append(" ");
}
osStr.append("]");
break;
}
case PDFObjectType_Dictionary:
{
osStr.append("<< ");
auto poDict = poObj->GetDictionary();
auto& oMap = poDict->GetValues();
for( const auto& oIter: oMap )
{
const char* pszKey = oIter.first.c_str();
GDALPDFObject* poSubObj = oIter.second;
osStr.append("/");
osStr.append(pszKey);
osStr.append(" ");
if( !SerializeAndRenumber(osStr, poSubObj, oRemapObjectRefs) )
return false;
osStr.append(" ");
}
osStr.append(">>");
auto poStream = poObj->GetStream();
if( poStream )
{
// CPLAssert( poObj->GetRefNum().toBool() ); // should be a top level object
osStr.append("\nstream\n");
auto pRawBytes = poStream->GetRawBytes();
if( !pRawBytes )
{
CPLError(CE_Failure, CPLE_AppDefined,
"Cannot get stream content");
return false;
}
osStr.append(pRawBytes, poStream->GetRawLength());
VSIFree(pRawBytes);
osStr.append("\nendstream\n");
}
break;
}
case PDFObjectType_Unknown:
{
CPLError(CE_Failure, CPLE_AppDefined,
"Corrupted PDF");
return false;
}
default:
{
poObj->Serialize(osStr, false);
break;
}
}
return true;
}
/************************************************************************/
/* SerializeAndRenumber() */
/************************************************************************/
GDALPDFObjectNum GDALPDFComposerWriter::SerializeAndRenumber(GDALPDFObject* poObj)
{
RemapType oRemapObjectRefs;
return EmitNewObject(poObj, oRemapObjectRefs);
}
/************************************************************************/
/* WritePDF() */
/************************************************************************/
bool GDALPDFComposerWriter::WritePDF(const CPLXMLNode* psNode,
PageContext& oPageContext)
{
const char* pszDataset = CPLGetXMLValue(psNode, "dataset", nullptr);
if( !pszDataset )
{
CPLError(CE_Failure, CPLE_AppDefined,
"Missing dataset");
return false;
}
GDALOpenInfo oOpenInfo(pszDataset, GA_ReadOnly);
std::unique_ptr<PDFDataset> poDS(PDFDataset::Open(&oOpenInfo));
if( !poDS )
{
CPLError(CE_Failure, CPLE_OpenFailed,
"%s is not a valid PDF file", pszDataset);
return false;
}
if( poDS->GetPageWidth() != oPageContext.m_dfWidthInUserUnit ||
poDS->GetPageHeight() != oPageContext.m_dfHeightInUserUnit )
{
CPLError(CE_Warning, CPLE_AppDefined,
"Dimensions of the inserted PDF page are %fx%f, which is "
"different from the output PDF page %fx%f",
poDS->GetPageWidth(),
poDS->GetPageHeight(),
oPageContext.m_dfWidthInUserUnit,
oPageContext.m_dfHeightInUserUnit);
}
auto poPageObj = poDS->GetPageObj();
if( !poPageObj )
return false;
auto poPageDict = poPageObj->GetDictionary();
if( !poPageDict )
return false;
auto poContents = poPageDict->Get("Contents");
if (poContents != nullptr && poContents->GetType() == PDFObjectType_Array)
{
GDALPDFArray* poContentsArray = poContents->GetArray();
if (poContentsArray->GetLength() == 1)
{
poContents = poContentsArray->Get(0);
}
}
if (poContents == nullptr ||
poContents->GetType() != PDFObjectType_Dictionary )
{
CPLError(CE_Failure, CPLE_AppDefined, "Missing Contents");
return false;
}
auto poResources = poPageDict->Get("Resources");
if( !poResources )
{
CPLError(CE_Failure, CPLE_AppDefined, "Missing Resources");
return false;
}
// Serialize and renumber the Page Resources dictionary
auto nClonedResources = SerializeAndRenumber(poResources);
if( !nClonedResources.toBool() )
{
return false;
}
// Create a Transparency group using cloned Page Resources, and
// the Page Contents stream
auto nFormId = AllocNewObject();
GDALPDFDictionaryRW oDictGroup;
GDALPDFDictionaryRW* poGroup = new GDALPDFDictionaryRW();
poGroup->Add("Type", GDALPDFObjectRW::CreateName("Group"))
.Add("S",GDALPDFObjectRW::CreateName("Transparency"));
oDictGroup.Add("Type", GDALPDFObjectRW::CreateName("XObject"))
.Add("BBox", &((new GDALPDFArrayRW())
->Add(0).Add(0)).
Add(oPageContext.m_dfWidthInUserUnit).
Add(oPageContext.m_dfHeightInUserUnit))
.Add("Subtype", GDALPDFObjectRW::CreateName("Form"))
.Add("Group", poGroup)
.Add("Resources", nClonedResources, 0);
auto poStream = poContents->GetStream();
if( !poStream )
{
CPLError(CE_Failure, CPLE_AppDefined, "Missing Contents stream");
return false;
}
auto pabyContents = poStream->GetBytes();
if( !pabyContents )
{
return false;
}
const auto nContentsLength = poStream->GetLength();
StartObjWithStream(nFormId, oDictGroup,
oPageContext.m_eStreamCompressMethod != COMPRESS_NONE);
VSIFWriteL(pabyContents, 1, nContentsLength, m_fp);
VSIFree(pabyContents);
EndObjWithStream();
// Paint the transparency group
double dfIgnoredOpacity;
StartBlending(psNode, oPageContext, dfIgnoredOpacity);
oPageContext.m_osDrawingStream +=
CPLOPrintf("/Form%d Do\n", nFormId.toInt());
oPageContext.m_oXObjects[
CPLOPrintf("Form%d", nFormId.toInt())] = nFormId;
EndBlending(psNode, oPageContext);
return true;
}
#endif // HAVE_PDF_READ_SUPPORT
/************************************************************************/
/* Generate() */
/************************************************************************/
bool GDALPDFComposerWriter::Generate(const CPLXMLNode* psComposition)
{
m_osJPEG2000Driver = CPLGetXMLValue(psComposition, "JPEG2000Driver", "");
auto psMetadata = CPLGetXMLNode(psComposition, "Metadata");
if( psMetadata )
{
SetInfo(
CPLGetXMLValue(psMetadata, "Author", nullptr),
CPLGetXMLValue(psMetadata, "Producer", nullptr),
CPLGetXMLValue(psMetadata, "Creator", nullptr),
CPLGetXMLValue(psMetadata, "CreationDate", nullptr),
CPLGetXMLValue(psMetadata, "Subject", nullptr),
CPLGetXMLValue(psMetadata, "Title", nullptr),
CPLGetXMLValue(psMetadata, "Keywords", nullptr));
SetXMP(nullptr, CPLGetXMLValue(psMetadata, "XMP", nullptr));
}
const char* pszJavascript = CPLGetXMLValue(psComposition, "Javascript", nullptr);
if( pszJavascript )
WriteJavascript(pszJavascript, false);
auto psLayerTree = CPLGetXMLNode(psComposition, "LayerTree");
if( psLayerTree )
{
m_bDisplayLayersOnlyOnVisiblePages = CPLTestBool(
CPLGetXMLValue(psLayerTree, "displayOnlyOnVisiblePages", "false"));
if( !CreateLayerTree(psLayerTree, GDALPDFObjectNum(), &m_oTreeOfOGC) )
return false;
}
bool bFoundPage = false;
for(const auto* psIter = psComposition->psChild; psIter; psIter = psIter->psNext)
{
if( psIter->eType == CXT_Element &&
strcmp(psIter->pszValue, "Page") == 0 )
{
if( !GeneratePage(psIter) )
return false;
bFoundPage = true;
}
}
if( !bFoundPage )
{
CPLError(CE_Failure, CPLE_AppDefined,
"At least one page should be defined");
return false;
}
auto psOutline = CPLGetXMLNode(psComposition, "Outline");
if( psOutline )
{
if( !CreateOutline(psOutline) )
return false;
}
return true;
}
/************************************************************************/
/* GDALPDFErrorHandler() */
/************************************************************************/
static void CPL_STDCALL GDALPDFErrorHandler(CPL_UNUSED CPLErr eErr,
CPL_UNUSED CPLErrorNum nType,
const char *pszMsg)
{
std::vector<CPLString> *paosErrors =
static_cast<std::vector<CPLString> *>(CPLGetErrorHandlerUserData());
paosErrors->push_back(pszMsg);
}
/************************************************************************/
/* GDALPDFCreateFromCompositionFile() */
/************************************************************************/
GDALDataset* GDALPDFCreateFromCompositionFile(const char* pszPDFFilename,
const char *pszXMLFilename)
{
CPLXMLTreeCloser oXML(
(pszXMLFilename[0] == '<' &&
strstr(pszXMLFilename, "<PDFComposition") != nullptr) ?
CPLParseXMLString(pszXMLFilename) : CPLParseXMLFile(pszXMLFilename));
if( !oXML.get() )
return nullptr;
auto psComposition = CPLGetXMLNode(oXML.get(), "=PDFComposition");
if( !psComposition )
{
CPLError(CE_Failure, CPLE_AppDefined, "Cannot find PDFComposition");
return nullptr;
}
// XML Validation.
if( CPLTestBool(CPLGetConfigOption("GDAL_XML_VALIDATION", "YES")) )
{
const char *pszXSD = CPLFindFile("gdal", "pdfcomposition.xsd");
if( pszXSD != nullptr )
{
std::vector<CPLString> aosErrors;
CPLPushErrorHandlerEx(GDALPDFErrorHandler, &aosErrors);
const int bRet = CPLValidateXML(pszXMLFilename, pszXSD, nullptr);
CPLPopErrorHandler();
if( !bRet )
{
if( !aosErrors.empty() &&
strstr(aosErrors[0].c_str(), "missing libxml2 support") ==
nullptr )
{
for( size_t i = 0; i < aosErrors.size(); i++ )
{
CPLError(CE_Warning, CPLE_AppDefined, "%s",
aosErrors[i].c_str());
}
}
}
CPLErrorReset();
}
}
/* -------------------------------------------------------------------- */
/* Create file. */
/* -------------------------------------------------------------------- */
VSILFILE* fp = VSIFOpenL(pszPDFFilename, "wb");
if( fp == nullptr )
{
CPLError( CE_Failure, CPLE_OpenFailed,
"Unable to create PDF file %s.\n",
pszPDFFilename );
return nullptr;
}
GDALPDFComposerWriter oWriter(fp);
if( !oWriter.Generate(psComposition) )
return nullptr;
return new GDALFakePDFDataset();
}
| [
"pablo.alvarezlopez@dlr.de"
] | pablo.alvarezlopez@dlr.de |
5d497d7dc1985be3cfd701a4f39b3a596672e8aa | 600c23efaf263d8053353157e03067cd940e8877 | /android/My_slam_v3/app/src/main/cpp/cpprint.cpp | db153991417c5ffcddef010bce242a6798e0801b | [] | no_license | tony92151/Moblie_SLAM | c68352a41fa035cbfd5486bf915d32221219ac4e | 40c9efe46e8accd6941777244fa7fe34f8c3f701 | refs/heads/master | 2020-06-14T14:32:01.856859 | 2019-08-31T10:55:10 | 2019-08-31T10:55:10 | 195,026,389 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 423 | cpp | #include <jni.h>
#include <string>
#include "cpprint.h"
#include <vector>
#include "stdio.h"
#include "opencv2/core/core.hpp"
//#include <opencv2/opencv.hpp>
using namespace std;
extern "C" JNIEXPORT jstring JNICALL
Java_com_example_ctest_cpprint_sayhi(
JNIEnv *env,
jobject /* this */) {
//cv::Mat img;
std::string hello = "Hello from me";
return env->NewStringUTF(hello.c_str());
}
| [
"tony92151@gmail.com"
] | tony92151@gmail.com |
fe51833e14d287acc23c64384d750b890665d275 | ce14a65381dee16422737c2b816169b7dc5d1a58 | /Resources/GoogleTestFixtures/GoogleTest-no-fixtures/LibraryCode.hpp | 18469e0abf3a7fa45f27846a7ed6911fd8bf592c | [] | no_license | fjpolo/UdemyCppUnitTestingGoogleTestAndGoogleMock | 417348e997725edc745832fb5e177c784534525c | 6405425dc1ea5977417063e3fdbbd4c1dec728c8 | refs/heads/master | 2023-03-11T05:31:17.990023 | 2021-03-03T08:00:14 | 2021-03-03T08:00:14 | 341,893,889 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 218 | hpp | #pragma once
class Account
{
public:
Account();
void deposit(double sum);
void withdraw(double sum);
double getBalance() const;
void transfer(Account &to, double sum);
private:
double mBalance;
};
| [
"franco.polo@ii-vi.com"
] | franco.polo@ii-vi.com |
cb441d405f550c04c231dc5754b3a8cd07dcae4c | 3c9f984766c81ba95f1f4f828fd9c4e6efef9da1 | /SupplyFinanceChain/src/SupplyFinanceChain/protocol/Serializer.h | 9a052c07becddeec37f87eadc74b07c94e4fdd83 | [] | no_license | SCF-Team/scfchain | 5f73e3c3a41ac5e33d2637980f428a9b8173fda5 | 41f020da81e1c69a61d0c1698df04cf33b20fc63 | refs/heads/master | 2020-06-26T21:51:29.263077 | 2019-08-05T11:11:24 | 2019-08-05T11:11:24 | 199,766,740 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 10,013 | h | //------------------------------------------------------------------------------
/*
This file is part of SupplyFinanceChaind: https://github.com/SupplyFinanceChain/SupplyFinanceChaind
Copyright (c) 2012, 2013 SupplyFinanceChain Labs Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#ifndef SUPPLYFINANCECHAIN_PROTOCOL_SERIALIZER_H_INCLUDED
#define SUPPLYFINANCECHAIN_PROTOCOL_SERIALIZER_H_INCLUDED
#include <SupplyFinanceChain/basics/base_uint.h>
#include <SupplyFinanceChain/basics/Blob.h>
#include <SupplyFinanceChain/basics/contract.h>
#include <SupplyFinanceChain/basics/Buffer.h>
#include <SupplyFinanceChain/basics/safe_cast.h>
#include <SupplyFinanceChain/basics/Slice.h>
#include <SupplyFinanceChain/beast/crypto/secure_erase.h>
#include <SupplyFinanceChain/protocol/SField.h>
#include <cassert>
#include <cstdint>
#include <iomanip>
#include <sstream>
#include <type_traits>
namespace SupplyFinanceChain {
class CKey; // forward declaration
class Serializer
{
private:
// DEPRECATED
Blob mData;
public:
explicit
Serializer (int n = 256)
{
mData.reserve (n);
}
Serializer (void const* data, std::size_t size)
{
mData.resize(size);
if (size)
{
assert(data != nullptr);
std::memcpy(mData.data(), data, size);
}
}
Slice slice() const noexcept
{
return Slice(mData.data(), mData.size());
}
std::size_t
size() const noexcept
{
return mData.size();
}
void const*
data() const noexcept
{
return mData.data();
}
// assemble functions
int add8 (unsigned char byte);
int add16 (std::uint16_t);
int add32 (std::uint32_t); // ledger indexes, account sequence, timestamps
int add64 (std::uint64_t); // native currency amounts
int add128 (const uint128&); // private key generators
int add256 (uint256 const& ); // transaction and ledger hashes
template <typename Integer>
int addInteger(Integer);
template <int Bits, class Tag>
int addBitString(base_uint<Bits, Tag> const& v) {
int ret = mData.size ();
mData.insert (mData.end (), v.begin (), v.end ());
return ret;
}
// TODO(tom): merge with add128 and add256.
template <class Tag>
int add160 (base_uint<160, Tag> const& i)
{
return addBitString<160, Tag>(i);
}
int addRaw (Blob const& vector);
int addRaw (const void* ptr, int len);
int addRaw (const Serializer& s);
int addZeros (size_t uBytes);
int addVL (Blob const& vector);
int addVL (Slice const& slice);
template<class Iter>
int addVL (Iter begin, Iter end, int len);
int addVL (const void* ptr, int len);
// disassemble functions
bool get8 (int&, int offset) const;
bool get256 (uint256&, int offset) const;
template <typename Integer>
bool getInteger(Integer& number, int offset) {
static const auto bytes = sizeof(Integer);
if ((offset + bytes) > mData.size ())
return false;
number = 0;
auto ptr = &mData[offset];
for (auto i = 0; i < bytes; ++i)
{
if (i)
number <<= 8;
number |= *ptr++;
}
return true;
}
template <int Bits, typename Tag = void>
bool getBitString(base_uint<Bits, Tag>& data, int offset) const {
auto success = (offset + (Bits / 8)) <= mData.size ();
if (success)
memcpy (data.begin (), & (mData.front ()) + offset, (Bits / 8));
return success;
}
// TODO(tom): merge with get128 and get256.
template <class Tag>
bool get160 (base_uint<160, Tag>& o, int offset) const
{
return getBitString<160, Tag>(o, offset);
}
bool getRaw (Blob&, int offset, int length) const;
Blob getRaw (int offset, int length) const;
bool getVL (Blob& objectVL, int offset, int& length) const;
bool getVLLength (int& length, int offset) const;
int addFieldID (int type, int name);
int addFieldID (SerializedTypeID type, int name)
{
return addFieldID (safe_cast<int> (type), name);
}
// DEPRECATED
uint256 getSHA512Half() const;
// totality functions
Blob const& peekData () const
{
return mData;
}
Blob getData () const
{
return mData;
}
Blob& modData ()
{
return mData;
}
int getDataLength () const
{
return mData.size ();
}
const void* getDataPtr () const
{
return mData.data();
}
void* getDataPtr ()
{
return mData.data();
}
int getLength () const
{
return mData.size ();
}
std::string getString () const
{
return std::string (static_cast<const char*> (getDataPtr ()), size ());
}
void secureErase ()
{
beast::secure_erase(mData.data(), mData.size());
mData.clear ();
}
void erase ()
{
mData.clear ();
}
bool chop (int num);
// vector-like functions
Blob ::iterator begin ()
{
return mData.begin ();
}
Blob ::iterator end ()
{
return mData.end ();
}
Blob ::const_iterator begin () const
{
return mData.begin ();
}
Blob ::const_iterator end () const
{
return mData.end ();
}
void reserve (size_t n)
{
mData.reserve (n);
}
void resize (size_t n)
{
mData.resize (n);
}
size_t capacity () const
{
return mData.capacity ();
}
bool operator== (Blob const& v)
{
return v == mData;
}
bool operator!= (Blob const& v)
{
return v != mData;
}
bool operator== (const Serializer& v)
{
return v.mData == mData;
}
bool operator!= (const Serializer& v)
{
return v.mData != mData;
}
std::string getHex () const
{
std::stringstream h;
for (unsigned char const& element : mData)
{
h <<
std::setw (2) <<
std::hex <<
std::setfill ('0') <<
safe_cast<unsigned int>(element);
}
return h.str ();
}
static int decodeLengthLength (int b1);
static int decodeVLLength (int b1);
static int decodeVLLength (int b1, int b2);
static int decodeVLLength (int b1, int b2, int b3);
private:
static int lengthVL (int length)
{
return length + encodeLengthLength (length);
}
static int encodeLengthLength (int length); // length to encode length
int addEncoded (int length);
};
template<class Iter>
int Serializer::addVL(Iter begin, Iter end, int len)
{
int ret = addEncoded(len);
for (; begin != end; ++begin)
{
addRaw(begin->data(), begin->size());
#ifndef NDEBUG
len -= begin->size();
#endif
}
assert(len == 0);
return ret;
}
//------------------------------------------------------------------------------
// DEPRECATED
// Transitional adapter to new serialization interfaces
class SerialIter
{
private:
std::uint8_t const* p_;
std::size_t remain_;
std::size_t used_ = 0;
public:
SerialIter (void const* data,
std::size_t size) noexcept;
SerialIter (Slice const& slice)
: SerialIter(slice.data(), slice.size())
{
}
// Infer the size of the data based on the size of the passed array.
template<int N>
explicit SerialIter (std::uint8_t const (&data)[N])
: SerialIter(&data[0], N)
{
static_assert (N > 0, "");
}
std::size_t
empty() const noexcept
{
return remain_ == 0;
}
void
reset() noexcept;
int
getBytesLeft() const noexcept
{
return static_cast<int>(remain_);
}
// get functions throw on error
unsigned char
get8();
std::uint16_t
get16();
std::uint32_t
get32();
std::uint64_t
get64();
template <int Bits, class Tag = void>
base_uint<Bits, Tag>
getBitString();
uint128
get128()
{
return getBitString<128>();
}
uint160
get160()
{
return getBitString<160>();
}
uint256
get256()
{
return getBitString<256>();
}
void
getFieldID (int& type, int& name);
// Returns the size of the VL if the
// next object is a VL. Advances the iterator
// to the beginning of the VL.
int
getVLDataLength ();
Slice
getSlice (std::size_t bytes);
// VFALCO DEPRECATED Returns a copy
Blob
getRaw (int size);
// VFALCO DEPRECATED Returns a copy
Blob
getVL();
void
skip (int num);
Buffer
getVLBuffer();
template<class T>
T getRawHelper (int size);
};
template <int Bits, class Tag>
base_uint<Bits, Tag>
SerialIter::getBitString()
{
base_uint<Bits, Tag> u;
auto const n = Bits/8;
if (remain_ < n)
Throw<std::runtime_error> (
"invalid SerialIter getBitString");
std::memcpy (u.begin(), p_, n);
p_ += n;
used_ += n;
remain_ -= n;
return u;
}
} // SupplyFinanceChain
#endif
| [
"ghubdevelop@protonmail.com"
] | ghubdevelop@protonmail.com |
05dc36e6f2cbfa9cebe2cbd999136c223abe641e | 1884b52d923717d7a406ff5dbf860a431692de81 | /C-Z/恶俗的C语言作业之辗转相除.cpp | d5b03ee0d3182817cedf718893c0bed170ad57b5 | [] | no_license | ShijieQ/C- | da7de3adf71581597b987aee04a28c49fbd9d24e | 4b3f363a5e5d836d8c84f0ccc2e121078a8f6fa7 | refs/heads/master | 2021-06-11T17:38:52.054092 | 2021-03-24T15:23:30 | 2021-03-24T15:23:30 | 159,472,051 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 192 | cpp | #include <stdio.h>
int gcd(int x,int y)
{
if(y==0) return x;
return gcd(y,x%y);
}
int main()
{
int a,b;
scanf("%d %d",&a,&b);
printf("gcd=%d\n",gcd(a,b));
return 0;
}
| [
"582162019@qq.com"
] | 582162019@qq.com |
830900213b3f0761801e348f0056e3cd55a1e41e | 474ca3fbc2b3513d92ed9531a9a99a2248ec7f63 | /ThirdParty/boost_1_63_0/libs/config/test/has_tr1_result_of_fail.cpp | 7e3c63147d7bedeffccbe80e6f7c1f5660c7872e | [
"BSL-1.0"
] | permissive | LazyPlanet/MX-Architecture | 17b7b2e6c730409b22b7f38633e7b1f16359d250 | 732a867a5db3ba0c716752bffaeb675ebdc13a60 | refs/heads/master | 2020-12-30T15:41:18.664826 | 2018-03-02T00:59:12 | 2018-03-02T00:59:12 | 91,156,170 | 4 | 0 | null | 2018-02-04T03:29:46 | 2017-05-13T07:05:52 | C++ | UTF-8 | C++ | false | false | 1,098 | cpp | // This file was automatically generated on Sat Jul 12 12:39:32 2008
// by libs/config/tools/generate.cpp
// Copyright John Maddock 2002-4.
// Use, modification and distribution are subject to 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/libs/config for the most recent version.//
// Revision $Id$
//
// Test file for macro BOOST_HAS_TR1_RESULT_OF
// This file should not compile, if it does then
// BOOST_HAS_TR1_RESULT_OF should be defined.
// See file boost_has_tr1_result_of.ipp for details
// Must not have BOOST_ASSERT_CONFIG set; it defeats
// the objective of this file:
#ifdef BOOST_ASSERT_CONFIG
# undef BOOST_ASSERT_CONFIG
#endif
#include <boost/config.hpp>
#include <boost/tr1/detail/config.hpp>
#include "test.hpp"
#ifndef BOOST_HAS_TR1_RESULT_OF
#include "boost_has_tr1_result_of.ipp"
#else
#error "this file should not compile"
#endif
int main( int, char *[] )
{
return boost_has_tr1_result_of::test();
}
| [
"1211618464@qq.com"
] | 1211618464@qq.com |
bf3305606c9445b82fd7b534c8a8d3cecf0f7ca4 | a44e151d2ff82b07d4c332ad0dab559a454bd724 | /upnpls.h | 9fcf3adec92ce6ba7c0deaa3f94991fe25500bf2 | [] | no_license | nikhilm/upnpls | 19ce9128b05c92746ff6584f9e612e197f063963 | 04c00f30b9b46972dc527c4dadc36df7349015d1 | refs/heads/master | 2021-01-16T18:40:24.779662 | 2010-04-12T15:09:00 | 2010-04-12T15:09:00 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 989 | h | #ifndef UPNPLS_H
#define UPNPLS_H
#include <QMainWindow>
#include <QModelIndex>
#include <QStringList>
#include <QUuid>
#include <QUrl>
#include <HUdn>
class QStandardItemModel;
class QTreeView;
namespace Herqq
{
namespace Upnp
{
class HControlPoint;
class HDevice;
class HService;
}
}
class Upnpls : public QMainWindow
{
Q_OBJECT
public:
Upnpls();
~Upnpls();
private:
enum Roles {
ServiceRole = Qt::UserRole + 1
};
void setupGui();
bool ready();
void waitForDevice();
bool initCDS( Herqq::Upnp::HDevice *dev );
Herqq::Upnp::HControlPoint *m_cp;
Herqq::Upnp::HService *m_cds;
Herqq::Upnp::HUdn m_udn;
QStandardItemModel *m_model;
QTreeView *m_view;
const QStringList m_args;
signals:
void done();
private slots:
void rootDeviceOnline( Herqq::Upnp::HDevice *device );
void rootDeviceOffline( Herqq::Upnp::HDevice *device );
void browse( const QModelIndex & );
};
#endif
| [
"nsm.nikhil@gmail.com"
] | nsm.nikhil@gmail.com |
0a15ddd180ab1e638b5ce1bec1448260693e7340 | 5a157ee5838918ef1fe6624cdbcd9d5408e498e8 | /BOJ/10828.cpp | 28ca40bf5ee89ef45c76da5a360e239288619d35 | [] | no_license | rlagksruf16/Algorithm_Everyday | 93e1071ef667e0a3417104cb1d6f14a5f39967ae | cf9032a04d8be7732a71b874dde124e0cb06421e | refs/heads/master | 2023-06-22T01:55:20.751238 | 2021-07-15T08:01:48 | 2021-07-15T08:01:48 | 217,672,321 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 959 | cpp | // simple stack algorithm
#include <iostream>
#include <algorithm>
#include <stack>
using namespace std;
int main() {
stack<int>s;
int N;
string a;
int num;
cin >> N;
for(int i = 0; i < N; i++) {
cin >> a;
if(a == "push") {
cin >> num;
s.push(num);
}
else if( a == "pop") {
if(s.empty() == 1)
cout << -1 << endl;
else {
cout << s.top() << endl;
s.pop();
}
}
else if( a == "top") {
if(s.empty() == 1)
cout << -1 << endl;
else
cout << s.top() << endl;
}
else if( a == "size") {
cout << s.size() << endl;
}
else if( a == "empty") {
cout << s.empty() << endl;
}
}
return 0;
}
| [
"rlagksruf16@gmail.com"
] | rlagksruf16@gmail.com |
8a1671c30ed46e4813954fd131e83ab9730785b1 | 3d3454b57ed72a03db9c11432ff9e79c4071d849 | /amazon_archives/trees/inorder_and_preorder.cpp | a0827137dfee589bb71c77cb45beb5a142505f9d | [] | no_license | L04DB4L4NC3R/placement-prep | 49d46eebe1e8c6e353f7fd8de4032db062cc9c0d | 756ca128d4699c463541ebbbd5e5b112e961698f | refs/heads/master | 2022-11-19T00:20:08.751449 | 2020-07-18T13:49:02 | 2020-07-18T13:49:02 | 249,736,200 | 5 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 464 | cpp | // https://practice.geeksforgeeks.org/problems/inorder-traversal/1
// https://practice.geeksforgeeks.org/problems/preorder-traversal/1
void inorder(Node* root)
{
// Your code here
if(root == NULL)
return;
inorder(root->left);
cout << root->data << " ";
inorder(root->right);
}
void preorder(Node* root)
{
// Your code here
if(root == NULL)
return;
cout << root->data << " ";
preorder(root->left);
preorder(root->right);
}
| [
"angadsharma1016@gmail.com"
] | angadsharma1016@gmail.com |
30f4c59b1af4bb0bc1d4329b478d1d773f415dac | 1ec01a36f14f92c29e161915d8b6a2b0bec8c777 | /ouzel/audio/coreaudio/CAAudioDevice.cpp | b7600c06b2d2a463612fd63dbb2ce5268fbd5066 | [
"BSD-2-Clause",
"BSD-3-Clause"
] | permissive | WengJunFeng/ouzel | f00fcb18ae569ddf5f047b8242e19aede4582ef1 | 84c3f9779d7913250efe9ac399f272fdc341cee0 | refs/heads/master | 2020-05-07T16:55:45.104573 | 2019-04-10T22:37:44 | 2019-04-10T22:37:44 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 14,755 | cpp | // Copyright 2015-2019 Elviss Strazdins. All rights reserved.
#include "core/Setup.h"
#if OUZEL_COMPILE_COREAUDIO
#include <system_error>
#include "CAAudioDevice.hpp"
#include "core/Engine.hpp"
#include "utils/Log.hpp"
#if TARGET_OS_IOS || TARGET_OS_TV
# include <objc/message.h>
extern "C" id const AVAudioSessionCategoryAmbient;
#elif TARGET_OS_MAC
static OSStatus deviceListChanged(AudioObjectID, UInt32, const AudioObjectPropertyAddress*, void*)
{
// TODO: implement
return 0;
}
static OSStatus deviceUnplugged(AudioObjectID, UInt32, const AudioObjectPropertyAddress*, void*)
{
// TODO: implement
return noErr;
}
#endif
static OSStatus outputCallback(void* inRefCon,
AudioUnitRenderActionFlags*,
const AudioTimeStamp*,
UInt32, UInt32,
AudioBufferList* ioData)
{
ouzel::audio::CAAudioDevice* audioDeviceCA = static_cast<ouzel::audio::CAAudioDevice*>(inRefCon);
try
{
audioDeviceCA->outputCallback(ioData);
}
catch (const std::exception& e)
{
ouzel::engine->log(ouzel::Log::Level::ERR) << e.what();
return -1;
}
return noErr;
}
namespace ouzel
{
namespace audio
{
class CoreAudioErrorCategory final: public std::error_category
{
public:
const char* name() const noexcept override
{
return "CoreAudio";
}
std::string message(int condition) const override
{
switch (condition)
{
case kAudio_UnimplementedError: return "kAudio_UnimplementedError";
case kAudio_FileNotFoundError: return "kAudio_FileNotFoundError";
case kAudio_FilePermissionError: return "kAudio_FilePermissionError";
case kAudio_TooManyFilesOpenError: return "kAudio_TooManyFilesOpenError";
case kAudio_BadFilePathError: return "kAudio_BadFilePathError";
case kAudio_ParamError: return "kAudio_ParamError";
case kAudio_MemFullError: return "kAudio_MemFullError";
default: return "Unknown error (" + std::to_string(condition) + ")";
}
}
};
const CoreAudioErrorCategory coreAudioErrorCategory {};
CAAudioDevice::CAAudioDevice(uint32_t initBufferSize,
uint32_t initSampleRate,
uint16_t initChannels,
const std::function<void(uint32_t frames,
uint16_t channels,
uint32_t sampleRate,
std::vector<float>& samples)>& initDataGetter):
AudioDevice(Driver::COREAUDIO, initBufferSize, initSampleRate, initChannels, initDataGetter)
{
OSStatus result;
#if TARGET_OS_IOS || TARGET_OS_TV
id audioSession = reinterpret_cast<id (*)(Class, SEL)>(&objc_msgSend)(objc_getClass("AVAudioSession"), sel_getUid("sharedInstance"));
reinterpret_cast<BOOL (*)(id, SEL, id, id)>(&objc_msgSend)(audioSession, sel_getUid("setCategory:error:"), AVAudioSessionCategoryAmbient, nil);
#elif TARGET_OS_MAC
static constexpr AudioObjectPropertyAddress deviceListAddress = {
kAudioHardwarePropertyDevices,
kAudioObjectPropertyScopeGlobal,
kAudioObjectPropertyElementMaster
};
if ((result = AudioObjectAddPropertyListener(kAudioObjectSystemObject, &deviceListAddress, deviceListChanged, this)) != noErr)
throw std::system_error(result, coreAudioErrorCategory, "Failed to add CoreAudio property listener");
static constexpr AudioObjectPropertyAddress defaultDeviceAddress = {
kAudioHardwarePropertyDefaultOutputDevice,
kAudioObjectPropertyScopeGlobal,
kAudioObjectPropertyElementMaster
};
UInt32 size = sizeof(AudioDeviceID);
if ((result = AudioObjectGetPropertyData(kAudioObjectSystemObject, &defaultDeviceAddress,
0, nullptr, &size, &deviceId)) != noErr)
throw std::system_error(result, coreAudioErrorCategory, "Failed to get CoreAudio output device");
static constexpr AudioObjectPropertyAddress aliveAddress = {
kAudioDevicePropertyDeviceIsAlive,
kAudioDevicePropertyScopeOutput,
kAudioObjectPropertyElementMaster
};
UInt32 alive = 0;
size = sizeof(alive);
if ((result = AudioObjectGetPropertyData(deviceId, &aliveAddress, 0, nullptr, &size, &alive)) != noErr)
throw std::system_error(result, coreAudioErrorCategory, "Failed to get CoreAudio device status");
if (!alive)
throw std::system_error(result, coreAudioErrorCategory, "Requested CoreAudio device is not alive");
static constexpr AudioObjectPropertyAddress hogModeAddress = {
kAudioDevicePropertyHogMode,
kAudioDevicePropertyScopeOutput,
kAudioObjectPropertyElementMaster
};
pid_t pid = 0;
size = sizeof(pid);
if ((result = AudioObjectGetPropertyData(deviceId, &hogModeAddress, 0, nullptr, &size, &pid)) != noErr)
throw std::system_error(result, coreAudioErrorCategory, "Failed to check if CoreAudio device is in hog mode");
if (pid != -1)
throw std::runtime_error("Requested CoreAudio device is being hogged");
static constexpr AudioObjectPropertyAddress nameAddress = {
kAudioObjectPropertyName,
kAudioDevicePropertyScopeOutput,
kAudioObjectPropertyElementMaster
};
CFStringRef tempStringRef = nullptr;
size = sizeof(CFStringRef);
if ((result = AudioObjectGetPropertyData(deviceId, &nameAddress,
0, nullptr, &size, &tempStringRef)) != noErr)
throw std::system_error(result, coreAudioErrorCategory, "Failed to get CoreAudio device name");
if (tempStringRef)
{
std::string name;
if (const char* deviceName = CFStringGetCStringPtr(tempStringRef, kCFStringEncodingUTF8))
name = deviceName;
else
{
CFIndex stringLength = CFStringGetLength(tempStringRef);
std::vector<char> temp(static_cast<size_t>(CFStringGetMaximumSizeForEncoding(stringLength, kCFStringEncodingUTF8)) + 1);
if (CFStringGetCString(tempStringRef, temp.data(), static_cast<CFIndex>(temp.size()), kCFStringEncodingUTF8))
for (auto i = temp.begin(); i != temp.end() && *i; ++i)
name.push_back(*i);
}
CFRelease(tempStringRef);
engine->log(Log::Level::INFO) << "Using " << name << " for audio";
}
#endif
AudioComponentDescription desc;
desc.componentType = kAudioUnitType_Output;
#if TARGET_OS_IOS || TARGET_OS_TV
desc.componentSubType = kAudioUnitSubType_RemoteIO;
#elif TARGET_OS_MAC
desc.componentSubType = kAudioUnitSubType_DefaultOutput;
#endif
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
desc.componentFlags = 0;
desc.componentFlagsMask = 0;
audioComponent = AudioComponentFindNext(nullptr, &desc);
if (!audioComponent)
throw std::runtime_error("Failed to find requested CoreAudio component");
#if TARGET_OS_MAC && !TARGET_OS_IOS && !TARGET_OS_TV
if ((result = AudioObjectAddPropertyListener(deviceId, &aliveAddress, deviceUnplugged, this)) != noErr)
throw std::system_error(result, coreAudioErrorCategory, "Failed to add CoreAudio property listener");
#endif
if ((result = AudioComponentInstanceNew(audioComponent, &audioUnit)) != noErr)
throw std::system_error(result, coreAudioErrorCategory, "Failed to create CoreAudio component instance");
#if TARGET_OS_MAC && !TARGET_OS_IOS && !TARGET_OS_TV
if ((result = AudioUnitSetProperty(audioUnit,
kAudioOutputUnitProperty_CurrentDevice,
kAudioUnitScope_Global, 0,
&deviceId,
sizeof(AudioDeviceID))) != noErr)
throw std::system_error(result, coreAudioErrorCategory, "Failed to set CoreAudio unit property");
#endif
constexpr AudioUnitElement bus = 0;
AudioStreamBasicDescription streamDescription;
streamDescription.mSampleRate = sampleRate;
streamDescription.mFormatID = kAudioFormatLinearPCM;
streamDescription.mFormatFlags = kLinearPCMFormatFlagIsFloat;
streamDescription.mChannelsPerFrame = channels;
streamDescription.mFramesPerPacket = 1;
streamDescription.mBitsPerChannel = sizeof(float) * 8;
streamDescription.mBytesPerFrame = streamDescription.mBitsPerChannel * streamDescription.mChannelsPerFrame / 8;
streamDescription.mBytesPerPacket = streamDescription.mBytesPerFrame * streamDescription.mFramesPerPacket;
streamDescription.mReserved = 0;
sampleFormat = SampleFormat::FLOAT32;
sampleSize = sizeof(float);
if ((result = AudioUnitSetProperty(audioUnit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Input, bus, &streamDescription, sizeof(streamDescription))) != noErr)
{
engine->log(Log::Level::WARN) << "Failed to set CoreAudio unit stream format to float, error: " << result;
streamDescription.mFormatFlags = kLinearPCMFormatFlagIsPacked | kAudioFormatFlagIsSignedInteger;
streamDescription.mBitsPerChannel = sizeof(int16_t) * 8;
streamDescription.mBytesPerFrame = streamDescription.mBitsPerChannel * streamDescription.mChannelsPerFrame / 8;
streamDescription.mBytesPerPacket = streamDescription.mBytesPerFrame * streamDescription.mFramesPerPacket;
if ((result = AudioUnitSetProperty(audioUnit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Input, bus, &streamDescription, sizeof(streamDescription))) != noErr)
throw std::system_error(result, coreAudioErrorCategory, "Failed to set CoreAudio unit stream format");
sampleFormat = SampleFormat::SINT16;
sampleSize = sizeof(int16_t);
}
AURenderCallbackStruct callback;
callback.inputProc = ::outputCallback;
callback.inputProcRefCon = this;
if ((result = AudioUnitSetProperty(audioUnit,
kAudioUnitProperty_SetRenderCallback,
kAudioUnitScope_Input, bus, &callback, sizeof(callback))) != noErr)
throw std::system_error(result, coreAudioErrorCategory, "Failed to set CoreAudio unit output callback");
UInt32 inIOBufferFrameSize = 512;
if ((result = AudioUnitSetProperty(audioUnit,
kAudioDevicePropertyBufferFrameSize,
kAudioUnitScope_Global,
0,
&inIOBufferFrameSize, sizeof(UInt32))) != noErr)
throw std::system_error(result, coreAudioErrorCategory, "Failed to set CoreAudio buffer size");
if ((result = AudioUnitInitialize(audioUnit)) != noErr)
throw std::system_error(result, coreAudioErrorCategory, "Failed to initialize CoreAudio unit");
}
CAAudioDevice::~CAAudioDevice()
{
if (audioUnit)
{
AudioOutputUnitStop(audioUnit);
AURenderCallbackStruct callback;
callback.inputProc = nullptr;
callback.inputProcRefCon = nullptr;
constexpr AudioUnitElement bus = 0;
AudioUnitSetProperty(audioUnit,
kAudioUnitProperty_SetRenderCallback,
kAudioUnitScope_Input, bus, &callback, sizeof(callback));
AudioComponentInstanceDispose(audioUnit);
}
#if TARGET_OS_MAC && !TARGET_OS_IOS && !TARGET_OS_TV
static constexpr AudioObjectPropertyAddress deviceListAddress = {
kAudioHardwarePropertyDevices,
kAudioObjectPropertyScopeGlobal,
kAudioObjectPropertyElementMaster
};
AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &deviceListAddress, deviceListChanged, this);
if (deviceId)
{
static constexpr AudioObjectPropertyAddress aliveAddress = {
kAudioDevicePropertyDeviceIsAlive,
kAudioDevicePropertyScopeOutput,
kAudioObjectPropertyElementMaster
};
AudioObjectRemovePropertyListener(deviceId, &aliveAddress, deviceUnplugged, this);
}
#endif
}
void CAAudioDevice::start()
{
OSStatus result;
if ((result = AudioOutputUnitStart(audioUnit)) != noErr)
throw std::system_error(result, coreAudioErrorCategory, "Failed to start CoreAudio output unit");
}
void CAAudioDevice::outputCallback(AudioBufferList* ioData)
{
for (UInt32 i = 0; i < ioData->mNumberBuffers; ++i)
{
AudioBuffer& buffer = ioData->mBuffers[i];
getData(buffer.mDataByteSize / (sampleSize * channels), data);
std::copy(data.begin(), data.end(), static_cast<uint8_t*>(buffer.mData));
}
}
} // namespace audio
} // namespace ouzel
#endif
| [
"elviss@elviss.lv"
] | elviss@elviss.lv |
dc6ee434ae7aab4d6aef0d4963634fff3ca363c8 | 9f81d77e028503dcbb6d7d4c0c302391b8fdd50c | /google/cloud/aiplatform/v1/featurestore_online_serving_options.h | 2b325751505a54ede0df26c203443eae2dd5019e | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | googleapis/google-cloud-cpp | b96a6ee50c972371daa8b8067ddd803de95f54ba | 178d6581b499242c52f9150817d91e6c95b773a5 | refs/heads/main | 2023-08-31T09:30:11.624568 | 2023-08-31T03:29:11 | 2023-08-31T03:29:11 | 111,860,063 | 450 | 351 | Apache-2.0 | 2023-09-14T21:52:02 | 2017-11-24T00:19:31 | C++ | UTF-8 | C++ | false | false | 2,739 | h | // Copyright 2023 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
//
// https://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.
// Generated by the Codegen C++ plugin.
// If you make any local changes, they will be lost.
// source: google/cloud/aiplatform/v1/featurestore_online_service.proto
#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AIPLATFORM_V1_FEATURESTORE_ONLINE_SERVING_OPTIONS_H
#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AIPLATFORM_V1_FEATURESTORE_ONLINE_SERVING_OPTIONS_H
#include "google/cloud/aiplatform/v1/featurestore_online_serving_connection.h"
#include "google/cloud/aiplatform/v1/featurestore_online_serving_connection_idempotency_policy.h"
#include "google/cloud/backoff_policy.h"
#include "google/cloud/options.h"
#include "google/cloud/version.h"
#include <memory>
namespace google {
namespace cloud {
namespace aiplatform_v1 {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
/**
* Use with `google::cloud::Options` to configure the retry policy.
*
* @ingroup google-cloud-aiplatform-options
*/
struct FeaturestoreOnlineServingServiceRetryPolicyOption {
using Type = std::shared_ptr<FeaturestoreOnlineServingServiceRetryPolicy>;
};
/**
* Use with `google::cloud::Options` to configure the backoff policy.
*
* @ingroup google-cloud-aiplatform-options
*/
struct FeaturestoreOnlineServingServiceBackoffPolicyOption {
using Type = std::shared_ptr<BackoffPolicy>;
};
/**
* Use with `google::cloud::Options` to configure which operations are retried.
*
* @ingroup google-cloud-aiplatform-options
*/
struct FeaturestoreOnlineServingServiceConnectionIdempotencyPolicyOption {
using Type = std::shared_ptr<
FeaturestoreOnlineServingServiceConnectionIdempotencyPolicy>;
};
/**
* The options applicable to FeaturestoreOnlineServingService.
*
* @ingroup google-cloud-aiplatform-options
*/
using FeaturestoreOnlineServingServicePolicyOptionList = OptionList<
FeaturestoreOnlineServingServiceRetryPolicyOption,
FeaturestoreOnlineServingServiceBackoffPolicyOption,
FeaturestoreOnlineServingServiceConnectionIdempotencyPolicyOption>;
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
} // namespace aiplatform_v1
} // namespace cloud
} // namespace google
#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AIPLATFORM_V1_FEATURESTORE_ONLINE_SERVING_OPTIONS_H
| [
"noreply@github.com"
] | googleapis.noreply@github.com |
2b97be7fe69cc673482b826d6d505c360c7683d0 | 157c9997e9011b301322f3169570a0c612e1fdf4 | /BmpDisplayDemo/BmpDisplayDemoDoc.cpp | ad0f9084af49fb2b7c5ed11a01aeb94abdde0cd0 | [] | no_license | 0nehu1/BmpDisplayDemo | 3a1d2207e700418ae343c8e58f584ebc69656b50 | 84481f9292027db97e3b10e46cf25a0e318855a1 | refs/heads/master | 2023-07-04T15:09:59.726326 | 2021-08-06T06:54:44 | 2021-08-06T06:54:44 | 393,284,395 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,012 | cpp |
// BmpDisplayDemoDoc.cpp: CBmpDisplayDemoDoc 클래스의 구현
//
#include "pch.h"
#include "framework.h"
// SHARED_HANDLERS는 미리 보기, 축소판 그림 및 검색 필터 처리기를 구현하는 ATL 프로젝트에서 정의할 수 있으며
// 해당 프로젝트와 문서 코드를 공유하도록 해 줍니다.
#ifndef SHARED_HANDLERS
#include "BmpDisplayDemo.h"
#endif
#include "BmpDisplayDemoDoc.h"
#include <propkey.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CBmpDisplayDemoDoc
IMPLEMENT_DYNCREATE(CBmpDisplayDemoDoc, CDocument)
BEGIN_MESSAGE_MAP(CBmpDisplayDemoDoc, CDocument)
END_MESSAGE_MAP()
// CBmpDisplayDemoDoc 생성/소멸
CBmpDisplayDemoDoc::CBmpDisplayDemoDoc() noexcept
{
// TODO: 여기에 일회성 생성 코드를 추가합니다.
}
CBmpDisplayDemoDoc::~CBmpDisplayDemoDoc()
{
}
BOOL CBmpDisplayDemoDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: 여기에 재초기화 코드를 추가합니다.
// SDI 문서는 이 문서를 다시 사용합니다.
return TRUE;
}
// CBmpDisplayDemoDoc serialization
void CBmpDisplayDemoDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: 여기에 저장 코드를 추가합니다.
}
else
{
// TODO: 여기에 로딩 코드를 추가합니다.
}
}
#ifdef SHARED_HANDLERS
// 축소판 그림을 지원합니다.
void CBmpDisplayDemoDoc::OnDrawThumbnail(CDC& dc, LPRECT lprcBounds)
{
// 문서의 데이터를 그리려면 이 코드를 수정하십시오.
dc.FillSolidRect(lprcBounds, RGB(255, 255, 255));
CString strText = _T("TODO: implement thumbnail drawing here");
LOGFONT lf;
CFont* pDefaultGUIFont = CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT));
pDefaultGUIFont->GetLogFont(&lf);
lf.lfHeight = 36;
CFont fontDraw;
fontDraw.CreateFontIndirect(&lf);
CFont* pOldFont = dc.SelectObject(&fontDraw);
dc.DrawText(strText, lprcBounds, DT_CENTER | DT_WORDBREAK);
dc.SelectObject(pOldFont);
}
// 검색 처리기를 지원합니다.
void CBmpDisplayDemoDoc::InitializeSearchContent()
{
CString strSearchContent;
// 문서의 데이터에서 검색 콘텐츠를 설정합니다.
// 콘텐츠 부분은 ";"로 구분되어야 합니다.
// 예: strSearchContent = _T("point;rectangle;circle;ole object;");
SetSearchContent(strSearchContent);
}
void CBmpDisplayDemoDoc::SetSearchContent(const CString& value)
{
if (value.IsEmpty())
{
RemoveChunk(PKEY_Search_Contents.fmtid, PKEY_Search_Contents.pid);
}
else
{
CMFCFilterChunkValueImpl *pChunk = nullptr;
ATLTRY(pChunk = new CMFCFilterChunkValueImpl);
if (pChunk != nullptr)
{
pChunk->SetTextValue(PKEY_Search_Contents, value, CHUNK_TEXT);
SetChunkValue(pChunk);
}
}
}
#endif // SHARED_HANDLERS
// CBmpDisplayDemoDoc 진단
#ifdef _DEBUG
void CBmpDisplayDemoDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CBmpDisplayDemoDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
// CBmpDisplayDemoDoc 명령
| [
"onejun0320@gmail.com"
] | onejun0320@gmail.com |
b0e7a2f5641924721f59210083879de89d6974b4 | 2d1fe67daaeb9bd9dbe3f5f313cba81902997276 | /Converter.CPP | 2213bad5c0ea34d9262f90a85c1fb9f87dfb13dc | [] | no_license | monowar123/C | 832541f56a49703cf66c5b2253e81b03722396b3 | 42e5624120e192192433dd284561f016084ff002 | refs/heads/master | 2021-01-09T20:27:30.802730 | 2016-06-23T04:30:08 | 2016-06-23T04:30:08 | 61,773,367 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 34,971 | cpp | #include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<graphics.h>
#include<dos.h>
#include<math.h>
#include<time.h>
void mouse_reset();
void mouse_on();
void mouse_off();
void get_position(int *x,int *y);
int left_button_pressed();
void main_window();
void window();
void temperature();
void length();
void waight();
void area();
void volume();
void num_sys();
void trigon();
void help();
int bin_to_dec(int num);
void date_show();
void main()
{
clrscr();
int gdriver = DETECT, gmode;
initgraph(&gdriver, &gmode, "c:\\tc\\bgi");
main_window();
date_show();
window();
getch();
}
void main_window()
{
setfillstyle(1,5);
bar(0,0,getmaxx(),getmaxy()); //border
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
setfillstyle(1,3);
bar(5,5,getmaxx()-5,50); //bar1
bar(5,302,getmaxx()-5,325); //bar3
bar(5,425,getmaxx()-5,getmaxy()-5); //bar5
setfillstyle(1,8);
bar(getmaxx()-20,5,getmaxx()-5,20); //x:close
bar(getmaxx()-37,5,getmaxx()-22,20); //maximize
bar(getmaxx()-54,5,getmaxx()-39,20); //minimize
bar(450,305,550,323); //clear
setfillstyle(1,15);
bar(getmaxx()-33,10,getmaxx()-27,15);
setcolor(15);
outtextxy(getmaxx()-50,9,"-");
setcolor(4);
outtextxy(getmaxx()-16,9,"x");
settextstyle(0,0,3);
setcolor(15);
outtextxy(190,18,"CONVERTER");
setcolor(9);
outtextxy(188,16,"CONVERTER");
settextstyle(0,0,2);
setcolor(15);
outtextxy(240,307,"OUTPUT");
setcolor(9);
outtextxy(238,305,"OUTPUT");
settextstyle(7,0,2);
setcolor(15);
outtextxy(470,300,"Clear");
settextstyle(7,0,2);
setcolor(15);
outtextxy(35,getmaxy()-53,"Md.Monowarul Islam");
outtextxy(35,getmaxy()-30,"CE-09016");
setcolor(9);
outtextxy(34,getmaxy()-54,"Md.Monowarul Islam");
outtextxy(34,getmaxy()-31,"CE-09016");
}
void window()
{
int end=0,x,y;
setfillstyle(1,1);
bar(5,55,getmaxx()-5,297); //bar2
/////////////* Button *//////////////
setfillstyle(1,8);
bar(30,80,210,110); //tempetature
bar(30,115,210,145); //length
bar(30,150,210,180); //waight
bar(30,185,210,215); //area
bar(30,220,210,250); //volume
bar(300,80,572,110); //number system
bar(300,115,572,145); //trigon ratios
bar(300,150,572,180); //help
settextstyle(7,0,2);
setcolor(15);
outtextxy(50,80,"Temperature");
outtextxy(50,117,"Length");
outtextxy(50,152,"Waight");
outtextxy(50,187,"Area");
outtextxy(50,223,"Volume");
outtextxy(320,82,"Number System");
outtextxy(320,117,"Trigonometrical Ratios");
outtextxy(320,152,"Help");
mouse_reset();
mouse_on();
while(!end)
{
if(left_button_pressed())
{
get_position(&x,&y);
if(x>30&&x<210&&y>80&&y<110)
temperature();
if(x>30&&x<210&&y>115&&y<145)
length();
if(x>30&&x<210&&y>150&&y<180)
waight();
if(x>30&&x<210&&y>185&&y<215)
area();
if(x>30&&x<210&&y>220&&y<250)
volume();
if(x>300&&x<572&&y>80&&y<110)
num_sys();
if(x>300&&x<572&&y>115&&y<145)
trigon();
if(x>300&&x<572&&y>150&&y<180)
help();
if(x>450&&x<550&&y>305&&y<323) //clear
{
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
}
if(x>(getmaxx()-20)&&x<(getmaxx()-5)&&y>5&&y<20)
exit(0);
}
}
}
void temperature()
{
mouse_off();
int x,y;
setfillstyle(1,1);
bar(5,55,getmaxx()-5,297);
setfillstyle(1,8);
bar(30,80,300,110); // C to F
bar(330,80,600,110); // F to K
bar(30,150,300,180); // C to K
bar(330,150,600,180); // F to R
bar(30,220,300,250); // C to R
bar(330,220,600,250); // K to R
bar(getmaxx()-80,267,getmaxx()-10,292); //back
settextstyle(7,0,2);
setcolor(15);
outtextxy(50,80,"Celcious to Fahrenheit");
outtextxy(50,150,"Celcious to Kelvin");
outtextxy(50,220,"Celcious to Rankine");
outtextxy(350,80,"Fahrenheit to kelvin");
outtextxy(350,150,"Fahrenheit to Rankine");
outtextxy(350,220,"Kelvin to Rankine");
outtextxy(getmaxx()-70,267,"Back");
mouse_on();
while(1)
{
if(left_button_pressed())
{
get_position(&x,&y);
if(x>30&&x<300&&y>80&&y<110) //C to F
{ float a;
gotoxy(3,22);
printf("Celcious to Fahrenheit press 1");
gotoxy(3,24);
printf("Fahrenheit to Celcious press 2");
char ch=getche();
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
switch(ch)
{
case '1': gotoxy(3,22);
printf("Input value in Celcious:");
scanf("%f",&a);
float f=1.8*a+32;
gotoxy(3,24);
printf("Value in Fahrenheit:%f",f);
break;
case '2': gotoxy(3,22);
printf("Input value in Fahrenheit:");
scanf("%f",&a);
float c=(a-32)/1.8;
gotoxy(3,24);
printf("Value in Celcious:%f",c);
break;
default : gotoxy(3,22);
printf("Wrong selection.");
}
}
if(x>30&&x<300&&y>150&&y<180) //C to K
{ float a;
gotoxy(3,22);
printf("Celcious to Kelvin press 1");
gotoxy(3,24);
printf("Kelvin to Celcious press 2");
char ch=getche();
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
switch(ch)
{
case '1': gotoxy(3,22);
printf("Input value in Celcious:");
scanf("%f",&a);
float k=a+273;
gotoxy(3,24);
printf("Value in Kelvin:%f",k);
break;
case '2': gotoxy(3,22);
printf("Input value in Kelvin:");
scanf("%f",&a);
float c=a-273;
gotoxy(3,24);
printf("Value in Celcious:%f",c);
break;
default : gotoxy(3,22);
printf("Wrong selection.");
}
}
if(x>30&&x<300&&y>220&&y<250) //C to R
{ float a;
gotoxy(3,22);
printf("Celcious to Rankine press 1");
gotoxy(3,24);
printf("Rankine to Celcious press 2");
char ch=getche();
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
switch(ch)
{
case '1': gotoxy(3,22);
printf("Input value in Celcious:");
scanf("%f",&a);
float r=(a*1.8)+492;
gotoxy(3,24);
printf("Value in Rankine:%f",r);
break;
case '2': gotoxy(3,22);
printf("Input value in Rankine:");
scanf("%f",&a);
float c=(a-492)/1.8;
gotoxy(3,24);
printf("Value in Celcious:%f",c);
break;
default : gotoxy(3,22);
printf("Wrong selection.");
}
}
if(x>330&&x<600&&y>80&&y<110) //F to K
{ float a;
gotoxy(3,22);
printf("Fahrenheit to Kelvin press 1");
gotoxy(3,24);
printf("Kelvin to Fahrenheit press 2");
char ch=getche();
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
switch(ch)
{
case '1': gotoxy(3,22);
printf("Input value in Fahrenheit:");
scanf("%f",&a);
float k=(a-32)/1.8+273;
gotoxy(3,24);
printf("Value in Kelvin:%f",k);
break;
case '2': gotoxy(3,22);
printf("Input value in Kelvin:");
scanf("%f",&a);
float f=(a-273)*1.8+32;
gotoxy(3,24);
printf("Value in Fahrenheit:%f",f);
break;
default : gotoxy(3,22);
printf("Wrong selection.");
}
}
if(x>330&&x<600&&y>150&&y<180) //F to R
{ float a;
gotoxy(3,22);
printf("Fahrenheit to Rankine press 1");
gotoxy(3,24);
printf("Rankine to Fahrenheit press 2");
char ch=getche();
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
switch(ch)
{
case '1': gotoxy(3,22);
printf("Input value in Fahrenheit:");
scanf("%f",&a);
float r=a+460;
gotoxy(3,24);
printf("Value in Rankine:%f",r);
break;
case '2': gotoxy(3,22);
printf("Input value in Rankine:");
scanf("%f",&a);
float f=a-460;
gotoxy(3,24);
printf("Value in Fahrenheit:%f",f);
break;
default : gotoxy(3,22);
printf("Wrong selection.");
}
}
if(x>330&&x<600&&y>220&&y<250) //K to R
{ float a;
gotoxy(3,22);
printf("Kelvin to Rankine press 1");
gotoxy(3,24);
printf("Rankine to Kelvin press 2");
char ch=getche();
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
switch(ch)
{
case '1': gotoxy(3,22);
printf("Input value in Kelvin:");
scanf("%f",&a);
float r=(a-273)*1.8+492;
gotoxy(3,24);
printf("Value in Rankine:%f",r);
break;
case '2': gotoxy(3,22);
printf("Input value in Rankine:");
scanf("%f",&a);
float k=(a-492)/1.8+273;
gotoxy(3,24);
printf("Value in Kelvin:%f",k);
break;
default : gotoxy(3,22);
printf("Wrong selection.");
}
}
if(x>(getmaxx()-80)&&y>267&&x<(getmaxx()-10)&&y<292) //back
window(); //back
if(x>450&&x<550&&y>305&&y<323) //clear
{
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
}
if(x>(getmaxx()-20)&&x<(getmaxx()-5)&&y>5&&y<20)
exit(0);
}
}
}
void length()
{
mouse_off();
int x,y;
setfillstyle(1,1);
bar(5,55,getmaxx()-5,297);
setfillstyle(1,8);
bar(200,65,430,95);
bar(200,105,430,135);
bar(200,145,430,175);
bar(200,185,430,215);
bar(200,225,430,255);
bar(getmaxx()-80,267,getmaxx()-10,292); //back
settextstyle(7,0,2);
setcolor(15);
outtextxy(220,65,"Mile to Kilo-Metre");
outtextxy(220,105,"Yard to Metre");
outtextxy(220,145,"Foot to Metre");
outtextxy(220,185,"Foot to Centi-Metre");
outtextxy(217,225,"Inch to Centi-Metre");
outtextxy(getmaxx()-70,267,"Back");
mouse_on();
while(1)
{
if(left_button_pressed())
{
get_position(&x,&y);
if(x>200&&x<430&&y>65&&y<95) //mile to km
{ float a,b;
gotoxy(3,22);
printf("Mile to KM press 1");
gotoxy(3,24);
printf("KM to Mile press 2");
char ch=getche();
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
switch(ch)
{
case '1': gotoxy(3,22);
printf("Input value in Mile:");
scanf("%f",&a);
b=a*1.609;
gotoxy(3,24);
printf("Value in KM:%f",b);
break;
case '2': gotoxy(3,22);
printf("Input value in KM:");
scanf("%f",&a);
b=a*0.621504;
gotoxy(3,24);
printf("Value in Mile:%f",b);
break;
default : gotoxy(3,22);
printf("Wrong selection.");
}
}
if(x>200&&x<430&&y>105&&y<135) //yard to metre
{ float a,b;
gotoxy(3,22);
printf("Yard to Metre press 1");
gotoxy(3,24);
printf("Metre to Yard press 2");
char ch=getche();
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
switch(ch)
{
case '1': gotoxy(3,22);
printf("Input value in Yard:");
scanf("%f",&a);
b=a*.9144;
gotoxy(3,24);
printf("Value in Metre:%f",b);
break;
case '2': gotoxy(3,22);
printf("Input value in Metre:");
scanf("%f",&a);
b=a*1.0936133;
gotoxy(3,24);
printf("Value in Yard:%f",b);
break;
default : gotoxy(3,22);
printf("Wrong selection.");
}
}
if(x>200&&x<430&&y>145&&y<175) //foot to metre
{ float a,b;
gotoxy(3,22);
printf("Foot to metre press 1");
gotoxy(3,24);
printf("Metre to Foot press 2");
char ch=getche();
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
switch(ch)
{
case '1': gotoxy(3,22);
printf("Input value in Foot:");
scanf("%f",&a);
b=a*.3048;
gotoxy(3,24);
printf("Value in Metre:%f",b);
break;
case '2': gotoxy(3,22);
printf("Input value in Metre:");
scanf("%f",&a);
b=a*3.2808399;
gotoxy(3,24);
printf("Value in Foot:%f",b);
break;
default : gotoxy(3,22);
printf("Wrong selection.");
}
}
if(x>200&&x<430&&y>185&&y<215) //foot to cm
{ float a,b;
gotoxy(3,22);
printf("Foot to CM press 1");
gotoxy(3,24);
printf("CM to Foot press 2");
char ch=getche();
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
switch(ch)
{
case '1': gotoxy(3,22);
printf("Input value in Foot:");
scanf("%f",&a);
b=a*30.48;
gotoxy(3,24);
printf("Value in CM:%f",b);
break;
case '2': gotoxy(3,22);
printf("Input value in CM:");
scanf("%f",&a);
b=a*.0328084;
gotoxy(3,24);
printf("Value in Foot:%f",b);
break;
default : gotoxy(3,22);
printf("Wrong selection.");
}
}
if(x>200&&x<430&&y>225&&y<255) //inch to cm
{ float a,b;
gotoxy(3,22);
printf("Inch to CM press 1");
gotoxy(3,24);
printf("CM to Inch press 2");
char ch=getche();
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
switch(ch)
{
case '1': gotoxy(3,22);
printf("Input value in Inch:");
scanf("%f",&a);
b=a*2.54;
gotoxy(3,24);
printf("Value in CM:%f",b);
break;
case '2': gotoxy(3,22);
printf("Input value in CM:");
scanf("%f",&a);
b=a*.3937008;
gotoxy(3,24);
printf("Value in Inch:%f",b);
break;
default : gotoxy(3,22);
printf("Wrong selection.");
}
}
if(x>(getmaxx()-80)&&y>267&&x<(getmaxx()-10)&&y<292) //back
window(); //back
if(x>450&&x<550&&y>305&&y<323) //clear
{
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
}
if(x>(getmaxx()-20)&&x<(getmaxx()-5)&&y>5&&y<20)
exit(0);
}
}
}
void waight()
{
mouse_off();
int x,y;
setfillstyle(1,1);
bar(5,55,getmaxx()-5,297);
setfillstyle(1,8);
bar(200,65,430,95);
bar(200,105,430,135);
bar(200,145,430,175);
bar(200,185,430,215);
bar(200,225,430,255);
bar(getmaxx()-80,267,getmaxx()-10,292); //back
settextstyle(7,0,2);
setcolor(15);
outtextxy(220,65,"Pound to Kilo");
outtextxy(220,105,"Carat to Gram");
outtextxy(220,145,"Ounce to Gram");
outtextxy(220,185,"Troy oz. to Gram");
outtextxy(217,225,"Stone to Kilo");
outtextxy(getmaxx()-70,267,"Back");
mouse_on();
while(1)
{
if(left_button_pressed())
{
get_position(&x,&y);
if(x>200&&x<430&&y>65&&y<95) //pound to kilo
{ float a,b;
gotoxy(3,22);
printf("Pound to Kilo press 1");
gotoxy(3,24);
printf("Kilo to Pound press 2");
char ch=getche();
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
switch(ch)
{
case '1': gotoxy(3,22);
printf("Input value in Pound:");
scanf("%f",&a);
b=a*.4536;
gotoxy(3,24);
printf("Value in Kilo:%f",b);
break;
case '2': gotoxy(3,22);
printf("Input value in Kilo:");
scanf("%f",&a);
b=a*2.2045955;
gotoxy(3,24);
printf("Value in Pound:%f",b);
break;
default : gotoxy(3,22);
printf("Wrong selection.");
}
}
if(x>200&&x<430&&y>105&&y<135) //carat to gram
{ float a,b;
gotoxy(3,22);
printf("Carat to Gram press 1");
gotoxy(3,24);
printf("Gram to Carat press 2");
char ch=getche();
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
switch(ch)
{
case '1': gotoxy(3,22);
printf("Input value in Carat:");
scanf("%f",&a);
b=a*.2;
gotoxy(3,24);
printf("Value in Gram:%f",b);
break;
case '2': gotoxy(3,22);
printf("Input value in Gram:");
scanf("%f",&a);
b=a*5;
gotoxy(3,24);
printf("Value in Carat:%f",b);
break;
default : gotoxy(3,22);
printf("Wrong selection.");
}
}
if(x>200&&x<430&&y>145&&y<175) //ounce to gram
{ float a,b;
gotoxy(3,22);
printf("Ounce to Gram press 1");
gotoxy(3,24);
printf("Gram to Ounce press 2");
char ch=getche();
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
switch(ch)
{
case '1': gotoxy(3,22);
printf("Input value in Ounce:");
scanf("%f",&a);
b=a*28.35;
gotoxy(3,24);
printf("Value in Gram:%f",b);
break;
case '2': gotoxy(3,22);
printf("Input value in Gram:");
scanf("%f",&a);
b=a*.0352734;
gotoxy(3,24);
printf("Value in Ounce:%f",b);
break;
default : gotoxy(3,22);
printf("Wrong selection.");
}
}
if(x>200&&x<430&&y>185&&y<215) // troy.oz to gram
{ float a,b;
gotoxy(3,22);
printf("Troy.oz to Gram press 1");
gotoxy(3,24);
printf("Gram to Troy.oz press 2");
char ch=getche();
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
switch(ch)
{
case '1': gotoxy(3,22);
printf("Input value in Troy.oz:");
scanf("%f",&a);
b=a*31.103477;
gotoxy(3,24);
printf("Value in Gram:%f",b);
break;
case '2': gotoxy(3,22);
printf("Input value in Gram:");
scanf("%f",&a);
b=a*.0321507;
gotoxy(3,24);
printf("Value in Troy.oz:%f",b);
break;
default : gotoxy(3,22);
printf("Wrong selection.");
}
}
if(x>200&&x<430&&y>225&&y<255) //stone to kilo
{ float a,b;
gotoxy(3,22);
printf("Stone to Kilo press 1");
gotoxy(3,24);
printf("Kilo to Stone press 2");
char ch=getche();
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
switch(ch)
{
case '1': gotoxy(3,22);
printf("Input value in Stone:");
scanf("%f",&a);
b=a*6.3502932;
gotoxy(3,24);
printf("Value in Kilo:%f",b);
break;
case '2': gotoxy(3,22);
printf("Input value in Kilo:");
scanf("%f",&a);
b=a*.157473;
gotoxy(3,24);
printf("Value in Stone:%f",b);
break;
default : gotoxy(3,22);
printf("Wrong selection.");
}
}
if(x>(getmaxx()-80)&&y>267&&x<(getmaxx()-10)&&y<292) //back
window(); //back
if(x>450&&x<550&&y>305&&y<323) //clear
{
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
}
if(x>(getmaxx()-20)&&x<(getmaxx()-5)&&y>5&&y<20)
exit(0);
}
}
}
void area()
{
mouse_off();
int x,y;
setfillstyle(1,1);
bar(5,55,getmaxx()-5,297);
setfillstyle(1,8);
bar(150,65,500,95);
bar(150,105,500,135);
bar(150,145,500,175);
bar(150,185,500,215);
bar(150,225,500,255);
bar(getmaxx()-80,267,getmaxx()-10,292); //back
settextstyle(7,0,2);
setcolor(15);
outtextxy(170,65,"Square Foot to Square Metre");
outtextxy(170,105,"Square Inch to Square CM");
outtextxy(170,145,"Square Yard to Square Metre");
outtextxy(170,185,"Square Milw to Square KM");
outtextxy(170,225,"Acre to Hectare");
outtextxy(getmaxx()-70,267,"Back");
mouse_on();
while(1)
{
if(left_button_pressed())
{
get_position(&x,&y);
if(x>150&&x<500&&y>65&&y<95) //s foot to s metre
{ float a,b;
gotoxy(3,22);
printf("Square Foot to Square Metre press 1");
gotoxy(3,24);
printf("Square Metre to Square Foot press 2");
char ch=getche();
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
switch(ch)
{
case '1': gotoxy(3,22);
printf("Input value in Square Foot:");
scanf("%f",&a);
b=a*.0929;
gotoxy(3,24);
printf("Value in Square Metre:%f",b);
break;
case '2': gotoxy(3,22);
printf("Input value in Square Metre:");
scanf("%f",&a);
b=a*10.764263;
gotoxy(3,24);
printf("Value in Square Foot:%f",b);
break;
default : gotoxy(3,22);
printf("Wrong selection.");
}
}
if(x>150&&x<500&&y>105&&y<135) //s inch to s cm
{ float a,b;
gotoxy(3,22);
printf("Square Inch to Square CM press 1");
gotoxy(3,24);
printf("Square CM to Square Inch press 2");
char ch=getche();
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
switch(ch)
{
case '1': gotoxy(3,22);
printf("Input value in Square Inch:");
scanf("%f",&a);
b=a*6.4516;
gotoxy(3,24);
printf("Value in Square CM:%f",b);
break;
case '2': gotoxy(3,22);
printf("Input value in Square CM:");
scanf("%f",&a);
gotoxy(3,24);
b=a*.1550003;
printf("Value in Square Inch:%f",b);
break;
default : gotoxy(3,22);
printf("Wrong selection.");
}
}
if(x>150&&x<500&&y>145&&y<175) //s yard to s metre
{ float a,b;
gotoxy(3,22);
printf("Square Yard to Square Metre press 1");
gotoxy(3,24);
printf("Square Metre to Square Yard press 2");
char ch=getche();
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
switch(ch)
{
case '1': gotoxy(3,22);
printf("Input value in Square Yard:");
scanf("%f",&a);
b=a*.8361274;
gotoxy(3,24);
printf("Value in Square Metre:%f",b);
break;
case '2': gotoxy(3,22);
printf("Input value in Square Metre:");
scanf("%f",&a);
b=a*1.19599;
gotoxy(3,24);
printf("Value in Square Yard:%f",b);
break;
default : gotoxy(3,22);
printf("Wrong selection.");
}
}
if(x>150&&x<500&&y>185&&y<215) //s mile to s km
{ float a,b;
gotoxy(3,22);
printf("Square Mile to Square KM press 1");
gotoxy(3,24);
printf("Square KM to Square Mile press 2");
char ch=getche();
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
switch(ch)
{
case '1': gotoxy(3,22);
printf("Input value in Square Mile:");
scanf("%f",&a);
b=a*2.59;
gotoxy(3,24);
printf("Value in Square KM:%f",b);
break;
case '2': gotoxy(3,22);
printf("Input value in Square KM:");
scanf("%f",&a);
b=a*.3861004;
gotoxy(3,24);
printf("Value in Square Mile:%f",b);
break;
default : gotoxy(3,22);
printf("Wrong selection.");
}
}
if(x>150&&x<500&&y>225&&y<255) //acre to hectare
{ float a,b;
gotoxy(3,22);
printf("Acre to Hectare press 1");
gotoxy(3,24);
printf("Hectare to Acre press 2");
char ch=getche();
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
switch(ch)
{
case '1': gotoxy(3,22);
printf("Input value in Acre:");
scanf("%f",&a);
b=a*.4047;
gotoxy(3,24);
printf("Value in Hectare:%f",b);
break;
case '2': gotoxy(3,22);
printf("Input value in Hectare:");
scanf("%f",&a);
b=a*2.4709661;
gotoxy(3,24);
printf("Value in Acre:%f",b);
break;
default : gotoxy(3,22);
printf("Wrong selection.");
}
}
if(x>(getmaxx()-80)&&y>267&&x<(getmaxx()-10)&&y<292) //back
window(); //back
if(x>450&&x<550&&y>305&&y<323) //clear
{
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
}
if(x>(getmaxx()-20)&&x<(getmaxx()-5)&&y>5&&y<20)
exit(0);
}
}
}
void volume()
{
mouse_off();
int x,y;
setfillstyle(1,1);
bar(5,55,getmaxx()-5,297);
setfillstyle(1,8);
bar(200,70,430,100);
bar(200,115,430,145);
bar(200,160,430,190);
bar(200,205,430,235);
bar(getmaxx()-80,267,getmaxx()-10,292); //back
settextstyle(7,0,2);
setcolor(15);
outtextxy(220,70,"V Inch to V CM");
outtextxy(220,115,"V Foot to V Metre");
outtextxy(220,160,"V Metre to V Yard");
outtextxy(220,205,"Gallon to Litre");
outtextxy(getmaxx()-70,267,"Back");
mouse_on();
while(1)
{
if(left_button_pressed())
{
get_position(&x,&y);
if(x>200&&x<430&&y>70&&y<100) // v inch to v cm
{ float a,b;
gotoxy(3,22);
printf("Cubic Inch to Cubic CM press 1");
gotoxy(3,24);
printf("Cubic CM to Cubic Inch press 2");
char ch=getche();
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4--output bar
switch(ch)
{
case '1': gotoxy(3,22);
printf("Input value in Cubic Inch:");
scanf("%f",&a);
b=a*16.387064;
gotoxy(3,24);
printf("Value in Cubic CM:%f",b);
break;
case '2': gotoxy(3,22);
printf("Input value in Cubic CM:");
scanf("%f",&a);
b=a*.0610237;
gotoxy(3,24);
printf("Value in Cubic Inch:%f",b);
break;
default : gotoxy(3,22);
printf("Wrong selection.");
}
}
if(x>200&&x<430&&y>115&&y<145) //v foot to v metre
{ float a,b;
gotoxy(3,22);
printf("Cubic Foot to Cubic Metre press 1");
gotoxy(3,24);
printf("Cubic Metre to Cubic Foot press 2");
char ch=getche();
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
switch(ch)
{
case '1': gotoxy(3,22);
printf("Input value in Cubic Foot:");
scanf("%f",&a);
b=a*.0283168;
gotoxy(3,24);
printf("Value in Cubic Metre:%f",b);
break;
case '2': gotoxy(3,22);
printf("Input value in Cubic Metre:");
scanf("%f",&a);
b=a*35.314667;
gotoxy(3,24);
printf("Value in Cubic Foot:%f",b);
break;
default : gotoxy(3,22);
printf("Wrong selection.");
}
}
if(x>200&&x<430&&y>160&&y<190) //v metre to v yard
{ float a,b;
gotoxy(3,22);
printf("Cubic Metre to Cubic Yard press 1");
gotoxy(3,24);
printf("Cubic Yard to Cubic Metre press 2");
char ch=getche();
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
switch(ch)
{
case '1': gotoxy(3,22);
printf("Input value in Cubic Metre:");
scanf("%f",&a);
b=a*1.3079505;
gotoxy(3,24);
printf("Value in Cubic Yard:%f",b);
break;
case '2': gotoxy(3,22);
printf("Input value in Cubic Yard:");
scanf("%f",&a);
b=a*.7645549;
gotoxy(3,24);
printf("Value in Cubic Metre:%f",b);
break;
default : gotoxy(3,22);
printf("Wrong selection.");
}
}
if(x>200&&x<430&&y>205&&y<235) // gallon to litre
{ float a,b;
gotoxy(3,22);
printf("Gallon to Litre press 1");
gotoxy(3,24);
printf("Litre to Gallon press 2");
char ch=getche();
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
switch(ch)
{
case '1': gotoxy(3,22);
printf("Input value in Gallon:");
scanf("%f",&a);
b=a*3.78541;
gotoxy(3,24);
printf("Value in Litre:%f",b);
break;
case '2': gotoxy(3,22);
printf("Input value in Litre:");
scanf("%f",&a);
b=a*.2641722;
gotoxy(3,24);
printf("Value in Gallon:%f",b);
break;
default : gotoxy(3,22);
printf("Wrong selection.");
}
}
if(x>(getmaxx()-80)&&y>267&&x<(getmaxx()-10)&&y<292) //back
window(); //back
if(x>450&&x<550&&y>305&&y<323) //clear
{
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
}
if(x>(getmaxx()-20)&&x<(getmaxx()-5)&&y>5&&y<20)
exit(0);
}
}
}
void num_sys()
{
mouse_off();
int x,y;
setfillstyle(1,1);
bar(5,55,getmaxx()-5,297);
setfillstyle(1,8);
bar(30,80,300,110); //
bar(330,80,600,110); //
bar(30,150,300,180); //
bar(330,150,600,180); //
bar(30,220,300,250); //
bar(330,220,600,250); //
bar(getmaxx()-80,267,getmaxx()-10,292); //back
settextstyle(7,0,2);
setcolor(15);
outtextxy(50,80,"Decimal to Binary");
outtextxy(40,150,"Decimal to Hexadecimal");
outtextxy(50,220,"Decimal to Octal");
outtextxy(340,80,"Binary to Hexadecimal");
outtextxy(350,150,"Binary to Octal");
outtextxy(350,220,"Hexadecimal to Octal");
outtextxy(getmaxx()-70,267,"Back");
mouse_on();
while(1)
{
if(left_button_pressed())
{
get_position(&x,&y);
if(x>30&&x<300&&y>80&&y<110) // decimal to binary
{ int a;
gotoxy(3,22);
printf("Decimal to Binary press 1");
gotoxy(3,24);
printf("Binary to Decimal press 2");
char ch=getche();
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
switch(ch)
{
case '1': gotoxy(3,22);
printf("Input value in Decimal:");
scanf("%d",&a);
int arr[100],i=0;
while(a!=0)
{
arr[i]=a%2;
a/=2; i++;
}
gotoxy(3,24);
printf("Value in Binary:");
for(int j=i-1;j>=0;j--)
printf("%d",arr[j]);
break;
case '2': gotoxy(3,22);
printf("Input value in Binary:");
scanf("%d",&a);
gotoxy(3,24);
printf("Value in Decimal:%d",bin_to_dec(a));
break;
default : gotoxy(3,22);
printf("Wrong selection.");
}
}
if(x>30&&x<300&&y>150&&y<180) //decimal to hexadecimal
{ int a;
gotoxy(3,22);
printf("Decimal to Hexadecimal press 1");
gotoxy(3,24);
printf("Hexadecimal to Decimal press 2");
char ch=getche();
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
switch(ch)
{
case '1': gotoxy(3,22);
printf("Input value in Decimal:");
scanf("%d",&a);
gotoxy(3,24);
printf("Value in Hexadecimal:%X",a);
break;
case '2': gotoxy(3,22);
printf("Input value in Hexadecimal:");
scanf("%X",&a);
gotoxy(3,24);
printf("Value in Decimal:%d",a);
break;
default : gotoxy(3,22);
printf("Wrong selection.");
}
}
if(x>30&&x<300&&y>220&&y<250) // decimal to octal
{ int a;
gotoxy(3,22);
printf("Decimal to Octal press 1");
gotoxy(3,24);
printf("Octal to Decimal press 2");
char ch=getche();
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
switch(ch)
{
case '1': gotoxy(3,22);
printf("Input value in Decimal:");
scanf("%d",&a);
gotoxy(3,24);
printf("Value in Octal:%o",a);
break;
case '2': gotoxy(3,22);
printf("Input value in Octal:");
scanf("%o",&a);
gotoxy(3,24);
printf("Value in Decimal:%d",a);
break;
default : gotoxy(3,22);
printf("Wrong selection.");
}
}
if(x>330&&x<600&&y>80&&y<110) // binary to hexadecimal
{ int a;
gotoxy(3,22);
printf("Binary to Hexadecimal press 1");
gotoxy(3,24);
printf("Hexadecimal to Binary press 2");
char ch=getche();
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
switch(ch)
{
case '1': gotoxy(3,22);
printf("Input value in Binary:");
scanf("%d",&a);
int p=bin_to_dec(a);
gotoxy(3,24);
printf("Value in Hexadecimal:%X",p);
break;
case '2': gotoxy(3,22);
printf("Input value in Hexadecimal:");
scanf("%X",&a);
int arr[100],i=0;
while(a!=0)
{
arr[i]=a%2;
a/=2; i++;
}
gotoxy(3,24);
printf("Value in Binary:");
for(int j=i-1;j>=0;j--)
printf("%d",arr[j]);
break;
default : gotoxy(3,22);
printf("Wrong selection.");
}
}
if(x>330&&x<600&&y>150&&y<180) // binary to octal
{ int a;
gotoxy(3,22);
printf("Binary to Octal press 1");
gotoxy(3,24);
printf("Octal to Binary press 2");
char ch=getche();
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
switch(ch)
{
case '1': gotoxy(3,22);
printf("Input value in Binary:");
scanf("%d",&a);
int p=bin_to_dec(a);
gotoxy(3,24);
printf("Value in Octal:%o",p);
break;
case '2': gotoxy(3,22);
printf("Input value in Octal:");
scanf("%o",&a);
int arr[100],i=0;
while(a!=0)
{
arr[i]=a%2;
a/=2; i++;
}
gotoxy(3,24);
printf("Value in Binary:");
for(int j=i-1;j>=0;j--)
printf("%d",arr[j]);
break;
default : gotoxy(3,22);
printf("Wrong selection.");
}
}
if(x>330&&x<600&&y>220&&y<250) //hexadecimal to octal
{ int a;
gotoxy(3,22);
printf("Hexadecimal to Octal press 1");
gotoxy(3,24);
printf("Octal to Hexadecimal press 2");
char ch=getche();
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
switch(ch)
{
case '1': gotoxy(3,22);
printf("Input value in Hexadecimal:");
scanf("%X",&a);
gotoxy(3,24);
printf("Value in Octal:%o",a);
break;
case '2': gotoxy(3,22);
printf("Input value in Octal:");
scanf("%o",&a);
gotoxy(3,24);
printf("Value in Hexadecimal:%X",a);
break;
default : gotoxy(3,22);
printf("Wrong selection.");
}
}
if(x>(getmaxx()-80)&&y>267&&x<(getmaxx()-10)&&y<292) //back
window(); //back
if(x>450&&x<550&&y>305&&y<323) //clear
{
setfillstyle(1,0);
bar(5,330,getmaxx()-5,420); //bar4
}
if(x>(getmaxx()-20)&&x<(getmaxx()-5)&&y>5&&y<20)
exit(0);
}
}
}
void trigon()
{
}
void help()
{
}
int bin_to_dec(int num)
{
int a[100],i=0,j=0,sum=0;
while(num!=0)
{
a[i]=num%10;
num/=10;i++;
}
for(j=0;j<i;j++)
sum+=a[j]*pow(2,j);
return sum;
}
void date_show()
{
char *wday[]={"Sunday","Monday","Tuesday","Wednasday","Thursday","Friday","Saturday","Unknown"};
struct date d;
getdate(&d);
gotoxy(10,28);
//printf("%d:%d:%d",d.da_day,d.da_mon,d.da_year);
char *str1,*str2,*str3; //date showing
gcvt(d.da_day,5,str1);
gcvt(d.da_mon,5,str2);
gcvt(d.da_year,5,str3);
setcolor(4);
outtextxy(getmaxx()-200,getmaxy()-55,str1);
outtextxy(getmaxx()-170,getmaxy()-55,"-");
outtextxy(getmaxx()-145,getmaxy()-55,str2);
outtextxy(getmaxx()-130,getmaxy()-55,"-");
outtextxy(getmaxx()-115,getmaxy()-55,str3);
struct tm time_check; //name of the day
time_check.tm_year=d.da_year-1900;
time_check.tm_mon=d.da_mon-1;
time_check.tm_mday=d.da_day;
time_check.tm_hour=0;
time_check.tm_min=0;
time_check.tm_sec=1;
time_check.tm_isdst=-1;
if(mktime(&time_check)==-1)
time_check.tm_wday=7;
setcolor(4);
outtextxy(getmaxx()-185,getmaxy()-35,wday[time_check.tm_wday]);
}
void mouse_reset()
{
union REGS r;
r.x.ax=0;
int86(0x33,&r,&r);
if(int(r.x.ax)!=-1)
{
printf("Hardware failure!");
exit(1);
}
}
void mouse_on()
{
union REGS r;
r.x.ax=1;
int86(0x33,&r,&r);
}
void mouse_off()
{
union REGS r;
r.x.ax=2;
int86(0x33,&r,&r);
}
void get_position(int *x,int *y)
{
union REGS r;
r.x.ax=3;
int86(0x33,&r,&r);
*x=r.x.cx;
*y=r.x.dx;
}
int left_button_pressed()
{
union REGS r;
r.x.ax=3;
int86(0x33,&r,&r);
return(r.x.bx & 1);
} | [
"monowar.mbstu@gmail.com"
] | monowar.mbstu@gmail.com |
df01d74b7419e29d04d569a1157594dd369c4c14 | 57484230c26cf67d8ef9bc17513d6389ad1ba103 | /Chapter 9 Texturing/9_TexWaves/GameTimer.h | 4aea8f35c911d2031ca959eb018c1b5201c65bb5 | [] | no_license | akatokikwok/DX12Ebook | ab2edf2e8e3fcb6b9133e58f444f07dc5fc2e519 | aed2a1a79ab7fb5b23e72ec0997e39b61f67a760 | refs/heads/master | 2023-09-02T06:27:19.518305 | 2021-10-27T07:24:48 | 2021-11-12T10:40:50 | 349,897,570 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,360 | h | //***************************************************************************************
// GameTimer.h by Frank Luna (C) 2011 All Rights Reserved.
//***************************************************************************************
#ifndef GAMETIMER_H
#define GAMETIMER_H
class GameTimer
{
public:
/* 计时器类的构造函数会查询 计数器的频率, 对其取倒数之后就拿到转换因子(实际上就是几分之一秒)*/
GameTimer();
/* 计算到现在为止不算暂停的游玩时长*/
float TotalTime()const; // in seconds
/* 拿两帧之间的时间差*/
float DeltaTime()const; // in seconds
/* 重置base时刻以及前一时刻为当前时刻*/
void Reset(); // Call before message loop.
/* 此方法主要是计算累加的暂停时长 同时更新前一时刻为startTime时刻*/
void Start(); // Call when unpaused.
/* 存储被停止的时刻,同时命中停止标志*/
void Stop(); // Call when paused.
/* 计算时刻差(单位:"计数")的函数*/
void Tick(); // Call every frame.
private:
double mSecondsPerCount;// 转换因子(实际上就是几分之一秒)
double mDeltaTime;
__int64 mBaseTime;
__int64 mPausedTime;// 应该理解为停止的时长,而非时刻
__int64 mStopTime;// 被停止的时刻
__int64 mPrevTime;
__int64 mCurrTime;
bool mStopped;
};
#endif // GAMETIMER_H | [
"akatokikwok@outlook.com"
] | akatokikwok@outlook.com |
d10592bbedfd868c9336ba62e9e1d1d384ebe956 | c605c0bdc5c80539b3302ab892d3378ef11d4047 | /백준 using c++/10026.cpp | 91d469f47cf1bc49ef73fea68bde680b33453d35 | [] | no_license | yujin0719/Problem-Solving | 44b4d6e5669c56488ab347e17d22b8346f560a88 | a481d7028f98b107f96483a7b3718b6d401c7822 | refs/heads/master | 2023-06-08T07:47:27.584629 | 2021-07-01T11:26:53 | 2021-07-01T11:26:53 | 252,609,862 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,182 | cpp | //10026: 적록색약
#include <bits/stdc++.h>
using namespace std;
char board[101][101];
int vis[101][101];
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};
char color[3] = {'R','B','G'};
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int N;
cin >> N;
for(int i = 0; i < N; i++)
cin >> board[i];
queue<pair<int,int> > q;
int origin = 0;
int error = 0;
for(int k = 0; k < 3; k++){
for(int i = 0; i < N; i++){
for (int j = 0; j < N; j++){
if(color[k] == board[i][j] && vis[i][j] == 0){
origin +=1;
q.push({i,j});
vis[i][j] = 1;
while(!q.empty()){
pair<int,int> cur = q.front();
q.pop();
for(int m = 0; m < 4; m ++){
if(cur.first+dx[m] >= 0 && cur.second+dy[m] >= 0 && cur.first+dx[m] < N && cur.second+dy[m] < N){
if(vis[cur.first+dx[m]][cur.second+dy[m]] == 0 && board[cur.first+dx[m]][cur.second+dy[m]] == color[k]){
q.push({cur.first+dx[m],cur.second+dy[m]});
vis[cur.first+dx[m]][cur.second+dy[m]] = 1;
}
}
}
}
}
}
}
}
for(int i = 0; i < N; i++){
fill(vis[i],vis[i]+N,0);
for(int j = 0; j < N; j++){
if(board[i][j] == 'G')
board[i][j] = 'R';
}
}
for(int k = 0; k < 2; k++){
for(int i = 0; i < N; i++){
for (int j = 0; j < N; j++){
if(color[k] == board[i][j] && vis[i][j] == 0){
error +=1;
q.push({i,j});
vis[i][j] = 1;
while(!q.empty()){
pair<int,int> cur = q.front();
q.pop();
for(int m = 0; m < 4; m ++){
if(cur.first+dx[m] >= 0 && cur.second+dy[m] >= 0 && cur.first+dx[m] < N && cur.second+dy[m] < N){
if(vis[cur.first+dx[m]][cur.second+dy[m]] == 0 && board[cur.first+dx[m]][cur.second+dy[m]] == color[k]){
q.push({cur.first+dx[m],cur.second+dy[m]});
vis[cur.first+dx[m]][cur.second+dy[m]] = 1;
}
}
}
}
}
}
}
}
cout << origin << ' ' << error << '\n';
}
| [
"yujin1760@naver.com"
] | yujin1760@naver.com |
9eb2cf457e4ccd7e37132deec5ebb5987fb99f63 | 927c7fa3c34d2ea8cb9d3647cc8759d2cd7229fe | /source/h/substance/bullet/enemy_shot/Enemy_shot.h | 543c8bb41548c36c55a4de48461d3c98e0b62a2c | [] | no_license | yu-chan/shooting | effec1dc1bca29ec32163c70820a77aee597ee99 | b31ca14036bdc5b130fb43da597fe84ca649e6e5 | refs/heads/master | 2021-01-21T04:55:21.389270 | 2016-06-29T21:35:14 | 2016-06-29T21:35:14 | 55,126,299 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 125 | h | #pragma once
class Enemy_shot :
public Shot
{
public:
Enemy_shot();
~Enemy_shot();
void shot_regist();
void move();
};
| [
"y.ooki0125@outlook.com"
] | y.ooki0125@outlook.com |
ab538a16b30e585751ac192d70cea2db95dfd79a | 4e6bc7cc8316a5543751e5f89dde3c20343cdfcf | /CUDADataFormats/Vertex/interface/ZVertexSoA.h | cd1f8aea4e340636c82010a708eb34eefa4778bc | [
"Apache-2.0"
] | permissive | PNWCMS/cmssw | 53624854d74c49caf1c77c74ba8e28397d67eedf | a13af767b0806291ccda8947c3ed19fcd5b91850 | refs/heads/master | 2020-10-02T03:07:01.372161 | 2019-12-02T20:58:47 | 2019-12-02T20:58:47 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,178 | h | #ifndef CUDADataFormatsVertexZVertexSoA_H
#define CUDADataFormatsVertexZVertexSoA_H
#include <cstdint>
#include "HeterogeneousCore/CUDAUtilities/interface/cudaCompat.h"
// SOA for vertices
// These vertices are clusterized and fitted only along the beam line (z)
// to obtain their global coordinate the beam spot position shall be added (eventually correcting for the beam angle as well)
struct ZVertexSoA {
static constexpr uint32_t MAXTRACKS = 32 * 1024;
static constexpr uint32_t MAXVTX = 1024;
int16_t idv[MAXTRACKS]; // vertex index for each associated (original) track (-1 == not associate)
float zv[MAXVTX]; // output z-posistion of found vertices
float wv[MAXVTX]; // output weight (1/error^2) on the above
float chi2[MAXVTX]; // vertices chi2
float ptv2[MAXVTX]; // vertices pt^2
int32_t ndof[MAXVTX]; // vertices number of dof (reused as workspace for the number of nearest neighbours)
uint16_t sortInd[MAXVTX]; // sorted index (by pt2) ascending
uint32_t nvFinal; // the number of vertices
__host__ __device__ void init() { nvFinal = 0; }
};
#endif // CUDADataFormatsVertexZVertexSoA.H
| [
"andrea.bocci@cern.ch"
] | andrea.bocci@cern.ch |
7e82a8e820151319aba6bf1e4bae3a0195d66c55 | 54399f5d4ac16ca0e241cf504368c92f6885b005 | /tags/trunk_before_2.0_switch/libfreebob/src/bebob/bebob_dl_codes.cpp | b93181c12308b0fdb017cdfee3f8e2b620ee852b | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | janosvitok/ffado | 82dcafeeed08a53a7ab48949a0b1e89fba59a799 | 99b2515d787332e8def72f3d4f0411157915134c | refs/heads/master | 2020-04-09T11:14:29.768311 | 2018-06-26T13:38:39 | 2018-06-26T13:38:39 | 6,838,393 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,314 | cpp | /* bebob_dl_codes.cpp
* Copyright (C) 2006 by Daniel Wagner
*
* This file is part of FreeBoB.
*
* FreeBoB 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.
* FreeBoB 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 FreeBoB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA.
*/
#include "bebob/bebob_dl_codes.h"
#include "bebob/bebob_dl_bcd.h"
unsigned short BeBoB::CommandCodes::m_gCommandId = 0;
BeBoB::CommandCodes::CommandCodes( fb_quadlet_t protocolVersion,
fb_byte_t commandCode,
size_t msgSize,
fb_byte_t operandSizeRequest,
fb_byte_t operandSizeRespone )
: m_commandId( m_gCommandId++ )
, m_protocolVersion( protocolVersion )
, m_commandCode( commandCode )
, m_msgSize( msgSize )
, m_operandSizeRequest( operandSizeRequest )
, m_operandSizeResponse( operandSizeRespone )
, m_resp_protocolVersion( 0 )
, m_resp_commandId( 0 )
, m_resp_commandCode( 0 )
, m_resp_operandSize( 0 )
{
}
BeBoB::CommandCodes::~CommandCodes()
{
}
bool
BeBoB::CommandCodes::serialize( IOSSerialize& se )
{
byte_t tmp;
bool result = se.write( m_protocolVersion, "CommandCodes: protocol version" );
tmp = m_commandId & 0xff;
result &= se.write( tmp, "CommandCodes: command id low" );
tmp = m_commandId >> 8;
result &= se.write( tmp, "CommandCodes: command id high" );
result &= se.write( m_commandCode, "CommandCodes: command code" );
result &= se.write( m_operandSizeRequest, "CommandCodes: request operand size" );
return result;
}
bool
BeBoB::CommandCodes::deserialize( IISDeserialize& de )
{
bool result = de.read( &m_resp_protocolVersion );
fb_byte_t tmp;
result &= de.read( &tmp );
m_resp_commandId = tmp;
result &= de.read( &tmp );
m_resp_commandId |= tmp << 8;
result &= de.read( &m_resp_commandCode );
result &= de.read( &m_resp_operandSize );
return result;
}
size_t
BeBoB::CommandCodes::getMaxSize()
{
return 2 * sizeof( fb_quadlet_t ) + m_msgSize;
}
////////////////////////////////
BeBoB::CommandCodesReset::CommandCodesReset( fb_quadlet_t protocolVersion,
EStartMode startMode )
: CommandCodes( protocolVersion, eCmdC_Reset, sizeof( m_startMode ), 1, 0 )
, m_startMode( startMode )
{
}
BeBoB::CommandCodesReset::~CommandCodesReset()
{
}
bool
BeBoB::CommandCodesReset::serialize( IOSSerialize& se )
{
bool result = CommandCodes::serialize( se );
result &= se.write( m_startMode, "CommandCodesReset: boot mode" );
return result;
}
bool
BeBoB::CommandCodesReset::deserialize( IISDeserialize& de )
{
return CommandCodes::deserialize( de );
}
////////////////////////////////
BeBoB::CommandCodesProgramGUID::CommandCodesProgramGUID(
fb_quadlet_t protocolVersion,
fb_octlet_t guid )
: CommandCodes( protocolVersion, eCmdC_ProgramGUID, sizeof( m_guid ), 2, 0 )
, m_guid( guid )
{
}
BeBoB::CommandCodesProgramGUID::~CommandCodesProgramGUID()
{
}
bool
BeBoB::CommandCodesProgramGUID::serialize( IOSSerialize& se )
{
bool result = CommandCodes::serialize( se );
fb_quadlet_t tmp = m_guid >> 32;
result &= se.write( tmp, "CommandCodesProgramGUID: GUID (high)" );
tmp = m_guid & 0xffffffff;
result &= se.write( tmp, "CommandCodesProgramGUID: GUID (low)" );
return result;
}
bool
BeBoB::CommandCodesProgramGUID::deserialize( IISDeserialize& de )
{
return CommandCodes::deserialize( de );
}
////////////////////////////////
BeBoB::CommandCodesDownloadStart::CommandCodesDownloadStart(
fb_quadlet_t protocolVersion,
EObject object )
: CommandCodes( protocolVersion, eCmdC_DownloadStart, 10*4, 10, 1 )
, m_object( object )
, m_date( 0 )
, m_time( 0 )
, m_id( 0 )
, m_version( 0 )
, m_address( 0 )
, m_length( 0 )
, m_crc( 0 )
{
}
BeBoB::CommandCodesDownloadStart::~CommandCodesDownloadStart()
{
}
bool
BeBoB::CommandCodesDownloadStart::serialize( IOSSerialize& se )
{
bool result = CommandCodes::serialize( se );
result &= se.write( m_object, "CommandCodesDownloadStart: object" );
for ( unsigned int i = 0; i < sizeof( m_date ); ++i ) {
fb_byte_t* tmp = ( fb_byte_t* )( &m_date );
result &= se.write( tmp[i], "CommandCodesDownloadStart: date" );
}
for ( unsigned int i = 0; i < sizeof( m_date ); ++i ) {
fb_byte_t* tmp = ( fb_byte_t* )( &m_time );
result &= se.write( tmp[i], "CommandCodesDownloadStart: time" );
}
result &= se.write( m_id, "CommandCodesDownloadStart: id" );
result &= se.write( m_version, "CommandCodesDownloadStart: version" );
result &= se.write( m_address, "CommandCodesDownloadStart: address" );
result &= se.write( m_length, "CommandCodesDownloadStart: length" );
result &= se.write( m_crc, "CommandCodesDownloadStart: crc" );
return result;
}
bool
BeBoB::CommandCodesDownloadStart::deserialize( IISDeserialize& de )
{
bool result = CommandCodes::deserialize( de );
result &= de.read( reinterpret_cast<fb_quadlet_t*>( &m_resp_max_block_size ) );
return result;
}
////////////////////////////////
BeBoB::CommandCodesDownloadBlock::CommandCodesDownloadBlock(
fb_quadlet_t protocolVersion )
: CommandCodes( protocolVersion,
eCmdC_DownloadBlock,
12,
3,
2 )
, m_seqNumber( 0 )
, m_address ( 0 )
, m_resp_seqNumber( 0 )
, m_resp_errorCode( 0 )
{
}
BeBoB::CommandCodesDownloadBlock::~CommandCodesDownloadBlock()
{
}
bool
BeBoB::CommandCodesDownloadBlock::serialize( IOSSerialize& se )
{
bool result = CommandCodes::serialize( se );
result &= se.write( m_seqNumber, "CommandCodesDownloadBlock: sequence number" );
result &= se.write( m_address, "CommandCodesDownloadBlock: address" );
result &= se.write( m_numBytes, "CommandCodesDownloadBlock: number of bytes" );
return result;
}
bool
BeBoB::CommandCodesDownloadBlock::deserialize( IISDeserialize& de )
{
bool result = CommandCodes::deserialize( de );
result &= de.read( &m_resp_seqNumber );
result &= de.read( &m_resp_errorCode );
return result;
}
////////////////////////////////
BeBoB::CommandCodesDownloadEnd::CommandCodesDownloadEnd(
fb_quadlet_t protocolVersion )
: CommandCodes( protocolVersion, eCmdC_DownloadEnd, 2, 0, 2 )
{
}
BeBoB::CommandCodesDownloadEnd::~CommandCodesDownloadEnd()
{
}
bool
BeBoB::CommandCodesDownloadEnd::serialize( IOSSerialize& se )
{
return CommandCodes::serialize( se );
}
bool
BeBoB::CommandCodesDownloadEnd::deserialize( IISDeserialize& de )
{
bool result = CommandCodes::deserialize( de );
result &= de.read( &m_resp_crc32 );
result &= de.read( &m_resp_valid );
return result;
}
////////////////////////////////
BeBoB::CommandCodesInitializePersParam::CommandCodesInitializePersParam(
fb_quadlet_t protocolVersion )
: CommandCodes( protocolVersion, eCmdC_InitPersParams, 0, 0, 0 )
{
}
BeBoB::CommandCodesInitializePersParam::~CommandCodesInitializePersParam()
{
}
bool
BeBoB::CommandCodesInitializePersParam::serialize( IOSSerialize& se )
{
return CommandCodes::serialize( se );
}
bool
BeBoB::CommandCodesInitializePersParam::deserialize( IISDeserialize& de )
{
return CommandCodes::deserialize( de );
}
////////////////////////////////
BeBoB::CommandCodesInitializeConfigToFactorySetting::CommandCodesInitializeConfigToFactorySetting(
fb_quadlet_t protocolVersion )
: CommandCodes( protocolVersion, eCmdC_InitConfigToFactorySetting, 0, 0, 0 )
{
}
BeBoB::CommandCodesInitializeConfigToFactorySetting::~CommandCodesInitializeConfigToFactorySetting()
{
}
bool
BeBoB::CommandCodesInitializeConfigToFactorySetting::serialize( IOSSerialize& se )
{
return CommandCodes::serialize( se );
}
bool
BeBoB::CommandCodesInitializeConfigToFactorySetting::deserialize( IISDeserialize& de )
{
return CommandCodes::deserialize( de );
}
////////////////////////////////
BeBoB::CommandCodesGo::CommandCodesGo( fb_quadlet_t protocolVersion,
EStartMode startMode )
: CommandCodes( protocolVersion, eCmdC_Go, sizeof( m_startMode ), 1, 1 )
, m_startMode( startMode )
{
}
BeBoB::CommandCodesGo::~CommandCodesGo()
{
}
bool
BeBoB::CommandCodesGo::serialize( IOSSerialize& se )
{
bool result = CommandCodes::serialize( se );
result &= se.write( m_startMode, "CommandCodesGo: start mode" );
return result;
}
bool
BeBoB::CommandCodesGo::deserialize( IISDeserialize& de )
{
bool result = CommandCodes::deserialize( de );
result &= de.read( &m_resp_validCRC );
return result;
}
| [
"pieterpalmers@2be59082-3212-0410-8809-b0798e1608f0"
] | pieterpalmers@2be59082-3212-0410-8809-b0798e1608f0 |
a348ff7c2d276bae6f4786450983b70448e4dd4f | 3a5a2dc09a6a3fd49c65dcae0d39200af5ea5e3f | /src/core/exceptions/NoMemoryException.cpp | e49fc9d4427036fd60d103fba057e645aae28e37 | [
"BSD-3-Clause"
] | permissive | intel/ixpdimm_sw | d72ec153471bedb9c95db119e5fc422be4c66cc7 | dbd3c99f3524ca6aff80f194ff0f67d4a543b9e3 | refs/heads/master | 2023-06-06T22:02:20.199697 | 2022-08-04T22:49:58 | 2022-08-04T22:49:58 | 46,385,178 | 17 | 7 | BSD-3-Clause | 2018-03-08T20:51:05 | 2015-11-18T00:47:04 | C | UTF-8 | C++ | false | false | 1,592 | cpp | /*
* Copyright (c) 2016, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "NoMemoryException.h"
| [
"nicholas.w.moulin@intel.com"
] | nicholas.w.moulin@intel.com |
a09736a231797426d7cecda50fd1075746c9e5e1 | 03542f93a8bee33fb88413d29613c9fd59a68dde | /HW/HW5/HW5_1/RandomArray.cpp | c17365e73eb05cd91684914fef9f03cb3704aaf7 | [] | no_license | TSLsun/OOP2018_Lab_HW | 9a5286c1a5774e490740485753b195daedd6a047 | aa651d2d7fd6f4fdf4068a7493f7e0e04a5d25cb | refs/heads/master | 2020-04-01T07:47:08.348755 | 2018-12-28T12:37:05 | 2018-12-28T12:37:05 | 153,003,349 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 564 | cpp | #include <ctime>
#include <cstdlib>
#include <iostream>
#include "RandomArray.h"
time_t RandomArray::seed_time = time(0);
void RandomArray::setSeed()
{
srand(seed_time);
}
void RandomArray::loadArray()
{
this->ir = new int[this->n];
for (int i=0; i!= this->n; i++)
this->ir[i] = rand()%1000;
}
void RandomArray::printArray()
{
for (int i=0; i!= this->n; i++)
std::cout << this->ir[i] << " ";
std::cout << "\n";
}
void RandomArray::freeArray()
{
delete[] this->ir;
}
void RandomArray::setSize(int n)
{
this->n = n;
}
| [
"smartsunnytsai@gmail.com"
] | smartsunnytsai@gmail.com |
5637b764dd6ac8cf73a96649e05828fbabd370ac | aceacb5a3f1b9eea538376f3841978ae5dce1b21 | /Group_page.cpp | ed0b3e4f7e4953529009de97e6f746d88d6576fd | [] | no_license | abdelrhman2023/Mini-Facebook | a280bf17844b86df3def3e134716f5d32ee98cd0 | dc8bdf612fb5ad9770fa490fbc18bbbe5cb23068 | refs/heads/main | 2023-05-26T09:41:27.003378 | 2021-06-12T22:50:47 | 2021-06-12T22:50:47 | 370,140,974 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,337 | cpp |
#include<iostream>
#include<assert.h>
#include<string>
#include"Arrylist.cpp"
#include "Group_page.h"
using namespace std;
Group_page::Group_page() {
}
Group_page::Group_page(string group_name) {
this->group_name = group_name;
}
Group_page::Group_page(string admin_id, int admin_password) {
this->admin_id = admin_id;
this->admin_password = admin_password;
}
bool Group_page:: login() {
string ch_name = "admin";
int ch_password = 1234;
cout << "Enter user Name : ";
cin >> admin_id;
cout << "Enter your password";
cin >> admin_password;
if (admin_id == ch_name && admin_password == ch_password) {
return true;
}
else {
return false;
}
}
void Group_page:: setgroup_name(string name) {
group_name = name;
}
void Group_page::setuser_name(string name_ad) {
admin_id = name_ad;
}
void Group_page::setpassword(int pass_ad) {
admin_password = pass_ad;
}
string Group_page::getGroub_name() {
return group_name;
}
ArryList<Group_page>Group_page::getFriendsList() {
return friends;
}
/* void Group_page::addPost(Posts& post)
{
posts.Append(post);
}*/
ostream& operator<<(ostream& os, const Group_page& obj)
{
// TODO: insert return statement here
}
| [
"noreply@github.com"
] | abdelrhman2023.noreply@github.com |
6b12486c9ffa7c19a129ededa338574572ee9635 | b00cffac7bd7f62ac15cd00f378d9e135bfb59af | /bignum.h | 6d6112e86fe66235e54db2c01fcaf325121c1acb | [] | no_license | HurricaneFist/BigNum | 4a021f7d6e52d1ad746f24eaf5431c14b0a0a591 | ddbc3f6afa83e40553fdd70d5ea6385d3fc57aa5 | refs/heads/master | 2020-03-30T08:00:17.109761 | 2016-05-24T20:19:53 | 2016-05-24T20:19:53 | 59,605,512 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,988 | h | #ifndef BIGNUM_H
#define BIGNUM_H
#include <sstream>
/**
* This header file provides algorithms for addition, multiplication, and exponentiation
* of unsigned arbitrary-precision integers (AKA big numbers).
*
* https://github.com/HurricaneFist
*/
namespace BigNum {
// convert a character to an integer
int val(char c) {
return c - '0';
}
// convert an integer to a character
char unval(int n) {
return n + '0';
}
/*
* Arbitrary-precision unsigned integer. Usually used for big numbers.
* Min value = 0
* Max value = 9.999... x 10^4294967293
* A Num of max value would theoretically consume over 4 GB of memory or disk space.
*/
struct Num {
std::string digits;
Num() {
digits = "";
}
Num(std::string digits_) {
digits = digits_;
}
friend std::ostream &operator<<(std::ostream &os, const Num &n) {
os << n.digits;
return os;
}
};
// Scientific notation with significant figures
std::string scino(Num n, int sigfigs) {
std::stringstream res;
res << n.digits[0];
if (sigfigs > 1) {
res << '.';
for (int i = 1; i < sigfigs; i++) {
if (i > n.digits.length()-1)
res << '0';
else
res << n.digits[i];
}
}
res << 'E';
res << n.digits.length()-1;
return res.str();
}
std::string scino(Num n) {
return scino(n, 5);
}
std::string scino(std::string n, int sigfigs) {
return scino(Num(n), sigfigs);
}
std::string scino(std::string n) {
return scino(Num(n), 5);
}
int compare(Num x, Num y) {
if (x.digits.length() > y.digits.length())
return 1;
if (x.digits.length() < y.digits.length())
return -1;
for (int i = 0; i < x.digits.length(); i++) {
if (val(x.digits[i]) > val(y.digits[i]))
return 1;
if (val(x.digits[i]) < val(y.digits[i]))
return -1;
}
return 0;
}
Num add(Num m, Num n) {
Num x, y;
std::string sum = "";
// x will always be greater or equal to y in terms of number of digits
if (m.digits.length() >= n.digits.length()) {
x = m;
y = n;
} else {
x = n;
y = m;
}
int xind = x.digits.length()-1, yind = y.digits.length()-1;
int drem = 0, dsum;
while (xind >= 0 || yind >= 0 || drem == 1) {
dsum = drem;
if (xind >= 0) dsum += val(x.digits[xind]);
if (yind >= 0) dsum += val(y.digits[yind]);
if (dsum >= 10) {
dsum -= 10;
drem = 1;
} else drem = 0;
sum = unval(dsum) + sum;
xind--;
yind--;
}
return Num(sum);
}
Num add(std::string m, std::string n) {
return add(Num(m), Num(n));
}
Num multiply(Num m, Num n) {
if (m.digits == "0" || n.digits == "0") return Num("0");
Num x, y, product("0");
// x will always be greater or equal to y in terms of number of digits
if (m.digits.length() >= n.digits.length()) {
x = m;
y = n;
} else {
x = n;
y = m;
}
int zeroes = 0;
for (int yind = y.digits.length()-1; yind >= 0; yind--, zeroes++) {
std::string dtotal = "";
int drem = 0;
for (int i = 0; i < zeroes; i++)
dtotal = '0' + dtotal;
for (int xind = x.digits.length()-1; xind >= 0; xind--) {
int dprod = val(x.digits[xind]) * val(y.digits[yind]) + drem;
if (dprod >= 10) {
drem = dprod / 10;
dprod -= drem * 10;
} else drem = 0;
dtotal = unval(dprod) + dtotal;
}
if (drem > 0) dtotal = unval(drem) + dtotal;
product = add(product, Num(dtotal));
}
return product;
}
Num multiply(std::string m, std::string n) {
return multiply(Num(m), Num(n));
}
// Decrement a Num (down to zero)
Num decrement(Num n) {
std::string res = "";
char digit;
bool decr = true;
for (int i = n.digits.length()-1; i >= 0; i--) {
if (decr) {
if (i == 0 && n.digits[i] == '1' && n.digits.length() > 1)
break;
else if (n.digits[i] == '0')
digit = '9';
else {
digit = unval(val(n.digits[i])-1);
decr = false;
}
} else digit = n.digits[i];
res = digit + res;
}
return Num(res);
}
Num decrement(std::string n) {
return decrement(Num(n));
}
// Exponentiation. N to the power of P.
Num power(Num n, Num p) {
Num res("1");
while (p.digits != "0") {
res = multiply(n, res);
p = decrement(p);
}
return res;
}
Num power(std::string n, std::string p) {
return power(Num(n), Num(p));
}
// Compute the factorial of a Num.
Num factorial(Num n) {
if (n.digits != "0" && n.digits != "1")
return multiply(n, factorial(decrement(n)));
return Num("1");
}
Num factorial(std::string n) {
return factorial(Num(n));
}
}
#endif | [
"hurricanefist@users.noreply.github.com"
] | hurricanefist@users.noreply.github.com |
6accd5f0562bce5d2ad03ca3bd02fb7d42217164 | 4ae76cff653cac15b992e938e7758481f9ffeed3 | /MeshViewer/QtOpenGLWidget.cpp | d85f69d33e06be8aeca0f076ba1ef22e001c0e19 | [] | no_license | congcong-hehe/MeshViewer | e81d728d0fd746546775a9eea38293527fd30425 | b6fa439c3fc58d5ad4c44e692a35850a6cfd0375 | refs/heads/main | 2023-02-25T15:37:27.456242 | 2021-02-01T07:25:02 | 2021-02-01T07:25:02 | 319,618,014 | 2 | 2 | null | null | null | null | GB18030 | C++ | false | false | 2,340 | cpp | #include "QtOpenGLWidget.h"
#include <QDebug>
#include <QFileDialog>
static int x_angle = 0; // x方向旋转角度
static int y_angle = 0; // y方向旋转角度
static float zoom = 45.0f; // 视野度数
QtOpenGLWidget::QtOpenGLWidget(QWidget* parent)
: QOpenGLWidget(parent)
{
}
QtOpenGLWidget::~QtOpenGLWidget()
{
}
void QtOpenGLWidget::initializeGL()
{
ff = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_3_3_Core>();
mesh_ = new QuadMesh;
mesh_->loadFile("../model/3cube.obj");
mesh_->setMesh();
ff->glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); //设置绘制的线框模式
}
void QtOpenGLWidget::resizeGL(int width, int height)
{
ff->glViewport(0, 0, width, height);
}
void QtOpenGLWidget::paintGL()
{
// 投影变换矩阵
QMatrix4x4 projection;
projection.perspective(zoom, (float)width() / height(), 0.1f, 100.0f);
// 模型变换矩阵
QMatrix4x4 model;
model.rotate(x_angle, QVector3D(0.0f, 1.0f, 0.0f));
model.rotate(y_angle, QVector3D(1.0f, 0.0f, 0.0f));
ff->glClearColor(0.2f, 0.3f, 0.3f, 1.0f); // 清屏颜色,(背景颜色)
ff->glClear(GL_COLOR_BUFFER_BIT); // 清空颜色缓存
if (mesh_ != nullptr && !mesh_->isEmpty()) // 防止出现文件为空的情况,访问首地址越界访问
{
mesh_->drawMesh(ff, projection, model);
}
}
void QtOpenGLWidget::mousePressEvent(QMouseEvent* event)
{
if (event->button() == Qt::LeftButton)
{
mouse_pressed_ = true;
last_pos_ = event->pos();
}
}
void QtOpenGLWidget::mouseReleaseEvent(QMouseEvent* event)
{
Q_UNUSED(event);
mouse_pressed_ = false;
}
void QtOpenGLWidget::mouseMoveEvent(QMouseEvent* event)
{
if (mouse_pressed_)
{
int xpos = event->pos().x();
int ypos = event->pos().y();
int xoffset = xpos - last_pos_.x();
int yoffset = ypos - last_pos_.y();
last_pos_ = event->pos();
x_angle = (x_angle + xoffset / 2) % 360;
y_angle = (y_angle + yoffset / 2) % 360;
}
update();
}
void QtOpenGLWidget::wheelEvent(QWheelEvent* event)
{
QPoint offset = event->angleDelta();
zoom -= (float)offset.y() / 20.0f;
if (zoom < 10.0f)
zoom = 10.0f;
if (zoom > 45.0f)
zoom = 45.0f;
update();
}
| [
"heyaqihehe@163.com"
] | heyaqihehe@163.com |
f9b15bf6096df19270cfdc6688cd04f079ba574b | 2b39fffb9b36f79614eccb3e940bcebce465dc46 | /protocol/rtp_impl.cpp | c34e220ae11ce98cb4209dd3571faab04e1ed84c | [] | no_license | tonytonyfly/audioengine | d81d93f8d55165996f85c1c00de09c77b1a4b676 | 4e37f1986ae7cf0ac5fe3cd0be0adf0df6fed8cb | refs/heads/master | 2020-06-05T18:48:56.345501 | 2017-11-18T11:59:19 | 2017-11-18T11:59:19 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,234 | cpp | #include "atp.h"
#include "rtp_impl.h"
RTPImpl::RTPImpl()
{
clock_ = Clock::GetRealTimeClock();
receiver_stat_ = ReceiveStatistics::Create( clock_ );
rtp_payload_registry_ = new RTPPayloadRegistry( RTPPayloadStrategy::CreateStrategy(true) );
rtp_parse_ = RtpHeaderParser::Create();
rtp_receiver_ = RtpReceiver::CreateAudioReceiver( clock_, nullptr, this, nullptr, rtp_payload_registry_ );
RtpRtcp::Configuration configure;
configure.audio = true;
configure.bandwidth_callback = this;
configure.clock = clock_;
configure.outgoing_transport = this;
configure.rtt_stats = this;
configure.send_bitrate_observer = this;
configure.receive_statistics = receiver_stat_;
rtp_rtcp_ = RtpRtcp::CreateRtpRtcp(configure);
}
RTPImpl::~RTPImpl()
{
delete receiver_stat_;
delete rtp_payload_registry_;
delete rtp_parse_;
delete rtp_receiver_;
delete rtp_rtcp_;
delete clock_;
}
bool RTPImpl::EncodePacket( void* payload, size_t len_of_byte )
{
return true;
}
bool RTPImpl::DecodePacket( void* packet, size_t len_of_byte )
{
return true;
}
bool RTPImpl::SendRtp( const uint8_t* packet, size_t length, const webrtc::PacketOptions& options )
{
return true;
}
bool RTPImpl::SendRtcp( const uint8_t* packet, size_t length )
{
return true;
}
int32_t RTPImpl::OnReceivedPayloadData( const uint8_t* payloadData,
const size_t payloadSize,
const webrtc::WebRtcRTPHeader* rtpHeader )
{
return true;
}
bool RTPImpl::OnRecoveredPacket( const uint8_t* packet, size_t packet_length )
{
return true;
}
void RTPImpl::OnReceivedEstimatedBitrate( uint32_t bitrate )
{
}
void RTPImpl::OnReceivedRtcpReceiverReport( const webrtc::ReportBlockList& report_blocks,
int64_t rtt,
int64_t now_ms )
{
}
void RTPImpl::OnRttUpdate( int64_t rtt )
{
}
int64_t RTPImpl::LastProcessedRtt() const
{
return 0;
}
void RTPImpl::Notify( const webrtc::BitrateStatistics& total_stats,
const webrtc::BitrateStatistics& retransmit_stats,
uint32_t ssrc )
{
}
| [
"zhangnaigan_1989@163.com"
] | zhangnaigan_1989@163.com |
5464ff8e7c937bc81fa5402de0aee6dcb8f906f5 | df140b749b654e3bfa70e92b91a4433c91017b6a | /Lab2/word/index.cpp | 96d497fb6c1f12f1e34e00b7a45d4625646a4db7 | [] | no_license | nnaaaa/dsa | 1a19e9d15f2f2ebe49eccd7231f0c079f28b2a38 | 4915565a14f2df17b23184874ab6ab2125667d7f | refs/heads/main | 2023-07-16T17:57:22.811788 | 2021-09-04T16:34:45 | 2021-09-04T16:34:45 | 395,194,733 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,276 | cpp | #include <iostream>
#include <stdio.h>
#include <fstream>
#include <vector>
#include <string>
#include <stdio.h>
using namespace std;
int *countWord(vector <string> clone,int &c_assign,int &c_compare){
vector <string> word;
int *count = new int[clone.size()];
c_assign+=2;
for (int i = 0;++c_compare && i < clone.size();++c_assign && ++i){
bool repeat = false;
count[i] = 1;
c_assign += 2;
for (int j = 0;++c_compare && j < word.size();++c_assign && ++j){
if (++c_compare && word[j] == clone[i]){
count[j]++;
repeat = true;
c_assign += 2;
break;
}
}
if (++c_compare && !repeat){
++c_assign;
word.push_back(clone[i]);
}
}
return count;
}
int *countWord2(vector <string> clone,int &c_assign,int &c_compare){
for (int i = 0; i < clone.size()-1; ++i){
for (int j = i + 1; j < clone.size(); ++j){
if ( clone[i].compare(clone[j]) < 0){
string temp = clone[i];
clone[i] = clone[j];
clone[j] = temp;
}
}
}
int *count = new int[clone.size()];
int index = 0;
c_assign += 3;
for (int i = 0;++c_compare && i < clone.size()-1;++c_assign && ++i){
if (++c_compare && clone[i].compare(clone[i+1]) == 0){
++c_assign;
count[index]++;
}
else{
++c_assign;
count[index++]++;
}
}
return count;
}
int main()
{
vector <string> randomArr{"nguyenanh","end","start","connect","out","the","quit"};
vector<string> a;
ofstream f("word.txt");
ofstream f2("word2.txt");
for (int i = 0;i<=500;i+=10)
{
for (int j = 0; j <= i;++j){
int x = rand() % 7;
a.push_back(randomArr[x]);
}
int c_assign = 0, c_compare = 0;
int *arr = countWord(a,c_assign,c_compare);
f << i << " " << c_assign << " " << c_compare << endl;
c_assign = 0;
c_compare = 0;
int *arr2 = countWord2(a,c_assign,c_compare);
f2 << i << " " << c_assign << " " << c_compare << endl;
}
system("pause");
return 0;
}
| [
"nngguyen.anh@gmail.com"
] | nngguyen.anh@gmail.com |
6cb90584f1108b979495562f83ac163345d584e8 | 72fdf2efd7d9e8c4e15c9a9f7d6b595bc540cfa4 | /Tests/include/ListLogHandler.hpp | f593f0b061bd4e79d66c2091ad4f7b2cfd7a65e3 | [
"BSD-3-Clause"
] | permissive | BlockProject3D/Engine | 0222cb25b797ed7566acf4679c01027189555664 | 6de000b335c374fe47a5df3d98a716aadb1967c9 | refs/heads/master | 2021-04-20T13:38:28.886449 | 2020-08-05T21:04:30 | 2020-08-05T21:04:30 | 249,688,344 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,030 | hpp | // Copyright (c) 2020, BlockProject
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of BlockProject nor the names of its contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#pragma once
#include <Framework/Log/ILogAdapter.hpp>
#include <Framework/Collection/List.hpp>
class ListLogHandler final : public bpf::log::ILogAdapter
{
private:
bpf::collection::List<bpf::String> &_logs;
public:
explicit inline ListLogHandler(bpf::collection::List<bpf::String> &lst)
: _logs(lst)
{
}
void LogMessage(bpf::log::ELogLevel level, const bpf::String &category, const bpf::String &msg) final;
};
| [
"nicolas1.fraysse@epitech.eu"
] | nicolas1.fraysse@epitech.eu |
28347f87ba7d6a950832025c3ceeab2ebbe369e5 | d7cca7519e5c3b3b728a2a0646a5aeb1a9563eeb | /source/development/device-api/device-server-writing/cpp_exchanging/any.cpp | 65f1fb16c902060e7286da0e9b54c36793e644c0 | [] | no_license | tango-controls/tango-doc | b0354144eb873e3af550365f9becb42638e86e73 | d6115b8216ca590b1d47e17046bf71e8af438cb9 | refs/heads/master | 2021-07-15T20:17:32.897753 | 2021-02-04T19:00:35 | 2021-02-04T19:00:35 | 69,636,146 | 10 | 30 | null | 2021-02-24T21:21:51 | 2016-09-30T05:19:33 | TeX | UTF-8 | C++ | false | false | 561 | cpp | CORBA_Any a;
Tango_DevLong l1,l2;
l1 = 2;
a <<= l1;
a >>= l2;
CORBA_Any b;
Tango_DevBoolean b1,b2;
b1 = true;
b <<= CORBA_Any::from_boolean(b1);
b >>= CORBA_Any::to_boolean(b2);
CORBA_Any s;
Tango_DevString str1,str2;
str1 = "I like dancing TANGO";
a <<= str1;
a >>= str2;
// CORBA_string_free(str2);
// a <<= CORBA_string_dup("Oups");
CORBA_Any seq;
Tango_DevVarFloatArray fl_arr1;
fl_arr1.length(2);
fl_arr1[0] = 1.0;
fl_arr1[1] = 2.0;
seq <<= fl_arr1;
Tango_DevVarFloatArray *fl_arr_ptr;
seq >>= fl_arr_ptr;
// delete fl_arr_ptr;
| [
"piotr.goryl@3-controls.com"
] | piotr.goryl@3-controls.com |
62e0760680b96761aa33a62a420e80ba00630243 | fb0ecd924b6529bb31bdc2e0ffa12e60ae641cf9 | /src/common/ThreadManager.h | f14fc6978814ba9c6893696d2bbe418c68d0a4d6 | [
"Apache-2.0"
] | permissive | huiqiaoqiu/Hercules | 3aa272165f79eeb57f6db29c51fbf0a3688102d3 | aa245e08474e60bf0903ca182a5884a8047be3ec | refs/heads/master | 2023-06-15T19:31:11.640163 | 2021-06-21T03:55:45 | 2021-06-21T03:55:45 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,894 | h | // Copyright 2021 HUYA
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include "Singleton.h"
#include "Common.h"
#include "Log.h"
#include <map>
#include <thread>
#include <mutex>
#include <utility>
#include <string>
namespace hercules
{
class ThreadManager : public Singleton<ThreadManager>
{
friend class Singleton<ThreadManager>;
private:
ThreadManager()
{
}
~ThreadManager()
{
}
public:
void registerThread(std::thread::id id, const std::string &name, std::thread *t)
{
std::unique_lock<std::mutex> lockGuard(m_mutex);
m_threads[id] = make_pair(name, t);
logInfo(MIXLOG << "register thread: " << name);
}
void unregisterThread(std::thread::id id)
{
std::unique_lock<std::mutex> lockGuard(m_mutex);
std::string name = "";
auto iter = m_threads.find(id);
if (iter != m_threads.end())
{
name = iter->second.first;
}
logInfo(MIXLOG << "unregister thread: " << name << ", id: " << id);
m_threads.erase(id);
}
void dumpAllThread()
{
std::unique_lock<std::mutex> lockGuard(m_mutex);
logInfo(MIXLOG << "thread num: " << m_threads.size());
std::map<std::string, int> threadStatistic;
for (const auto &kv : m_threads)
{
threadStatistic[kv.second.first]++;
}
for (const auto &kv : threadStatistic)
{
logInfo(MIXLOG << "thread: " << kv.first << ", count: " << kv.second);
}
}
void joinAllThread()
{
std::unique_lock<std::mutex> lockGuard(m_mutex);
logInfo(MIXLOG << "thread num: " << m_threads.size());
auto iter = m_threads.begin();
while (!m_threads.empty())
{
std::thread *t = iter->second.second;
if (t != nullptr)
{
t->join();
}
iter = m_threads.erase(iter);
}
}
private:
std::mutex m_mutex;
std::map<std::thread::id, std::pair<std::string, std::thread *>> m_threads;
};
} // namespace hercules
| [
"674913892@qq.com"
] | 674913892@qq.com |
69561bc3145a4f6ccdba59817ead744521eb6aca | aa8a7cb9058b9c68e9688fe650124ba518a3bbc9 | /Assignment1/Source/MovableCamera.cpp | d6fc0b19af05db603fff5066d47c366a20dbd76d | [] | no_license | kiozune/Climbing-Simulator | 162b6568be477cb6015574a49eb2f50ead528364 | c018ec9cf6287cfc1bea9a3fb8073cdde64d6cc0 | refs/heads/master | 2020-04-22T08:17:36.757266 | 2019-02-27T20:11:36 | 2019-02-27T20:11:36 | 170,239,626 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,335 | cpp | #include "MovableCamera.h"
#include "Utility.h"
void MoveableCamera::update()
{
front.x = cos(rad(yaw)) * cos(rad(pitch));
front.y = sin(rad(pitch));
front.z = sin(rad(yaw)) * cos(rad(pitch));
if (front.IsZero()) return;
front = front.Normalize();
right = front.Cross(worldUp).Normalize();
up = right.Cross(front).Normalize();
target = position + front;
forward = right.Cross(worldUp).Normalize();
}
void MoveableCamera::setTarget(Vector3 target) {}
void MoveableCamera::move(const double dt)
{
GLfloat velocity = moveSpeed * dt;
if (Application::IsKeyPressed('W'))
position -= forward * velocity;
if (Application::IsKeyPressed('S'))
position += forward * velocity;
if (Application::IsKeyPressed('A'))
position -= right * velocity;
if (Application::IsKeyPressed('D'))
position += right * velocity;
if (Application::IsKeyPressed(VK_SHIFT))
position -= worldUp * velocity;
if (Application::IsKeyPressed(VK_SPACE))
position += worldUp * velocity;
}
void MoveableCamera::lookAround(GLfloat xPos, GLfloat yPos)
{
GLfloat xDiff = (xPos - prevX) / 10.0;
GLfloat yDiff = (yPos - prevY) / 10.0;
if (xDiff) yaw += xDiff;
if (yDiff) pitch -= yDiff;
// lock pitch
if (pitch > 89)
pitch = 89;
else if (pitch < -89)
pitch = -89;
prevX = xPos, prevY = yPos;
// update vectors
update();
}
| [
"jameslimbj@gmail.com"
] | jameslimbj@gmail.com |
a9345df1e90fd0a1a130ba2405222ec2a5561bf9 | 28c000caf6617ba2074e0f2a8fc936ccb8c01fb3 | /poj/1394/6565061_WA.cc | 5997e22e2c7235541adeea90b25307eb9f000483 | [] | no_license | ATM006/acm_problem_code | f597fa31033fd663b14d74ad94cae3f7c1629b99 | ac40d230cd450bcce60df801eb3b8ce9409dfaac | refs/heads/master | 2020-08-31T21:34:00.707529 | 2014-01-23T05:30:42 | 2014-01-23T05:30:42 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,014 | cc | #include <cstdio>
#include <cstring>
#include <map>
#include <queue>
#include <string>
using namespace std;
struct edge{
int to;
int d;
edge *next;
}edg[100002],*vert[102];
struct QN{
int u;
int start,d;
bool operator <(const QN &a)const{
if(a.d==d)
return a.start>start;
return a.d<d;
}
};
int dis[102];
void add_edge(int x,int y,int tim1,int tim2,int &top){
edge *p=&edg[++top];
p->to=y;
p->d=tim1*10000+tim2;
p->next=vert[x]; vert[x]=p;
}
void dijkstra(int s,int t,int &st,int &ed,int X,int n){
QN now,next;
priority_queue<QN>Q;
for(int i=0;i<n;i++)dis[i]=10000;
for(edge *p=vert[s];p;p=p->next){
if(p->d/10000>=X){
now.u=p->to;
now.start=p->d/10000;
now.d=p->d%10000;
Q.push(now);
}
}
while(!Q.empty()){
now=Q.top();Q.pop();
//printf("%d %d\n",now.u,now.d);
if(now.u==t){
st=now.start;ed=now.d;
return ;
}
int u=now.u;
int d=now.d;
for(edge *p=vert[u];p;p=p->next){
if(p->d/10000>=d&&(p->d%10000<dis[p->to])){
now.u=p->to;
now.d=p->d%10000;
dis[p->to]=p->d%10000;
Q.push(now);
}
}
}
}
int main()
{
int nca=1,n;
while(scanf("%d",&n),n){
char sta[50],end[50];
map<string,int>mp;
map<string,int>::iterator p,q;
for(int i=0;i<n;i++){
scanf("%s",sta);
mp[sta]=i;
}
int T,top=-1;
memset(vert,0,sizeof(vert));
scanf("%d",&T);
for(int i=0;i<T;i++){
int u,v,m,tim1,tim2;
scanf("%d",&m);
for(int j=0;j<m;j++){
scanf("%d%s",&tim2,end);
if(j!=0){
p=mp.find(sta);
q=mp.find(end);
if(p!=mp.end()&&q!=mp.end()&&tim1<=tim2){
u=p->second;
v=q->second;
add_edge(u,v,tim1,tim2,top);
}
}
strcpy(sta,end);
tim1=tim2;
}
}
scanf("%d%s%s",&T,sta,end);
int u=-1,v=-1;
p=mp.find(sta);
if(p!=mp.end())
u=p->second;
p=mp.find(end);
if(p!=mp.end())
v=p->second;
printf("Scenario #%d\n",nca++);
if(u==-1||v==-1){
puts("No connection\n");
}
else{
int tim1=-1,tim2=1000000;
dijkstra(u,v,tim1,tim2,T,n);
if(tim2==1000000)
puts("No connection\n");
else{
printf("Departure %.4d %s\n",tim1,sta);
printf("Arrival %.4d %s\n\n",tim2,end);
}
}
}
return 0;
}
| [
"wangjunyong@doodlemobile.com"
] | wangjunyong@doodlemobile.com |
db94f32db8c711bc743614f9b7cc2e3c2c4ff2a7 | 5fa00ff2f8f6e903c706d6731ee69c20e5440e5f | /src/shared/LogWriter.cpp | 5b93fe9304dfb40a5087007a60571358682d7e4d | [
"MIT"
] | permissive | 5433D-R32433/pcap-ndis6 | 9e93d8b47ebe0b68373785323be92c57c90669e2 | 77c9f02f5a774a5976e7fb96f667b5abb335d299 | refs/heads/master | 2022-01-13T07:58:42.002164 | 2019-06-24T00:24:02 | 2019-06-24T00:24:02 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,523 | cpp | //////////////////////////////////////////////////////////////////////
// Project: pcap-ndis6
// Description: WinPCAP fork with NDIS6.x support
// License: MIT License, read LICENSE file in project root for details
//
// Copyright (c) 2019 Change Dynamix, Inc.
// All Rights Reserved.
//
// https://changedynamix.io/
//
// Author: Andrey Fedorinin
//////////////////////////////////////////////////////////////////////
#include "LogWriter.h"
#include "CommonDefs.h"
#include "StrUtils.h"
#include "MiscUtils.h"
#include <vector>
std::wstring CLogWriter::InternalFormatMessage(
__in const std::wstring &Message)
{
return UTILS::STR::FormatW(
L"[%s] %04x %s",
UTILS::STR::GetTimeStr().c_str(),
GetCurrentThreadId(),
Message.c_str());
};
void CLogWriter::InternalLogMessage(
__in const std::wstring &Message)
{
UNREFERENCED_PARAMETER(Message);
};
void CLogWriter::InternalLogOSDetails()
{
std::wstring Message = UTILS::STR::FormatW(
L"%s\n",
UTILS::MISC::GetOSVersionInfoStrFromRegistry().c_str());
InternalLogMessage(Message);
};
CLogWriter::CLogWriter():
CCSObject()
{
};
CLogWriter::~CLogWriter()
{
};
void CLogWriter::LogMessage(
__in const std::wstring &Message)
{
std::wstring FormattedMessage =
InternalFormatMessage(Message);
Enter();
try
{
InternalLogMessage(FormattedMessage);
}
catch (...)
{
}
Leave();
};
void CLogWriter::LogMessage(
__in LPCWSTR Message)
{
Enter();
try
{
InternalLogMessage(Message);
}
catch (...)
{
}
Leave();
};
void CLogWriter::LogMessageFmt(
__in const std::wstring Format,
__in ...)
{
va_list ArgList;
va_start(ArgList, Format);
DWORD BufferChCnt = _vscwprintf(Format.c_str(), ArgList);
if (BufferChCnt > 0)
{
std::vector<wchar_t> Buffer;
Buffer.resize(BufferChCnt + 2, 0);
if (_vsnwprintf_s(
&Buffer[0],
BufferChCnt + 1,
BufferChCnt + 1,
Format.c_str(),
ArgList) > 0)
{
LogMessage(&Buffer[0]);
}
}
va_end(ArgList);
};
void CLogWriter::LogOSDetails()
{
Enter();
__try
{
InternalLogOSDetails();
}
__finally
{
Leave();
}
}; | [
"andrey.fedorinin.wrk@gmail.com"
] | andrey.fedorinin.wrk@gmail.com |
cd069c396c5ae70315145d43089e7660f0cd2347 | cd433b32df1cc7d3d18f23eb1c10e8bcacd7f1b8 | /ClearEEPROM/testStringtoInt/testStringtoInt.ino | 0ec2101b317be9519cac4d63c44cf859166554f2 | [] | no_license | criticalhitx/ArduinoTA | 9818f2a466df01f114fba2ab4fa2d7fc6f175b34 | ffd3754b02f4dfa2ef37da3761a2d6624e5c8bce | refs/heads/master | 2020-07-12T02:13:45.133498 | 2019-12-27T17:59:57 | 2019-12-27T17:59:57 | 204,691,361 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 631 | ino | #include<EEPROM.h>
//Use 120-125
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
EEPROM.begin(512);
writeKeyEEPROM("176184",24,29);
}
void loop() {
// put your main code here, to run repeatedly:
}
void writeKeyEEPROM (String key,int startadd,int untiladd)
{
int count = 0;
for (int i=startadd;i<=untiladd;i++)
{
EEPROM.write(i, key[count]);
count++;
}
EEPROM.commit();
}
String readKey (int startadd, int untiladd)
{
String key;
for (int i=startadd;i<=untiladd;i++)
{
char karakter = char(EEPROM.read(i));
key = String (key+karakter);
}
return key;
}
| [
"clink200032@gmail.com"
] | clink200032@gmail.com |
17038f6365fa76c694e4cfc5f2f98239f174357d | b5275b89d28a1182c126e6af6369d95f297536a2 | /AlgorithmTraining/IOI/2007/miners.cpp | 65b18ed1fb0639e8b7d19ed9a6c8b4420081de41 | [] | no_license | riryk/AlgorithmTraining | b84722dee58cfe76e61bb721da351a596b44ec2c | 5d232180a603bb445c784d1bbba532d81ed904a5 | refs/heads/master | 2021-08-04T16:49:02.050175 | 2021-07-22T14:31:43 | 2021-07-22T14:31:43 | 102,188,532 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,022 | cpp | #include "stdafx.h"
#include <vector>
#include <map>
#include <algorithm>
#include <errno.h>
using namespace System;
using namespace std;
int A[100000];
int N;
int dp[16][16][100000];
// supply: 1, 2, 3.
// prev supply 000000aabb
int getScore(int prevsupply, int supply)
{
int a = (prevsupply >> 2);
int b = (prevsupply & 3);
int c = supply;
int total = ((1 << a)|(1 << b)|(1 << c)) & 14;
int bitcount = ((total >> 2) & 1) + ((total >> 3) & 1) + ((total >> 4) & 1);
return bitcount;
}
int solve(int m1, int m2, int i)
{
if (i == N) return 0;
return min(solve(((m1 << 2)|A[i])&15, m2, i + 1) + getScore(m1, A[i]),
solve(m1, ((m2 << 2)|A[i])&15, i + 1) + getScore(m2, A[i]));
}
int solvedp(int m1, int m2, int i)
{
if (i == N) return 0;
if (dp[m1][m2][i] != -1) return dp[m1][m2][i];
int result = min(solve(((m1 << 2)|A[i])&15, m2, i + 1) + getScore(m1, A[i]),
solve(m1, ((m2 << 2)|A[i])&15, i + 1) + getScore(m2, A[i]));
dp[m1][m2][i] = result;
return result;
}
| [
"Ruslan_Iryk@epam.com"
] | Ruslan_Iryk@epam.com |
e733e63c172cdf6eb0156c44cf7d6490fa0f034d | 0141a8f26284dbfd824d9b054a899f6b6d7510eb | /abc/abc/100-150/abc139/d.cpp | d5eefbf45876cea9bf56ac7ffff7463d4345f105 | [] | no_license | yunotama/atcoder | 2da758f479da6aaaa17c88f13995e42554cb0701 | ddb16580416d04abaa6c4d543dc82a62706d283a | refs/heads/master | 2021-03-15T06:20:52.038947 | 2020-03-12T13:19:34 | 2020-03-12T13:19:34 | 246,830,843 | 0 | 0 | null | 2020-03-12T13:19:36 | 2020-03-12T12:39:16 | null | UTF-8 | C++ | false | false | 184 | cpp | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
int main()
{
long long n;
cin >> n;
cout << (n - 1) * n / 2 << endl;
} | [
"kabi.hiroya@gmail.com"
] | kabi.hiroya@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.